example/clientapi/smf/inc/common/smfmusic/smfmusicrating.h
changeset 3 0446eb7b28aa
parent 2 86af6c333601
child 4 969092730d34
equal deleted inserted replaced
2:86af6c333601 3:0446eb7b28aa
     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 <QObject>
       
    25 #include <QSharedData>
       
    26 #include <smfclientglobal.h>
       
    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 : public QObject
       
    44 	{
       
    45 	Q_OBJECT
       
    46 public:
       
    47 	/**
       
    48 	 * Constructor with default argument
       
    49 	 * @param aParent The parent object
       
    50 	 * (parent should be of type SmfTrackInfo)
       
    51 	 */
       
    52 	SmfMusicRating(SmfTrackInfo *aParent = 0);
       
    53 	
       
    54 	/**
       
    55 	 * Copy Constructor
       
    56 	 * @param aOther The reference object
       
    57 	 */
       
    58 	SmfMusicRating( const SmfMusicRating &aOther );
       
    59 	
       
    60 	/**
       
    61 	 * Overloaded = operator 
       
    62 	 * @param aOther The reference object
       
    63 	 */
       
    64 	SmfMusicRating operator=( const SmfMusicRating &aOther );
       
    65 	
       
    66 	/**
       
    67 	 * Destructor
       
    68 	 */
       
    69 	~SmfMusicRating( );
       
    70 	
       
    71 	/**
       
    72 	 * Method to get the rating
       
    73 	 * @return The rating value
       
    74 	 */
       
    75 	int rating( ) const;
       
    76 
       
    77 	/**
       
    78 	 * Method to get the max rating
       
    79 	 * @return The max rating value
       
    80 	 */
       
    81 	int maxRating( ) const;
       
    82 	
       
    83 	/**
       
    84 	 * Method to get the min rating
       
    85 	 * @return The min rating value
       
    86 	 */
       
    87 	int minRating( ) const;
       
    88 	
       
    89 private:
       
    90 	QSharedDataPointer<SmfMusicRatingPrivate> d;
       
    91 	
       
    92 	friend QDataStream &operator<<( QDataStream &aDataStream, 
       
    93 			const SmfMusicRating &aMusicRating );
       
    94 
       
    95 	friend QDataStream &operator>>( QDataStream &aDataStream, 
       
    96 			SmfMusicRating &aMusicRating );
       
    97 	
       
    98 	};
       
    99 
       
   100 
       
   101 /**
       
   102  * Method for Externalization. Writes the SmfMusicRating object to 
       
   103  * the stream and returns a reference to the stream.
       
   104  * @param aDataStream Stream to be written
       
   105  * @param aMusicRating The SmfMusicRating object to be externalized
       
   106  * @return reference to the written stream
       
   107  */
       
   108 QDataStream &operator<<( QDataStream &aDataStream, 
       
   109 		const SmfMusicRating &aMusicRating );
       
   110 
       
   111 /**
       
   112  * Method for Internalization. Reads a SmfMusicRating object from 
       
   113  * the stream and returns a reference to the stream.
       
   114  * @param aDataStream Stream to be read
       
   115  * @param aMusicRating The SmfMusicRating object to be internalized
       
   116  * @return reference to the stream
       
   117  */
       
   118 QDataStream &operator>>( QDataStream &aDataStream, 
       
   119 		SmfMusicRating &aMusicRating);
       
   120 
       
   121 #endif /* SMFMUSICRATING_H_ */