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


C++ StringMap::begin方法代码示例

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


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

示例1: doInsert

Ice::Long ConnectionQuery::doInsert(const string& strPrefix,
		const string& table, const StringMap& properties) {
	if (!properties.size()) {
		return -1;
	}
	ostringstream sql;
	sql << strPrefix << table << " (";
	for (StringMap::const_iterator it = properties.begin();;) {
		sql << it->first;
		if (++it == properties.end()) {
			break;
		} else {
			sql << ", ";
		}
	}
	sql << ") VALUES (";
	for (StringMap::const_iterator it = properties.begin();;) {
//#ifndef NEWARCH
//		// sql << mysqlpp::quote << it->second;
//		sql << "'" << mysqlpp::quote << it->second << "'";
//#else
		sql << "'" << mysqlpp::quote << it->second << "'";
//#endif
		if (++it == properties.end()) {
			break;
		} else {
			sql << ", ";
		}
	}
	sql << ")";
	return doExecute(sql.str());
}
开发者ID:bradenwu,项目名称:oce,代码行数:32,代码来源:connectionquery.cpp

示例2: normalize

void Application::normalize(StringMap<float> &counts)
{
  float sum=0;
  StringMapIterator<float> cur=counts.begin(), end=counts.end();
  for(; cur!=end ; ++cur) sum+=(*cur).second;
  if(sum>0)
    for(cur=counts.begin() ; cur!=end ; ++cur) (*cur).second/=sum;
}
开发者ID:ReddyLab,项目名称:FBI,代码行数:8,代码来源:get-bias-model.C

示例3: compareStringMap

 bool compareStringMap(StringMap &a, StringMap& b) {
     if (a.size() != b.size())
         return false;
     for (auto ita = a.begin(), itb = b.begin(); ita != a.end(); ++ita, ++itb) {
         if (ita->first.compare(itb->first) != 0
             || ita->second != itb->second)
             return false;
     }
     return true;
 }
开发者ID:dut09,项目名称:leetcode,代码行数:10,代码来源:SubstringWithConcatenationOfAllWords.cpp

示例4: connect

void BoshTransport::connect(const sf::Url & url, const StringMap & additionalArgs, int timeOutMs, const ResultCallback & callback){
	if (mState != Unconnected) {
		Log (LogError) << LOGID << "Wrong State " << toString (mState) << std::endl;
		return xcall (abind (callback, error::WrongState));
	}

	mUrl = url;
	mRid = randomRid();
	mRidRecv = mRid;

	// Setting Parameters
	StringMap args = additionalArgs;
	args["rid"] = toString (mRid);
	setIfNotSet (&args, "ver", "1.10");
	setIfNotSet (&args, "wait", "60");
	setIfNotSet (&args, "hold", "1");
	setIfNotSet (&args, "xmlns", "http://jabber.org/protocol/httpbind");

	BoshNodeBuilder builder;
	for (StringMap::const_iterator i = args.begin(); i != args.end(); i++){
		builder.addAttribute(i->first,i->second);
	}

	// Send it out...
	mState = Connecting;
	executeRequest (sf::createByteArrayPtr(builder.toString()), timeOutMs, abind (dMemFun (this, &BoshTransport::onConnectReply), callback));
}
开发者ID:nob13,项目名称:schneeflocke,代码行数:27,代码来源:BoshTransport.cpp

示例5: startNextRequest

void BoshTransport::startNextRequest (const StringMap & additionalArgs, const ResultCallback & callback) {
	if (mState != Connected && mState != Closing){
		Log (LogWarning) << LOGID << "Strange state" << std::endl;
		notifyAsync (callback, error::WrongState);
		return;
	}
	// Building Message
	mRid++;
	BoshNodeBuilder builder;
	builder.addAttribute("rid", toString(mRid));
	builder.addAttribute("sid", mSid);
	builder.addAttribute("xmlns", "http://jabber.org/protocol/httpbind");
	for (StringMap::const_iterator i = additionalArgs.begin(); i != additionalArgs.end(); i++) {
		builder.addAttribute(i->first.c_str(), i->second);
	}

	// Adding data..
	for (std::deque<ByteArrayPtr>::const_iterator i = mOutputBuffer.begin(); i != mOutputBuffer.end(); i++) {
		builder.addContent(*i);
	}
	mOutputBuffer.clear();

	// Sending
	sf::ByteArrayPtr data = sf::createByteArrayPtr (builder.toString());
	mOpenRids[mRid] = data;
	mOpenRidCount++;
	executeRequest (data, mLongPollTimeoutMs, abind (dMemFun (this, &BoshTransport::onRequestReply), mRid, callback));
}
开发者ID:nob13,项目名称:schneeflocke,代码行数:28,代码来源:BoshTransport.cpp

