Hugintrunk  0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Member Functions | Private Attributes | List of all members
vigra_ext::FileRAII Class Reference

Class used for opening files. More...

#include <FileRAII.h>

Public Member Functions

 FileRAII (const char *path, const char *mode)
 Open the specified file. More...
 
 ~FileRAII ()
 
FILE * get ()
 Get pointer to opened file. More...
 

Private Member Functions

 FileRAII (const FileRAII &)
 
FileRAIIoperator= (const FileRAII &)
 

Private Attributes

FILE * file
 

Detailed Description

Class used for opening files.

File class using RAII (Resource Acquisition Is Initialization) technique. This ensures that the file is properly close even when an exception occurs.

Definition at line 33 of file FileRAII.h.

Constructor & Destructor Documentation

vigra_ext::FileRAII::FileRAII ( const char *  path,
const char *  mode 
)
inline

Open the specified file.

Parameters
pathpath to a file
modemode as defined by the fopen function

Definition at line 41 of file FileRAII.h.

References file.

vigra_ext::FileRAII::~FileRAII ( )
inline

Definition at line 52 of file FileRAII.h.

References file.

vigra_ext::FileRAII::FileRAII ( const FileRAII )
private

Member Function Documentation

FILE* vigra_ext::FileRAII::get ( )
inline

Get pointer to opened file.

Returns
FILE* pointer to the opened file.

Definition at line 79 of file FileRAII.h.

References file.

FileRAII& vigra_ext::FileRAII::operator= ( const FileRAII )
private

Member Data Documentation

FILE* vigra_ext::FileRAII::file
private

Definition at line 85 of file FileRAII.h.

Referenced by FileRAII(), get(), and ~FileRAII().


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