Smart Temporary File. More...

#include <rio.h>

Collaboration diagram for RSmartTempFile:
[legend]

Public Member Functions

 RSmartTempFile (void)
 
RURI GetName (bool remove=true)
 
 ~RSmartTempFile (void)
 

Private Attributes

RURI Name
 
bool Requested
 
bool Remove
 

Detailed Description

Smart Temporary File.

This class provides a "smart" temporary file. In practice, once the name of a temporary file is asked, when the instance is deleted, the temporary file is created. Of course, the temporary file may be explicitly leave if necessary.

It can be useful in an exception environment, since temporary files are always removed.

void BadFunction(void)
{
RTextFile Text(Tmp.GetName());
Text.Open(RIO::Create);
int Wrong (2/0); // This will generate an exception -> Temporary file is removed
}

Constructor & Destructor Documentation

RSmartTempFile ( void  )

Constructor.

~RSmartTempFile ( void  )

Destruct. If the name was requested, the temporary file is removed.

Member Function Documentation

RURI GetName ( bool  remove = true)

Get the name of the temporary file.

Parameters
removeFile must be removed?

Field Documentation

RURI Name
private

Name of the temporary file.

bool Requested
private

Name requested?

bool Remove
private

Temporary file must be removed.