mmappfw_plat/mpx_common_api/inc/mpxattribute.h
changeset 0 a2952bb97e68
equal deleted inserted replaced
-1:000000000000 0:a2952bb97e68
       
     1 /*
       
     2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "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 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  mpx attribute class
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef MPXATTRIBUTE_H
       
    20 #define MPXATTRIBUTE_H
       
    21 
       
    22 #include <s32strm.h>
       
    23 
       
    24 enum TMPXAttributeType
       
    25     {
       
    26     EMPXTypeUnknown,
       
    27     EMPXTypeTInt,
       
    28     EMPXTypeText,
       
    29     EMPXTypeTObject,
       
    30     EMPXTypeCObject,
       
    31     EMPXTypeError
       
    32     };
       
    33 
       
    34 
       
    35 /**
       
    36 *  MPX Attribute data type class.
       
    37 *
       
    38 *  @lib mpxcommon.lib
       
    39 */
       
    40 class TMPXAttributeData
       
    41     {
       
    42 public:
       
    43     /**
       
    44      * Overloadded operator&.
       
    45      *
       
    46      * @since S60 3.2.3
       
    47      * @param aData TMPXAttributeData object
       
    48      */
       
    49     IMPORT_C TBool operator& (const TMPXAttributeData& aData) const;
       
    50     /**
       
    51      * Overloadded operator&.
       
    52      *
       
    53      * @since S60 3.2.3
       
    54      * @param aData attribute
       
    55      */
       
    56     IMPORT_C TBool operator& (TUint& aData) const;
       
    57     /**
       
    58      * Overloadded operator|.
       
    59      *
       
    60      * @since S60 3.2.3
       
    61      * @param aData TMPXAttributeData object
       
    62      */
       
    63     IMPORT_C TMPXAttributeData operator| (const TMPXAttributeData& aData) const;
       
    64 public:
       
    65     TInt iContentId;
       
    66     TUint iAttributeId;
       
    67     };
       
    68 
       
    69 
       
    70 /**
       
    71 *  TMPXAttribute data type class.
       
    72 *  It represents unique id of an item, e.g. a song in the device.
       
    73 *
       
    74 *  @lib mpxcommon.lib
       
    75 */
       
    76 class TMPXAttribute
       
    77     {
       
    78 public:     // Constructors and destructor
       
    79     /**
       
    80     * C++ default constructor.
       
    81     *
       
    82     * @since S60 3.2.3
       
    83     */
       
    84     IMPORT_C TMPXAttribute();
       
    85 
       
    86     /**
       
    87     * C++ constructor.
       
    88     *
       
    89     * @since S60 3.2.3
       
    90     * @param aContentId media content id
       
    91     * @param aAttributeId attribute id within the content
       
    92     */
       
    93     IMPORT_C TMPXAttribute(TInt aContentId, TUint aAttributeId);
       
    94 
       
    95     /**
       
    96     * Copy constructor.
       
    97     *
       
    98     * @since S60 3.2.3
       
    99     * @param aId source of attribute id
       
   100     */
       
   101     IMPORT_C TMPXAttribute(const TMPXAttribute& aId);
       
   102 
       
   103     /**
       
   104      * Copy constructor.
       
   105      *
       
   106      * @since S60 3.2.3
       
   107      * @param aData source of attribute data
       
   108      */
       
   109     IMPORT_C TMPXAttribute(const TMPXAttributeData& aData);
       
   110 
       
   111 public:
       
   112      /**
       
   113     * Overloaded assignment operator.
       
   114     *
       
   115     * @since S60 3.2.3
       
   116     * @param aId source of attribute
       
   117     * @return reference to updated object
       
   118     */
       
   119     IMPORT_C TMPXAttribute& operator=(const TMPXAttribute& aId);
       
   120 
       
   121     /**
       
   122     * Overloaded equal operator.
       
   123     *
       
   124     * @since S60 3.2.3
       
   125     * @param aId id to be compared
       
   126     * @return ETrue if equal, otherwise, EFalse
       
   127     */
       
   128     IMPORT_C TBool operator==(const TMPXAttribute& aId) const;
       
   129 
       
   130 public:
       
   131     /**
       
   132     * Externalize the object of this class.
       
   133     *
       
   134     * @since S60 3.2.3
       
   135     * @param aStream write stream
       
   136     */
       
   137     IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
       
   138 
       
   139     /**
       
   140     * Internalize the object of this class.
       
   141     *
       
   142     * @since S60 3.2.3
       
   143     * @param aStream read stream
       
   144     */
       
   145     IMPORT_C void InternalizeL(RReadStream& aStream);
       
   146 
       
   147     /**
       
   148     * Get content id.
       
   149     *
       
   150     * @since S60 3.2.3
       
   151     * @return content id
       
   152     */
       
   153     IMPORT_C TInt ContentId() const;
       
   154 
       
   155     /**
       
   156     * Attribute id.
       
   157     *
       
   158     * @since S60 3.2.3
       
   159     * @return attribute db
       
   160     */
       
   161     IMPORT_C TUint AttributeId() const;
       
   162 
       
   163     /**
       
   164     * Helper function to do match in the RArray of the objects of this class.
       
   165     *
       
   166     * @since S60 3.2.3
       
   167     * @param aFirst first object
       
   168     * @param aSecond second object
       
   169     */
       
   170     IMPORT_C static TBool Match(const TMPXAttribute& aFirst,
       
   171                                const TMPXAttribute& aSecond);
       
   172 
       
   173     /**
       
   174     * Helper function to do match in the RArray of the objects of this class by
       
   175     * content id.
       
   176     *
       
   177     * @since S60 3.2.3
       
   178     * @param aFirst first object
       
   179     * @param aSecond second object
       
   180     */
       
   181     IMPORT_C static TBool MatchContentId(const TMPXAttribute& aFirst,
       
   182                                          const TMPXAttribute& aSecond);
       
   183 
       
   184 private:     // Data
       
   185     TMPXAttributeData iData;
       
   186     };
       
   187 
       
   188 // CONSTANTS NULL attribute not used for storing data
       
   189 const TMPXAttributeData KMPXMediaNullAttribute={0x0,0x00};
       
   190 
       
   191 #endif   // MPXATTRIBUTE_H
       
   192 
       
   193 // End of File