qBittorrent
Utils::IO Namespace Reference

Classes

class  FileDeviceOutputIterator
 

Functions

nonstd::expected< void, QString > saveToFile (const QString &path, const QByteArray &data)
 
nonstd::expected< void, QString > saveToFile (const QString &path, const lt::entry &data)
 

Function Documentation

◆ saveToFile() [1/2]

nonstd::expected< void, QString > Utils::IO::saveToFile ( const QString &  path,
const lt::entry &  data 
)

Definition at line 77 of file io.cpp.

78 {
79  QSaveFile file {path};
80  if (!file.open(QIODevice::WriteOnly))
81  return nonstd::make_unexpected(file.errorString());
82 
83  const int bencodedDataSize = lt::bencode(Utils::IO::FileDeviceOutputIterator {file}, data);
84  if ((file.size() != bencodedDataSize) || !file.flush() || !file.commit())
85  return nonstd::make_unexpected(file.errorString());
86 
87  return {};
88 }
file(GLOB QBT_TS_FILES "${qBittorrent_SOURCE_DIR}/src/lang/*.ts") set_source_files_properties($
Definition: CMakeLists.txt:5

References file().

Here is the call graph for this function:

◆ saveToFile() [2/2]

nonstd::expected< void, QString > Utils::IO::saveToFile ( const QString &  path,
const QByteArray &  data 
)