tbx
0.7.6
|
Class to give the same interface to saving to an external application as the SaveAs dialogue. More...
#include <saver.h>
Public Member Functions | |
Saver () | |
Constructor for an uninitialised save operation. | |
Saver (const Saver &other) | |
Constructor from another Saver. More... | |
Saver & | operator= (const Saver &other) |
Assign this saver from another. More... | |
bool | operator== (const Saver &other) const |
Check if two savers are the same underlying save operation. More... | |
bool | operator!= (const Saver &other) const |
Check if two savers are not the same underlying save operation. More... | |
void | save (const PointerInfo &where, const std::string &leaf_name, int file_type, int file_size) |
Start the save. More... | |
void | save_for_data_request (const WimpMessage &data_req, const std::string &leaf_name, int file_type, int file_size) |
Start save in response to a DataRequest message. More... | |
std::string | leaf_name () const |
Get the proposed leaf name for the file to be saved. | |
int | file_type () const |
Get the file type from the save. | |
int | file_size () const |
Get the file size from the SaveAs object. | |
bool | safe () const |
Check if the save is to a safe locations. More... | |
void | buffer_filled (void *buffer, int size) |
Call in a RAM transfer when another buffer has been made available. More... | |
void | file_save_completed (bool successful, std::string file_name) |
Call this after saving a file in the SaveAsSaveToFileListener. More... | |
void | set_finished_handler (SaverFinishedHandler *handler) |
Handler called when the save operation has completed. More... | |
void | set_save_completed_handler (SaverSaveCompletedHandler *handler) |
Handler called if the save completed successfully. More... | |
void | set_save_to_file_handler (SaverSaveToFileHandler *handler) |
Handler called to save to a file. More... | |
void | set_fill_buffer_handler (SaverFillBufferHandler *handler) |
Handler called to fill the buffers for a RAM transfer. More... | |
Friends | |
class | SaverImpl |
Class to give the same interface to saving to an external application as the SaveAs dialogue.
This allows a convenient interface to save to another application or the filer.
To use, set the handlers and then call the save method.
The Saver class is just a reference to the actual save so does not have to be kept after the save has started.
tbx::Saver::Saver | ( | const Saver & | other | ) |
void tbx::Saver::buffer_filled | ( | void * | buffer, |
int | size | ||
) |
Call in a RAM transfer when another buffer has been made available.
buffer | new buffer to transfer |
size | size of data in the buffer |
void tbx::Saver::file_save_completed | ( | bool | successful, |
std::string | file_name | ||
) |
Call this after saving a file in the SaveAsSaveToFileListener.
successful | set to true if save was successful |
file_name | actual file name client saved to. |
|
inline |
Check if two savers are not the same underlying save operation.
other | Saver to compare with |
Assign this saver from another.
The assignment shares a reference counted internal representation of the save operations
other | Saver to share save implementation with. |
|
inline |
Check if two savers are the same underlying save operation.
other | Saver to compare with |
|
inline |
Check if the save is to a safe locations.
This is set before the save to file handler is called.
void tbx::Saver::save | ( | const PointerInfo & | where, |
const std::string & | leaf_name, | ||
int | file_type, | ||
int | file_size | ||
) |
Start the save.
where | Location to save to |
leaf_name | leaf_name of the file to save |
file_type | file type for the saved file |
file_size | estimated file size for the saved file |
your_ref | reference from other application when saving from a data request or equivalent (0 for no ref) |
void tbx::Saver::save_for_data_request | ( | const WimpMessage & | data_req, |
const std::string & | leaf_name, | ||
int | file_type, | ||
int | file_size | ||
) |
Start save in response to a DataRequest message.
leaf_name | leaf_name of the file to save |
file_type | file type for the saved file |
file_size | estimated file size for the saved file |
|
inline |
Handler called to fill the buffers for a RAM transfer.
handler | object to call to fill a buffer |
|
inline |
Handler called when the save operation has completed.
handler | object to call when save has finished |
|
inline |
Handler called if the save completed successfully.
handler | object to call if save completed successfully |
|
inline |
Handler called to save to a file.
handler | object to call to save the file |