Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

QueryDocument.hpp

Go to the documentation of this file.
00001 /*==========================================================================
00002  * Copyright (c) 2003 Carnegie Mellon University.  All Rights Reserved.
00003  *
00004  * Use of the Lemur Toolkit for Language Modeling and Information Retrieval
00005  * is subject to the terms of the software license set forth in the LICENSE
00006  * file included with this software, and also available at
00007  * http://www.cs.cmu.edu/~lemur/license.html
00008  *
00009  *==========================================================================
00010 */
00011 
00012 // tnt - 2/2003
00013 
00014 #include "Document.hpp" 
00015 #include "TextHandler.hpp"
00016 #include "common_headers.hpp"
00017 
00018 #ifndef QUERYDOC_HPP
00019 #define QUERYDOC_HPP
00020 
00021 
00026 
00027 class QueryToken: public TokenTerm {
00028 public:
00029   QueryToken() {}
00030   virtual ~QueryToken(){}
00031   virtual const char *spelling() { return str; }
00032   friend class QueryDocument;
00033   friend class StrStructQuery;
00034 private:
00035   char *str;
00036 };
00037 
00038 class QueryDocument: public Document, public TextHandler {
00039 public:
00040   QueryDocument();
00041   ~QueryDocument();
00042   void startTermIteration() {iter = 0;}
00043   bool hasMore() { return iter < tokens.size();}
00044   void skipToEnd() {iter = tokens.size();}
00045 
00047   TokenTerm* nextTerm();
00048   void addTerm(const char* token);
00049   char* handleWord(char *word);
00050   char* handleSymbol(char *sym);
00051 
00052   char *getID() const {return id;}
00053   void setID(const char* idstr) {id = strdup(idstr);}
00054 
00055 private:
00056   char* id;
00057   vector<char*> tokens;
00058   int iter;
00059   QueryToken tt;
00060 };
00061 
00062 #endif

Generated on Fri Feb 6 07:11:48 2004 for LEMUR by doxygen1.2.16