#include <Playable.h>
Inheritance diagram for LiveSupport::Core::Playable:
It contains the methods which are common to these classes.
Definition at line 78 of file Playable.h.
Public Types | |
AudioClipType | |
PlaylistType | |
enum | Type { AudioClipType, PlaylistType } |
The sub-types a Playable object can belong to. More… | |
Public Member Functions | |
virtual | ~Playable (void) throw () |
A virtual destructor, as this class has virtual functions. | |
virtual Ptr< UniqueId >::Ref | getId (void) const =0 throw () |
Return the id of the audio clip or playlist. | |
virtual Ptr< time_duration >::Ref | getPlaylength (void) const =0 throw () |
Return the total playing length for this audio clip or playlist. | |
virtual Ptr< const std::string >::Ref | getUri (void) const =0 throw () |
Return the URI of the sound file of this audio clip or playlist, which can be played by the audio player. | |
virtual void | setUri (Ptr< const std::string >::Ref uri)=0 throw () |
Set the URI of the sound file of this audio clip or playlist, which can be played by the audio player. | |
virtual Ptr< const std::string >::Ref | getToken (void) const =0 throw () |
Return the token which is used to identify this audio clip or playlist to the storage server. | |
virtual void | setToken (Ptr< const std::string >::Ref token)=0 throw () |
Set the token which is used to identify this audio clip or playlist to the storage server. | |
virtual Ptr< const Glib::ustring >::Ref | getTitle (void) const =0 throw () |
Return the title of this audio clip or playlist. | |
virtual void | setTitle (Ptr< const Glib::ustring >::Ref title)=0 throw () |
Set the title of this audio clip or playlist. | |
virtual Ptr< Glib::ustring >::Ref | getMetadata (const std::string &key) const =0 throw () |
Return the value of a metadata field in this audio clip or playlist. | |
virtual void | setMetadata (Ptr< const Glib::ustring >::Ref value, const std::string &key)=0 throw (std::invalid_argument) |
Set the value of a metadata field in this audio clip or playlist. | |
virtual Ptr< Glib::ustring >::Ref | getXmlElementString (void) const =0 throw () |
Return a partial XML representation of this audio clip or playlist. | |
virtual Ptr< Glib::ustring >::Ref | getXmlDocumentString (void) const =0 throw () |
Return a complete XML representation of this audio clip or playlist. | |
Type | getType (void) const throw () |
Return the type of this object. | |
Ptr< AudioClip >::Ref | getAudioClip (void) throw () |
Return an audio clip pointer to this object. | |
Ptr< Playlist >::Ref | getPlaylist (void) throw () |
Return a playlist pointer to this object. | |
Protected Member Functions | |
Playable (Type typeParam) throw () | |
Only my children are allowed to instantiate me. |
LiveSupport::Core::Playable::Playable | ( | Type | typeParam | ) | throw () [inline, protected] |
Only my children are allowed to instantiate me.
typeParam | either AudioClipType or PlaylistType. |
Definition at line 101 of file Playable.h.
virtual LiveSupport::Core::Playable::~Playable | ( | void | ) | throw () [inline, virtual] |
A virtual destructor, as this class has virtual functions.
Definition at line 113 of file Playable.h.
Return an audio clip pointer to this object.
If the object’s type is not AudioClipType, returns a zero pointer.
Definition at line 54 of file Playable.cxx.
References AudioClipType.
virtual Ptr<UniqueId>::Ref LiveSupport::Core::Playable::getId | ( | void | ) | const throw () [pure virtual] |
Return the id of the audio clip or playlist.
Implemented in LiveSupport::Core::AudioClip, and LiveSupport::Core::Playlist.
virtual Ptr<Glib::ustring>::Ref LiveSupport::Core::Playable::getMetadata | ( | const std::string & | key | ) | const throw () [pure virtual] |
Return the value of a metadata field in this audio clip or playlist.
If the playable does not have this metadata field, returns a null pointer.
key | the name of the metadata field |
Implemented in LiveSupport::Core::AudioClip, and LiveSupport::Core::Playlist.
virtual Ptr<time_duration>::Ref LiveSupport::Core::Playable::getPlaylength | ( | void | ) | const throw () [pure virtual] |
Return the total playing length for this audio clip or playlist.
Implemented in LiveSupport::Core::AudioClip, and LiveSupport::Core::Playlist.
Return a playlist pointer to this object.
If the object’s type is not PlaylistType, returns a zero pointer.
Definition at line 69 of file Playable.cxx.
References PlaylistType.
virtual Ptr<const Glib::ustring>::Ref LiveSupport::Core::Playable::getTitle | ( | void | ) | const throw () [pure virtual] |
Return the title of this audio clip or playlist.
Implemented in LiveSupport::Core::AudioClip, and LiveSupport::Core::Playlist.
virtual Ptr<const std::string>::Ref LiveSupport::Core::Playable::getToken | ( | void | ) | const throw () [pure virtual] |
Return the token which is used to identify this audio clip or playlist to the storage server.
The token is set when the Playable object is acquired and unset (made null again) when it is released.
Implemented in LiveSupport::Core::AudioClip, and LiveSupport::Core::Playlist.
Type LiveSupport::Core::Playable::getType | ( | void | ) | const throw () [inline] |
Return the type of this object.
Definition at line 279 of file Playable.h.
virtual Ptr<const std::string>::Ref LiveSupport::Core::Playable::getUri | ( | void | ) | const throw () [pure virtual] |
Return the URI of the sound file of this audio clip or playlist, which can be played by the audio player.
This sound file can be an mp3 or a SMIL file.
Implemented in LiveSupport::Core::AudioClip, and LiveSupport::Core::Playlist.
virtual Ptr<Glib::ustring>::Ref LiveSupport::Core::Playable::getXmlDocumentString | ( | void | ) | const throw () [pure virtual] |
Return a complete XML representation of this audio clip or playlist.
This is a string containing a an XML document with an <audioClip> or <playlist> root node, together with an XML header and a <metadata> element (in the case of playlists, for the outermost playlist only).
The encoding is UTF-8. IDs are 16-digit hexadecimal numbers, time durations have the format “hh:mm:ss.ssssss”.
The audio clip or playlist can be reconstructed from the string returned by this method:
Ptr<AudioClip>::Ref audioClip1 = ... something ...;
Ptr<xmlpp::DomParser>::Ref parser;
parser->parse_memory(*audioClip1->getXmlDocumentString());
const xmlpp::Document* document = parser->get_document();
const xmlpp::Element* root = document->get_root_node();
Ptr<AudioClip>::Ref audioClip2(new AudioClip());
audioClip2->configure(*root);
results in two identical audio clips (this works for playlists, too, but see the note at Playlist::getXmlDocumentString()).
Implemented in LiveSupport::Core::AudioClip, and LiveSupport::Core::Playlist.
virtual Ptr<Glib::ustring>::Ref LiveSupport::Core::Playable::getXmlElementString | ( | void | ) | const throw () [pure virtual] |
Return a partial XML representation of this audio clip or playlist.
This is a string containing a single <audioClip> or <playlist> XML element, with minimal information (ID, title, playlength) only, without an XML header or any other metadata.
The encoding is UTF-8. IDs are 16-digit hexadecimal numbers, time durations have the format “hh:mm:ss.ssssss”.
Implemented in LiveSupport::Core::AudioClip, and LiveSupport::Core::Playlist.
virtual void LiveSupport::Core::Playable::setMetadata | ( | Ptr< const Glib::ustring >::Ref | value, | |
const std::string & | key | |||
) | throw (std::invalid_argument) [pure virtual] |
Set the value of a metadata field in this audio clip or playlist.
value | the new value of the metadata field. | |
key | the name of the metadata field |
std::invalid_argument | if the key is dcterms:extent, but the value is not a valid ISO-8601 time |
Implemented in LiveSupport::Core::AudioClip, and LiveSupport::Core::Playlist.
virtual void LiveSupport::Core::Playable::setTitle | ( | Ptr< const Glib::ustring >::Ref | title | ) | throw () [pure virtual] |
Set the title of this audio clip or playlist.
title | a new title. |
Implemented in LiveSupport::Core::AudioClip, and LiveSupport::Core::Playlist.
virtual void LiveSupport::Core::Playable::setToken | ( | Ptr< const std::string >::Ref | token | ) | throw () [pure virtual] |
Set the token which is used to identify this audio clip or playlist to the storage server.
The token is set when the Playable object is acquired and unset (made null again) when it is released.
token | a new token. |
Implemented in LiveSupport::Core::AudioClip, and LiveSupport::Core::Playlist.
virtual void LiveSupport::Core::Playable::setUri | ( | Ptr< const std::string >::Ref | uri | ) | throw () [pure virtual] |
Set the URI of the sound file of this audio clip or playlist, which can be played by the audio player.
This sound file can be an mp3 or a SMIL file.
uri | the new URI. |
Implemented in LiveSupport::Core::AudioClip, and LiveSupport::Core::Playlist.