bool ConfigFile::containTitle( char *buf, const char *section ) { /* 功能:字符串中是否包含指定的section 参数: buf[IN]:源串 section[IN]:要查找的section 返回值: 找到返回true 否则返回false */ char *p; int len; p = titlePos( buf, &len ); if( p ) { //hauk -- 2013-10-29 modified //if( (int)strlen( section ) == len && strncmp( section, p, len ) == 0 ) //return true; if((int)strlen(section) != len) return false; char acDst[256], acSrc[256]; memset(acDst, 0, sizeof(acDst)); memset(acSrc, 0, sizeof(acSrc)); memcpy(acDst, section, len); memcpy(acSrc, p, len); #ifdef WIN32 if(0 == stricmp(acDst, acSrc)) return true; #else if(0 == strcasecmp(acDst, acSrc)) return true; #endif //end of modification } return false; }
bool ConfigFile::isTitleLine( char *bufPtr ) { /* 功能:字符串中是否是一个section 参数: bufPtr[IN]:源串 返回值: 成功返回true 失败返回false */ return titlePos( bufPtr, 0 ) != 0; }
/*------------------------------------------------------------------------------ // containTitle: check if a string contain a section a title //------------------------------------------------------------------------------*/ static int containTitle( char *buf, const char *section ) { char *p; int len; p = titlePos( buf, &len ); if( p ) { if( strlen( section ) == len && strnicmp( section, p, len ) == 0 ) return True; } return False; }
//---------------------------------------------------------------------------- // containTitle: check if a string contain a section a title //---------------------------------------------------------------------------- NABoolean UdrCfgParser::containTitle( char *buf, const char *section ) { char *p; Int32 len; p = titlePos( buf, &len ); if( p ) { if( ((signed)strlen( section )) == len && (strnicmp( section, p, len )) == 0 ) return TRUE; } return FALSE; }
//---------------------------------------------------------------------------- // isTitleLine: check if a string is a section title line //---------------------------------------------------------------------------- Int32 UdrCfgParser::isTitleLine( char *bufPtr ) { return titlePos( bufPtr, 0 ) != 0; }
/*------------------------------------------------------------------------------ // isTitleLine: check if a string is a section title line //------------------------------------------------------------------------------*/ static int isTitleLine( char *bufPtr ) { return titlePos( bufPtr, 0 ) != 0; }