mpx/commonframework/common/inc/mpxmediadataarray.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:  Array of variable size elements on global chunk
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef RMPXMEDIADATAARRAY_H
       
    21 #define RMPXMEDIADATAARRAY_H
       
    22 
       
    23 #include "mpxdataarray.h"
       
    24 #include <mpxattribute.h>
       
    25 
       
    26 class RMPXMediaDataItem;
       
    27 
       
    28 
       
    29 /**
       
    30 *  Class RMPXMediaDataItemArray. A dynamic array of RMPXMediaDataItems, where 
       
    31 *  each item can have variable length data
       
    32 */
       
    33 class RMPXMediaDataItemArray : public RMPXDataItemArray
       
    34     {
       
    35 public:   
       
    36         
       
    37     /**
       
    38     * Sets the data for this object
       
    39     * 
       
    40     * @param aClientHandle, client handle to the global chunk
       
    41     * @param aArray, source array
       
    42     * @return KErrNone if succeeded, otherwise system error code
       
    43     */
       
    44     TInt Copy(TUint aClientHandle,const RMPXMediaDataItemArray& aArray);   
       
    45     
       
    46     /**
       
    47     * Data item at aIndex
       
    48     * 
       
    49     * @param aClientHandle, client handle to the global chunk
       
    50     * @param aIndex, index to the data item
       
    51     * @return data item object
       
    52     */
       
    53     inline RMPXMediaDataItem* MediaDataItem(TUint aClientHandle,TInt aIndex);
       
    54     
       
    55     /**
       
    56     * Adds an item to the array
       
    57     * 
       
    58     * @param aClientHandle, client handle to the global chunk
       
    59     * @param aAttr, media attribute
       
    60     * @param aAttrType, object type
       
    61     * @param aData, raw data
       
    62     * @return KErrNone if succeeded. Otheriwse system error code
       
    63     */
       
    64     TInt Append(TUint aClientHandle,
       
    65                 const TMPXAttribute& aAttr,
       
    66                 TMPXAttributeType aAttrType,
       
    67                 const TDesC8& aData);
       
    68     
       
    69     /**
       
    70     * Sets an item in the array
       
    71     * 
       
    72     * @param aClientHandle, client handle to the global chunk
       
    73     * @param aAttr, media attribute
       
    74     * @param aAttrType, object type
       
    75     * @param aData, raw data
       
    76     * @param aIndex, index of data item to be set.
       
    77     * @return KErrNone if succeeded. Otheriwse system error code
       
    78     */
       
    79     TInt Set(TUint aClientHandle,
       
    80             const TMPXAttribute& aAttr,
       
    81             TMPXAttributeType aAttrType,
       
    82             const TDesC8& aData,
       
    83             TInt aIndex);
       
    84     
       
    85     /**
       
    86     * Inserts an item to the array
       
    87     * 
       
    88     * @param aClientHandle, client handle to the global chunk
       
    89     * @param aAttr, media attribute
       
    90     * @param aAttrType, object type
       
    91     * @param aData, raw data
       
    92     * @param aIndex, index of data item.
       
    93     * @return KErrNone if succeeded. Otheriwse system error code
       
    94     */
       
    95     TInt Insert(TUint aClientHandle,
       
    96                 const TMPXAttribute& aAttr,
       
    97                 TMPXAttributeType aAttrType,
       
    98                 const TDesC8& aData,
       
    99                 TInt aIndex); 
       
   100     
       
   101     /**
       
   102     * Index of an attribute
       
   103     * 
       
   104     * @param aClientHandle, client handle to the global chunk
       
   105     * @param aAttr, media attribute
       
   106     * @return index of the media attribute
       
   107     */
       
   108     TInt Index(TUint aClientHandle,const TMPXAttribute& aAttr);
       
   109     
       
   110 private:
       
   111     
       
   112     /**
       
   113     * Create a new item, or NULL if OOM
       
   114     * 
       
   115     * @param aClientHandle, client handle to the global chunk
       
   116     * @param aAttr, media attribute
       
   117     * @param aAttrType, object type
       
   118     * @param aData, raw data
       
   119     * @return pointer to new data item
       
   120     */
       
   121     RMPXMediaDataItem* NewItem(TUint aClientHandle,
       
   122                                const TMPXAttribute& aAttr,
       
   123                                TMPXAttributeType aAttrType,
       
   124                                const TDesC8& aData);
       
   125     };
       
   126 
       
   127 /**
       
   128 *  Class RMPXMediaDataItem. Encapsulates a media item of data on the heap.
       
   129 *  E.g. a single attribute and value of a media object
       
   130 */
       
   131 class RMPXMediaDataItem : public RMPXDataItem
       
   132     {
       
   133 public:
       
   134     /**
       
   135     * Default C++ constructor
       
   136     */
       
   137     inline RMPXMediaDataItem();
       
   138 
       
   139     /**
       
   140     * Sets the attribute and its type
       
   141     * 
       
   142     * @param aAttr, media attribute
       
   143     * @param aAttrType, object type
       
   144     */
       
   145     inline void SetAttribute(const TMPXAttribute& aAttr,TMPXAttributeType aType);
       
   146     
       
   147     /**
       
   148     * The attribute type
       
   149     * 
       
   150     * @return object type of the item
       
   151     */
       
   152     inline TMPXAttributeType Type() const;
       
   153     
       
   154     /**
       
   155     * The attribute
       
   156     * 
       
   157     * @return media attribute of the item
       
   158     */
       
   159     inline const TMPXAttribute& Attribute() const;
       
   160     
       
   161 private:
       
   162     /**
       
   163     * Attribute stored by this object
       
   164     */
       
   165     TMPXAttribute iAttr;
       
   166     /**
       
   167     * Data type of attribute. Can be EMPXTypeUnknown,EMPXTypeTInt,
       
   168     * EMPXTypeText,EMPXTypeTObject,EMPXTypeCObject
       
   169     */
       
   170     TMPXAttributeType iAttrType; 
       
   171     };
       
   172 
       
   173 #include "mpxmediadataarray.inl"
       
   174 
       
   175 #endif // RMPXMEDIADATAARRAY_H