本文整理汇总了C++中CStr::CompareNoCase方法的典型用法代码示例。如果您正苦于以下问题:C++ CStr::CompareNoCase方法的具体用法?C++ CStr::CompareNoCase怎么用?C++ CStr::CompareNoCase使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CStr
的用法示例。
在下文中一共展示了CStr::CompareNoCase方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ParseString
//------------------------------------------------------------------------------
/// \brief Parses the string that was passed in
//------------------------------------------------------------------------------
void ArrayReaderParser::ParseString ()
{
CStr msg("Incorrectly formated string in U2DREL");
CToken t1(m_str, "\"");;
CStr str;
try
{
m_valid = true;
str = t1.GetNextToken();
{
CToken token(str, " ");
str = token.GetNextToken();
if (str.CompareNoCase("HDF5") != 0)
throw EException(msg);
str = token.GetNextToken();
// see if the string is "CONSTANT"
if (str.CompareNoCase("constant") == 0)
{
m_const = true;
str = token.GetNextToken();
}
// read the multiplier
if(sscanf(str.c_str(), "%lf", &m_mult) != 1)
throw EException(msg);
str = token.GetNextToken(); // read the IPRN flag
if (sscanf(str.c_str(), "%d", &m_IPRN) != 1)
throw EException(msg);
}
if (m_const)
return;
m_file = t1.GetNextToken(); // read the filename
if (m_file.IsEmpty())
throw EException(msg);
t1.GetNextToken();
m_path = t1.GetNextToken(); // read the path
if (m_path.IsEmpty())
throw EException(msg);
str = t1.GetNextToken();
{
CToken token(str, " ");
str = token.GetNextToken(); // read the number of dimensions
if ("1" != str && "2" != str && "3" != str)
throw EException(msg);
unsigned int nDim(0);
if (sscanf(str.c_str(), "%d", &nDim) != 1)
throw EException(msg);
// read the indices so we know how to read the array
std::pair<int, int> myPair;
for (unsigned int i=0; i<nDim; i++)
{
myPair.first = myPair.second = 0;
str = token.GetNextToken();
if (sscanf(str.c_str(), "%d", &myPair.first) != 1)
throw EException(msg);
str = token.GetNextToken();
if (sscanf(str.c_str(), "%d", &myPair.second) != 1)
throw EException(msg);
m_indices.push_back(myPair);
}
if (nDim != m_indices.size())
throw EException(msg);
}
}
catch (EException &e)
{
CStr out(e.what());
if (!out.IsEmpty())
{
ErrorStack::Get().PutError(out);
}
m_valid = false;
}
} // ArrayReaderParser::ParseString