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


C++ NameMap::find方法代码示例

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


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

示例1: lookupHash

	virtual void lookupHash(const URI &namedUri, const Callback &cb) {
		{
			boost::shared_lock<boost::shared_mutex> lookuplock(mMut);
			NameMap::const_iterator iter = mLookupCache.find(namedUri);
			if (iter != mLookupCache.end()) {
				RemoteFileId rfid ((*iter).second); // copy, because the map could change.
				lookuplock.unlock();

				cb(namedUri, &rfid);
				return;
			}
		}
		NameLookupManager::lookupHash(namedUri, cb);
	}
开发者ID:jordanmisiura,项目名称:sirikata,代码行数:14,代码来源:CachedNameLookupManager.hpp

示例2: resolveSearchpaths

        StringList AbstractFileManager::resolveSearchpaths(const String& rootPath, const StringList& searchPaths) {
            typedef std::map<String, String> NameMap;
            NameMap nameMap;
            
            StringList contents = directoryContents(rootPath, "", true, false);
            for (size_t i = 0; i < contents.size(); i++)
                nameMap[Utility::toLower(contents[i])] = contents[i];

            StringList result;
            for (size_t i = 0; i < searchPaths.size(); i++) {
                NameMap::iterator it = nameMap.find(Utility::toLower(searchPaths[i]));
                if (it != nameMap.end())
                    result.push_back(appendPath(rootPath, it->second));
            }
            
            return result;
        }
开发者ID:ProPuke,项目名称:TrenchBroom,代码行数:17,代码来源:AbstractFileManager.cpp

示例3: generateDestroyMission

MissionObject* MissionManager::generateDestroyMission(MissionObject* mission, uint64 terminal)
{


	mission->setMissionType(destroy); //crc = destroy

	//find the missiondata for the respective terminal
	Terminal_Mission_Link* link = NULL;

	TerminalMap::iterator terminalMapIt = mTerminalMap.find(terminal);
	if(terminalMapIt != mTerminalMap.end())
	{
		gLogger->logMsgF("MissionManager : found the terminal",MSG_HIGH);
		Terminal_Type* terminal = (*terminalMapIt).second;

		//now get the amount of stfs and get one per chance
		uint32 amount = terminal->list.size();
		uint32 chosen = gRandom->getRand() % amount;

		gLogger->logMsgF("MissionManager : random : %u",MSG_HIGH,chosen);

		bool found = false;
		uint32 counter = 0;
		while(!found)
		{
			gLogger->logMsgF("MissionManager : != found ",MSG_HIGH);
			MissionLinkList::iterator it = 	terminal->list.begin();
			while(it != terminal->list.end())
			{
				if(counter >= chosen)
				{
					if((*it)->type == MissionTypeDestroy)
					{
						found = true;
						link = (*it);
						break;
					}
				}
				counter++;
				it++;

			}
			it = terminal->list.begin();

		}

	}

	int mission_num;

	if(link)
	{
		gLogger->logMsgF("MissionManager : found db destroy missions",MSG_HIGH);

		//now set the stf
		char s[255];
		sprintf(s,"mission/%s",link->missiontype->stf.getAnsi());
		mission->setTitleFile(s);

		//the mission within the stf
		mission_num = (gRandom->getRand() % link->content)+1;
		mission->setNum(mission_num);

		//Mission Title
		sprintf(mt,"m%dt",mission_num);
		mission->setTitle(mt);


		//Mission Description
		sprintf(md,"m%dd",mission_num);

		mission->setDetailFile(s);
		mission->setDetail(md);

		//still have to sort out the names of the mission givers
	}
	else
	{
		gLogger->logMsgF("MissionManager : No mission file associated :(",MSG_HIGH);
		return NULL;

	}


	missionTargets missionTarget[4] =
	{
			{0xB9BA5440, "@lair_n:naboo_otolla_gungan_camp_neutral_large_theater"},
			{0x6D4C33E5, "@lair_n:naboo_capper_spineflap_nest_neutral_large"},
			{0xA0057DAE, "@lair_n:naboo_kaadu_lair_neutral_medium_boss_01"},
			{0xFA6FD53A, "@lair_n:lair_base"},
	};


	//Randomly choose a target
	int target = gRandom->getRand() % 4;

	//END TEMP

	//Position
	//int radius = 500; //500m radius
//.........这里部分代码省略.........
开发者ID:Arnold47525,项目名称:mmoserver,代码行数:101,代码来源:MissionManager.cpp

示例4: Add

bool ArcApp::Add()
{
    // turn m_args into a list of files, i.e. expand wildcards, recurse
    // directories and remove duplicates
    NameMap files;
    MakeFileList(files);

    wxInputStreamPtr in(MakeInputStream());
    if (!in.get()) return false;
    wxOutputStreamPtr out(MakeOutputStream());
    if (!out.get()) return false;

    wxArchiveInputStreamPtr  arc(m_factory->NewStream(*in));
    wxArchiveOutputStreamPtr outarc(m_factory->NewStream(*out));
    wxArchiveEntryPtr        entry(arc->GetNextEntry());

    outarc->CopyArchiveMetaData(*arc);

    for (;;) {
        bool keep;
        NameMap::iterator it;

        if (!entry.get()) {
            if (files.empty())
                break;
            it = files.begin();
            keep = false;
        } else {
            it = files.find(entry->GetInternalName());
            keep = true;
        }

        if (it != files.end()) {
            wxString name = it->second;
            files.erase(it);

            if (wxDirExists(name)) {
                *m_info << "adding " << name.mb_str() << std::endl;
                wxDateTime dt(wxFileModificationTime(name));
                if (!outarc->PutNextDirEntry(name, dt))
                    return false;
                keep = false;
            } else {
                wxFFileInputStream file(name);

                if (file.Ok()) {
                    *m_info << "adding " << name.mb_str() << std::endl;
                    wxDateTime dt(wxFileModificationTime(name));
                    if (!outarc->PutNextEntry(name, dt, file.GetSize()) ||
                            !outarc->Write(file) || !file.Eof())
                        return false;
                    keep = false;
                }
            }
        }

        if (keep)
            if (!outarc->CopyEntry(entry.release(), *arc))
                return false;

        if (entry.get() || keep)
            entry.reset(arc->GetNextEntry());
    }

    in.reset();
    return arc->Eof() && outarc->Close() && out->Close();
}
开发者ID:stahta01,项目名称:wxCode_components,代码行数:67,代码来源:arc.cpp


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