本文整理汇总了C++中CvString::GetLength方法的典型用法代码示例。如果您正苦于以下问题:C++ CvString::GetLength方法的具体用法?C++ CvString::GetLength怎么用?C++ CvString::GetLength使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CvString
的用法示例。
在下文中一共展示了CvString::GetLength方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: isCommaFile
bool CvXMLLoadUtilityModTools::isCommaFile(CvString *pszTextVal, const char* szDirName)
{
#if (DEBUG_IS_MODULAR_ART == 1)
CvString szDebugBuffer;
szDebugBuffer.Format("=== isCommaFile BEGIN ===");
gDLL->logMsg("CvXMLLoadUtilityModTools_isCommaFile.log", szDebugBuffer.c_str());
szDebugBuffer.Format(" Text value: %s, Directory name: '%s'", pszTextVal->c_str(), szDirName);
gDLL->logMsg("CvXMLLoadUtilityModTools_isCommaFile.log", szDebugBuffer.c_str());
#endif
string::size_type posComma = (*pszTextVal).find_first_of(',');
if(posComma != string::npos) //if no comma found at all, return false
{
#if (DEBUG_IS_MODULAR_ART == 1)
szDebugBuffer.Format(" Found a ',' at position %i (total length %i)", (int)posComma, (*pszTextVal).GetLength());
gDLL->logMsg("CvXMLLoadUtilityModTools_isCommaFile.log", szDebugBuffer.c_str());
#endif
CvString szTempLocation;
CvString szAppend = " ";
int iCountComma = 0;
CvString szLocationNameStripComma;
// Check how many comma's we have in the string and how many Button Files
#if (DEBUG_IS_MODULAR_ART == 1)
std::vector<CvString> asTagParts;
pszTextVal->getTokens(CvString(","), asTagParts);
iCountComma = asTagParts.size();
szDebugBuffer.Format(" Total number of ',' in pszTextVal: %i", iCountComma);
gDLL->logMsg("CvXMLLoadUtilityModTools_isCommaFile.log", szDebugBuffer.c_str());
for (std::vector<CvString>::iterator it = asTagParts.begin(); it != asTagParts.end(); it++)
{
szDebugBuffer.Format(" - Token %s", (*it).c_str());
gDLL->logMsg("CvXMLLoadUtilityModTools_isCommaFile.log", szDebugBuffer.c_str());
}
#else
szLocationNameStripComma = *pszTextVal;
for ( int i = 0; i < szLocationNameStripComma.GetLength(); i++)
{
if (szLocationNameStripComma[i] == 44) // "," = 44 (ASCII)
{
iCountComma++;
}
}
#endif
#if (DEBUG_IS_MODULAR_ART == 1)
CvString szButtonsString;
for (std::vector<CvString>::iterator it = asTagParts.begin(); it != asTagParts.end(); it++)
{
bool bDigitsOnly = true;
for (int i = 0; i < (*it).GetLength(); i++)
{
if (!isdigit((*it)[i]))
bDigitsOnly = false;
}
if (!bDigitsOnly)
szButtonsString += ((*it) + ",");
}
// Eliminate comma at end of string, if there is one
if (szButtonsString.GetLength() > 0 && szButtonsString[szButtonsString.GetLength()] == ',')
szButtonsString = szButtonsString.substr(0, szButtonsString.GetLength() - 1);
szDebugBuffer.Format(" Button art string after eliminating numerical indices: %s", szButtonsString.c_str());
gDLL->logMsg("CvXMLLoadUtilityModTools_isCommaFile.log", szDebugBuffer.c_str());
#else
// determine the append string at the end of the tag
bool bContinue = true;
szTempLocation = *pszTextVal;
while ( bContinue)
{
posComma = szTempLocation.find_first_of(',');
if(posComma != string::npos) //Prevent Null pointer deletion
{
szTempLocation = szTempLocation.substr(szTempLocation.find(",")+1);
if (isdigit(szTempLocation[0])) //We found the Append
{
bContinue = false;
}
}
else break;
}
if (!bContinue )
{
szAppend = "," + szTempLocation;
}
#endif
std::vector<CvString> vecButtonArtFile;
#if (DEBUG_IS_MODULAR_ART == 1)
szButtonsString.getTokens(CvString(","), vecButtonArtFile);
szDebugBuffer.Format(" Button art vector size after tokenizing by ',': %i", vecButtonArtFile.size());
gDLL->logMsg("CvXMLLoadUtilityModTools_isCommaFile.log", szDebugBuffer.c_str());
#else
//.........这里部分代码省略.........