tbx
0.7.6
|
Helper class to implement the loader interface and call a routine once all the bytes have been loaded with the bytes loaded at the end of the processing. More...
#include <memoryloader.h>
Public Member Functions | |
MemoryLoader (bool show_error=false, const char *error_title=0) | |
Construct the memory loader object. More... | |
virtual bool | load_file (LoadEvent &event) |
Overriden from Loader to load the file and pass the bytes loaded to the data_loaded function. More... | |
virtual void * | data_buffer (const LoadEvent &event, int &buffer_size) |
Set up buffer for application to application data transfer. More... | |
virtual bool | data_received (DataReceivedEvent &event) |
Overriden from Loader to populate the internal data buffer from the transfer. More... | |
virtual void | data_error (const LoadEvent &event) |
Informs loader that an error occurred during application to application data transfer. More... | |
virtual void | data_exception (const LoadEvent &event, std::exception &except) |
Informs loader an exception occurred during the loading process. More... | |
virtual void | data_loaded (const LoadEvent &event, char *data, int data_size, bool &claim_data)=0 |
Called when all the data has been loaded this method is called with a character array of the data recieved. More... | |
![]() | |
virtual bool | accept_file (LoadEvent &event) |
Override to see if the loader can accept a file. More... | |
Helper class to implement the loader interface and call a routine once all the bytes have been loaded with the bytes loaded at the end of the processing.
Add the loader to the object you wish to handle the load and override the data_loaded method to process the bytes loaded.
tbx::MemoryLoader::MemoryLoader | ( | bool | show_error = false , |
const char * | error_title = 0 |
||
) |
Construct the memory loader object.
show_error | true to show a message box on error (default false) |
error_title | Title to show if an error is reported ("" or 0 for the default title) |
|
virtual |
Set up buffer for application to application data transfer.
This method is overriden from the Loader class to create an internal buffer which will be filled and then passed to the data_loaded method.
event | LoadEvent that started the data transfer |
buffer_size | size of the buffer returned (defaults to event.estimated_size()) |
Reimplemented from tbx::Loader.
|
virtual |
Informs loader that an error occurred during application to application data transfer.
overrided to show a message if show_error was set in the constructor override for alternate processing
event | load event that started the transfer |
Reimplemented from tbx::Loader.
|
virtual |
Informs loader an exception occurred during the loading process.
If not overriden it will show an error box if show_error was set in the constructor or call data_error if not.
event | load event that started the transfer |
except | exception that occurred. |
|
pure virtual |
Called when all the data has been loaded this method is called with a character array of the data recieved.
data | bytes loaded. |
data_size | number of bytes in the buffer; |
claim_data | set to true to claim the data buffer. If claim_data is true, delete the claimed buffer with delete [] when it's finished with. |
|
virtual |
Overriden from Loader to populate the internal data buffer from the transfer.
Once all data is received the data_loaded method will be called.
event | Details of buffer received |
Reimplemented from tbx::Loader.
|
virtual |
Overriden from Loader to load the file and pass the bytes loaded to the data_loaded function.
The file name for the load is in event.file_name().
Implements tbx::Loader.