mtpfws/mtpfw/src/cmtpobjectmgr.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 /**
       
    17  @file
       
    18  @internalComponent
       
    19 */
       
    20 
       
    21 #include "cmtpobjectmgr.h"
       
    22 #include "cmtpdpidstore.h"
       
    23 #include "cmtpobjectstore.h"
       
    24 #include "tmtptypeobjecthandle.h"
       
    25 #include "cmtppkgidstore.h"
       
    26 /**
       
    27 MTP object manager information record factory method. This method creates an 
       
    28 empty object information record.
       
    29 @return A pointer to a new CMTPObjectMetaData instance, ownership IS transferred.
       
    30 @leave One of the system wide error codes, if a processing failure occurs.
       
    31 */
       
    32 CMTPObjectMgr* CMTPObjectMgr::NewL()
       
    33     {
       
    34     CMTPObjectMgr* self = new (ELeave) CMTPObjectMgr();
       
    35     CleanupStack::PushL(self);
       
    36     self->ConstructL();
       
    37     CleanupStack::Pop(self);
       
    38     return self;
       
    39     }
       
    40 
       
    41 /**
       
    42 Destructor
       
    43 */    
       
    44 CMTPObjectMgr::~CMTPObjectMgr()
       
    45     {
       
    46     delete iObjectStore;
       
    47     }
       
    48 
       
    49 /**
       
    50 Provides a reference to the object meta data store.
       
    51 @return The object information store.
       
    52 */
       
    53 CMTPObjectStore& CMTPObjectMgr::ObjectStore()
       
    54     {
       
    55     return *iObjectStore;
       
    56     }
       
    57 
       
    58 void CMTPObjectMgr::RestorePersistentObjectsL(TUint aDataProviderId)
       
    59     {
       
    60     iObjectStore->RestorePersistentObjectsL(aDataProviderId);
       
    61     }
       
    62 
       
    63 EXPORT_C void CMTPObjectMgr::RemoveObjectsByStorageIdL(TUint32 aStorageId)
       
    64 	{
       
    65     iObjectStore->RemoveObjectsByStorageIdL(aStorageId);
       
    66 	}
       
    67 
       
    68 void CMTPObjectMgr::RemoveNonPersistentObjectsL(TUint aDataProviderId)
       
    69 	{
       
    70 	iObjectStore->RemoveNonPersistentObjectsL(aDataProviderId);
       
    71 	}
       
    72 
       
    73 void CMTPObjectMgr::MarkNonPersistentObjectsL(TUint aDataProviderId, TUint32 aStorageId)
       
    74 	{
       
    75 	iObjectStore->MarkNonPersistentObjectsL(aDataProviderId, aStorageId);
       
    76 	}
       
    77       
       
    78 void CMTPObjectMgr::MarkDPLoadedL(TUint aDataProviderId, TBool aFlag)
       
    79 	{
       
    80 	iObjectStore->MarkDPLoadedL(aDataProviderId, aFlag);
       
    81 	}
       
    82 TUint CMTPObjectMgr::CountL(const TMTPObjectMgrQueryParams& aParams) const
       
    83     {
       
    84     return iObjectStore->CountL(aParams);
       
    85     }
       
    86     
       
    87 void CMTPObjectMgr::CommitReservedObjectHandleL(CMTPObjectMetaData& aObjectInfo)
       
    88     {
       
    89     iObjectStore->CommitReservedObjectHandleL(aObjectInfo);
       
    90     }
       
    91     
       
    92 void CMTPObjectMgr::GetObjectHandlesL(const TMTPObjectMgrQueryParams& aParams, RMTPObjectMgrQueryContext& aContext, RArray<TUint>& aHandles) const
       
    93     {
       
    94     iObjectStore->GetObjectHandlesL(aParams, aContext, aHandles);
       
    95     }
       
    96     
       
    97 void CMTPObjectMgr::GetObjectSuidsL(const TMTPObjectMgrQueryParams& aParams, RMTPObjectMgrQueryContext& aContext, CDesCArray& aSuids) const
       
    98     {
       
    99     iObjectStore->GetObjectSuidsL(aParams, aContext, aSuids);
       
   100     }
       
   101     
       
   102 TUint32 CMTPObjectMgr::HandleL(const TDesC& aSuid) const
       
   103     {
       
   104     return iObjectStore->HandleL(aSuid);
       
   105     }
       
   106     
       
   107 void CMTPObjectMgr::InsertObjectL(CMTPObjectMetaData& aObject)
       
   108     {
       
   109     iObjectStore->InsertObjectL(aObject);
       
   110     }
       
   111     
       
   112 void CMTPObjectMgr::InsertObjectsL(RPointerArray<CMTPObjectMetaData>& aObjects)
       
   113     {
       
   114     iObjectStore->InsertObjectsL(aObjects);
       
   115     }
       
   116 void CMTPObjectMgr::InsertDPIDObjectL(TUint aDpId, TUint aUid)
       
   117     {
       
   118     iObjectStore->DPIDStore().InsertDPIDObjectL(aDpId,aUid);
       
   119     }  
       
   120 
       
   121 void CMTPObjectMgr::InsertPkgIDObjectL(TUint aDpId, TUint aPkgId)
       
   122     {
       
   123     iObjectStore->PkgIDStore().InsertPkgIdL(aDpId,aPkgId);
       
   124     }
       
   125     
       
   126 void CMTPObjectMgr::ModifyObjectL(const CMTPObjectMetaData& aObject)
       
   127     {
       
   128     iObjectStore->ModifyObjectL(aObject);
       
   129     }
       
   130     
       
   131 TBool CMTPObjectMgr::ObjectL(const TMTPTypeUint32& aHandle, CMTPObjectMetaData& aBuf) const
       
   132     {
       
   133     return iObjectStore->ObjectL(aHandle, aBuf);
       
   134     }
       
   135     
       
   136 TBool CMTPObjectMgr::ObjectL(const TDesC& aSuid, CMTPObjectMetaData& aBuf) const            
       
   137     {
       
   138     return iObjectStore->ObjectL(aSuid, aBuf);
       
   139     }
       
   140     
       
   141 TUint CMTPObjectMgr::ObjectOwnerId(const TMTPTypeUint32& aHandle) const
       
   142     {
       
   143     return iObjectStore->ObjectOwnerId(aHandle);
       
   144     }
       
   145 
       
   146 TUint CMTPObjectMgr::DPIDL(const TUint aUid, TBool& aFlag) const
       
   147     {
       
   148     return iObjectStore->DPIDStore().DPIDL(aUid, aFlag);
       
   149     }    
       
   150 
       
   151 TMTPTypeUint128 CMTPObjectMgr::PuidL(TUint32 aHandle) const
       
   152     {
       
   153     return iObjectStore->PuidL(aHandle);
       
   154     }
       
   155     
       
   156     
       
   157 TMTPTypeUint128 CMTPObjectMgr::PuidL(TInt64 /*aObjectUid*/) const
       
   158     {
       
   159     User::Leave(KErrNotSupported);
       
   160     return TMTPTypeUint128(0);
       
   161     }
       
   162     
       
   163 TMTPTypeUint128 CMTPObjectMgr::PuidL(const TDesC& aSuid) const
       
   164     {
       
   165     return iObjectStore->PuidL(aSuid);
       
   166     }
       
   167     
       
   168 void CMTPObjectMgr::RemoveObjectL(const TMTPTypeUint32& aHandle)
       
   169     {
       
   170     iObjectStore->RemoveObjectL(aHandle);
       
   171     }
       
   172     
       
   173 void CMTPObjectMgr::RemoveObjectL(const TDesC& aSuid)
       
   174     {
       
   175     iObjectStore->RemoveObjectL(aSuid);
       
   176     }
       
   177     
       
   178 void CMTPObjectMgr::RemoveObjectsL(const CDesCArray& aSuids)
       
   179     {
       
   180     iObjectStore->RemoveObjectsL(aSuids);
       
   181     }
       
   182     
       
   183 void CMTPObjectMgr::RemoveObjectsL(TUint aDataProviderId)
       
   184     {
       
   185     iObjectStore->RemoveObjectsL(aDataProviderId);
       
   186     }
       
   187     
       
   188 void CMTPObjectMgr::ReserveObjectHandleL(CMTPObjectMetaData& aObjectInfo, TUint64 aSpaceRequired)
       
   189     {
       
   190     iObjectStore->ReserveObjectHandleL(aObjectInfo, aSpaceRequired);
       
   191     }
       
   192     
       
   193 void CMTPObjectMgr::UnreserveObjectHandleL(const CMTPObjectMetaData& aObjectInfo)
       
   194     {
       
   195     iObjectStore->UnreserveObjectHandleL(aObjectInfo);
       
   196     }
       
   197 
       
   198 /**
       
   199 Standard C++ constructor
       
   200 */    	
       
   201 CMTPObjectMgr::CMTPObjectMgr()
       
   202     {
       
   203     }
       
   204 
       
   205 /**
       
   206 second phase construction
       
   207 */    
       
   208 void CMTPObjectMgr::ConstructL()
       
   209     {
       
   210     iObjectStore = CMTPObjectStore::NewL();
       
   211     }
       
   212 
       
   213 /**
       
   214 return MtpDeltaDataMgr
       
   215 */    
       
   216 TAny* CMTPObjectMgr::MtpDeltaDataMgr()
       
   217     {
       
   218     return 	iObjectStore->MtpDeltaDataMgr();
       
   219     }
       
   220 
       
   221 
       
   222     
       
   223