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
|
||||
|
||||
|
||||
Author : $Author: maroy $
|
||||
Version : $Revision: 1.38 $
|
||||
Author : $Author: fgerlits $
|
||||
Version : $Revision: 1.39 $
|
||||
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 >
|
||||
* </code></pre>
|
||||
*
|
||||
* @author $Author: maroy $
|
||||
* @version $Revision: 1.38 $
|
||||
* @author $Author: fgerlits $
|
||||
* @version $Revision: 1.39 $
|
||||
*/
|
||||
class Playlist : public Configurable,
|
||||
public Playable
|
||||
|
@ -269,14 +269,6 @@ class Playlist : public Configurable,
|
|||
/**
|
||||
* 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
|
||||
*/
|
||||
Playlist(const Playlist & otherPlaylist)
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
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 $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -147,15 +147,20 @@ static const std::string xmlNamespaceUri
|
|||
*----------------------------------------------------------------------------*/
|
||||
Playlist :: Playlist(const Playlist & otherPlaylist)
|
||||
throw ()
|
||||
: Playable(PlaylistType)
|
||||
: Playable(PlaylistType),
|
||||
id (otherPlaylist.id),
|
||||
title (otherPlaylist.title),
|
||||
playlength(otherPlaylist.playlength),
|
||||
uri (otherPlaylist.uri),
|
||||
token (otherPlaylist.token)
|
||||
{
|
||||
id = otherPlaylist.id;
|
||||
title = otherPlaylist.title;
|
||||
playlength = otherPlaylist.playlength;
|
||||
uri = otherPlaylist.uri;
|
||||
token = otherPlaylist.token;
|
||||
|
||||
elementList.reset(new PlaylistElementListType(*otherPlaylist.elementList));
|
||||
elementList.reset(new PlaylistElementListType);
|
||||
const_iterator it;
|
||||
for (it = otherPlaylist.begin(); it != otherPlaylist.end(); ++it) {
|
||||
Ptr<PlaylistElement>::Ref otherElement(new PlaylistElement(
|
||||
*it->second ));
|
||||
elementList->insert(std::make_pair(it->first, otherElement));
|
||||
}
|
||||
|
||||
if (otherPlaylist.savedCopy) {
|
||||
savedCopy.reset(new Playlist(*otherPlaylist.savedCopy));
|
||||
|
@ -177,12 +182,11 @@ Playlist :: Playlist(Ptr<UniqueId>::Ref id,
|
|||
Ptr<time_duration>::Ref playlength,
|
||||
Ptr<const std::string>::Ref uri)
|
||||
throw ()
|
||||
: Playable(PlaylistType)
|
||||
: Playable(PlaylistType),
|
||||
id(id),
|
||||
uri(uri)
|
||||
{
|
||||
this->id = id;
|
||||
this->title.reset(new Glib::ustring(""));
|
||||
this->playlength = playlength;
|
||||
this->uri = uri;
|
||||
|
||||
elementList.reset(new PlaylistElementListType);
|
||||
|
||||
|
@ -199,13 +203,10 @@ Playlist :: Playlist(Ptr<UniqueId>::Ref id,
|
|||
Ptr<time_duration>::Ref playlength,
|
||||
Ptr<const std::string>::Ref uri)
|
||||
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);
|
||||
|
||||
setTitle(title);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue