![]() |
Bitcoin Core
25.99.0
P2P Digital Currency
|
Non-refcounted RAII wrapper for FILE*. More...
#include <streams.h>
Public Member Functions | |
AutoFile (std::FILE *file, std::vector< std::byte > data_xor={}) | |
~AutoFile () | |
AutoFile (const AutoFile &)=delete | |
AutoFile & | operator= (const AutoFile &)=delete |
bool | feof () const |
int | fclose () |
std::FILE * | release () |
Get wrapped FILE* with transfer of ownership. More... | |
std::FILE * | Get () const |
Get wrapped FILE* without transfer of ownership. More... | |
bool | IsNull () const |
Return true if the wrapped FILE* is nullptr, false otherwise. More... | |
std::size_t | detail_fread (Span< std::byte > dst) |
Implementation detail, only used internally. More... | |
void | read (Span< std::byte > dst) |
void | ignore (size_t nSize) |
void | write (Span< const std::byte > src) |
template<typename T > | |
AutoFile & | operator<< (const T &obj) |
template<typename T > | |
AutoFile & | operator>> (T &&obj) |
Protected Attributes | |
std::FILE * | m_file |
const std::vector< std::byte > | m_xor |
Non-refcounted RAII wrapper for FILE*.
Will automatically close the file when it goes out of scope if not null. If you're returning the file pointer, return file.release(). If you need to close the file early, use file.fclose() instead of fclose(file).
|
inlineexplicit |
|
inline |
|
delete |
std::size_t AutoFile::detail_fread | ( | Span< std::byte > | dst | ) |
Implementation detail, only used internally.
Definition at line 10 of file streams.cpp.
|
inline |
|
inline |
|
inline |
void AutoFile::ignore | ( | size_t | nSize | ) |
Definition at line 31 of file streams.cpp.
|
inline |
void AutoFile::read | ( | Span< std::byte > | dst | ) |
|
inline |
void AutoFile::write | ( | Span< const std::byte > | src | ) |