|
1 // Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // Resource reader |
|
15 // |
|
16 // |
|
17 |
|
18 #include <barsc2.h> |
|
19 #include <barsread2.h> |
|
20 #include "BaRsReadImpl.h" |
|
21 |
|
22 /** It creates the implementation in place - iImpl array, |
|
23 and sets the default leave/panic behaviour of the object - |
|
24 the object "L" methods will leave if something goes wrong. |
|
25 */ |
|
26 EXPORT_C RResourceReader::RResourceReader() : |
|
27 iRscBuffer(NULL) |
|
28 { |
|
29 new (iImpl) TResourceReaderImpl; |
|
30 TBaAssert assertObj(TBaAssert::ELeave); |
|
31 Impl()->SetAssertObj(assertObj); |
|
32 } |
|
33 |
|
34 /** The method calls RResourceReader::Close() method to release |
|
35 allocated by the instance resources. |
|
36 */ |
|
37 EXPORT_C RResourceReader::~RResourceReader() |
|
38 { |
|
39 Close(); |
|
40 } |
|
41 |
|
42 /** |
|
43 Sets the buffer containing the resource data. |
|
44 |
|
45 The current position within the buffer is set to the start of the buffer so |
|
46 that subsequent calls to the interpreting functions, for example ReadInt8(), |
|
47 start at the beginning of this buffer. |
|
48 @param aRscFile A pointer to the CResourceFile object, used as a resource data supplier. |
|
49 @param aResourceId The numeric id of the resource to be read. |
|
50 @panic 0 If aRscFile is NULL. |
|
51 */ |
|
52 EXPORT_C void RResourceReader::OpenL(const CResourceFile* aRscFile, TInt aResourceId) |
|
53 { |
|
54 OpenLC(aRscFile, aResourceId); |
|
55 CleanupStack::Pop(this); |
|
56 } |
|
57 |
|
58 /** |
|
59 Sets the buffer containing the resource data. |
|
60 |
|
61 The current position within the buffer is set to the start of the buffer so |
|
62 that subsequent calls to the interpreting functions, for example ReadInt8(), |
|
63 start at the beginning of this buffer. |
|
64 |
|
65 A pointer to current RResourceReader instance is placed into the cleanup stack. |
|
66 |
|
67 @param aRscFile A pointer to the CResourceFile object, used as a resource data supplier. |
|
68 @param aResourceId Numeric id of the resource to be read. |
|
69 @panic 0 If aRscFile is NULL. |
|
70 */ |
|
71 EXPORT_C void RResourceReader::OpenLC(const CResourceFile* aRscFile, TInt aResourceId) |
|
72 { |
|
73 __ASSERT_DEBUG(aRscFile, User::Invariant()); |
|
74 Close(); |
|
75 iRscBuffer = aRscFile->AllocReadL(aResourceId); |
|
76 Impl()->SetBuffer(iRscBuffer); |
|
77 CleanupClosePushL(*this); |
|
78 } |
|
79 |
|
80 /** |
|
81 Sets the buffer containing the resource data. |
|
82 |
|
83 The current position within the buffer is set to the start of the buffer so |
|
84 that subsequent calls to the interpreting functions, for example ReadInt8(), |
|
85 start at the beginning of this buffer. |
|
86 |
|
87 @param aRscData A reference to an 8 bit descriptor containing or representing resource data. |
|
88 */ |
|
89 EXPORT_C void RResourceReader::OpenL(const TDesC8& aRscData) |
|
90 { |
|
91 OpenLC(aRscData); |
|
92 CleanupStack::Pop(this); |
|
93 } |
|
94 |
|
95 /** |
|
96 Sets the buffer containing the resource data. |
|
97 |
|
98 The current position within the buffer is set to the start of the buffer so |
|
99 that subsequent calls to the interpreting functions, for example ReadInt8(), |
|
100 start at the beginning of this buffer. |
|
101 |
|
102 A pointer to current RResourceReader instance is placed into the cleanup stack. |
|
103 |
|
104 @param aRscData A reference to an 8 bit descriptor containing or representing resource data. |
|
105 */ |
|
106 EXPORT_C void RResourceReader::OpenLC(const TDesC8& aRscData) |
|
107 { |
|
108 Close(); |
|
109 CleanupClosePushL(*this); |
|
110 iRscBuffer = aRscData.AllocL(); |
|
111 Impl()->SetBuffer(iRscBuffer); |
|
112 } |
|
113 |
|
114 /** |
|
115 Destroys the buffer containing the resource data. |
|
116 |
|
117 Open() method should be called if you want to set |
|
118 the buffer and current position again. |
|
119 |
|
120 If a one or more copies of the same RResourceReader object exist - they share the same |
|
121 resource data buffer. So destroying the RResourceReader object you will destroy the |
|
122 shared resource data buffer. |
|
123 |
|
124 @post Buffer pointer is set to NULL. |
|
125 @post Buffer current position pointer is set to NULL. |
|
126 */ |
|
127 EXPORT_C void RResourceReader::Close() |
|
128 { |
|
129 delete iRscBuffer; |
|
130 iRscBuffer = NULL; |
|
131 Impl()->ResetBuffer(); |
|
132 } |
|
133 |
|
134 /** Interprets the data at the current buffer position as leading byte count data |
|
135 and constructs an 8 bit heap descriptor containing a copy of this data. |
|
136 |
|
137 The data is interpreted as: |
|
138 |
|
139 a byte value defining the number of 8 bit text characters or the length of |
|
140 binary data (the resource string/binary data length is limited to 255 characters max) |
|
141 |
|
142 followed by: |
|
143 |
|
144 the 8 bit text characters or binary data. |
|
145 |
|
146 If the value of the leading byte is zero, the function assumes that no data |
|
147 follows the leading byte and returns a NULL pointer. |
|
148 |
|
149 The current position within the resource buffer is updated. |
|
150 |
|
151 Use this explicit 8Â bit variant when the resource contains binary data. If |
|
152 the resource contains text, then use the build independent variant ReadHBufCL(). |
|
153 |
|
154 In general, this type of resource data corresponds to one of the following: |
|
155 |
|
156 a LTEXT type in a resource STRUCT declaration. |
|
157 |
|
158 a variable length array within a STRUCT declaration which includes the LEN |
|
159 BYTE keywords. |
|
160 |
|
161 @pre Open() is called to initialize RResourceReader data members. |
|
162 @return Pointer to the 8Â bit heap descriptor containing a copy of the data |
|
163 following the leading byte count at the current position within the resource |
|
164 buffer. The pointer can be NULL. |
|
165 @post Current buffer position is updated. |
|
166 @leave KErrEof The new buffer position is beyond the buffer end. */ |
|
167 EXPORT_C HBufC8* RResourceReader::ReadHBufC8L() |
|
168 { |
|
169 return Impl()->ReadHBufC8L(); |
|
170 } |
|
171 |
|
172 /** Interprets the data at the current buffer position as leading byte count data |
|
173 and constructs a 16 bit heap descriptor containing a copy of this data. |
|
174 |
|
175 The data is interpreted as: |
|
176 |
|
177 a byte value defining the number of 16 bit text characters |
|
178 (the resource string/binary data length is limited to 255 characters max) |
|
179 |
|
180 followed by: |
|
181 |
|
182 the 16 bit text characters. |
|
183 |
|
184 If the value of the leading byte is zero, the function assumes that no data |
|
185 follows the leading byte and returns a NULL pointer. |
|
186 |
|
187 The current position within the resource buffer is updated. |
|
188 |
|
189 Do not use this explicit 16Â bit variant when the resource contains binary |
|
190 data; use the explicit 8Â bit variant instead. If the resource contains text, |
|
191 use the build independent variant ReadHBufCL(). |
|
192 |
|
193 @pre Open() is called to initialize RResourceReader data members. |
|
194 @return Pointer to the 16Â bit heap descriptor containing a copy of the |
|
195 data following the leading byte count at the current position within the resource |
|
196 buffer. The pointer can be NULL. |
|
197 @post Current buffer position is updated. |
|
198 @leave KErrCorrupt The new buffer position is beyond the buffer end. */ |
|
199 EXPORT_C HBufC16* RResourceReader::ReadHBufC16L() |
|
200 { |
|
201 return Impl()->ReadHBufC16L(); |
|
202 } |
|
203 |
|
204 /** Interprets the data at the current buffer position as leading byte count data |
|
205 and constructs an 8 bit non modifiable pointer descriptor to represent this |
|
206 data. |
|
207 |
|
208 The data is interpreted as: |
|
209 |
|
210 a byte value defining the number of text characters or the length of binary |
|
211 data (the resource string/binary data length is limited to 255 characters max) |
|
212 |
|
213 followed by: |
|
214 |
|
215 the 8 bit text characters or binary data. |
|
216 |
|
217 If the value of the leading byte is zero, calling Length() on the returned |
|
218 TPtrC8 returns zero. |
|
219 |
|
220 The current position within the resource buffer is updated. |
|
221 |
|
222 Use this explicit 8Â bit variant when the resource contains binary data. If |
|
223 the resource contains text, then use the build independent variant ReadTPtrC(). |
|
224 |
|
225 In general, this type of resource data corresponds to one of the following: |
|
226 |
|
227 a LTEXT type in a resource STRUCT declaration. |
|
228 |
|
229 a variable length array within a STRUCT declaration which includes the LEN |
|
230 BYTE keywords. |
|
231 |
|
232 @pre Open() is called to initialize RResourceReader data members. |
|
233 @return 8bit non modifiable pointer descriptor representing |
|
234 the data following the leading byte count at the |
|
235 current position within the resource buffer. |
|
236 @post Current buffer position is updated. |
|
237 @leave KErrEof The new buffer position is beyond the buffer end. */ |
|
238 EXPORT_C TPtrC8 RResourceReader::ReadTPtrC8L() |
|
239 { |
|
240 return Impl()->ReadTPtrC8L(); |
|
241 } |
|
242 |
|
243 /** Interprets the data at the current buffer position as leading byte count data |
|
244 and constructs a 16 bit non modifiable pointer descriptor to represent this |
|
245 data. |
|
246 |
|
247 The data is interpreted as: |
|
248 |
|
249 a byte value defining the number of 16 bit text characters |
|
250 (the resource string/binary data length is limited to 255 characters max) |
|
251 |
|
252 followed by: |
|
253 |
|
254 the 16 bit text characters. |
|
255 |
|
256 If the value of the leading byte is zero, calling Length() on the returned |
|
257 TPtrC16 returns zero. |
|
258 |
|
259 The current position within the resource buffer is updated. |
|
260 |
|
261 Do not use this explicit 16Â bit variant when the resource contains binary |
|
262 data; use the explicit 8Â bit variant instead. If the resource contains text, |
|
263 use the build independent variant ReadTPtrC(). |
|
264 |
|
265 @pre Open() is called to initialize RResourceReader data members. |
|
266 @return 16 bit non modifiable pointer descriptor representing |
|
267 the data following the leading byte count at the |
|
268 current position within the resource buffer. |
|
269 @post Current buffer position is updated. |
|
270 @leave KErrCorrupt The new buffer position is beyond the buffer end. */ |
|
271 EXPORT_C TPtrC16 RResourceReader::ReadTPtrC16L() |
|
272 { |
|
273 return Impl()->ReadTPtrC16L(); |
|
274 } |
|
275 |
|
276 /** Interprets the data at the current buffer position as an array of leading byte |
|
277 count data and constructs a flat array of 8 bit descriptors. |
|
278 |
|
279 Each descriptor in the descriptor array corresponds to an element of the resource |
|
280 array. |
|
281 |
|
282 At the current buffer position, the buffer is expected to contain an array |
|
283 of data elements preceded by a TInt16 value defining the number of elements |
|
284 within that array. |
|
285 |
|
286 Each element of the array is interpreted as: |
|
287 |
|
288 a byte value defining the number of 8 bit text characters or the length of |
|
289 binary data (the resource string/binary data length is limited to 255 characters max) |
|
290 |
|
291 followed by: |
|
292 |
|
293 the text characters or binary data. |
|
294 |
|
295 The current position within the resource buffer is updated. |
|
296 |
|
297 Use this explicit 8Â bit variant when the resource contains binary data. If |
|
298 the elements of the resource array contain text, use the build independent |
|
299 variant of ReadDesCArrayL(). |
|
300 |
|
301 @pre Open() is called to initialize RResourceReader data members. |
|
302 @return Pointer to an 8bit variant flat descriptor array. |
|
303 @post Current buffer position is updated. |
|
304 @leave KErrEof The new buffer position is beyond the buffer end. */ |
|
305 EXPORT_C CDesC8ArrayFlat* RResourceReader::ReadDesC8ArrayL() |
|
306 { |
|
307 return Impl()->ReadDesC8ArrayL(); |
|
308 } |
|
309 |
|
310 /** Interprets the data at the current buffer position as an array of leading byte |
|
311 count data and constructs a flat array of 16 bit descriptors. |
|
312 |
|
313 Each descriptor in the descriptor array corresponds to an element of the resource |
|
314 array. |
|
315 |
|
316 At the current buffer position, the buffer is expected to contain an array |
|
317 of data elements preceded by a TInt16 value defining the number of elements |
|
318 within that array. |
|
319 |
|
320 Each element of the array is interpreted as: |
|
321 |
|
322 a byte value defining the number of 8 bit text characters or the length of |
|
323 binary data (the resource string/binary data length is limited to 255 characters max) |
|
324 |
|
325 followed by: |
|
326 |
|
327 the 16 bit text characters. |
|
328 |
|
329 The current position within the resource buffer is updated. |
|
330 |
|
331 Do not use this explicit 16Â bit variant when the resource contains binary |
|
332 data; use the explicit 8Â bit variant instead. If the resource contains text, |
|
333 use the build independent variant ReadDesCArrayL(). |
|
334 |
|
335 @pre Open() is called to initialize RResourceReader data members. |
|
336 @return Pointer to a 16bit variant flat descriptor array. |
|
337 @post Current buffer position is updated. |
|
338 @leave KErrEof The new buffer position is beyond the buffer end. */ |
|
339 EXPORT_C CDesC16ArrayFlat* RResourceReader::ReadDesC16ArrayL() |
|
340 { |
|
341 return Impl()->ReadDesC16ArrayL(); |
|
342 } |
|
343 |
|
344 /** Interprets the data at the current buffer position as a TInt8 type and returns |
|
345 the value as a TInt. |
|
346 |
|
347 The current position within the resource buffer is updated. |
|
348 |
|
349 In general, a TInt8 corresponds to a BYTE type in a resource STRUCT declaration. |
|
350 |
|
351 Note that in Symbian OS, a TInt is at least as big as a TInt8. |
|
352 |
|
353 @pre Open() is called to initialize RResourceReader data members. |
|
354 @return The TInt8 value taken from the resource buffer. |
|
355 @post Current buffer position is updated. |
|
356 @leave KErrEof The new buffer position is beyond the buffer end. */ |
|
357 EXPORT_C TInt RResourceReader::ReadInt8L() |
|
358 { |
|
359 return Impl()->ReadInt8L(); |
|
360 } |
|
361 |
|
362 /** Interprets the data at the current buffer position as a TUint8 type and returns |
|
363 the value as a TUint. |
|
364 |
|
365 The current position within the resource buffer is updated. |
|
366 |
|
367 In general, a TUint8 corresponds to a BYTE type in a resource STRUCT declaration. |
|
368 |
|
369 Note that in Symbian OS, a TUint is at least as big as a TUint8. |
|
370 |
|
371 @pre Open() is called to initialize RResourceReader data members. |
|
372 @return The TUint8 value taken from the resource buffer. |
|
373 @post Current buffer position is updated. |
|
374 @leave KErrEof The new buffer position is beyond the buffer end. */ |
|
375 EXPORT_C TUint RResourceReader::ReadUint8L() |
|
376 { |
|
377 return Impl()->ReadUint8L(); |
|
378 } |
|
379 |
|
380 /** Interprets the data at the current buffer position as a TInt16 type and returns |
|
381 the value as a TInt. |
|
382 |
|
383 The current position within the resource buffer is updated. |
|
384 |
|
385 In general, a TInt16 corresponds to a WORD type in a resource STRUCT declaration. |
|
386 |
|
387 Note that in Symbian OS, a TInt is at least as big as a TInt16. |
|
388 |
|
389 @pre Open() is called to initialize RResourceReader data members. |
|
390 @return The TInt16 value taken from the resource buffer. |
|
391 @post Current buffer position is updated. |
|
392 @leave KErrEof The new buffer position is beyond the buffer end. */ |
|
393 EXPORT_C TInt RResourceReader::ReadInt16L() |
|
394 { |
|
395 return Impl()->ReadInt16L(); |
|
396 } |
|
397 |
|
398 /** Interprets the data at the current buffer position as a TUint16 type and returns |
|
399 the value as a TUint. |
|
400 |
|
401 The current position within the resource buffer is updated. |
|
402 |
|
403 In general, a TUint16 corresponds to a WORD type in a resource STRUCT declaration. |
|
404 |
|
405 Note that in Symbian OS, a TUint is at least as big as a TUint16. |
|
406 |
|
407 @pre Open() is called to initialize RResourceReader data members. |
|
408 @return The TUint16 value taken from the resource buffer. |
|
409 @post Current buffer position is updated. |
|
410 @leave KErrEof The new buffer position is beyond the buffer end. */ |
|
411 EXPORT_C TUint RResourceReader::ReadUint16L() |
|
412 { |
|
413 return Impl()->ReadUint16L(); |
|
414 } |
|
415 |
|
416 /** Interprets the data at the current buffer position as a TInt32 type and returns |
|
417 the value as a TInt. |
|
418 |
|
419 The current position within the resource buffer is updated. |
|
420 |
|
421 In general, a TInt32 corresponds to a LONG type in a resource STRUCT declaration. |
|
422 |
|
423 Note that in Symbian OS, TInt and TInt32 are the same size. |
|
424 |
|
425 @pre Open() is called to initialize RResourceReader data members. |
|
426 @return The TInt32 value taken from the resource buffer. |
|
427 @post Current buffer position is updated. |
|
428 @leave KErrEof The new buffer position is beyond the buffer end. */ |
|
429 EXPORT_C TInt RResourceReader::ReadInt32L() |
|
430 { |
|
431 return Impl()->ReadInt32L(); |
|
432 } |
|
433 |
|
434 /** Interprets the data at the current buffer position as a TUint32 type and returns |
|
435 the value as a TUint. |
|
436 |
|
437 The current position within the resource buffer is updated. |
|
438 |
|
439 In general, a TUint32 corresponds to a LONG type in a resource STRUCT declaration. |
|
440 |
|
441 Note that in Symbian OS a TUint is the same size as a TUint32. |
|
442 |
|
443 @pre Open() is called to initialize RResourceReader data members. |
|
444 @return The TUint32 value taken from the resource buffer. |
|
445 @post Current buffer position is updated. |
|
446 @leave KErrEof The new buffer position is beyond the buffer end. */ |
|
447 EXPORT_C TUint RResourceReader::ReadUint32L() |
|
448 { |
|
449 return Impl()->ReadUint32L(); |
|
450 } |
|
451 |
|
452 /** Interprets the data at the current buffer position as a TReal64 type and returns |
|
453 the value as a TReal64. |
|
454 |
|
455 The current position within the resource buffer is updated. |
|
456 |
|
457 In general, a TReal64 corresponds to a DOUBLE type in a resource STRUCT declaration. |
|
458 |
|
459 @pre Open() is called to initialize RResourceReader data members. |
|
460 @return The TReal64 value taken from the resource buffer. |
|
461 @post Current buffer position is updated. |
|
462 @leave KErrEof The new buffer position is beyond the buffer end. */ |
|
463 EXPORT_C TReal64 RResourceReader::ReadReal64L() __SOFTFP |
|
464 { |
|
465 return Impl()->ReadReal64L(); |
|
466 } |
|
467 |
|
468 /** Copies a specified length of data from the resource buffer, starting at the |
|
469 current position within the buffer, into the location pointed to by a specified |
|
470 pointer. No assumption is made about the type of data at being read. |
|
471 |
|
472 The current position within the resource buffer is updated. |
|
473 |
|
474 @pre Open() is called to initialize RResourceReader data members. |
|
475 @param aPtr Pointer to the target location for data copied from the resource buffer. |
|
476 @param aLength The length of data to be copied from the resource buffer. |
|
477 @post Current buffer position is updated. |
|
478 @leave KErrEof The new buffer position is beyond the buffer end. */ |
|
479 EXPORT_C void RResourceReader::ReadL(TAny* aPtr,TInt aLength) |
|
480 { |
|
481 Impl()->ReadL(aPtr,aLength); |
|
482 } |
|
483 |
|
484 /** Moves the current buffer position backwards by the specified amount. |
|
485 |
|
486 @pre Open() is called to initialize RResourceReader data members. |
|
487 @param aLength The length by which the current position is to be moved backward. |
|
488 @post Current buffer position is updated. |
|
489 @leave KErrArgument The resulting position lies before the start of the resource. */ |
|
490 EXPORT_C void RResourceReader::RewindL(TInt aLength) |
|
491 { |
|
492 Impl()->RewindL(aLength); |
|
493 } |
|
494 |
|
495 /** Moves the current buffer position forwards by the specified amount. |
|
496 If the resulting position lies beyond the end of the resource buffer, |
|
497 then the function leaves with KErrEof code. |
|
498 |
|
499 @pre Open() is called to initialize RResourceReader data members. |
|
500 @param aLength The length by which the current position is to be advanced. |
|
501 @post Current buffer position is updated. |
|
502 @leave KErrEof The resulting position lies beyond the end of the resource buffer. */ |
|
503 EXPORT_C void RResourceReader::AdvanceL(TInt aLength) |
|
504 { |
|
505 Impl()->AdvanceL(aLength); |
|
506 } |
|
507 |
|
508 #if defined(_UNICODE) |
|
509 /** Interprets the data at the current buffer position as leading byte count data |
|
510 and constructs a build independent heap descriptor containing a copy of this |
|
511 data. |
|
512 |
|
513 The data is interpreted as: |
|
514 |
|
515 a byte value defining the number of text characters or the length of binary |
|
516 data (the resource string/binary data length is limited to 255 characters max) |
|
517 |
|
518 followed by: |
|
519 |
|
520 the text characters or binary data. This resource data is interpreted as either |
|
521 8Â bit or 16Â bit, depending on the build. |
|
522 |
|
523 If the value of the leading byte is zero, the function assumes that no data |
|
524 follows the leading byte and returns a NULL pointer. |
|
525 |
|
526 The current position within the resource buffer is updated. |
|
527 |
|
528 Use this build independent variant when the resource contains text. If the |
|
529 resource contains binary data, use the explicit 8Â bit variant ReadHBufC8L(). |
|
530 |
|
531 @pre Open() is called to initialize RResourceReader data members. |
|
532 @return Pointer to the heap descriptor containing a copy of |
|
533 the data following the leading byte count at the |
|
534 current position within the resource buffer. The |
|
535 pointer can be NULL. |
|
536 @post Current buffer position is updated. |
|
537 @leave KErrCorrupt The resulting position lies beyond the end of the resource buffer. */ |
|
538 EXPORT_C HBufC* RResourceReader::ReadHBufCL() |
|
539 { |
|
540 return ReadHBufC16L(); |
|
541 } |
|
542 |
|
543 /** Interprets the data at the current buffer position as leading byte count data |
|
544 and constructs a non modifiable pointer descriptor to represent this data. |
|
545 |
|
546 The data is interpreted as: |
|
547 |
|
548 a byte value defining the number of text characters or the length of binary |
|
549 data (the resource string/binary data length is limited to 255 characters max) |
|
550 |
|
551 followed by: |
|
552 |
|
553 the text characters or binary data. This resource data is interpreted as either |
|
554 8Â bit or 16Â bit, depending on the build. |
|
555 |
|
556 If the value of the leading byte is zero, calling Length() on the returned |
|
557 TPtrC returns zero. |
|
558 |
|
559 The current position within the resource buffer is updated. |
|
560 |
|
561 Use this build independent variant when the resource contains text. If the |
|
562 resource contains binary data, use the explicit 8Â bit variant ReadTPtrC8(). |
|
563 |
|
564 @pre Open() is called to initialize RResourceReader data members. |
|
565 @return Non modifiable pointer descriptor representing the |
|
566 data following the leading byte count of the element |
|
567 at the specified position within the array. |
|
568 @post Current buffer position is updated. |
|
569 @leave KErrCorrupt The resulting position lies beyond the end of the resource buffer. */ |
|
570 EXPORT_C TPtrC RResourceReader::ReadTPtrCL() |
|
571 { |
|
572 return ReadTPtrC16L(); |
|
573 } |
|
574 |
|
575 /** Interprets the data at the current buffer position as an array of leading byte |
|
576 count data and constructs a build independent flat array of descriptors. |
|
577 |
|
578 Each descriptor in the descriptor array corresponds to an element of the resource |
|
579 array. |
|
580 |
|
581 At the current buffer position, the buffer is expected to contain an array |
|
582 of data elements preceded by a TInt16 value defining the number of elements |
|
583 within that array. |
|
584 |
|
585 Each element of the array is interpreted as: |
|
586 |
|
587 a byte value defining the number of text characters or the length of binary |
|
588 data (the resource string/binary data length is limited to 255 characters max) |
|
589 |
|
590 followed by: |
|
591 |
|
592 the text characters or binary data. This resource data is interpreted as either |
|
593 8Â bit or 16Â bit, depending on the build. |
|
594 |
|
595 The current position within the resource buffer is updated. |
|
596 |
|
597 Use this build independent variant when the elements contain text. If the |
|
598 elements contain binary data, use the explicit 8Â bit variant ReadDesC8ArrayL(). |
|
599 |
|
600 @pre Open() is called to initialize RResourceReader data members. |
|
601 @return Pointer to a build independent flat descriptor array. |
|
602 @post Current buffer position is updated. |
|
603 @leave KErrEof The resulting position lies beyond the end of the resource buffer. */ |
|
604 EXPORT_C CDesCArrayFlat* RResourceReader::ReadDesCArrayL() |
|
605 { |
|
606 return ReadDesC16ArrayL(); |
|
607 } |
|
608 |
|
609 #else //if defined(_UNICODE) |
|
610 |
|
611 EXPORT_C HBufC* RResourceReader::ReadHBufCL() |
|
612 { |
|
613 return ReadHBufC8L(); |
|
614 } |
|
615 |
|
616 EXPORT_C TPtrC RResourceReader::ReadTPtrCL() |
|
617 { |
|
618 return ReadTPtrC8L(); |
|
619 } |
|
620 |
|
621 EXPORT_C CDesCArrayFlat* RResourceReader::ReadDesCArrayL() |
|
622 { |
|
623 return ReadDesC8ArrayL(); |
|
624 } |
|
625 |
|
626 #endif //if defined(_UNICODE) |
|
627 |
|
628 /** @internalComponent |
|
629 @return Non-const pointer to the implementation object. */ |
|
630 TResourceReaderImpl* RResourceReader::Impl() |
|
631 { |
|
632 return reinterpret_cast <TResourceReaderImpl*> (iImpl); |
|
633 } |
|
634 |
|
635 /** @internalComponent |
|
636 @return Const pointer to the implementation object. */ |
|
637 const TResourceReaderImpl* RResourceReader::Impl() const |
|
638 { |
|
639 return reinterpret_cast <const TResourceReaderImpl*> (iImpl); |
|
640 } |
|
641 |