smf/smfservermodule/smfclient/common/smfmusicprofile.cpp
changeset 10 1d94eb8df9c2
parent 9 b85b0c039c14
equal deleted inserted replaced
9:b85b0c039c14 10:1d94eb8df9c2
     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 music profile class represents a user's profile in music site
       
    17  *
       
    18  */
       
    19 
       
    20 #include <smfmusicprofile.h>
       
    21 #include <smfmusicprofile_p.h>
       
    22 
       
    23 /**
       
    24  * Constructor with default argument
       
    25  */
       
    26 SmfMusicProfile::SmfMusicProfile( )
       
    27 	{
       
    28 	d = new SmfMusicProfilePrivate;
       
    29 	}
       
    30 
       
    31 /**
       
    32  * Copy Constructor
       
    33  * @param aOther The reference object
       
    34  */
       
    35 SmfMusicProfile::SmfMusicProfile( const SmfMusicProfile &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 SmfMusicProfile& SmfMusicProfile::operator=( const SmfMusicProfile &aOther )
       
    46 	{
       
    47 	d->m_usage = aOther.d->m_usage;
       
    48 	d->m_interest = aOther.d->m_interest;
       
    49 	d->m_events = aOther.d->m_events;
       
    50 	d->m_profileId = aOther.d->m_profileId;
       
    51 	return *this;
       
    52 	}
       
    53 
       
    54 /**
       
    55  * Destructor
       
    56  */
       
    57 SmfMusicProfile::~SmfMusicProfile( )
       
    58 	{
       
    59 	}
       
    60 
       
    61 /**
       
    62  * Method to get the user's used tracks
       
    63  * @return The users track list
       
    64  */
       
    65 QList<SmfTrackInfo> SmfMusicProfile::musicUsageInfo( ) const
       
    66 	{
       
    67 	return d->m_usage;
       
    68 	}
       
    69 
       
    70 /**
       
    71  * Method to get the user's interested tracks
       
    72  * @return The users interested track list
       
    73  */
       
    74 QList<SmfTrackInfo> SmfMusicProfile::interestInfo( ) const
       
    75 	{
       
    76 	return d->m_interest;
       
    77 	}
       
    78 
       
    79 /**
       
    80  * Method to get the user events as list of SmfEvents
       
    81  * @return The list of events
       
    82  */
       
    83 QList<SmfEvent> SmfMusicProfile::userEvents( ) const
       
    84 	{
       
    85 	return d->m_events;
       
    86 	}
       
    87 
       
    88 /**
       
    89  * Method to get the id of the music profile
       
    90  * @return The ID value 
       
    91  */
       
    92 QString SmfMusicProfile::id( ) const
       
    93 	{
       
    94 	return d->m_profileId;
       
    95 	}
       
    96 
       
    97 /**
       
    98  * Method to set the user's used tracks
       
    99  * @param aUsage The users new track list
       
   100  */
       
   101 void SmfMusicProfile::setMusicUsageInfo( const QList<SmfTrackInfo>& aUsage )
       
   102 	{
       
   103 	d->m_usage = aUsage;
       
   104 	}
       
   105 
       
   106 /**
       
   107  * Method to set the user's interested tracks
       
   108  * @param aInterest The users new interested track list
       
   109  */
       
   110 void SmfMusicProfile::setInterestInfo( const QList<SmfTrackInfo>& aInterest )
       
   111 	{
       
   112 	d->m_interest = aInterest;
       
   113 	}
       
   114 
       
   115 /**
       
   116  * Method to set the user events as list of SmfEvents
       
   117  * @param aList The list of events
       
   118  */
       
   119 void SmfMusicProfile::setUserEvents( const QList<SmfEvent> &aList )
       
   120 	{
       
   121 	d->m_events = aList;
       
   122 	}
       
   123 
       
   124 /**
       
   125  * Method to set the id of the music profile
       
   126  * @param aId The ID value 
       
   127  */
       
   128 void SmfMusicProfile::setId( const QString &aId )
       
   129 	{
       
   130 	d->m_profileId = aId;
       
   131 	}
       
   132 
       
   133 
       
   134 /**
       
   135  * Method for Externalization. Writes the SmfMusicProfile object to 
       
   136  * the stream and returns a reference to the stream.
       
   137  * @param aDataStream Stream to be written
       
   138  * @param aProfile The SmfMusicProfile object to be externalized
       
   139  * @return reference to the written stream
       
   140  */
       
   141  QDataStream &operator<<( QDataStream &aDataStream, 
       
   142 		const SmfMusicProfile &aProfile )
       
   143 	{
       
   144 	// Serialize d->m_usage
       
   145 	aDataStream<<aProfile.d->m_usage;
       
   146 	
       
   147 	// Serialize d->m_interest
       
   148 	aDataStream<<aProfile.d->m_interest;
       
   149 	
       
   150 	// Serialize d->m_events
       
   151 	aDataStream<<aProfile.d->m_events;
       
   152 	
       
   153 	// Serialize d->m_profileId
       
   154 	aDataStream<<aProfile.d->m_profileId;
       
   155 	
       
   156 	return aDataStream;
       
   157 	}
       
   158 
       
   159 /**
       
   160  * Method for Internalization. Reads a SmfMusicProfile object from 
       
   161  * the stream and returns a reference to the stream.
       
   162  * @param aDataStream Stream to be read
       
   163  * @param aProfile The SmfMusicProfile object to be internalized
       
   164  * @return reference to the stream
       
   165  */
       
   166  QDataStream &operator>>( QDataStream &aDataStream, 
       
   167 		SmfMusicProfile &aProfile)
       
   168 	{
       
   169 	// Deserialize d->m_usage
       
   170 	aDataStream>>aProfile.d->m_usage;
       
   171 	
       
   172 	// Deserialize d->m_interest
       
   173 	aDataStream>>aProfile.d->m_interest;
       
   174 	
       
   175 	// Deserialize d->m_events
       
   176 	aDataStream>>aProfile.d->m_events;
       
   177 	
       
   178 	// Deserialize d->m_profileId
       
   179 	aDataStream>>aProfile.d->m_profileId;
       
   180 	
       
   181 	return aDataStream;
       
   182 	}
       
   183