CLucene - a full-featured, c++ search engine
API Documentation
00001 /*------------------------------------------------------------------------------ 00002 * Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team 00003 * 00004 * Distributable under the terms of either the Apache License (Version 2.0) or 00005 * the GNU Lesser General Public License, as specified in the COPYING file. 00006 ------------------------------------------------------------------------------*/ 00007 #ifndef _lucene_document_Document_ 00008 #define _lucene_document_Document_ 00009 00010 #if defined(_LUCENE_PRAGMA_ONCE) 00011 # pragma once 00012 #endif 00013 00014 #include "Field.h" 00015 00018 CL_NS_DEF(document) 00019 00020 class Document; //predefine 00021 class DocumentFieldEnumeration :LUCENE_BASE{ 00022 class DocumentFieldList :LUCENE_BASE{ 00023 public: 00024 DocumentFieldList(Field* f, DocumentFieldList* n); 00025 ~DocumentFieldList(); 00026 Field* field; 00027 DocumentFieldList* next; 00028 }; 00029 friend class Document; 00030 private: 00031 const DocumentFieldList* fields; 00032 public: 00033 DocumentFieldEnumeration(const DocumentFieldList* fl); 00034 ~DocumentFieldEnumeration(); 00035 bool hasMoreElements() const; 00036 Field* nextElement(); 00037 }; 00038 00052 class Document:LUCENE_BASE { 00053 private: 00054 DocumentFieldEnumeration::DocumentFieldList* fieldList; 00055 float_t boost; 00056 public: 00057 Document(); 00058 ~Document(); 00059 00071 void add(Field& field); 00077 Field* getField(const TCHAR* name) const; 00078 00085 const TCHAR* get(const TCHAR* field) const; 00086 00088 DocumentFieldEnumeration* fields() const; 00090 TCHAR* toString() const; 00091 00101 void setBoost(float_t boost); 00102 00114 float_t getBoost() const; 00115 00116 00128 void removeField(const TCHAR* name); 00129 00140 void removeFields(const TCHAR* name); 00141 00150 TCHAR** getValues(const TCHAR* name); 00151 00155 void clear(); 00156 }; 00157 CL_NS_END 00158 #endif