Lucene++ - a full-featured, c++ search engine
API Documentation

- Main Page
- Related Pages
- Namespaces
- Data Structures
- Files

- File List
- Globals

All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
CompoundFileReader.h
Go to the documentation of this file.
1 // Copyright (c) 2009-2011 Alan Wright. All rights reserved.
3 // Distributable under the terms of either the Apache License (Version 2.0)
4 // or the GNU Lesser General Public License.
6
7 #ifndef COMPOUNDFILEREADER_H
8 #define COMPOUNDFILEREADER_H
9
10 #include "Directory.h"
11 #include "BufferedIndexInput.h"
12
13 namespace Lucene
14 {
18 class CompoundFileReader : public Directory
19 {
20 public:
21 CompoundFileReader(DirectoryPtr dir, const String& name);
22 CompoundFileReader(DirectoryPtr dir, const String& name, int32_t readBufferSize);
23 virtual ~CompoundFileReader();
24
25 LUCENE_CLASS(CompoundFileReader);
26
27 protected:
28 struct FileEntry
29 {
30 FileEntry(int64_t offset = 0, int64_t length = 0)
31 {
32 this->offset = offset;
33 this->length = length;
34 }
35 int64_t offset;
36 int64_t length;
37 };
38 typedef boost::shared_ptr<FileEntry> FileEntryPtr;
39 typedef HashMap<String, FileEntryPtr> MapStringFileEntryPtr;
40
41 DirectoryPtr directory;
42 String fileName;
43 int32_t readBufferSize;
44 IndexInputPtr stream;
45 MapStringFileEntryPtr entries;
46
47 protected:
48 void ConstructReader(DirectoryPtr dir, const String& name, int32_t readBufferSize);
49
50 public:
51 DirectoryPtr getDirectory();
52 String getName();
53 virtual void close();
54 virtual IndexInputPtr openInput(const String& name);
55 virtual IndexInputPtr openInput(const String& name, int32_t bufferSize);
56
58 virtual HashSet<String> listAll();
59
61 virtual bool fileExists(const String& name);
62
64 virtual uint64_t fileModified(const String& name);
65
67 virtual void touchFile(const String& name);
68
70 virtual void deleteFile(const String& name);
71
73 virtual void renameFile(const String& from, const String& to);
74
76 virtual int64_t fileLength(const String& name);
77
79 virtual IndexOutputPtr createOutput(const String& name);
80
82 virtual LockPtr makeLock(const String& name);
83 };
84
86 class CSIndexInput : public BufferedIndexInput
87 {
88 public:
89 CSIndexInput();
90 CSIndexInput(IndexInputPtr base, int64_t fileOffset, int64_t length);
91 CSIndexInput(IndexInputPtr base, int64_t fileOffset, int64_t length, int32_t readBufferSize);
92 virtual ~CSIndexInput();
93
94 LUCENE_CLASS(CSIndexInput);
95
96 public:
97 IndexInputPtr base;
98 int64_t fileOffset;
99 int64_t _length;
100
101 public:
103 virtual void close();
104
105 virtual int64_t length();
106
108 virtual LuceneObjectPtr clone(LuceneObjectPtr other = LuceneObjectPtr());
109
110 protected:
115 virtual void readInternal(uint8_t* b, int32_t offset, int32_t length);
116
119 virtual void seekInternal(int64_t pos);
120 };
121 }
122
123 #endif

clucene.sourceforge.net