00001 /* AbiSuite 00002 * Copyright (C) Jordi Mas i Hernāndez 00003 * 00004 * This program is free software; you can redistribute it and/or 00005 * modify it under the terms of the GNU General Public License 00006 * as published by the Free Software Foundation; either version 2 00007 * of the License, or (at your option) any later version. 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with this program; if not, write to the Free Software 00016 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 00017 * 02110-1301 USA. 00018 */ 00019 00020 #include "ut_vector.h" 00021 #include "ut_xml.h" 00022 #include "ut_hash.h" 00023 00024 #include "ut_string_class.h" 00025 00026 #ifndef BARBARISMS_H 00027 #define BARBARISMS_H 00028 00029 class ABI_EXPORT BarbarismChecker : public UT_XML::Listener 00030 { 00031 public: 00032 BarbarismChecker(); 00033 ~BarbarismChecker(); 00034 00035 bool load(const char *szLang); 00036 00037 bool checkWord(const UT_UCSChar * word32, size_t length); 00038 00039 bool suggestWord(const UT_UCSChar *word32, size_t length, UT_GenericVector<UT_UCSChar*>* pVecsugg); 00040 00041 /* 00042 Implementation of UT_XML::Listener 00043 */ 00044 void startElement(const gchar *name, const gchar **atts); 00045 void endElement(const gchar *){}; 00046 void charData(const gchar *, int){}; 00047 00048 private: 00049 00050 bool suggestExactWord(const UT_UCSChar *word32, size_t length, UT_GenericVector<UT_UCSChar*>* pVecsugg); 00051 00052 UT_GenericStringMap<UT_GenericVector<UT_UCS4Char *>*> m_map; 00053 UT_GenericVector<UT_UCS4Char *>* m_pCurVector; 00054 00055 UT_String m_sLang; 00056 }; 00057 00058 #endif // BARBARISMS_H