#include <AutoClose.h>
Public Member Functions | |
| AutoClose (void) | |
| AutoClose (IRom *rom) | |
| AutoClose (AutoClose &rhs) | |
| AutoClose & | operator= (AutoClose &rhs) |
| ~AutoClose (void) | |
| const IRom * | get () const |
| const IRom * | operator-> () const |
| const IRom & | operator* () const |
| IRom * | get () |
| IRom * | operator-> () |
| IRom & | operator* () |
| void | reset (IRom *rom) |
| void | destruct () |
| void | decontrol () |
| void | swap (AutoClose &rhs) |
An object wrapper that closes the (readonly) file on destruction. It additionally holds a flag specifying whether the wrapper is responsible for the file to close. Only one wrapper should be responsible for the closing operation. If a wrapper is created through the copy constructor or the copy assignment operator, the new wrapper becomes responsible (if the source wrapper was responsible at all). This class works very similar to std::auto_ptr.
| xl7::io::AutoClose::AutoClose | ( | void | ) | [inline] |
Default constructor.
| xl7::io::AutoClose::AutoClose | ( | IRom * | rom | ) | [inline, explicit] |
Explicit constructor.
| xl7::io::AutoClose::AutoClose | ( | AutoClose & | rhs | ) | [inline] |
Copy constructor.
| xl7::io::AutoClose::~AutoClose | ( | void | ) | [inline] |
Destructor.
| void xl7::io::AutoClose::decontrol | ( | ) | [inline] |
Forces the wrapper to lose responsibility for the closing operation.
| void xl7::io::AutoClose::destruct | ( | ) | [inline] |
Closes the file (if responsible).
| IRom* xl7::io::AutoClose::get | ( | ) | [inline] |
Returns the pointer to the file.
| const IRom* xl7::io::AutoClose::get | ( | ) | const [inline] |
Returns the pointer to the file.
| IRom& xl7::io::AutoClose::operator* | ( | ) | [inline] |
Returns the file.
| const IRom& xl7::io::AutoClose::operator* | ( | ) | const [inline] |
Returns the file.
| IRom* xl7::io::AutoClose::operator-> | ( | ) | [inline] |
Returns the pointer to the file.
| const IRom* xl7::io::AutoClose::operator-> | ( | ) | const [inline] |
Returns the pointer to the file.
| void xl7::io::AutoClose::reset | ( | IRom * | rom | ) | [inline] |
Replaces the file by another one. The current file will be closed if the wrapper is responsible. The wrapper will be responsible for the newly set file.
| void xl7::io::AutoClose::swap | ( | AutoClose & | rhs | ) | [inline] |
Swaps the contents of two wrappers.
1.6.1