31
|
1 |
/*
|
|
2 |
* Copyright (c) 2006-2006 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 the License "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: Stores element data and writes it to stream
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
#ifndef CBSSTORAGE_H
|
|
21 |
#define CBSSTORAGE_H
|
|
22 |
|
|
23 |
#include <e32base.h>
|
|
24 |
|
|
25 |
#include "rbsobjowningptrarray.h"
|
|
26 |
|
|
27 |
class MBSElement;
|
|
28 |
class RWriteStream;
|
|
29 |
class MBSImportLogger;
|
|
30 |
|
|
31 |
|
|
32 |
/**
|
|
33 |
* Stores element data and writes it to stream
|
|
34 |
*
|
|
35 |
* @lib brandimporter.exe
|
|
36 |
* @since S60 v3.2
|
|
37 |
*/
|
|
38 |
class CBSStorage : public CBase
|
|
39 |
{
|
|
40 |
public:
|
|
41 |
|
|
42 |
static CBSStorage* NewL();
|
|
43 |
|
|
44 |
static CBSStorage* NewLC();
|
|
45 |
|
|
46 |
~CBSStorage();
|
|
47 |
|
|
48 |
/**
|
|
49 |
* Set version of brand storage
|
|
50 |
*
|
|
51 |
* @since S60 3.2
|
|
52 |
* @param aVersion version
|
|
53 |
*/
|
|
54 |
void SetVersion( TInt aVersion );
|
|
55 |
|
|
56 |
/**
|
|
57 |
* Set application ID of brand storage
|
|
58 |
*
|
|
59 |
* @since S60 3.2
|
|
60 |
* @param aAppId application ID
|
|
61 |
* @return none
|
|
62 |
*/
|
|
63 |
void SetApplicationIdL( const TDesC& aAppId );
|
|
64 |
|
|
65 |
/**
|
|
66 |
* Set storage ID of brand storage
|
|
67 |
*
|
|
68 |
* @since S60 3.2
|
|
69 |
* @param aStorageId storage ID
|
|
70 |
* @return none
|
|
71 |
*/
|
|
72 |
void SetStorageIdL( const TDesC& aStorageId );
|
|
73 |
|
|
74 |
/**
|
|
75 |
* Set language of brand storage
|
|
76 |
*
|
|
77 |
* @since S60 3.2
|
|
78 |
* @param aLanguage language
|
|
79 |
* @return none
|
|
80 |
*/
|
|
81 |
void SetLanguageL( TLanguage aLanguage );
|
|
82 |
|
|
83 |
/**
|
|
84 |
* Store element to storage. Storage takes the ownership of element.
|
|
85 |
*
|
|
86 |
* @since S60 3.2
|
|
87 |
* @param aElement element to store.
|
|
88 |
* @return General Symbian errorcode.
|
|
89 |
*/
|
|
90 |
void AppendElementsL( MBSElement* aElement );
|
|
91 |
|
|
92 |
/**
|
|
93 |
* Return the count of elements in storage
|
|
94 |
*
|
|
95 |
* @since S60 3.2
|
|
96 |
* @return count of elements
|
|
97 |
*/
|
|
98 |
TInt ElementCount();
|
|
99 |
|
|
100 |
/**
|
|
101 |
* Externalize storage into stream
|
|
102 |
*
|
|
103 |
* @since S60 3.2
|
|
104 |
* @param aWriteStream output stream
|
|
105 |
* @return none
|
|
106 |
*/
|
|
107 |
void ExternalizeL( RWriteStream& aWriteStream );
|
|
108 |
|
|
109 |
/**
|
|
110 |
* Replaces an element in the storage
|
|
111 |
*
|
|
112 |
* @since S60 3.2
|
|
113 |
* @param aElement the element to be replaced
|
|
114 |
*/
|
|
115 |
void ReplaceElementL( MBSElement* aElement );
|
|
116 |
|
|
117 |
|
|
118 |
TPtrC ProposeFileNameL();
|
|
119 |
TPtrC ProposedDirL();
|
|
120 |
void GetListOfFilesL( RArray<TPtrC>& aFileList );
|
|
121 |
|
|
122 |
private:
|
|
123 |
|
|
124 |
CBSStorage();
|
|
125 |
|
|
126 |
void ConstructL();
|
|
127 |
|
|
128 |
/**
|
|
129 |
* Check that header information is complete
|
|
130 |
*
|
|
131 |
* @since S60 3.2
|
|
132 |
* @return ETrue - header information ok
|
|
133 |
* EFalse - header information missing or incomplete
|
|
134 |
*/
|
|
135 |
TBool VerifyHeader();
|
|
136 |
|
|
137 |
TBool VerifyDataL( TArray<MBSElement*> aArray,
|
|
138 |
TBool aIgnoreEmptyID = EFalse );
|
|
139 |
TBool VerifyDataL( RBSObjOwningPtrArray<MBSElement>& aArray,
|
|
140 |
TBool aIgnoreEmptyID = EFalse );
|
|
141 |
|
|
142 |
void HandleIfErrorL( TInt aError, const TDesC& aText );
|
|
143 |
|
|
144 |
void AppendFilesL( MBSElement* aElement, RArray<TPtrC>& aFileList );
|
|
145 |
|
|
146 |
private: // Data
|
|
147 |
|
|
148 |
// Own. Array of stored elements.
|
|
149 |
RBSObjOwningPtrArray<MBSElement> iElements;
|
|
150 |
|
|
151 |
// Own. Proposed file name
|
|
152 |
HBufC* iFilename;
|
|
153 |
|
|
154 |
// Proposed directory (points to iFilename)
|
|
155 |
TPtrC iDir;
|
|
156 |
|
|
157 |
// HEADER DATA
|
|
158 |
|
|
159 |
// Version number of storage
|
|
160 |
TInt iVersion;
|
|
161 |
|
|
162 |
// Own. Language ID of storage
|
|
163 |
HBufC* iLanguage;
|
|
164 |
|
|
165 |
// Own. Application ID of storage
|
|
166 |
HBufC* iAppId;
|
|
167 |
|
|
168 |
// Own. Storage ID.of storage
|
|
169 |
HBufC* iStorageId;
|
|
170 |
};
|
|
171 |
|
|
172 |
#endif //CBSSTORAGE_H
|