smf/smfservermodule/smfclient/common/smfmusicrating.h
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 rating class represents an instance of rating 
       
    17  * about a music track
       
    18  *
       
    19  */
       
    20 
       
    21 #ifndef SMFMUSICRATING_H_
       
    22 #define SMFMUSICRATING_H_
       
    23 
       
    24 #include <QSharedData>
       
    25 #include <smfclientglobal.h>
       
    26 #include <QMetaType>
       
    27 
       
    28 class SmfTrackInfo;
       
    29 class SmfMusicRatingPrivate;
       
    30 
       
    31 /**
       
    32  * Indicates range of values to represent ratings,
       
    33  * SP should normalize their rating value to this scale
       
    34  */
       
    35 const int SMF_MAX_RATING = 10;
       
    36 const int SMF_MIN_RATING = 0;
       
    37 
       
    38 /**
       
    39  * @ingroup smf_common_group
       
    40  * The music rating class represents an instance of rating 
       
    41  * about a music track 
       
    42  */
       
    43 class SMFCLIENT_EXPORT SmfMusicRating
       
    44 	{
       
    45 public:
       
    46 	/**
       
    47 	 * Constructor with default argument
       
    48 	 * @param aParent The SmfTrackInfo instance
       
    49 	 */
       
    50 	SmfMusicRating( SmfTrackInfo *aParent = 0 );
       
    51 	
       
    52 	/**
       
    53 	 * Copy Constructor
       
    54 	 * @param aOther The reference object
       
    55 	 */
       
    56 	SmfMusicRating( const SmfMusicRating &aOther );
       
    57 	
       
    58 	/**
       
    59 	 * Overloaded = operator 
       
    60 	 * @param aOther The reference object
       
    61 	 */
       
    62 	SmfMusicRating& operator=( const SmfMusicRating &aOther );
       
    63 	
       
    64 	/**
       
    65 	 * Destructor
       
    66 	 */
       
    67 	~SmfMusicRating( );
       
    68 	
       
    69 	/**
       
    70 	 * Method to get the rating
       
    71 	 * @return The rating value
       
    72 	 */
       
    73 	int rating( ) const;
       
    74 
       
    75 	/**
       
    76 	 * Method to get the max rating
       
    77 	 * @return The max rating value
       
    78 	 */
       
    79 	int maxRating( ) const;
       
    80 	
       
    81 	/**
       
    82 	 * Method to get the min rating
       
    83 	 * @return The min rating value
       
    84 	 */
       
    85 	int minRating( ) const;
       
    86 	
       
    87 	/**
       
    88 	 * Method to set the rating
       
    89 	 * @param aRating The rating value
       
    90 	 */
       
    91 	void setRating( const int &aRating );
       
    92 
       
    93 	/**
       
    94 	 * Method to set the max rating
       
    95 	 * @param aMax The max rating value
       
    96 	 */
       
    97 	void setMaxRating( const int &aMax );
       
    98 	
       
    99 	/**
       
   100 	 * Method to set the min rating
       
   101 	 * @param aMin The min rating value
       
   102 	 */
       
   103 	void setMinRating( const int &aMin );
       
   104 	
       
   105 private:
       
   106 	QSharedDataPointer<SmfMusicRatingPrivate> d;
       
   107 	
       
   108 	friend QDataStream &operator<<( QDataStream &aDataStream, 
       
   109 			const SmfMusicRating &aMusicRating );
       
   110 
       
   111 	friend QDataStream &operator>>( QDataStream &aDataStream, 
       
   112 			SmfMusicRating &aMusicRating );
       
   113 	
       
   114 	};
       
   115 
       
   116 
       
   117 /**
       
   118  * Method for Externalization. Writes the SmfMusicRating object to 
       
   119  * the stream and returns a reference to the stream.
       
   120  * @param aDataStream Stream to be written
       
   121  * @param aMusicRating The SmfMusicRating object to be externalized
       
   122  * @return reference to the written stream
       
   123  */
       
   124 SMFCLIENT_EXPORT QDataStream &operator<<( QDataStream &aDataStream, 
       
   125 		const SmfMusicRating &aMusicRating );
       
   126 
       
   127 /**
       
   128  * Method for Internalization. Reads a SmfMusicRating object from 
       
   129  * the stream and returns a reference to the stream.
       
   130  * @param aDataStream Stream to be read
       
   131  * @param aMusicRating The SmfMusicRating object to be internalized
       
   132  * @return reference to the stream
       
   133  */
       
   134 SMFCLIENT_EXPORT QDataStream &operator>>( QDataStream &aDataStream, 
       
   135 		SmfMusicRating &aMusicRating);
       
   136 
       
   137 
       
   138 // Make the class SmfMusicRating known to QMetaType, so that as to register it.
       
   139 Q_DECLARE_METATYPE(SmfMusicRating)
       
   140 
       
   141 
       
   142 #endif /* SMFMUSICRATING_H_ */