• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ els函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中els函数的典型用法代码示例。如果您正苦于以下问题:C++ els函数的具体用法?C++ els怎么用?C++ els使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: separator1

/**
 * xuudb-format (Unicore 6)
 *  225;zib;dgms0006:dgls0050;user;mosgrid:lifescience;CN=Patrick Schaefer,OU=CSR,O=GridGermany,C=DE
 */
void UserMappingGridmapUnicore::ReadGridmapFileUnicore6(
    std::ifstream &in,
    boost::bimap< std::string, std::string > &new_username,
    std::multimap< std::string, std::string > &new_groupname) {
  std::vector< std::string > vec;
  std::string line;

  string separator1("");   // no escaping
  string separator2(";");  // split dn on ;
  string separator3("");   // the dn is not enclosed
  escaped_list_separator<char> els(separator1, separator2, separator3);

  // read lines
  while(getline(in, line)) {
    tokenizer< escaped_list_separator<char> > tok(line, els);
    vec.clear();
    vec.assign(tok.begin(), tok.end());

    // are there two entries available?
    if (vec.size() < 6) {
      Logging::log->getLog(LEVEL_ERROR)
          << "gridmap: could not parse line: " << line << std::endl;
      continue;
    }

    trim(vec[5]);  // dn
    trim(vec[2]);  // username

    // store the dn, groups and username
    Store(std::string(vec[5]), std::string(vec[2]), ":",
        new_username, new_groupname);
  }
}
开发者ID:BillTheBest,项目名称:xtreemfs,代码行数:37,代码来源:user_mapping_gridmap_unicore.cpp


示例2: escaped_split

	void escaped_split(const std::string &str, const std::string &sep, std::vector<std::string> &parts) {
		boost::escaped_list_separator<char> els("\\", sep, "\"");
		boost::tokenizer<boost::escaped_list_separator<char>> tokens(str, els);

		parts.clear();
		for(auto it = tokens.begin(); it != tokens.end(); ++it) {
			if((*it).length() > 0) {
				parts.push_back(boost::trim_copy(*it));
			}
		}
	}
开发者ID:SimonLarsen,项目名称:graphio,代码行数:11,代码来源:split.hpp


示例3: els

void RPCExecutor::request(const QString &command)
{
    // Parse shell-like command line into separate arguments
    std::string strMethod;
    std::vector<std::string> strParams;
    try {
        boost::escaped_list_separator<char> els('\\',' ','\"');
        std::string strCommand = command.toStdString();
        boost::tokenizer<boost::escaped_list_separator<char> > tok(strCommand, els);

        int n = 0;
        for(boost::tokenizer<boost::escaped_list_separator<char> >::iterator beg=tok.begin(); beg!=tok.end(); ++beg,++n)
        {
            if(n == 0) // First parameter is the command
                strMethod = *beg;
            else
                strParams.push_back(*beg);
        }
    }
    catch(boost::escaped_list_error &e)
    {
        emit reply(RPCConsole::CMD_ERROR, QString("Parse error"));
        return;
    }

    try {
        std::string strPrint;
        json_spirit::Value result = tableRPC.execute(strMethod, RPCConvertValues(strMethod, strParams));

        // Format result reply
        if (result.type() == json_spirit::null_type)
            strPrint = "";
        else if (result.type() == json_spirit::str_type)
            strPrint = result.get_str();
        else
            strPrint = write_string(result, true);

        emit reply(RPCConsole::CMD_REPLY, QString::fromStdString(strPrint));
    }
    catch (json_spirit::Object& objError)
    {
        emit reply(RPCConsole::CMD_ERROR, QString::fromStdString(write_string(json_spirit::Value(objError), false)));
    }
    catch (std::exception& e)
    {
        emit reply(RPCConsole::CMD_ERROR, QString("Error: ") + QString::fromStdString(e.what()));
    }
}
开发者ID:G8CoinProject,项目名称:G8,代码行数:48,代码来源:rpcconsole.cpp


