#include <libsswf.h>
Public Member Functions | |
DataLimit (const Data &data, unsigned long limit, bool offset=true) | |
Initializes a DataLimit object. | |
void | Restore () |
Restore the limit. | |
~DataLimit () | |
Restore the limit and clean up the data limit object. | |
Private Attributes | |
const Data *const | f_data |
const unsigned long | f_old_limit |
bool | f_restored |
Data::DataLimit::DataLimit | ( | const Data & | data, | |
unsigned long | limit, | |||
bool | offset = true | |||
) |
This class is used to create RAII objects allowing you to ensure that the limit of a Data object is always restored as required.
OutOfBoundsErrorException | is raised if the limit is more than the current size of the Data buffer. |
[in] | data | The data that receives the new limit. |
[in] | limit | The new data limit. |
[in] | offset | If true, the limit is considered to be an offset from the current file position. |
Data::DataLimit::~DataLimit | ( | ) |
void Data::DataLimit::Restore | ( | void | ) |
This function restores the limit of the data to what it was at the time you created this DataLimit object.
It is expected that all DataLimit will be created on your stack to automatically enforce the order in which the creations and destructions should occur.
References f_data, f_old_limit, f_restored, and sswf::Data::Limit().
Referenced by ~DataLimit().
const Data* const sswf::Data::DataLimit::f_data [private] |
Referenced by Restore().
const unsigned long sswf::Data::DataLimit::f_old_limit [private] |
Referenced by Restore().
bool sswf::Data::DataLimit::f_restored [private] |
Referenced by Restore().