示例6: saveNodes

	/*
	 * Save bootstrap nodes to disk
	 */
	void KBucket::saveNodes(SimpleXML& xml)
	{
		xml.addTag("Nodes");
		xml.stepIn();

		// get 50 random nodes to bootstrap from them next time
		Node::Map closestToMe;
		getClosestNodes(CID::generate(), closestToMe, 50, 3);

		for(Node::Map::const_iterator j = closestToMe.begin(); j != closestToMe.end(); j++)
		{
			const Node::Ptr& node = j->second;

			xml.addTag("Node");
			xml.addChildAttrib("CID", node->getUser()->getCID().toBase32());
			xml.addChildAttrib("type", node->getType());
			xml.addChildAttrib("verified", node->isIpVerified());

			if(!node->getUDPKey().key.isZero() && !node->getUDPKey().ip.empty())
			{
				xml.addChildAttrib("key", node->getUDPKey().key.toBase32());
				xml.addChildAttrib("keyIP", node->getUDPKey().ip);
			}

			StringMap params;
			node->getIdentity().getParams(params, Util::emptyString, false, true);

			for(StringMap::const_iterator i = params.begin(); i != params.end(); i++)
				xml.addChildAttrib(i->first, i->second);
		}

		xml.stepOut();
	}
开发者ID:pk2010,项目名称:eiskaltdcpp,代码行数:36,代码来源:KBucket.cpp

示例7: GetClusterHealthPolicy

ServiceModel::ClusterHealthPolicy ManagementConfig::GetClusterHealthPolicy() const
{
    auto clusterHealthPolicy = ServiceModel::ClusterHealthPolicy(
        this->ConsiderWarningAsError,
        static_cast<BYTE>(this->MaxPercentUnhealthyNodes),
        static_cast<BYTE>(this->MaxPercentUnhealthyApplications));

    // Check if there are any per app type entries defined
    StringMap clusterHealthPolicyEntries;
    this->GetKeyValues(L"HealthManager/ClusterHealthPolicy", clusterHealthPolicyEntries);
    for (auto it = clusterHealthPolicyEntries.begin(); it != clusterHealthPolicyEntries.end(); ++it)
    {
        if (StringUtility::StartsWithCaseInsensitive<wstring>(it->first, *ApplicationTypeMaxPercentUnhealthyApplicationsPrefix))
        {
            // Get the application type name and the value
            wstring appTypeName = it->first;
            StringUtility::Replace<wstring>(appTypeName, *ApplicationTypeMaxPercentUnhealthyApplicationsPrefix, L"");
            
            int value;
            if (!StringUtility::TryFromWString<int>(it->second, value))
            {
                Assert::CodingError("Cluster manifest validation error: {0}: Error parsing app type MaxPercentUnhealthyApplication {1} as int", it->first, it->second);
            }

            auto error = clusterHealthPolicy.AddApplicationTypeHealthPolicy(move(appTypeName), static_cast<BYTE>(value));
            ASSERT_IFNOT(error.IsSuccess(), "Cluster manifest validation error: {0}: Error parsing app type MaxPercentUnhealthyApplication {1}", it->first, it->second);
        }
    }

    return clusterHealthPolicy;
}
开发者ID:vturecek,项目名称:Service-Fabric,代码行数:31,代码来源:ManagementConfig.cpp

示例8: qsort

// Copy Options into a vector so we can sort them as we like.
static void
sortOpts(StringMap<Option*> &OptMap,
         SmallVectorImpl< std::pair<const char *, Option*> > &Opts,
         bool ShowHidden) {
  SmallPtrSet<Option*, 128> OptionSet;  // Duplicate option detection.

  for (StringMap<Option*>::iterator I = OptMap.begin(), E = OptMap.end();
       I != E; ++I) {
    // Ignore really-hidden options.
    if (I->second->getOptionHiddenFlag() == ReallyHidden)
      continue;

    // Unless showhidden is set, ignore hidden flags.
    if (I->second->getOptionHiddenFlag() == Hidden && !ShowHidden)
      continue;

    // If we've already seen this option, don't add it to the list again.
    if (!OptionSet.insert(I->second))
      continue;

    Opts.push_back(std::pair<const char *, Option*>(I->getKey().data(),
                                                    I->second));
  }

  // Sort the options list alphabetically.
  qsort(Opts.data(), Opts.size(), sizeof(Opts[0]), OptNameCompare);
}
开发者ID:nikunjy,项目名称:parallelStuff,代码行数:28,代码来源:CommandLine.cpp

