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


C++ KKStr::FirstChar方法代码示例

本文整理汇总了C++中KKStr::FirstChar方法的典型用法代码示例。如果您正苦于以下问题:C++ KKStr::FirstChar方法的具体用法?C++ KKStr::FirstChar怎么用?C++ KKStr::FirstChar使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在KKStr的用法示例。


在下文中一共展示了KKStr::FirstChar方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: FromDelStr

PointListPtr  PointList::FromDelStr (const KKStr&  _s)
{
  PointListPtr  result = new PointList (true);

  KKStr  s (_s);
  s.TrimLeft ();

  while  (s.Len () > 0)
  {
    char nextCh = s.FirstChar ();
    char endPairChar = 0;
    if  (nextCh == '[')
      endPairChar = ']';

    else if  (nextCh == '(')
      endPairChar = ')';

    else
    {
      // Not Bracketed.
      endPairChar = 0;
      kkint16  row = (kkint16)s.ExtractTokenInt (",\t\n\t");
      kkint16  col = (kkint16)s.ExtractTokenInt (",\t\n\t");
      result->PushOnBack (new Point (row, col));
    }

    if  (endPairChar != 0)
    {
      KKStr pairStr = "";
      auto  idx = s.Find (endPairChar);
      if  (idx)
      {
        pairStr = s.SubStrSeg (0, idx);
        s = s.SubStrPart (idx + 1);
      }
      else
      {
        pairStr = s;
        s = "";
      }

      kkint16  row = (kkint16)pairStr.ExtractTokenInt (",");
      kkint16  col = (kkint16)pairStr.ExtractTokenInt (",");
      result->PushOnBack (new Point (row, col));
      nextCh = s.FirstChar ();
      if  ((nextCh == ',')  ||  (nextCh == '\n')  ||  (nextCh == '\r')  || (nextCh == '\t'))
        s.ChopFirstChar ();
    }
    s.TrimLeft ();
  }

  return  result;
}  /* FromDelStr */
开发者ID:KurtKramer,项目名称:KSquareLibraries,代码行数:53,代码来源:Point.cpp

示例2: tagStr

XmlTag::XmlTag (istream&  i)
{
  tagType = tagNULL;

  if  (i.peek () == '<')
    i.get ();

  KKStr tagStr (100);
  ReadWholeTag (i, tagStr);

  if  (tagStr.FirstChar () == '/')
  {
    tagStr.ChopFirstChar ();
    tagType = tagEnd;
  }

  if  (tagStr.EndsWith ("/>"))
  {
    tagType = tagEmpty;
    tagStr.ChopLastChar ();
    tagStr.ChopLastChar ();
  }

  else if  (tagStr.LastChar () != '>')
  {
    tagType = tagStart;
  }

  else
  {
    if  (tagType == tagNULL)
      tagType = tagStart;
    tagStr.ChopLastChar ();
  }

  name.TrimLeft ();
  name.TrimRight ();

  name = tagStr.ExtractToken2 (" \n\r\t");
  KKStr attributeName (20);
  KKStr attributeValue (20);

  while  (!tagStr.Empty ())
  {
    ExtractAttribute (tagStr, attributeName, attributeValue);
    if  (!attributeName.Empty ())
      attributes.push_back (XmlAttribute (attributeName, attributeValue));
  }
}
开发者ID:jizhihang,项目名称:Pices-XXX-,代码行数:49,代码来源:XmlStream.cpp

示例3: LoadFile

void  Configuration::LoadFile (RunLog&  log)
{
  log.Level (10) << "Configuration::LoadFile: " << fileName << endl;

  kkint32  lastLineNum = 0;

  if  (fileName == "")
  {
    log.Level (-1) << endl
                   << "Configuration::LoadFile   ***ERROR***   File-Name is blank"  << endl
                   << endl;
    FormatGood (false);
    return;
  }

  FILE*  inFile = osFOPEN (fileName.Str (), "r");

  if  (!inFile)
  {
    log.Level (-1) << endl
                   << "Configuration::LoadFile   ***ERROR***    Opening File: " << fileName << endl
                   << endl;

    FormatGood (false);
    return;
  }

  char  buff[10240];
  kkint32 lineCount = 0;

  curSectionName = "";
  ConfSectionPtr  curSection = NULL;

  while  (fgets (buff, sizeof (buff), inFile))
  {
    lastLineNum++;
    KKStr  line (buff);
    line.TrimRight ();
    line.TrimLeft ();

    StripOutAnyComments (line);

    log.Level (70) << line << endl;
    
    StripOutAnyComments (line);

    if  (line.Empty ())            
    {
      // If we have a blank line, we do nothing.
    }

    else if  (line.FirstChar () == '[')
    {
      // Looks like definition of new section. 

      if  (line.LastChar () == ']')
      {
        curSectionName = line.SubStrPart (1, line.Len () - 2);
        curSectionName.TrimLeft ();
        curSectionName.TrimRight ();
        curSectionName.Upper ();

        curSection = new ConfSection (curSectionName, lastLineNum);
        sections->AddConfSection (curSection);
        log.Level (30) << "LoadFile   SectionName[" << curSectionName << "]." << endl;
      }
      else
      {
        log.Level (-1) << endl
                       << "Configuration::LoadFile   ***ERROR***    LineNumber[" << lastLineNum << "]  Improper Section Name[" << line << "]." << endl
                       << endl;
        formatGood = false;
      }
    }

    else
    {
      if  (!curSection)
      {
        log.Level (-1) << endl
                       << "Configuration::LoadFile   ***ERROR***  Format Error LineNumber[" << lastLineNum << "]" << endl
                       << "                            No Section Defined."  << endl 
                       << endl;
     
        formatGood = false;

        curSectionName = "GLOBAL";
        curSection = new ConfSection (curSectionName, lastLineNum);
        sections->AddConfSection (curSection);
      }

      kkint32  equalIdx = line.LocateCharacter ('=');

      if  (equalIdx < 0)
      {
        // We have a improperly formated line.
        log.Level (-1) << endl
                       << "Configuration::LoadFile   ***ERROR***   LineNumber[" << lastLineNum << "] Improperly Formated Line[" << line << "]." 
                       << endl;
        formatGood = false;
//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:


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