changed return values in AudioClip and Playlist from Ptr<std::string>::Ref

and Ptr<Glib::ustring>::Ref to Ptr<const ... >::Ref
finished adding audio clip methods to WebStorageClient
modified helix install script to copy the splay executable to $LS/usr/bin
    (HELIX_LIBS needs to be set to "$LS/usr/lib/helix/" for this to work)
This commit is contained in:
fgerlits 2004-12-29 19:16:33 +00:00
parent 11f46d11ba
commit 562705b031
10 changed files with 388 additions and 101 deletions

View file

@ -22,7 +22,7 @@
Author : $Author: fgerlits $
Version : $Revision: 1.13 $
Version : $Revision: 1.14 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/include/LiveSupport/Core/AudioClip.h,v $
------------------------------------------------------------------------------*/
@ -124,7 +124,7 @@ using namespace boost::posix_time;
* </code></pre>
*
* @author $Author: fgerlits $
* @version $Revision: 1.13 $
* @version $Revision: 1.14 $
*/
class AudioClip : public Configurable,
public Playable
@ -138,32 +138,32 @@ class AudioClip : public Configurable,
/**
* The unique id of the audio clip.
*/
Ptr<UniqueId>::Ref id;
Ptr<UniqueId>::Ref id;
/**
* The title of the audio clip.
*/
Ptr<Glib::ustring>::Ref title;
Ptr<const Glib::ustring>::Ref title;
/**
* The playling length of the audio clip.
*/
Ptr<time_duration>::Ref playlength;
Ptr<time_duration>::Ref playlength;
/**
* The location of the binary audio clip sound file.
*/
Ptr<const std::string>::Ref uri;
Ptr<const std::string>::Ref uri;
/**
* The identifying token returned by the storage server.
*/
Ptr<const std::string>::Ref token;
Ptr<const std::string>::Ref token;
/**
* This audio clip in XML format.
*/
Ptr<xmlpp::Document>::Ref xmlAudioClip;
Ptr<xmlpp::Document>::Ref xmlAudioClip;
public:
@ -196,9 +196,9 @@ class AudioClip : public Configurable,
* @param uri the location of the sound file corresponding to
* this audio clip object (optional)
*/
AudioClip(Ptr<UniqueId>::Ref id,
Ptr<time_duration>::Ref playlength,
Ptr<string>::Ref uri = Ptr<string>::Ref())
AudioClip(Ptr<UniqueId>::Ref id,
Ptr<time_duration>::Ref playlength,
Ptr<const std::string>::Ref uri = Ptr<string>::Ref())
throw ();
/**
@ -210,10 +210,10 @@ class AudioClip : public Configurable,
* @param uri the location of the sound file corresponding to
* this audio clip object (optional)
*/
AudioClip(Ptr<UniqueId>::Ref id,
Ptr<Glib::ustring>::Ref title,
Ptr<time_duration>::Ref playlength,
Ptr<string>::Ref uri = Ptr<string>::Ref())
AudioClip(Ptr<UniqueId>::Ref id,
Ptr<const Glib::ustring>::Ref title,
Ptr<time_duration>::Ref playlength,
Ptr<const std::string>::Ref uri = Ptr<string>::Ref())
throw ();
/**
@ -326,7 +326,7 @@ class AudioClip : public Configurable,
*
* @return the title.
*/
virtual Ptr<Glib::ustring>::Ref
virtual Ptr<const Glib::ustring>::Ref
getTitle(void) const throw ()
{
return title;
@ -338,7 +338,7 @@ class AudioClip : public Configurable,
* @param title a new title.
*/
virtual void
setTitle(Ptr<Glib::ustring>::Ref title)
setTitle(Ptr<const Glib::ustring>::Ref title)
throw ();
/**
@ -361,8 +361,8 @@ class AudioClip : public Configurable,
* @param ns the namespace of the metadata field (optional)
*/
virtual void
setMetadata(Ptr<Glib::ustring>::Ref value, const std::string &key,
const std::string &ns = "")
setMetadata(Ptr<const Glib::ustring>::Ref value,
const std::string &key, const std::string &ns = "")
throw ();
@ -371,6 +371,13 @@ class AudioClip : public Configurable,
* the metadata fields of the audio clip, and it's roughly the
* inverse of the configure() method.
*
* (NOTE: This returns a non-constant pointer to a member of the
* AudioClip object, so handle with care, and do not ever, ever
* modify the Document object returned. It cannot be made const
* because <code>xmlpp::Document::write_to_file()</code> and
* <code>xmlpp::Document::write_to_string()</code> are only defined on
* non-constant instances.)
*
* @return an xmlpp::Document containing the metadata.
*/
Ptr<xmlpp::Document>::Ref

View file

@ -22,7 +22,7 @@
Author : $Author: fgerlits $
Version : $Revision: 1.3 $
Version : $Revision: 1.4 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/include/LiveSupport/Core/Playable.h,v $
------------------------------------------------------------------------------*/
@ -54,7 +54,6 @@
namespace LiveSupport {
namespace Core {
using namespace std;
using namespace boost::posix_time;
/* ================================================================ constants */
@ -70,7 +69,7 @@ using namespace boost::posix_time;
* It contains the methods which are common to these classes.
*
* @author $Author: fgerlits $
* @version $Revision: 1.3 $
* @version $Revision: 1.4 $
*/
class Playable
{
@ -100,7 +99,7 @@ class Playable
*
* @return the URI.
*/
virtual Ptr<const string>::Ref
virtual Ptr<const std::string>::Ref
getUri(void) const throw () = 0;
/**
@ -111,7 +110,7 @@ class Playable
* @param uri the new URI.
*/
virtual void
setUri(Ptr<const string>::Ref uri) throw () = 0;
setUri(Ptr<const std::string>::Ref uri) throw () = 0;
/**
@ -120,7 +119,7 @@ class Playable
*
* @return the token.
*/
virtual Ptr<const string>::Ref
virtual Ptr<const std::string>::Ref
getToken(void) const throw () = 0;
/**
@ -130,7 +129,8 @@ class Playable
* @param token a new token.
*/
virtual void
setToken(Ptr<const string>::Ref token) throw () = 0;
setToken(Ptr<const std::string>::Ref token)
throw () = 0;
/**
@ -138,7 +138,7 @@ class Playable
*
* @return the title.
*/
virtual Ptr<Glib::ustring>::Ref
virtual Ptr<const Glib::ustring>::Ref
getTitle(void) const throw () = 0;
/**
@ -147,7 +147,7 @@ class Playable
* @param title a new title.
*/
virtual void
setTitle(Ptr<Glib::ustring>::Ref title)
setTitle(Ptr<const Glib::ustring>::Ref title)
throw () = 0;
@ -171,8 +171,9 @@ class Playable
* @param ns the namespace of the metadata field (optional)
*/
virtual void
setMetadata(Ptr<Glib::ustring>::Ref value, const std::string &key,
const std::string &ns = "")
setMetadata(Ptr<const Glib::ustring>::Ref value,
const std::string &key,
const std::string &ns = "")
throw () = 0;

View file

@ -22,7 +22,7 @@
Author : $Author: fgerlits $
Version : $Revision: 1.21 $
Version : $Revision: 1.22 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/include/LiveSupport/Core/Playlist.h,v $
------------------------------------------------------------------------------*/
@ -93,7 +93,7 @@ using namespace boost::posix_time;
* </code></pre>
*
* @author $Author: fgerlits $
* @version $Revision: 1.21 $
* @version $Revision: 1.22 $
*/
class Playlist : public Configurable,
public Playable
@ -107,27 +107,27 @@ class Playlist : public Configurable,
/**
* The unique id of the playlist.
*/
Ptr<UniqueId>::Ref id;
Ptr<UniqueId>::Ref id;
/**
* The title of the playlist.
*/
Ptr<Glib::ustring>::Ref title;
Ptr<const Glib::ustring>::Ref title;
/**
* The playling length of the playlist.
*/
Ptr<time_duration>::Ref playlength;
Ptr<time_duration>::Ref playlength;
/**
* The uri of the SMIL file generated from this playlist (if any).
*/
Ptr<const std::string>::Ref uri;
Ptr<const std::string>::Ref uri;
/**
* The token given to this playlist by the storage server.
*/
Ptr<const std::string>::Ref token;
Ptr<const std::string>::Ref token;
/**
* Flag set if playlist is currently playing.
@ -171,7 +171,7 @@ class Playlist : public Configurable,
/**
* The type for storing the metadata.
*/
typedef std::map<const std::string, Ptr<Glib::ustring>::Ref>
typedef std::map<const std::string, Ptr<const Glib::ustring>::Ref>
metadataType;
/**
@ -200,9 +200,9 @@ class Playlist : public Configurable,
* @param uri the location of the SMIL file representing this
* playlist (optional)
*/
Playlist(Ptr<UniqueId>::Ref id,
Ptr<time_duration>::Ref playlength,
Ptr<std::string>::Ref uri = Ptr<std::string>::Ref())
Playlist(Ptr<UniqueId>::Ref id,
Ptr<time_duration>::Ref playlength,
Ptr<const std::string>::Ref uri = Ptr<std::string>::Ref())
throw ()
{
this->id = id;
@ -223,10 +223,10 @@ class Playlist : public Configurable,
* @param uri the location of the SMIL file representing this
* playlist (optional)
*/
Playlist(Ptr<UniqueId>::Ref id,
Ptr<Glib::ustring>::Ref title,
Ptr<time_duration>::Ref playlength,
Ptr<std::string>::Ref uri = Ptr<std::string>::Ref())
Playlist(Ptr<UniqueId>::Ref id,
Ptr<const Glib::ustring>::Ref title,
Ptr<time_duration>::Ref playlength,
Ptr<const std::string>::Ref uri = Ptr<std::string>::Ref())
throw ()
{
this->id = id;
@ -312,7 +312,7 @@ class Playlist : public Configurable,
* @param uri the new URI.
*/
virtual void
setUri(Ptr<const string>::Ref uri) throw ()
setUri(Ptr<const std::string>::Ref uri) throw ()
{
this->uri = uri;
}
@ -323,7 +323,7 @@ class Playlist : public Configurable,
*
* @return the token.
*/
virtual Ptr<const string>::Ref
virtual Ptr<const std::string>::Ref
getToken(void) const throw ()
{
return token;
@ -336,7 +336,8 @@ class Playlist : public Configurable,
* @param token a new token.
*/
virtual void
setToken(Ptr<const string>::Ref token) throw ()
setToken(Ptr<const std::string>::Ref token)
throw ()
{
this->token = token;
}
@ -541,7 +542,7 @@ class Playlist : public Configurable,
*
* @return the title.
*/
virtual Ptr<Glib::ustring>::Ref
virtual Ptr<const Glib::ustring>::Ref
getTitle(void) const throw ()
{
return title;
@ -553,7 +554,7 @@ class Playlist : public Configurable,
* @param title a new title.
*/
virtual void
setTitle(Ptr<Glib::ustring>::Ref title)
setTitle(Ptr<const Glib::ustring>::Ref title)
throw ()
{
this->title = title;
@ -580,8 +581,8 @@ class Playlist : public Configurable,
* @param ns the namespace of the metadata field (optional)
*/
virtual void
setMetadata(Ptr<Glib::ustring>::Ref value, const std::string &key,
const std::string &ns = "")
setMetadata(Ptr<const Glib::ustring>::Ref value,
const std::string &key, const std::string &ns = "")
throw ();

View file

@ -22,7 +22,7 @@
Author : $Author: fgerlits $
Version : $Revision: 1.11 $
Version : $Revision: 1.12 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/AudioClip.cxx,v $
------------------------------------------------------------------------------*/
@ -115,9 +115,9 @@ static const std::string defaultPrefixUri ="http://www.streamonthefly.org/";
/*------------------------------------------------------------------------------
* Test constructor without title.
*----------------------------------------------------------------------------*/
AudioClip :: AudioClip(Ptr<UniqueId>::Ref id,
Ptr<time_duration>::Ref playlength,
Ptr<std::string>::Ref uri)
AudioClip :: AudioClip(Ptr<UniqueId>::Ref id,
Ptr<time_duration>::Ref playlength,
Ptr<const std::string>::Ref uri)
throw ()
{
this->id = id;
@ -125,7 +125,7 @@ AudioClip :: AudioClip(Ptr<UniqueId>::Ref id,
this->playlength = playlength;
this->uri = uri;
Ptr<Glib::ustring>::Ref playlengthString(new Glib::ustring(
Ptr<const Glib::ustring>::Ref playlengthString(new const Glib::ustring(
to_simple_string(*playlength) ));
setMetadata(playlengthString, extentElementName, extentElementPrefix);
}
@ -133,10 +133,10 @@ AudioClip :: AudioClip(Ptr<UniqueId>::Ref id,
/*------------------------------------------------------------------------------
* Test constructor with title.
*----------------------------------------------------------------------------*/
AudioClip :: AudioClip(Ptr<UniqueId>::Ref id,
Ptr<Glib::ustring>::Ref title,
Ptr<time_duration>::Ref playlength,
Ptr<std::string>::Ref uri)
AudioClip :: AudioClip(Ptr<UniqueId>::Ref id,
Ptr<const Glib::ustring>::Ref title,
Ptr<time_duration>::Ref playlength,
Ptr<const std::string>::Ref uri)
throw ()
{
this->id = id;
@ -144,7 +144,7 @@ AudioClip :: AudioClip(Ptr<UniqueId>::Ref id,
this->playlength = playlength;
this->uri = uri;
Ptr<Glib::ustring>::Ref playlengthString(new Glib::ustring(
Ptr<const Glib::ustring>::Ref playlengthString(new const Glib::ustring(
to_simple_string(*playlength) ));
setMetadata(playlengthString, extentElementName, extentElementPrefix);
@ -156,7 +156,7 @@ AudioClip :: AudioClip(Ptr<UniqueId>::Ref id,
* Set the value of the title field.
*----------------------------------------------------------------------------*/
void
AudioClip :: setTitle(Ptr<Glib::ustring>::Ref title)
AudioClip :: setTitle(Ptr<const Glib::ustring>::Ref title)
throw ()
{
this->title = title;
@ -243,7 +243,8 @@ AudioClip :: configure(const xmlpp::Element & element)
&& dataElement->has_child_text()) {
Glib::ustring value = dataElement->get_child_text()
->get_content();
Ptr<Glib::ustring>::Ref ptrToValue(new Glib::ustring(value));
Ptr<const Glib::ustring>::Ref ptrToValue(
new const Glib::ustring(value));
title = ptrToValue;
}
@ -267,7 +268,7 @@ AudioClip :: configure(const xmlpp::Element & element)
throw std::invalid_argument(eMsg);
}
Ptr<Glib::ustring>::Ref playlengthString(new Glib::ustring(
Ptr<const Glib::ustring>::Ref playlengthString(new const Glib::ustring(
to_simple_string(*playlength) ));
setMetadata(playlengthString, extentElementName, extentElementPrefix);
}
@ -317,8 +318,9 @@ AudioClip :: getMetadata(const string &key, const std::string &ns) const
* Set the value of a metadata field.
*----------------------------------------------------------------------------*/
void
AudioClip :: setMetadata(Ptr<Glib::ustring>::Ref value, const std::string &key,
const std::string &ns)
AudioClip :: setMetadata(Ptr<const Glib::ustring>::Ref value,
const std::string &key,
const std::string &ns)
throw ()
{
if (ns == extentElementPrefix && key == extentElementName) {

View file

@ -22,7 +22,7 @@
Author : $Author: fgerlits $
Version : $Revision: 1.4 $
Version : $Revision: 1.5 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/AudioClipTest.cxx,v $
------------------------------------------------------------------------------*/
@ -109,16 +109,16 @@ AudioClipTest :: firstTest(void)
CPPUNIT_ASSERT(duration->minutes() == 18);
CPPUNIT_ASSERT(duration->seconds() == 30);
Ptr<Glib::ustring>::Ref title = audioClip->getTitle();
Ptr<const Glib::ustring>::Ref title = audioClip->getTitle();
CPPUNIT_ASSERT(title);
CPPUNIT_ASSERT(*title == "File Title txt");
Ptr<Glib::ustring>::Ref subject = audioClip
Ptr<const Glib::ustring>::Ref subject = audioClip
->getMetadata("subject", "dc");
CPPUNIT_ASSERT(subject);
CPPUNIT_ASSERT(*subject == "Keywords: qwe, asd, zcx");
Ptr<Glib::ustring>::Ref alternativeTitle = audioClip
Ptr<const Glib::ustring>::Ref alternativeTitle = audioClip
->getMetadata("alternative", "dcterms");
CPPUNIT_ASSERT(alternativeTitle);
CPPUNIT_ASSERT(*alternativeTitle ==

View file

@ -22,7 +22,7 @@
Author : $Author: fgerlits $
Version : $Revision: 1.17 $
Version : $Revision: 1.18 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/Playlist.cxx,v $
------------------------------------------------------------------------------*/
@ -376,7 +376,8 @@ Playlist :: getMetadata(const string &key, const string &ns) const
metadataType::const_iterator it = metadata.find(completeKey);
if (it != metadata.end()) {
return it->second;
Ptr<Glib::ustring>::Ref data(new Glib::ustring(*it->second));
return data;
}
else {
Ptr<Glib::ustring>::Ref nullPointer;
@ -389,8 +390,8 @@ Playlist :: getMetadata(const string &key, const string &ns) const
* Set the value of a metadata field.
*----------------------------------------------------------------------------*/
void
Playlist :: setMetadata(Ptr<Glib::ustring>::Ref value, const string &key,
const string &ns)
Playlist :: setMetadata(Ptr<const Glib::ustring>::Ref value,
const string &key, const string &ns)
throw ()
{
std::string completeKey = key + ns;