Master Core  v0.0.9 - 2abfd2849db8ba7a83957c64eb976b406713c123
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Public Member Functions | Public Attributes | Protected Attributes | List of all members
CAutoFile Class Reference

RAII wrapper for FILE*. More...

#include <serialize.h>

+ Collaboration diagram for CAutoFile:

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 1145 of file serialize.h.

Constructor & Destructor Documentation

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

Definition at line 1155 of file serialize.h.

CAutoFile::~CAutoFile ( )
inline

Definition at line 1164 of file serialize.h.

References fclose().

+ Here is the call graph for this function:

Member Function Documentation

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

Definition at line 1197 of file serialize.h.

short CAutoFile::exceptions ( )
inline

Definition at line 1198 of file serialize.h.

References exceptmask.

short CAutoFile::exceptions ( short  mask)
inline

Definition at line 1199 of file serialize.h.

References exceptmask, and setstate().

+ Here is the call graph for this function:

bool CAutoFile::fail ( ) const
inline

Definition at line 1195 of file serialize.h.

void CAutoFile::fclose ( )
inline

Definition at line 1169 of file serialize.h.

Referenced by ~CAutoFile().

+ Here is the caller graph for this function:

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

Definition at line 1227 of file serialize.h.

References GetSerializeSize().

Referenced by WriteBlockToDisk().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int CAutoFile::GetType ( )
inline

Definition at line 1202 of file serialize.h.

References nType.

int CAutoFile::GetVersion ( )
inline

Definition at line 1204 of file serialize.h.

References nVersion.

bool CAutoFile::good ( ) const
inline

Definition at line 1196 of file serialize.h.

CAutoFile::operator FILE * ( )
inline

Definition at line 1177 of file serialize.h.

References file.

bool CAutoFile::operator! ( )
inline

Definition at line 1182 of file serialize.h.

FILE** CAutoFile::operator& ( )
inline

Definition at line 1180 of file serialize.h.

References file.

FILE& CAutoFile::operator* ( )
inline

Definition at line 1179 of file serialize.h.

References file.

FILE* CAutoFile::operator-> ( )
inline

Definition at line 1178 of file serialize.h.

References file.

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

Definition at line 1234 of file serialize.h.

References Serialize().

+ Here is the call graph for this function:

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

Definition at line 1181 of file serialize.h.

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

Definition at line 1244 of file serialize.h.

References Unserialize().

+ Here is the call graph for this function:

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

Definition at line 1208 of file serialize.h.

References setstate().

+ Here is the call graph for this function:

void CAutoFile::ReadVersion ( )
inline

Definition at line 1205 of file serialize.h.

References nVersion.

FILE* CAutoFile::release ( )
inline

Definition at line 1176 of file serialize.h.

References file.

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

Definition at line 1188 of file serialize.h.

Referenced by exceptions(), read(), and write().

+ Here is the caller graph for this function:

void CAutoFile::SetType ( int  n)
inline

Definition at line 1201 of file serialize.h.

void CAutoFile::SetVersion ( int  n)
inline

Definition at line 1203 of file serialize.h.

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

Definition at line 1217 of file serialize.h.

References setstate().

+ Here is the call graph for this function:

void CAutoFile::WriteVersion ( )
inline

Definition at line 1206 of file serialize.h.

References nVersion.

Member Data Documentation

short CAutoFile::exceptmask
protected

Definition at line 1150 of file serialize.h.

Referenced by exceptions().

FILE* CAutoFile::file
protected

Definition at line 1148 of file serialize.h.

Referenced by operator FILE *(), operator&(), operator*(), operator->(), and release().

int CAutoFile::nType

Definition at line 1152 of file serialize.h.

Referenced by GetType().

int CAutoFile::nVersion

Definition at line 1153 of file serialize.h.

Referenced by GetVersion(), ReadVersion(), and WriteVersion().

short CAutoFile::state
protected

Definition at line 1149 of file serialize.h.


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