99
|
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(RPointerArray<CAfEntry> &dst, CAfEntry &src);
|
|
48 |
|
|
49 |
RFs& Fs();
|
|
50 |
|
|
51 |
static void ThumbnailPathL(RBuf &dst,
|
|
52 |
RFs& fileSystem,
|
|
53 |
TInt uid,
|
|
54 |
const TDesC &activityName,
|
|
55 |
TBool persistent);
|
|
56 |
|
|
57 |
static void StoragePathL(RBuf &dst,
|
|
58 |
RFs& fileSystem,
|
|
59 |
TBool persistent);
|
|
60 |
static void AppStoragePathL(RBuf &dst,
|
|
61 |
RFs& fileSystem,
|
|
62 |
TInt uid,
|
|
63 |
TBool persistent);
|
|
64 |
private:
|
|
65 |
static HBufC8* Md5HexDigestL(const TDesC8 &string);
|
|
66 |
|
|
67 |
private:
|
|
68 |
CAfStorage(RFs& session);
|
|
69 |
|
|
70 |
void ConstructL();
|
|
71 |
|
|
72 |
void CreateDbL(const TDesC& databaseFile);
|
|
73 |
|
|
74 |
void OpenDbL(const TDesC& databaseFile);
|
|
75 |
|
|
76 |
void CreateTableL();
|
|
77 |
|
|
78 |
void DeleteNonPersistentActivitiesL();
|
|
79 |
|
|
80 |
void GetActivitiesL(const TDesC& dst);
|
|
81 |
|
|
82 |
HBufC* SelectRowLC(TInt appId, const TDesC& actId) const;
|
|
83 |
|
|
84 |
HBufC* SelectRowsLC(TInt appId) const;
|
|
85 |
|
|
86 |
HBufC* DeleteRowLC(TInt appId, const TDesC& actId) const;
|
|
87 |
|
|
88 |
HBufC* DeleteRowsLC(TInt appId) const;
|
|
89 |
|
|
90 |
HBufC* BuildQueryLC(const TDesC& format, TInt appId, const TDesC& actId) const;
|
|
91 |
|
|
92 |
void ActivitiesL(RPointerArray<CAfEntry>& dst,
|
|
93 |
const TDesC& query,
|
|
94 |
CAfEntry::AccessRights rights,
|
|
95 |
TInt limit = 0);
|
|
96 |
|
|
97 |
void ActivitiesL(RPointerArray<CAfEntry>& dst,
|
|
98 |
RDbView& query,
|
|
99 |
CAfEntry::AccessRights rights,
|
|
100 |
TInt limit = 0);
|
|
101 |
|
|
102 |
void GetActivityForUpdateL(RDbView& query, TInt appId, const TDesC& actId);
|
|
103 |
|
|
104 |
void ReadDataL(RBuf& dst, RDbRowSet& src, TInt offset) const;
|
|
105 |
|
|
106 |
void ExternalizeDataL(RDbRowSet &dst,const CAfEntry & src, TInt offset) const;
|
|
107 |
|
|
108 |
void InternalizeDataL(CAfEntry &dst, RDbRowSet& src, TInt offset) const;
|
|
109 |
|
|
110 |
private:
|
|
111 |
RFs& mFsSession;
|
|
112 |
RDbStoreDatabase mActDb;/* For database operations */
|
|
113 |
CFileStore* mFileStore; /* For creating and opening database files */
|
|
114 |
};
|
|
115 |
|
|
116 |
#endif //AFSTORAGE_H
|