1 /* |
|
2 * Copyright (c) 2009 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: |
|
15 * |
|
16 */ |
|
17 #ifndef AFSTORAGE_H |
|
18 #define AFSTORAGE_H |
|
19 |
|
20 #define __E32SVR_H__ |
|
21 |
|
22 #include <e32std.h> |
|
23 #include <e32base.h> |
|
24 #include <d32dbms.h> // RDbStoreDatabase |
|
25 #include <s32file.h> // CFileStore & CPermanentFileStore |
|
26 #include "afentry.h" |
|
27 |
|
28 class CAfStorage : public CBase |
|
29 { |
|
30 public: |
|
31 ~CAfStorage(); |
|
32 |
|
33 static CAfStorage* NewL(RFs& session); |
|
34 |
|
35 void AddActivityL(CAfEntry &entry); |
|
36 |
|
37 void UpdateActivityL(CAfEntry &entry); |
|
38 |
|
39 void DeleteActivityL(CAfEntry &entry); |
|
40 |
|
41 void DeleteActivitiesL(CAfEntry &entry); |
|
42 |
|
43 void ActivitiesL(RPointerArray<CAfEntry> &dst); |
|
44 |
|
45 void ActivitiesL(RPointerArray<CAfEntry> &dst, TInt appId); |
|
46 |
|
47 void ActivityL(CAfEntry *&dst, CAfEntry &src); |
|
48 |
|
49 RFs& Fs(); |
|
50 |
|
51 private: |
|
52 CAfStorage(RFs& session); |
|
53 |
|
54 void ConstructL(); |
|
55 |
|
56 void CreateDbL(const TDesC& databaseFile); |
|
57 |
|
58 void OpenDbL(const TDesC& databaseFile); |
|
59 |
|
60 void CreateTableL(); |
|
61 |
|
62 void DeleteNonPersistentActivitiesL(); |
|
63 |
|
64 void GetActivitiesL(const TDesC& dst); |
|
65 |
|
66 HBufC* SelectRowLC(TInt appId, const TDesC& actId) const; |
|
67 |
|
68 HBufC* SelectRowsLC(TInt appId) const; |
|
69 |
|
70 HBufC* DeleteRowLC(TInt appId, const TDesC& actId) const; |
|
71 |
|
72 HBufC* DeleteRowsLC(TInt appId) const; |
|
73 |
|
74 HBufC* BuildQueryLC(const TDesC& format, TInt appId, const TDesC& actId) const; |
|
75 |
|
76 void ActivitiesL(RPointerArray<CAfEntry>& dst, |
|
77 const TDesC& query, |
|
78 CAfEntry::AccessRights rights, |
|
79 TInt limit = 0); |
|
80 |
|
81 void ActivitiesL(RPointerArray<CAfEntry>& dst, |
|
82 RDbView& query, |
|
83 CAfEntry::AccessRights rights, |
|
84 TInt limit = 0); |
|
85 |
|
86 void GetActivityForUpdateL(RDbView& query, TInt appId, const TDesC& actId); |
|
87 |
|
88 void ReadDataL(RBuf& dst, RDbRowSet& src, TInt offset) const; |
|
89 |
|
90 void ExternalizeDataL(RDbRowSet &dst,const CAfEntry & src, TInt offset) const; |
|
91 |
|
92 void InternalizeDataL(CAfEntry &dst, RDbRowSet& src, TInt offset) const; |
|
93 |
|
94 private: |
|
95 RFs& mFsSession; |
|
96 RDbStoreDatabase mActDb;/* For database operations */ |
|
97 CFileStore* mFileStore; /* For creating and opening database files */ |
|
98 }; |
|
99 |
|
100 #endif //AFSTORAGE_H |
|