LiveSupport::Core::Playable Class Reference

#include <Playable.h>

Inheritance diagram for LiveSupport::Core::Playable:

[legend]
List of all members.

Detailed Description

An abstract class which is extended by AudioClip and Playlist.

It contains the methods which are common to these classes.

Author:
Author
fgerlits
Version:
Revision
2329

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.


Member Enumeration Documentation

enum LiveSupport::Core::Playable::Type

The sub-types a Playable object can belong to.

Enumerator:
AudioClipType 
PlaylistType 

Definition at line 85 of file Playable.h.


Constructor & Destructor Documentation

LiveSupport::Core::Playable::Playable ( Type  typeParam  )  throw () [inline, protected]

Only my children are allowed to instantiate me.

Parameters:
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.


Member Function Documentation

Ptr< AudioClip >::Ref Playable::getAudioClip ( void   )  throw ()

Return an audio clip pointer to this object.

If the object’s type is not AudioClipType, returns a zero pointer.

See also:
getType()
Returns:
an audio clip pointer to this object.

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.

Returns:
the unique 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.

Parameters:
key the name of the metadata field
Returns:
the value of the metadata field; 0 if there is no such 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.

Returns:
the playing length in microseconds.

Implemented in LiveSupport::Core::AudioClip, and LiveSupport::Core::Playlist.

Ptr< Playlist >::Ref Playable::getPlaylist ( void   )  throw ()

Return a playlist pointer to this object.

If the object’s type is not PlaylistType, returns a zero pointer.

See also:
getType()
Returns:
a playlist pointer to this object.

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.

Returns:
the title.

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.

Returns:
the token.

Implemented in LiveSupport::Core::AudioClip, and LiveSupport::Core::Playlist.

Type LiveSupport::Core::Playable::getType ( void   )  const throw () [inline]

Return the type of this object.

Returns:
either AudioClipType or PlaylistType.

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.

Returns:
the URI.

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()).

Returns:
a string representation of the audio clip as an XML document

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”.

Returns:
a string representation of the audio clip as an XML element

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.

Parameters:
value the new value of the metadata field.
key the name of the metadata field
Exceptions:
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.

Parameters:
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.

Parameters:
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.

Parameters:
uri the new URI.

Implemented in LiveSupport::Core::AudioClip, and LiveSupport::Core::Playlist.


The documentation for this class was generated from the following files:
Generated on Sat Sep 22 02:00:37 2007 for Campcaster by  1.4.7