Anoncoin  0.9.4
P2P Digital Currency
Public Member Functions | Public Attributes | Protected Attributes | List of all members
CAutoFile Class Reference

RAII wrapper for FILE*. More...

#include <serialize.h>

Public Member Functions

 CAutoFile (FILE *filenew, int nTypeIn, int nVersionIn)
 
 ~CAutoFile ()
 
void fclose ()
 
FILE * release ()
 
 operator FILE * ()
 
FILE * operator-> ()
 
FILE & operator* ()
 
FILE ** operator& ()
 
FILE * operator= (FILE *pnew)
 
bool operator! ()
 
void setstate (short bits, const char *psz)
 
bool fail () const
 
bool good () const
 
void clear (short n=0)
 
short exceptions ()
 
short exceptions (short mask)
 
void SetType (int n)
 
int GetType ()
 
void SetVersion (int n)
 
int GetVersion ()
 
void ReadVersion ()
 
void WriteVersion ()
 
CAutoFileread (char *pch, size_t nSize)
 
CAutoFilewrite (const char *pch, size_t nSize)
 
template<typename T >
unsigned int GetSerializeSize (const T &obj)
 
template<typename T >
CAutoFileoperator<< (const T &obj)
 
template<typename T >
CAutoFileoperator>> (T &obj)
 

Public Attributes

int nType
 
int nVersion
 

Protected Attributes

FILE * file
 
short state
 
short exceptmask
 

Detailed Description

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).

Definition at line 1154 of file serialize.h.

Constructor & Destructor Documentation

CAutoFile::CAutoFile ( FILE *  filenew,
int  nTypeIn,
int  nVersionIn 
)
inline

Definition at line 1164 of file serialize.h.

CAutoFile::~CAutoFile ( )
inline

Definition at line 1173 of file serialize.h.

Here is the call graph for this function:

Member Function Documentation

void CAutoFile::clear ( short  n = 0)
inline

Definition at line 1206 of file serialize.h.

short CAutoFile::exceptions ( )
inline

Definition at line 1207 of file serialize.h.

short CAutoFile::exceptions ( short  mask)
inline

Definition at line 1208 of file serialize.h.

Here is the call graph for this function:

bool CAutoFile::fail ( ) const
inline

Definition at line 1204 of file serialize.h.

void CAutoFile::fclose ( )
inline

Definition at line 1178 of file serialize.h.

Here is the caller graph for this function:

template<typename T >
unsigned int CAutoFile::GetSerializeSize ( const T &  obj)
inline

Definition at line 1236 of file serialize.h.

Here is the call graph for this function:

Here is the caller graph for this function:

int CAutoFile::GetType ( )
inline

Definition at line 1211 of file serialize.h.

int CAutoFile::GetVersion ( )
inline

Definition at line 1213 of file serialize.h.

bool CAutoFile::good ( ) const
inline

Definition at line 1205 of file serialize.h.

CAutoFile::operator FILE * ( )
inline

Definition at line 1186 of file serialize.h.

bool CAutoFile::operator! ( )
inline

Definition at line 1191 of file serialize.h.

FILE** CAutoFile::operator& ( )
inline

Definition at line 1189 of file serialize.h.

FILE& CAutoFile::operator* ( )
inline

Definition at line 1188 of file serialize.h.

FILE* CAutoFile::operator-> ( )
inline

Definition at line 1187 of file serialize.h.

template<typename T >
CAutoFile& CAutoFile::operator<< ( const T &  obj)
inline

Definition at line 1243 of file serialize.h.

Here is the call graph for this function:

FILE* CAutoFile::operator= ( FILE *  pnew)
inline

Definition at line 1190 of file serialize.h.

template<typename T >
CAutoFile& CAutoFile::operator>> ( T &  obj)
inline

Definition at line 1253 of file serialize.h.

Here is the call graph for this function:

CAutoFile& CAutoFile::read ( char *  pch,
size_t  nSize 
)
inline

Definition at line 1217 of file serialize.h.

Here is the call graph for this function:

void CAutoFile::ReadVersion ( )
inline

Definition at line 1214 of file serialize.h.

FILE* CAutoFile::release ( )
inline

Definition at line 1185 of file serialize.h.

void CAutoFile::setstate ( short  bits,
const char *  psz 
)
inline

Definition at line 1197 of file serialize.h.

Here is the caller graph for this function:

void CAutoFile::SetType ( int  n)
inline

Definition at line 1210 of file serialize.h.

void CAutoFile::SetVersion ( int  n)
inline

Definition at line 1212 of file serialize.h.

CAutoFile& CAutoFile::write ( const char *  pch,
size_t  nSize 
)
inline

Definition at line 1226 of file serialize.h.

Here is the call graph for this function:

void CAutoFile::WriteVersion ( )
inline

Definition at line 1215 of file serialize.h.

Member Data Documentation

short CAutoFile::exceptmask
protected

Definition at line 1159 of file serialize.h.

FILE* CAutoFile::file
protected

Definition at line 1157 of file serialize.h.

int CAutoFile::nType

Definition at line 1161 of file serialize.h.

int CAutoFile::nVersion

Definition at line 1162 of file serialize.h.

short CAutoFile::state
protected

Definition at line 1158 of file serialize.h.


The documentation for this class was generated from the following file: