diff options
Diffstat (limited to 'src/kvilib/core')
-rw-r--r-- | src/kvilib/core/kvi_error.cpp | 6 | ||||
-rw-r--r-- | src/kvilib/core/kvi_error.h | 2 | ||||
-rw-r--r-- | src/kvilib/core/kvi_pointerhashtable.h | 54 | ||||
-rw-r--r-- | src/kvilib/core/kvi_pointerlist.h | 34 | ||||
-rw-r--r-- | src/kvilib/core/kvi_qcstring.h | 16 | ||||
-rw-r--r-- | src/kvilib/core/kvi_qstring.cpp | 410 | ||||
-rw-r--r-- | src/kvilib/core/kvi_qstring.h | 207 | ||||
-rw-r--r-- | src/kvilib/core/kvi_string.cpp | 100 | ||||
-rw-r--r-- | src/kvilib/core/kvi_string.h | 36 | ||||
-rw-r--r-- | src/kvilib/core/kvi_valuelist.h | 6 |
10 files changed, 436 insertions, 435 deletions
diff --git a/src/kvilib/core/kvi_error.cpp b/src/kvilib/core/kvi_error.cpp index 6497c757..bbd1abcd 100644 --- a/src/kvilib/core/kvi_error.cpp +++ b/src/kvilib/core/kvi_error.cpp @@ -57,7 +57,7 @@ const char * g_errorTable[KVI_NUM_ERRORS]= __tr_no_lookup("Unexpected end of command in dictionary key"), // 006: unexpectedEndInDictionaryKey __tr_no_lookup("Switch dash without switch letter"), // 007: switchDashWithoutSwitchLetter __tr_no_lookup("Unknown function"), // 008: unknownFunction - __tr_no_lookup("Unexpected end of command in parenthesis"), // 009: unexpectedEndInParenthesis + __tr_no_lookup("Unexpected end of command in tqparenthesis"), // 009: unexpectedEndInParenthesis __tr_no_lookup("Unexpected end of command in function parameters"), // 010: unexpectedEndInFunctionParams __tr_no_lookup("Missing variable name"), // 011: missingVariableName __tr_no_lookup("Variable or identifier expected"), // 012: variableOrIdentifierExpected @@ -112,7 +112,7 @@ const char * g_errorTable[KVI_NUM_ERRORS]= __tr_no_lookup("Integer parameter expected"), // 061 __tr_no_lookup("Invalid parameter"), // 062 __tr_no_lookup("No such file"), // 063 - __tr_no_lookup("Open parenthesis expected"), // 064 + __tr_no_lookup("Open tqparenthesis expected"), // 064 __tr_no_lookup("Open brace expected"), // 065 __tr_no_lookup("Can't kill a builtin class"), // 066 __tr_no_lookup("The SOCKSV4 protocol lacks IpV6 support"), // 067 @@ -183,7 +183,7 @@ namespace KviError return g_errorTable[KviError_unknownError]; } - QString getDescription(int iErrorCode) + TQString getDescription(int iErrorCode) { return __tr2qs_no_xgettext(getUntranslatedDescription(iErrorCode)); } diff --git a/src/kvilib/core/kvi_error.h b/src/kvilib/core/kvi_error.h index 7ab55e88..c295dfe2 100644 --- a/src/kvilib/core/kvi_error.h +++ b/src/kvilib/core/kvi_error.h @@ -180,7 +180,7 @@ namespace KviError { - KVILIB_API QString getDescription(int iErrorCode); + KVILIB_API TQString getDescription(int iErrorCode); KVILIB_API const char * getUntranslatedDescription(int iErrorCode); KVILIB_API int translateSystemError(int iErrNo); }; diff --git a/src/kvilib/core/kvi_pointerhashtable.h b/src/kvilib/core/kvi_pointerhashtable.h index 9066c091..4a9b20d8 100644 --- a/src/kvilib/core/kvi_pointerhashtable.h +++ b/src/kvilib/core/kvi_pointerhashtable.h @@ -229,25 +229,25 @@ inline void * & kvi_hash_key_default(void *) return static_default; } -inline unsigned int kvi_hash_hash(const QString &szKey,bool bCaseSensitive) +inline unsigned int kvi_hash_hash(const TQString &szKey,bool bCaseSensitive) { unsigned int uResult = 0; - const QChar * p = KviQString::nullTerminatedArray(szKey); + const TQChar * p = KviTQString::nullTerminatedArray(szKey); if(!p)return 0; if(bCaseSensitive) { - while(p->unicode()) + while(p->tqunicode()) { - uResult += p->unicode(); + uResult += p->tqunicode(); p++; } } else { - while(p->unicode()) + while(p->tqunicode()) { #ifdef COMPILE_USE_QT4 - uResult += p->toLower().unicode(); + uResult += p->toLower().tqunicode(); #else - uResult += p->lower().unicode(); + uResult += p->lower().tqunicode(); #endif p++; } @@ -255,25 +255,25 @@ inline unsigned int kvi_hash_hash(const QString &szKey,bool bCaseSensitive) return uResult; } -inline bool kvi_hash_key_equal(const QString &szKey1,const QString &szKey2,bool bCaseSensitive) +inline bool kvi_hash_key_equal(const TQString &szKey1,const TQString &szKey2,bool bCaseSensitive) { if(bCaseSensitive) - return KviQString::equalCS(szKey1,szKey2); - return KviQString::equalCI(szKey1,szKey2); + return KviTQString::equalCS(szKey1,szKey2); + return KviTQString::equalCI(szKey1,szKey2); } -inline void kvi_hash_key_copy(const QString &szFrom,QString &szTo,bool) +inline void kvi_hash_key_copy(const TQString &szFrom,TQString &szTo,bool) { szTo = szFrom; } -inline void kvi_hash_key_destroy(QString &szKey,bool) +inline void kvi_hash_key_destroy(TQString &szKey,bool) { } -inline const QString & kvi_hash_key_default(QString *) +inline const TQString & kvi_hash_key_default(TQString *) { - return KviQString::empty; + return KviTQString::empty; } template<typename Key,typename T> class KviPointerHashTable; @@ -311,7 +311,7 @@ public: /// \endverbatim /// /// Implementations for the most likey Key data types are provided below. -/// KviPointerHashTable will automagically work with const char *,QString,KviStr +/// KviPointerHashTable will automagically work with const char *,TQString,KviStr /// and integer types as keys. /// /// For string Key types, the hash table may or may not be case sensitive. @@ -349,7 +349,7 @@ public: /// Places the hash table iterator at the position /// of the item found. /// - T * find(const Key & hKey) + T * tqfind(const Key & hKey) { m_uIteratorIdx = kvi_hash_hash(hKey,m_bCaseSensitive) % m_uSize; if(!m_pDataArray[m_uIteratorIdx])return 0; @@ -364,11 +364,11 @@ public: /// Returns the item associated to the key hKey /// or NULL if no such item exists in the hash table. /// Places the hash table iterator at the position - /// of the item found. This is an alias to find(). + /// of the item found. This is an alias to tqfind(). /// T * operator[](const Key & hKey) { - return find(hKey); + return tqfind(hKey); } /// @@ -427,7 +427,7 @@ public: /// The hash table iterator is placed at the newly inserted item. /// This is just an alias to insert() with a different name. /// - void replace(const Key & hKey,T * pData) + void tqreplace(const Key & hKey,T * pData) { insert(hKey,pData); } @@ -522,7 +522,7 @@ public: /// it's hash table entry, if found, and NULL otherwise. /// The hash table iterator is placed at the item found. /// - KviPointerHashTableEntry<Key,T> * findRef(const T * pRef) + KviPointerHashTableEntry<Key,T> * tqfindRef(const T * pRef) { for(m_uIteratorIdx = 0;m_uIteratorIdx<m_uSize;m_uIteratorIdx++) { @@ -540,7 +540,7 @@ public: /// /// Returns the entry pointed by the hash table iterator. /// This function must be preceeded by a call to firstEntry(), first() - /// or findRef(). + /// or tqfindRef(). /// KviPointerHashTableEntry<Key,T> * currentEntry() { @@ -568,7 +568,7 @@ public: /// Places the hash table iterator at the next entry /// and returns it. /// This function must be preceeded by a call to firstEntry(), first() - /// or findRef(). + /// or tqfindRef(). /// KviPointerHashTableEntry<Key,T> * nextEntry() { @@ -596,7 +596,7 @@ public: /// /// Returns the data value pointer pointed by the hash table iterator. /// This function must be preceeded by a call to firstEntry(), first() - /// or findRef(). + /// or tqfindRef(). /// T * current() { @@ -613,7 +613,7 @@ public: /// /// Returns the key pointed by the hash table iterator. /// This function must be preceeded by a call to firstEntry(), first() - /// or findRef(). + /// or tqfindRef(). /// const Key & currentKey() { @@ -648,7 +648,7 @@ public: /// Places the hash table iterator at the next entry /// and returns the associated data value pointer. /// This function must be preceeded by a call to firstEntry(), first() - /// or findRef(). + /// or tqfindRef(). /// T * next() { @@ -681,7 +681,7 @@ public: /// Removes all items in the hash table and then /// makes a complete shallow copy of the data contained in t. /// The removed items are deleted if autodeletion is enabled. - /// The hash table iterator is invalidated. + /// The hash table iterator is tqinvalidated. /// Does not change autodelete flag: make sure you not delete the items twice :) /// void copyFrom(KviPointerHashTable<Key,T> &t) @@ -693,7 +693,7 @@ public: /// /// Inserts a complete shallow copy of the data contained in t. - /// The hash table iterator is invalidated. + /// The hash table iterator is tqinvalidated. /// void insert(KviPointerHashTable<Key,T> &t) { diff --git a/src/kvilib/core/kvi_pointerlist.h b/src/kvilib/core/kvi_pointerlist.h index 381780c8..8b5cb9c5 100644 --- a/src/kvilib/core/kvi_pointerlist.h +++ b/src/kvilib/core/kvi_pointerlist.h @@ -32,13 +32,13 @@ // //============================================================================= -// Qt changes the collection classes too much and too frequently. +// TQt changes the collection classes too much and too frequently. // I think we need to be independent of that to the maximum degree possible. // That's why we have our own fast pointer list class. -// This does not depend on Qt AT ALL and has an interface similar -// to the Qt<=3.x series. The pointer lists with the autodelete +// This does not depend on TQt AT ALL and has an interface similar +// to the TQt<=3.x series. The pointer lists with the autodelete // feature was great and I don't completly understand why they have -// been removed from Qt4 in favor of the value based non-autodeleting +// been removed from TQt4 in favor of the value based non-autodeleting // lists... anyway: here we go :) #include "kvi_settings.h" @@ -288,7 +288,7 @@ public: /// Iterating over pointers is also very fast and this /// class contains an internal iterator that allows to /// write loops in a compact and clean way. -/// See the first(), next(), current() and findRef() +/// See the first(), next(), current() and tqfindRef() /// functions for the description of this feature. /// /// There is also a non-const external iterator @@ -297,11 +297,11 @@ public: /// since the list provides the autoDelete() method /// which vould implicitly violate constness. /// If you have to deal with const objects then -/// you need to use a QList instead. +/// you need to use a TQList instead. /// /// Your objects also do not need to support copy constructors /// or >= operators. This class will work fine without them -/// as opposed to a plain QList. +/// as opposed to a plain TQList. /// /// This class also supports automatic deletion of the inseted items. /// See the setAutoDelete() and autoDelete() members for the @@ -618,7 +618,7 @@ public: /// /// Returns the current iteration item /// A call to this function MUST be preceded by a call to - /// first(),last(),at() or findRef() + /// first(),last(),at() or tqfindRef() /// T * current() { @@ -628,9 +628,9 @@ public: /// /// Returns the current iteration item /// A call to this function should be preceded by a call to - /// first(),last(),at() or findRef(). + /// first(),last(),at() or tqfindRef(). /// This function will return a NULL pointer if the current - /// item has been invalidated due to a remove operation. + /// item has been tqinvalidated due to a remove operation. /// T * safeCurrent() { @@ -641,7 +641,7 @@ public: /// /// Returns an iterator pointing to the current item in the list. /// A call to this function MUST be preceded by a call to - /// first(),last(),at() or findRef() + /// first(),last(),at() or tqfindRef() /// KviPointerListIterator<T> iteratorAtCurrent() { @@ -652,7 +652,7 @@ public: /// Sets the iteration pointer to the next item in the list /// and returns that item (or 0 if the end of the list has been reached) /// A call to this function MUST be preceded by a _succesfull_ call to - /// first(),last(),at() or findRef(). + /// first(),last(),at() or tqfindRef(). /// T * next() { @@ -666,7 +666,7 @@ public: /// Sets the iteration pointer to the previous item in the list /// and returns that item (or 0 if the beginning of the list has been reached) /// A call to this function MUST be preceded by a _succesfull_ call to - /// first(),last(),at() or findRef() + /// first(),last(),at() or tqfindRef() /// T * prev() { @@ -715,7 +715,7 @@ public: /// and returns its position (zero based index) in the list or -1 if the /// item cannot be found /// - int findRef(const T * d) + int tqfindRef(const T * d) { int ret = 0; for(T * t = first();t;t = next()) @@ -945,7 +945,7 @@ public: /// bool removeRef(const T * d) { - if(findRef(d) == -1)return false; + if(tqfindRef(d) == -1)return false; removeCurrentSafe(); return true; } @@ -957,7 +957,7 @@ public: /// void insertAfter(const T * ref,const T * d) { - if(findRef(ref) == -1) + if(tqfindRef(ref) == -1) { append(d); return; @@ -981,7 +981,7 @@ public: /// void insertBefore(const T * ref,const T * d) { - if(findRef(ref) == -1) + if(tqfindRef(ref) == -1) { prepend(d); return; diff --git a/src/kvilib/core/kvi_qcstring.h b/src/kvilib/core/kvi_qcstring.h index 0693e205..9406115c 100644 --- a/src/kvilib/core/kvi_qcstring.h +++ b/src/kvilib/core/kvi_qcstring.h @@ -1,5 +1,5 @@ -#ifndef _KVI_QCSTRING_H_ -#define _KVI_QCSTRING_H_ +#ifndef _KVI_TQCSTRING_H_ +#define _KVI_TQCSTRING_H_ //============================================================================= // @@ -28,12 +28,12 @@ #include "kvi_settings.h" #ifdef COMPILE_USE_QT4 - #include <q3cstring.h> // includes <qbytearray.h> - #define KviQCString QByteArray + #include <tq3cstring.h> // includes <qbytearray.h> + #define KviTQCString TQByteArray #else - // this is dead in Qt 4.x - #include <qcstring.h> - #define KviQCString QCString + // this is dead in TQt 4.x + #include <tqcstring.h> + #define KviTQCString TQCString #endif -#endif //!_KVI_QCSTRING_H_ +#endif //!_KVI_TQCSTRING_H_ diff --git a/src/kvilib/core/kvi_qstring.cpp b/src/kvilib/core/kvi_qstring.cpp index eba255aa..fd61aed4 100644 --- a/src/kvilib/core/kvi_qstring.cpp +++ b/src/kvilib/core/kvi_qstring.cpp @@ -24,7 +24,7 @@ //============================================================================= // -// Helper functions for the QString class +// Helper functions for the TQString class // //============================================================================= @@ -38,7 +38,7 @@ #include <ctype.h> // for tolower() #include <stdio.h> // for sprintf() -#include <qregexp.h> +#include <tqregexp.h> // kvi_string.cpp extern unsigned char iso88591_toLower_map[256]; @@ -46,48 +46,48 @@ extern unsigned char iso88591_toUpper_map[256]; #define MY_MIN(a,b) (((a) < (b)) ? (a) : (b)) -namespace KviQString +namespace KviTQString { // The global empty (and null) string - const QString empty; + const TQString empty; - bool equalCSN(const QString &sz1,const QString &sz2,unsigned int len) + bool equalCSN(const TQString &sz1,const TQString &sz2,unsigned int len) { if(len == 0)return true; // assume equal - const QChar * c1 = sz1.unicode(); - const QChar * c2 = sz2.unicode(); + const TQChar * c1 = sz1.tqunicode(); + const TQChar * c2 = sz2.tqunicode(); unsigned int lmin = MY_MIN(sz1.length(),sz2.length()); if(lmin < len)return false; - const QChar * c1e = c1 + len; + const TQChar * c1e = c1 + len; if(!c1 || !c2)return (c1 == c2); while(c1 < c1e) { - if(c1->unicode() != c2->unicode())return false; + if(c1->tqunicode() != c2->tqunicode())return false; c1++; c2++; } return (c1 == c1e); } - bool equalCIN(const QString &sz1,const QString &sz2,unsigned int len) + bool equalCIN(const TQString &sz1,const TQString &sz2,unsigned int len) { if(len == 0)return true; // assume equal - const QChar * c1 = sz1.unicode(); - const QChar * c2 = sz2.unicode(); + const TQChar * c1 = sz1.tqunicode(); + const TQChar * c2 = sz2.tqunicode(); unsigned int lmin = MY_MIN(sz1.length(),sz2.length()); if(lmin < len)return false; - const QChar * c1e = c1 + len; + const TQChar * c1e = c1 + len; if(!c1 || !c2)return (c1 == c2); while(c1 < c1e) { #ifdef COMPILE_USE_QT4 - if(c1->toLower().unicode() != c2->toLower().unicode())return false; + if(c1->toLower().tqunicode() != c2->toLower().tqunicode())return false; #else - if(c1->lower().unicode() != c2->lower().unicode())return false; + if(c1->lower().tqunicode() != c2->lower().tqunicode())return false; #endif c1++; c2++; @@ -95,31 +95,31 @@ namespace KviQString return (c1 == c1e); } - bool equalCSN(const QString &sz1,const char * sz2,unsigned int len) + bool equalCSN(const TQString &sz1,const char * sz2,unsigned int len) { if(len == 0)return true; // assume equal - const QChar * c1 = sz1.unicode(); + const TQChar * c1 = sz1.tqunicode(); if(sz1.length() < len)return false; - const QChar * c1e = c1 + len; + const TQChar * c1e = c1 + len; if(!sz2)return !c1; if(!c1)return !sz2; while((c1 < c1e) && (*sz2)) { - if(c1->unicode() != *sz2)return false; + if(c1->tqunicode() != *sz2)return false; c1++; sz2++; } return (c1 == c1e); } - bool equalCIN(const QString &sz1,const char * sz2,unsigned int len) + bool equalCIN(const TQString &sz1,const char * sz2,unsigned int len) { if(len == 0)return true; // assume equal - const QChar * c1 = sz1.unicode(); + const TQChar * c1 = sz1.tqunicode(); if(sz1.length() < len)return false; - const QChar * c1e = c1 + len; + const TQChar * c1e = c1 + len; if(!sz2)return !c1; if(!c1)return !(*sz2); @@ -127,9 +127,9 @@ namespace KviQString while((c1 < c1e) && (*sz2)) { #ifdef COMPILE_USE_QT4 - if(c1->toLower().unicode() != tolower(*sz2))return false; + if(c1->toLower().tqunicode() != tolower(*sz2))return false; #else - if(c1->lower().unicode() != tolower(*sz2))return false; + if(c1->lower().tqunicode() != tolower(*sz2))return false; #endif c1++; sz2++; @@ -138,22 +138,22 @@ namespace KviQString } // sz2 is assumed to be null terminated, sz1 is not! - bool equalCIN(const QString &sz1,const QChar *sz2,unsigned int len) + bool equalCIN(const TQString &sz1,const TQChar *sz2,unsigned int len) { if(len == 0)return true; // assume equal - const QChar * c1 = sz1.unicode(); + const TQChar * c1 = sz1.tqunicode(); if(sz1.length() < len)return false; - const QChar * c1e = c1 + len; + const TQChar * c1e = c1 + len; if(!sz2)return !c1; - if(!c1)return !(sz2->unicode()); + if(!c1)return !(sz2->tqunicode()); - while((c1 < c1e) && (sz2->unicode())) + while((c1 < c1e) && (sz2->tqunicode())) { #ifdef COMPILE_USE_QT4 - if(c1->toLower().unicode() != sz2->toLower().unicode())return false; + if(c1->toLower().tqunicode() != sz2->toLower().tqunicode())return false; #else - if(c1->lower().unicode() != sz2->lower().unicode())return false; + if(c1->lower().tqunicode() != sz2->lower().tqunicode())return false; #endif c1++; sz2++; @@ -161,65 +161,65 @@ namespace KviQString return (c1 == c1e); } - QString makeSizeReadable(size_t bytes) + TQString makeSizeReadable(size_t bytes) { double size = bytes; if(size<900) - return QString(__tr2qs("%1 bytes")).arg(size,0,'f',3); + return TQString(__tr2qs("%1 bytes")).tqarg(size,0,'f',3); size/=1024; if(size<900) - return QString(__tr2qs("%1 KB")).arg(size,0,'f',3); + return TQString(__tr2qs("%1 KB")).tqarg(size,0,'f',3); size/=1024; if(size<900) - return QString(__tr2qs("%1 MB")).arg(size,0,'f',3); + return TQString(__tr2qs("%1 MB")).tqarg(size,0,'f',3); //Pirated DVD?;) size/=1024; if(size<900) - return QString(__tr2qs("%1 GB")).arg(size,0,'f',3); + return TQString(__tr2qs("%1 GB")).tqarg(size,0,'f',3); //Uhm.. We are downloading a whole internet:))) size/=1024; - return QString(__tr2qs("%1 TB")).arg(size,0,'f',3); + return TQString(__tr2qs("%1 TB")).tqarg(size,0,'f',3); } - bool equalCS(const QString &sz1,const QString &sz2) + bool equalCS(const TQString &sz1,const TQString &sz2) { if(sz1.length() != sz2.length())return false; - const QChar * c1 = sz1.unicode(); - const QChar * c2 = sz2.unicode(); - const QChar * c1e = c1 + sz1.length(); + const TQChar * c1 = sz1.tqunicode(); + const TQChar * c2 = sz2.tqunicode(); + const TQChar * c1e = c1 + sz1.length(); if(!c1 || !c2)return (c1 == c2); while(c1 < c1e) { - if(c1->unicode() != c2->unicode())return false; + if(c1->tqunicode() != c2->tqunicode())return false; c1++; c2++; } return (c1 == c1e); } - bool equalCI(const QString &sz1,const QString &sz2) + bool equalCI(const TQString &sz1,const TQString &sz2) { if(sz1.length() != sz2.length())return false; - const QChar * c1 = sz1.unicode(); - const QChar * c2 = sz2.unicode(); - const QChar * c1e = c1 + sz1.length(); + const TQChar * c1 = sz1.tqunicode(); + const TQChar * c2 = sz2.tqunicode(); + const TQChar * c1e = c1 + sz1.length(); if(!c1 || !c2)return (c1 == c2); while(c1 < c1e) { #ifdef COMPILE_USE_QT4 - if(c1->toLower().unicode() != c2->toLower().unicode())return false; + if(c1->toLower().tqunicode() != c2->toLower().tqunicode())return false; #else - if(c1->lower().unicode() != c2->lower().unicode())return false; + if(c1->lower().tqunicode() != c2->lower().tqunicode())return false; #endif c1++; c2++; @@ -228,56 +228,56 @@ namespace KviQString } // sz2 is assumed to be null terminated, sz1 is not! - bool equalCI(const QString &sz1,const QChar *sz2) + bool equalCI(const TQString &sz1,const TQChar *sz2) { - const QChar * c1 = sz1.unicode(); - const QChar * c1e = c1 + sz1.length(); + const TQChar * c1 = sz1.tqunicode(); + const TQChar * c1e = c1 + sz1.length(); if(!c1 || !sz2)return (c1 == sz2); while(c1 < c1e) { - if(!sz2->unicode())return false; // sz1 has at least another character + if(!sz2->tqunicode())return false; // sz1 has at least another character #ifdef COMPILE_USE_QT4 - if(c1->toLower().unicode() != sz2->toLower().unicode())return false; + if(c1->toLower().tqunicode() != sz2->toLower().tqunicode())return false; #else - if(c1->lower().unicode() != sz2->lower().unicode())return false; + if(c1->lower().tqunicode() != sz2->lower().tqunicode())return false; #endif c1++; sz2++; } - return (c1 == c1e) && (!sz2->unicode()); + return (c1 == c1e) && (!sz2->tqunicode()); } - bool equalCS(const QString &sz1,const char * sz2) + bool equalCS(const TQString &sz1,const char * sz2) { - const QChar * c1 = sz1.unicode(); - const QChar * c1e = c1 + sz1.length(); + const TQChar * c1 = sz1.tqunicode(); + const TQChar * c1e = c1 + sz1.length(); if(!c1)return !sz2; while((c1 < c1e) && (*sz2)) { - if(c1->unicode() != *sz2)return false; + if(c1->tqunicode() != *sz2)return false; c1++; sz2++; } return ((c1 == c1e) && (*sz2 == '\0')); } - bool equalCI(const QString &sz1,const char * sz2) + bool equalCI(const TQString &sz1,const char * sz2) { - const QChar * c1 = sz1.unicode(); - const QChar * c1e = c1 + sz1.length(); + const TQChar * c1 = sz1.tqunicode(); + const TQChar * c1e = c1 + sz1.length(); if(!c1)return !sz2; while((c1 < c1e) && (*sz2)) { #ifdef COMPILE_USE_QT4 - if(c1->toLower().unicode() != tolower(*sz2))return false; + if(c1->toLower().tqunicode() != tolower(*sz2))return false; #else - if(c1->lower().unicode() != tolower(*sz2))return false; + if(c1->lower().tqunicode() != tolower(*sz2))return false; #endif c1++; sz2++; @@ -285,12 +285,12 @@ namespace KviQString return ((c1 == c1e) && (*sz2 == '\0')); } - int cmpCS(const QString &sz1,const QString &sz2) + int cmpCS(const TQString &sz1,const TQString &sz2) { - const QChar * c1 = sz1.unicode(); - const QChar * c2 = sz2.unicode(); - const QChar * c1e = c1 + sz1.length(); - const QChar * c2e = c2 + sz2.length(); + const TQChar * c1 = sz1.tqunicode(); + const TQChar * c2 = sz2.tqunicode(); + const TQChar * c1e = c1 + sz1.length(); + const TQChar * c2e = c2 + sz2.length(); if(!c1) { @@ -304,12 +304,12 @@ namespace KviQString { if(c1 >= c1e) { - if(c2 < c2e)return /* 0 */ - (c2->unicode()); + if(c2 < c2e)return /* 0 */ - (c2->tqunicode()); return 0; } - if(c2 >= c2e)return c1->unicode() /* - 0 */; + if(c2 >= c2e)return c1->tqunicode() /* - 0 */; - int diff = c1->unicode() - c2->unicode(); + int diff = c1->tqunicode() - c2->tqunicode(); if(diff)return diff; c1++; @@ -319,12 +319,12 @@ namespace KviQString return 0; // never here } - int cmpCI(const QString &sz1,const QString &sz2) + int cmpCI(const TQString &sz1,const TQString &sz2) { - const QChar * c1 = sz1.unicode(); - const QChar * c2 = sz2.unicode(); - const QChar * c1e = c1 + sz1.length(); - const QChar * c2e = c2 + sz2.length(); + const TQChar * c1 = sz1.tqunicode(); + const TQChar * c2 = sz2.tqunicode(); + const TQChar * c1e = c1 + sz1.length(); + const TQChar * c2e = c2 + sz2.length(); if(!c1) { @@ -338,22 +338,22 @@ namespace KviQString if(c1 >= c1e) { #ifdef COMPILE_USE_QT4 - if(c2 < c2e)return /* 0 */ - (c2->toLower().unicode()); + if(c2 < c2e)return /* 0 */ - (c2->toLower().tqunicode()); #else - if(c2 < c2e)return /* 0 */ - (c2->lower().unicode()); + if(c2 < c2e)return /* 0 */ - (c2->lower().tqunicode()); #endif return 0; } #ifdef COMPILE_USE_QT4 - if(c2 >= c2e)return c1->toLower().unicode() /* - 0 */; + if(c2 >= c2e)return c1->toLower().tqunicode() /* - 0 */; #else - if(c2 >= c2e)return c1->lower().unicode() /* - 0 */; + if(c2 >= c2e)return c1->lower().tqunicode() /* - 0 */; #endif #ifdef COMPILE_USE_QT4 - int diff = c1->toLower().unicode() - c2->toLower().unicode(); + int diff = c1->toLower().tqunicode() - c2->toLower().tqunicode(); #else - int diff = c1->lower().unicode() - c2->lower().unicode(); + int diff = c1->lower().tqunicode() - c2->lower().tqunicode(); #endif if(diff)return diff; @@ -364,15 +364,15 @@ namespace KviQString return 0; // never here } - int cmpCIN(const QString &sz1,const QString &sz2,unsigned int len) + int cmpCIN(const TQString &sz1,const TQString &sz2,unsigned int len) { if(len == 0)return 0; // assume equal unsigned int l1 = MY_MIN(len,sz1.length()); unsigned int l = MY_MIN(l1,sz2.length()); // FIXME: THIS IS NOT OK - const QChar * c1 = sz1.unicode(); - const QChar * c2 = sz2.unicode(); - const QChar * c1e = c1 + l; + const TQChar * c1 = sz1.tqunicode(); + const TQChar * c2 = sz2.tqunicode(); + const TQChar * c1e = c1 + l; if(!c1) { @@ -384,9 +384,9 @@ namespace KviQString int diff = 0; #ifdef COMPILE_USE_QT4 - while((c1 < c1e) && !(diff = (c1->toLower().unicode() - c2->toLower().unicode()))) + while((c1 < c1e) && !(diff = (c1->toLower().tqunicode() - c2->toLower().tqunicode()))) #else - while((c1 < c1e) && !(diff = (c1->lower().unicode() - c2->lower().unicode()))) + while((c1 < c1e) && !(diff = (c1->lower().tqunicode() - c2->lower().tqunicode()))) #endif { c1++; @@ -396,12 +396,12 @@ namespace KviQString return diff; } - void ensureLastCharIs(QString &szString,const QChar &c) + void ensureLastCharIs(TQString &szString,const TQChar &c) { if(!lastCharIs(szString,c))szString.append(c); } - QString getToken(QString &szString,const QChar &sep) + TQString getToken(TQString &szString,const TQChar &sep) { int i=0; while(i < szString.length()) @@ -409,7 +409,7 @@ namespace KviQString if(szString[i] == sep)break; i++; } - QString ret; + TQString ret; if(i == szString.length()) { ret = szString; @@ -427,7 +427,7 @@ namespace KviQString return ret; } - void stripRightWhiteSpace(QString &s) + void stripRightWhiteSpace(TQString &s) { int iRemove = 0; while(iRemove < s.length()) @@ -438,7 +438,7 @@ namespace KviQString if(iRemove > 0)s.remove(s.length() - iRemove,iRemove); } - void stripRight(QString &s,const QChar &c) + void stripRight(TQString &s,const TQChar &c) { int iRemove = 0; while(iRemove < s.length()) @@ -449,7 +449,7 @@ namespace KviQString if(iRemove > 0)s.remove(s.length() - iRemove,iRemove); } - void stripLeft(QString &s,const QChar &c) + void stripLeft(TQString &s,const TQChar &c) { int iRemove = 0; while(iRemove < s.length()) @@ -462,7 +462,7 @@ namespace KviQString if(iRemove > 0)s.remove(0,iRemove); } - void detach(QString &sz) + void detach(TQString &sz) { #ifdef COMPILE_USE_QT4 sz.resize(sz.length()); @@ -471,52 +471,52 @@ namespace KviQString #endif } - const QChar * nullTerminatedArray(const QString &sz) + const TQChar * nullTerminatedArray(const TQString &sz) { //sz.setLength(sz.length()); // detach! #ifdef COMPILE_USE_QT4 return sz.constData(); #else - return (const QChar *)sz.ucs2(); // MAY BE NULL! + return (const TQChar *)sz.ucs2(); // MAY BE NULL! #endif } - void appendNumber(QString &s,double dReal) + void appendNumber(TQString &s,double dReal) { char buffer[512]; ::sprintf(buffer,"%f",dReal); s.append(buffer); } - void appendNumber(QString &s,int iInteger) + void appendNumber(TQString &s,int iInteger) { char buffer[64]; ::sprintf(buffer,"%d",iInteger); s.append(buffer); } - void appendNumber(QString &s,kvi_i64_t iInteger) + void appendNumber(TQString &s,kvi_i64_t iInteger) { char buffer[64]; ::sprintf(buffer,"%ld",iInteger); s.append(buffer); } - void appendNumber(QString &s,kvi_u64_t uInteger) + void appendNumber(TQString &s,kvi_u64_t uInteger) { char buffer[64]; ::sprintf(buffer,"%lu",uInteger); s.append(buffer); } - void appendNumber(QString &s,unsigned int uInteger) + void appendNumber(TQString &s,unsigned int uInteger) { char buffer[64]; ::sprintf(buffer,"%u",uInteger); s.append(buffer); } - void vsprintf(QString &s,const QString &szFmt,kvi_va_list list) + void vsprintf(TQString &s,const TQString &szFmt,kvi_va_list list) { #define MEMINCREMENT 32 @@ -525,15 +525,15 @@ namespace KviQString //s.setLength(allocsize); - const QChar * fmt = nullTerminatedArray(szFmt); + const TQChar * fmt = nullTerminatedArray(szFmt); if(!fmt) { - s = QString::null; + s = TQString(); return; } - QChar * buffer = (QChar *)kvi_malloc(sizeof(QChar) * allocsize); - //QChar * p = (QChar *)s.unicode(); + TQChar * buffer = (TQChar *)kvi_malloc(sizeof(TQChar) * allocsize); + //TQChar * p = (TQChar *)s.tqunicode(); char *argString; long argValue; @@ -544,29 +544,29 @@ namespace KviQString char *pNumBuf; unsigned int tmp; - QChar * p = buffer; + TQChar * p = buffer; #define INCREMENT_MEM \ { \ allocsize += MEMINCREMENT; \ - buffer = (QChar *)kvi_realloc(buffer,sizeof(QChar) * allocsize); \ + buffer = (TQChar *)kvi_realloc(buffer,sizeof(TQChar) * allocsize); \ p = buffer + reallen; \ } #define INCREMENT_MEM_BY(numchars) \ { \ allocsize += numchars + MEMINCREMENT; \ - buffer = (QChar *)kvi_realloc(buffer,sizeof(QChar) * allocsize); \ + buffer = (TQChar *)kvi_realloc(buffer,sizeof(TQChar) * allocsize); \ p = buffer + reallen; \ } - for(; fmt->unicode() ; ++fmt) + for(; fmt->tqunicode() ; ++fmt) { if(reallen == allocsize)INCREMENT_MEM //copy up to a '%' - if(fmt->unicode() != '%') + if(fmt->tqunicode() != '%') { *p++ = *fmt; reallen++; @@ -574,16 +574,16 @@ namespace KviQString } ++fmt; //skip this '%' - switch(fmt->unicode()) + switch(fmt->tqunicode()) { case 's': // char * string { argString = kvi_va_arg(list,char *); if(!argString)argString = "[!NULL!]"; - QString str(argString); + TQString str(argString); if(str.isEmpty())continue; int len = str.length(); - const QChar * ch = str.unicode(); + const TQChar * ch = str.tqunicode(); if(!ch)continue; if((allocsize - reallen) < len)INCREMENT_MEM_BY(len) while(len--)*p++ = *ch++; @@ -596,17 +596,17 @@ namespace KviQString if(!str)continue; if((allocsize - reallen) < str->len())INCREMENT_MEM_BY(str->len()) argString = str->ptr(); - while(*argString)*p++ = QChar(*argString++); + while(*argString)*p++ = TQChar(*argString++); reallen += str->len(); continue; } - case 'Q': // QString * string + case 'Q': // TQString * string { - QString * str = kvi_va_arg(list,QString *); + TQString * str = kvi_va_arg(list,TQString *); if(!str)continue; if(str->isEmpty())continue; int len = str->length(); - const QChar * ch = str->unicode(); + const TQChar * ch = str->tqunicode(); if(!ch)continue; if((allocsize - reallen) < len)INCREMENT_MEM_BY(len) while(len--)*p++ = *ch++; @@ -627,7 +627,7 @@ namespace KviQString reallen++; continue; } - case 'q': // QChar * + case 'q': // TQChar * { // // I'm not sure about this... @@ -637,7 +637,7 @@ namespace KviQString // as sizeof(int) bytes value. // Is this always true ? // - *p++ = *((QChar *)kvi_va_arg(list,QChar *)); + *p++ = *((TQChar *)kvi_va_arg(list,TQChar *)); reallen++; continue; } @@ -661,7 +661,7 @@ namespace KviQString //copy now.... argUValue = pNumBuf - numberBuffer; //length of the number string if((allocsize - reallen) < (int)argUValue)INCREMENT_MEM_BY(argUValue) - do { *p++ = QChar(*--pNumBuf); } while(pNumBuf != numberBuffer); + do { *p++ = TQChar(*--pNumBuf); } while(pNumBuf != numberBuffer); reallen += argUValue; continue; } @@ -721,7 +721,7 @@ namespace KviQString { *p++ = '%'; //write it reallen++; - if(fmt->unicode()) + if(fmt->tqunicode()) { if(reallen == allocsize)INCREMENT_MEM *p++ = *fmt; @@ -738,35 +738,35 @@ namespace KviQString } - QString & sprintf(QString &s,const QString &szFmt,...) + TQString & sprintf(TQString &s,const TQString &szFmt,...) { kvi_va_list list; kvi_va_start_by_reference(list,szFmt); //print...with max 256 chars - KviQString::vsprintf(s,szFmt,list); + KviTQString::vsprintf(s,szFmt,list); kvi_va_end(list); return s; } - void appendFormatted(QString &s,const QString &szFmt,...) + void appendFormatted(TQString &s,const TQString &szFmt,...) { - QString tmp; + TQString tmp; kvi_va_list list; kvi_va_start_by_reference(list,szFmt); //print...with max 256 chars - KviQString::vsprintf(tmp,szFmt,list); + KviTQString::vsprintf(tmp,szFmt,list); kvi_va_end(list); s.append(tmp); } - bool matchWildExpressionsCI(const QString &szM1,const QString &szM2) + bool matchWildExpressionsCI(const TQString &szM1,const TQString &szM2) { //Matches two regular expressions containging wildcards (* and ?) // s1 // m1 - // mask1 : *xor - // mask2 : xorand*xor + // tqmask1 : *xor + // tqmask2 : xorand*xor // m2 // s2 @@ -782,28 +782,28 @@ namespace KviQString // #ifdef COMPILE_USE_QT4 - const QChar * m1 = (const QChar *)szM1.constData(); - const QChar * m2 = (const QChar *)szM2.constData(); + const TQChar * m1 = (const TQChar *)szM1.constData(); + const TQChar * m2 = (const TQChar *)szM2.constData(); #else - const QChar * m1 = (const QChar *)szM1.ucs2(); - const QChar * m2 = (const QChar *)szM2.ucs2(); + const TQChar * m1 = (const TQChar *)szM1.ucs2(); + const TQChar * m2 = (const TQChar *)szM2.ucs2(); #endif - if(!(m1 && m2 && (m1->unicode())))return false; - const QChar * savePos1 = 0; - const QChar * savePos2 = m2; - while(m1->unicode()) + if(!(m1 && m2 && (m1->tqunicode())))return false; + const TQChar * savePos1 = 0; + const TQChar * savePos2 = m2; + while(m1->tqunicode()) { - //loop managed by m1 (initially first mask) - if(m1->unicode()=='*') + //loop managed by m1 (initially first tqmask) + if(m1->tqunicode()=='*') { //Found a wildcard in m1 savePos1 = ++m1; //move to the next char and save the position...this is our jolly - if(!savePos1->unicode())return true; //last was a wildcard , matches everything ahead... + if(!savePos1->tqunicode())return true; //last was a wildcard , matches everything ahead... savePos2 = m2+1; //next return state for the second string continue; //and return } - if(!m2->unicode())return false; //m2 finished and we had something to match here! + if(!m2->tqunicode())return false; //m2 finished and we had something to match here! #ifdef COMPILE_USE_QT4 if(m1->toLower()==m2->toLower()) #else @@ -813,7 +813,7 @@ namespace KviQString //chars matched m1++; //Go ahead in the two strings m2++; // - if((!(m1->unicode())) && m2->unicode() && savePos1) + if((!(m1->tqunicode())) && m2->tqunicode() && savePos1) { //m1 finished , but m2 not yet and we have a savePosition for m1 (there was a wildcard)... //retry matching the string following the * from the savePos2 (one char ahead last time) @@ -822,11 +822,11 @@ namespace KviQString savePos2++; //next savePos2 will be next char } } else { - if(m2->unicode() == '*') + if(m2->tqunicode() == '*') { //A wlidcard in the second string - //Invert the game : mask1 <-> mask2 - //mask2 now leads the game... + //Invert the game : tqmask1 <-> tqmask2 + //tqmask2 now leads the game... savePos1 = m1; //aux m1 = m2; //...swap m2 = savePos1; //...swap @@ -835,11 +835,11 @@ namespace KviQString continue; //...and again } // m1 != m2 , m1 != * , m2 != * - if((m1->unicode() == '?') || (m2->unicode() == '?')) + if((m1->tqunicode() == '?') || (m2->tqunicode() == '?')) { m1++; m2++; - if((!(m1->unicode())) && m2->unicode() && savePos1) + if((!(m1->tqunicode())) && m2->tqunicode() && savePos1) { //m1 finished , but m2 not yet and we have a savePosition for m1 (there was a wildcard)... //retry matching the string following the * from the savePos2 (one char ahead last time) @@ -858,21 +858,21 @@ namespace KviQString } } } - return (!(m2->unicode())); //m1 surely finished , so for the match , m2 must be finished too + return (!(m2->tqunicode())); //m1 surely finished , so for the match , m2 must be finished too } - bool matchStringCI(const QString &szExp,const QString &szStr,bool bIsRegExp,bool bExact) + bool matchStringCI(const TQString &szExp,const TQString &szStr,bool bIsRegExp,bool bExact) { - QString szWildcard; + TQString szWildcard; #ifdef COMPILE_USE_QT4 - QChar* ptr=(QChar*)szExp.constData(); + TQChar* ptr=(TQChar*)szExp.constData(); #else - QChar* ptr=(QChar*)szExp.ucs2(); + TQChar* ptr=(TQChar*)szExp.ucs2(); #endif if(!ptr) return 0; - while(ptr->unicode()) + while(ptr->tqunicode()) { - if((ptr->unicode()=='[') || (ptr->unicode()==']')) + if((ptr->tqunicode()=='[') || (ptr->tqunicode()==']')) { szWildcard.append("["); szWildcard.append(*ptr); @@ -883,9 +883,9 @@ namespace KviQString ptr++; } #ifdef COMPILE_USE_QT4 - QRegExp re(szWildcard,Qt::CaseInsensitive,bIsRegExp ? QRegExp::RegExp : QRegExp::Wildcard); + TQRegExp re(szWildcard,TQt::CaseInsensitive,bIsRegExp ? TQRegExp::RegExp : TQRegExp::Wildcard); #else - QRegExp re(szWildcard,false,!bIsRegExp); + TQRegExp re(szWildcard,false,!bIsRegExp); #endif if(bExact) return re.exactMatch(szStr); #ifdef COMPILE_USE_QT4 @@ -895,18 +895,18 @@ namespace KviQString #endif } - bool matchStringCS(const QString &szExp,const QString &szStr,bool bIsRegExp,bool bExact) + bool matchStringCS(const TQString &szExp,const TQString &szStr,bool bIsRegExp,bool bExact) { - QString szWildcard; + TQString szWildcard; #ifdef COMPILE_USE_QT4 - QChar* ptr=(QChar*)szExp.constData(); + TQChar* ptr=(TQChar*)szExp.constData(); #else - QChar* ptr=(QChar*)szExp.ucs2(); + TQChar* ptr=(TQChar*)szExp.ucs2(); #endif if(!ptr) return 0; - while(ptr->unicode()) + while(ptr->tqunicode()) { - if((ptr->unicode()=='[')) // <-- hum ? + if((ptr->tqunicode()=='[')) // <-- hum ? { szWildcard.append("["); szWildcard.append(*ptr); @@ -917,9 +917,9 @@ namespace KviQString ptr++; } #ifdef COMPILE_USE_QT4 - QRegExp re(szWildcard,Qt::CaseSensitive,bIsRegExp ? QRegExp::RegExp : QRegExp::Wildcard); + TQRegExp re(szWildcard,TQt::CaseSensitive,bIsRegExp ? TQRegExp::RegExp : TQRegExp::Wildcard); #else - QRegExp re(szWildcard,true,!bIsRegExp); + TQRegExp re(szWildcard,true,!bIsRegExp); #endif if(bExact) return re.exactMatch(szStr); #ifdef COMPILE_USE_QT4 @@ -929,34 +929,34 @@ namespace KviQString #endif } - void cutFromFirst(QString &s,const QChar &c,bool bIncluded) + void cutFromFirst(TQString &s,const TQChar &c,bool bIncluded) { #ifdef COMPILE_USE_QT4 int idx = s.indexOf(c); #else - int idx = s.find(c); + int idx = s.tqfind(c); #endif if(idx == -1)return; s.truncate(bIncluded ? idx : idx + 1); } - void cutFromLast(QString &s,const QChar &c,bool bIncluded) + void cutFromLast(TQString &s,const TQChar &c,bool bIncluded) { #ifdef COMPILE_USE_QT4 int idx = s.lastIndexOf(c); #else - int idx = s.findRev(c); + int idx = s.tqfindRev(c); #endif if(idx == -1)return; s.truncate(bIncluded ? idx : idx + 1); } - void cutToFirst(QString &s,const QChar &c,bool bIncluded,bool bClearIfNotFound) + void cutToFirst(TQString &s,const TQChar &c,bool bIncluded,bool bClearIfNotFound) { #ifdef COMPILE_USE_QT4 int idx = s.indexOf(c); #else - int idx = s.find(c); + int idx = s.tqfind(c); #endif if(idx == -1) { @@ -966,12 +966,12 @@ namespace KviQString s.remove(0,bIncluded ? idx + 1 : idx); } - void cutToLast(QString &s,const QChar &c,bool bIncluded,bool bClearIfNotFound) + void cutToLast(TQString &s,const TQChar &c,bool bIncluded,bool bClearIfNotFound) { #ifdef COMPILE_USE_QT4 int idx = s.lastIndexOf(c); #else - int idx = s.findRev(c); + int idx = s.tqfindRev(c); #endif if(idx == -1) { @@ -981,34 +981,34 @@ namespace KviQString s.remove(0,bIncluded ? idx + 1 : idx); } - void cutFromFirst(QString &s,const QString &c,bool bIncluded) + void cutFromFirst(TQString &s,const TQString &c,bool bIncluded) { #ifdef COMPILE_USE_QT4 int idx = s.indexOf(c); #else - int idx = s.find(c); + int idx = s.tqfind(c); #endif if(idx == -1)return; s.truncate(bIncluded ? idx : idx + c.length()); } - void cutFromLast(QString &s,const QString &c,bool bIncluded) + void cutFromLast(TQString &s,const TQString &c,bool bIncluded) { #ifdef COMPILE_USE_QT4 int idx = s.lastIndexOf(c); #else - int idx = s.findRev(c); + int idx = s.tqfindRev(c); #endif if(idx == -1)return; s.truncate(bIncluded ? idx : idx + c.length()); } - void cutToFirst(QString &s,const QString &c,bool bIncluded,bool bClearIfNotFound) + void cutToFirst(TQString &s,const TQString &c,bool bIncluded,bool bClearIfNotFound) { #ifdef COMPILE_USE_QT4 int idx = s.indexOf(c); #else - int idx = s.find(c); + int idx = s.tqfind(c); #endif if(idx == -1) { @@ -1018,12 +1018,12 @@ namespace KviQString s.remove(0,bIncluded ? idx + c.length() : idx); } - void cutToLast(QString &s,const QString &c,bool bIncluded,bool bClearIfNotFound) + void cutToLast(TQString &s,const TQString &c,bool bIncluded,bool bClearIfNotFound) { #ifdef COMPILE_USE_QT4 int idx = s.lastIndexOf(c); #else - int idx = s.findRev(c); + int idx = s.tqfindRev(c); #endif if(idx == -1) { @@ -1033,60 +1033,60 @@ namespace KviQString s.remove(0,bIncluded ? idx + c.length() : idx); } - QString upperISO88591(const QString &szSrc) + TQString upperISO88591(const TQString &szSrc) { - const QChar * c = nullTerminatedArray(szSrc); + const TQChar * c = nullTerminatedArray(szSrc); if(!c) { - QString ret; + TQString ret; return ret; } - QChar * buffer = (QChar *)kvi_malloc(sizeof(QChar) * szSrc.length()); - QChar * b = buffer; - unsigned short us = c->unicode(); + TQChar * buffer = (TQChar *)kvi_malloc(sizeof(TQChar) * szSrc.length()); + TQChar * b = buffer; + unsigned short us = c->tqunicode(); while(us) { if(us < 256) - *b=QChar((unsigned short)iso88591_toUpper_map[us]); + *b=TQChar((unsigned short)iso88591_toUpper_map[us]); else *b = *c; c++; b++; - us = c->unicode(); + us = c->tqunicode(); } - QString ret(buffer,szSrc.length()); + TQString ret(buffer,szSrc.length()); kvi_free(buffer); return ret; } - QString lowerISO88591(const QString &szSrc) + TQString lowerISO88591(const TQString &szSrc) { - const QChar * c = nullTerminatedArray(szSrc); + const TQChar * c = nullTerminatedArray(szSrc); if(!c) { - QString ret; + TQString ret; return ret; } - QChar * buffer = (QChar *)kvi_malloc(sizeof(QChar) * szSrc.length()); - QChar * b = buffer; - unsigned short us = c->unicode(); + TQChar * buffer = (TQChar *)kvi_malloc(sizeof(TQChar) * szSrc.length()); + TQChar * b = buffer; + unsigned short us = c->tqunicode(); while(us) { if(us < 256) { - *b=QChar((unsigned short)iso88591_toLower_map[us]); + *b=TQChar((unsigned short)iso88591_toLower_map[us]); } else *b = *c; c++; b++; - us = c->unicode(); + us = c->tqunicode(); } - QString ret(buffer,szSrc.length()); + TQString ret(buffer,szSrc.length()); kvi_free(buffer); return ret; } - void transliterate(QString &s,const QString &szToFind,const QString &szReplacement) + void transliterate(TQString &s,const TQString &szToFind,const TQString &szReplacement) { int i=0; int il = MY_MIN(szToFind.length(),szReplacement.length()); @@ -1105,7 +1105,7 @@ namespace KviQString static char hexdigits[16] = { '0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f' }; - void bufferToHex(QString &szRetBuffer,const unsigned char * buffer,unsigned int len) + void bufferToHex(TQString &szRetBuffer,const unsigned char * buffer,unsigned int len) { #ifdef COMPILE_USE_QT4 szRetBuffer.resize(len * 2); @@ -1115,9 +1115,9 @@ namespace KviQString unsigned int i=0; while(i < (len*2)) { - szRetBuffer[int(i)] = QChar( (unsigned int) hexdigits[(*buffer) / 16] ); + szRetBuffer[int(i)] = TQChar( (unsigned int) hexdigits[(*buffer) / 16] ); i++; - szRetBuffer[int(i)] = QChar( (unsigned int)hexdigits[(*buffer) % 16] ); + szRetBuffer[int(i)] = TQChar( (unsigned int)hexdigits[(*buffer) % 16] ); i++; buffer++; } diff --git a/src/kvilib/core/kvi_qstring.h b/src/kvilib/core/kvi_qstring.h index c82063e9..d5addebf 100644 --- a/src/kvilib/core/kvi_qstring.h +++ b/src/kvilib/core/kvi_qstring.h @@ -1,5 +1,5 @@ -#ifndef _KVI_QSTRING_H_ -#define _KVI_QSTRING_H_ +#ifndef _KVI_TQSTRING_H_ +#define _KVI_TQSTRING_H_ //============================================================================= // @@ -27,7 +27,7 @@ //============================================================================= // -// Helper functions for the QString class +// Helper functions for the TQString class // //============================================================================= @@ -36,109 +36,110 @@ #include "kvi_stdarg.h" #include "kvi_qcstring.h" -#include <qstring.h> +#include <tqstring.h> +#include <tqregexp.h> /// -/// \namespace KviQString +/// \namespace KviTQString /// -/// \brief A namespace for QString helper functions +/// \brief A namespace for TQString helper functions /// /// This namespace contains several helper functions -/// that are used when dealing with QString. +/// that are used when dealing with TQString. /// -namespace KviQString +namespace KviTQString { - extern KVILIB_API QString makeSizeReadable(size_t size); - extern KVILIB_API bool equalCS(const QString &sz1,const QString &sz2); - extern KVILIB_API bool equalCI(const QString &sz1,const QString &sz2); - extern KVILIB_API bool equalCS(const QString &sz1,const char * sz2); - extern KVILIB_API bool equalCI(const QString &sz1,const char * sz2); + extern KVILIB_API TQString makeSizeReadable(size_t size); + extern KVILIB_API bool equalCS(const TQString &sz1,const TQString &sz2); + extern KVILIB_API bool equalCI(const TQString &sz1,const TQString &sz2); + extern KVILIB_API bool equalCS(const TQString &sz1,const char * sz2); + extern KVILIB_API bool equalCI(const TQString &sz1,const char * sz2); // sz2 is assumed to be null terminated here! - extern KVILIB_API bool equalCI(const QString &sz1,const QChar * sz2); - inline bool equalCS(const char * sz1,const QString &sz2) + extern KVILIB_API bool equalCI(const TQString &sz1,const TQChar * sz2); + inline bool equalCS(const char * sz1,const TQString &sz2) { return equalCS(sz2,sz1); }; - inline bool equalCI(const char * sz1,const QString &sz2) + inline bool equalCI(const char * sz1,const TQString &sz2) { return equalCI(sz2,sz1); }; // sz1 is assumed to be null terminated here! - inline bool equalCI(const QChar * sz1,const QString &sz2) + inline bool equalCI(const TQChar * sz1,const TQString &sz2) { return equalCI(sz2,sz1); }; - extern KVILIB_API bool equalCSN(const QString &sz1,const QString &sz2,unsigned int len); - extern KVILIB_API bool equalCIN(const QString &sz1,const QString &sz2,unsigned int len); - extern KVILIB_API bool equalCSN(const QString &sz1,const char * sz2,unsigned int len); - extern KVILIB_API bool equalCIN(const QString &sz1,const char * sz2,unsigned int len); + extern KVILIB_API bool equalCSN(const TQString &sz1,const TQString &sz2,unsigned int len); + extern KVILIB_API bool equalCIN(const TQString &sz1,const TQString &sz2,unsigned int len); + extern KVILIB_API bool equalCSN(const TQString &sz1,const char * sz2,unsigned int len); + extern KVILIB_API bool equalCIN(const TQString &sz1,const char * sz2,unsigned int len); // sz2 is assumed to be null terminated here! - extern KVILIB_API bool equalCIN(const QString &sz1,const QChar * sz2,unsigned int len); - inline bool equalCSN(const char * sz1,const QString &sz2,unsigned int len) + extern KVILIB_API bool equalCIN(const TQString &sz1,const TQChar * sz2,unsigned int len); + inline bool equalCSN(const char * sz1,const TQString &sz2,unsigned int len) { return equalCSN(sz2,sz1,len); }; - inline bool equalCIN(const char * sz1,const QString &sz2,unsigned int len) + inline bool equalCIN(const char * sz1,const TQString &sz2,unsigned int len) { return equalCIN(sz2,sz1,len); }; // sz1 is assumed to be null terminated here! - inline bool equalCIN(const QChar * sz1,const QString &sz2,unsigned int len) + inline bool equalCIN(const TQChar * sz1,const TQString &sz2,unsigned int len) { return equalCIN(sz2,sz1,len); }; //note that greater here means that come AFTER in the alphabetic order // return < 0 ---> str1 < str2 // return = 0 ---> str1 = str2 // return > 0 ---> str1 > str2 - extern KVILIB_API int cmpCI(const QString &sz1,const QString &sz2); - extern KVILIB_API int cmpCIN(const QString &sz1,const QString &sz2,unsigned int len); - extern KVILIB_API int cmpCS(const QString &sz1,const QString &sz2); + extern KVILIB_API int cmpCI(const TQString &sz1,const TQString &sz2); + extern KVILIB_API int cmpCIN(const TQString &sz1,const TQString &sz2,unsigned int len); + extern KVILIB_API int cmpCS(const TQString &sz1,const TQString &sz2); - extern KVILIB_API void detach(QString &sz); + extern KVILIB_API void detach(TQString &sz); - // this makes the QString sz appear as a null terminated array - // it MAY RETURN 0 when the QString is null! - extern KVILIB_API const QChar * nullTerminatedArray(const QString &sz); + // this makes the TQString sz appear as a null terminated array + // it MAY RETURN 0 when the TQString is null! + extern KVILIB_API const TQChar * nullTerminatedArray(const TQString &sz); - inline bool lastCharIs(QString &szString,const QChar &c) + inline bool lastCharIs(TQString &szString,const TQChar &c) { return szString.endsWith(c); }; - extern KVILIB_API void ensureLastCharIs(QString &szString,const QChar &c); + extern KVILIB_API void ensureLastCharIs(TQString &szString,const TQChar &c); // wild expression matching - extern KVILIB_API bool matchWildExpressionsCI(const QString &szM1,const QString &szM2); + extern KVILIB_API bool matchWildExpressionsCI(const TQString &szM1,const TQString &szM2); // wild or regexp matching - extern KVILIB_API bool matchStringCI(const QString &szExp,const QString &szStr,bool bIsRegExp = false,bool bExact = false); - extern KVILIB_API bool matchStringCS(const QString &szExp,const QString &szStr,bool bIsRegExp = false,bool bExact = false); + extern KVILIB_API bool matchStringCI(const TQString &szExp,const TQString &szStr,bool bIsRegExp = false,bool bExact = false); + extern KVILIB_API bool matchStringCS(const TQString &szExp,const TQString &szStr,bool bIsRegExp = false,bool bExact = false); - extern KVILIB_API void vsprintf(QString &s,const QString &szFmt,kvi_va_list list); - extern KVILIB_API QString & sprintf(QString &s,const QString &szFmt,...); - extern KVILIB_API void stripRightWhiteSpace(QString &s); - extern KVILIB_API void stripLeft(QString &s,const QChar &c); - extern KVILIB_API void stripRight(QString &s,const QChar &c); - extern KVILIB_API void appendFormatted(QString &s,const QString &szFmt,...); - extern KVILIB_API void appendNumber(QString &s,double dReal); - extern KVILIB_API void appendNumber(QString &s,kvi_i64_t iInteger); - extern KVILIB_API void appendNumber(QString &s,int iInteger); - extern KVILIB_API void appendNumber(QString &s,unsigned int uInteger); - extern KVILIB_API void appendNumber(QString &s,kvi_u64_t uInteger); + extern KVILIB_API void vsprintf(TQString &s,const TQString &szFmt,kvi_va_list list); + extern KVILIB_API TQString & sprintf(TQString &s,const TQString &szFmt,...); + extern KVILIB_API void stripRightWhiteSpace(TQString &s); + extern KVILIB_API void stripLeft(TQString &s,const TQChar &c); + extern KVILIB_API void stripRight(TQString &s,const TQChar &c); + extern KVILIB_API void appendFormatted(TQString &s,const TQString &szFmt,...); + extern KVILIB_API void appendNumber(TQString &s,double dReal); + extern KVILIB_API void appendNumber(TQString &s,kvi_i64_t iInteger); + extern KVILIB_API void appendNumber(TQString &s,int iInteger); + extern KVILIB_API void appendNumber(TQString &s,unsigned int uInteger); + extern KVILIB_API void appendNumber(TQString &s,kvi_u64_t uInteger); - extern KVILIB_API void cutFromFirst(QString &s,const QChar &c,bool bIncluded = true); - extern KVILIB_API void cutFromLast(QString &s,const QChar &c,bool bIncluded = true); - extern KVILIB_API void cutToFirst(QString &s,const QChar &c,bool bIncluded = true,bool bClearIfNotFound = false); - extern KVILIB_API void cutToLast(QString &s,const QChar &c,bool bIncluded = true,bool bClearIfNotFound = false); - extern KVILIB_API void cutFromFirst(QString &s,const QString &c,bool bIncluded = true); - extern KVILIB_API void cutFromLast(QString &s,const QString &c,bool bIncluded = true); - extern KVILIB_API void cutToFirst(QString &s,const QString &c,bool bIncluded = true,bool bClearIfNotFound = false); - extern KVILIB_API void cutToLast(QString &s,const QString &c,bool bIncluded = true,bool bClearIfNotFound = false); + extern KVILIB_API void cutFromFirst(TQString &s,const TQChar &c,bool bIncluded = true); + extern KVILIB_API void cutFromLast(TQString &s,const TQChar &c,bool bIncluded = true); + extern KVILIB_API void cutToFirst(TQString &s,const TQChar &c,bool bIncluded = true,bool bClearIfNotFound = false); + extern KVILIB_API void cutToLast(TQString &s,const TQChar &c,bool bIncluded = true,bool bClearIfNotFound = false); + extern KVILIB_API void cutFromFirst(TQString &s,const TQString &c,bool bIncluded = true); + extern KVILIB_API void cutFromLast(TQString &s,const TQString &c,bool bIncluded = true); + extern KVILIB_API void cutToFirst(TQString &s,const TQString &c,bool bIncluded = true,bool bClearIfNotFound = false); + extern KVILIB_API void cutToLast(TQString &s,const TQString &c,bool bIncluded = true,bool bClearIfNotFound = false); - extern KVILIB_API QString upperISO88591(const QString &szSrc); - extern KVILIB_API QString lowerISO88591(const QString &szSrc); - extern KVILIB_API QString getToken(QString &szString,const QChar &sep); + extern KVILIB_API TQString upperISO88591(const TQString &szSrc); + extern KVILIB_API TQString lowerISO88591(const TQString &szSrc); + extern KVILIB_API TQString getToken(TQString &szString,const TQChar &sep); - extern KVILIB_API void transliterate(QString &s,const QString &szToFind,const QString &szReplacement); + extern KVILIB_API void transliterate(TQString &s,const TQString &szToFind,const TQString &szReplacement); - extern KVILIB_API void bufferToHex(QString &szRetBuffer,const unsigned char * buffer,unsigned int len); + extern KVILIB_API void bufferToHex(TQString &szRetBuffer,const unsigned char * buffer,unsigned int len); - // a global empty string (note that this is ALSO NULL under Qt 3.x) - extern KVILIB_API const QString empty; + // a global empty string (note that this is ALSO NULL under TQt 3.x) + extern KVILIB_API const TQString empty; /// - /// A portability wrapper which with Qt3 and Qt4. + /// A portability wrapper which with TQt3 and TQt4. /// Returns a lowcase version of the parameter string. /// - inline QString toLower(const QString &s) + inline TQString toLower(const TQString &s) { #ifdef COMPILE_USE_QT4 return s.toLower(); @@ -147,97 +148,97 @@ namespace KviQString #endif } - inline int find(const QString &s,QChar c,int index = 0,bool cs = true) + inline int tqfind(const TQString &s,TQChar c,int index = 0,bool cs = true) { #ifdef COMPILE_USE_QT4 - return s.indexOf(c,index,cs ? Qt::CaseSensitive : Qt::CaseInsensitive); + return s.indexOf(c,index,cs ? TQt::CaseSensitive : TQt::CaseInsensitive); #else - return s.find(c,index,cs); + return s.tqfind(c,index,cs); #endif } - inline int find(const QString &s,char c,int index = 0,bool cs = true) + inline int tqfind(const TQString &s,char c,int index = 0,bool cs = true) { #ifdef COMPILE_USE_QT4 - return s.indexOf(c,index,cs ? Qt::CaseSensitive : Qt::CaseInsensitive); + return s.indexOf(c,index,cs ? TQt::CaseSensitive : TQt::CaseInsensitive); #else - return s.find(c,index,cs); + return s.tqfind(c,index,cs); #endif } - inline int find(const QString &s,const QString & str,int index = 0,bool cs = true) + inline int tqfind(const TQString &s,const TQString & str,int index = 0,bool cs = true) { #ifdef COMPILE_USE_QT4 - return s.indexOf(str,index,cs ? Qt::CaseSensitive : Qt::CaseInsensitive); + return s.indexOf(str,index,cs ? TQt::CaseSensitive : TQt::CaseInsensitive); #else - return s.find(str,index,cs); + return s.tqfind(str,index,cs); #endif } - inline int find(const QString &s,const QRegExp & rx,int index = 0) + inline int tqfind(const TQString &s,const TQRegExp & rx,int index = 0) { #ifdef COMPILE_USE_QT4 return s.indexOf(rx,index); #else - return s.find(rx,index); + return s.tqfind(rx,index); #endif } - inline int find(const QString &s,const char * str,int index = 0) + inline int tqfind(const TQString &s,const char * str,int index = 0) { #ifdef COMPILE_USE_QT4 - return s.indexOf(QString(str),index); + return s.indexOf(TQString(str),index); #else - return s.find(str,index); + return s.tqfind(str,index); #endif } - inline int findRev(const QString &s,QChar c,int index = -1,bool cs = true) + inline int tqfindRev(const TQString &s,TQChar c,int index = -1,bool cs = true) { #ifdef COMPILE_USE_QT4 - return s.lastIndexOf(c,index,cs ? Qt::CaseSensitive : Qt::CaseInsensitive); + return s.lastIndexOf(c,index,cs ? TQt::CaseSensitive : TQt::CaseInsensitive); #else - return s.findRev(c,index,cs); + return s.tqfindRev(c,index,cs); #endif } - inline int findRev(const QString &s,char c,int index = -1,bool cs = true) + inline int tqfindRev(const TQString &s,char c,int index = -1,bool cs = true) { #ifdef COMPILE_USE_QT4 - return s.lastIndexOf(c,index,cs ? Qt::CaseSensitive : Qt::CaseInsensitive); + return s.lastIndexOf(c,index,cs ? TQt::CaseSensitive : TQt::CaseInsensitive); #else - return s.findRev(c,index,cs); + return s.tqfindRev(c,index,cs); #endif } - inline int findRev(const QString &s,const QString & str,int index = -1,bool cs = true) + inline int tqfindRev(const TQString &s,const TQString & str,int index = -1,bool cs = true) { #ifdef COMPILE_USE_QT4 - return s.lastIndexOf(str,index,cs ? Qt::CaseSensitive : Qt::CaseInsensitive); + return s.lastIndexOf(str,index,cs ? TQt::CaseSensitive : TQt::CaseInsensitive); #else - return s.findRev(str,index,cs); + return s.tqfindRev(str,index,cs); #endif } - inline int findRev(const QString &s,const QRegExp & rx,int index = -1) + inline int tqfindRev(const TQString &s,const TQRegExp & rx,int index = -1) { #ifdef COMPILE_USE_QT4 return s.lastIndexOf(rx,index); #else - return s.findRev(rx,index); + return s.tqfindRev(rx,index); #endif } - inline int findRev(const QString &s,const char * str,int index = -1) + inline int tqfindRev(const TQString &s,const char * str,int index = -1) { #ifdef COMPILE_USE_QT4 - return s.lastIndexOf(QString(str),index); + return s.lastIndexOf(TQString(str),index); #else - return s.findRev(str,index); + return s.tqfindRev(str,index); #endif } - inline QString trimmed(const QString &s) + inline TQString trimmed(const TQString &s) { #ifdef COMPILE_USE_QT4 return s.trimmed(); @@ -246,16 +247,16 @@ namespace KviQString #endif } - // WARNING: DO NOT USE CONSTRUCTS LIKE char * c = KviQString::toUtf8(something).data(); + // WARNING: DO NOT USE CONSTRUCTS LIKE char * c = KviTQString::toUtf8(something).data(); // They are dangerous since with many compilers the returned string gets destroyed - // at the end of the instruction and the c pointer gets thus invalidated. + // at the end of the instruction and the c pointer gets thus tqinvalidated. // Use - // KviQCString tmp = KviQString::toUtf8(something); + // KviTQCString tmp = KviTQString::toUtf8(something); // char * c = tmp.data(); // instead. // Yes, I know that it sucks, but it's the only way to // transit to qt 4.x more or less cleanly... - inline KviQCString toUtf8(const QString &s) + inline KviTQCString toUtf8(const TQString &s) { #ifdef COMPILE_USE_QT4 return s.toUtf8(); @@ -264,12 +265,12 @@ namespace KviQString #endif } - inline KviQCString toLocal8Bit(const QString &s) + inline KviTQCString toLocal8Bit(const TQString &s) { return s.local8Bit(); } - inline kvi_i64_t toI64(QString &szNumber,bool * bOk) + inline kvi_i64_t toI64(TQString &szNumber,bool * bOk) { #if SIZEOF_LONG_INT == 8 return szNumber.toLong(bOk); @@ -278,7 +279,7 @@ namespace KviQString #endif } - inline kvi_u64_t toU64(QString &szNumber,bool * bOk) + inline kvi_u64_t toU64(TQString &szNumber,bool * bOk) { #if SIZEOF_LONG_INT == 8 return szNumber.toULong(bOk); @@ -288,6 +289,6 @@ namespace KviQString } }; -// QT4SUX: Because QString::null is gone. QString() is SLOWER than QString::null since it invokes a constructor and destructor. +// QT4SUX: Because TQString() is gone. TQString() is SLOWER than TQString() since it invokes a constructor and destructor. -#endif //!_KVI_QSTRING_H_ +#endif //!_KVI_TQSTRING_H_ diff --git a/src/kvilib/core/kvi_string.cpp b/src/kvilib/core/kvi_string.cpp index 3f201352..df89122a 100644 --- a/src/kvilib/core/kvi_string.cpp +++ b/src/kvilib/core/kvi_string.cpp @@ -55,7 +55,7 @@ kvi_wslen_t kvi_wstrlen(const kvi_wchar_t * str) // %S = Latin1 KviStr pointer (#ifdef WSTRINGCONFIG_USE_KVISTR) : can't be NULL! // %W = KviWStr pointer : can't be NULL! -// %Q = QString pointer : can't be NULL! +// %Q = TQString pointer : can't be NULL! #define _WSTRING_WMEMCPY(_dst,_src,_len) kvi_fastmoveodd((void *)(_dst),(const void *)(_src),sizeof(kvi_wchar_t) * (_len)) #define _WSTRING_STRLEN(_str) kvi_strLen(_str) @@ -105,11 +105,11 @@ kvi_wslen_t kvi_wstrlen(const kvi_wchar_t * str) break; \ case 'Q': \ { \ - QString * pString = kvi_va_arg(list,QString *); \ + TQString * pString = kvi_va_arg(list,TQString *); \ if(pString->length() > 0) \ { \ if(len <= ((int)(pString->length())))return (-1); \ - _WSTRING_WMEMCPY(p,pString->unicode(),pString->length()); \ + _WSTRING_WMEMCPY(p,pString->tqunicode(),pString->length()); \ p += pString->length(); \ len -= pString->length(); \ } \ @@ -190,10 +190,10 @@ int kvi_wvsnprintf(kvi_wchar_t *buffer,kvi_wslen_t len,const kvi_wchar_t *fmt,kv WVSNPRINTF_BODY } -bool kvi_qstringEqualCI(const QString &s1,const QString &s2) +bool kvi_qstringEqualCI(const TQString &s1,const TQString &s2) { - const QChar * p1 = s1.unicode(); - const QChar * p2 = s2.unicode(); + const TQChar * p1 = s1.tqunicode(); + const TQChar * p2 = s2.tqunicode(); int l = s1.length() < s2.length() ? s1.length() : s2.length(); #ifdef COMPILE_USE_QT4 while(l-- && (p1->toLower() == p2->toLower()))p1++,p2++; @@ -402,8 +402,8 @@ bool kvi_matchWildExpr(register const char *m1,register const char *m2) // s1 // m1 - // mask1 : *xor - // mask2 : xorand*xor + // tqmask1 : *xor + // tqmask2 : xorand*xor // m2 // s2 @@ -423,7 +423,7 @@ bool kvi_matchWildExpr(register const char *m1,register const char *m2) const char * savePos2 = m2; while(*m1) { - //loop managed by m1 (initially first mask) + //loop managed by m1 (initially first tqmask) if(*m1=='*') { //Found a wildcard in m1 @@ -450,8 +450,8 @@ bool kvi_matchWildExpr(register const char *m1,register const char *m2) if(*m2 == '*') { //A wlidcard in the second string - //Invert the game : mask1 <-> mask2 - //mask2 now leads the game... + //Invert the game : tqmask1 <-> tqmask2 + //tqmask2 now leads the game... savePos1 = m1; //aux m1 = m2; //...swap m2 = savePos1; //...swap @@ -497,7 +497,7 @@ bool kvi_matchWildExprCS(register const char *m1,register const char *m2) if(!(m1 && m2 && (*m1)))return false; const char * savePos1 = 0; const char * savePos2 = m2; - while(*m1){ //loop managed by m1 (initially first mask) + while(*m1){ //loop managed by m1 (initially first tqmask) if(*m1=='*'){ //Found a wildcard in m1 savePos1 = ++m1; //move to the next char and save the position...this is our jolly @@ -520,8 +520,8 @@ bool kvi_matchWildExprCS(register const char *m1,register const char *m2) } else { if(*m2 == '*'){ //A wlidcard in the second string - //Invert the game : mask1 <-> mask2 - //mask2 now leads the game... + //Invert the game : tqmask1 <-> tqmask2 + //tqmask2 now leads the game... savePos1 = m1; //aux m1 = m2; //...swap m2 = savePos1; //...swap @@ -554,7 +554,7 @@ bool kvi_matchWildExprWithTerminator(register const char *m1,register const char const char * savePos2 = m2; while(NOT_AT_END(m1)) { - //loop managed by m1 (initially first mask) + //loop managed by m1 (initially first tqmask) if(*m1=='*') { //Found a wildcard in m1 @@ -588,8 +588,8 @@ bool kvi_matchWildExprWithTerminator(register const char *m1,register const char if(*m2 == '*') { //A wlidcard in the second string - //Invert the game : mask1 <-> mask2 - //mask2 now leads the game... + //Invert the game : tqmask1 <-> tqmask2 + //tqmask2 now leads the game... bSwapped = !bSwapped; savePos1 = m1; //aux m1 = m2; //...swap @@ -745,10 +745,10 @@ int kvi_vsnprintf(char *buffer,int len,const char *fmt,kvi_va_list list) *p++ = (char)kvi_va_arg(list,int); --len; continue; - case 'Q': // QString! (this should almost never happen) + case 'Q': // TQString! (this should almost never happen) { - QString * s = kvi_va_arg(list,QString *); - KviQCString cs = KviQString::toUtf8(*s); + TQString * s = kvi_va_arg(list,TQString *); + KviTQCString cs = KviTQString::toUtf8(*s); const char * t = cs.data(); if(!t)continue; // nothing to do //check for space... @@ -810,10 +810,10 @@ int kvi_irc_vsnprintf(char *buffer,const char *fmt,kvi_va_list list,bool *bTrunc if(--len < 3)goto truncate; } continue; - case 'Q': // QString! (this should almost never happen) + case 'Q': // TQString! (this should almost never happen) { - QString * s = kvi_va_arg(list,QString *); - KviQCString cs = KviQString::toUtf8(*s); + TQString * s = kvi_va_arg(list,TQString *); + KviTQCString cs = KviTQString::toUtf8(*s); const char * t = cs.data(); if(!t)continue; // nothing to do while(*t) @@ -1038,7 +1038,7 @@ KviStr::KviStr(const char *str) } } -KviStr::KviStr(const KviQCString &str) +KviStr::KviStr(const KviTQCString &str) { //Deep copy constructor if(str.data()) @@ -1115,9 +1115,9 @@ KviStr::KviStr(const KviStr &str) kvi_fastmove(m_ptr,str.m_ptr,m_len+1); } -KviStr::KviStr(const QString &str) +KviStr::KviStr(const TQString &str) { - KviQCString sz = KviQString::toUtf8(str); + KviTQCString sz = KviTQString::toUtf8(str); if(sz.length() > 0) { m_len = sz.length(); @@ -1141,23 +1141,23 @@ KviStr::KviStr(char c,int fillLen) } -KviStr::KviStr(const kvi_wchar_t * unicode) +KviStr::KviStr(const kvi_wchar_t * tqunicode) { - if(!unicode) + if(!tqunicode) { m_len = 0; m_ptr = (char *)kvi_malloc(1); *m_ptr = 0; } else { - m_len = kvi_wstrlen(unicode); + m_len = kvi_wstrlen(tqunicode); m_ptr = (char *)kvi_malloc(m_len + 1); register char * p = m_ptr; - while(*unicode)*p++ = *unicode++; + while(*tqunicode)*p++ = *tqunicode++; *p = 0; } } -KviStr::KviStr(const kvi_wchar_t * unicode,int len) +KviStr::KviStr(const kvi_wchar_t * tqunicode,int len) { m_len = len; m_ptr = (char *)kvi_malloc(m_len + 1); @@ -1165,7 +1165,7 @@ KviStr::KviStr(const kvi_wchar_t * unicode,int len) char * end = p + len; while(p != end) { - *p++ = *unicode++; + *p++ = *tqunicode++; } *p = 0; } @@ -1196,7 +1196,7 @@ KviStr & KviStr::operator=(const KviStr &str) return (*this); } -KviStr & KviStr::operator=(const KviQCString &str) +KviStr & KviStr::operator=(const KviTQCString &str) { m_len = str.length(); m_ptr = (char *)kvi_realloc(m_ptr,m_len+1); @@ -1342,7 +1342,7 @@ int KviStr::hexToBuffer(char ** buffer,bool bNullToNewlines) return len; } -static const char * base64_chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; +static const char * base64_chars = "ABCDEFGHIJKLMNOPTQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; void KviStr::bufferToBase64(const char * buffer,int len) @@ -1490,9 +1490,9 @@ KviStr & KviStr::setStr(const char *str,int len) return (*this); } -KviStr & KviStr::operator=(const QString &str) +KviStr & KviStr::operator=(const TQString &str) { - KviQCString sz = KviQString::toUtf8(str); + KviTQCString sz = KviTQString::toUtf8(str); if(sz.length() > 0){ m_len = sz.length(); m_ptr = (char *)kvi_realloc(m_ptr,m_len+1); @@ -1539,9 +1539,9 @@ void KviStr::append(const char *str) m_len += len; } -void KviStr::append(const QString &str) +void KviStr::append(const TQString &str) { - KviQCString sz = KviQString::toUtf8(str); + KviTQCString sz = KviTQString::toUtf8(str); if(sz.length() < 1)return; m_ptr = (char *)kvi_realloc(m_ptr,m_len+sz.length()+1); kvi_fastmove((m_ptr+m_len),sz.data(),sz.length()+1); @@ -2203,7 +2203,7 @@ int KviStr::occurences(const char *str,bool caseS) const return cnt; } -bool KviStr::contains(char c,bool caseS) const +bool KviStr::tqcontains(char c,bool caseS) const { register char *p = m_ptr; if(caseS) @@ -2224,7 +2224,7 @@ bool KviStr::contains(char c,bool caseS) const return false; } -bool KviStr::contains(const char *str,bool caseS) const +bool KviStr::tqcontains(const char *str,bool caseS) const { __range_valid(str); register char *p = m_ptr; @@ -2657,7 +2657,7 @@ KviStr & KviStr::sprintf(const char *fmt,...) return (*this); } -int KviStr::find(const char *str,int idx,bool caseS) const +int KviStr::tqfind(const char *str,int idx,bool caseS) const { if(idx >= m_len)return -1; register char *p=m_ptr + idx; @@ -2682,7 +2682,7 @@ int KviStr::find(const char *str,int idx,bool caseS) const } } -int KviStr::find(char c,int idx) const +int KviStr::tqfind(char c,int idx) const { if(idx >= m_len)return -1; register char *p=m_ptr + idx; @@ -2691,7 +2691,7 @@ int KviStr::find(char c,int idx) const } -int KviStr::findRev(const char *str,int idx,bool caseS) const +int KviStr::tqfindRev(const char *str,int idx,bool caseS) const { if((m_len + idx) < 0)return -1; register char *p=m_ptr + m_len + idx; @@ -2729,17 +2729,17 @@ int KviStr::findFirstIdx(const char *str,bool caseS) const { // This function can't be used to search inside // multibyte encoded strings... convert your - // code to QString and use QString::findRev(). + // code to TQString and use TQString::tqfindRev(). // We must throw away KviStr at all in this case... - // return QString(m_ptr).find(QString(str),0,caseS);; + // return TQString(m_ptr).tqfind(TQString(str),0,caseS);; // Both this KviStr and the const char * str are assumed // to be in the proper (and same) encoding. - // If KviStr is in encoding A then QString(m_ptr) might + // If KviStr is in encoding A then TQString(m_ptr) might // or not be decoded correctly. // Also if KviStr is in UTF-8 (for example), then - // a position in QString() does not map to the position in the char array + // a position in TQString() does not map to the position in the char array // since a single UNICODE char may use one or more bytes... __range_valid(str); @@ -2782,10 +2782,10 @@ int KviStr::findLastIdx(const char *str,bool caseS) const { // This function can't be used to search inside // multibyte encoded strings... convert your - // code to QString and use QString::findRev(). + // code to TQString and use TQString::tqfindRev(). // We must throw away KviStr at all in this case... - // return QString(m_ptr).findRev(QString(str),-1,caseS); + // return TQString(m_ptr).tqfindRev(TQString(str),-1,caseS); __range_valid(str); //Calc the len of the searched string @@ -2948,7 +2948,7 @@ KviStr & KviStr::emptyString() } -bool KviStr::ext_contains(register const char * data,const char * item,bool caseS) +bool KviStr::ext_tqcontains(register const char * data,const char * item,bool caseS) { if(item && data) { diff --git a/src/kvilib/core/kvi_string.h b/src/kvilib/core/kvi_string.h index 602173cd..4a7991bb 100644 --- a/src/kvilib/core/kvi_string.h +++ b/src/kvilib/core/kvi_string.h @@ -34,8 +34,8 @@ #include <strings.h> // useless ? #endif -#include <qglobal.h> -#include <qstring.h> +#include <tqglobal.h> +#include <tqstring.h> #include "kvi_qcstring.h" @@ -58,7 +58,7 @@ #endif -__KVI_EXTERN KVILIB_API bool kvi_qstringEqualCI(const QString &s1,const QString &s2); +__KVI_EXTERN KVILIB_API bool kvi_qstringEqualCI(const TQString &s1,const TQString &s2); // Include inlined assembly implementations if required @@ -146,18 +146,18 @@ public: // Compat with QT...<br> // WARNING : With QT2.x it WILL loose UNICODE data.<br> - // Safe even if the QString is null. - KviStr(const QString &str); + // Safe even if the TQString is null. + KviStr(const TQString &str); - KviStr(const KviQCString &str); + KviStr(const KviTQCString &str); // Fill sonstructor. // Creates a string long fillLen characters filled with character c.<br> KviStr(char c,int fillLen = 1); - KviStr(const kvi_wchar_t * unicode); + KviStr(const kvi_wchar_t * tqunicode); - KviStr(const kvi_wchar_t * unicode,int len); + KviStr(const kvi_wchar_t * tqunicode,int len); // just free(m_ptr) ~KviStr(); @@ -233,7 +233,7 @@ public: // append functions void append(const KviStr &str); - void append(const QString &str); + void append(const TQString &str); void append(char c); void append(const char *str); // str CAN be 0 void append(const char *str,int len); // str CAN NOT be 0, and MUST be at least len chars long @@ -257,14 +257,14 @@ public: KviStr & operator=(const KviStr &str); // deep copy KviStr & operator=(const char *str); // str can be NULL here KviStr & operator=(char c); // 2 bytes allocated ,m_len = 1 - KviStr & operator=(const QString &str); - KviStr & operator=(const KviQCString &str); + KviStr & operator=(const TQString &str); + KviStr & operator=(const KviTQCString &str); // Append operators KviStr & operator+=(const KviStr &str) { append(str); return (*this); }; KviStr & operator+=(const char *str) { append(str); return (*this); }; KviStr & operator+=(char c) { append(c); return (*this); }; - KviStr & operator+=(const QString &str) { append(str); return (*this); }; + KviStr & operator+=(const TQString &str) { append(str); return (*this); }; // Comparison bool equalsCI(const KviStr &other) const { if(m_len != other.m_len)return false; return kvi_strEqualCI(m_ptr,other.m_ptr); }; @@ -376,9 +376,9 @@ public: //============================================================================= // Returns true if at least one occurence of str is found - bool contains(const char *str,bool caseS=true) const; + bool tqcontains(const char *str,bool caseS=true) const; // Returns true if at least one occurence of character c is found in this string - bool contains(char c,bool caseS=true) const; + bool tqcontains(char c,bool caseS=true) const; // Returns the number of occurences of string str in this string.<br> // Overlapped matches are counted. int occurences(const char *str,bool caseS=true) const; @@ -405,9 +405,9 @@ public: // str can NOT be 0 here. int findLastIdx(const char *str,bool caseS = true) const; - int find(char c,int startIdx) const; - int find(const char * str,int startIdx,bool caseS = true) const; - int findRev(const char * str,int startIdx,bool caseS = true) const; + int tqfind(char c,int startIdx) const; + int tqfind(const char * str,int startIdx,bool caseS = true) const; + int tqfindRev(const char * str,int startIdx,bool caseS = true) const; //============================================================================= // Numbers @@ -462,7 +462,7 @@ public: //============================================================================= // FIXME: Should it be KviStrExt::contains namespace ? - static bool ext_contains(register const char * data,const char * item,bool caseS = true); + static bool ext_tqcontains(register const char * data,const char * item,bool caseS = true); }; // FIXME: the functions below should end in the KviStr namespace ??? diff --git a/src/kvilib/core/kvi_valuelist.h b/src/kvilib/core/kvi_valuelist.h index fde9d5b6..9ad234f2 100644 --- a/src/kvilib/core/kvi_valuelist.h +++ b/src/kvilib/core/kvi_valuelist.h @@ -27,11 +27,11 @@ #include "kvi_settings.h" #ifdef COMPILE_USE_QT4 - #include <q3valuelist.h> + #include <tq3valuelist.h> #define KviValueList Q3ValueList #else - #include <qvaluelist.h> - #define KviValueList QValueList + #include <tqvaluelist.h> + #define KviValueList TQValueList #endif #endif //_KVI_VALUELIST_H_ |