|
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 @internalTechnology |
|
19 */ |
|
20 |
|
21 #ifndef CMTPREFERENCEMGR_H |
|
22 #define CMTPREFERENCEMGR_H |
|
23 |
|
24 #include <e32base.h> |
|
25 #include <mtp/mmtpreferencemgr.h> |
|
26 |
|
27 #include "mtpframeworkconst.h" |
|
28 #include "rmtpframework.h" |
|
29 |
|
30 class RDbDatabase; |
|
31 class CMTPObjectStore; |
|
32 |
|
33 /** |
|
34 Implements the MTP reference manager interface. |
|
35 |
|
36 @internalTechnology |
|
37 |
|
38 */ |
|
39 class CMTPReferenceMgr : public CBase, public MMTPReferenceMgr |
|
40 { |
|
41 public: |
|
42 static CMTPReferenceMgr* NewL(CMTPObjectStore& aObjectStore); |
|
43 ~CMTPReferenceMgr(); |
|
44 |
|
45 void RemoveReferencesL(TUint aHandle); |
|
46 |
|
47 public: // From MMTPReferenceMgr |
|
48 |
|
49 CMTPTypeArray* ReferencesLC(const TMTPTypeUint32& aFromHandle) const; |
|
50 CDesCArray* ReferencesLC(const TDesC& aParentSuid) const; |
|
51 void RemoveReferencesL(const TDesC& aSuid); |
|
52 void SetReferenceL(const TDesC& aFromSuid, const TDesC& aToSuid); |
|
53 void SetReferencesL(const TDesC& aParentSuid, const CDesCArray& aToSuids); |
|
54 void SetReferencesL(const TMTPTypeUint32& aFromHandle, const CMTPTypeArray& aToHandles); |
|
55 |
|
56 private: |
|
57 CMTPReferenceMgr(CMTPObjectStore& aObjectStore); |
|
58 void ConstructL(); |
|
59 |
|
60 private: |
|
61 //helpers |
|
62 void CreateTableL(); |
|
63 void CreateIndexL(); |
|
64 |
|
65 CMTPTypeArray* GetReferencesLC(TUint aHandle) const; |
|
66 CDesCArray* GetReferencesInDesLC(TUint aHandle) const; |
|
67 void GetReferencesL(TUint aHandle, RArray<TUint>& aToHandles) const; |
|
68 void SetReferencesL(TUint aHandle, const RArray<TUint>& aToHandles); |
|
69 void SetReferenceL(TUint aHandle, TUint aToHandles); |
|
70 //void AdjustReferencesL(RArray<TUint32>& aHandles) const; |
|
71 void IncTranOpsNumL(); |
|
72 |
|
73 private: // Owned |
|
74 |
|
75 TBuf<KMTPMaxSqlStatementLen> iSqlStatement; |
|
76 |
|
77 private: // Not owned |
|
78 |
|
79 RDbDatabase* iDatabase; |
|
80 CMTPObjectStore& iObjectStore; |
|
81 mutable RDbTable iBatched; |
|
82 }; |
|
83 #endif // CMTPREFERENCEMGR_H |