当前位置: 首页>>代码示例>>C++>>正文


C++ CStr::CompareNoCase方法代码示例

本文整理汇总了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
开发者ID:Aquaveo,项目名称:MFLib,代码行数:85,代码来源:ArrayReaderParser.cpp


注:本文中的CStr::CompareNoCase方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。