mtpfws/mtpfw/dataproviders/dataproviderapi/interface/cmtpmetadata.h
changeset 0 d0791faffa3f
equal deleted inserted replaced
-1:000000000000 0:d0791faffa3f
       
     1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 /**
       
    17  @file
       
    18  @publishedPartner
       
    19  @released
       
    20 */
       
    21 
       
    22 #ifndef CMTPMETADATA_H
       
    23 #define CMTPMETADATA_H
       
    24 
       
    25 #include <badesca.h>
       
    26 #include <e32base.h>
       
    27 
       
    28 /** 
       
    29 Defines the MTP meta-data base class.
       
    30 @publishedPartner
       
    31 @released
       
    32 */
       
    33 class CMTPMetaData : public CBase
       
    34     {        
       
    35 public:
       
    36     /* 
       
    37      * Store the hash code for the folder
       
    38      */
       
    39     struct TPathHash
       
    40     	{
       
    41     	TUint32 iHash;
       
    42     	TUint   iIndex;
       
    43     	};
       
    44 
       
    45 public:
       
    46     
       
    47     IMPORT_C virtual ~CMTPMetaData();
       
    48     
       
    49     IMPORT_C const TDesC& DesC(TUint aId) const;
       
    50     IMPORT_C const CDesCArray& DesCArray(TUint aId);
       
    51     IMPORT_C TInt Int(TUint aId) const;
       
    52     IMPORT_C const RArray<TInt>& IntArray(TUint aId) const;
       
    53     IMPORT_C TUint Uint(TUint aId) const;
       
    54     IMPORT_C const RArray<TUint>& UintArray(TUint aId) const;
       
    55     
       
    56     IMPORT_C void GetIntArrayL(TUint aId, RArray<TInt>& aValue);
       
    57     IMPORT_C void GetUintArrayL(TUint aId, RArray<TUint>& aValue);
       
    58     
       
    59     IMPORT_C void SetDesCL(TUint aId, const TDesC& aValue);
       
    60     IMPORT_C void SetDesCArrayL(TUint aId, const CDesCArrayFlat& aValue);
       
    61     IMPORT_C void SetDesCArrayL(TUint aId, const CDesCArraySeg& aValue);
       
    62     IMPORT_C void SetInt(TUint aId, TInt aValue);
       
    63     IMPORT_C void SetIntArrayL(TUint aId, const RArray<TInt>& aValue);
       
    64     IMPORT_C void SetUint(TUint aId, TUint aValue);
       
    65     IMPORT_C void SetUintArrayL(TUint aId, const RArray<TUint>& aValue);
       
    66     IMPORT_C void SetHashPath(const TDesC16& aExclusionPath, TUint aIndex);
       
    67     IMPORT_C const RArray<TPathHash>& GetHashPathArray();
       
    68     
       
    69     IMPORT_C TAny* GetExtendedInterface(TUid aInterfaceUid);
       
    70     IMPORT_C static TInt CompareTPathHash(const TPathHash&, const TPathHash&);
       
    71     
       
    72 protected:
       
    73 
       
    74     /**
       
    75     The meta-data element data type identifiers.
       
    76     */
       
    77     enum TType
       
    78         {
       
    79         /**
       
    80         Unknown (null).
       
    81         */
       
    82         EUndefined  = 0,
       
    83         
       
    84         /**
       
    85         @see TDesC.
       
    86         */
       
    87         EDesC       = 1,
       
    88         
       
    89         /**
       
    90         @see CDesCArray.
       
    91         */
       
    92         EDesCArray  = 2,
       
    93         
       
    94         /**
       
    95         @see TInt.
       
    96         */
       
    97         EInt        = 3,
       
    98         
       
    99         /**
       
   100         @see Rarray<TInt>.
       
   101         */
       
   102         EIntArray   = 4,
       
   103         
       
   104         /**
       
   105         @see TUint.
       
   106         */
       
   107         EUint       = 5,
       
   108         
       
   109         /**
       
   110         @see Rarray<TUint>.
       
   111         */
       
   112         EUintArray  = 6,
       
   113         };
       
   114 
       
   115     /**
       
   116     Describes the meta-data element.
       
   117     */
       
   118     struct TElementMetaData
       
   119         {
       
   120         /**
       
   121         The element buffer offset.
       
   122         */
       
   123         TUint   iOffset;
       
   124         
       
   125         /**
       
   126         The element data type identifier.
       
   127         */
       
   128         TType   iType;
       
   129         };
       
   130     
       
   131 protected:
       
   132 
       
   133     CMTPMetaData(const TElementMetaData* aElements, TUint aCount);  
       
   134     void ConstructL();
       
   135     void ConstructL(const CMTPMetaData& aFrom);
       
   136 
       
   137 private:
       
   138     
       
   139     CMTPMetaData();
       
   140     
       
   141     void CopyL(const CDesCArray& aFrom, CDesCArray& aTo);
       
   142     void CopyL(const RArray<TInt>& aFrom, RArray<TInt>& aTo);
       
   143     void CopyL(const RArray<TUint>& aFrom, RArray<TUint>& aTo);
       
   144     
       
   145     void DeleteIntArray(TUint aIdx);
       
   146     void DeleteUintArray(TUint aIdx);
       
   147 
       
   148 private:  // Owned
       
   149 
       
   150     /**
       
   151     The default array granularity
       
   152     */
       
   153     static const TUint              KGranularity = 8;
       
   154     
       
   155     /**
       
   156     The element meta-data.
       
   157     */
       
   158     const RArray<TElementMetaData>  iElements;
       
   159     
       
   160     /**
       
   161     The DesC element data.
       
   162     */
       
   163     RPointerArray<HBufC>            iElementsDesC;
       
   164     
       
   165     /**
       
   166     The DesCArray element data.
       
   167     */
       
   168     RPointerArray<CDesCArray>       iElementsDesCArray;
       
   169 
       
   170     /**
       
   171     The Int element data.
       
   172     */
       
   173     RArray<TInt>                    iElementsInt;
       
   174     
       
   175     /**
       
   176     The IntArray element data.
       
   177     */
       
   178     RPointerArray<TAny>             iElementsIntArray;
       
   179 
       
   180     /**
       
   181     The Uint element data.
       
   182     */
       
   183     RArray<TUint>                   iElementsUint;
       
   184     
       
   185     /**
       
   186     The UintArray element data.
       
   187     */
       
   188     RPointerArray<TAny>             iElementsUintArray;
       
   189     
       
   190     /**
       
   191     The extended data object pointer.
       
   192     */
       
   193     TAny*                           iExtensionData;
       
   194     
       
   195     /**
       
   196     The extended interface object pointer.
       
   197     */
       
   198     TAny*                           iExtensionInterfaces;
       
   199 
       
   200     /**
       
   201     The TDesCArrayType type element data.
       
   202     */
       
   203     RArray<TInt>  iElementsDesCArrayType;
       
   204     RArray<TPathHash>               iPathHash;
       
   205 
       
   206 	/**
       
   207     The CDesCArray element data type identifiers.
       
   208     */
       
   209     enum TDesCArrayType 
       
   210     	{
       
   211     	/**
       
   212         @see CDesCArrayFlat.
       
   213         */
       
   214     	 EDesCArrayFlat = 0,
       
   215     		
       
   216     	/**
       
   217         @see CDesCArraySeg.
       
   218         */
       
   219     	 EDesCArraySeg = 1,
       
   220     	};
       
   221     };
       
   222     
       
   223 #endif // CMTPMETADATA_H