@ -54,8 +54,8 @@ namespace KviTQString
bool equalCSN ( const TQString & sz1 , const TQString & sz2 , unsigned int len )
bool equalCSN ( const TQString & sz1 , const TQString & sz2 , unsigned int len )
{
{
if ( len = = 0 ) return true ; // assume equal
if ( len = = 0 ) return true ; // assume equal
const TQChar * c1 = sz1 . tq unicode( ) ;
const TQChar * c1 = sz1 . unicode( ) ;
const TQChar * c2 = sz2 . tq unicode( ) ;
const TQChar * c2 = sz2 . unicode( ) ;
unsigned int lmin = MY_MIN ( sz1 . length ( ) , sz2 . length ( ) ) ;
unsigned int lmin = MY_MIN ( sz1 . length ( ) , sz2 . length ( ) ) ;
if ( lmin < len ) return false ;
if ( lmin < len ) return false ;
const TQChar * c1e = c1 + len ;
const TQChar * c1e = c1 + len ;
@ -64,7 +64,7 @@ namespace KviTQString
while ( c1 < c1e )
while ( c1 < c1e )
{
{
if ( c1 - > tq unicode( ) ! = c2 - > tq unicode( ) ) return false ;
if ( c1 - > unicode( ) ! = c2 - > unicode( ) ) return false ;
c1 + + ;
c1 + + ;
c2 + + ;
c2 + + ;
}
}
@ -74,8 +74,8 @@ namespace KviTQString
bool equalCIN ( const TQString & sz1 , const TQString & sz2 , unsigned int len )
bool equalCIN ( const TQString & sz1 , const TQString & sz2 , unsigned int len )
{
{
if ( len = = 0 ) return true ; // assume equal
if ( len = = 0 ) return true ; // assume equal
const TQChar * c1 = sz1 . tq unicode( ) ;
const TQChar * c1 = sz1 . unicode( ) ;
const TQChar * c2 = sz2 . tq unicode( ) ;
const TQChar * c2 = sz2 . unicode( ) ;
unsigned int lmin = MY_MIN ( sz1 . length ( ) , sz2 . length ( ) ) ;
unsigned int lmin = MY_MIN ( sz1 . length ( ) , sz2 . length ( ) ) ;
if ( lmin < len ) return false ;
if ( lmin < len ) return false ;
const TQChar * c1e = c1 + len ;
const TQChar * c1e = c1 + len ;
@ -85,9 +85,9 @@ namespace KviTQString
while ( c1 < c1e )
while ( c1 < c1e )
{
{
# ifdef COMPILE_USE_QT4
# ifdef COMPILE_USE_QT4
if ( c1 - > toLower ( ) . tq unicode( ) ! = c2 - > toLower ( ) . tq unicode( ) ) return false ;
if ( c1 - > toLower ( ) . unicode( ) ! = c2 - > toLower ( ) . unicode( ) ) return false ;
# else
# else
if ( c1 - > lower ( ) . tq unicode( ) ! = c2 - > lower ( ) . tq unicode( ) ) return false ;
if ( c1 - > lower ( ) . unicode( ) ! = c2 - > lower ( ) . unicode( ) ) return false ;
# endif
# endif
c1 + + ;
c1 + + ;
c2 + + ;
c2 + + ;
@ -98,7 +98,7 @@ namespace KviTQString
bool equalCSN ( const TQString & 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
if ( len = = 0 ) return true ; // assume equal
const TQChar * c1 = sz1 . tq unicode( ) ;
const TQChar * c1 = sz1 . unicode( ) ;
if ( sz1 . length ( ) < len ) return false ;
if ( sz1 . length ( ) < len ) return false ;
const TQChar * c1e = c1 + len ;
const TQChar * c1e = c1 + len ;
@ -107,7 +107,7 @@ namespace KviTQString
while ( ( c1 < c1e ) & & ( * sz2 ) )
while ( ( c1 < c1e ) & & ( * sz2 ) )
{
{
if ( c1 - > tq unicode( ) ! = * sz2 ) return false ;
if ( c1 - > unicode( ) ! = * sz2 ) return false ;
c1 + + ;
c1 + + ;
sz2 + + ;
sz2 + + ;
}
}
@ -117,7 +117,7 @@ namespace KviTQString
bool equalCIN ( const TQString & 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
if ( len = = 0 ) return true ; // assume equal
const TQChar * c1 = sz1 . tq unicode( ) ;
const TQChar * c1 = sz1 . unicode( ) ;
if ( sz1 . length ( ) < len ) return false ;
if ( sz1 . length ( ) < len ) return false ;
const TQChar * c1e = c1 + len ;
const TQChar * c1e = c1 + len ;
@ -127,9 +127,9 @@ namespace KviTQString
while ( ( c1 < c1e ) & & ( * sz2 ) )
while ( ( c1 < c1e ) & & ( * sz2 ) )
{
{
# ifdef COMPILE_USE_QT4
# ifdef COMPILE_USE_QT4
if ( c1 - > toLower ( ) . tq unicode( ) ! = tolower ( * sz2 ) ) return false ;
if ( c1 - > toLower ( ) . unicode( ) ! = tolower ( * sz2 ) ) return false ;
# else
# else
if ( c1 - > lower ( ) . tq unicode( ) ! = tolower ( * sz2 ) ) return false ;
if ( c1 - > lower ( ) . unicode( ) ! = tolower ( * sz2 ) ) return false ;
# endif
# endif
c1 + + ;
c1 + + ;
sz2 + + ;
sz2 + + ;
@ -141,19 +141,19 @@ namespace KviTQString
bool equalCIN ( const TQString & sz1 , const TQChar * sz2 , unsigned int len )
bool equalCIN ( const TQString & sz1 , const TQChar * sz2 , unsigned int len )
{
{
if ( len = = 0 ) return true ; // assume equal
if ( len = = 0 ) return true ; // assume equal
const TQChar * c1 = sz1 . tq unicode( ) ;
const TQChar * c1 = sz1 . unicode( ) ;
if ( sz1 . length ( ) < len ) return false ;
if ( sz1 . length ( ) < len ) return false ;
const TQChar * c1e = c1 + len ;
const TQChar * c1e = c1 + len ;
if ( ! sz2 ) return ! c1 ;
if ( ! sz2 ) return ! c1 ;
if ( ! c1 ) return ! ( sz2 - > tq unicode( ) ) ;
if ( ! c1 ) return ! ( sz2 - > unicode( ) ) ;
while ( ( c1 < c1e ) & & ( sz2 - > tq unicode( ) ) )
while ( ( c1 < c1e ) & & ( sz2 - > unicode( ) ) )
{
{
# ifdef COMPILE_USE_QT4
# ifdef COMPILE_USE_QT4
if ( c1 - > toLower ( ) . tq unicode( ) ! = sz2 - > toLower ( ) . tq unicode( ) ) return false ;
if ( c1 - > toLower ( ) . unicode( ) ! = sz2 - > toLower ( ) . unicode( ) ) return false ;
# else
# else
if ( c1 - > lower ( ) . tq unicode( ) ! = sz2 - > lower ( ) . tq unicode( ) ) return false ;
if ( c1 - > lower ( ) . unicode( ) ! = sz2 - > lower ( ) . unicode( ) ) return false ;
# endif
# endif
c1 + + ;
c1 + + ;
sz2 + + ;
sz2 + + ;
@ -189,15 +189,15 @@ namespace KviTQString
{
{
if ( sz1 . length ( ) ! = sz2 . length ( ) ) return false ;
if ( sz1 . length ( ) ! = sz2 . length ( ) ) return false ;
const TQChar * c1 = sz1 . tq unicode( ) ;
const TQChar * c1 = sz1 . unicode( ) ;
const TQChar * c2 = sz2 . tq unicode( ) ;
const TQChar * c2 = sz2 . unicode( ) ;
const TQChar * c1e = c1 + sz1 . length ( ) ;
const TQChar * c1e = c1 + sz1 . length ( ) ;
if ( ! c1 | | ! c2 ) return ( c1 = = c2 ) ;
if ( ! c1 | | ! c2 ) return ( c1 = = c2 ) ;
while ( c1 < c1e )
while ( c1 < c1e )
{
{
if ( c1 - > tq unicode( ) ! = c2 - > tq unicode( ) ) return false ;
if ( c1 - > unicode( ) ! = c2 - > unicode( ) ) return false ;
c1 + + ;
c1 + + ;
c2 + + ;
c2 + + ;
}
}
@ -208,8 +208,8 @@ namespace KviTQString
{
{
if ( sz1 . length ( ) ! = sz2 . length ( ) ) return false ;
if ( sz1 . length ( ) ! = sz2 . length ( ) ) return false ;
const TQChar * c1 = sz1 . tq unicode( ) ;
const TQChar * c1 = sz1 . unicode( ) ;
const TQChar * c2 = sz2 . tq unicode( ) ;
const TQChar * c2 = sz2 . unicode( ) ;
const TQChar * c1e = c1 + sz1 . length ( ) ;
const TQChar * c1e = c1 + sz1 . length ( ) ;
if ( ! c1 | | ! c2 ) return ( c1 = = c2 ) ;
if ( ! c1 | | ! c2 ) return ( c1 = = c2 ) ;
@ -217,9 +217,9 @@ namespace KviTQString
while ( c1 < c1e )
while ( c1 < c1e )
{
{
# ifdef COMPILE_USE_QT4
# ifdef COMPILE_USE_QT4
if ( c1 - > toLower ( ) . tq unicode( ) ! = c2 - > toLower ( ) . tq unicode( ) ) return false ;
if ( c1 - > toLower ( ) . unicode( ) ! = c2 - > toLower ( ) . unicode( ) ) return false ;
# else
# else
if ( c1 - > lower ( ) . tq unicode( ) ! = c2 - > lower ( ) . tq unicode( ) ) return false ;
if ( c1 - > lower ( ) . unicode( ) ! = c2 - > lower ( ) . unicode( ) ) return false ;
# endif
# endif
c1 + + ;
c1 + + ;
c2 + + ;
c2 + + ;
@ -230,35 +230,35 @@ namespace KviTQString
// sz2 is assumed to be null terminated, sz1 is not!
// sz2 is assumed to be null terminated, sz1 is not!
bool equalCI ( const TQString & sz1 , const TQChar * sz2 )
bool equalCI ( const TQString & sz1 , const TQChar * sz2 )
{
{
const TQChar * c1 = sz1 . tq unicode( ) ;
const TQChar * c1 = sz1 . unicode( ) ;
const TQChar * c1e = c1 + sz1 . length ( ) ;
const TQChar * c1e = c1 + sz1 . length ( ) ;
if ( ! c1 | | ! sz2 ) return ( c1 = = sz2 ) ;
if ( ! c1 | | ! sz2 ) return ( c1 = = sz2 ) ;
while ( c1 < c1e )
while ( c1 < c1e )
{
{
if ( ! sz2 - > tq unicode( ) ) return false ; // sz1 has at least another character
if ( ! sz2 - > unicode( ) ) return false ; // sz1 has at least another character
# ifdef COMPILE_USE_QT4
# ifdef COMPILE_USE_QT4
if ( c1 - > toLower ( ) . tq unicode( ) ! = sz2 - > toLower ( ) . tq unicode( ) ) return false ;
if ( c1 - > toLower ( ) . unicode( ) ! = sz2 - > toLower ( ) . unicode( ) ) return false ;
# else
# else
if ( c1 - > lower ( ) . tq unicode( ) ! = sz2 - > lower ( ) . tq unicode( ) ) return false ;
if ( c1 - > lower ( ) . unicode( ) ! = sz2 - > lower ( ) . unicode( ) ) return false ;
# endif
# endif
c1 + + ;
c1 + + ;
sz2 + + ;
sz2 + + ;
}
}
return ( c1 = = c1e ) & & ( ! sz2 - > tq unicode( ) ) ;
return ( c1 = = c1e ) & & ( ! sz2 - > unicode( ) ) ;
}
}
bool equalCS ( const TQString & sz1 , const char * sz2 )
bool equalCS ( const TQString & sz1 , const char * sz2 )
{
{
const TQChar * c1 = sz1 . tq unicode( ) ;
const TQChar * c1 = sz1 . unicode( ) ;
const TQChar * c1e = c1 + sz1 . length ( ) ;
const TQChar * c1e = c1 + sz1 . length ( ) ;
if ( ! c1 ) return ! sz2 ;
if ( ! c1 ) return ! sz2 ;
while ( ( c1 < c1e ) & & ( * sz2 ) )
while ( ( c1 < c1e ) & & ( * sz2 ) )
{
{
if ( c1 - > tq unicode( ) ! = * sz2 ) return false ;
if ( c1 - > unicode( ) ! = * sz2 ) return false ;
c1 + + ;
c1 + + ;
sz2 + + ;
sz2 + + ;
}
}
@ -267,7 +267,7 @@ namespace KviTQString
bool equalCI ( const TQString & sz1 , const char * sz2 )
bool equalCI ( const TQString & sz1 , const char * sz2 )
{
{
const TQChar * c1 = sz1 . tq unicode( ) ;
const TQChar * c1 = sz1 . unicode( ) ;
const TQChar * c1e = c1 + sz1 . length ( ) ;
const TQChar * c1e = c1 + sz1 . length ( ) ;
if ( ! c1 ) return ! sz2 ;
if ( ! c1 ) return ! sz2 ;
@ -275,9 +275,9 @@ namespace KviTQString
while ( ( c1 < c1e ) & & ( * sz2 ) )
while ( ( c1 < c1e ) & & ( * sz2 ) )
{
{
# ifdef COMPILE_USE_QT4
# ifdef COMPILE_USE_QT4
if ( c1 - > toLower ( ) . tq unicode( ) ! = tolower ( * sz2 ) ) return false ;
if ( c1 - > toLower ( ) . unicode( ) ! = tolower ( * sz2 ) ) return false ;
# else
# else
if ( c1 - > lower ( ) . tq unicode( ) ! = tolower ( * sz2 ) ) return false ;
if ( c1 - > lower ( ) . unicode( ) ! = tolower ( * sz2 ) ) return false ;
# endif
# endif
c1 + + ;
c1 + + ;
sz2 + + ;
sz2 + + ;
@ -287,8 +287,8 @@ namespace KviTQString
int cmpCS ( const TQString & sz1 , const TQString & sz2 )
int cmpCS ( const TQString & sz1 , const TQString & sz2 )
{
{
const TQChar * c1 = sz1 . tq unicode( ) ;
const TQChar * c1 = sz1 . unicode( ) ;
const TQChar * c2 = sz2 . tq unicode( ) ;
const TQChar * c2 = sz2 . unicode( ) ;
const TQChar * c1e = c1 + sz1 . length ( ) ;
const TQChar * c1e = c1 + sz1 . length ( ) ;
const TQChar * c2e = c2 + sz2 . length ( ) ;
const TQChar * c2e = c2 + sz2 . length ( ) ;
@ -304,12 +304,12 @@ namespace KviTQString
{
{
if ( c1 > = c1e )
if ( c1 > = c1e )
{
{
if ( c2 < c2e ) return /* 0 */ - ( c2 - > tq unicode( ) ) ;
if ( c2 < c2e ) return /* 0 */ - ( c2 - > unicode( ) ) ;
return 0 ;
return 0 ;
}
}
if ( c2 > = c2e ) return c1 - > tq unicode( ) /* - 0 */ ;
if ( c2 > = c2e ) return c1 - > unicode( ) /* - 0 */ ;
int diff = c1 - > tq unicode( ) - c2 - > tq unicode( ) ;
int diff = c1 - > unicode( ) - c2 - > unicode( ) ;
if ( diff ) return diff ;
if ( diff ) return diff ;
c1 + + ;
c1 + + ;
@ -321,8 +321,8 @@ namespace KviTQString
int cmpCI ( const TQString & sz1 , const TQString & sz2 )
int cmpCI ( const TQString & sz1 , const TQString & sz2 )
{
{
const TQChar * c1 = sz1 . tq unicode( ) ;
const TQChar * c1 = sz1 . unicode( ) ;
const TQChar * c2 = sz2 . tq unicode( ) ;
const TQChar * c2 = sz2 . unicode( ) ;
const TQChar * c1e = c1 + sz1 . length ( ) ;
const TQChar * c1e = c1 + sz1 . length ( ) ;
const TQChar * c2e = c2 + sz2 . length ( ) ;
const TQChar * c2e = c2 + sz2 . length ( ) ;
@ -338,22 +338,22 @@ namespace KviTQString
if ( c1 > = c1e )
if ( c1 > = c1e )
{
{
# ifdef COMPILE_USE_QT4
# ifdef COMPILE_USE_QT4
if ( c2 < c2e ) return /* 0 */ - ( c2 - > toLower ( ) . tq unicode( ) ) ;
if ( c2 < c2e ) return /* 0 */ - ( c2 - > toLower ( ) . unicode( ) ) ;
# else
# else
if ( c2 < c2e ) return /* 0 */ - ( c2 - > lower ( ) . tq unicode( ) ) ;
if ( c2 < c2e ) return /* 0 */ - ( c2 - > lower ( ) . unicode( ) ) ;
# endif
# endif
return 0 ;
return 0 ;
}
}
# ifdef COMPILE_USE_QT4
# ifdef COMPILE_USE_QT4
if ( c2 > = c2e ) return c1 - > toLower ( ) . tq unicode( ) /* - 0 */ ;
if ( c2 > = c2e ) return c1 - > toLower ( ) . unicode( ) /* - 0 */ ;
# else
# else
if ( c2 > = c2e ) return c1 - > lower ( ) . tq unicode( ) /* - 0 */ ;
if ( c2 > = c2e ) return c1 - > lower ( ) . unicode( ) /* - 0 */ ;
# endif
# endif
# ifdef COMPILE_USE_QT4
# ifdef COMPILE_USE_QT4
int diff = c1 - > toLower ( ) . tq unicode( ) - c2 - > toLower ( ) . tq unicode( ) ;
int diff = c1 - > toLower ( ) . unicode( ) - c2 - > toLower ( ) . unicode( ) ;
# else
# else
int diff = c1 - > lower ( ) . tq unicode( ) - c2 - > lower ( ) . tq unicode( ) ;
int diff = c1 - > lower ( ) . unicode( ) - c2 - > lower ( ) . unicode( ) ;
# endif
# endif
if ( diff ) return diff ;
if ( diff ) return diff ;
@ -370,8 +370,8 @@ namespace KviTQString
unsigned int l1 = MY_MIN ( len , sz1 . length ( ) ) ;
unsigned int l1 = MY_MIN ( len , sz1 . length ( ) ) ;
unsigned int l = MY_MIN ( l1 , sz2 . length ( ) ) ; // FIXME: THIS IS NOT OK
unsigned int l = MY_MIN ( l1 , sz2 . length ( ) ) ; // FIXME: THIS IS NOT OK
const TQChar * c1 = sz1 . tq unicode( ) ;
const TQChar * c1 = sz1 . unicode( ) ;
const TQChar * c2 = sz2 . tq unicode( ) ;
const TQChar * c2 = sz2 . unicode( ) ;
const TQChar * c1e = c1 + l ;
const TQChar * c1e = c1 + l ;
if ( ! c1 )
if ( ! c1 )
@ -384,9 +384,9 @@ namespace KviTQString
int diff = 0 ;
int diff = 0 ;
# ifdef COMPILE_USE_QT4
# ifdef COMPILE_USE_QT4
while ( ( c1 < c1e ) & & ! ( diff = ( c1 - > toLower ( ) . tq unicode( ) - c2 - > toLower ( ) . tq unicode( ) ) ) )
while ( ( c1 < c1e ) & & ! ( diff = ( c1 - > toLower ( ) . unicode( ) - c2 - > toLower ( ) . unicode( ) ) ) )
# else
# else
while ( ( c1 < c1e ) & & ! ( diff = ( c1 - > lower ( ) . tq unicode( ) - c2 - > lower ( ) . tq unicode( ) ) ) )
while ( ( c1 < c1e ) & & ! ( diff = ( c1 - > lower ( ) . unicode( ) - c2 - > lower ( ) . unicode( ) ) ) )
# endif
# endif
{
{
c1 + + ;
c1 + + ;
@ -533,7 +533,7 @@ namespace KviTQString
}
}
TQChar * buffer = ( TQChar * ) kvi_malloc ( sizeof ( TQChar ) * allocsize ) ;
TQChar * buffer = ( TQChar * ) kvi_malloc ( sizeof ( TQChar ) * allocsize ) ;
//TQChar * p = (TQChar *)s. tq unicode();
//TQChar * p = (TQChar *)s. unicode();
char * argString ;
char * argString ;
long argValue ;
long argValue ;
@ -561,12 +561,12 @@ namespace KviTQString
}
}
for ( ; fmt - > tq unicode( ) ; + + fmt )
for ( ; fmt - > unicode( ) ; + + fmt )
{
{
if ( reallen = = allocsize ) INCREMENT_MEM
if ( reallen = = allocsize ) INCREMENT_MEM
//copy up to a '%'
//copy up to a '%'
if ( fmt - > tq unicode( ) ! = ' % ' )
if ( fmt - > unicode( ) ! = ' % ' )
{
{
* p + + = * fmt ;
* p + + = * fmt ;
reallen + + ;
reallen + + ;
@ -574,7 +574,7 @@ namespace KviTQString
}
}
+ + fmt ; //skip this '%'
+ + fmt ; //skip this '%'
switch ( fmt - > tq unicode( ) )
switch ( fmt - > unicode( ) )
{
{
case ' s ' : // char * string
case ' s ' : // char * string
{
{
@ -583,7 +583,7 @@ namespace KviTQString
TQString str ( argString ) ;
TQString str ( argString ) ;
if ( str . isEmpty ( ) ) continue ;
if ( str . isEmpty ( ) ) continue ;
int len = str . length ( ) ;
int len = str . length ( ) ;
const TQChar * ch = str . tq unicode( ) ;
const TQChar * ch = str . unicode( ) ;
if ( ! ch ) continue ;
if ( ! ch ) continue ;
if ( ( allocsize - reallen ) < len ) INCREMENT_MEM_BY ( len )
if ( ( allocsize - reallen ) < len ) INCREMENT_MEM_BY ( len )
while ( len - - ) * p + + = * ch + + ;
while ( len - - ) * p + + = * ch + + ;
@ -606,7 +606,7 @@ namespace KviTQString
if ( ! str ) continue ;
if ( ! str ) continue ;
if ( str - > isEmpty ( ) ) continue ;
if ( str - > isEmpty ( ) ) continue ;
int len = str - > length ( ) ;
int len = str - > length ( ) ;
const TQChar * ch = str - > tq unicode( ) ;
const TQChar * ch = str - > unicode( ) ;
if ( ! ch ) continue ;
if ( ! ch ) continue ;
if ( ( allocsize - reallen ) < len ) INCREMENT_MEM_BY ( len )
if ( ( allocsize - reallen ) < len ) INCREMENT_MEM_BY ( len )
while ( len - - ) * p + + = * ch + + ;
while ( len - - ) * p + + = * ch + + ;
@ -721,7 +721,7 @@ namespace KviTQString
{
{
* p + + = ' % ' ; //write it
* p + + = ' % ' ; //write it
reallen + + ;
reallen + + ;
if ( fmt - > tq unicode( ) )
if ( fmt - > unicode( ) )
{
{
if ( reallen = = allocsize ) INCREMENT_MEM
if ( reallen = = allocsize ) INCREMENT_MEM
* p + + = * fmt ;
* p + + = * fmt ;
@ -789,21 +789,21 @@ namespace KviTQString
const TQChar * m2 = ( const TQChar * ) szM2 . ucs2 ( ) ;
const TQChar * m2 = ( const TQChar * ) szM2 . ucs2 ( ) ;
# endif
# endif
if ( ! ( m1 & & m2 & & ( m1 - > tq unicode( ) ) ) ) return false ;
if ( ! ( m1 & & m2 & & ( m1 - > unicode( ) ) ) ) return false ;
const TQChar * savePos1 = 0 ;
const TQChar * savePos1 = 0 ;
const TQChar * savePos2 = m2 ;
const TQChar * savePos2 = m2 ;
while ( m1 - > tq unicode( ) )
while ( m1 - > unicode( ) )
{
{
//loop managed by m1 (initially first mask)
//loop managed by m1 (initially first mask)
if ( m1 - > tq unicode( ) = = ' * ' )
if ( m1 - > unicode( ) = = ' * ' )
{
{
//Found a wildcard in m1
//Found a wildcard in m1
savePos1 = + + m1 ; //move to the next char and save the position...this is our jolly
savePos1 = + + m1 ; //move to the next char and save the position...this is our jolly
if ( ! savePos1 - > tq unicode( ) ) return true ; //last was a wildcard , matches everything ahead...
if ( ! savePos1 - > unicode( ) ) return true ; //last was a wildcard , matches everything ahead...
savePos2 = m2 + 1 ; //next return state for the second string
savePos2 = m2 + 1 ; //next return state for the second string
continue ; //and return
continue ; //and return
}
}
if ( ! m2 - > tq unicode( ) ) return false ; //m2 finished and we had something to match here!
if ( ! m2 - > unicode( ) ) return false ; //m2 finished and we had something to match here!
# ifdef COMPILE_USE_QT4
# ifdef COMPILE_USE_QT4
if ( m1 - > toLower ( ) = = m2 - > toLower ( ) )
if ( m1 - > toLower ( ) = = m2 - > toLower ( ) )
# else
# else
@ -813,7 +813,7 @@ namespace KviTQString
//chars matched
//chars matched
m1 + + ; //Go ahead in the two strings
m1 + + ; //Go ahead in the two strings
m2 + + ; //
m2 + + ; //
if ( ( ! ( m1 - > tq unicode( ) ) ) & & m2 - > tq unicode( ) & & savePos1 )
if ( ( ! ( m1 - > unicode( ) ) ) & & m2 - > unicode( ) & & savePos1 )
{
{
//m1 finished , but m2 not yet and we have a savePosition for m1 (there was a wildcard)...
//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)
//retry matching the string following the * from the savePos2 (one char ahead last time)
@ -822,7 +822,7 @@ namespace KviTQString
savePos2 + + ; //next savePos2 will be next char
savePos2 + + ; //next savePos2 will be next char
}
}
} else {
} else {
if ( m2 - > tq unicode( ) = = ' * ' )
if ( m2 - > unicode( ) = = ' * ' )
{
{
//A wlidcard in the second string
//A wlidcard in the second string
//Invert the game : mask1 <-> mask2
//Invert the game : mask1 <-> mask2
@ -835,11 +835,11 @@ namespace KviTQString
continue ; //...and again
continue ; //...and again
}
}
// m1 != m2 , m1 != * , m2 != *
// m1 != m2 , m1 != * , m2 != *
if ( ( m1 - > tq unicode( ) = = ' ? ' ) | | ( m2 - > tq unicode( ) = = ' ? ' ) )
if ( ( m1 - > unicode( ) = = ' ? ' ) | | ( m2 - > unicode( ) = = ' ? ' ) )
{
{
m1 + + ;
m1 + + ;
m2 + + ;
m2 + + ;
if ( ( ! ( m1 - > tq unicode( ) ) ) & & m2 - > tq unicode( ) & & savePos1 )
if ( ( ! ( m1 - > unicode( ) ) ) & & m2 - > unicode( ) & & savePos1 )
{
{
//m1 finished , but m2 not yet and we have a savePosition for m1 (there was a wildcard)...
//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)
//retry matching the string following the * from the savePos2 (one char ahead last time)
@ -858,7 +858,7 @@ namespace KviTQString
}
}
}
}
}
}
return ( ! ( m2 - > tq unicode( ) ) ) ; //m1 surely finished , so for the match , m2 must be finished too
return ( ! ( m2 - > unicode( ) ) ) ; //m1 surely finished , so for the match , m2 must be finished too
}
}
bool matchStringCI ( const TQString & szExp , const TQString & szStr , bool bIsRegExp , bool bExact )
bool matchStringCI ( const TQString & szExp , const TQString & szStr , bool bIsRegExp , bool bExact )
@ -870,9 +870,9 @@ namespace KviTQString
TQChar * ptr = ( TQChar * ) szExp . ucs2 ( ) ;
TQChar * ptr = ( TQChar * ) szExp . ucs2 ( ) ;
# endif
# endif
if ( ! ptr ) return 0 ;
if ( ! ptr ) return 0 ;
while ( ptr - > tq unicode( ) )
while ( ptr - > unicode( ) )
{
{
if ( ( ptr - > tq unicode( ) = = ' [ ' ) | | ( ptr - > tq unicode( ) = = ' ] ' ) )
if ( ( ptr - > unicode( ) = = ' [ ' ) | | ( ptr - > unicode( ) = = ' ] ' ) )
{
{
szWildcard . append ( " [ " ) ;
szWildcard . append ( " [ " ) ;
szWildcard . append ( * ptr ) ;
szWildcard . append ( * ptr ) ;
@ -904,9 +904,9 @@ namespace KviTQString
TQChar * ptr = ( TQChar * ) szExp . ucs2 ( ) ;
TQChar * ptr = ( TQChar * ) szExp . ucs2 ( ) ;
# endif
# endif
if ( ! ptr ) return 0 ;
if ( ! ptr ) return 0 ;
while ( ptr - > tq unicode( ) )
while ( ptr - > unicode( ) )
{
{
if ( ( ptr - > tq unicode( ) = = ' [ ' ) ) // <-- hum ?
if ( ( ptr - > unicode( ) = = ' [ ' ) ) // <-- hum ?
{
{
szWildcard . append ( " [ " ) ;
szWildcard . append ( " [ " ) ;
szWildcard . append ( * ptr ) ;
szWildcard . append ( * ptr ) ;
@ -1043,7 +1043,7 @@ namespace KviTQString
}
}
TQChar * buffer = ( TQChar * ) kvi_malloc ( sizeof ( TQChar ) * szSrc . length ( ) ) ;
TQChar * buffer = ( TQChar * ) kvi_malloc ( sizeof ( TQChar ) * szSrc . length ( ) ) ;
TQChar * b = buffer ;
TQChar * b = buffer ;
unsigned short us = c - > tq unicode( ) ;
unsigned short us = c - > unicode( ) ;
while ( us )
while ( us )
{
{
if ( us < 256 )
if ( us < 256 )
@ -1052,7 +1052,7 @@ namespace KviTQString
* b = * c ;
* b = * c ;
c + + ;
c + + ;
b + + ;
b + + ;
us = c - > tq unicode( ) ;
us = c - > unicode( ) ;
}
}
TQString ret ( buffer , szSrc . length ( ) ) ;
TQString ret ( buffer , szSrc . length ( ) ) ;
kvi_free ( buffer ) ;
kvi_free ( buffer ) ;
@ -1069,7 +1069,7 @@ namespace KviTQString
}
}
TQChar * buffer = ( TQChar * ) kvi_malloc ( sizeof ( TQChar ) * szSrc . length ( ) ) ;
TQChar * buffer = ( TQChar * ) kvi_malloc ( sizeof ( TQChar ) * szSrc . length ( ) ) ;
TQChar * b = buffer ;
TQChar * b = buffer ;
unsigned short us = c - > tq unicode( ) ;
unsigned short us = c - > unicode( ) ;
while ( us )
while ( us )
{
{
if ( us < 256 )
if ( us < 256 )
@ -1079,7 +1079,7 @@ namespace KviTQString
* b = * c ;
* b = * c ;
c + + ;
c + + ;
b + + ;
b + + ;
us = c - > tq unicode( ) ;
us = c - > unicode( ) ;
}
}
TQString ret ( buffer , szSrc . length ( ) ) ;
TQString ret ( buffer , szSrc . length ( ) ) ;
kvi_free ( buffer ) ;
kvi_free ( buffer ) ;