#include <sequenceeditorguiclipboard.h>
Public Member Functions | |
Clipboard (const rttr::type &trackType) | |
virtual | ~Clipboard ()=default |
void | addObject (const rtti::Object *object, const std::string &sequenceName, utility::ErrorState &errorState) |
void | addObject (const rtti::Object *object, utility::ErrorState &errorState) |
template<typename T > | |
std::vector< T * > | deserialize (std::vector< std::unique_ptr< rtti::Object >> &createdObjects, utility::ErrorState &errorState) |
template<typename T > | |
bool | isClipboard () |
template<typename T > | |
T * | getDerived () |
std::vector< std::string > | getObjectIDs () const |
bool | containsObject (const std::string &objectID, const std::string &sequenceName) const |
void | removeObject (const std::string &objectID) |
int | getObjectCount () const |
rttr::type | getTrackType () const |
bool | save (const std::string &filePath, utility::ErrorState &errorState) |
bool | load (const std::string &filePath, utility::ErrorState &errorState) |
Protected Attributes | |
std::map< std::string, std::string > | mSerializedObjects |
rttr::type | mTrackType |
std::string | mSequenceName |
Clipboard is a class that can contain a serialized object related to the Sequencer The state of the gui can contain a clipboard, that can be de-serialized at a certain point Typically, the clipboard contains a certain curve segment or event segment, and that segment can be pasted at a certain location in a certain Track
|
explicit |
Constructor
trackType | expects tracktype |
|
virtualdefault |
Default decontructor
void addObject | ( | const rtti::Object * | object, |
const std::string & | sequenceName, | ||
utility::ErrorState & | errorState | ||
) |
Serialize an object
object | pointer object to serialize |
sequenceName | sequence name currently used, if sequence name is different from previous, clears previously added objects |
errorState | holds information about any errors |
void addObject | ( | const rtti::Object * | object, |
utility::ErrorState & | errorState | ||
) |
Serialize an object
object | pointer object to serialize |
errorState | holds information about any errors |
bool containsObject | ( | const std::string & | objectID, |
const std::string & | sequenceName | ||
) | const |
returns true when clipboard holds serialized object of specified id
objectID | the object id of serialized object |
sequenceName | name of the sequence |
std::vector< T * > deserialize | ( | std::vector< std::unique_ptr< rtti::Object >> & | createdObjects, |
utility::ErrorState & | errorState | ||
) |
Deserialize clipboard content to object of type T
T | the object type to deserialze |
createdObjects | vector containing created objects |
errorState | holds information about any errors |
T* getDerived | ( | ) |
returns raw pointer to derived class T of this clipboard performs static cast, exception on fail, always use isClipboard<T> to check for type
T | the derived type |
int getObjectCount | ( | ) | const |
returns amount of stored serialized objects
std::vector<std::string> getObjectIDs | ( | ) | const |
returns object ids of serialized objects
rttr::type getTrackType | ( | ) | const |
returns rtti track type info that was passed to clipboard upon construction
bool isClipboard | ( | ) |
returns true when clipboard is clipboard of derived type T
T | the derived type |
bool load | ( | const std::string & | filePath, |
utility::ErrorState & | errorState | ||
) |
Loads serialized segments to clipboard, return true on success, errorState contains any errors
filePath | path of file to load relative to application data folder |
errorState | contains any errors that may occur during this operation |
void removeObject | ( | const std::string & | objectID | ) |
removes specified object from clipboard when it is contained, no assert when not present
objectID | the object id of the object to remove |
bool save | ( | const std::string & | filePath, |
utility::ErrorState & | errorState | ||
) |
Writes current serialized segments to disk, return true on success, errorState contains any errors FilePath is relative to application data folder
filePath | path of file to write relative to application data folder |
errorState | contains any errors that may occur during this operation |
|
protected |
|
protected |
|
protected |