smf/smfservermodule/smfclient/common/smfmusicrating.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 music rating class represents an instance of rating 
       
    17  * about a music track
       
    18  *
       
    19  */
       
    20 
       
    21 #include <smfmusicrating.h>
       
    22 #include <smfmusicrating_p.h>
       
    23 
       
    24 /**
       
    25  * Constructor with default argument
       
    26  * @param aParent The SmfTrackInfo instance
       
    27  */
       
    28 SmfMusicRating::SmfMusicRating( SmfTrackInfo *aParent )
       
    29 	{
       
    30 	d = new SmfMusicRatingPrivate();
       
    31 	}
       
    32 
       
    33 /**
       
    34  * Copy Constructor
       
    35  * @param aOther The reference object
       
    36  */
       
    37 SmfMusicRating::SmfMusicRating( const SmfMusicRating &aOther )
       
    38 	: d( aOther.d )
       
    39 	{
       
    40 	}
       
    41 
       
    42 /**
       
    43  * Overloaded = operator 
       
    44  * @param aOther The reference object
       
    45  */
       
    46 SmfMusicRating& SmfMusicRating::operator=( const SmfMusicRating &aOther )
       
    47 	{
       
    48 	d->m_rating = aOther.d->m_rating;
       
    49 	d->m_max = aOther.d->m_max;
       
    50 	d->m_min = aOther.d->m_min;
       
    51 	return *this;
       
    52 	}
       
    53 
       
    54 /**
       
    55  * Destructor
       
    56  */
       
    57 SmfMusicRating::~SmfMusicRating( )
       
    58 	{
       
    59 	}
       
    60 
       
    61 /**
       
    62  * Method to get the rating
       
    63  * @return The rating value
       
    64  */
       
    65 int SmfMusicRating::rating( ) const
       
    66 	{
       
    67 	return d->m_rating;
       
    68 	}
       
    69 
       
    70 /**
       
    71  * Method to get the max rating
       
    72  * @return The max rating value
       
    73  */
       
    74 int SmfMusicRating::maxRating( ) const
       
    75 	{
       
    76 	return d->m_max;
       
    77 	}
       
    78 
       
    79 /**
       
    80  * Method to get the min rating
       
    81  * @return The min rating value
       
    82  */
       
    83 int SmfMusicRating::minRating( ) const
       
    84 	{
       
    85 	return d->m_min;
       
    86 	}
       
    87 
       
    88 /**
       
    89  * Method to set the rating
       
    90  * @param aRating The rating value
       
    91  */
       
    92 void SmfMusicRating::setRating( const int &aRating )
       
    93 	{
       
    94 	d->m_rating = aRating;
       
    95 	}
       
    96 
       
    97 /**
       
    98  * Method to set the max rating
       
    99  * @param aMax The max rating value
       
   100  */
       
   101 void SmfMusicRating::setMaxRating( const int &aMax )
       
   102 	{
       
   103 	d->m_max = aMax;
       
   104 	}
       
   105 
       
   106 /**
       
   107  * Method to set the min rating
       
   108  * @param aMin The min rating value
       
   109  */
       
   110 void SmfMusicRating::setMinRating( const int &aMin )
       
   111 	{
       
   112 	d->m_min = aMin;
       
   113 	}
       
   114 
       
   115 
       
   116 /**
       
   117  * Method for Externalization. Writes the SmfMusicRating object to 
       
   118  * the stream and returns a reference to the stream.
       
   119  * @param aDataStream Stream to be written
       
   120  * @param aMusicRating The SmfMusicRating object to be externalized
       
   121  * @return reference to the written stream
       
   122  */
       
   123 QDataStream &operator<<( QDataStream &aDataStream, 
       
   124 		const SmfMusicRating &aMusicRating )
       
   125 	{
       
   126 	// Serialize d->m_rating
       
   127 	aDataStream<<aMusicRating.d->m_rating;
       
   128 	
       
   129 	// Serialize d->m_max
       
   130 	aDataStream<<aMusicRating.d->m_max;
       
   131 	
       
   132 	// Serialize d->m_min
       
   133 	aDataStream<<aMusicRating.d->m_min;
       
   134 	
       
   135 	return aDataStream;
       
   136 	}
       
   137 
       
   138 /**
       
   139  * Method for Internalization. Reads a SmfMusicRating object from 
       
   140  * the stream and returns a reference to the stream.
       
   141  * @param aDataStream Stream to be read
       
   142  * @param aMusicRating The SmfMusicRating object to be internalized
       
   143  * @return reference to the stream
       
   144  */
       
   145 QDataStream &operator>>( QDataStream &aDataStream, 
       
   146 		SmfMusicRating &aMusicRating)
       
   147 	{
       
   148 	// Deserialize d->m_rating
       
   149 	aDataStream>>aMusicRating.d->m_rating;
       
   150 	
       
   151 	// Deserialize d->m_max
       
   152 	aDataStream>>aMusicRating.d->m_max;
       
   153 	
       
   154 	// Deserialize d->m_min
       
   155 	aDataStream>>aMusicRating.d->m_min;
       
   156 	
       
   157 	return aDataStream;
       
   158 	}
       
   159