示例9: jl_finalize_module

// this takes ownership of a module after code emission is complete
// and will add it to the execution engine when required (by jl_finalize_function)
void jl_finalize_module(Module *m, bool shadow)
{
#if !defined(USE_ORCJIT)
    jl_globalPM->run(*m);
#endif
    // record the function names that are part of this Module
    // so it can be added to the JIT when needed
    for (Module::iterator I = m->begin(), E = m->end(); I != E; ++I) {
        Function *F = &*I;
        if (!F->isDeclaration()) {
            bool known = incomplete_fname.erase(F->getName());
            (void)known; // TODO: assert(known); // llvmcall gets this wrong
            module_for_fname[F->getName()] = m;
        }
    }
#if defined(USE_ORCJIT) || defined(USE_MCJIT)
    // in the newer JITs, the shadow module is separate from the execution module
    if (shadow)
        jl_add_to_shadow(m);
#else
    bool changes = jl_try_finalize(m);
    while (changes) {
        // this definitely isn't the most efficient, but it's only for the old LLVM 3.3 JIT
        changes = false;
        for (StringMap<Module*>::iterator MI = module_for_fname.begin(), ME = module_for_fname.end(); MI != ME; ++MI) {
            changes |= jl_try_finalize(MI->second);
        }
    }
#endif
}
开发者ID:giordano,项目名称:julia,代码行数:32,代码来源:jitlayers.cpp

示例10: on_playerReceiveFields

void ScriptApiPlayer::on_playerReceiveFields(ServerActiveObject *player,
		const std::string &formname,
		const StringMap &fields)
{
	SCRIPTAPI_PRECHECKHEADER

	// Get core.registered_on_chat_messages
	lua_getglobal(L, "core");
	lua_getfield(L, -1, "registered_on_player_receive_fields");
	// Call callbacks
	// param 1
	objectrefGetOrCreate(L, player);
	// param 2
	lua_pushstring(L, formname.c_str());
	// param 3
	lua_newtable(L);
	StringMap::const_iterator it;
	for (it = fields.begin(); it != fields.end(); ++it) {
		const std::string &name = it->first;
		const std::string &value = it->second;
		lua_pushstring(L, name.c_str());
		lua_pushlstring(L, value.c_str(), value.size());
		lua_settable(L, -3);
	}
	script_run_callbacks(L, 3, RUN_CALLBACKS_MODE_OR_SC);
}
开发者ID:DaErHuo,项目名称:minetest,代码行数:26,代码来源:s_player.cpp

示例11: finalizeJob

//! The Job options are synchronised using the widgetChanged slot, but we still
//! need to determine if the options should be printed as part of the job.  This
//! is based on whether or not the associated control is enabled or not.
void InputDialog::finalizeJob(Job* job) 
{
   if (!job) return;
   QWidget* w;
   QString name;
   StringMap::const_iterator iter;
   StringMap s = job->getOptions();

   for (iter = s.begin(); iter != s.end(); ++iter) {
       name  = iter.key();
       w = findChild<QWidget*>(name.toLower());
	   // If there is no widget of this name, then we are probably dealing 
       // with something the user wrote into the preview box, so we just 
	   // leave things alone.
       if (w) job->printOption(name, w->isEnabled());
   }

   // Special case code to avoid writing the method keyword when custom is
   // chosen (for backward compatibility)
   QComboBox* method(findChild<QComboBox*>("method"));
   QString m(method->currentText());
   if (method && (m == "Custom" || m == "TD-DFT")) {
      job->printOption("METHOD", false);
      job->printOption("EXCHANGE", true);
   }
}
开发者ID:jhgorse,项目名称:IQmol,代码行数:29,代码来源:InputDialog.C

示例12: handleMainMenuButtons

