tbx  0.7.3
Classes | Public Member Functions | Friends | List of all members
tbx::Saver Class Reference

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...
 
Saveroperator= (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 &file_name, int file_type, int file_size)
 Start the save. 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
 

Detailed Description

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.

Constructor & Destructor Documentation

tbx::Saver::Saver ( const Saver other)

Constructor from another Saver.

This constructer shares a reference counted internal representation of the save operations

Parameters
otherSaver to share save implementation with.

Member Function Documentation

void tbx::Saver::buffer_filled ( void *  buffer,
int  size 
)

Call in a RAM transfer when another buffer has been made available.

Parameters
buffernew buffer to transfer
sizesize 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.

Parameters
successfulset to true if save was successful
file_nameactual file name client saved to.
bool tbx::Saver::operator!= ( const Saver other) const
inline

Check if two savers are not the same underlying save operation.

Parameters
otherSaver to compare with
Returns
true if they are not the same save operation
Saver & tbx::Saver::operator= ( const Saver other)

Assign this saver from another.

The assignment shares a reference counted internal representation of the save operations

Parameters
otherSaver to share save implementation with.
bool tbx::Saver::operator== ( const Saver other) const
inline

Check if two savers are the same underlying save operation.

Parameters
otherSaver to compare with
Returns
true if they are the same save operation
bool tbx::Saver::safe ( ) const
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.

Parameters
whereLocation to save to
leaf_nameleaf_name of the file to save
file_typefile type for the saved file
file_sizeestimated file size for the saved file
void tbx::Saver::set_fill_buffer_handler ( SaverFillBufferHandler handler)
inline

Handler called to fill the buffers for a RAM transfer.

Parameters
handlerobject to call to fill a buffer
void tbx::Saver::set_finished_handler ( SaverFinishedHandler handler)
inline

Handler called when the save operation has completed.

Parameters
handlerobject to call when save has finished
void tbx::Saver::set_save_completed_handler ( SaverSaveCompletedHandler handler)
inline

Handler called if the save completed successfully.

Parameters
handlerobject to call if save completed successfully
void tbx::Saver::set_save_to_file_handler ( SaverSaveToFileHandler handler)
inline

Handler called to save to a file.

Parameters
handlerobject to call to save the file

The documentation for this class was generated from the following files: