diff options
author | Michele Calgaro <[email protected]> | 2023-08-24 21:28:39 +0900 |
---|---|---|
committer | Michele Calgaro <[email protected]> | 2023-08-31 16:31:47 +0900 |
commit | 7c3b44b81086c6b99f91e294c3b438dc808b47e2 (patch) | |
tree | d92d61649487df1a2fbd200d4ead11a7f16ba63f /src/kvilib/core | |
parent | cafbffba66b6ce809783ed1eb4d24aac6fe9701f (diff) | |
download | kvirc-7c3b44b81086c6b99f91e294c3b438dc808b47e2.tar.gz kvirc-7c3b44b81086c6b99f91e294c3b438dc808b47e2.zip |
Drop USE_QT4 code
Signed-off-by: Michele Calgaro <[email protected]>
(cherry picked from commit 030a2248f3630fd0404df98beffc78b5b5ca4c31)
Diffstat (limited to 'src/kvilib/core')
-rw-r--r-- | src/kvilib/core/kvi_pointerhashtable.h | 4 | ||||
-rw-r--r-- | src/kvilib/core/kvi_pointerlist.h | 5 | ||||
-rw-r--r-- | src/kvilib/core/kvi_qcstring.h | 10 | ||||
-rw-r--r-- | src/kvilib/core/kvi_qstring.cpp | 117 | ||||
-rw-r--r-- | src/kvilib/core/kvi_qstring.h | 55 | ||||
-rw-r--r-- | src/kvilib/core/kvi_string.cpp | 4 | ||||
-rw-r--r-- | src/kvilib/core/kvi_valuelist.h | 5 |
7 files changed, 3 insertions, 197 deletions
diff --git a/src/kvilib/core/kvi_pointerhashtable.h b/src/kvilib/core/kvi_pointerhashtable.h index 99e513f3..d7e84759 100644 --- a/src/kvilib/core/kvi_pointerhashtable.h +++ b/src/kvilib/core/kvi_pointerhashtable.h @@ -244,11 +244,7 @@ inline unsigned int kvi_hash_hash(const TQString &szKey,bool bCaseSensitive) } else { while(p->unicode()) { -#ifdef COMPILE_USE_QT4 - uResult += p->toLower().unicode(); -#else uResult += p->lower().unicode(); -#endif p++; } } diff --git a/src/kvilib/core/kvi_pointerlist.h b/src/kvilib/core/kvi_pointerlist.h index c9746c29..b46343c3 100644 --- a/src/kvilib/core/kvi_pointerlist.h +++ b/src/kvilib/core/kvi_pointerlist.h @@ -36,10 +36,7 @@ // 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 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 TQt4 in favor of the value based non-autodeleting -// lists... anyway: here we go :) +// to the TQt<=3.x series. #include "kvi_settings.h" diff --git a/src/kvilib/core/kvi_qcstring.h b/src/kvilib/core/kvi_qcstring.h index 9406115c..97e6e423 100644 --- a/src/kvilib/core/kvi_qcstring.h +++ b/src/kvilib/core/kvi_qcstring.h @@ -27,13 +27,7 @@ #include "kvi_settings.h" -#ifdef COMPILE_USE_QT4 - #include <tq3cstring.h> // includes <qbytearray.h> - #define KviTQCString TQByteArray -#else - // this is dead in TQt 4.x - #include <tqcstring.h> - #define KviTQCString TQCString -#endif +#include <tqcstring.h> +#define KviTQCString TQCString #endif //!_KVI_TQCSTRING_H_ diff --git a/src/kvilib/core/kvi_qstring.cpp b/src/kvilib/core/kvi_qstring.cpp index 84beaa07..a477527b 100644 --- a/src/kvilib/core/kvi_qstring.cpp +++ b/src/kvilib/core/kvi_qstring.cpp @@ -84,11 +84,7 @@ namespace KviTQString while(c1 < c1e) { -#ifdef COMPILE_USE_QT4 - if(c1->toLower().unicode() != c2->toLower().unicode())return false; -#else if(c1->lower().unicode() != c2->lower().unicode())return false; -#endif c1++; c2++; } @@ -126,11 +122,7 @@ namespace KviTQString while((c1 < c1e) && (*sz2)) { -#ifdef COMPILE_USE_QT4 - if(c1->toLower().unicode() != tolower(*sz2))return false; -#else if(c1->lower().unicode() != tolower(*sz2))return false; -#endif c1++; sz2++; } @@ -150,11 +142,7 @@ namespace KviTQString while((c1 < c1e) && (sz2->unicode())) { -#ifdef COMPILE_USE_QT4 - if(c1->toLower().unicode() != sz2->toLower().unicode())return false; -#else if(c1->lower().unicode() != sz2->lower().unicode())return false; -#endif c1++; sz2++; } @@ -216,11 +204,7 @@ namespace KviTQString while(c1 < c1e) { -#ifdef COMPILE_USE_QT4 - if(c1->toLower().unicode() != c2->toLower().unicode())return false; -#else if(c1->lower().unicode() != c2->lower().unicode())return false; -#endif c1++; c2++; } @@ -238,11 +222,7 @@ namespace KviTQString while(c1 < c1e) { if(!sz2->unicode())return false; // sz1 has at least another character -#ifdef COMPILE_USE_QT4 - if(c1->toLower().unicode() != sz2->toLower().unicode())return false; -#else if(c1->lower().unicode() != sz2->lower().unicode())return false; -#endif c1++; sz2++; } @@ -274,11 +254,7 @@ namespace KviTQString while((c1 < c1e) && (*sz2)) { -#ifdef COMPILE_USE_QT4 - if(c1->toLower().unicode() != tolower(*sz2))return false; -#else if(c1->lower().unicode() != tolower(*sz2))return false; -#endif c1++; sz2++; } @@ -337,24 +313,12 @@ namespace KviTQString { if(c1 >= c1e) { -#ifdef COMPILE_USE_QT4 - if(c2 < c2e)return /* 0 */ - (c2->toLower().unicode()); -#else if(c2 < c2e)return /* 0 */ - (c2->lower().unicode()); -#endif return 0; } -#ifdef COMPILE_USE_QT4 - if(c2 >= c2e)return c1->toLower().unicode() /* - 0 */; -#else if(c2 >= c2e)return c1->lower().unicode() /* - 0 */; -#endif -#ifdef COMPILE_USE_QT4 - int diff = c1->toLower().unicode() - c2->toLower().unicode(); -#else int diff = c1->lower().unicode() - c2->lower().unicode(); -#endif if(diff)return diff; c1++; @@ -383,11 +347,7 @@ namespace KviTQString int diff = 0; -#ifdef COMPILE_USE_QT4 - while((c1 < c1e) && !(diff = (c1->toLower().unicode() - c2->toLower().unicode()))) -#else while((c1 < c1e) && !(diff = (c1->lower().unicode() - c2->lower().unicode()))) -#endif { c1++; c2++; @@ -464,21 +424,13 @@ namespace KviTQString void detach(TQString &sz) { -#ifdef COMPILE_USE_QT4 - sz.resize(sz.length()); -#else sz.setLength(sz.length()); -#endif } const TQChar * nullTerminatedArray(const TQString &sz) { //sz.setLength(sz.length()); // detach! -#ifdef COMPILE_USE_QT4 - return sz.constData(); -#else return (const TQChar *)sz.ucs2(); // MAY BE NULL! -#endif } void appendNumber(TQString &s,double dReal) @@ -781,13 +733,8 @@ namespace KviTQString // s1 // -#ifdef COMPILE_USE_QT4 - const TQChar * m1 = (const TQChar *)szM1.constData(); - const TQChar * m2 = (const TQChar *)szM2.constData(); -#else const TQChar * m1 = (const TQChar *)szM1.ucs2(); const TQChar * m2 = (const TQChar *)szM2.ucs2(); -#endif if(!(m1 && m2 && (m1->unicode())))return false; const TQChar * savePos1 = 0; @@ -804,11 +751,7 @@ namespace KviTQString continue; //and return } if(!m2->unicode())return false; //m2 finished and we had something to match here! -#ifdef COMPILE_USE_QT4 - if(m1->toLower()==m2->toLower()) -#else if(m1->lower()==m2->lower()) -#endif { //chars matched m1++; //Go ahead in the two strings @@ -864,11 +807,7 @@ namespace KviTQString bool matchStringCI(const TQString &szExp,const TQString &szStr,bool bIsRegExp,bool bExact) { TQString szWildcard; -#ifdef COMPILE_USE_QT4 - TQChar* ptr=(TQChar*)szExp.constData(); -#else TQChar* ptr=(TQChar*)szExp.ucs2(); -#endif if(!ptr) return 0; while(ptr->unicode()) { @@ -882,27 +821,15 @@ namespace KviTQString } ptr++; } -#ifdef COMPILE_USE_QT4 - TQRegExp re(szWildcard,TQt::CaseInsensitive,bIsRegExp ? TQRegExp::RegExp : TQRegExp::Wildcard); -#else TQRegExp re(szWildcard,false,!bIsRegExp); -#endif if(bExact) return re.exactMatch(szStr); -#ifdef COMPILE_USE_QT4 - return re.indexIn(szStr) != -1; -#else return re.search(szStr) != -1; -#endif } bool matchStringCS(const TQString &szExp,const TQString &szStr,bool bIsRegExp,bool bExact) { TQString szWildcard; -#ifdef COMPILE_USE_QT4 - TQChar* ptr=(TQChar*)szExp.constData(); -#else TQChar* ptr=(TQChar*)szExp.ucs2(); -#endif if(!ptr) return 0; while(ptr->unicode()) { @@ -916,48 +843,28 @@ namespace KviTQString } ptr++; } -#ifdef COMPILE_USE_QT4 - TQRegExp re(szWildcard,TQt::CaseSensitive,bIsRegExp ? TQRegExp::RegExp : TQRegExp::Wildcard); -#else TQRegExp re(szWildcard,true,!bIsRegExp); -#endif if(bExact) return re.exactMatch(szStr); -#ifdef COMPILE_USE_QT4 - return re.indexIn(szStr) != -1; -#else return re.search(szStr) != -1; -#endif } void cutFromFirst(TQString &s,const TQChar &c,bool bIncluded) { -#ifdef COMPILE_USE_QT4 - int idx = s.indexOf(c); -#else int idx = s.find(c); -#endif if(idx == -1)return; s.truncate(bIncluded ? idx : idx + 1); } void cutFromLast(TQString &s,const TQChar &c,bool bIncluded) { -#ifdef COMPILE_USE_QT4 - int idx = s.lastIndexOf(c); -#else int idx = s.findRev(c); -#endif if(idx == -1)return; s.truncate(bIncluded ? idx : idx + 1); } 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); -#endif if(idx == -1) { if(bClearIfNotFound)s = ""; @@ -968,11 +875,7 @@ namespace KviTQString 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); -#endif if(idx == -1) { if(bClearIfNotFound)s = ""; @@ -983,33 +886,21 @@ namespace KviTQString void cutFromFirst(TQString &s,const TQString &c,bool bIncluded) { -#ifdef COMPILE_USE_QT4 - int idx = s.indexOf(c); -#else int idx = s.find(c); -#endif if(idx == -1)return; s.truncate(bIncluded ? idx : idx + c.length()); } void cutFromLast(TQString &s,const TQString &c,bool bIncluded) { -#ifdef COMPILE_USE_QT4 - int idx = s.lastIndexOf(c); -#else int idx = s.findRev(c); -#endif if(idx == -1)return; s.truncate(bIncluded ? idx : idx + c.length()); } 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); -#endif if(idx == -1) { if(bClearIfNotFound)s = ""; @@ -1020,11 +911,7 @@ namespace KviTQString 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); -#endif if(idx == -1) { if(bClearIfNotFound)s = ""; @@ -1107,11 +994,7 @@ namespace KviTQString void bufferToHex(TQString &szRetBuffer,const unsigned char * buffer,unsigned int len) { -#ifdef COMPILE_USE_QT4 - szRetBuffer.resize(len * 2); -#else szRetBuffer.setLength(len * 2); -#endif unsigned int i=0; while(i < (len*2)) { diff --git a/src/kvilib/core/kvi_qstring.h b/src/kvilib/core/kvi_qstring.h index 7f9f7e73..8d70ba5f 100644 --- a/src/kvilib/core/kvi_qstring.h +++ b/src/kvilib/core/kvi_qstring.h @@ -136,115 +136,66 @@ namespace KviTQString extern KVILIB_API const TQString empty; /// - /// A portability wrapper which with TQt3 and TQt4. /// Returns a lowcase version of the parameter string. /// inline TQString toLower(const TQString &s) { -#ifdef COMPILE_USE_QT4 - return s.toLower(); -#else return s.lower(); -#endif } inline int find(const TQString &s,TQChar c,int index = 0,bool cs = true) { -#ifdef COMPILE_USE_QT4 - return s.indexOf(c,index,cs ? TQt::CaseSensitive : TQt::CaseInsensitive); -#else return s.find(c,index,cs); -#endif } inline int find(const TQString &s,char c,int index = 0,bool cs = true) { -#ifdef COMPILE_USE_QT4 - return s.indexOf(c,index,cs ? TQt::CaseSensitive : TQt::CaseInsensitive); -#else return s.find(c,index,cs); -#endif } inline int find(const TQString &s,const TQString & str,int index = 0,bool cs = true) { -#ifdef COMPILE_USE_QT4 - return s.indexOf(str,index,cs ? TQt::CaseSensitive : TQt::CaseInsensitive); -#else return s.find(str,index,cs); -#endif } inline int find(const TQString &s,const TQRegExp & rx,int index = 0) { -#ifdef COMPILE_USE_QT4 - return s.indexOf(rx,index); -#else return s.find(rx,index); -#endif } inline int find(const TQString &s,const char * str,int index = 0) { -#ifdef COMPILE_USE_QT4 - return s.indexOf(TQString(str),index); -#else return s.find(str,index); -#endif } inline int findRev(const TQString &s,TQChar c,int index = -1,bool cs = true) { -#ifdef COMPILE_USE_QT4 - return s.lastIndexOf(c,index,cs ? TQt::CaseSensitive : TQt::CaseInsensitive); -#else return s.findRev(c,index,cs); -#endif } inline int findRev(const TQString &s,char c,int index = -1,bool cs = true) { -#ifdef COMPILE_USE_QT4 - return s.lastIndexOf(c,index,cs ? TQt::CaseSensitive : TQt::CaseInsensitive); -#else return s.findRev(c,index,cs); -#endif } inline int findRev(const TQString &s,const TQString & str,int index = -1,bool cs = true) { -#ifdef COMPILE_USE_QT4 - return s.lastIndexOf(str,index,cs ? TQt::CaseSensitive : TQt::CaseInsensitive); -#else return s.findRev(str,index,cs); -#endif } inline int findRev(const TQString &s,const TQRegExp & rx,int index = -1) { -#ifdef COMPILE_USE_QT4 - return s.lastIndexOf(rx,index); -#else return s.findRev(rx,index); -#endif } inline int findRev(const TQString &s,const char * str,int index = -1) { -#ifdef COMPILE_USE_QT4 - return s.lastIndexOf(TQString(str),index); -#else return s.findRev(str,index); -#endif } inline TQString trimmed(const TQString &s) { -#ifdef COMPILE_USE_QT4 - return s.trimmed(); -#else return s.stripWhiteSpace(); -#endif } // WARNING: DO NOT USE CONSTRUCTS LIKE char * c = KviTQString::toUtf8(something).data(); @@ -258,11 +209,7 @@ namespace KviTQString // transit to qt 4.x more or less cleanly... inline KviTQCString toUtf8(const TQString &s) { -#ifdef COMPILE_USE_QT4 - return s.toUtf8(); -#else return s.utf8(); -#endif } inline KviTQCString toLocal8Bit(const TQString &s) @@ -289,6 +236,4 @@ namespace KviTQString } }; -// QT4SUX: Because TQString() is gone. TQString() is SLOWER than TQString() since it invokes a constructor and destructor. - #endif //!_KVI_TQSTRING_H_ diff --git a/src/kvilib/core/kvi_string.cpp b/src/kvilib/core/kvi_string.cpp index c133f20f..9e491ccb 100644 --- a/src/kvilib/core/kvi_string.cpp +++ b/src/kvilib/core/kvi_string.cpp @@ -195,11 +195,7 @@ bool kvi_qstringEqualCI(const TQString &s1,const TQString &s2) const TQChar * p1 = s1.unicode(); const TQChar * p2 = s2.unicode(); int l = s1.length() < s2.length() ? s1.length() : s2.length(); -#ifdef COMPILE_USE_QT4 - while(l-- && (p1->toLower() == p2->toLower()))p1++,p2++; -#else while(l-- && (p1->lower() == p2->lower()))p1++,p2++; -#endif if(l==-1)return true; return false; } diff --git a/src/kvilib/core/kvi_valuelist.h b/src/kvilib/core/kvi_valuelist.h index 9ad234f2..c5a2e624 100644 --- a/src/kvilib/core/kvi_valuelist.h +++ b/src/kvilib/core/kvi_valuelist.h @@ -26,12 +26,7 @@ #include "kvi_settings.h" -#ifdef COMPILE_USE_QT4 - #include <tq3valuelist.h> - #define KviValueList Q3ValueList -#else #include <tqvaluelist.h> #define KviValueList TQValueList -#endif #endif //_KVI_VALUELIST_H_ |