cstring.temp.h

Go to the documentation of this file.
00001 
00008 #ifndef tchar
00009 #error These templates require 'tchar' to be defined so they know what sort of \
00010 characters to make.  'tchar' may be 'wchar_t' or 'char'.
00011 #endif
00012 
00013 
00022 bool ctl_sconst_(tchar, strchr )( ctl_sconst( tchar )* self, tchar ch )
00023 {
00024     const tchar* p, *e;
00025     assertobjptr(self);
00026     p = self->parse;
00027     e = self->end;
00028     while( p < e )
00029     {
00030         if( *p == ch )
00031         {
00032             self->parse = p;
00033             return true;
00034         }
00035         p++;
00036     }
00037     return false;
00038 }
00039 
00048 bool ctl_sconst_(tchar, strichr )( ctl_sconst( tchar )* self, tchar ch )
00049 {
00050     const tchar* p, *e;
00051     assertobjptr(self);
00052     p = self->parse;
00053     e = self->end;
00054     ch = ctolower(tchar)(ch);
00055     while( p < e )
00056     {
00057         if( ctolower(tchar)(*p) == ch )
00058         {
00059             self->parse = p;
00060             return true;
00061         }
00062         p++;
00063     }
00064     return false;
00065 }
00066 
00075 bool ctl_sconst_(tchar, strstr )( ctl_sconst( tchar )* self, const tchar* sz )
00076 {
00077     const tchar* p, *e;
00078     size_t szLen;
00079     assertobjptr(self);
00080     assertconst(sz,sizeof(tchar));
00081     szLen = cstrlen(tchar)(sz);
00082     p = self->parse;
00083     e = self->end - szLen;
00084     while( p < e )
00085     {
00086         if( *p == *sz && !cstrncmp(tchar)(p,sz,szLen) )
00087         {
00088             self->parse = p;
00089             return true;
00090         }
00091         p++;
00092     }
00093     return false;
00094 }
00095 
00104 bool ctl_sconst_(tchar, stristr )( ctl_sconst( tchar )* self, const tchar* sz )
00105 {
00106     const tchar* p, *e;
00107     tchar ch;
00108     size_t szLen;
00109     assertobjptr(self);
00110     assertconst(sz,sizeof(tchar));
00111     szLen = cstrlen(tchar)(sz);
00112     p = self->parse;
00113     e = self->end - szLen;
00114     ch = ctolower(tchar)(*sz);
00115     while( p < e )
00116     {
00117         if( ctolower(tchar)(*p) == ch && !cstrnicmp(tchar)(p,sz,szLen) )
00118         {
00119             self->parse = p;
00120             return true;
00121         }
00122         p++;
00123     }
00124     return false;
00125 }
00126 
00135 bool ctl_sconst_(tchar, strpbrk )( ctl_sconst( tchar )* self, const tchar* szSet )
00136 {
00137     const tchar* p, *e;
00138     assertobjptr(self);
00139     assertconst(szSet,sizeof(tchar));
00140     p = self->parse;
00141     e = self->end;
00142     while( p < e )
00143     {
00144         if( cstrchr(tchar)(szSet,*p) )
00145         {
00146             self->parse = p;
00147             return true;
00148         }
00149         p++;
00150     }
00151     return false;
00152 }
00153 
00165 bool ctl_sconst_(tchar, dmatch )( ctl_sconst( tchar )* self, ctl_sconst( tchar )* substring, tchar chOpen, tchar chClose )
00166 {
00167     /* Skipe over *anything* between present start ans first match of chOpen */
00168     assertobjptr(self);
00169     assertconst(substring,sizeof(tchar));
00170     ctl_sconst_copy(tchar, substring, self );
00171     if( ctl_sconst_(tchar, strchr )(substring, chOpen ) )
00172     {
00173         int matchCount = 1;
00174         const tchar *p = substring->begin = substring->parse+ 1;
00175         const tchar* const e = substring->end;
00176         while( p < e )
00177         {
00178             if( *p == chOpen )
00179             {
00180                 matchCount++;
00181             }
00182             else if( *p == chClose )
00183             {
00184                 matchCount--;
00185                 if( 0 == matchCount )
00186                 {
00187                     self->parse = p + 1;
00188                     substring->end = p;
00189                     substring->parse = substring->begin;
00190                     return true;
00191                 }
00192             }
00193             p++;
00194         }
00195     }
00196     return false;
00197 }
00198 
00209 bool ctl_sconst_(tchar, dmatchstr )( ctl_sconst( tchar )* self, ctl_sconst( tchar )* substring, const tchar* szOpen, const tchar* szClose )
00210 {
00211     /* Skips over *anything* between present start ans first match of chOpen */
00212     size_t openLen;
00213     assertobjptr(self);
00214     assertconst(substring,sizeof(tchar));
00215     assertconst(szOpen,sizeof(tchar));
00216     assertconst(szClose,sizeof(tchar));
00217     openLen = cstrlen(tchar)(szOpen);
00218     ctl_sconst_copy(tchar, substring, self );
00219     if( ctl_sconst_(tchar, strstr )(substring, szOpen ) )
00220     {
00221         int matchCount = 1;
00222         size_t closeLen = cstrlen(tchar)(szClose);
00223         const tchar *p = substring->begin = substring->parse + openLen;
00224         const tchar* const e = substring->end;
00225         const tchar* const es = e - closeLen;
00226         while( p <= es )
00227         {
00228             if( (size_t)(e-p) >= openLen && *p == *szOpen && !cstrncmp(tchar)(p,szOpen,openLen) )
00229             {
00230                 matchCount++;
00231                 p += openLen;
00232                 continue;
00233             }
00234             else if( *p == *szClose && !cstrncmp(tchar)(p,szClose,closeLen) )
00235             {
00236                 matchCount--;
00237                 if( 0 == matchCount )
00238                 {
00239                     self->parse = p+closeLen;
00240                     substring->end = p;
00241                     substring->parse = substring->begin;
00242                     return true;
00243                 }
00244                 else
00245                 {
00246                     p += closeLen;
00247                     continue;
00248                 }
00249             }
00250             p++;
00251         }
00252     }
00253     return false;
00254 }
00255 
00263 bool ctl_sconst_(tchar, skipspace )( ctl_sconst( tchar )* self )
00264 {
00265     const tchar* p, *e;
00266     assertobjptr(self);
00267     p = self->parse;
00268     e = self->end;
00269     while( cisspace(tchar)(*p) && p < e )
00270         p++;
00271     if( p < e )
00272     {
00273         self->parse = p;
00274         return true;
00275     }
00276     return false;
00277 }
00278 
00286 bool ctl_sconst_(tchar, nextspace )( ctl_sconst( tchar )* self )
00287 {
00288     const tchar* p, *e;
00289     assertobjptr(self);
00290     p = self->parse;
00291     e = self->end;
00292     while( !cisspace(tchar)(*p) && p < e )
00293         p++;
00294     if( p < e )
00295     {
00296         self->parse = p;
00297         return true;
00298     }
00299     return false;
00300 }
00301 
00310 int  ctl_sconst_(tchar, strcmp )( const ctl_sconst( tchar )* self, const tchar* sz )
00311 {
00312     const tchar* p, *e;
00313     size_t lensz;
00314     size_t len;
00315     assertobjconst(self);
00316     assertconst(sz,1);
00317     p = self->parse;
00318     e = self->end;
00319     lensz = cstrlen(tchar)(sz);
00320     len = e-p;
00321     if(len>lensz)
00322     {
00323         int i = cstrncmp(tchar)(p,sz,lensz);
00324         if(i)
00325             return i;
00326         return 1;
00327     }
00328     else if(len<lensz)
00329     {
00330         int i = cstrncmp(tchar)(p,sz,len);
00331         if(i)
00332             return i;
00333         return -1;
00334     }
00335     return cstrncmp(tchar)(p,sz,len);
00336 }
00337 
00346 int  ctl_sconst_(tchar, stricmp )( const ctl_sconst( tchar )* self, const tchar* sz )
00347 {
00348     const tchar* p, *e;
00349     size_t lensz;
00350     size_t len;
00351     assertobjconst(self);
00352     assertconst(sz,1);
00353     p = self->parse;
00354     e = self->end;
00355     lensz = cstrlen(tchar)(sz);
00356     len = e-p;
00357     if(len>lensz)
00358     {
00359         int i = cstrnicmp(tchar)(p,sz,lensz);
00360         if(i)
00361             return i;
00362         return 1;
00363     }
00364     else if(len<lensz)
00365     {
00366         int i = cstrnicmp(tchar)(p,sz,len);
00367         if(i)
00368             return i;
00369         return -1;
00370     }
00371     return cstrnicmp(tchar)(p,sz,len);
00372 }
00373 
00383 int  ctl_sconst_(tchar, strncmp )( const ctl_sconst( tchar )* self, const tchar* sz, size_t count )
00384 {
00385     const tchar* p, *e;
00386     size_t lensz;
00387     size_t len;
00388     assertobjconst(self);
00389     assertconst(sz,1);
00390     p = self->parse;
00391     e = self->end;
00392     lensz = cstrnlen(tchar)(sz,count);
00393     len = e-p;
00394     if(len>lensz)
00395     {
00396         return cstrncmp(tchar)(p,sz,lensz);
00397     }
00398     else if(len<lensz)
00399     {
00400         int i = cstrncmp(tchar)(p,sz,len);
00401         if(i)
00402             return i;
00403         return -1;
00404     }
00405     return cstrncmp(tchar)(p,sz,len);
00406 }
00407 
00417 int  ctl_sconst_(tchar, strnicmp )( const ctl_sconst( tchar )* self, const tchar* sz, size_t count )
00418 {
00419     const tchar* p, *e;
00420     size_t lensz;
00421     size_t len;
00422     assertobjconst(self);
00423     assertconst(sz,1);
00424     p = self->parse;
00425     e = self->end;
00426     lensz = cstrnlen(tchar)(sz,count);
00427     len = e-p;
00428     if(len>lensz)
00429     {
00430         int i = cstrnicmp(tchar)(p,sz,lensz);
00431         if(i)
00432             return i;
00433         return 1;
00434     }
00435     else if(len<lensz)
00436     {
00437         int i = cstrnicmp(tchar)(p,sz,len);
00438         if(i)
00439             return i;
00440         return -1;
00441     }
00442     return cstrnicmp(tchar)(p,sz,len);
00443 }
00444 
00453 int  ctl_sconst_(tchar, compare )( const ctl_sconst( tchar )* self, const ctl_sconst( tchar )* other )
00454 {
00455     const tchar* p, *e, *op, *oe;
00456     assertobjconst(self);
00457     assertconst(other,1);
00458     p = self->begin;
00459     e = self->end;
00460     op = other->begin;
00461     oe = other->end;
00462     while( p < e && op < oe )
00463     {
00464         int diff = *p++-*op++;
00465         if( diff )
00466             return diff;
00467     }
00468     if( p < e )
00469         return 1;
00470     else if( op < oe )
00471         return -1;
00472     else return 0;
00473 }
00474 
00483 int  ctl_sconst_(tchar, icompare )( const ctl_sconst( tchar )* self, const ctl_sconst( tchar )* other )
00484 {
00485     const tchar* p, *e, *op, *oe;
00486     assertobjconst(self);
00487     assertconst(other,1);
00488     p = self->begin;
00489     e = self->end;
00490     op = other->begin;
00491     oe = other->end;
00492     while( p < e && op < oe )
00493     {
00494         int diff = tolower(*p++)-tolower(*op++);
00495         if( diff )
00496             return diff;
00497     }
00498     if( p < e )
00499         return 1;
00500     else if( op < oe )
00501         return -1;
00502     else return 0;
00503 }
00504 
00513 bool ctl_sconst_(tchar, getbool )( ctl_sconst( tchar )* self, bool* pBool )
00514 {
00515     assertobjptr(self);
00516     assertptr(pBool,sizeof(bool));
00517     if( ctl_sconst_(tchar, skipspace )(self) )
00518     {
00519         const tchar* p = self->parse;
00520         const tchar* e = self->end;
00521         if( p < e )
00522         {
00523             const tchar* szztruefalse[] = { szconst(tchar,"false"), szconst(tchar,"true"), NULL };
00524             const tchar* szzonoff[] = { szconst(tchar,"off"), szconst(tchar,"on"), NULL };
00525             const tchar* szzyesno[] = { szconst(tchar,"no"), szconst(tchar,"yes"), NULL };
00526             const tchar* szztf[] = { szconst(tchar,"f"), szconst(tchar,"t"), NULL };
00527             const tchar* szzyn[] = { szconst(tchar,"n"), szconst(tchar,"y"), NULL };
00528             int tmp;
00529             if( *p == chconst(tchar,'-') || cisdigit(tchar)(*p) )
00530             {
00531                 int32 tmp;
00532                 if( ctl_sconst_(tchar, getint32 )(self,&tmp) )
00533                 {
00534                     *pBool = 0 != tmp;
00535                     return true;
00536                 }
00537             }
00538             else if(ctl_sconst_(tchar, getienum )( self, &tmp, szztruefalse ) ||
00539                     ctl_sconst_(tchar, getienum )( self, &tmp, szzonoff ) ||
00540                     ctl_sconst_(tchar, getienum )( self, &tmp, szzyesno ) ||
00541                     ctl_sconst_(tchar, getienum )( self, &tmp, szztf ) ||
00542                     ctl_sconst_(tchar, getienum )( self, &tmp, szzyn ) )
00543             {
00544                 *pBool = tmp;
00545                 return true;
00546             }
00547         }
00548     }
00549     return *pBool = false;
00550 }
00551 
00560 bool ctl_sconst_(tchar, getint8 )( ctl_sconst( tchar )* self, int8* value )
00561 {
00562     int32 val;
00563     bool ret;
00564     assertobjptr(self);
00565     assertptr(value,sizeof(*value));
00566     val = 0;
00567     ret = ctl_sconst_(tchar, getint32 )( self, &val );
00568     *value = (int8)val;
00569     return ret;
00570 }
00571 
00579 bool ctl_sconst_(tchar, getuint8 )( ctl_sconst( tchar )* self, uint8* value )
00580 {
00581     uint32 val;
00582     bool ret;
00583     assertobjptr(self);
00584     assertptr(value,sizeof(*value));
00585     val = 0;
00586     ret = ctl_sconst_(tchar, getuint32 )( self, &val );
00587     *value = (uint8)val;
00588     return ret;
00589 }
00590 
00599 bool ctl_sconst_(tchar, getint16 )( ctl_sconst( tchar )* self, int16* value )
00600 {
00601     int32 val;
00602     bool ret;
00603     assertobjptr(self);
00604     assertptr(value,sizeof(*value));
00605 
00606     val = 0;
00607     ret = ctl_sconst_(tchar, getint32 )( self, &val );
00608     *value = (int16)val;
00609     return ret;
00610 }
00611 
00620 bool ctl_sconst_(tchar, getuint16 )( ctl_sconst( tchar )* self, uint16* value )
00621 {
00622     uint32 val;
00623     bool ret;
00624     assertobjptr(self);
00625     assertptr(value,sizeof(*value));
00626     val = 0;
00627     ret = ctl_sconst_(tchar, getuint32 )( self, &val );
00628     *value = (uint16)val;
00629     return ret;
00630 }
00631 
00640 bool ctl_sconst_(tchar, getint32 )( ctl_sconst( tchar )* self, int32* value )
00641 {
00642     bool ret;
00643     assertobjptr(self);
00644     assertptr(value,sizeof(*value));
00645 
00646     ret = false;
00647     if( ctl_sconst_(tchar, skipspace )( self ) )
00648     {
00649         bool bSign = false;
00650         const tchar* p = self->parse;
00651         const tchar* e = self->end;
00652         *value = 0;
00653         if( e <= p )
00654             return false;
00655         if( *p == chconst(tchar,'-') )
00656         {
00657             bSign = true;
00658             ++p;
00659         }
00660         while( e > p && cisdigit(tchar)(*p) )
00661         {
00662             *value *= 10;
00663             *value += *p++ - chconst(tchar,'0');
00664             ret = true;
00665         }
00666         if( bSign )
00667             *value = -*value;
00668         if( ret )
00669             self->parse = p;
00670     }
00671     return ret;
00672 }
00673 
00682 bool ctl_sconst_(tchar, getuint32 )( ctl_sconst( tchar )* self, uint32* value )
00683 {
00684     bool ret;
00685     assertobjptr(self);
00686     assertptr(value,sizeof(*value));
00687 
00688     ret = false;
00689     if( ctl_sconst_(tchar, skipspace )( self ) )
00690     {
00691         const tchar* p = self->parse;
00692         const tchar* e = self->end;
00693         *value = 0;
00694         while( e > p && cisdigit(tchar)(*p) )
00695         {
00696             *value *= 10;
00697             *value += *p++ - chconst(tchar,'0');
00698             ret = true;
00699         }
00700         if( ret )
00701             self->parse = p;
00702     }
00703     return ret;
00704 }
00705 
00714 bool ctl_sconst_(tchar, getint64 )( ctl_sconst( tchar )* self, int64* value )
00715 {
00716     bool ret;
00717     assertobjptr(self);
00718     assertptr(value,sizeof(*value));
00719 
00720     ret = false;
00721     if( ctl_sconst_(tchar, skipspace )( self ) )
00722     {
00723         bool bSign = false;
00724         const tchar* p = self->parse;
00725         const tchar* e = self->end;
00726         *value = 0;
00727         if( e <= p )
00728             return false;
00729         if( *p == chconst(tchar,'-') )
00730         {
00731             bSign = true;
00732             ++p;
00733         }
00734         while( e > p && cisdigit(tchar)(*p) )
00735         {
00736             *value *= 10;
00737             *value += *p++ - chconst(tchar,'0');
00738             ret = true;
00739         }
00740         if( bSign )
00741             *value = -*value;
00742         if( ret )
00743             self->parse = p;
00744     }
00745     return ret;
00746 }
00747 
00756 bool ctl_sconst_(tchar, getuint64 )( ctl_sconst( tchar )* self, uint64* value )
00757 {
00758     bool ret;
00759     assertobjptr(self);
00760     assertptr(value,sizeof(*value));
00761 
00762     ret = false;
00763     if( ctl_sconst_(tchar, skipspace )( self ) )
00764     {
00765         const tchar* p = self->parse;
00766         const tchar* e = self->end;
00767         *value = 0;
00768         while( e > p && cisdigit(tchar)(*p) )
00769         {
00770             *value *= 10;
00771             *value += *p++ - chconst(tchar,'0');
00772             ret = true;
00773         }
00774         if( ret )
00775             self->parse = p;
00776     }
00777     return ret;
00778 }
00779 
00788 bool ctl_sconst_(tchar, getfloat32 )( ctl_sconst( tchar )* self, float32* value )
00789 {
00790     tchar* p;
00791     assertobjptr(self);
00792     assertptr(value,sizeof(*value));
00793 
00794     p = (tchar*)self->parse;
00795     *value = (float32)cstrtof(tchar)(p,&p);
00796     if( p > self->end || p == self->parse )
00797     {
00798         *value = 0;
00799         return false;
00800     }
00801     self->parse = p;
00802     return true;
00803 }
00804 
00813 bool ctl_sconst_(tchar, getfloat64 )( ctl_sconst( tchar )* self, float64* value )
00814 {
00815     tchar* p;
00816     assertobjptr(self);
00817     assertptr(value,sizeof(*value));
00818 
00819     p = (tchar*)self->parse;
00820     *value = cstrtod(tchar)(p,&p);
00821     if( p > self->end || p == self->parse )
00822     {
00823         *value = 0;
00824         return false;
00825     }
00826     self->parse = p;
00827     return true;
00828 }
00829 
00839 bool ctl_sconst_(tchar, getxint8 )( ctl_sconst( tchar )* self, int8* value )
00840 {
00841     uint32 tmp;
00842     assertobjptr(self);
00843     assertptr(value,sizeof(*value));
00844 
00845     if( ctl_sconst_(tchar, getxuint32 )( self, &tmp, 2 ) )
00846     {
00847         *value = (uint8)tmp;
00848         return true;
00849     }
00850     return false;
00851 }
00852 
00862 bool ctl_sconst_(tchar, getxuint8 )( ctl_sconst( tchar )* self, uint8* value )
00863 {
00864     uint32 tmp;
00865     assertobjptr(self);
00866     assertptr(value,sizeof(*value));
00867 
00868     if( ctl_sconst_(tchar, getxuint32 )( self, &tmp, 2 ) )
00869     {
00870         *value = (uint8)tmp;
00871         return true;
00872     }
00873     return false;
00874 }
00875 
00885 bool ctl_sconst_(tchar, getxint16 )( ctl_sconst( tchar )* self, int16* value )
00886 {
00887     uint32 tmp;
00888     assertobjptr(self);
00889     assertptr(value,sizeof(*value));
00890 
00891     if( ctl_sconst_(tchar, getxuint32 )( self, &tmp, 4 ) )
00892     {
00893         *value = (int16)tmp;
00894         return true;
00895     }
00896     return false;
00897 }
00898 
00908 bool ctl_sconst_(tchar, getxuint16 )( ctl_sconst( tchar )* self, uint16* value )
00909 {
00910     uint32 tmp;
00911     assertobjptr(self);
00912     assertptr(value,sizeof(*value));
00913 
00914     if( ctl_sconst_(tchar, getxuint32 )( self, &tmp, 4 ) )
00915     {
00916         *value = (uint16)tmp;
00917         return true;
00918     }
00919     return false;
00920 }
00921 
00931 bool ctl_sconst_(tchar, getxuint32 )( ctl_sconst( tchar )* self, uint32* value, int numDigits )
00932 {
00933     bool ret = false;
00934     assertobjptr(self);
00935     assertptr(value,sizeof(*value));
00936 
00937     if( ctl_sconst_(tchar, skipspace )( self ) )
00938     {
00939         const tchar* p = self->parse;
00940         const tchar* e = self->end;
00941         *value = 0;
00942         while( e > p && cisxdigit(tchar)(*p) && numDigits-- )
00943         {
00944             tchar ch = (tchar)(ctoupper(tchar)(*p++) - chconst(tchar,'0'));
00945             if( ch > 9 )
00946                 ch -= chconst(tchar,'A') - (chconst(tchar,'9')+1);
00947             *value <<= 4;
00948             *value += ch;
00949             ret = true;
00950         }
00951         if( ret )
00952             self->parse = p;
00953     }
00954     return ret;
00955 }
00956 
00966 bool ctl_sconst_(tchar, getxuint64 )( ctl_sconst( tchar )* self, uint64* value, int numDigits )
00967 {
00968     bool ret = false;
00969     assertobjptr(self);
00970     assertptr(value,sizeof(*value));
00971 
00972     if( ctl_sconst_(tchar, skipspace )( self ) )
00973     {
00974         const tchar* p = self->parse;
00975         const tchar* e = self->end;
00976         *value = 0;
00977         while( e > p && cisxdigit(tchar)(*p) && numDigits-- )
00978         {
00979             tchar ch = (tchar)(ctoupper(tchar)(*p++) - chconst(tchar,'0'));
00980             if( ch > 9 )
00981                 ch -= chconst(tchar,'A') - (chconst(tchar,'9')+1);
00982             *value <<= 4;
00983             *value += ch;
00984             ret = true;
00985         }
00986         if( ret )
00987             self->parse = p;
00988     }
00989     return ret;
00990 }
00991 
01000 bool ctl_sconst_(tchar, getenum )( ctl_sconst( tchar )* self, int* pValue, const tchar* const* szzList )
01001 {
01002     assertobjptr(self);
01003     assertptr(pValue,sizeof(int));
01004     assertconst(szzList,sizeof(const char*));
01005     if(ctl_sconst_(tchar, skipspace)(self))
01006     {
01007         const tchar *p = self->parse;
01008         const tchar *e = self->end;
01009         const tchar *const *psz = szzList;
01010         while (*psz)
01011         {
01012             size_t len = cstrlen(tchar)(*psz);
01013             if ( p + len <= e && !memcmp(p,*psz,ctl_chsize(tchar,len)))
01014             {
01015                 *pValue = (int) (psz - szzList);
01016                 self->parse += len;
01017                 return true;
01018             }
01019             psz++;
01020         }
01021     }
01022     *pValue = -1;
01023     return false;
01024 }
01025 
01034 bool ctl_sconst_(tchar, getienum )( ctl_sconst( tchar )* self, int* pValue, const tchar* const*  szzList )
01035 {
01036     assertobjptr(self);
01037     assertptr(pValue,sizeof(int));
01038     assertconst(szzList,sizeof(const char*));
01039     if(ctl_sconst_(tchar, skipspace)(self))
01040     {
01041         const tchar *p = self->parse;
01042         const tchar *e = self->end;
01043         const tchar *const *psz = szzList;
01044         while (*psz)
01045         {
01046             size_t len = cstrlen(tchar)(*psz);
01047             if ( p + len <= e && !cstrnicmp(tchar)(p,*psz,len))
01048             {
01049                 *pValue = (int) (psz - szzList);
01050                 self->parse += len;
01051                 return true;
01052             }
01053             psz++;
01054         }
01055     }
01056     *pValue = -1;
01057     return false;
01058 }
01059 
01060 #define mfg_sconst_findclass( tchar, classname)\
01061 \
01069 bool ctl_sconst_(tchar, ppConcat(find_,classname) )( ctl_sconst( tchar )* self )\
01070 {\
01071     const tchar* p;\
01072     const tchar* e;\
01073     assertobjptr(self);\
01074     p = (self)->parse;\
01075     e = (self)->end;\
01076     while( p < e )\
01077     {\
01078         if( ppConcat(c,classname)(tchar)(*p) )\
01079         {\
01080             (self)->parse = p;\
01081             return true;\
01082         }\
01083         p++;\
01084     }\
01085     return false;\
01086 }
01087 
01088 #define mfg_sconst_findnotclass( tchar, classname)\
01089 \
01097 bool ctl_sconst_(tchar, ppConcat(find_not_,classname) )( ctl_sconst( tchar )* self )\
01098 {\
01099     const tchar* p;\
01100     const tchar* e;\
01101     assertobjptr(self);\
01102     p = (self)->parse;\
01103     e = (self)->end;\
01104     while( p < e )\
01105     {\
01106         if( !ppConcat(c,classname)(tchar)(*p) )\
01107         {\
01108             (self)->parse = p;\
01109             return true;\
01110         }\
01111         p++;\
01112     }\
01113     return false;\
01114 }
01115 
01116 #define mfg_sconst_scanclass( tchar, classname) \
01117 \
01126 bool ctl_sconst_(tchar, ppConcat(scan_,classname) )( ctl_sconst( tchar )* self, ctl_sconst( tchar )* result )\
01127 {\
01128     const tchar* p;\
01129     const tchar* e;\
01130     assertobjptr(self);\
01131     p = (self)->parse;\
01132     e = (self)->end;\
01133     while( p < e )\
01134     {\
01135         if( ppConcat(c,classname)(tchar)(*p) )\
01136         {\
01137             result->begin = result->parse = result->end = p;\
01138             (self)->parse = p+1;\
01139             while( p < e )\
01140             {\
01141                 if( !ppConcat(c,classname)(tchar)(*p) )\
01142                     break;\
01143                 p++;\
01144             }\
01145             self->parse = result->end = p;\
01146             return true;\
01147         }\
01148         p++;\
01149     }\
01150     return false;\
01151 }
01152 
01153 #define mfg_sconst_scannotclass( tchar, classname)\
01154 \
01163 bool ctl_sconst_(tchar, ppConcat(scan_not_,classname) )( ctl_sconst( tchar )* self, ctl_sconst( tchar )* result )\
01164 {\
01165     const tchar* p;\
01166     const tchar* e;\
01167     assertobjptr(self);\
01168     p = (self)->parse;\
01169     e = (self)->end;\
01170     while( p < e )\
01171     {\
01172         if( !ppConcat(c,classname)(tchar)(*p) )\
01173         {\
01174             result->begin = result->parse = result->end = p;\
01175             (self)->parse = p+1;\
01176             while( p < e )\
01177             {\
01178                 if( ppConcat(c,classname)(tchar)(*p) )\
01179                     break;\
01180                 p++;\
01181             }\
01182             self->parse = result->end = p;\
01183             return true;\
01184         }\
01185         p++;\
01186     }\
01187     return false;\
01188 }
01189 
01190 
01191 /* Manufacture scans declared in cstring.h by DEF_Supported_Class_Scans */
01192 DEF_Supported_Class_Scans(tchar,mfg_sconst_findclass)
01193 DEF_Supported_Class_Scans(tchar,mfg_sconst_findnotclass)
01194 DEF_Supported_Class_Scans(tchar,mfg_sconst_scanclass)
01195 DEF_Supported_Class_Scans(tchar,mfg_sconst_scannotclass)

Generated on Fri Jan 2 15:28:34 2009 for Squat by  doxygen 1.5.6