00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef INDRI_TRECDOCUMENTITERATOR_HPP
00020 #define INDRI_TRECDOCUMENTITERATOR_HPP
00021
00022 #include "indri/DocumentIterator.hpp"
00023 #include "indri/Buffer.hpp"
00024 #include "indri/UnparsedDocument.hpp"
00025 #include <string>
00026 #include <fstream>
00027
00028 class TaggedDocumentIterator : public DocumentIterator {
00029 private:
00030 UnparsedDocument _document;
00031 FILE* _in;
00032 Buffer _buffer;
00033 std::string _lastMetadataTag;
00034 std::string _fileName;
00035
00036 bool _readLine( char*& beginLine, size_t& lineLength );
00037
00038 const char* _startDocTag;
00039 const char* _endDocTag;
00040 const char* _endMetadataTag;
00041
00042 int _startDocTagLength;
00043 int _endDocTagLength;
00044 int _endMetadataTagLength;
00045
00046 public:
00047 TaggedDocumentIterator();
00048 ~TaggedDocumentIterator();
00049
00050 void setTags( const char* startDoc, const char* endDoc, const char* endMetadata );
00051
00052 void open( const std::string& filename );
00053 void close();
00054
00055 UnparsedDocument* nextDocument();
00056 };
00057
00058 #endif // INDRI_TRECDOCUMENTITERATOR_HPP