00001 00004 /* ----START-LICENCE---- 00005 * Copyright 1999,2000,2001 BrightStation PLC 00006 * Copyright 2002 Ananova Ltd 00007 * Copyright 2002,2003 Olly Betts 00008 * 00009 * This program is free software; you can redistribute it and/or 00010 * modify it under the terms of the GNU General Public License as 00011 * published by the Free Software Foundation; either version 2 of the 00012 * License, or (at your option) any later version. 00013 * 00014 * This program is distributed in the hope that it will be useful, 00015 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00017 * GNU General Public License for more details. 00018 * 00019 * You should have received a copy of the GNU General Public License 00020 * along with this program; if not, write to the Free Software 00021 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 00022 * USA 00023 * -----END-LICENCE----- 00024 */ 00025 00026 #ifndef XAPIAN_INCLUDED_DOCUMENT_H 00027 #define XAPIAN_INCLUDED_DOCUMENT_H 00028 00029 #include <string> 00030 00031 #include <xapian/base.h> 00032 #include <xapian/types.h> 00033 00034 namespace Xapian { 00035 00036 class TermIterator; 00037 class ValueIterator; 00038 00040 class Document { 00041 public: 00042 class Internal; 00044 Xapian::Internal::RefCntPtr<Internal> internal; 00045 00046 public: 00051 explicit Document(Internal *internal_); 00052 00056 Document(const Document &other); 00057 00061 void operator=(const Document &other); 00062 00064 Document(); 00065 00067 ~Document(); 00068 00070 std::string get_value(Xapian::valueno value) const; 00071 00073 // same number. 00074 void add_value(Xapian::valueno valueno, const std::string &value); 00075 00077 void remove_value(Xapian::valueno valueno); 00078 00080 void clear_values(); 00081 00087 std::string get_data() const; 00088 00090 void set_data(const std::string &data); 00091 00106 void add_posting(const std::string & tname, 00107 Xapian::termpos tpos, 00108 Xapian::termcount wdfinc = 1); 00109 00120 void add_term_nopos(const std::string & tname, 00121 Xapian::termcount wdfinc = 1); 00122 00142 void remove_posting(const std::string & tname, 00143 Xapian::termpos tpos, 00144 Xapian::termcount wdfdec = 1); 00145 00153 void remove_term(const std::string & tname); 00154 00156 void clear_terms(); 00157 00159 Xapian::termcount termlist_count() const; 00160 00162 TermIterator termlist_begin() const; 00163 00165 TermIterator termlist_end() const; 00166 00168 Xapian::termcount values_count() const; 00169 00171 ValueIterator values_begin() const; 00172 00174 ValueIterator values_end() const; 00175 00180 std::string get_description() const; 00181 }; 00182 00183 } 00184 00185 #endif // XAPIAN_INCLUDED_DOCUMENT_H