#include <cel_storage.h>
Public Member Functions | |
| StorageRewinder (Storage *inStorage) | |
| StorageRewinder () | |
| void | setStorage (Storage *inStorage) |
| void | rewind () |
| void | releaseStorage () |
| ~StorageRewinder () | |
void someFunction(Storage *inStorage) { // rewinder remember the current storage pointer position StorageRewinder rewinder(inStorage); u8 someBuffer[256]; inStorage->readBytes(someBuffer, 256); if(!some_validation_function(someBuffer, 256)) { // StorageRewinder automatically rewinds the storage // even if you are canceling the process by some // exception. throw someError; } // some process... do_something(...); // StorageRewinder also works on the end of the function. }
Definition at line 259 of file cel_storage.h.
| Celartem::StorageRewinder::StorageRewinder | ( | Storage * | inStorage | ) | [inline] |
This constructor creates the StorageRewinder on the specified storage. The instance memorizes the current storage position of the storage.
| inStorage | A storage on which the StorageRewinder is built on. |
Definition at line 270 of file cel_storage.h.
| Celartem::StorageRewinder::StorageRewinder | ( | ) | [inline] |
This constructor creates the StorageRewinder that does not hold any storage. This version of constructor is usually used with setStorage method.
Definition at line 281 of file cel_storage.h.
| Celartem::StorageRewinder::~StorageRewinder | ( | ) | [inline] |
This method rewinds the storage to the initial position and delete the StorageRewinder instance.
Definition at line 323 of file cel_storage.h.
| void Celartem::StorageRewinder::setStorage | ( | Storage * | inStorage | ) | [inline] |
This method associates the specified storage instance to this StorageRewinder instance. Please note that the previous one is not to be rewound but only released.
| inStorage | A storage on which the StorageRewinder is built on. |
Definition at line 293 of file cel_storage.h.
| void Celartem::StorageRewinder::rewind | ( | ) | [inline] |
This method rewinds the storage to the initial position.
Definition at line 303 of file cel_storage.h.
Referenced by ~StorageRewinder().
| void Celartem::StorageRewinder::releaseStorage | ( | ) | [inline] |
This method releases the storage instance that is held by this instance. Please note that this method does not rewind the storage.
Definition at line 314 of file cel_storage.h.
Referenced by setStorage().