00001 /* 00002 * Aiksaurus - An English-language thesaurus library 00003 * Copyright (C) 2001-2002 by Jared Davis 00004 * 00005 * This program is free software; you can redistribute it and/or 00006 * modify it under the terms of the GNU General Public License 00007 * as published by the Free Software Foundation; either version 2 00008 * of the License, or (at your option) any later version. 00009 * 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU General Public License 00016 * along with this program; if not, write to the Free Software 00017 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 00018 * 02110-1301 USA. 00019 * 00020 */ 00021 00022 #ifndef INCLUDED_AIKSAURUS_H 00023 #define INCLUDED_AIKSAURUS_H 00024 00025 #if defined _WIN32 00026 #if defined _STATIC_BUILD 00027 #define AIKEXPORT 00028 #else 00029 #if defined _DLL 00030 #define AIKEXPORT __declspec(dllexport) 00031 #else 00032 #define AIKEXPORT __declspec(dllimport) 00033 #endif 00034 #endif 00035 #else 00036 #define AIKEXPORT 00037 #endif 00038 00039 #include <string> 00040 00041 namespace AiksaurusImpl 00042 { 00043 class ThesaurusImpl; 00044 class AIKEXPORT Aiksaurus 00045 { 00046 private: 00047 00048 // Prevent copying and assignment 00049 Aiksaurus(const Aiksaurus& rhs); 00050 Aiksaurus& operator=(const Aiksaurus& rhs); 00051 00052 ThesaurusImpl *d_impl_ptr; 00053 std::string d_error; 00054 00055 public: 00056 00057 Aiksaurus() throw(); 00058 Aiksaurus(const char * path_meanings, const char * path_words) throw(); 00059 00060 ~Aiksaurus() throw(); 00061 00062 // word(): returns current word that is being 00063 // searched for. You should not try to delete 00064 // this string. 00065 const char* word() const throw(); 00066 00067 // error(): empty string if no problems encountered. 00068 // otherwise, a human-suitable description of the 00069 // problem will be presented. 00070 // + Do not try to delete this string. 00071 const char* error() const throw(); 00072 00073 00074 // find(): perform a search for a new word. 00075 // returns *true* if word is known, *false* otherwise. 00076 bool find(const char* word) throw(); 00077 00078 // next(): return synonyms for the word. 00079 // + Do not try to delete this string. 00080 // + *meaning* will change as new meanings are 00081 // encountered 00082 // + the first two words of any meaning are 00083 // titles for that meaning. 00084 // + returns an empty string when out of synonyms. 00085 const char* next(int& meaning) throw(); 00086 00087 // similar(): repeatdly to return one "nearby word" 00088 // at a time. these are not synonyms: they are known 00089 // words that are alphabetically near the 00090 // searched-for word. 00091 const char* similar() throw(); 00092 }; 00093 } 00094 00095 typedef AiksaurusImpl::Aiksaurus Aiksaurus; 00096 00097 #endif // INCLUDED_AIKSAURUS_H