tbx
0.7.5
|
Class to handle file/data loading from the filer or an external application. More...
#include <loader.h>
Public Member Functions | |
virtual bool | load_file (LoadEvent &event)=0 |
Override to do the actual file load. More... | |
virtual bool | accept_file (LoadEvent &event) |
Override to see if the loader can accept a file. 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) |
Override to receive the file by in memory transfer from another application. More... | |
virtual void | data_error (const LoadEvent &event) |
Informs loader that an error occurred during application to application data transfer. More... | |
Class to handle file/data loading from the filer or an external application.
Add the loader to the object you wish to handle the load and override the load_file method to load the file.
|
inlinevirtual |
Override to see if the loader can accept a file.
Defaults to return true as in normal circumstances the file type is all that is important and that will be specified when adding the loader.
|
inlinevirtual |
Set up buffer for application to application data transfer.
Called after a file has been accepted so the loader can create a buffer for the transfer or point to the location to load to.
Return 0 (as the default does) if application to application data transfer is not supported.
event | LoadEvent that started the data transfer |
buffer_size | size of the buffer returned (defaults to event.estimated_size()) |
|
inlinevirtual |
Informs loader that an error occurred during application to application data transfer.
event | load event that started the transfer |
|
inlinevirtual |
Override to receive the file by in memory transfer from another application.
This routine may be called multiple times until all the data is transferred.
It is possible for the last packet transferred to contain zero bytes if the penultimate call filled the buffer exactly.
The DataReceivedEvent contains details of where the data was copied and the number of bytes received. The more method returns false when there is no more data to receive.
By default this returns false as a loader can support transfer by file only.
event | Details of buffer received |
|
pure virtual |
Override to do the actual file load.
The file name for the load is in event.file_name().