Bitcoin ABC 0.26.3
P2P Digital Currency
|
Non-refcounted RAII wrapper for FILE*. More...
#include <streams.h>
Public Member Functions | |
AutoFile (FILE *filenew) | |
~AutoFile () | |
AutoFile (const AutoFile &)=delete | |
AutoFile & | operator= (const AutoFile &)=delete |
int | fclose () |
FILE * | release () |
Get wrapped FILE* with transfer of ownership. | |
FILE * | Get () const |
Get wrapped FILE* without transfer of ownership. | |
bool | IsNull () const |
Return true if the wrapped FILE* is nullptr, false otherwise. | |
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 | |
FILE * | file |
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).
|
inline |
|
delete |
|
inline |
|
inline |
|
inline |
|
inline |