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


C++ RE::FullMatch方法代码示例

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


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

示例1: configFile

bool Main::Config::ExecuteConfigCommands(Ui::Command & handler)
{
    static char const * const vimpcrcFile = "/.vimpcrc";
    static char const * const home        = "HOME";
    static bool configCommandsExecuted    = false;

    pcrecpp::RE const commentCheck("^\\s*\".*");

    if (configCommandsExecuted == false)
    {
        configCommandsExecuted = true;

        std::string configFile(getenv(home));
        configFile.append(vimpcrcFile);

        std::string   input;
        std::ifstream inputStream(configFile.c_str());

        if (inputStream)
        {
            while (!inputStream.eof())
            {
                std::getline(inputStream, input);

                if ((input != "") && (commentCheck.FullMatch(input.c_str()) == false))
                {
                    handler.ExecuteCommand(input);
                }
            }
        }
    }

    return true;
}
开发者ID:phanimahesh,项目名称:vimpc,代码行数:34,代码来源:config.hpp

示例2: parseUriRef

// Returns true if parsing succeeded, false otherwise. Parsing can fail if the uri
// reference isn't properly formed.
bool cdom::parseUriRef(const string& uriRef,
                       string& scheme,
                       string& authority,
                       string& path,
                       string& query,
                       string& fragment) {

#ifdef USE_URIPARSER
    UriParserStateA state;
    UriUriA uri;
    state.uri = &uri;
    if ( uriParseUriA(&state, uriRef.c_str()) == 0 ) {
        scheme = fromRange(uri.scheme);
        authority = fromRange(uri.hostText);
        path = fromList(uri.pathHead, "/");
        if (uri.absolutePath != URI_TRUE and uri.hostText.first == NULL)
            path = path.erase(0, 1);
        query = fromRange(uri.query);
        fragment = fromRange(uri.fragment);
        uriFreeUriMembersA(&uri);
        return true;
    }
#else
    // This regular expression for parsing URI references comes from the URI spec:
    //   http://tools.ietf.org/html/rfc3986#appendix-B
    static pcrecpp::RE re("^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?");
    string s1, s3, s6, s8;
    if (re.FullMatch(uriRef, &s1, &scheme, &s3, &authority, &path, &s6, &query, &s8, &fragment))
        return true;
#endif

    return false;
}
开发者ID:ANR2ME,项目名称:collada-dom,代码行数:35,代码来源:daeURI.cpp

示例3: DetermineColour

int32_t SongWindow::DetermineColour(uint32_t line) const
{
   uint32_t printLine = line + FirstLine();
   Mpc::Song * song   = (printLine < BufferSize()) ? Buffer().Get(printLine) : NULL;

   int32_t colour = Colour::Song;

   if (song != NULL)
   {
      if ((song->URI() == client_.GetCurrentSongURI()))
      {
         colour = Colour::CurrentSong;
      }
      else if (client_.SongIsInQueue(*song))
      {
         colour = Colour::FullAdd;
      }
      else if ((search_.LastSearchString() != "") && (settings_.Get(Setting::HighlightSearch) == true) &&
               (search_.HighlightSearch() == true))
      {
         pcrecpp::RE const expression(".*" + search_.LastSearchString() + ".*", search_.LastSearchOptions());

         if (expression.FullMatch(song->FormatString(settings_.Get(Setting::SongFormat))))
         {
            colour = Colour::SongMatch;
         }
      }
   }

   return colour;
}
开发者ID:phanimahesh,项目名称:vimpc,代码行数:31,代码来源:songwindow.cpp

示例4: check_attributes

bool event_t::check_attributes(string &error_message, const attribute_t &a, bool empty_only)
{
  static pcrecpp::RE known_keyword =
    "APPLICATION|TITLE|TEST|COMMAND|USER|CROUP|"
    "DBUS_SERVICE|DBUS_PATH|DBUS_INTERFACE|DBUS_METHOD|DBUS_SIGNAL|"
    "PLUGIN|BACKUP" ;
  static pcrecpp::RE upper_case = "[A-Z_]+" ;
  static pcrecpp::RE app_name = "[A-Za-z_][A-Za-z_0-9]*" ;

  bool app_name_found = false ;

  for(map<string,string>::const_iterator it=a.txt.begin(); it!=a.txt.end(); ++it)
  {
    if(it->first.empty())
      return error_message += ": empty attribute key", false ;
    if(it->second.empty())
      return error_message += ": empty value of attribute '"+it->first+"'", false ;
    if(empty_only)
      continue ;
    if(upper_case.FullMatch(it->first))
    {
      if(!known_keyword.FullMatch(it->first))
        return error_message = "unknown upper case event attribute key '"+it->first+"'", false ;
      if(it->first=="APPLICATION")
      {
        app_name_found = true ;
        if(!app_name.FullMatch(it->second))
          return error_message = "invalid application name '"+it->second+"'", false ;
      }
    }
  }

  if(empty_only || app_name_found)
    return true ;
  else
    return error_message = "no application name given", false ;
}
开发者ID:matthewvogt,项目名称:timed,代码行数:37,代码来源:event.cpp

示例5: parseUriRef

// Returns true if parsing succeeded, false otherwise. Parsing can fail if the uri
// reference isn't properly formed.
bool cdom::parseUriRef(const string& uriRef,
                       string& scheme,
                       string& authority,
                       string& path,
                       string& query,
                       string& fragment) {
	// This regular expression for parsing URI references comes from the URI spec:
	//   http://tools.ietf.org/html/rfc3986#appendix-B
	static pcrecpp::RE re("^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?");
	string s1, s3, s6, s8;
	if (re.FullMatch(uriRef, &s1, &scheme, &s3, &authority, &path, &s6, &query, &s8, &fragment))
		return true;

	return false;
}
开发者ID:Kaoswerk,项目名称:newton-dynamics,代码行数:17,代码来源:daeURI.cpp

示例6: while

static
int
read_dnssec_keygen_file_as_map(std::istream& i,
			       std::map<std::string,std::string>& m)
{
    static pcrecpp::RE re_DNSKeyFile("(\\S+):\\s*(.*)");

    std::string s;
    while (getline(i, s)) {
	std::string key;
	std::string value;
	if (re_DNSKeyFile.FullMatch(s, &key, &value)) {
	    m[key] = value;
	}
    }
    return m.size();
}
开发者ID:shigeya,项目名称:wide-cpp-lib,代码行数:17,代码来源:key_dnssec.cpp


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