lib
kohyphen.h00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
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()
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;
00125
00126 static KoHyphenator* s_self;
00127 };
00128
00129 #endif
|