|
1 /** @file |
|
2 * Copyright (c) 2005-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: Declares CUpnpIcon class |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef C_CUPNPICON_H |
|
20 #define C_CUPNPICON_H |
|
21 |
|
22 // INCLUDES |
|
23 |
|
24 #include <badesca.h> |
|
25 #include <upnpdescriptionproperty.h> |
|
26 #include <s32mem.h> |
|
27 // CONSTANTS |
|
28 |
|
29 _LIT8( KUrl, "url" ); |
|
30 _LIT8( KWidth, "width" ); |
|
31 _LIT8( KDepth, "depth" ); |
|
32 _LIT8( KHeight, "height" ); |
|
33 _LIT8( KMimeType, "mimetype" ); |
|
34 |
|
35 const TInt KMaxNumberPropertySize=10; |
|
36 const TInt KMaxMimeTypeSize = 20; |
|
37 const TInt KDefBuffer = 100; |
|
38 |
|
39 // CLASS DECLARATION |
|
40 |
|
41 /** |
|
42 * Declares CUpnpIcon class |
|
43 * |
|
44 * @since Series60 2.6 |
|
45 */ |
|
46 class CUpnpIcon : public CBase |
|
47 { |
|
48 public: // Constructors and destructor |
|
49 |
|
50 /** |
|
51 * Two-phased constructor. returns a pointer to the new element. |
|
52 * @param aElement This reference contains the state variable element |
|
53 */ |
|
54 IMPORT_C static CUpnpIcon* NewL( ); |
|
55 |
|
56 /** |
|
57 * Two-phased constructor. returns a pointer to the new element. |
|
58 * @param aPath icon path |
|
59 * @param aUrl icon url |
|
60 * @param aWidth icon width |
|
61 * @param aHeight icon height |
|
62 * @param aDepth icon depth |
|
63 * @param aMimeType icon mime type |
|
64 */ |
|
65 IMPORT_C static CUpnpIcon* NewL(const TDesC16& aPath, const TDesC8& aUrl, const TInt aWidth, const TInt aHeight, const TInt aDepth, const TDesC8& aMimeType); |
|
66 |
|
67 /** |
|
68 * Two-phased constructor. returns a pointer to the new element. |
|
69 * @param aPath icon path |
|
70 * @param aWidth icon width |
|
71 * @param aHeight icon height |
|
72 * @param aDepth icon depth |
|
73 * @param aMimeType icon mime type |
|
74 */ |
|
75 IMPORT_C static CUpnpIcon* NewL(const TDesC16& aPath, const TInt aWidth, const TInt aHeight, const TInt aDepth, const TDesC8& aMimeType); |
|
76 |
|
77 /** |
|
78 * Destructor. Deletes the element from memory. |
|
79 */ |
|
80 IMPORT_C virtual ~CUpnpIcon(); |
|
81 |
|
82 |
|
83 public: // New functions |
|
84 |
|
85 /** |
|
86 * Returns the mime type. |
|
87 * @since Series60 2.6 |
|
88 * @return return icon mime type |
|
89 */ |
|
90 IMPORT_C const TPtrC8 MimeType() const; |
|
91 |
|
92 /** |
|
93 * Returns the width of the icon. |
|
94 * @since Series60 2.6 |
|
95 * @return width in pixels or KErrNotFound |
|
96 */ |
|
97 IMPORT_C TInt Width() const; |
|
98 |
|
99 /** |
|
100 * Returns the width of the icon. |
|
101 * @since Series60 2.6 |
|
102 * @return icon width |
|
103 */ |
|
104 TPtrC8 WidthTPtrC8() const; |
|
105 |
|
106 /** |
|
107 * Returns the height of the icon. |
|
108 * @since Series60 2.6 |
|
109 * @return height in pixels or KErrNotFound |
|
110 */ |
|
111 IMPORT_C TInt Height() const; |
|
112 |
|
113 /** |
|
114 * Returns height of the icon. |
|
115 * @since Series60 2.6 |
|
116 * @return icon height |
|
117 */ |
|
118 TPtrC8 HeightTPtrC8() const; |
|
119 |
|
120 /** |
|
121 * Returns the color depth of the icon. |
|
122 * @since Series60 2.6 |
|
123 * @return icon depth or KErrNotFound |
|
124 */ |
|
125 IMPORT_C TInt Depth() const; |
|
126 |
|
127 /** |
|
128 * Returns color depth of the icon. |
|
129 * @since Series60 2.6 |
|
130 * @return icon depth |
|
131 */ |
|
132 TPtrC8 DepthTPtrC8() const; |
|
133 |
|
134 /** |
|
135 * Returns the url address. |
|
136 * @since Series60 2.6 |
|
137 * @return url address or NULL |
|
138 */ |
|
139 IMPORT_C const TPtrC8 Url() const; |
|
140 |
|
141 /** |
|
142 * Returns the icon buffer |
|
143 * @since Series60 2.6 |
|
144 * @return icon buffer |
|
145 */ |
|
146 IMPORT_C const TPtr8& GetIconBufferPtr() const; |
|
147 |
|
148 /** |
|
149 * Get bitmap filename |
|
150 * @since Series60 2.6 |
|
151 * @return bitmap filename |
|
152 */ |
|
153 IMPORT_C TFileName BitmapFilename() const; |
|
154 |
|
155 /** |
|
156 * Set bitmap filename |
|
157 * @since Series60 2.6 |
|
158 * @param aName the bitmap filename (path?) |
|
159 */ |
|
160 IMPORT_C void SetBitmapFilename( const TDesC& aName ); |
|
161 |
|
162 /** |
|
163 * Sets icon mime type |
|
164 * @since Series60 2.6 |
|
165 * @param aMimeType icon mime type |
|
166 */ |
|
167 void SetMimeTypeL( const TDesC8& aMimeType ); |
|
168 |
|
169 /** |
|
170 * Sets icon url |
|
171 * @since Series60 2.6 |
|
172 * @param aUrl icon url |
|
173 */ |
|
174 IMPORT_C void SetUrlL( const TDesC8& aUrl ); |
|
175 |
|
176 /** |
|
177 * Sets icon width |
|
178 * @since Series60 2.6 |
|
179 * @param aWidth icon width |
|
180 */ |
|
181 void SetWidthL( const TInt aWidth ); |
|
182 |
|
183 /** |
|
184 * Sets icon height |
|
185 * @since Series60 2.6 |
|
186 * @param aHeight icon height |
|
187 */ |
|
188 void SetHeightL( const TInt aHeight ); |
|
189 |
|
190 /** |
|
191 * Sets icon depth |
|
192 * @since Series60 2.6 |
|
193 * @param aDepth icon depth |
|
194 */ |
|
195 void SetDepthL( const TInt aDepth ); |
|
196 |
|
197 /** |
|
198 * Add description property |
|
199 * @since Series60 3.2 |
|
200 * @param aProperty |
|
201 */ |
|
202 void AddPropertyL( CUpnpDescriptionProperty* aProperty ); |
|
203 |
|
204 /** |
|
205 * Deserializes icon |
|
206 * @since Series60 3.2 |
|
207 * @param aStream |
|
208 */ |
|
209 void ExternalizeL( RWriteStream& aStream ) const; |
|
210 |
|
211 /** |
|
212 * Serializes icon |
|
213 * @since Series60 3.2 |
|
214 * @param aStream |
|
215 */ |
|
216 IMPORT_C void InternalizeL( RReadStream& aStream ); |
|
217 |
|
218 /** |
|
219 * @since Series60 3.2 |
|
220 * @return serialized icon |
|
221 */ |
|
222 IMPORT_C HBufC8* ToDes8L() const; |
|
223 |
|
224 private: // Constructors |
|
225 |
|
226 /** |
|
227 * By default Symbian 2nd phase constructor is private. |
|
228 * @param aElement |
|
229 */ |
|
230 void ConstructL( ); |
|
231 |
|
232 /** |
|
233 * By default Symbian 2nd phase constructor is private. |
|
234 * @param aPath icon path |
|
235 * @param aUrl icon url |
|
236 * @param aWidth icon width |
|
237 * @param aHeight icon height |
|
238 * @param aDepth icon depth |
|
239 * @param aMimeType icon mime type |
|
240 */ |
|
241 void CUpnpIcon::ConstructL(const TDesC16& aPath, const TDesC8& aUrl, const TInt aWidth, const TInt aHeight, const TInt aDepth, const TDesC8& aMimeType); |
|
242 |
|
243 /** |
|
244 * By default Symbian 2nd phase constructor is private. |
|
245 * @param aPath icon path |
|
246 * @param aWidth icon width |
|
247 * @param aHeight icon height |
|
248 * @param aDepth icon depth |
|
249 * @param aMimeType icon mime type |
|
250 */ |
|
251 void CUpnpIcon::ConstructL(const TDesC16& aPath, const TInt aWidth, const TInt aHeight, const TInt aDepth, const TDesC8& aMimeType); |
|
252 |
|
253 |
|
254 /** |
|
255 * C++ default constructor. |
|
256 * @param aElement |
|
257 */ |
|
258 CUpnpIcon(); |
|
259 |
|
260 /** |
|
261 * Deletes icon's file if exists. |
|
262 * @since Series60 2.6 |
|
263 */ |
|
264 void DeleteIconFromFsL(); |
|
265 |
|
266 private: // Data |
|
267 |
|
268 // Buffer to pass data to server |
|
269 HBufC8* iSendBuffer; |
|
270 TPtr8 iSendBufferPtr; |
|
271 |
|
272 // XML element containing icon description |
|
273 RPointerArray<CUpnpDescriptionProperty> iProperties; |
|
274 |
|
275 // iFileName the bitmap filename, owned |
|
276 TFileName iFilename; |
|
277 }; |
|
278 |
|
279 #endif //C_CUPNPICON_H |
|
280 |
|
281 // End of File |