本文整理汇总了C++中FileMap::find方法的典型用法代码示例。如果您正苦于以下问题:C++ FileMap::find方法的具体用法?C++ FileMap::find怎么用?C++ FileMap::find使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileMap
的用法示例。
在下文中一共展示了FileMap::find方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: compare_files
//*******************************************************************
// compare_files PRIVATE
//-------------------------------------------------------------------
// Porownanie wszystkich przyslanych plikow.
// Kryterium porownywania jest czas ich ostatniej modyfikacji.
//*******************************************************************
void QBtCompareDirsDialog::compare_files( const FileMap& in_data1, const FileMap& in_data2 )
{
QBtShared::idle();
if( !continue_ ) return;
AllItems data_all = AllItems();
join_files( data_all, in_data1 );
join_files( data_all, in_data2 );
if( data_all.empty() ) return;
RowData row_data;
AllItems::const_iterator it = data_all.begin();
const AllItems::const_iterator end = data_all.end();
while( continue_ && ( it != end ) ) {
const QString name = it.key();
const FileMap::const_iterator it1 = in_data1.find( name );
const FileMap::const_iterator it2 = in_data2.find( name );
const bool is1 = ( it1 != in_data1.end() );
const bool is2 = ( it2 != in_data2.end() );
row_data.reset();
if( is1 ) row_data.set_lft( name, it1.value().absoluteFilePath() );
if( is2 ) row_data.set_rgt( name, it2.value().absoluteFilePath() );
if( is1 && is2 ) {
row_data.separator( check_files( row_data.path1(), row_data.path2() ) );
}
add_row( row_data );
++it;
}
}
示例2: unmap
void Memory::unmap(hostptr_t addr, size_t /*count*/)
{
FileMapEntry entry = Files.find(addr);
if(Files.remove(addr) == false) return;
UnmapViewOfFile(entry.address());
CloseHandle(entry.handle());
}
示例3: shadow
hostptr_t Memory::shadow(hostptr_t addr, size_t count)
{
TRACE(GLOBAL, "Getting shadow mapping for %p ("FMT_SIZE" bytes)", addr, count);
FileMapEntry entry = Files.find(addr);
if(entry.handle() == NULL) return NULL;
off_t offset = off_t(addr - entry.address());
hostptr_t ret = (hostptr_t)MapViewOfFile(entry.handle(), FILE_MAP_WRITE, 0, (DWORD)offset, (DWORD)count);
return ret;
}
示例4: release
// Call instead of delete:
void DataFile::release ()
{
if (--_ref_count <= 0)
{
FileMap::iterator i = open_data_files.find (_filename);
LOG_ASSERT (i != open_data_files.end ());
open_data_files.erase (i);
delete this;
}
}
示例5: 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;
}
示例6: 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);
}
}