void ScriptApiMainMenu::handleMainMenuButtons(const StringMap &fields)
{
	SCRIPTAPI_PRECHECKHEADER

	int error_handler = PUSH_ERROR_HANDLER(L);

	// Get handler function
	lua_getglobal(L, "core");
	lua_getfield(L, -1, "button_handler");
	lua_remove(L, -2); // Remove core
	if (lua_isnil(L, -1)) {
		lua_pop(L, 1); // Pop button handler
		return;
	}
	luaL_checktype(L, -1, LUA_TFUNCTION);

	// Convert fields to a Lua table
	lua_newtable(L);
	StringMap::const_iterator it;
	for (it = fields.begin(); it != fields.end(); ++it) {
		const std::string &name = it->first;
		const std::string &value = it->second;
		lua_pushstring(L, name.c_str());
		lua_pushlstring(L, value.c_str(), value.size());
		lua_settable(L, -3);
	}

	// Call it
	PCALL_RES(lua_pcall(L, 1, 0, error_handler));
	lua_pop(L, 1); // Pop error handler
}
开发者ID:MultiCraftProject,项目名称:MultiCraft,代码行数:31,代码来源:s_mainmenu.cpp

示例13: replaceTagsInWord

QString KraftDB::replaceTagsInWord( const QString& w, StringMap replaceMap ) const
{
    QString re( w );

    QMap<int, QStringList> reMap;
    StringMap::Iterator it;
    for ( it = replaceMap.begin(); it != replaceMap.end(); ++it ) {
        reMap[it.key().length()] << it.key();
    }

    QMap<int, QStringList>::Iterator reIt;
    for ( reIt = reMap.end(); reIt != reMap.begin(); ) {
        --reIt;
        QStringList keys = reIt.value();
        kDebug() << "PP: " << keys;
        for ( QStringList::Iterator dtIt = keys.begin(); dtIt != keys.end(); ++dtIt ) {
            QString repKey = *dtIt;
            re.replace( repKey, replaceMap[repKey] );
        }
    }

    kDebug() << "Adding to wordlist <" << re << ">";

    return re;
}
开发者ID:KDE,项目名称:kraft,代码行数:25,代码来源:kraftdb.cpp

示例14: onCurrentItemChanged

void SkillEditFrame::onCurrentItemChanged(DataContainerItem *current) {
	if (current == 0)
		return;
	QTableWidget *skillTable = this->findChild<QTableWidget *>("skillTable");
	DataContainerItem *item = current;
	if (item->getStringData().size() > 0) {
		StatsContainer *skill = GenStatsReader::getContainer(*skillStats, item->getStringData());
		if (skill != 0) {
			typedef std::map<std::string, std::string> StringMap;
			StringMap dataMap = skill->getBaseDataMap();
			for (int i=0; i<skillTable->rowCount(); ++i) {
				for (int j=0; j<skillTable->columnCount(); ++j) {
					delete skillTable->item(i, j);
				}
			}
			
			skillTable->setRowCount(0);
			int row = 0;
			for (StringMap::iterator it = dataMap.begin(); it != dataMap.end(); ++it) {
				QTableWidgetItem *nameItem = new QTableWidgetItem();
				nameItem->setText(it->first.c_str());
				QTableWidgetItem *valueItem = new QTableWidgetItem();
				valueItem->setText(it->second.c_str());
				skillTable->insertRow(row);
				skillTable->setItem(row, 0, nameItem);
				skillTable->setItem(row, 1, valueItem);
				++row;
			}

			skillTable->resizeRowsToContents();
			skillTable->resizeColumnsToContents();
		}
	}
}
开发者ID:mishley,项目名称:MooseEdit,代码行数:34,代码来源:SkillEditFrame.cpp

示例15: Gets

Int2StrMap XceCacheAdapter::Gets(const IntSequence& ids) {
  // 1 %
  // 2 call one by one

  typedef std::map< ::Ice::Int, StringList> GetsMap;
  GetsMap gets_map;

  for(IntSequence::const_iterator i = ids.begin(); i != ids.end(); ++i) {
    int index = *i % cluster();
    gets_map[index].push_back(std::string(
      (const char*)&(*i), sizeof(Ice::Int)
      ));
  }

  // 2 串行调用 Gets 
  Int2StrMap result;  
  int i=0;
  for (GetsMap::const_iterator gmi = gets_map.begin(); gmi != gets_map.end(); ++gmi, ++i) {
    try {
      CachePrx proxy = locate<CachePrx>(_cache_proxies, "cache", gmi->first, MyUtil::TWO_WAY);
      
      StringMap subr = proxy->Gets(gmi->second);

      for (StringMap::const_iterator i=subr.begin(); i!=subr.end(); ++i) {
        int uid = *(int*)(i->first.data()); // 
        result.insert(std::make_pair(uid, i->second));
      }
    } catch (Ice::Exception& e) {
      MCE_ERROR("Gets error: cluster="<< i << e);
      continue;
    }
  }
  
  return result;
}
开发者ID:bradenwu,项目名称:oce,代码行数:35,代码来源:XceCacheAdapter.cpp


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