Smart Temporary File. More...
#include <rio.h>
Collaboration diagram for RSmartTempFile:
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)
{
RSmartTempFile Tmp;
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
-
remove File must be removed?
Field Documentation
|
private |
Name of the temporary file.
|
private |
Name requested?
|
private |
Temporary file must be removed.