|
1 /* |
|
2 * Copyright (c) 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 "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: CJavaAttributes header file |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef JAVAATTRIBUTES_H |
|
20 #define JAVAATTRIBUTES_H |
|
21 |
|
22 |
|
23 #include <e32base.h> |
|
24 #include <s32strm.h> |
|
25 |
|
26 #include "javaattribute.h" |
|
27 |
|
28 using namespace Java; |
|
29 |
|
30 namespace Java |
|
31 { |
|
32 namespace Manager |
|
33 { |
|
34 namespace Registry |
|
35 { |
|
36 class CJavaAttributes: public CBase |
|
37 { |
|
38 public: |
|
39 /** |
|
40 * Construct a new attributes array object |
|
41 * @since S60 v5.0 |
|
42 * |
|
43 * |
|
44 * @return a new CJavaAttribute object |
|
45 */ |
|
46 IMPORT_C static CJavaAttributes* NewL(); |
|
47 |
|
48 /** |
|
49 * Construct a new attributes array object and fill array form serialized |
|
50 * buffer |
|
51 * @since S60 v5.0 |
|
52 * |
|
53 * @param aBuffer with serialized CJavaAttributes object |
|
54 * @return a new CJavaAttribute object |
|
55 */ |
|
56 IMPORT_C static CJavaAttributes* NewL(TDesC8* aBuffer); |
|
57 |
|
58 /** |
|
59 * Construct a new attributes array object and leaves the object on |
|
60 * the cleanupstack |
|
61 * @since S60 v5.0 |
|
62 * |
|
63 * |
|
64 * @return a new CJavaAttribute object |
|
65 */ |
|
66 IMPORT_C static CJavaAttributes* NewLC(); |
|
67 |
|
68 /** |
|
69 * Construct a new attributes array object, fill array form serialized |
|
70 * buffer and leaves the object on the cleanupstack |
|
71 * @since S60 v5.0 |
|
72 * |
|
73 * |
|
74 * @param aBuffer with serialized CJavaAttributes object |
|
75 * @return a new CJavaAttribute object |
|
76 */ |
|
77 IMPORT_C static CJavaAttributes* NewLC(TDesC8* aBuffer); |
|
78 |
|
79 /** |
|
80 * Destructor deletes all attributes stored in iAttributes |
|
81 * @since S60 v5.0 |
|
82 * |
|
83 */ |
|
84 virtual ~CJavaAttributes(); |
|
85 |
|
86 /** |
|
87 * Returns number of stored attributes |
|
88 * @since S60 v5.0 |
|
89 * |
|
90 * |
|
91 * @return number of attributes in array |
|
92 */ |
|
93 IMPORT_C TInt Count() const; |
|
94 |
|
95 /** |
|
96 * Returns reference to object with requested Attribute. |
|
97 * @since S60 v5.0 |
|
98 * |
|
99 * |
|
100 * @param aName: name of attribute |
|
101 * @return MJavaAttribute&; Ownership handed over |
|
102 */ |
|
103 IMPORT_C const MJavaAttribute* Attribute(const TDesC& aName) const; |
|
104 |
|
105 /** |
|
106 * Returns copy of attributes storage |
|
107 * @since S60 v5.0 |
|
108 * |
|
109 * |
|
110 * @return RPointerArray<MJavaAttributes> |
|
111 */ |
|
112 IMPORT_C const RPointerArray< MJavaAttribute >& Attributes() const; |
|
113 |
|
114 /** |
|
115 * Add attribute to array. |
|
116 * @since S60 v5.0 |
|
117 * |
|
118 * |
|
119 * @param MJavaAttribute*, Ownership gotten. |
|
120 * @return position of added attribute in array |
|
121 */ |
|
122 IMPORT_C void AddAttributeL(MJavaAttribute* aAttribute); |
|
123 |
|
124 /** |
|
125 * Store attribute to MJavaAttribute and add to array. |
|
126 * @since S60 v5.0 |
|
127 * |
|
128 * |
|
129 * @param aName |
|
130 * @param aValue |
|
131 * @param aTrusted |
|
132 * @return position of added attribute in array |
|
133 */ |
|
134 IMPORT_C void AddAttributeL(const TDesC& aName, const TDesC& aValue, TBool aTrusted); |
|
135 |
|
136 /** |
|
137 * Delete all attributes |
|
138 * |
|
139 * @since S60 v5.0 |
|
140 */ |
|
141 IMPORT_C void DeleteAttributes(); |
|
142 |
|
143 /** |
|
144 * Returns the size needed for serialization. |
|
145 * @since S60 v5.0 |
|
146 * |
|
147 * @return size needed for serialization |
|
148 * @see SerializedPropertiesL |
|
149 */ |
|
150 IMPORT_C TInt Size() const; |
|
151 |
|
152 /** |
|
153 * Returns serialized CJavaAttributes object |
|
154 * @since S60 v5.0 |
|
155 * |
|
156 * |
|
157 * @param aName |
|
158 * @param aValue |
|
159 * @param aTrusted |
|
160 * @return HBufC8* with serialized object, ownership handed over. |
|
161 */ |
|
162 IMPORT_C HBufC8* SerializedAttributesL() const; |
|
163 |
|
164 public: |
|
165 /** |
|
166 * Externalizes the attribete objects. It is used by "<<" operator. |
|
167 * @since S60 v5.0 |
|
168 * |
|
169 * |
|
170 * @param aStream externalization happens in this stream |
|
171 */ |
|
172 virtual void ExternalizeL(RWriteStream& aStream) const; |
|
173 |
|
174 /** |
|
175 * Internalizes the attribute objects. It is used by ">>" operator. |
|
176 * @since S60 v5.0 |
|
177 * |
|
178 * @param aStream internalization happens from this stream |
|
179 */ |
|
180 virtual void InternalizeL(RReadStream& aStream); |
|
181 |
|
182 private: |
|
183 /** |
|
184 * ConstructL does deserialize attributes, if a buffer exists |
|
185 * @since S60 v5.0 |
|
186 * |
|
187 * |
|
188 * @param aBuffer with serialized CJavaAttributes object |
|
189 */ |
|
190 void ConstructL(TDesC8* aBuffer); |
|
191 |
|
192 private: |
|
193 /** |
|
194 * Array of atributes objects |
|
195 * @since S60 v5.0 |
|
196 * |
|
197 */ |
|
198 RPointerArray< MJavaAttribute > iAttributes; |
|
199 |
|
200 }; |
|
201 } // namespace Registry |
|
202 } // namespace Manager |
|
203 } // namespace Java |
|
204 |
|
205 #endif // JAVAATTRIBUTES_H |
|
206 |
|
207 |
|
208 // End of File |