smf/smfservermodule/smfclient/common/smfartists.cpp
changeset 7 be09cf1f39dd
equal deleted inserted replaced
6:c39a6cfd1fb9 7:be09cf1f39dd
       
     1 /**
       
     2  * Copyright (c) 2010 Sasken Communication Technologies Ltd.
       
     3  * All rights reserved.
       
     4  * This component and the accompanying materials are made available
       
     5  * under the terms of the "Eclipse Public License v1.0" 
       
     6  * which accompanies  this distribution, and is available
       
     7  * at the URL "http://www.eclipse.org/legal/epl-v10.html"
       
     8  *
       
     9  * Initial Contributors:
       
    10  * Chandradeep Gandhi, Sasken Communication Technologies Ltd - Initial contribution
       
    11  *
       
    12  * Contributors:
       
    13  * Manasij Roy, Nalina Hariharan
       
    14  * 
       
    15  * Description:
       
    16  * The SmfArtists class represents the artists in a track or an album
       
    17  *
       
    18  */
       
    19 
       
    20 #include <smfartists.h>
       
    21 #include <smfartists_p.h>
       
    22 
       
    23 /**
       
    24  * Constructor with default argument
       
    25  */
       
    26 SmfArtists::SmfArtists( )
       
    27 	{
       
    28 	d = new SmfArtistsPrivate;
       
    29 	}
       
    30 
       
    31 /**
       
    32  * Copy Constructor
       
    33  * @param aOther The reference object
       
    34  */
       
    35 SmfArtists::SmfArtists( const SmfArtists &aOther )
       
    36 	:d( aOther.d )
       
    37 	{
       
    38 	}
       
    39 
       
    40 /**
       
    41  * Overloaded = operator
       
    42  * @param aOther The reference object
       
    43  * @return The target reference value
       
    44  */
       
    45 SmfArtists& SmfArtists::operator=( const SmfArtists &aOther )
       
    46 	{
       
    47 	d->m_names = aOther.d->m_names;
       
    48 	d->m_image = aOther.d->m_image;
       
    49 	d->m_url = aOther.d->m_url;
       
    50 	return *this;
       
    51 	}
       
    52 
       
    53 /**
       
    54  * Destructor
       
    55  */
       
    56 SmfArtists::~SmfArtists( )
       
    57 	{
       
    58 	}
       
    59 
       
    60 /**
       
    61  * Method to get the artists names
       
    62  * @return The list of artists
       
    63  */
       
    64 QStringList SmfArtists::names( ) const
       
    65 	{
       
    66 	return d->m_names;
       
    67 	}
       
    68 
       
    69 /**
       
    70  * Method to get the image of the artists
       
    71  * @return The image of te artists
       
    72  */
       
    73 QImage SmfArtists::image( ) const
       
    74 	{
       
    75 	return d->m_image;
       
    76 	}
       
    77 
       
    78 /**
       
    79  * Method to get the url of the artists
       
    80  * @return The url of the artists
       
    81  */
       
    82 QUrl SmfArtists::url( ) const
       
    83 	{
       
    84 	return d->m_url;
       
    85 	}
       
    86 
       
    87 /**
       
    88  * Method to set the artists names
       
    89  * @param aList The list of artists names
       
    90  */
       
    91 void SmfArtists::setNames( const QStringList &aList )
       
    92 	{
       
    93 	d->m_names = aList;
       
    94 	}
       
    95 
       
    96 /**
       
    97  * Method to set the image of the artists
       
    98  * @param aImage The image of the artists
       
    99  */
       
   100 void SmfArtists::setImage( const QImage &aImage )
       
   101 	{
       
   102 	d->m_image = aImage;
       
   103 	}
       
   104 
       
   105 /**
       
   106  * Method to set the url of the artists
       
   107  * @param aUrl The url of the artists
       
   108  */
       
   109 void SmfArtists::setUrl( const QUrl &aUrl )
       
   110 	{
       
   111 	d->m_url = aUrl;
       
   112 	}
       
   113 	
       
   114 /**
       
   115  * Method for Externalization. Writes the SmfArtists object to 
       
   116  * the stream and returns a reference to the stream.
       
   117  * @param aDataStream Stream to be written
       
   118  * @param aArtists The SmfArtists object to be externalized
       
   119  * @return reference to the written stream
       
   120  */
       
   121  QDataStream &operator<<( QDataStream &aDataStream, 
       
   122 		const SmfArtists &aArtists )
       
   123 	{
       
   124 	// Serialize d->m_image
       
   125 	aDataStream<<aArtists.d->m_image;
       
   126 	
       
   127 	// Serialize d->m_names
       
   128 	aDataStream<<aArtists.d->m_names;
       
   129 	
       
   130 	// Serialize d->m_url
       
   131 	aDataStream<<aArtists.d->m_url;
       
   132 	
       
   133 	return aDataStream;
       
   134 	}
       
   135 
       
   136 /**
       
   137  * Method for Internalization. Reads a SmfArtists object from 
       
   138  * the stream and returns a reference to the stream.
       
   139  * @param aDataStream Stream to be read
       
   140  * @param aArtists The SmfArtists object to be internalized
       
   141  * @return reference to the stream
       
   142  */
       
   143  QDataStream &operator>>( QDataStream &aDataStream, 
       
   144 		SmfArtists &aArtists)
       
   145 	{
       
   146 	// Deserialize d->m_image
       
   147 	aDataStream>>aArtists.d->m_image;
       
   148 	
       
   149 	// Deserialize d->m_names
       
   150 	aDataStream>>aArtists.d->m_names;
       
   151 	
       
   152 	// Deserialize d->m_url
       
   153 	aDataStream>>aArtists.d->m_url;
       
   154 	
       
   155 	return aDataStream;
       
   156 	}
       
   157