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


C++ FileMap::insert方法代码示例

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


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

示例1: registerFile

 void registerFile( llvm::StringRef compilerPath, llvm::StringRef replacement )
 {
     FileStatus fileStatus;
     CompilerDescription desc = { compilerPath.str(), replacement.str() };
     if ( getFileStatus( compilerPath, fileStatus ) )
         files.insert( std::make_pair( fileStatus, desc ) );
 }
开发者ID:pkesist,项目名称:buildpal,代码行数:7,代码来源:hookProcess.cpp

示例2: DataFile

DataFile *DataFile::reference (const stdString &filename, bool for_write)
{
    DataFile *file;

    FileMap::iterator i = open_data_files.find (filename);
    if (i == open_data_files.end ())
    {
        file = new DataFile (filename, for_write);
        open_data_files.insert (FileMap::value_type (file->getFilename(), file));
    }
    else
    {
        file = i->second;
        file->reference ();
    }

    return file;
}
开发者ID:epicsdeb,项目名称:channelarchiver,代码行数:18,代码来源:DataFile.cpp

示例3: map

hostptr_t Memory::map(hostptr_t addr, size_t count, GmacProtection prot)
{
    hostptr_t cpuAddr = NULL;

	// Create anonymous file to be mapped
	HANDLE handle = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, (DWORD)count, NULL);
	if(handle == NULL) return NULL;
	
	// Create a view of the file in the previously allocated virtual memory range
	if((cpuAddr = (hostptr_t)MapViewOfFileEx(handle, FILE_MAP_WRITE, 0, 0, (DWORD)count, addr)) == NULL) {
		CloseHandle(handle);
		return NULL;
	}

	if(Files.insert(handle, cpuAddr, count) == false) {
		CloseHandle(handle);
		return NULL;
	}

	// Make sure that the range has the requested virtual protection bits
	protect(cpuAddr, count, prot);
    return cpuAddr;
}
开发者ID:GMAC-lib,项目名称:gmac,代码行数:23,代码来源:Memory.cpp

示例4: SaveToStreams

void ObjectCollection::SaveToStreams()
{
	typedef std::pair<String, Array<TypedCompoundPointer>>					FileEntry;
	typedef std::unordered_map<String, Array<TypedCompoundPointer>>			FileMap;
	FileMap map;

	for (TypedCompoundPointer& p : mObjects)
	{
		String* loc = p.GetCompoundMember<String>("!location");
		gAssert(loc != nullptr);
		FileMap::iterator i = map.find(*loc);
		if (i == map.end())
			map.insert(FileEntry(*loc, Array<TypedCompoundPointer>(&p, 1)));
		else
			i->second.Append(p);
	}

	for (const FileEntry& entry : map)
	{
		Path target_path(entry.first);
		StreamDevice* d = gDevices.FindDevice(target_path.GetDeviceName());
		gAssert(d != nullptr);
		Stream* s = d->CreateStream(target_path, smWrite);
		gAssert(s != nullptr);
		ObjectWriter wr(*s);
		std::cout << "Opened stream to " << target_path << std::endl;
		for (const TypedCompoundPointer& object : entry.second)
		{
			const String* name = object.GetCompoundMember<String>("!name");
			const String* loc = object.GetCompoundMember<String>("!location");
			std::cout << "   Writing: " << (loc != nullptr ? *loc : String("<noloc>")) << " : " << (name != nullptr ? *name : String("<noname>")) << std::endl;
			wr.WriteTypedCompoundPointer(object);
		}
		d->CloseStream(s);
	}
}
开发者ID:jaapnull,项目名称:Crockett,代码行数:36,代码来源:ObjectCollection.cpp


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