本文整理汇总了C++中path::append_filename方法的典型用法代码示例。如果您正苦于以下问题:C++ path::append_filename方法的具体用法?C++ path::append_filename怎么用?C++ path::append_filename使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类path
的用法示例。
在下文中一共展示了path::append_filename方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: update_file
void Container::update_file(const std::string& filename, const path& relative_path, const path& src)
{
{
if (!validate())
{
if (has_callback_)
send_callback(CONFLICT, MISSING_ENC_FILES);
else
throw(std::logic_error("severe: synchronization with cloud incomplete!"));
return;
}
path location = relative_path.append_filename(filename);
std::string file_name = location.get_filename();
container_handle::file_node fnode = handle_.get_filenode(location);
if (!FileSystem::file_exists(src.str()))
{
return;
}
using namespace CryptoPP;
/*std::string crc;
if (!secure_crc(src.str(), crc))
{
return;
}*/
std::string hash;
if (!secure_hash(src.str(), hash))
{
return;
}
if (fnode.p == relative_path)
{
container_handle::block_node block_node = fnode.blocks[0];
std::string hashname = block_node.filename;
//std::string old_crc = block_node.crc;
std::string old_hash = block_node.hash;
if (old_hash == hash) { return; }
send_callback(INFORMATION, UPDATE_FILE, filename);
std::string location_name = block_node.location;
int64_t size = FileSystem::file_size(src.str());
int64_t old_size = fnode.size;
if (!handle_.update_memusage_location(location_name, (size - old_size)))
return;
path store_path(handle_.get_location_path(location_name));
if (!store_path.valid())
{
//THROW
return;
}
std::string iv;
bool ret = false;
switch (algo_)
{
case AES:
ret =helper_update_file<CryptoPP::AES>(fnode, src, store_path, iv);
break;
case SERPENT:
ret = helper_update_file<CryptoPP::Serpent>(fnode, src, store_path, iv);
break;
case TWOFISH:
ret = helper_update_file<CryptoPP::Twofish>(fnode, src, store_path, iv);
break;
default:
return;
}
if (!ret)
{
handle_.update_memusage_location(location_name, old_size - size);
return;
}
//handle_.update_file_crc(crc, location);
handle_.update_file_hash(hash, location);
//handle_.update_block_crc(crc, location, 1);
handle_.update_block_hash(hash, location, 1);
handle_.update_file_size(size, location);
}
}
save();
#ifdef TDEBUG
handle_.dump(std::string("C:\\Users\\Kai\\Desktop\\new_test.xml"));
#endif
}