change the copy constructor; now it duplicates playlist elements, instead of just copying the pointers
This commit is contained in:
parent
128f8034b8
commit
533ee75926
2 changed files with 24 additions and 31 deletions
|
@ -21,8 +21,8 @@
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: maroy $
|
Author : $Author: fgerlits $
|
||||||
Version : $Revision: 1.38 $
|
Version : $Revision: 1.39 $
|
||||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/include/LiveSupport/Core/Playlist.h,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/include/LiveSupport/Core/Playlist.h,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -127,8 +127,8 @@ using namespace boost::posix_time;
|
||||||
* <!ATTLIST playlist playlength NMTOKEN #IMPLIED >
|
* <!ATTLIST playlist playlength NMTOKEN #IMPLIED >
|
||||||
* </code></pre>
|
* </code></pre>
|
||||||
*
|
*
|
||||||
* @author $Author: maroy $
|
* @author $Author: fgerlits $
|
||||||
* @version $Revision: 1.38 $
|
* @version $Revision: 1.39 $
|
||||||
*/
|
*/
|
||||||
class Playlist : public Configurable,
|
class Playlist : public Configurable,
|
||||||
public Playable
|
public Playable
|
||||||
|
@ -269,14 +269,6 @@ class Playlist : public Configurable,
|
||||||
/**
|
/**
|
||||||
* Copy constructor.
|
* Copy constructor.
|
||||||
*
|
*
|
||||||
* Copies the <i>pointers</i> for all fields except elementList,
|
|
||||||
* savedCopy and metadata. A new copy of these three are created,
|
|
||||||
* but the playlists and strings contained in elementList and
|
|
||||||
* metadata are not duplicated, only a new pointer to them is created.
|
|
||||||
* The remaining fields are immutable; if you want to modify them,
|
|
||||||
* call the appropriate setter function with (a pointer to) an object
|
|
||||||
* with the new value.
|
|
||||||
*
|
|
||||||
* @param otherPlaylist the playlist to be copied
|
* @param otherPlaylist the playlist to be copied
|
||||||
*/
|
*/
|
||||||
Playlist(const Playlist & otherPlaylist)
|
Playlist(const Playlist & otherPlaylist)
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: fgerlits $
|
Author : $Author: fgerlits $
|
||||||
Version : $Revision: 1.37 $
|
Version : $Revision: 1.38 $
|
||||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/Playlist.cxx,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/Playlist.cxx,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -147,15 +147,20 @@ static const std::string xmlNamespaceUri
|
||||||
*----------------------------------------------------------------------------*/
|
*----------------------------------------------------------------------------*/
|
||||||
Playlist :: Playlist(const Playlist & otherPlaylist)
|
Playlist :: Playlist(const Playlist & otherPlaylist)
|
||||||
throw ()
|
throw ()
|
||||||
: Playable(PlaylistType)
|
: Playable(PlaylistType),
|
||||||
|
id (otherPlaylist.id),
|
||||||
|
title (otherPlaylist.title),
|
||||||
|
playlength(otherPlaylist.playlength),
|
||||||
|
uri (otherPlaylist.uri),
|
||||||
|
token (otherPlaylist.token)
|
||||||
{
|
{
|
||||||
id = otherPlaylist.id;
|
elementList.reset(new PlaylistElementListType);
|
||||||
title = otherPlaylist.title;
|
const_iterator it;
|
||||||
playlength = otherPlaylist.playlength;
|
for (it = otherPlaylist.begin(); it != otherPlaylist.end(); ++it) {
|
||||||
uri = otherPlaylist.uri;
|
Ptr<PlaylistElement>::Ref otherElement(new PlaylistElement(
|
||||||
token = otherPlaylist.token;
|
*it->second ));
|
||||||
|
elementList->insert(std::make_pair(it->first, otherElement));
|
||||||
elementList.reset(new PlaylistElementListType(*otherPlaylist.elementList));
|
}
|
||||||
|
|
||||||
if (otherPlaylist.savedCopy) {
|
if (otherPlaylist.savedCopy) {
|
||||||
savedCopy.reset(new Playlist(*otherPlaylist.savedCopy));
|
savedCopy.reset(new Playlist(*otherPlaylist.savedCopy));
|
||||||
|
@ -177,12 +182,11 @@ Playlist :: Playlist(Ptr<UniqueId>::Ref id,
|
||||||
Ptr<time_duration>::Ref playlength,
|
Ptr<time_duration>::Ref playlength,
|
||||||
Ptr<const std::string>::Ref uri)
|
Ptr<const std::string>::Ref uri)
|
||||||
throw ()
|
throw ()
|
||||||
: Playable(PlaylistType)
|
: Playable(PlaylistType),
|
||||||
|
id(id),
|
||||||
|
uri(uri)
|
||||||
{
|
{
|
||||||
this->id = id;
|
|
||||||
this->title.reset(new Glib::ustring(""));
|
this->title.reset(new Glib::ustring(""));
|
||||||
this->playlength = playlength;
|
|
||||||
this->uri = uri;
|
|
||||||
|
|
||||||
elementList.reset(new PlaylistElementListType);
|
elementList.reset(new PlaylistElementListType);
|
||||||
|
|
||||||
|
@ -199,13 +203,10 @@ Playlist :: Playlist(Ptr<UniqueId>::Ref id,
|
||||||
Ptr<time_duration>::Ref playlength,
|
Ptr<time_duration>::Ref playlength,
|
||||||
Ptr<const std::string>::Ref uri)
|
Ptr<const std::string>::Ref uri)
|
||||||
throw ()
|
throw ()
|
||||||
: Playable(PlaylistType)
|
: Playable(PlaylistType),
|
||||||
|
id(id),
|
||||||
|
uri(uri)
|
||||||
{
|
{
|
||||||
this->id = id;
|
|
||||||
this->title = title;
|
|
||||||
this->playlength = playlength;
|
|
||||||
this->uri = uri;
|
|
||||||
|
|
||||||
elementList.reset(new PlaylistElementListType);
|
elementList.reset(new PlaylistElementListType);
|
||||||
|
|
||||||
setTitle(title);
|
setTitle(title);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue