diff options
Diffstat (limited to 'lib/kotext/kohyphen')
-rw-r--r-- | lib/kotext/kohyphen/hyphdicts/hyph_da.dic | 2 | ||||
-rw-r--r-- | lib/kotext/kohyphen/hyphdicts/hyph_es.dic | 4 | ||||
-rw-r--r-- | lib/kotext/kohyphen/hyphdicts/hyph_hu.dic | 4 | ||||
-rw-r--r-- | lib/kotext/kohyphen/hyphdicts/hyph_nl.dic | 2 | ||||
-rwxr-xr-x | lib/kotext/kohyphen/hyphdicts/hyph_sv.dic | 2 | ||||
-rw-r--r-- | lib/kotext/kohyphen/kohyphen.cpp | 84 | ||||
-rw-r--r-- | lib/kotext/kohyphen/kohyphen.h | 36 | ||||
-rw-r--r-- | lib/kotext/kohyphen/kohyphentest.cpp | 28 |
8 files changed, 81 insertions, 81 deletions
diff --git a/lib/kotext/kohyphen/hyphdicts/hyph_da.dic b/lib/kotext/kohyphen/hyphdicts/hyph_da.dic index 77d0666f..2a7154fb 100644 --- a/lib/kotext/kohyphen/hyphdicts/hyph_da.dic +++ b/lib/kotext/kohyphen/hyphdicts/hyph_da.dic @@ -540,7 +540,7 @@ le4mo 4leu l1f lfin4 -lfind5 +ltqfind5 l1go1 l3h li4ga diff --git a/lib/kotext/kohyphen/hyphdicts/hyph_es.dic b/lib/kotext/kohyphen/hyphdicts/hyph_es.dic index 2af6bfa1..05ff239c 100644 --- a/lib/kotext/kohyphen/hyphdicts/hyph_es.dic +++ b/lib/kotext/kohyphen/hyphdicts/hyph_es.dic @@ -451,8 +451,8 @@ z1h 2locos. 2loca. 2locas. -2moco. -2mocos. +2tqmoco. +2tqmocos. 2mula. 2mulas. 2pedo. diff --git a/lib/kotext/kohyphen/hyphdicts/hyph_hu.dic b/lib/kotext/kohyphen/hyphdicts/hyph_hu.dic index 66564932..8b1bdce4 100644 --- a/lib/kotext/kohyphen/hyphdicts/hyph_hu.dic +++ b/lib/kotext/kohyphen/hyphdicts/hyph_hu.dic @@ -25668,7 +25668,7 @@ fimeg1 fi1me 2f1i2nas fi1na -2find +2tqfind fin1os2z fi1no fi2n1 @@ -26978,7 +26978,7 @@ ge3mell 2g1e2ms ge1m 2g1eml -ge2moc +ge2tqmoc ge1mo 2g1emp ge1na2 diff --git a/lib/kotext/kohyphen/hyphdicts/hyph_nl.dic b/lib/kotext/kohyphen/hyphdicts/hyph_nl.dic index 0a5b745b..a5b6f05c 100644 --- a/lib/kotext/kohyphen/hyphdicts/hyph_nl.dic +++ b/lib/kotext/kohyphen/hyphdicts/hyph_nl.dic @@ -3408,7 +3408,7 @@ fik4st fil4m3a film5on fi3lo -4find +4tqfind 3fini f3inj 4fink diff --git a/lib/kotext/kohyphen/hyphdicts/hyph_sv.dic b/lib/kotext/kohyphen/hyphdicts/hyph_sv.dic index 6ec0f944..1726d063 100755 --- a/lib/kotext/kohyphen/hyphdicts/hyph_sv.dic +++ b/lib/kotext/kohyphen/hyphdicts/hyph_sv.dic @@ -2183,7 +2183,7 @@ mani1k 5ma3ri mash5 mas3ko -mask3ro +tqmask3ro ma5sk^^f6 mas3ti mas4v diff --git a/lib/kotext/kohyphen/kohyphen.cpp b/lib/kotext/kohyphen/kohyphen.cpp index 584fa247..29d13c37 100644 --- a/lib/kotext/kohyphen/kohyphen.cpp +++ b/lib/kotext/kohyphen/kohyphen.cpp @@ -19,10 +19,10 @@ * Boston, MA 02110-1301, USA. * ******************************************************************************/ -#include <qdom.h> -#include <qfile.h> -#include <qtextcodec.h> -#include <qstring.h> +#include <tqdom.h> +#include <tqfile.h> +#include <tqtextcodec.h> +#include <tqstring.h> #include <klocale.h> #include <kapplication.h> @@ -49,31 +49,31 @@ KoHyphenator::KoHyphenator() { /* Reading config for dictionary encodings from file...*/ - QString path = kapp->dirs()->findResource("data", "koffice/hyphdicts/dicts.xml"); + TQString path = kapp->dirs()->findResource("data", "koffice/hyphdicts/dicts.xml"); #ifdef DEBUG_HYPHENATOR kdDebug() << path << endl; #endif - QFile *f; + TQFile *f; if (!path.isNull()) - f = new QFile(path); + f = new TQFile(path); else throw KoHyphenatorException( "Could not create KoHyphenator instance." ); - QDomDocument config; - QDomNodeList records; + TQDomDocument config; + TQDomNodeList records; config.setContent(f); - for (QDomNode n = config.firstChild(); !n.isNull(); n = n.nextSibling()) + for (TQDomNode n = config.firstChild(); !n.isNull(); n = n.nextSibling()) if (n.nodeName() == "dicts") { records = n.childNodes(); for (uint i = 0; i < records.count(); i++) { - QDomNamedNodeMap attr = records.item(i).attributes(); - if (attr.contains("lang") && attr.contains("encoding")) { - QString lang = attr.namedItem("lang").nodeValue(); - QString encoding = attr.namedItem("encoding").nodeValue(); + TQDomNamedNodeMap attr = records.item(i).attributes(); + if (attr.tqcontains("lang") && attr.tqcontains("encoding")) { + TQString lang = attr.namedItem("lang").nodeValue(); + TQString encoding = attr.namedItem("encoding").nodeValue(); #ifdef DEBUG_HYPHENATOR kdDebug() << "KoHyphenator: found lang=" << lang << " encoding=" << encoding << endl; #endif @@ -88,19 +88,19 @@ KoHyphenator::KoHyphenator() KoHyphenator::~KoHyphenator() { - for (QMap<QString, HyphenDict*>::iterator it = dicts.begin(); it != dicts.end(); ++it) + for (TQMap<TQString, HyphenDict*>::iterator it = dicts.begin(); it != dicts.end(); ++it) { if ((*it) != 0) hnj_hyphen_free((*it)); } } -char *KoHyphenator::hyphens(const QString& str, const QString& lang) const +char *KoHyphenator::hyphens(const TQString& str, const TQString& lang) const { char *x = new char[str.length()+1]; try { - QTextCodec *codec = codecForLang(lang); + TQTextCodec *codec = codecForLang(lang); hnj_hyphen_hyphenate(dict(lang), (const char *)(codec->fromUnicode(str)), str.length(), x); } catch (KoHyphenatorException &e) @@ -115,13 +115,13 @@ char *KoHyphenator::hyphens(const QString& str, const QString& lang) const return x; } -QString KoHyphenator::hyphenate(const QString& str, const QString& lang) const +TQString KoHyphenator::hyphenate(const TQString& str, const TQString& lang) const { char* x = new char[str.length()+1]; - QString res = str; + TQString res = str; try { - QTextCodec *codec = codecForLang(lang); + TQTextCodec *codec = codecForLang(lang); hnj_hyphen_hyphenate(dict(lang), (const char *)(codec->fromUnicode(str)), str.length(), x); } catch (KoHyphenatorException &e) @@ -141,7 +141,7 @@ QString KoHyphenator::hyphenate(const QString& str, const QString& lang) const #endif if ((x[i] % 2) != 0) { - res.insert(j+1, QChar(0xad)); + res.insert(j+1, TQChar(0xad)); j++; } j++; @@ -150,7 +150,7 @@ QString KoHyphenator::hyphenate(const QString& str, const QString& lang) const return res; } -bool KoHyphenator::checkHyphenPos(const QString& str, int pos, const QString& lang) const +bool KoHyphenator::checkHyphenPos(const TQString& str, int pos, const TQString& lang) const { #ifdef DEBUG_HYPHENATOR kdDebug() << "string: " << str << endl; @@ -167,65 +167,65 @@ bool KoHyphenator::checkHyphenPos(const QString& str, int pos, const QString& la return ret; } -HyphenDict *KoHyphenator::dict(const QString &_lang) const +HyphenDict *KoHyphenator::dict(const TQString &_lang) const { - QString lang( _lang ); + TQString lang( _lang ); //only load dictionary when encoding info is present - if (encodings.find(lang) == encodings.end()) + if (encodings.tqfind(lang) == encodings.end()) { - int underscore = lang.find('_'); + int underscore = lang.tqfind('_'); if ( underscore > -1 ) { lang.truncate( underscore ); - if (encodings.find(lang) == encodings.end()) - throw KoHyphenatorException( QString("No dictionary for %1").arg(lang) ); + if (encodings.tqfind(lang) == encodings.end()) + throw KoHyphenatorException( TQString("No dictionary for %1").tqarg(lang) ); } else - throw KoHyphenatorException( QString("No dictionary for %1").arg(lang) ); + throw KoHyphenatorException( TQString("No dictionary for %1").tqarg(lang) ); } - if (dicts.find(lang) == dicts.end()) + if (dicts.tqfind(lang) == dicts.end()) { #ifdef DEBUG_HYPHENATOR kdDebug() << "Searching dictionary for '" << lang << "' language..." << endl; #endif - QString path = kapp->dirs()->findResource("data", "koffice/hyphdicts/hyph_" + lang + ".dic"); + TQString path = kapp->dirs()->findResource("data", "koffice/hyphdicts/hyph_" + lang + ".dic"); if (!path.isNull()) { #ifdef DEBUG_HYPHENATOR kdDebug() << "Loading dictionary for '" << lang << "' language: path = " << path << endl; #endif - const_cast<KoHyphenator*>(this)->dicts.insert( lang, hnj_hyphen_load(QFile::encodeName(path)) ); - if (dicts.find(lang) == dicts.end()) + const_cast<KoHyphenator*>(this)->dicts.insert( lang, hnj_hyphen_load(TQFile::encodeName(path)) ); + if (dicts.tqfind(lang) == dicts.end()) { #ifdef DEBUG_HYPHENATOR kdDebug() << "No dictionary loaded" << endl; #endif - throw(KoHyphenatorException( QString("Could not load dictionary for the language: %1").arg(lang) )); + throw(KoHyphenatorException( TQString("Could not load dictionary for the language: %1").tqarg(lang) )); } } else - throw(KoHyphenatorException( QString("Could not load dictionary for the language: %1").arg(lang) )); + throw(KoHyphenatorException( TQString("Could not load dictionary for the language: %1").tqarg(lang) )); } return dicts[lang]; } -QTextCodec* KoHyphenator::codecForLang(const QString& lang) const +TQTextCodec* KoHyphenator::codecForLang(const TQString& lang) const { - EncodingMap::Iterator it = encodings.find(lang); + EncodingMap::Iterator it = encodings.tqfind(lang); if (it == encodings.end()) { - int underscore = lang.find('_'); + int underscore = lang.tqfind('_'); if ( underscore > -1 ) { - QString _lang( lang ); + TQString _lang( lang ); _lang.truncate( underscore ); - it = encodings.find(_lang); + it = encodings.tqfind(_lang); } } if (it != encodings.end()) { if ( (*it).codec ) return (*it).codec; - (*it).codec = QTextCodec::codecForName((*it).encoding); + (*it).codec = TQTextCodec::codecForName((*it).encoding); return (*it).codec; } - return QTextCodec::codecForMib(106); // utf-8 + return TQTextCodec::codecForMib(106); // utf-8 } diff --git a/lib/kotext/kohyphen/kohyphen.h b/lib/kotext/kohyphen/kohyphen.h index b36f80c3..af3bef41 100644 --- a/lib/kotext/kohyphen/kohyphen.h +++ b/lib/kotext/kohyphen/kohyphen.h @@ -22,16 +22,16 @@ #ifndef KOHYPHEN_H #define KOHYPHEN_H -#include <qmap.h> -#include <qstring.h> +#include <tqmap.h> +#include <tqstring.h> #include "hyphen.h" class KoHyphenatorException{ public: - KoHyphenatorException(const QString& MessageText): messageText(MessageText) {} - QString message() const { return messageText; } + KoHyphenatorException(const TQString& MessageText): messageText(MessageText) {} + TQString message() const { return messageText; } private: - QString messageText; + TQString messageText; }; /** @@ -45,11 +45,11 @@ private: * This library tries to adopt it for KDE. * * It handles the hyphenation dictionary loading for the specified language. - * QString -> char* conversion is done by using of settings in + * TQString -> char* conversion is done by using of settings in * dicts.xml file in datadir/koffice/hyphdicts (dictionaries are also located * there). * - * The @ref hyphenate() functions returns QString containing hyphenation + * The @ref hyphenate() functions returns TQString containing hyphenation * chars (0xad) or char* in format of hnj_hyphen_hyphenate() function from * libhnj library. */ @@ -70,7 +70,7 @@ public: * Can be used to check if the line break at given position * should be forced and automatic hyphen added. */ - bool checkHyphenPos(const QString& str, int pos, const QString& lang) const; + bool checkHyphenPos(const TQString& str, int pos, const TQString& lang) const; /** * Returns the pointer to the string in hnj_hyphen_hyphenate() format @@ -88,7 +88,7 @@ public: * Language: two chars containing the ISO 639-1 code * (for example "en", "uk", etc.) (could be lang_COUNTRY as well). */ - char *hyphens(const QString& str, const QString& lang) const; + char *hyphens(const TQString& str, const TQString& lang) const; /** * Hyphenates the string str and returns the string with @@ -100,27 +100,27 @@ public: * Language: two chars containing the ISO 639-1 code * (for example "en", "uk", etc.) (could be lang_COUNTRY as well). */ - QString hyphenate(const QString& str, const QString& lang) const; + TQString hyphenate(const TQString& str, const TQString& lang) const; private: /** * @return the encoding of dictionary for the language @p lang. */ - QTextCodec* codecForLang(const QString& lang) const; + TQTextCodec* codecForLang(const TQString& lang) const; KoHyphenator(); - HyphenDict *dict(const QString &lang) const; + HyphenDict *dict(const TQString &lang) const; - QMap<QString, HyphenDict*> dicts; + TQMap<TQString, HyphenDict*> dicts; struct EncodingStruct { - EncodingStruct() // for QMap + EncodingStruct() // for TQMap : encoding(), codec(0L) {} - EncodingStruct(const QCString& _encoding) + EncodingStruct(const TQCString& _encoding) : encoding(_encoding), codec(0L) {} - QCString encoding; - QTextCodec* codec; + TQCString encoding; + TQTextCodec* codec; }; - typedef QMap<QString, EncodingStruct> EncodingMap; + typedef TQMap<TQString, EncodingStruct> EncodingMap; mutable EncodingMap encodings; // key is the language code static KoHyphenator* s_self; diff --git a/lib/kotext/kohyphen/kohyphentest.cpp b/lib/kotext/kohyphen/kohyphentest.cpp index d19526ce..d5d8daff 100644 --- a/lib/kotext/kohyphen/kohyphentest.cpp +++ b/lib/kotext/kohyphen/kohyphentest.cpp @@ -3,19 +3,19 @@ #include <stdio.h> #include <stdlib.h> -#include <qstringlist.h> +#include <tqstringlist.h> #include <kapplication.h> #include "kohyphen.h" #include <kdebug.h> -static bool check(QString a, QString b) +static bool check(TQString a, TQString b) { if (a.isEmpty()) - a = QString::null; + a = TQString(); if (b.isEmpty()) - b = QString::null; + b = TQString(); if (a == b) { kdDebug() << "checking '" << a << "' against expected value '" << b << "'... " << "ok" << endl; } @@ -28,13 +28,13 @@ static bool check(QString a, QString b) KoHyphenator * hypher = 0L; -void check_hyphenation( const QStringList& tests, const QStringList& results, const char* lang ) +void check_hyphenation( const TQStringList& tests, const TQStringList& results, const char* lang ) { - QStringList::ConstIterator it, itres; + TQStringList::ConstIterator it, itres; for ( it = tests.begin(), itres = results.begin(); it != tests.end() ; ++it, ++itres ) { - QString result = hypher->hyphenate((*it), lang); + TQString result = hypher->hyphenate((*it), lang); kdDebug() << (*it) << " hyphenates like this: " << result << endl; - check( result.replace(QChar(0xad),'-'), *itres ); + check( result.tqreplace(TQChar(0xad),'-'), *itres ); } } @@ -51,22 +51,22 @@ int main (int argc, char ** argv) return 1; } - QStringList::ConstIterator it, itres; + TQStringList::ConstIterator it, itres; //testing Czech language, this text is in UTF-8! - QStringList cs_tests = QStringList() << "Žluťoučký" << "kůň" << "úpěl" << + TQStringList cs_tests = TQStringList() << "Žluťoučký" << "kůň" << "úpěl" << "ďábelské" << "ódy"; for ( it = cs_tests.begin(); it != cs_tests.end() ; ++it ) kdDebug() << (*it) << " hyphenates like this: " << hypher->hyphenate((*it), "cs") << endl; //testing English - QStringList en_tests = QStringList() << "Follow" << "white" << "rabbit"; - QStringList en_results = QStringList() << "Fol-low" << "white" << "rab-bit"; + TQStringList en_tests = TQStringList() << "Follow" << "white" << "rabbit"; + TQStringList en_results = TQStringList() << "Fol-low" << "white" << "rab-bit"; check_hyphenation( en_tests, en_results, "en" ); - QStringList fr_tests = QStringList() << "constitution" ; - QStringList fr_results = QStringList() << "consti-tu-tion" ; + TQStringList fr_tests = TQStringList() << "constitution" ; + TQStringList fr_results = TQStringList() << "consti-tu-tion" ; check_hyphenation( fr_tests, fr_results, "fr" ); return 0; |