本文整理汇总了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 ) );
}
示例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;
}
示例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;
}
示例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);
}
}