lib Library API Documentation

kohyphen.h

00001 /****************************************************************************** 00002 * Copyright (C) 2002 by Alexander Dymo <cloudtemple@mskat.net> * 00003 * Copyright (C) 2002-2003 by Lukas Tinkl <lukas.tinkl@suse.cz> * 00004 * Copyright (C) 2003 David Faure <faure@kde.org> * 00005 * * 00006 * This program is free software; you can redistribute it and/or modify * 00007 * it under the terms of the GNU Library General Public License as * 00008 * published by the Free Software Foundation; either version 2 of the * 00009 * License, or (at your option) any later version. * 00010 * * 00011 * This library is distributed in the hope that it will be useful, * 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 00014 * Library General Public License for more details. * 00015 * * 00016 * You should have received a copy of the GNU Library General Public License * 00017 * along with this library; see the file COPYING.LIB. If not, write to * 00018 * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, * 00019 * Boston, MA 02111-1307, USA. * 00020 ******************************************************************************/ 00021 00022 #ifndef KOHYPHEN_H 00023 #define KOHYPHEN_H 00024 00025 #include <qmap.h> 00026 #include <qstring.h> 00027 #include "hyphen.h" 00028 00029 class KoHyphenatorException{ 00030 public: 00031 KoHyphenatorException(const QString& MessageText): messageText(MessageText) {} 00032 QString message() const { return messageText; } 00033 private: 00034 QString messageText; 00035 }; 00036 00056 class KoHyphenator{ 00057 public: 00063 static KoHyphenator* self(); 00064 00065 ~KoHyphenator(); 00066 00073 bool checkHyphenPos(const QString& str, int pos, const QString& lang) const; 00074 00091 char *hyphens(const QString& str, const QString& lang) const; 00092 00103 QString hyphenate(const QString& str, const QString& lang) const; 00104 00105 private: 00109 QTextCodec* codecForLang(const QString& lang) const; 00110 00111 KoHyphenator(); 00112 HyphenDict *dict(const QString &lang) const; 00113 00114 QMap<QString, HyphenDict*> dicts; 00115 struct EncodingStruct { 00116 EncodingStruct() // for QMap 00117 : encoding(), codec(0L) {} 00118 EncodingStruct(const QCString& _encoding) 00119 : encoding(_encoding), codec(0L) {} 00120 QCString encoding; 00121 QTextCodec* codec; 00122 }; 00123 typedef QMap<QString, EncodingStruct> EncodingMap; 00124 mutable EncodingMap encodings; // key is the language code 00125 00126 static KoHyphenator* s_self; 00127 }; 00128 00129 #endif
KDE Logo
This file is part of the documentation for lib Library Version 1.3.5.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Nov 17 06:54:16 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003