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.cpp410
1 files changed, 205 insertions, 205 deletions
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++;
}