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 namespace lemur 00022 { 00023 namespace api 00024 { 00025 00027 00033 class QueryDocument: public Document, public TextHandler { 00034 public: 00035 QueryDocument(); 00036 ~QueryDocument(); 00037 void startTermIteration() const{iter = 0;} 00038 bool hasMore() const{ return iter < tokens.size();} 00039 void skipToEnd() const{iter = tokens.size();} 00040 00042 const Term* nextTerm() const; 00043 void addTerm(const char* token); 00044 char* handleWord(char *word); 00045 char* handleSymbol(char *sym); 00046 00047 const char *getID() const {return id;} 00048 void setID(const char* idstr) {id = strdup(idstr);} 00049 00050 private: 00051 char* id; 00052 vector<char*> tokens; 00053 mutable int iter; 00054 mutable Term tt; 00055 }; 00056 } 00057 } 00058 00059 #endif