本文整理汇总了C++中FileMap::empty方法的典型用法代码示例。如果您正苦于以下问题:C++ FileMap::empty方法的具体用法?C++ FileMap::empty怎么用?C++ FileMap::empty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileMap
的用法示例。
在下文中一共展示了FileMap::empty方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: join_files
//*******************************************************************
// join_files PRIVATE
//*******************************************************************
void QBtCompareDirsDialog::join_files( AllItems& out_set, const FileMap& in_map ) const
{
if( in_map.empty() ) return;
FileMap::const_iterator it = in_map.begin();
const FileMap::const_iterator end = in_map.end();
while( continue_ && ( it != end ) ) {
out_set.insert( it.key(), QString() );
++it;
}
}
示例2: save_changes
bool FileContainerTemporary::save_changes(const std::string &filename, bool as_copy)
{
if (file_is_opened()) return false;
etl::handle< FileContainerZip > container;
std::string fname_abs = fix_slashes(filename);
if (!is_absolute_path(fname_abs)) fname_abs = absolute_path(fname_abs);
bool save_at_place = filename.empty() || fname_abs == container_filename_;
if (save_at_place) as_copy = false;
if (save_at_place)
{
if (!container_->is_opened()) return false;
container = container_;
}
else
{
if (container_->is_opened())
{
{ // copy container
ReadStreamHandle read_steram = container_->get_read_stream_whole_container();
if (read_steram.empty()) return false;
WriteStreamHandle write_stream = file_system_->get_write_stream(filename);
if (write_stream.empty()) return false;
if (!write_stream->write_whole_stream(read_steram)) return false;
}
// open container
container = new FileContainerZip();
if (!container->open(filename)) return false;
}
else
{
// create container
container = new FileContainerZip();
if (!container->create(filename)) return false;
}
}
FileMap files = files_;
// remove files
bool processed = true;
while(processed)
{
processed = false;
for(FileMap::iterator i = files.begin(); i != files.end(); i++)
{
if (i->second.is_removed && container->file_remove(i->second.name))
{
processed = true;
files.erase(i);
break;
}
}
}
// create directories
processed = true;
while(processed)
{
processed = false;
for(FileMap::iterator i = files.begin(); i != files.end(); i++)
{
if (!i->second.is_removed
&& i->second.is_directory
&& container->directory_create(i->second.name))
{
processed = true;
files.erase(i);
break;
}
}
}
// create files
for(FileMap::iterator i = files.begin(); i != files.end();)
{
if (!i->second.is_removed
&& !i->second.is_directory
&& !i->second.tmp_filename.empty()
&& copy(file_system_, i->second.tmp_filename, container, i->second.name))
{
file_system_->file_remove(i->second.tmp_filename);
processed = true;
files.erase(i++);
}
else i++;
}
// try to save container
if (container->save())
{
// update internal state
if (save_at_place)
{
files_ = files;
//.........这里部分代码省略.........