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


C++ wstring::cbegin方法代码示例

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


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

示例1: Parse

      /// <summary>Parses all the keywords/macros in a string and replaces them recursively</summary>
      /// <param name="text">Source text to parse</param>
      /// <param name="depth">Debugging output depth</param>
      /// <returns>Fully parsed text</returns>
      /// <exception cref="Logic::FileFormatException">Macro contains wrong number of parameters</exception>
      /// <exception cref="Logic::Language::RegularExpressionException">RegEx error</exception>
      wstring  DescriptionParser::Parse(wstring text, int depth) const 
      {
         UINT Position;
         wsmatch match;
         wstring r;
         
         try
         {
#ifdef PRINT_CONSOLE
            Console << Cons::Cyan << Indent(depth) << "Parsing: " << Cons::White << text << ENDL;
#endif

            // Find/Replace all macros:  {AAAA:bbb}, {AAAA:bbb,ccc}, {AAAA:bbb,ccc,ddd} ...
            for (Position = 0; regex_search(text.cbegin()+Position, text.cend(), match, MatchMacro); ) //  Manually track position for in-place replacement + avoid infinite loop
            {
               // Recursively generate replacement text
               r = onMatchMacro(match, depth);

#ifdef PRINT_CONSOLE
               Console << Indent(depth) << "Replacing text: " << Cons::Yellow << match[0].str() << Cons::White << " with " << Cons::Green << r << ENDL;
#endif

               // Advance position to beyond inserted text, and insert text
               Position = (match[0].first - text.cbegin()) + r.length();
               text.replace(match[0].first, match[0].second, r);
            }

            // Find/Replace all keywords:  {AAAAA}, AAAAA
            for (Position = 0; regex_search(text.cbegin()+Position, text.cend(), match, MatchKeyword); )  
            {
               // Recursively generate replacement text
               r = onMatchKeyword(match, depth);

#ifdef PRINT_CONSOLE
               Console << Indent(depth) << "Replacing text: " << Cons::Yellow << match[0].str() << Cons::White << " with " << Cons::Green << r << ENDL;
#endif

               // Advance position to beyond inserted text, and insert text
               Position = (match[0].first - text.cbegin()) + r.length();
               text.replace(match[0].first, match[0].second, r);
            }

            return text;
         }
         catch (regex_error& e) {
            throw RegularExpressionException(HERE, e);
         }
      }
开发者ID:CyberSys,项目名称:X-Studio-2,代码行数:54,代码来源:DescriptionParser.cpp

示例2: Populate

      /// <summary>Populates the parameters markers within the description source text.</summary>
      /// <param name="src">source text.</param>
      /// <param name="cmd">command syntax.</param>
      /// <returns></returns>
      wstring  DescriptionParser::Populate(wstring src, CommandSyntaxRef cmd)
      {
         wsmatch match;
         wstring r;
         
         // Replace all {aaa,bbb} markers.  Manually track position for in-place replacement + avoid infinite loop
         for (int Position = 0; regex_search(src.cbegin()+Position, src.cend(), match, MartchParameterMarker); )
         {
            r = onParameterMarker(match, cmd);

#ifdef PRINT_CONSOLE            
            Console << "  Replace: " << Cons::Yellow << match[0].str() << Cons::White << " with " << Cons::Green << r << ENDL;
#endif
            // Advance position + perform replacement
            Position = (match[0].first - src.cbegin()) + r.length();
            src.replace(match[0].first, match[0].second, r);
         }

         return src;
      }
开发者ID:CyberSys,项目名称:X-Studio-2,代码行数:24,代码来源:DescriptionParser.cpp

示例3: startsWith

bool ConnectedShortcut::startsWith(const wstring& tested, const wstring& prefix)
{
	return (tested.length() >= prefix.length()) &&
		(std::mismatch(prefix.cbegin(), prefix.cend(), tested.cbegin()).first == prefix.cend());
}
开发者ID:troiganto,项目名称:autosave,代码行数:5,代码来源:ConnectedShortcut.cpp


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