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.lemurproject.org/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 QueryDocument: public Document, public TextHandler { 00028 public: 00029 QueryDocument(); 00030 ~QueryDocument(); 00031 void startTermIteration() const{iter = 0;} 00032 bool hasMore() const{ return iter < tokens.size();} 00033 void skipToEnd() const{iter = tokens.size();} 00034 00036 const Term* nextTerm() const; 00037 void addTerm(const char* token); 00038 char* handleWord(char *word); 00039 char* handleSymbol(char *sym); 00040 00041 const char *getID() const {return id;} 00042 void setID(const char* idstr) {id = strdup(idstr);} 00043 00044 private: 00045 char* id; 00046 vector<char*> tokens; 00047 mutable int iter; 00048 mutable Term tt; 00049 }; 00050 00051 #endif