Main Page | Alphabetical List | Class List | File List | Class Members

Document Class Reference

List of all members.

Public Member Functions

 Document ()
 Document (const char *draft)
 Document (ESTMTDB *db, int number, int options)
 ~Document ()
void add_attr (const char *name, const char *value)
void add_text (const char *text)
void add_hidden_text (const char *text)
int get_id ()
std::vector< std::string > * get_attr_names ()
const char * get_attr (const char *name)
const char * text ()
const char * get_dump_draft ()
const char * make_snippet (std::vector< std::string > _words, int wwidth, int hwidth, int awidth)
bool scan_words (std::vector< std::string > _words)

Public Attributes

ESTDOC * doc

Private Attributes

std::string text_buf

Constructor & Destructor Documentation

Document::Document  )  [inline]
 

constructor

Definition at line 65 of file HyperEstraierWrapper.cpp.

References doc.

00065                {
00069         doc = est_doc_new();
00070     }

Document::Document const char *  draft  )  [inline]
 

destructor

Definition at line 71 of file HyperEstraierWrapper.cpp.

References doc.

00071                                 {
00075         doc = est_doc_new_from_draft(draft);
00076     }

Document::Document ESTMTDB *  db,
int  number,
int  options
[inline]
 

constructor(for internal use only)

Definition at line 77 of file HyperEstraierWrapper.cpp.

References doc.

00077                                                     {
00081         doc = est_mtdb_get_doc(db, number, options);
00082     }

Document::~Document  )  [inline]
 

destructor

Definition at line 83 of file HyperEstraierWrapper.cpp.

References doc.

00083                 {
00087         est_doc_delete(doc);
00088     }


Member Function Documentation

void Document::add_attr const char *  name,
const char *  value
[inline]
 

add an attribute to a document object

Definition at line 89 of file HyperEstraierWrapper.cpp.

References doc.

00089                                                        {
00093         est_doc_add_attr(doc, name, value);
00094     }

void Document::add_hidden_text const char *  text  )  [inline]
 

add a hidden sentence to a document object

Definition at line 101 of file HyperEstraierWrapper.cpp.

References doc.

00101                                             {
00105         est_doc_add_hidden_text(doc, text);
00106     }

void Document::add_text const char *  text  )  [inline]
 

add a sentence of text to a document object

Definition at line 95 of file HyperEstraierWrapper.cpp.

References doc.

00095                                     {
00099         est_doc_add_text(doc, text);
00100     }

const char* Document::get_attr const char *  name  )  [inline]
 

get the value of an attribute of a document object

Definition at line 125 of file HyperEstraierWrapper.cpp.

References doc.

00125                                             {
00129         return est_doc_attr(doc, name);
00130     }

std::vector<std::string>* Document::get_attr_names  )  [inline]
 

get a list of attribute names of a document object

Definition at line 113 of file HyperEstraierWrapper.cpp.

References doc.

00113                                             {
00117         std::vector<std::string> * vs = new std::vector<std::string>;
00118         CBLIST * attr_names = est_doc_attr_names(doc);
00119         for (int i=0; i < cblistnum(attr_names); i++) {
00120             vs->push_back(cblistval(attr_names, i, NULL));
00121         }
00122         cblistclose(attr_names);
00123         return vs;
00124     }

const char* Document::get_dump_draft  )  [inline]
 

dump draft data of a document object

Definition at line 145 of file HyperEstraierWrapper.cpp.

References doc.

00145                                   {
00149         return est_doc_dump_draft(doc);
00150     }

int Document::get_id  )  [inline]
 

get the ID number of a document object

Definition at line 107 of file HyperEstraierWrapper.cpp.

References doc.

00107                  {
00111         return est_doc_id(doc);
00112     }

const char* Document::make_snippet std::vector< std::string >  _words,
int  wwidth,
int  hwidth,
int  awidth
[inline]
 

make a snippet of the body text of a document object

Definition at line 151 of file HyperEstraierWrapper.cpp.

References doc.

00151                                                                                                {
00155         CBLIST * words;
00156         std::vector<std::string>::iterator iter;
00157 
00158         words = cblistopen();
00159 
00160         for (iter = _words.begin(); _words.end() != iter; iter++) {
00161             cblistpush(words, iter->c_str(), -1);
00162         }
00163 
00164         const char *result = est_doc_make_snippet(doc, words, wwidth, hwidth, awidth); 
00165 
00166         cblistclose(words);
00167 
00168         return result;
00169     }

bool Document::scan_words std::vector< std::string >  _words  )  [inline]
 

check whether the text of a document object includes every specified words

Definition at line 170 of file HyperEstraierWrapper.cpp.

References doc.

00170                                                  {
00174         CBLIST *words;
00175         std::vector<std::string>::iterator iter;
00176 
00177         words = cblistopen();
00178 
00179         for (iter = _words.begin(); _words.end() != iter; iter++) {
00180             cblistpush(words, iter->c_str(), -1);
00181         }
00182 
00183         int result = est_doc_scan_words(doc, words);
00184 
00185         cblistclose(words);
00186 
00187         return result;
00188     }

const char* Document::text  )  [inline]
 

get a list of sentences of the text of a document object

Definition at line 131 of file HyperEstraierWrapper.cpp.

References doc, and text_buf.

00131                         {
00135         if (text_buf == "") {
00136             const CBLIST *texts;
00137             texts = est_doc_texts(doc);
00138             text_buf = "";
00139             for(int i = 0; i < cblistnum(texts); i++) {
00140                 text_buf += cblistval(texts, i, NULL);
00141             }
00142         }
00143         return text_buf.c_str();
00144     }


Member Data Documentation

ESTDOC* Document::doc
 

Definition at line 63 of file HyperEstraierWrapper.cpp.

Referenced by add_attr(), add_hidden_text(), add_text(), Document(), Database::etch_doc(), get_attr(), get_attr_names(), get_dump_draft(), get_id(), make_snippet(), Database::put_doc(), scan_words(), text(), and ~Document().

std::string Document::text_buf [private]
 

Definition at line 61 of file HyperEstraierWrapper.cpp.

Referenced by text().


The documentation for this class was generated from the following file:
Generated on Sat Jun 11 14:47:05 2005 for HyperEstraierWrapper by  doxygen 1.4.2