mtpfws/mtpfw/dataproviders/dataproviderapi/src/cmtpstoragemetadata.cpp
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 #include <mtp/cmtpstoragemetadata.h>
       
    17     
       
    18 /**
       
    19 The element meta-data table content.
       
    20 */
       
    21 const CMTPMetaData::TElementMetaData CMTPStorageMetaData::KElements[CMTPStorageMetaData::ENumElements] = 
       
    22     {
       
    23         {0, CMTPStorageMetaData::EUint},        // EAttributes
       
    24         {0, CMTPStorageMetaData::EDesCArray},   // EExcludedAreas
       
    25         {1, CMTPStorageMetaData::EUint},        // EStorageId
       
    26         {0, CMTPStorageMetaData::EUintArray},   // ELogicalIds
       
    27         {0, CMTPStorageMetaData::EDesC},        // EStorageSuid
       
    28         {2, CMTPStorageMetaData::EUint},        // EStorageSystemType
       
    29     };
       
    30     
       
    31 /**
       
    32 MTP storage meta-data factory method. This method creates an 
       
    33 empty storage meta-data record.
       
    34 @return A pointer to a new CMTPStorageMetaData instance, ownership IS transferred.
       
    35 @leave One of the system wide error codes, if a processing failure occurs.
       
    36 */
       
    37 EXPORT_C CMTPStorageMetaData* CMTPStorageMetaData::NewL()
       
    38     {
       
    39     CMTPStorageMetaData* self = CMTPStorageMetaData::NewLC();
       
    40     CleanupStack::Pop(self); // self
       
    41     return self;
       
    42     }
       
    43 
       
    44 /**
       
    45 MTP storage meta-data factory method. This method creates an 
       
    46 empty storage meta-data record. A pointer to the meta-data is placed on the 
       
    47 cleanup stack.
       
    48 @return A pointer to a new CMTPStorageMetaData instance, ownership IS transferred.
       
    49 @leave One of the system wide error codes, if a processing failure occurs.
       
    50 */
       
    51 EXPORT_C CMTPStorageMetaData* CMTPStorageMetaData::NewLC()
       
    52     {
       
    53     CMTPStorageMetaData* self = new(ELeave) CMTPStorageMetaData();
       
    54     CleanupStack::PushL(self);
       
    55     self->CMTPMetaData::ConstructL();
       
    56     return self;
       
    57     }
       
    58     
       
    59 /**
       
    60 MTP storage meta-data factory method. 
       
    61 @param aStorageSystemType The storage system type.
       
    62 @param aStorageSuid The storage System Unique IDentifier (SUID).
       
    63 @return A pointer to a new CMTPStorageMetaData instance, ownership IS transferred.
       
    64 @leave One of the system wide error codes, if a processing failure occurs.
       
    65 */
       
    66 EXPORT_C CMTPStorageMetaData* CMTPStorageMetaData::NewL(TUint aStorageSystemType, const TDesC& aStorageSuid)
       
    67     {
       
    68     CMTPStorageMetaData* self = CMTPStorageMetaData::NewLC(aStorageSystemType, aStorageSuid);
       
    69     CleanupStack::Pop(self);
       
    70     return self;
       
    71     }
       
    72     
       
    73 /**
       
    74 MTP storage meta-data factory method. A pointer to the meta-data is 
       
    75 placed on the cleanup stack.
       
    76 @param aStorageSystemType The storage system type.
       
    77 @param aStorageSuid The storage System Unique IDentifier (SUID).
       
    78 @return A pointer to a new CMTPStorageMetaData instance, ownership IS transferred.
       
    79 @leave One of the system wide error codes, if a processing failure occurs.
       
    80 */
       
    81 EXPORT_C CMTPStorageMetaData* CMTPStorageMetaData::NewLC(TUint aStorageSystemType, const TDesC& aStorageSuid)
       
    82     {
       
    83     CMTPStorageMetaData* self = new(ELeave) CMTPStorageMetaData();
       
    84     CleanupStack::PushL(self);
       
    85     self->ConstructL(aStorageSystemType, aStorageSuid);
       
    86     return self;
       
    87     }
       
    88     
       
    89 /**
       
    90 MTP storage meta-data copy factory method. 
       
    91 @return A pointer to a new CMTPStorageMetaData instance, ownership IS transferred.
       
    92 @leave One of the system wide error codes, if a processing failure occurs.
       
    93 */
       
    94 EXPORT_C CMTPStorageMetaData* CMTPStorageMetaData::NewL(const CMTPStorageMetaData& aStorage)
       
    95     {
       
    96     CMTPStorageMetaData* self = CMTPStorageMetaData::NewLC(aStorage);
       
    97     CleanupStack::Pop(self);
       
    98     return self;
       
    99     }
       
   100     
       
   101 /**
       
   102 MTP storage meta-data copy factory method. A pointer to the meta-data
       
   103 is placed on the cleanup stack.
       
   104 @param aStorage .
       
   105 @return A pointer to a new CMTPStorageMetaData instance, ownership IS transferred.
       
   106 @leave One of the system wide error codes, if a processing failure occurs.
       
   107 */
       
   108 EXPORT_C CMTPStorageMetaData* CMTPStorageMetaData::NewLC(const CMTPStorageMetaData& aStorage)
       
   109     {
       
   110     CMTPStorageMetaData* self = new(ELeave) CMTPStorageMetaData();
       
   111     CleanupStack::PushL(self);
       
   112     self->CMTPMetaData::ConstructL(aStorage);
       
   113     return self;
       
   114     }
       
   115 
       
   116 /**
       
   117 Destructor.
       
   118 */
       
   119 EXPORT_C CMTPStorageMetaData::~CMTPStorageMetaData()
       
   120     {
       
   121 
       
   122     } 
       
   123 
       
   124 /**
       
   125 Constructor.
       
   126 */
       
   127 CMTPStorageMetaData::CMTPStorageMetaData() :
       
   128     CMTPMetaData(KElements, ENumElements)
       
   129     {
       
   130     
       
   131     }
       
   132     
       
   133 /**
       
   134 Second phase constructor.
       
   135 @param aStorageSystemType The storage system type.
       
   136 @param aStorageSuid The storage System Unique IDentifier (SUID).
       
   137 @leave One of the system wide error code, if a processing failure occurs.
       
   138 */
       
   139 void CMTPStorageMetaData::ConstructL(TUint aStorageSystemType, const TDesC& aStorageSuid)
       
   140     {
       
   141     CMTPMetaData::ConstructL();
       
   142     SetUint(EStorageSystemType, aStorageSystemType);
       
   143     SetDesCL(EStorageSuid, aStorageSuid);
       
   144     }