示例4: ArgumentSizeMismatch

 inline ExecStatus
 Weights<View>::post(Home home, const SharedArray<int>& elements,
                     const SharedArray<int>& weights,
                     View x, Gecode::Int::IntView y) {
   if (elements.size() != weights.size())
     throw ArgumentSizeMismatch("Weights");
   Region r(home);
   int* els_arr = r.alloc<int>(elements.size());
   for (int i=elements.size(); i--;)
     els_arr[i] = elements[i];
   IntSet els(els_arr, elements.size());
   IntSetRanges er(els);
   GECODE_ME_CHECK(x.intersectI(home, er));
   (void) new (home) Weights(home,elements,weights,x,y);
   return ES_OK;
 }
开发者ID:Wushaowei001,项目名称:vcp,代码行数:16,代码来源:weights.hpp


示例5: itemize

  PosibErr<void> itemize (ParmString s, MutableContainer & d) {
    ItemizeTokenizer els(s);
    ItemizeItem li;
    while (li = els.next(), li.name != 0) {
      switch (li.action) {
      case '+':
	RET_ON_ERR(d.add(li.name));
	break;
      case '-':
	RET_ON_ERR(d.remove(li.name));
	break;
      case '!':
	RET_ON_ERR(d.clear());
	break;
      default:
	abort();
      }
    }
    return no_err;
  }
开发者ID:Distrotech,项目名称:aspell,代码行数:20,代码来源:itemize.cpp


示例6: find_word_list

  PosibErr<Config *> find_word_list(Config * c) 
  {
    Config * config = new_config();
    RET_ON_ERR(config->read_in_settings(c));
    String dict_name;

    if (config->have("master")) {
      dict_name = config->retrieve("master");

    } else {

      ////////////////////////////////////////////////////////////////////
      //
      // Give first preference to an exact match for the language-country
      // code, then give preference to those in the alternate code list
      // in the order they are presented, then if there is no match
      // look for one for just language.  If that fails give up.
      // Once the best matching code is found, try to find a matching
      // variety if one exists, other wise look for one with no variety.
      //

      BetterList b_code;
      //BetterList b_jargon;
      BetterVariety b_variety;
      BetterList b_module;
      BetterSize b_size;
      Better * better[4] = {&b_code,&b_variety,&b_module,&b_size};
      const DictInfo * best = 0;

      //
      // retrieve and normalize code
      //
      const char * p;
      String code;
      PosibErr<String> str = config->retrieve("lang");
      p = str.data.c_str();
      while (asc_isalpha(*p))
        code += asc_tolower(*p++);
      String lang = code;
      bool have_country = false;
      if (*p == '-' || *p == '_') {
        ++p;
        have_country = true;
        code += '_'; 
        while (asc_isalpha(*p))
          code += asc_toupper(*p++);
      }
  
      //
      // Retrieve acceptable code search orders
      //
      String lang_country_list;
      if (have_country) {
        lang_country_list = code;
        lang_country_list += ' ';
      }
      String lang_only_list = lang;
      lang_only_list += ' ';

      // read retrieve lang_country_list and lang_only_list from file(s)
      // FIXME: Write Me

      //
      split_string_list(b_code.list, lang_country_list);
      split_string_list(b_code.list, lang_only_list);
      b_code.init();

      //
      // Retrieve Variety
      // 
      config->retrieve_list("variety", &b_variety.list);
      if (b_variety.list.empty() && config->have("jargon")) 
        b_variety.list.add(config->retrieve("jargon"));
      b_variety.init();
      str.data.clear();

      //
      // Retrieve module list
      //
      if (config->have("module"))
        b_module.list.add(config->retrieve("module"));
      else if (config->have("module-search-order"))
        config->retrieve_list("module-search-order", &b_module.list);
      {
        StackPtr<ModuleInfoEnumeration> els(get_module_info_list(config)->elements());
        const ModuleInfo * entry;
        while ( (entry = els->next()) != 0)
          b_module.list.add(entry->name);
      }
      b_module.init();

      //
      // Retrieve size
      //
      str = config->retrieve("size");
      p = str.data.c_str();
      if (p[0] == '+' || p[0] == '-' || p[0] == '<' || p[0] == '>') {
        b_size.req_type = p[0];
        ++p;
      } else {
//.........这里部分代码省略.........
开发者ID:Distrotech,项目名称:aspell,代码行数:101,代码来源:find_speller.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ elv_dispatch_add_tail函数代码示例发布时间:2022-05-30
下一篇:
C++ eloop_unregister_read_sock函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap