summaryrefslogtreecommitdiffstats
path: root/src/kvilib/core/kvi_qstring.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/kvilib/core/kvi_qstring.cpp')
-rw-r--r--src/kvilib/core/kvi_qstring.cpp117
1 files changed, 0 insertions, 117 deletions
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))
{