FileResource Class Reference

This is a Resource class that opens and closes files and optionally deletes them after close. More...

#include <FileResource.h>

Inheritance diagram for FileResource:

Inheritance graph

List of all members.

Public Member Functions

 FileResource (const char *pFilename, const char *pAccess, bool deleteOnClose=false)
 operator FILE * ()
bool getDeleteOnClose () const
void setDeleteOnClose (bool deleteOnClose)


Detailed Description

This is a Resource class that opens and closes files and optionally deletes them after close.

This class has a conversion operator to allow a FileResource object to be used wherever a FILE* would normally be used.

Definition at line 109 of file FileResource.h.


Constructor & Destructor Documentation

FileResource::FileResource ( const char *  pFilename,
const char *  pAccess,
bool  deleteOnClose = false 
)

Constructs a Resource object that wraps a FILE*.

Opens the specified file using the specified access modes.

Parameters:
pFilename The name of the file to open.
pAccess The access mode to open the file with. These match the modes used with fopen().
deleteOnClose If true, the file will be deleted from the file system after it is closed. If false, the file will simply be closed.

Definition at line 126 of file FileResource.h.


Member Function Documentation

FileResource::operator FILE * (  ) 

Returns a pointer to the underlying FILE.

This operator allows the FileResource object to be used wherever a FILE* would normally be used.

Returns:
A pointer to the underlying FILE.

Definition at line 138 of file FileResource.h.

bool FileResource::getDeleteOnClose (  )  const

Returns whether the file will be deleted after it is closed.

Returns:
Returns true if the file will be deleted after it is closed, or false if the file will simply be closed.

Definition at line 149 of file FileResource.h.

void FileResource::setDeleteOnClose ( bool  deleteOnClose  ) 

Sets whether the file will be deleted after it is closed.

Parameters:
deleteOnClose If set to true, the file will be deleted after it is closed. If set to false, the file will simply close without being deleted.

Definition at line 163 of file FileResource.h.


Software Development Kit - Opticks 4.9.0 Build 16218