00001 // 00002 // Part of the ht://Dig package <http://www.htdig.org/> 00003 // Copyright (c) 1999, 2000, 2001 The ht://Dig Group 00004 // For copyright details, see the file COPYING in your distribution 00005 // or the GNU General Public License version 2 or later 00006 // <http://www.gnu.org/copyleft/gpl.html> 00007 // 00008 // $Id: WordResults_8h-source.html,v 1.1 2008/06/08 10:13:23 sebdiaz Exp $ 00009 // 00010 00011 #ifndef _WordResults_h_ 00012 #define _WordResults_h_ 00013 00014 #include <stdio.h> 00015 #include <stdlib.h> 00016 00017 #include "db.h" 00018 #include <htString.h> 00019 #include <WordKey.h> 00020 #include <WordKeySemantic.h> 00021 #include <WordMatch.h> 00022 00023 class WordContext; 00024 00025 class WordResults 00026 { 00027 public: 00028 WordResults(WordContext* ncontext) : 00029 key_semantic(ncontext) { 00030 context = ncontext; 00031 variables = 0; 00032 variables_cursor = 0; 00033 sorted = 0; 00034 sorted_cursor = 0; 00035 ranked = 0; 00036 ranked_cursor = 0; 00037 uniq = 0; 00038 uniq_cursor = 0; 00039 dbenv = 0; 00040 document_length = 0; 00041 document_offset = 0; 00042 uniq_offset = 0; 00043 name = 0; 00044 verbose = 0; 00045 } 00046 ~WordResults() { 00047 Close(); 00048 } 00049 00050 void Verbose(int nverbose) { verbose = nverbose; } 00051 00052 int Open(char* name); 00053 int Close(); 00054 00055 int KeySemantic(const WordKeySemantic& nkey_semantic); 00056 00057 int Filled() const; 00058 int Exists(const WordKey& key) const; 00059 int UniqExists(const WordKey& key) const; 00060 int Put(const WordMatch& match, unsigned int position); 00061 int Get(WordMatches* matches, unsigned int length, unsigned int position) const; 00062 00063 int PutContext(const String& context_out); 00064 int GetContext(String& context_in) const; 00065 00066 int PutMatchesTotal(unsigned int matches_total); 00067 int GetMatchesTotal(unsigned int& matches_total) const; 00068 00069 int Count(unsigned int& count) const; 00070 00071 private: 00072 WordContext* context; 00073 WordKeySemantic key_semantic; 00074 DB* variables; 00075 DBC* variables_cursor; 00076 DB* sorted; 00077 DBC* sorted_cursor; 00078 DB* ranked; 00079 DBC* ranked_cursor; 00080 DB* uniq; 00081 DBC* uniq_cursor; 00082 DB* info; 00083 DBC* info_cursor; 00084 DB_ENV* dbenv; 00085 int document_length; 00086 int document_offset; 00087 int uniq_offset; 00088 char* name; 00089 int verbose; 00090 }; 00091 #endif /* _WordResults_h_ */