|
1 // Copyright (c) 1994-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 the License "Symbian Foundation License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // e32\include\e32cmn.inl |
|
15 // |
|
16 // |
|
17 |
|
18 #ifndef __PLACEMENT_NEW_INLINE |
|
19 #define __PLACEMENT_NEW_INLINE |
|
20 // Global placement operator new |
|
21 inline TAny* operator new(TUint /*aSize*/, TAny* aBase) __NO_THROW |
|
22 {return aBase;} |
|
23 |
|
24 // Global placement operator delete |
|
25 inline void operator delete(TAny* /*aPtr*/, TAny* /*aBase*/) __NO_THROW |
|
26 {} |
|
27 #endif //__PLACEMENT_NEW_INLINE |
|
28 |
|
29 #ifndef __PLACEMENT_VEC_NEW_INLINE |
|
30 #define __PLACEMENT_VEC_NEW_INLINE |
|
31 // Global placement operator new[] |
|
32 inline TAny* operator new[](TUint /*aSize*/, TAny* aBase) __NO_THROW |
|
33 {return aBase;} |
|
34 |
|
35 // Global placement operator delete[] |
|
36 inline void operator delete[](TAny* /*aPtr*/, TAny* /*aBase*/) __NO_THROW |
|
37 {} |
|
38 #endif //__PLACEMENT_VEC_NEW_INLINE |
|
39 |
|
40 |
|
41 // class RAllocator |
|
42 inline RAllocator::RAllocator() |
|
43 { |
|
44 iAccessCount=1; |
|
45 iHandleCount=0; |
|
46 iHandles=0; |
|
47 iFlags=0; |
|
48 iCellCount=0; |
|
49 iTotalAllocSize=0; |
|
50 } |
|
51 inline void RAllocator::__DbgMarkCheck(TBool aCountAll, TInt aCount, const TUint8* aFileName, TInt aLineNum) |
|
52 {__DbgMarkCheck(aCountAll, aCount, TPtrC8(aFileName), aLineNum);} |
|
53 |
|
54 // Class RHeap |
|
55 inline RHeap::RHeap() |
|
56 {} |
|
57 |
|
58 /** |
|
59 @return The maximum length to which the heap can grow. |
|
60 |
|
61 @publishedAll |
|
62 @released |
|
63 */ |
|
64 inline TInt RHeap::MaxLength() const |
|
65 {return iMaxLength;} |
|
66 |
|
67 inline void RHeap::operator delete(TAny*, TAny*) |
|
68 /** |
|
69 Called if constructor issued by operator new(TUint aSize, TAny* aBase) throws exception. |
|
70 This is dummy as corresponding new operator does not allocate memory. |
|
71 */ |
|
72 {} |
|
73 |
|
74 |
|
75 inline TUint8* RHeap::Base() const |
|
76 /** |
|
77 Gets a pointer to the start of the heap. |
|
78 |
|
79 Note that because of the small space overhead incurred by all allocated cells, |
|
80 no cell will have the same address as that returned by this function. |
|
81 |
|
82 @return A pointer to the base of the heap. |
|
83 */ |
|
84 {return iBase;} |
|
85 |
|
86 |
|
87 |
|
88 |
|
89 inline TInt RHeap::Size() const |
|
90 /** |
|
91 Gets the current size of the heap. |
|
92 |
|
93 This is the total number of bytes committed by the host chunk. |
|
94 It is the requested size rounded up by page size minus the size of RHeap object(116 bytes) |
|
95 minus the cell alignment overhead as shown: |
|
96 |
|
97 Size = (Rounded committed size - Size of RHeap - Cell Alignment Overhead). |
|
98 |
|
99 The cell alignment overhead varies between release builds and debug builds. |
|
100 |
|
101 Note that this value is always greater than the total space available across all allocated cells. |
|
102 |
|
103 @return The size of the heap. |
|
104 |
|
105 @see Rheap::Available( ) |
|
106 */ |
|
107 {return iTop-iBase;} |
|
108 |
|
109 |
|
110 |
|
111 |
|
112 inline TInt RHeap::Align(TInt a) const |
|
113 /** |
|
114 @internalComponent |
|
115 */ |
|
116 {return _ALIGN_UP(a, iAlign);} |
|
117 |
|
118 |
|
119 |
|
120 |
|
121 inline const TAny* RHeap::Align(const TAny* a) const |
|
122 /** |
|
123 @internalComponent |
|
124 */ |
|
125 {return (const TAny*)_ALIGN_UP((TLinAddr)a, iAlign);} |
|
126 |
|
127 |
|
128 |
|
129 |
|
130 inline TBool RHeap::IsLastCell(const SCell* aCell) const |
|
131 /** |
|
132 @internalComponent |
|
133 */ |
|
134 {return (((TUint8*)aCell) + aCell->len) == iTop;} |
|
135 |
|
136 |
|
137 |
|
138 |
|
139 #ifndef __KERNEL_MODE__ |
|
140 inline void RHeap::Lock() const |
|
141 /** |
|
142 @internalComponent |
|
143 */ |
|
144 {((RFastLock&)iLock).Wait();} |
|
145 |
|
146 |
|
147 |
|
148 |
|
149 inline void RHeap::Unlock() const |
|
150 /** |
|
151 @internalComponent |
|
152 */ |
|
153 {((RFastLock&)iLock).Signal();} |
|
154 |
|
155 |
|
156 inline TInt RHeap::ChunkHandle() const |
|
157 /** |
|
158 @internalComponent |
|
159 */ |
|
160 { |
|
161 return iChunkHandle; |
|
162 } |
|
163 #endif |
|
164 |
|
165 |
|
166 |
|
167 |
|
168 // Class TRefByValue |
|
169 template <class T> |
|
170 inline TRefByValue<T>::TRefByValue(T &aRef) |
|
171 : iRef(aRef) |
|
172 /** |
|
173 Constructs this value reference for the specified referenced object. |
|
174 |
|
175 @param aRef The referenced object. |
|
176 */ |
|
177 {} |
|
178 |
|
179 |
|
180 |
|
181 |
|
182 template <class T> |
|
183 inline TRefByValue<T>::operator T &() |
|
184 /** |
|
185 Gets a reference to the object encapsulated inside this value reference. |
|
186 */ |
|
187 {return(iRef);} |
|
188 |
|
189 |
|
190 |
|
191 |
|
192 /** |
|
193 Creates the logical channel. |
|
194 |
|
195 @param aDevice The name of the logical device for which the channel |
|
196 is to be constructed. This is the name by which |
|
197 the LDD factory object, i.e. the instance of |
|
198 the DLogicalDevice derived class, is known. |
|
199 @param aVer The required version of the logical device. The driver |
|
200 normally checks this against the version of the logical |
|
201 channel, returning KErrNotSupported if the logical channel |
|
202 is not compatible. |
|
203 @param aUnit A unit of the device. This argument only has meaning if |
|
204 the flag KDeviceAllowUnit is set in the iParseMask data |
|
205 member of the LDD factory object. |
|
206 @param aDriver A pointer to a descriptor containing the name of |
|
207 a physical device. This is the name by which the PDD |
|
208 factory object, i.e. the instance of the DPhysicalDevice |
|
209 derived class, is known. |
|
210 This is NULL, if no explicit name is to be supplied, or |
|
211 the logical device does not require an accompanying physical |
|
212 device. |
|
213 @param aInfo A pointer to an explicit 8-bit descriptor containing extra |
|
214 information for the physical device. This argument only has |
|
215 meaning if the KDeviceAllowInfo flag is set in the iParseMask |
|
216 data member of the LDD factory object. |
|
217 @param aType An enumeration whose enumerators define the ownership of |
|
218 this handle. If not explicitly specified, EOwnerProcess is |
|
219 taken as default. |
|
220 @param aTransferable If false, the channel is created as an object which is |
|
221 local/private to the current process. |
|
222 If true, the channel is an object which may be shared with |
|
223 other processes using the IPC mechanisms for handle passing. |
|
224 |
|
225 @return KErrNone, if successful; otherwise one of the other system wide |
|
226 error codes. |
|
227 */ |
|
228 inline TInt RBusLogicalChannel::DoCreate(const TDesC& aDevice, const TVersion& aVer, TInt aUnit, const TDesC* aDriver, const TDesC8* aInfo, TOwnerType aType, TBool aTransferable) |
|
229 { return DoCreate(aDevice, aVer, aUnit, aDriver, aInfo, (TInt)aType | (aTransferable?KCreateProtectedObject:0) ); } |
|
230 |
|
231 |
|
232 |
|
233 |
|
234 // Class TChar |
|
235 inline TChar::TChar() |
|
236 /** |
|
237 Default constructor. |
|
238 |
|
239 Constructs this character object with an undefined value. |
|
240 */ |
|
241 {} |
|
242 |
|
243 |
|
244 |
|
245 |
|
246 inline TChar::TChar(TUint aChar) |
|
247 : iChar(aChar) |
|
248 /** |
|
249 Constructs this character object and initialises it with the specified value. |
|
250 |
|
251 @param aChar The initialisation value. |
|
252 */ |
|
253 {} |
|
254 |
|
255 |
|
256 |
|
257 |
|
258 inline TChar& TChar::operator-=(TUint aChar) |
|
259 /** |
|
260 Subtracts an unsigned integer value from this character object. |
|
261 |
|
262 This character object is changed by the operation. |
|
263 |
|
264 @param aChar The value to be subtracted. |
|
265 |
|
266 @return A reference to this character object. |
|
267 */ |
|
268 {iChar-=aChar;return(*this);} |
|
269 |
|
270 |
|
271 |
|
272 |
|
273 inline TChar& TChar::operator+=(TUint aChar) |
|
274 /** |
|
275 Adds an unsigned integer value to this character object. |
|
276 |
|
277 This character object is changed by the operation. |
|
278 |
|
279 @param aChar The value to be added. |
|
280 |
|
281 @return A reference to this character object. |
|
282 */ |
|
283 {iChar+=aChar;return(*this);} |
|
284 |
|
285 |
|
286 |
|
287 |
|
288 inline TChar TChar::operator-(TUint aChar) |
|
289 /** |
|
290 Gets the result of subtracting an unsigned integer value from this character |
|
291 object. |
|
292 |
|
293 This character object is not changed. |
|
294 |
|
295 @param aChar The value to be subtracted. |
|
296 |
|
297 @return A character object whose value is the result of the subtraction |
|
298 operation. |
|
299 */ |
|
300 {return(iChar-aChar);} |
|
301 |
|
302 |
|
303 |
|
304 |
|
305 inline TChar TChar::operator+(TUint aChar) |
|
306 /** |
|
307 Gets the result of adding an unsigned integer value to this character object. |
|
308 |
|
309 This character object is not changed. |
|
310 |
|
311 @param aChar The value to be added. |
|
312 |
|
313 @return A character object whose value is the result of the addition operation. |
|
314 */ |
|
315 {return(iChar+aChar);} |
|
316 |
|
317 |
|
318 |
|
319 |
|
320 inline TChar::operator TUint() const |
|
321 /** |
|
322 Gets the value of the character as an unsigned integer. |
|
323 |
|
324 The operator casts a TChar to a TUint, returning the TUint value wrapped by |
|
325 this character object. |
|
326 */ |
|
327 {return(iChar);} |
|
328 |
|
329 |
|
330 |
|
331 |
|
332 // Class TDesC8 |
|
333 inline TBool TDesC8::operator<(const TDesC8 &aDes) const |
|
334 /** |
|
335 Determines whether this descriptor's data is less than the specified |
|
336 descriptor's data. |
|
337 |
|
338 The comparison is implemented using the Compare() member function. |
|
339 |
|
340 @param aDes The 8-bit non-modifable descriptor whose data is to be compared |
|
341 with this descriptor's data. |
|
342 |
|
343 @return True if greater than or equal, false otherwise. |
|
344 |
|
345 @see TDesC8::Compare |
|
346 */ |
|
347 {return(Compare(aDes)<0);} |
|
348 |
|
349 |
|
350 |
|
351 |
|
352 inline TBool TDesC8::operator<=(const TDesC8 &aDes) const |
|
353 /** |
|
354 Determines whether this descriptor's data is less than or equal to the |
|
355 specified descriptor's data. |
|
356 |
|
357 The comparison is implemented using the Compare() member function. |
|
358 |
|
359 @param aDes The 8-bit non-modifable descriptor whose data is to be compared |
|
360 with this descriptor's data. |
|
361 |
|
362 @return True if less than or equal, false otherwise. |
|
363 |
|
364 @see TDesC8::Compare |
|
365 */ |
|
366 {return(Compare(aDes)<=0);} |
|
367 |
|
368 |
|
369 |
|
370 |
|
371 inline TBool TDesC8::operator>(const TDesC8 &aDes) const |
|
372 /** |
|
373 Determines whether this descriptor's data is greater than the specified |
|
374 descriptor's data. |
|
375 |
|
376 The comparison is implemented using the Compare() member function. |
|
377 |
|
378 @param aDes The 8-bit non-modifable descriptor whose data is to be compared |
|
379 with this descriptor's data. |
|
380 |
|
381 @return True if greater than, false otherwise. |
|
382 |
|
383 @see TDesC8::Compare |
|
384 */ |
|
385 {return(Compare(aDes)>0);} |
|
386 |
|
387 |
|
388 |
|
389 |
|
390 inline TBool TDesC8::operator>=(const TDesC8 &aDes) const |
|
391 /** |
|
392 Determines whether this descriptor's data is greater than or equal to the |
|
393 specified descriptor's data. |
|
394 |
|
395 The comparison is implemented using the Compare() member function. |
|
396 |
|
397 @param aDes The 8-bit non-modifable descriptor whose data is to be compared |
|
398 with this descriptor's data. |
|
399 |
|
400 @return True if greater than, false otherwise. |
|
401 |
|
402 @see TDesC8::Compare |
|
403 */ |
|
404 {return(Compare(aDes)>=0);} |
|
405 |
|
406 |
|
407 |
|
408 |
|
409 inline TBool TDesC8::operator==(const TDesC8 &aDes) const |
|
410 /** |
|
411 Determines whether this descriptor's data is equal to the specified |
|
412 descriptor's data. |
|
413 |
|
414 The comparison is implemented using the Compare() member function. |
|
415 |
|
416 @param aDes The 8-bit non-modifable descriptor whose data is to be compared |
|
417 with this descriptor's data. |
|
418 |
|
419 @return True if equal, false otherwise. |
|
420 |
|
421 @see TDesC8::Compare |
|
422 */ |
|
423 {return(Compare(aDes)==0);} |
|
424 |
|
425 |
|
426 |
|
427 |
|
428 inline TBool TDesC8::operator!=(const TDesC8 &aDes) const |
|
429 /** |
|
430 Determines whether this descriptor's data is not equal to the specified |
|
431 descriptor's data. |
|
432 |
|
433 The comparison is implemented using the Compare() member function. |
|
434 |
|
435 @param aDes The 8-bit non-modifable descriptor whose data is to be compared |
|
436 with this descriptor's data. |
|
437 |
|
438 @return True if not equal, false otherwise. |
|
439 |
|
440 @see TDesC8::Compare |
|
441 */ |
|
442 {return(Compare(aDes)!=0);} |
|
443 |
|
444 |
|
445 |
|
446 |
|
447 inline const TUint8 &TDesC8::operator[](TInt anIndex) const |
|
448 /** |
|
449 Gets a reference to a single data item within this descriptor's data. |
|
450 |
|
451 @param anIndex The position of the individual data item within the descriptor's |
|
452 data. This is an offset value; a zero value refers to the |
|
453 leftmost data position. |
|
454 |
|
455 @return A reference to the data item. |
|
456 |
|
457 @panic USER 21, if anIndex is negative or greater than or equal to the current |
|
458 length of the descriptor. |
|
459 */ |
|
460 {return(AtC(anIndex));} |
|
461 |
|
462 |
|
463 |
|
464 |
|
465 inline TInt TDesC8::Length() const |
|
466 /** |
|
467 Gets the length of the data. |
|
468 |
|
469 This is the number of 8-bit values or data items represented by the descriptor. |
|
470 |
|
471 @return The length of the data represented by the descriptor. |
|
472 */ |
|
473 {return(iLength&KMaskDesLength8);} |
|
474 |
|
475 |
|
476 |
|
477 |
|
478 inline TInt TDesC8::Size() const |
|
479 /** |
|
480 Gets the size of the data. |
|
481 |
|
482 This is the number of bytes occupied by the data represented by the descriptor. |
|
483 |
|
484 @return The size of the data represented by the descriptor. |
|
485 */ |
|
486 {return(Length());} |
|
487 |
|
488 |
|
489 |
|
490 |
|
491 inline void TDesC8::DoSetLength(TInt aLength) |
|
492 {iLength=(iLength&(~KMaskDesLength8))|aLength;} |
|
493 |
|
494 |
|
495 |
|
496 |
|
497 // Class TPtrC8 |
|
498 inline void TPtrC8::Set(const TUint8 *aBuf,TInt aLength) |
|
499 /** |
|
500 Sets the 8-bit non-modifiable pointer descriptor to point to the specified |
|
501 location in memory, whether in RAM or ROM. |
|
502 |
|
503 The length of the descriptor is set to the specified length. |
|
504 |
|
505 @param aBuf A pointer to the location that the descriptor is to represent. |
|
506 @param aLength The length of the descriptor. This value must be non-negative. |
|
507 |
|
508 @panic USER 29, if aLength is negative. |
|
509 */ |
|
510 {new(this) TPtrC8(aBuf,aLength);} |
|
511 |
|
512 |
|
513 |
|
514 |
|
515 inline void TPtrC8::Set(const TDesC8 &aDes) |
|
516 /** |
|
517 Sets the 8-bit non-modifiable pointer descriptor from the specified descriptor. |
|
518 |
|
519 It is set to point to the same data and is given the same length. |
|
520 |
|
521 @param aDes A reference to an 8-bit non-modifiable descriptor. |
|
522 */ |
|
523 {new(this) TPtrC8(aDes);} |
|
524 |
|
525 |
|
526 |
|
527 |
|
528 inline void TPtrC8::Set(const TPtrC8& aPtr) |
|
529 /** |
|
530 Sets the 8-bit non-modifiable pointer descriptor from the specified |
|
531 non-modifiable pointer descriptor. |
|
532 |
|
533 It is set to point to the same data and is given the same length. |
|
534 |
|
535 @param aPtr A reference to an 8-bit non-modifiable pointer descriptor. |
|
536 */ |
|
537 {new(this) TPtrC8(aPtr);} |
|
538 |
|
539 |
|
540 |
|
541 |
|
542 |
|
543 // class TBufCBase8 |
|
544 inline TPtr8 TBufCBase8::DoDes(TInt aMaxLength) |
|
545 {return TPtr8(*this,aMaxLength);} |
|
546 |
|
547 |
|
548 |
|
549 |
|
550 // Template class TBufC8 |
|
551 template <TInt S> |
|
552 inline TBufC8<S>::TBufC8() |
|
553 : TBufCBase8() |
|
554 /** |
|
555 Constructs an empty 8-bit non-modifiable buffer descriptor. |
|
556 |
|
557 It contains no data. |
|
558 |
|
559 The integer template parameter determines the size of the data area which |
|
560 is created as part of the buffer descriptor object. |
|
561 |
|
562 Data can, subsequently, be assigned into this buffer descriptor using the |
|
563 assignment operators. |
|
564 |
|
565 @see TBufC8::operator= |
|
566 */ |
|
567 {} |
|
568 |
|
569 |
|
570 |
|
571 |
|
572 template <TInt S> |
|
573 inline TBufC8<S>::TBufC8(const TUint8 *aString) |
|
574 : TBufCBase8(aString,S) |
|
575 /** |
|
576 Constructs the 8-bit non-modifiable buffer descriptor from a zero terminated |
|
577 string. |
|
578 |
|
579 The integer template parameter determines the size of the data area which |
|
580 is created as part of this object. |
|
581 |
|
582 The string, excluding the zero terminator, is copied into this buffer descriptor's |
|
583 data area. The length of this buffer descriptor is set to the length of the |
|
584 string, excluding the zero terminator. |
|
585 |
|
586 @param aString A pointer to a zero terminated string. |
|
587 |
|
588 @panic USER 20, if the length of the string, excluding the zero terminator, is |
|
589 greater than the value of the integer template parameter. |
|
590 */ |
|
591 {} |
|
592 |
|
593 |
|
594 |
|
595 |
|
596 template <TInt S> |
|
597 inline TBufC8<S>::TBufC8(const TDesC8 &aDes) |
|
598 : TBufCBase8(aDes,S) |
|
599 /** |
|
600 Constructs the 8-bit non-modifiable buffer descriptor from any |
|
601 existing descriptor. |
|
602 |
|
603 The integer template parameter determines the size of the data area which |
|
604 is created as part of this object. |
|
605 |
|
606 Data is copied from the source descriptor into this buffer descriptor and |
|
607 the length of this buffer descriptor is set to the length of the |
|
608 source descriptor. |
|
609 |
|
610 @param aDes The source 8-bit non-modifiable descriptor. |
|
611 |
|
612 @panic USER 20, if the length of the source descriptor is |
|
613 greater than the value of the integer template parameter. |
|
614 */ |
|
615 {} |
|
616 |
|
617 |
|
618 |
|
619 |
|
620 template <TInt S> |
|
621 inline TBufC8<S> &TBufC8<S>::operator=(const TUint8 *aString) |
|
622 /** |
|
623 Copies data into this descriptor, replacing any existing data. |
|
624 |
|
625 The length of this descriptor is set to reflect the new data. |
|
626 |
|
627 @param aString A pointer to a zero-terminated string. |
|
628 |
|
629 @return A reference to this descriptor. |
|
630 |
|
631 @panic USER 23, if the length of the string, excluding the zero terminator, is |
|
632 greater than the maximum length of this (target) descriptor. |
|
633 */ |
|
634 {Copy(aString,S);return(*this);} |
|
635 |
|
636 |
|
637 |
|
638 |
|
639 template <TInt S> |
|
640 inline TBufC8<S> &TBufC8<S>::operator=(const TDesC8 &aDes) |
|
641 /** |
|
642 Copies data into this descriptor, replacing any existing data. |
|
643 |
|
644 The length of this descriptor is set to reflect the new data. |
|
645 |
|
646 @param aDes An 8-bit non-modifiable descriptor. |
|
647 |
|
648 @return A reference to this descriptor. |
|
649 |
|
650 @panic USER 23, if the length of the descriptor aDes is |
|
651 greater than the maximum length of this (target) descriptor. |
|
652 */ |
|
653 {Copy(aDes,S);return(*this);} |
|
654 |
|
655 |
|
656 |
|
657 |
|
658 template <TInt S> |
|
659 inline TPtr8 TBufC8<S>::Des() |
|
660 /** |
|
661 Creates and returns an 8-bit modifiable pointer descriptor for the data |
|
662 represented by this 8-bit non-modifiable buffer descriptor. |
|
663 |
|
664 The content of a non-modifiable buffer descriptor normally cannot be altered, |
|
665 other than by complete replacement of the data. Creating a modifiable pointer |
|
666 descriptor provides a way of changing the data. |
|
667 |
|
668 The modifiable pointer descriptor is set to point to this non-modifiable buffer |
|
669 descriptor's data. |
|
670 |
|
671 The length of the modifiable pointer descriptor is set to the length of this |
|
672 non-modifiable buffer descriptor. |
|
673 |
|
674 The maximum length of the modifiable pointer descriptor is set to the value |
|
675 of the integer template parameter. |
|
676 |
|
677 When data is modified through this new pointer descriptor, the lengths of |
|
678 both it and this constant buffer descriptor are changed. |
|
679 |
|
680 @return An 8-bit modifiable pointer descriptor representing the data in this |
|
681 8-bit non-modifiable buffer descriptor. |
|
682 */ |
|
683 {return DoDes(S);} |
|
684 |
|
685 |
|
686 |
|
687 |
|
688 #ifndef __KERNEL_MODE__ |
|
689 // Class HBufC8 |
|
690 inline HBufC8 &HBufC8::operator=(const HBufC8 &aLcb) |
|
691 /** |
|
692 Copies data into this 8-bit heap descriptor replacing any existing data. |
|
693 |
|
694 The length of this descriptor is set to reflect the new data. |
|
695 |
|
696 Note that the maximum length of this (target) descriptor is the length |
|
697 of the descriptor buffer in the allocated host heap cell; this may be greater |
|
698 than the maximum length specified when this descriptor was created or |
|
699 last re-allocated. |
|
700 |
|
701 @param aLcb The source 8-bit heap descriptor. |
|
702 |
|
703 @return A reference to this 8-bit heap descriptor. |
|
704 |
|
705 @panic USER 23, if the length of the descriptor aLcb is greater than the |
|
706 maximum length of this (target) descriptor |
|
707 */ |
|
708 {return *this=static_cast<const TDesC8&>(aLcb);} |
|
709 |
|
710 |
|
711 |
|
712 |
|
713 // Class RBuf8 |
|
714 inline RBuf8& RBuf8::operator=(const TUint8* aString) |
|
715 /** |
|
716 Copies data into this descriptor replacing any existing data. |
|
717 |
|
718 The length of this descriptor is set to reflect the new data. |
|
719 |
|
720 @param aString A pointer to a zero-terminated string. |
|
721 |
|
722 @return A reference to this, the target descriptor. |
|
723 |
|
724 @panic USER 11, if the length of the string, excluding the zero terminator, is |
|
725 greater than the maximum length of this (target) descriptor. |
|
726 */ |
|
727 {Copy(aString);return(*this);} |
|
728 |
|
729 |
|
730 |
|
731 |
|
732 inline RBuf8& RBuf8::operator=(const TDesC8& aDes) |
|
733 /** |
|
734 Copies data into this descriptor replacing any existing data. |
|
735 |
|
736 The length of this descriptor is set to reflect the new data. |
|
737 |
|
738 @param aDes An 8-bit non-modifiable descriptor. |
|
739 |
|
740 @return A reference to this, the target descriptor. |
|
741 |
|
742 @panic USER 11, if the length of the descriptor aDes is greater than the |
|
743 maximum length of this (target) descriptor. |
|
744 */ |
|
745 {Copy(aDes);return(*this);} |
|
746 |
|
747 |
|
748 |
|
749 |
|
750 inline RBuf8& RBuf8::operator=(const RBuf8& aDes) |
|
751 /** |
|
752 Copies data into this descriptor replacing any existing data. |
|
753 |
|
754 The length of this descriptor is set to reflect the new data. |
|
755 |
|
756 @param aDes A 8-bit buffer descriptor. |
|
757 |
|
758 @return A reference to this, the target descriptor. |
|
759 |
|
760 @panic USER 11, if the length of the descriptor aDes is greater than the |
|
761 maximum length of this (target) descriptor. |
|
762 */ |
|
763 {Copy(aDes);return(*this);} |
|
764 |
|
765 |
|
766 |
|
767 |
|
768 /** |
|
769 Creates an 8-bit resizable buffer descriptor that has been initialised with |
|
770 data from the specified read stream; leaves on failure. |
|
771 |
|
772 Data is assigned to the new descriptor from the specified stream. |
|
773 This variant assumes that the stream contains the length of the data followed |
|
774 by the data itself. |
|
775 |
|
776 The function is implemented by calling the HBufC8::NewL(RReadStream&,TInt) |
|
777 variant and then assigning the resulting heap descriptor using |
|
778 the RBuf8::Assign(HBufC8*) variant. The comments that describe |
|
779 the HBufC8::NewL() variant also apply to this RBuf8::CreateL() function. |
|
780 |
|
781 The function may leave with one of the system-wide error codes, specifically |
|
782 KErrOverflow, if the length of the data as read from the stream is greater than |
|
783 the upper limit as specified by the aMaxLength parameter. |
|
784 |
|
785 @param aStream The stream from which the data length and the data to be |
|
786 assigned to the new descriptor, are taken. |
|
787 @param aMaxLength The upper limit on the length of data that the descriptor is |
|
788 to represent. The value of this parameter must be non-negative |
|
789 otherwise the underlying function will panic. |
|
790 */ |
|
791 inline void RBuf8::CreateL(RReadStream &aStream,TInt aMaxLength) |
|
792 { |
|
793 Assign(HBufC8::NewL(aStream,aMaxLength)); |
|
794 } |
|
795 #endif |
|
796 |
|
797 |
|
798 |
|
799 |
|
800 // Class TDes8 |
|
801 inline TDes8 &TDes8::operator=(const TUint8 *aString) |
|
802 /** |
|
803 Copies data into this descriptor replacing any existing data. |
|
804 |
|
805 The length of this descriptor is set to reflect the new data. |
|
806 |
|
807 @param aString A pointer to a zero-terminated string. |
|
808 |
|
809 @return A reference to this, the target descriptor. |
|
810 |
|
811 @panic USER 23, if the length of the string, excluding the zero terminator, is |
|
812 greater than the maximum length of this (target) descriptor. |
|
813 */ |
|
814 {Copy(aString);return(*this);} |
|
815 |
|
816 |
|
817 |
|
818 |
|
819 inline TDes8 &TDes8::operator=(const TDesC8 &aDes) |
|
820 /** |
|
821 Copies data into this descriptor replacing any existing data. |
|
822 |
|
823 The length of this descriptor is set to reflect the new data. |
|
824 |
|
825 @param aDes An 8-bit non-modifiable descriptor. |
|
826 |
|
827 @return A reference to this, the target descriptor. |
|
828 |
|
829 @panic USER 23, if the length of the descriptor aDes is greater than the |
|
830 maximum length of this (target) descriptor. |
|
831 */ |
|
832 {Copy(aDes);return(*this);} |
|
833 |
|
834 |
|
835 |
|
836 |
|
837 inline TDes8 &TDes8::operator=(const TDes8 &aDes) |
|
838 /** |
|
839 Copies data into this descriptor replacing any existing data. |
|
840 |
|
841 The length of this descriptor is set to reflect the new data. |
|
842 |
|
843 @param aDes An 8-bit modifiable descriptor. |
|
844 |
|
845 @return A reference to this, the target descriptor. |
|
846 |
|
847 @panic USER 23, if the length of the descriptor aDes is greater than the |
|
848 maximum length of this (target) descriptor. |
|
849 */ |
|
850 {Copy(aDes);return(*this);} |
|
851 |
|
852 |
|
853 |
|
854 |
|
855 inline TDes8 &TDes8::operator+=(const TDesC8 &aDes) |
|
856 /** |
|
857 Appends data onto the end of this descriptor's data and returns a reference |
|
858 to this descriptor. |
|
859 |
|
860 The length of this descriptor is incremented to reflect the new content. |
|
861 |
|
862 @param aDes An-8 bit non-modifiable descriptor whose data is to be appended. |
|
863 |
|
864 @return A reference to this descriptor. |
|
865 |
|
866 @panic USER 23, if the resulting length of this descriptor is greater than its |
|
867 maximum length. |
|
868 */ |
|
869 {Append(aDes);return(*this);} |
|
870 |
|
871 |
|
872 |
|
873 |
|
874 inline const TUint8 &TDes8::operator[](TInt anIndex) const |
|
875 /** |
|
876 Gets a const reference to a single data item within this descriptor's data. |
|
877 |
|
878 @param anIndex The position of the data item within this descriptor's data. |
|
879 This is an offset value; a zero value refers to the leftmost |
|
880 data position. |
|
881 |
|
882 @return A const reference to the data item at the specified position. |
|
883 |
|
884 @panic USER 21, if anIndex is negative or is greater than or equal to the |
|
885 current length of this descriptor. |
|
886 */ |
|
887 {return(AtC(anIndex));} |
|
888 |
|
889 |
|
890 |
|
891 |
|
892 inline TUint8 &TDes8::operator[](TInt anIndex) |
|
893 /** |
|
894 Gets a non-const reference to a single data item within this descriptor's |
|
895 data. |
|
896 |
|
897 @param anIndex The position of the data item within this descriptor's data. |
|
898 This is an offset value; a zero value refers to the leftmost |
|
899 data position. |
|
900 |
|
901 @return A non-const reference to the data item at the specified position. |
|
902 |
|
903 @panic USER 21, if anIndex is negative or is greater than or equal to the |
|
904 current length of this descriptor. |
|
905 */ |
|
906 {return((TUint8 &)AtC(anIndex));} |
|
907 |
|
908 |
|
909 |
|
910 |
|
911 inline TInt TDes8::MaxLength() const |
|
912 /** |
|
913 Gets the maximum length of the descriptor. |
|
914 |
|
915 This is the upper limit for the number of 8-bit values or data items that |
|
916 the descriptor can represent. |
|
917 |
|
918 @return The maximum length of data that the descriptor can represent. |
|
919 */ |
|
920 {return(iMaxLength);} |
|
921 |
|
922 |
|
923 |
|
924 |
|
925 inline TInt TDes8::MaxSize() const |
|
926 /** |
|
927 Gets the maximum size of the descriptor. |
|
928 |
|
929 This is the upper limit for the number of bytes which the data represented by |
|
930 the descriptor can occupy. |
|
931 |
|
932 @return The maximum size of the descriptor data. |
|
933 */ |
|
934 {return(iMaxLength);} |
|
935 |
|
936 |
|
937 |
|
938 |
|
939 inline TUint8 * TDes8::WPtr() const |
|
940 {return((TUint8 *)Ptr());} |
|
941 |
|
942 |
|
943 |
|
944 |
|
945 // Class TPtr8 |
|
946 inline TPtr8 &TPtr8::operator=(const TUint8 *aString) |
|
947 /** |
|
948 Copies data into this 8-bit modifiable pointer descriptor replacing any |
|
949 existing data. |
|
950 |
|
951 The length of this descriptor is set to reflect the new data. |
|
952 |
|
953 @param aString A pointer to a zero-terminated string. |
|
954 |
|
955 @return A reference to this 8-bit modifiable pointer descriptor. |
|
956 |
|
957 @panic USER 23, if the length of the string, excluding the zero terminator, is |
|
958 greater than the maximum length of this descriptor. |
|
959 */ |
|
960 {Copy(aString);return(*this);} |
|
961 |
|
962 |
|
963 |
|
964 |
|
965 inline TPtr8 &TPtr8::operator=(const TDesC8 &aDes) |
|
966 /** |
|
967 Copies data into this 8-bit modifiable pointer descriptor replacing any |
|
968 existing data. |
|
969 |
|
970 The length of this descriptor is set to reflect the new data. |
|
971 |
|
972 @param aDes An 8-bit modifiable pointer descriptor whose data is to be copied |
|
973 into this descriptor. |
|
974 |
|
975 @return A reference to this 8-bit modifiable pointer descriptor. |
|
976 |
|
977 @panic USER 23, if the length of aDes is greater than the maximum |
|
978 length of this descriptor. |
|
979 */ |
|
980 {Copy(aDes);return(*this);} |
|
981 |
|
982 |
|
983 |
|
984 |
|
985 inline TPtr8 &TPtr8::operator=(const TPtr8 &aDes) |
|
986 /** |
|
987 Copies data into this 8-bit modifiable pointer descriptor replacing any |
|
988 existing data. |
|
989 |
|
990 The length of this descriptor is set to reflect the new data. |
|
991 |
|
992 @param aDes An 8-bit modifiable pointer descriptor whose data is to be copied |
|
993 into this descriptor. |
|
994 |
|
995 @return A reference to this 8-bit modifiable pointer descriptor. |
|
996 |
|
997 @panic USER 23, if the length of aDes is greater than the maximum |
|
998 length of this descriptor. |
|
999 */ |
|
1000 {Copy(aDes);return(*this);} |
|
1001 |
|
1002 |
|
1003 |
|
1004 |
|
1005 inline void TPtr8::Set(TUint8 *aBuf,TInt aLength,TInt aMaxLength) |
|
1006 /** |
|
1007 Sets the 8-bit modifiable pointer descriptor to point to the specified location |
|
1008 in memory, whether in RAM or ROM. |
|
1009 |
|
1010 The length of the descriptor and its maximum length are set to the specified |
|
1011 values. |
|
1012 |
|
1013 @param aBuf A pointer to the location that the descriptor is to represent. |
|
1014 @param aLength The length of the descriptor. |
|
1015 @param aMaxLength The maximum length of the descriptor. |
|
1016 |
|
1017 @panic USER 20, if aLength is negative or is greater than the maximum length of |
|
1018 this descriptor. |
|
1019 @panic USER 30, if aMaxLength is negative. |
|
1020 */ |
|
1021 {new(this) TPtr8(aBuf,aLength,aMaxLength);} |
|
1022 |
|
1023 |
|
1024 |
|
1025 |
|
1026 inline void TPtr8::Set(const TPtr8 &aPtr) |
|
1027 /** |
|
1028 Sets the 8-bit modifiable pointer descriptor from an existing 8-bit modifiable |
|
1029 pointer descriptor. |
|
1030 |
|
1031 It is set to point to the same data, is given the same length and the same |
|
1032 maximum length as the source pointer descriptor. |
|
1033 |
|
1034 @param aPtr The source 8-bit modifiable pointer descriptor. |
|
1035 */ |
|
1036 {new(this) TPtr8(aPtr);} |
|
1037 |
|
1038 |
|
1039 |
|
1040 |
|
1041 // Template class TBuf8 |
|
1042 template <TInt S> |
|
1043 inline TBuf8<S>::TBuf8() |
|
1044 : TBufBase8(S) |
|
1045 /** |
|
1046 Constructs an empty 8-bit modifiable buffer descriptor. |
|
1047 |
|
1048 It contains no data. |
|
1049 |
|
1050 The integer template parameter determines the size of the data area that is created |
|
1051 as part of the object, and defines the descriptor's maximum length. |
|
1052 */ |
|
1053 {} |
|
1054 |
|
1055 |
|
1056 |
|
1057 |
|
1058 template <TInt S> |
|
1059 inline TBuf8<S>::TBuf8(TInt aLength) |
|
1060 : TBufBase8(aLength,S) |
|
1061 /** |
|
1062 Constructs an empty 8-bit modifiable buffer descriptor and sets the its length |
|
1063 to the specified value. |
|
1064 |
|
1065 No data is assigned to the descriptor. |
|
1066 |
|
1067 The integer template parameter determines the size of the data area that is created |
|
1068 as part of the object, and defines the descriptor's maximum length. |
|
1069 |
|
1070 @param aLength The length of this modifiable buffer descriptor. |
|
1071 |
|
1072 @panic USER 20, if aLength is negative or is greater than the |
|
1073 value of the integer template parameter. |
|
1074 */ |
|
1075 {} |
|
1076 |
|
1077 |
|
1078 |
|
1079 |
|
1080 template <TInt S> |
|
1081 inline TBuf8<S>::TBuf8(const TUint8 *aString) |
|
1082 : TBufBase8(aString,S) |
|
1083 /** |
|
1084 Constructs the 8-bit modifiable buffer descriptor from a |
|
1085 zero terminated string. |
|
1086 |
|
1087 The integer template parameter determines the size of the data area that |
|
1088 is created as part of the object, and defines the descriptor's maximum length. |
|
1089 |
|
1090 The string, excluding the zero terminator, is copied into this buffer |
|
1091 descriptor's data area. The length of this buffer descriptor is set to the |
|
1092 length of the string, excluding the zero terminator. |
|
1093 |
|
1094 @param aString A pointer to a zero terminated string. |
|
1095 |
|
1096 @panic USER 23, if the length of the string, excluding the zero terminator, |
|
1097 is greater than the value of the integer template parameter. |
|
1098 */ |
|
1099 {} |
|
1100 |
|
1101 |
|
1102 |
|
1103 |
|
1104 template <TInt S> |
|
1105 inline TBuf8<S>::TBuf8(const TDesC8 &aDes) |
|
1106 : TBufBase8(aDes,S) |
|
1107 /** |
|
1108 Constructs the 8-bit modifiable buffer descriptor from any existing |
|
1109 8-bit descriptor. |
|
1110 |
|
1111 The integer template parameter determines the size of the data area created |
|
1112 as part of this object and defines the descriptor's maximum length. |
|
1113 |
|
1114 Data is copied from the source descriptor into this modifiable buffer |
|
1115 descriptor and the length of this modifiable buffer descriptor is set to |
|
1116 the length of the source descriptor. |
|
1117 |
|
1118 @param aDes The source 8-bit non-modifiable descriptor. |
|
1119 |
|
1120 @panic USER 23, if the length of the source descriptor is greater than the |
|
1121 value of the integer template parameter. |
|
1122 */ |
|
1123 {} |
|
1124 |
|
1125 |
|
1126 |
|
1127 |
|
1128 template <TInt S> |
|
1129 inline TBuf8<S> &TBuf8<S>::operator=(const TUint8 *aString) |
|
1130 /** |
|
1131 Copies data into this 8-bit modifiable buffer descriptor, replacing any |
|
1132 existing data. |
|
1133 |
|
1134 The length of this descriptor is set to reflect the new data. |
|
1135 |
|
1136 @param aString A pointer to a zero-terminated string. |
|
1137 |
|
1138 @return A reference to this 8-bit modifiable buffer descriptor. |
|
1139 |
|
1140 @panic USER 23, if the length of the string, excluding the zero terminator, |
|
1141 is greater than the maximum length of this (target) descriptor. |
|
1142 */ |
|
1143 {Copy(aString);return(*this);} |
|
1144 |
|
1145 |
|
1146 |
|
1147 |
|
1148 template <TInt S> |
|
1149 inline TBuf8<S> &TBuf8<S>::operator=(const TDesC8 &aDes) |
|
1150 /** |
|
1151 Copies data into this 8-bit modifiable buffer descriptor, replacing any |
|
1152 existing data. |
|
1153 |
|
1154 The length of this descriptor is set to reflect the new data. |
|
1155 |
|
1156 @param aDes An 8 bit non-modifiable descriptor. |
|
1157 |
|
1158 @return A reference to this 8-bit modifiable buffer descriptor. |
|
1159 |
|
1160 @panic USER 23, if the length of the descriptor aDes is greater than the |
|
1161 maximum length of this (target) descriptor. |
|
1162 */ |
|
1163 {Copy(aDes);return(*this);} |
|
1164 |
|
1165 |
|
1166 |
|
1167 |
|
1168 template <TInt S> |
|
1169 inline TBuf8<S>& TBuf8<S>::operator=(const TBuf8<S>& aBuf) |
|
1170 /** |
|
1171 Copies data into this 8-bit modifiable buffer descriptor replacing any |
|
1172 existing data. |
|
1173 |
|
1174 The length of this descriptor is set to reflect the new data. |
|
1175 |
|
1176 @param aBuf The source 8-bit modifiable buffer descriptor with the same |
|
1177 template value. |
|
1178 |
|
1179 @return A reference to this 8-bit modifiable buffer descriptor. |
|
1180 */ |
|
1181 {Copy(aBuf);return *this;} |
|
1182 |
|
1183 |
|
1184 |
|
1185 |
|
1186 // Template class TAlignedBuf8 |
|
1187 template <TInt S> |
|
1188 inline TAlignedBuf8<S>::TAlignedBuf8() |
|
1189 : TBufBase8(S) |
|
1190 /** |
|
1191 Constructs an empty 8-bit modifiable buffer descriptor. |
|
1192 |
|
1193 It contains no data. |
|
1194 |
|
1195 The integer template parameter determines the size of the data area that is created |
|
1196 as part of the object, and defines the descriptor's maximum length. |
|
1197 */ |
|
1198 {} |
|
1199 |
|
1200 |
|
1201 |
|
1202 |
|
1203 template <TInt S> |
|
1204 inline TAlignedBuf8<S>::TAlignedBuf8(TInt aLength) |
|
1205 : TBufBase8(aLength,S) |
|
1206 /** |
|
1207 Constructs an empty 8-bit modifiable buffer descriptor and sets the its length |
|
1208 to the specified value. |
|
1209 |
|
1210 No data is assigned to the descriptor. |
|
1211 |
|
1212 The integer template parameter determines the size of the data area that is created |
|
1213 as part of the object, and defines the descriptor's maximum length. |
|
1214 |
|
1215 @param aLength The length of this modifiable buffer descriptor. |
|
1216 |
|
1217 @panic USER 20, if aLength is negative or is greater than the |
|
1218 value of the integer template parameter. |
|
1219 */ |
|
1220 {} |
|
1221 |
|
1222 |
|
1223 |
|
1224 |
|
1225 template <TInt S> |
|
1226 inline TAlignedBuf8<S>::TAlignedBuf8(const TUint8 *aString) |
|
1227 : TBufBase8(aString,S) |
|
1228 /** |
|
1229 Constructs the 8-bit modifiable buffer descriptor from a |
|
1230 zero terminated string. |
|
1231 |
|
1232 The integer template parameter determines the size of the data area that |
|
1233 is created as part of the object, and defines the descriptor's maximum length. |
|
1234 |
|
1235 The string, excluding the zero terminator, is copied into this buffer |
|
1236 descriptor's data area. The length of this buffer descriptor is set to the |
|
1237 length of the string, excluding the zero terminator. |
|
1238 |
|
1239 @param aString A pointer to a zero terminated string. |
|
1240 |
|
1241 @panic USER 23, if the length of the string, excluding the zero terminator, |
|
1242 is greater than the value of the integer template parameter. |
|
1243 */ |
|
1244 {} |
|
1245 |
|
1246 |
|
1247 |
|
1248 |
|
1249 template <TInt S> |
|
1250 inline TAlignedBuf8<S>::TAlignedBuf8(const TDesC8 &aDes) |
|
1251 : TBufBase8(aDes,S) |
|
1252 /** |
|
1253 Constructs the 8-bit modifiable buffer descriptor from any existing |
|
1254 8-bit descriptor. |
|
1255 |
|
1256 The integer template parameter determines the size of the data area created |
|
1257 as part of this object and defines the descriptor's maximum length. |
|
1258 |
|
1259 Data is copied from the source descriptor into this modifiable buffer |
|
1260 descriptor and the length of this modifiable buffer descriptor is set to |
|
1261 the length of the source descriptor. |
|
1262 |
|
1263 @param aDes The source 8-bit non-modifiable descriptor. |
|
1264 |
|
1265 @panic USER 23, if the length of the source descriptor is greater than the |
|
1266 value of the integer template parameter. |
|
1267 */ |
|
1268 {} |
|
1269 |
|
1270 |
|
1271 |
|
1272 |
|
1273 template <TInt S> |
|
1274 inline TAlignedBuf8<S> &TAlignedBuf8<S>::operator=(const TUint8 *aString) |
|
1275 /** |
|
1276 Copies data into this 8-bit modifiable buffer descriptor, replacing any |
|
1277 existing data. |
|
1278 |
|
1279 The length of this descriptor is set to reflect the new data. |
|
1280 |
|
1281 @param aString A pointer to a zero-terminated string. |
|
1282 |
|
1283 @return A reference to this 8-bit modifiable buffer descriptor. |
|
1284 |
|
1285 @panic USER 23, if the length of the string, excluding the zero terminator, |
|
1286 is greater than the maximum length of this (target) descriptor. |
|
1287 */ |
|
1288 {Copy(aString);return(*this);} |
|
1289 |
|
1290 |
|
1291 |
|
1292 |
|
1293 template <TInt S> |
|
1294 inline TAlignedBuf8<S> &TAlignedBuf8<S>::operator=(const TDesC8 &aDes) |
|
1295 /** |
|
1296 Copies data into this 8-bit modifiable buffer descriptor, replacing any |
|
1297 existing data. |
|
1298 |
|
1299 The length of this descriptor is set to reflect the new data. |
|
1300 |
|
1301 @param aDes An 8 bit non-modifiable descriptor. |
|
1302 |
|
1303 @return A reference to this 8-bit modifiable buffer descriptor. |
|
1304 |
|
1305 @panic USER 23, if the length of the descriptor aDes is greater than the |
|
1306 maximum length of this (target) descriptor. |
|
1307 */ |
|
1308 {Copy(aDes);return(*this);} |
|
1309 |
|
1310 |
|
1311 |
|
1312 |
|
1313 template <TInt S> |
|
1314 inline TAlignedBuf8<S>& TAlignedBuf8<S>::operator=(const TAlignedBuf8<S>& aBuf) |
|
1315 /** |
|
1316 Copies data into this 8-bit modifiable buffer descriptor replacing any |
|
1317 existing data. |
|
1318 |
|
1319 The length of this descriptor is set to reflect the new data. |
|
1320 |
|
1321 @param aBuf The source 8-bit modifiable buffer descriptor with the same |
|
1322 template value. |
|
1323 |
|
1324 @return A reference to this 8-bit modifiable buffer descriptor. |
|
1325 */ |
|
1326 {Copy(aBuf);return *this;} |
|
1327 |
|
1328 |
|
1329 |
|
1330 |
|
1331 // Template class TLitC8 |
|
1332 template <TInt S> |
|
1333 inline const TDesC8* TLitC8<S>::operator&() const |
|
1334 /** |
|
1335 Returns a const TDesC8 type pointer. |
|
1336 |
|
1337 @return A descriptor type pointer to this literal. |
|
1338 */ |
|
1339 {return REINTERPRET_CAST(const TDesC8*,this);} |
|
1340 |
|
1341 |
|
1342 |
|
1343 |
|
1344 template <TInt S> |
|
1345 inline const TDesC8& TLitC8<S>::operator()() const |
|
1346 /** |
|
1347 Returns a const TDesC8 type reference. |
|
1348 |
|
1349 @return A descriptor type reference to this literal |
|
1350 */ |
|
1351 {return *operator&();} |
|
1352 |
|
1353 |
|
1354 |
|
1355 |
|
1356 template <TInt S> |
|
1357 inline TLitC8<S>::operator const TDesC8&() const |
|
1358 /** |
|
1359 Invoked by the compiler when a TLitC8<TInt> type is passed to a function |
|
1360 which is prototyped to take a const TDesC8& type. |
|
1361 */ |
|
1362 {return *operator&();} |
|
1363 |
|
1364 |
|
1365 |
|
1366 template <TInt S> |
|
1367 inline TLitC8<S>::operator const __TRefDesC8() const |
|
1368 /** |
|
1369 Invoked by the compiler when a TLitC8<TInt> type is passed to a function |
|
1370 which is prototyped to take a const TRefByValue<const TDesC8> type. |
|
1371 |
|
1372 @see __TRefDesC8 |
|
1373 */ |
|
1374 {return *operator&();} |
|
1375 |
|
1376 |
|
1377 |
|
1378 |
|
1379 #ifndef __KERNEL_MODE__ |
|
1380 // Class TDesC16 |
|
1381 inline TBool TDesC16::operator<(const TDesC16 &aDes) const |
|
1382 /** |
|
1383 Determines whether this descriptor's data is less than the specified descriptor's |
|
1384 data. |
|
1385 |
|
1386 The comparison is implemented using the Compare() member function. |
|
1387 |
|
1388 @param aDes The 16-bit non-modifable descriptor whose data is to be compared |
|
1389 with this descriptor's data. |
|
1390 |
|
1391 @return True if less than, false otherwise. |
|
1392 |
|
1393 @see TDesC16::Compare |
|
1394 */ |
|
1395 {return(Compare(aDes)<0);} |
|
1396 |
|
1397 |
|
1398 |
|
1399 |
|
1400 inline TBool TDesC16::operator<=(const TDesC16 &aDes) const |
|
1401 /** |
|
1402 Determines whether this descriptor's data is less than or equal |
|
1403 to the specified descriptor's data. |
|
1404 |
|
1405 The comparison is implemented using the Compare() member function. |
|
1406 |
|
1407 @param aDes The 16-bit non- modifiable descriptor whose data is to be compared |
|
1408 with this descriptor's data. |
|
1409 |
|
1410 @return True if less than or equal, false otherwise. |
|
1411 |
|
1412 @see TDesC16::Compare |
|
1413 */ |
|
1414 {return(Compare(aDes)<=0);} |
|
1415 |
|
1416 |
|
1417 |
|
1418 |
|
1419 inline TBool TDesC16::operator>(const TDesC16 &aDes) const |
|
1420 /** |
|
1421 Determines whether this descriptor's data is greater than the specified |
|
1422 descriptor's data. |
|
1423 |
|
1424 The comparison is implemented using the Compare() member function. |
|
1425 |
|
1426 @param aDes The 16-bit non-modifiable descriptor whose data is to be compared |
|
1427 with this descriptor's data. |
|
1428 |
|
1429 @return True if greater than, false otherwise. |
|
1430 |
|
1431 @see TDesC16::Compare |
|
1432 */ |
|
1433 {return(Compare(aDes)>0);} |
|
1434 |
|
1435 |
|
1436 |
|
1437 |
|
1438 inline TBool TDesC16::operator>=(const TDesC16 &aDes) const |
|
1439 /** |
|
1440 Determines whether this descriptor's data is greater than or equal to the |
|
1441 specified descriptor's data. |
|
1442 |
|
1443 The comparison is implemented using the Compare() member function. |
|
1444 |
|
1445 @param aDes The 16-bit non-modifiable descriptor whose data is to be compared |
|
1446 with this descriptor's data. |
|
1447 |
|
1448 @return True if greater than or equal, false otherwise. |
|
1449 |
|
1450 @see TDesC16::Compare |
|
1451 */ |
|
1452 {return(Compare(aDes)>=0);} |
|
1453 |
|
1454 |
|
1455 |
|
1456 |
|
1457 inline TBool TDesC16::operator==(const TDesC16 &aDes) const |
|
1458 /** |
|
1459 Determines whether this descriptor's data is equal to the specified |
|
1460 descriptor's data. |
|
1461 |
|
1462 The comparison is implemented using the Compare() member function. |
|
1463 |
|
1464 @param aDes The 16-bit non-modifiable descriptor whose data is to be compared |
|
1465 with this descriptor's data. |
|
1466 |
|
1467 @return True if equal, false otherwise. |
|
1468 |
|
1469 @see TDesC16::Compare |
|
1470 */ |
|
1471 {return(Compare(aDes)==0);} |
|
1472 |
|
1473 |
|
1474 |
|
1475 |
|
1476 inline TBool TDesC16::operator!=(const TDesC16 &aDes) const |
|
1477 /** |
|
1478 Determines whether this descriptor's data is not equal to the specified |
|
1479 descriptor's data. |
|
1480 |
|
1481 The comparison is implemented using the Compare() member function. |
|
1482 |
|
1483 @param aDes The 16-bit non-modifiable descriptor whose data is to be compared |
|
1484 with this descriptor's data. |
|
1485 |
|
1486 @return True if not equal, false otherwise. |
|
1487 |
|
1488 @see TDesC16::Compare |
|
1489 */ |
|
1490 {return(Compare(aDes)!=0);} |
|
1491 |
|
1492 |
|
1493 |
|
1494 |
|
1495 inline const TUint16 &TDesC16::operator[](TInt anIndex) const |
|
1496 /** |
|
1497 Gets a reference to a single data item within this descriptor's data. |
|
1498 |
|
1499 @param anIndex The position of the individual data item within the descriptor's |
|
1500 data. This is an offset value; a zero value refers to the |
|
1501 leftmost data position. |
|
1502 |
|
1503 @return A reference to the data item. |
|
1504 |
|
1505 @panic USER 9, if anIndex is negative or greater than or equal to the current |
|
1506 length of the descriptor. |
|
1507 */ |
|
1508 {return(AtC(anIndex));} |
|
1509 |
|
1510 |
|
1511 |
|
1512 |
|
1513 inline TInt TDesC16::Length() const |
|
1514 /** |
|
1515 Gets the length of the data. |
|
1516 |
|
1517 This is the number of 16-bit values or data items represented by the descriptor. |
|
1518 |
|
1519 @return The length of the data represented by the descriptor. |
|
1520 */ |
|
1521 {return(iLength&KMaskDesLength16);} |
|
1522 |
|
1523 |
|
1524 |
|
1525 |
|
1526 inline TInt TDesC16::Size() const |
|
1527 /** |
|
1528 Gets the size of the data. |
|
1529 |
|
1530 This is the number of bytes occupied by the data represented by the descriptor. |
|
1531 |
|
1532 @return The size of the data represented by the descriptor. This is always |
|
1533 twice the length. |
|
1534 */ |
|
1535 {return(Length()<<1);} |
|
1536 |
|
1537 |
|
1538 |
|
1539 |
|
1540 inline void TDesC16::DoSetLength(TInt aLength) |
|
1541 {iLength=(iLength&(~KMaskDesLength16))|aLength;} |
|
1542 |
|
1543 |
|
1544 |
|
1545 |
|
1546 // Class TPtrC16 |
|
1547 inline void TPtrC16::Set(const TUint16 *aBuf,TInt aLength) |
|
1548 /** |
|
1549 Sets the 16-bit non-modifiable pointer descriptor to point to the specified |
|
1550 location in memory, whether in RAM or ROM. |
|
1551 |
|
1552 The length of the descriptor is set to the specified length. |
|
1553 |
|
1554 @param aBuf A pointer to the location that the descriptor is to represent. |
|
1555 @param aLength The length of the descriptor. This value must be non-negative |
|
1556 |
|
1557 @panic USER 17, if aLength is negative. |
|
1558 */ |
|
1559 {new(this) TPtrC16(aBuf,aLength);} |
|
1560 |
|
1561 |
|
1562 |
|
1563 |
|
1564 inline void TPtrC16::Set(const TDesC16 &aDes) |
|
1565 /** |
|
1566 Sets the 16-bit non-modifiable pointer descriptor from the specified descriptor. |
|
1567 |
|
1568 It is set to point to the same data and is given the same length. |
|
1569 |
|
1570 @param aDes A reference to a 16-bit non-modifiable descriptor |
|
1571 */ |
|
1572 {new(this) TPtrC16(aDes);} |
|
1573 |
|
1574 |
|
1575 |
|
1576 |
|
1577 inline void TPtrC16::Set(const TPtrC16& aPtr) |
|
1578 {new(this) TPtrC16(aPtr);} |
|
1579 |
|
1580 |
|
1581 |
|
1582 |
|
1583 // class TBufCBase16 |
|
1584 inline TPtr16 TBufCBase16::DoDes(TInt aMaxLength) |
|
1585 {return TPtr16(*this,aMaxLength);} |
|
1586 |
|
1587 |
|
1588 |
|
1589 |
|
1590 // Template class TBufC16 |
|
1591 template <TInt S> |
|
1592 inline TBufC16<S>::TBufC16() |
|
1593 : TBufCBase16() |
|
1594 /** |
|
1595 Constructs an empty 16-bit non-modifiable buffer descriptor. |
|
1596 |
|
1597 It contains no data. |
|
1598 |
|
1599 The integer template parameter determines the size of the data area which |
|
1600 is created as part of the buffer descriptor object. |
|
1601 |
|
1602 Data can, subsequently, be assigned into this buffer descriptor using the |
|
1603 assignment operators. |
|
1604 |
|
1605 @see TBufC16::operator= |
|
1606 */ |
|
1607 {} |
|
1608 |
|
1609 |
|
1610 |
|
1611 |
|
1612 template <TInt S> |
|
1613 inline TBufC16<S>::TBufC16(const TUint16 *aString) |
|
1614 : TBufCBase16(aString,S) |
|
1615 /** |
|
1616 Constructs the 16-bit non-modifiable buffer descriptor from a zero terminated |
|
1617 string. |
|
1618 |
|
1619 The integer template parameter determines the size of the data area which |
|
1620 is created as part of this object. |
|
1621 |
|
1622 The string, excluding the zero terminator, is copied into this buffer descriptor's |
|
1623 data area. The length of this buffer descriptor is set to the length of the |
|
1624 string, excluding the zero terminator. |
|
1625 |
|
1626 @panic USER 8, if the length of the string, excluding the zero terminator, is |
|
1627 greater than the value of the integer template parameter. |
|
1628 |
|
1629 @param aString A pointer to a zero terminated string. |
|
1630 */ |
|
1631 {} |
|
1632 |
|
1633 |
|
1634 |
|
1635 |
|
1636 template <TInt S> |
|
1637 inline TBufC16<S>::TBufC16(const TDesC16 &aDes) |
|
1638 : TBufCBase16(aDes,S) |
|
1639 /** |
|
1640 Constructs the 16-bit non-modifiable buffer descriptor from any |
|
1641 existing descriptor. |
|
1642 |
|
1643 The integer template parameter determines the size of the data area which |
|
1644 is created as part of this object. |
|
1645 |
|
1646 Data is copied from the source descriptor into this buffer descriptor and |
|
1647 the length of this buffer descriptor is set to the length of the |
|
1648 source descriptor. |
|
1649 |
|
1650 @param aDes The source 16-bit non-modifiable descriptor. |
|
1651 |
|
1652 @panic USER 8, if the length of the source descriptor is |
|
1653 greater than the value of the integer template parameter. |
|
1654 */ |
|
1655 {} |
|
1656 |
|
1657 |
|
1658 |
|
1659 |
|
1660 template <TInt S> |
|
1661 inline TBufC16<S> &TBufC16<S>::operator=(const TUint16 *aString) |
|
1662 /** |
|
1663 Copies data into this descriptor replacing any existing data. |
|
1664 |
|
1665 The length of this descriptor is set to reflect the new data. |
|
1666 |
|
1667 @param aString A pointer to a zero-terminated string. |
|
1668 |
|
1669 @return A reference to this descriptor. |
|
1670 |
|
1671 @panic USER 11, if the length of the string, excluding the zero terminator, is |
|
1672 greater than the maximum length of this (target) descriptor. |
|
1673 */ |
|
1674 {Copy(aString,S);return(*this);} |
|
1675 |
|
1676 |
|
1677 |
|
1678 |
|
1679 template <TInt S> |
|
1680 inline TBufC16<S> &TBufC16<S>::operator=(const TDesC16 &aDes) |
|
1681 /** |
|
1682 Copies data into this descriptor, replacing any existing data. |
|
1683 |
|
1684 The length of this descriptor is set to reflect the new data. |
|
1685 |
|
1686 @param aDes A 16-bit non-modifiable descriptor. |
|
1687 |
|
1688 @panic USER 11, if the length of the descriptor aDes is |
|
1689 greater than the maximum length of this (target) descriptor. |
|
1690 |
|
1691 @return A reference to this descriptor. |
|
1692 */ |
|
1693 {Copy(aDes,S);return(*this);} |
|
1694 |
|
1695 |
|
1696 |
|
1697 |
|
1698 template <TInt S> |
|
1699 inline TPtr16 TBufC16<S>::Des() |
|
1700 /** |
|
1701 Creates and returns a 16-bit modifiable pointer descriptor for the data |
|
1702 represented by this 16-bit non-modifiable buffer descriptor. |
|
1703 |
|
1704 The content of a non-modifiable buffer descriptor normally cannot be altered, |
|
1705 other than by complete replacement of the data. Creating a modifiable pointer |
|
1706 descriptor provides a way of changing the data. |
|
1707 |
|
1708 The modifiable pointer descriptor is set to point to this non-modifiable buffer |
|
1709 descriptor's data. |
|
1710 |
|
1711 The length of the modifiable pointer descriptor is set to the length of this |
|
1712 non-modifiable buffer descriptor. |
|
1713 |
|
1714 The maximum length of the modifiable pointer descriptor is set to the value |
|
1715 of the integer template parameter. |
|
1716 |
|
1717 When data is modified through this new pointer descriptor, the lengths of |
|
1718 both it and this constant buffer descriptor are changed. |
|
1719 |
|
1720 @return A 16-bit modifiable pointer descriptor representing the data in this |
|
1721 16-bit non-modifiable buffer descriptor. |
|
1722 */ |
|
1723 {return(DoDes(S));} |
|
1724 |
|
1725 |
|
1726 |
|
1727 |
|
1728 #ifndef __KERNEL_MODE__ |
|
1729 // Class HBufC16 |
|
1730 inline HBufC16 &HBufC16::operator=(const HBufC16 &aLcb) |
|
1731 /** |
|
1732 Copies data into this 16-bit heap descriptor replacing any existing data. |
|
1733 |
|
1734 The length of this descriptor is set to reflect the new data. |
|
1735 |
|
1736 Note that the maximum length of this (target) descriptor is the length |
|
1737 of the descriptor buffer in the allocated host heap cell; this may be greater |
|
1738 than the maximum length specified when this descriptor was created or |
|
1739 last re-allocated. |
|
1740 |
|
1741 @param aLcb The source 16-bit heap descriptor. |
|
1742 |
|
1743 @return A reference to this 16-bit heap descriptor. |
|
1744 |
|
1745 @panic USER 11, if the length of the descriptor aLcb is greater than the |
|
1746 maximum length of this (target) descriptor |
|
1747 */ |
|
1748 {return *this=static_cast<const TDesC16&>(aLcb);} |
|
1749 #endif |
|
1750 |
|
1751 |
|
1752 |
|
1753 |
|
1754 // Class TDes16 |
|
1755 inline TDes16 &TDes16::operator=(const TUint16 *aString) |
|
1756 /** |
|
1757 Copies data into this descriptor replacing any existing data. |
|
1758 |
|
1759 The length of this descriptor is set to reflect the new data. |
|
1760 |
|
1761 @param aString A pointer to a zero-terminated string. |
|
1762 |
|
1763 @return A reference to this, the target descriptor. |
|
1764 |
|
1765 @panic USER 11, if the length of the string, excluding the zero terminator, is |
|
1766 greater than the maximum length of this (target) descriptor. |
|
1767 */ |
|
1768 {Copy(aString);return(*this);} |
|
1769 |
|
1770 |
|
1771 |
|
1772 |
|
1773 inline TDes16 &TDes16::operator=(const TDesC16 &aDes) |
|
1774 /** |
|
1775 Copies data into this descriptor replacing any existing data. |
|
1776 |
|
1777 The length of this descriptor is set to reflect the new data. |
|
1778 |
|
1779 @param aDes A 16-bit non-modifiable descriptor. |
|
1780 |
|
1781 @return A reference to this, the target descriptor. |
|
1782 |
|
1783 @panic USER 11, if the length of the descriptor aDes is greater than the |
|
1784 maximum length of this (target) descriptor. |
|
1785 */ |
|
1786 {Copy(aDes);return(*this);} |
|
1787 |
|
1788 |
|
1789 |
|
1790 |
|
1791 inline TDes16 &TDes16::operator=(const TDes16 &aDes) |
|
1792 /** |
|
1793 Copies data into this descriptor replacing any existing data. |
|
1794 |
|
1795 The length of this descriptor is set to reflect the new data. |
|
1796 |
|
1797 @param aDes A 16-bit modifiable descriptor. |
|
1798 |
|
1799 @return A reference to this, the target descriptor. |
|
1800 |
|
1801 @panic USER 11, if the length of the descriptor aDes is greater than the |
|
1802 maximum length of this (target) descriptor. |
|
1803 */ |
|
1804 {Copy(aDes);return(*this);} |
|
1805 |
|
1806 |
|
1807 |
|
1808 |
|
1809 inline TDes16 &TDes16::operator+=(const TDesC16 &aDes) |
|
1810 /** |
|
1811 Appends data onto the end of this descriptor's data and returns a reference |
|
1812 to this descriptor. |
|
1813 |
|
1814 The length of this descriptor is incremented to reflect the new content. |
|
1815 |
|
1816 @param aDes A 16-bit non-modifiable descriptor whose data is to be appended. |
|
1817 |
|
1818 @return A reference to this descriptor. |
|
1819 |
|
1820 @panic USER 11, if the resulting length of this descriptor is greater than its |
|
1821 maximum length. |
|
1822 */ |
|
1823 {Append(aDes);return(*this);} |
|
1824 |
|
1825 |
|
1826 |
|
1827 |
|
1828 inline const TUint16 &TDes16::operator[](TInt anIndex) const |
|
1829 /** |
|
1830 Gets a const reference to a single data item within this descriptor's data. |
|
1831 |
|
1832 @param anIndex The position the data item within this descriptor's data. This |
|
1833 is an offset value; a zero value refers to the leftmost data position. |
|
1834 |
|
1835 @return A const reference to the data item at the specified position. |
|
1836 |
|
1837 @panic USER 9, if anIndex is negative or is greater than or equal to the |
|
1838 current length of this descriptor. |
|
1839 */ |
|
1840 {return(AtC(anIndex));} |
|
1841 |
|
1842 |
|
1843 |
|
1844 |
|
1845 inline TUint16 &TDes16::operator[](TInt anIndex) |
|
1846 /** |
|
1847 Gets a non-const reference to a single data item within this descriptor's |
|
1848 data. |
|
1849 |
|
1850 @param anIndex The position of the data item within this descriptor's data. |
|
1851 This is an offset value; a zero value refers to the leftmost |
|
1852 data position. |
|
1853 |
|
1854 @return A non-const reference to the data item at the specified position. |
|
1855 |
|
1856 @panic USER 9, if anIndex is negative or is greater than or equal to the |
|
1857 current length of this descriptor. |
|
1858 */ |
|
1859 {return((TUint16 &)AtC(anIndex));} |
|
1860 |
|
1861 |
|
1862 |
|
1863 |
|
1864 inline TInt TDes16::MaxLength() const |
|
1865 /** |
|
1866 Gets the maximum length of the descriptor. |
|
1867 |
|
1868 This is the upper limit for the number of 16-bit values or data items that |
|
1869 the descriptor can represent. |
|
1870 |
|
1871 @return The maximum length of data that the descriptor can represent. |
|
1872 */ |
|
1873 {return(iMaxLength);} |
|
1874 |
|
1875 |
|
1876 |
|
1877 |
|
1878 inline TInt TDes16::MaxSize() const |
|
1879 /** |
|
1880 Gets the maximum size of the descriptor. |
|
1881 |
|
1882 This is the upper limit for the number of bytes which the data represented by |
|
1883 the descriptor can occupy. |
|
1884 |
|
1885 @return The maximum size of the descriptor data. |
|
1886 */ |
|
1887 {return(iMaxLength<<1);} |
|
1888 |
|
1889 |
|
1890 |
|
1891 |
|
1892 inline TUint16 * TDes16::WPtr() const |
|
1893 {return((TUint16 *)Ptr());} |
|
1894 |
|
1895 |
|
1896 |
|
1897 |
|
1898 // Class TPtr16 |
|
1899 inline TPtr16 &TPtr16::operator=(const TUint16 *aString) |
|
1900 /** |
|
1901 Copies data into this 16-bit modifiable pointer descriptor replacing |
|
1902 any existing data. |
|
1903 |
|
1904 The length of this descriptor is set to reflect the new data. |
|
1905 |
|
1906 @param aString A pointer to a zero-terminated string. |
|
1907 |
|
1908 @return A reference to this 16-bit modifiable pointer descriptor. |
|
1909 |
|
1910 @panic USER 11, if the length of the string, excluding the zero terminator, is |
|
1911 greater than the maximum length of this descriptor. |
|
1912 */ |
|
1913 {Copy(aString);return(*this);} |
|
1914 |
|
1915 |
|
1916 |
|
1917 |
|
1918 inline TPtr16 &TPtr16::operator=(const TDesC16 &aDes) |
|
1919 /** |
|
1920 Copies data into this 16-bit modifiable pointer descriptor replacing any |
|
1921 existing data. |
|
1922 |
|
1923 The length of this descriptor is set to reflect the new data. |
|
1924 |
|
1925 @param aDes A 16-bit non-modifiable descriptor whose data is to be copied |
|
1926 into this descriptor. |
|
1927 |
|
1928 @return A reference to this 16-bit modifiable pointer descriptor. |
|
1929 |
|
1930 @panic USER 11, if the length of aDes is greater than the maximum |
|
1931 length of this descriptor. |
|
1932 */ |
|
1933 {Copy(aDes);return(*this);} |
|
1934 |
|
1935 |
|
1936 |
|
1937 |
|
1938 inline TPtr16 &TPtr16::operator=(const TPtr16 &aDes) |
|
1939 /** |
|
1940 Copies data into this 16-bit modifiable pointer descriptor replacing any |
|
1941 existing data. |
|
1942 |
|
1943 The length of this descriptor is set to reflect the new data. |
|
1944 |
|
1945 @param aDes A 16-bit modifiable pointer descriptor whose data is to be copied |
|
1946 into this descriptor. |
|
1947 |
|
1948 @return A reference to this 16-bit modifiable pointer descriptor. |
|
1949 |
|
1950 @panic USER 11, if the length of aDes is greater than the maximum |
|
1951 length of this descriptor. |
|
1952 */ |
|
1953 {Copy(aDes);return(*this);} |
|
1954 |
|
1955 |
|
1956 |
|
1957 |
|
1958 inline void TPtr16::Set(TUint16 *aBuf,TInt aLength,TInt aMaxLength) |
|
1959 /** |
|
1960 Sets the 16-bit modifiable pointer descriptor to point to the specified location |
|
1961 in memory, whether in RAM or ROM. |
|
1962 |
|
1963 The length of the descriptor and its maximum length are set to the specified |
|
1964 values. |
|
1965 |
|
1966 @param aBuf A pointer to the location that the descriptor is to represent. |
|
1967 @param aLength The length of the descriptor. |
|
1968 @param aMaxLength The maximum length of the descriptor. |
|
1969 |
|
1970 @panic USER 8, if aLength is negative or is greater than the maximum length of |
|
1971 this descriptor. |
|
1972 @panic USER 18, if aMaxLength is negative. |
|
1973 */ |
|
1974 {new(this) TPtr16(aBuf,aLength,aMaxLength);} |
|
1975 |
|
1976 |
|
1977 |
|
1978 |
|
1979 inline void TPtr16::Set(const TPtr16 &aPtr) |
|
1980 /** |
|
1981 Sets the 16-bit modifiable pointer descriptor from an existing |
|
1982 16-bit modifiable pointer descriptor. |
|
1983 |
|
1984 It is set to point to the same data, is given the same length and the same |
|
1985 maximum length as the source pointer descriptor. |
|
1986 |
|
1987 @param aPtr The source 16-bit modifiable pointer descriptor. |
|
1988 */ |
|
1989 {new(this) TPtr16(aPtr);} |
|
1990 |
|
1991 |
|
1992 |
|
1993 |
|
1994 // Template class TBuf16 |
|
1995 template <TInt S> |
|
1996 inline TBuf16<S>::TBuf16() |
|
1997 : TBufBase16(S) |
|
1998 /** |
|
1999 Constructs an empty 16-bit modifiable buffer descriptor. |
|
2000 |
|
2001 It contains no data. |
|
2002 |
|
2003 The integer template parameter determines the size of the data area created |
|
2004 as part of the object and defines the descriptor's maximum length. |
|
2005 */ |
|
2006 {} |
|
2007 |
|
2008 |
|
2009 |
|
2010 |
|
2011 template <TInt S> |
|
2012 inline TBuf16<S>::TBuf16(TInt aLength) |
|
2013 : TBufBase16(aLength,S) |
|
2014 /** |
|
2015 Constructs an empty 16-bit modifiable buffer descriptor and sets the its length |
|
2016 to the specified value. |
|
2017 |
|
2018 No data is assigned to the descriptor. |
|
2019 |
|
2020 The integer template parameter defines the size of the data area created as |
|
2021 part of the object and defines the descriptor's maximum length. |
|
2022 |
|
2023 @param aLength The length of this modifiable buffer descriptor. |
|
2024 |
|
2025 @panic USER 8, if aLength is negative or is greater than the |
|
2026 value of the integer template parameter. |
|
2027 */ |
|
2028 {} |
|
2029 |
|
2030 |
|
2031 |
|
2032 |
|
2033 template <TInt S> |
|
2034 inline TBuf16<S>::TBuf16(const TUint16 *aString) |
|
2035 : TBufBase16(aString,S) |
|
2036 /** |
|
2037 Constructs the 16-bit modifiable buffer descriptor from |
|
2038 a zero terminated string. |
|
2039 |
|
2040 The integer template parameter determines the size of the data area that is |
|
2041 created as part of this object, and defines the descriptor's maximum length. |
|
2042 |
|
2043 The string, excluding the zero terminator, is copied into this buffer |
|
2044 descriptor's data area. The length of this buffer descriptor is set to the |
|
2045 length of the string, excluding the zero terminator. |
|
2046 |
|
2047 @param aString A pointer to a zero terminated string. |
|
2048 |
|
2049 @panic USER 11, if the length of the string, excluding the zero terminator, |
|
2050 is greater than the value of the integer template parameter. |
|
2051 */ |
|
2052 {} |
|
2053 |
|
2054 |
|
2055 |
|
2056 |
|
2057 template <TInt S> |
|
2058 inline TBuf16<S>::TBuf16(const TDesC16 &aDes) |
|
2059 : TBufBase16(aDes,S) |
|
2060 /** |
|
2061 Constructs the 16-bit modifiable buffer descriptor from any existing |
|
2062 16-bit descriptor. |
|
2063 |
|
2064 The integer template parameter determines the size of the data area created |
|
2065 as part of this object and defines the descriptor's maximum length. |
|
2066 |
|
2067 Data is copied from the source descriptor into this modifiable buffer descriptor |
|
2068 and the length of this modifiable buffer descriptor is set to the length of |
|
2069 the source descriptor. |
|
2070 |
|
2071 @param aDes The source 16-bit non-modifiable descriptor. |
|
2072 |
|
2073 @panic USER 11, if the length of the source descriptor is greater than the |
|
2074 value of the integer template parameter. |
|
2075 */ |
|
2076 {} |
|
2077 |
|
2078 |
|
2079 |
|
2080 |
|
2081 template <TInt S> |
|
2082 inline TBuf16<S> &TBuf16<S>::operator=(const TUint16 *aString) |
|
2083 /** |
|
2084 Copies data into this 16-bit modifiable buffer descriptor, replacing any |
|
2085 existing data. |
|
2086 |
|
2087 The length of this descriptor is set to reflect the new data. |
|
2088 |
|
2089 @param aString A pointer to a zero-terminated string. |
|
2090 |
|
2091 @return A reference to this descriptor. |
|
2092 |
|
2093 @panic USER 11, if the length of the string, excluding the zero terminator, |
|
2094 is greater than the maximum length of this (target) descriptor. |
|
2095 */ |
|
2096 {Copy(aString);return(*this);} |
|
2097 |
|
2098 |
|
2099 |
|
2100 |
|
2101 template <TInt S> |
|
2102 inline TBuf16<S> &TBuf16<S>::operator=(const TDesC16 &aDes) |
|
2103 /** |
|
2104 Copies data into this 16-bit modifiable descriptor, replacing any |
|
2105 existing data. |
|
2106 |
|
2107 The length of this descriptor is set to reflect the new data. |
|
2108 |
|
2109 @param aDes A 16-bit non-modifiable descriptor. |
|
2110 |
|
2111 @return A reference to this descriptor. |
|
2112 |
|
2113 @panic USER 11, if the length of the descriptor aDes is greater than the |
|
2114 maximum length of this (target) descriptor. |
|
2115 */ |
|
2116 {Copy(aDes);return(*this);} |
|
2117 |
|
2118 |
|
2119 |
|
2120 |
|
2121 template <TInt S> |
|
2122 inline TBuf16<S>& TBuf16<S>::operator=(const TBuf16<S>& aBuf) |
|
2123 /** |
|
2124 Copies data into this 16-bit modifiable buffer descriptor replacing any |
|
2125 existing data. |
|
2126 |
|
2127 The length of this descriptor is set to reflect the new data. |
|
2128 |
|
2129 @param aBuf The source 16-bit modifiable buffer descriptor with the same |
|
2130 template value. |
|
2131 |
|
2132 @return A reference to this 16-bit modifiable buffer descriptor. |
|
2133 |
|
2134 @panic USER 11, if the length of the descriptor aDes is greater than the |
|
2135 maximum length of this (target) descriptor. |
|
2136 */ |
|
2137 {Copy(aBuf);return *this;} |
|
2138 |
|
2139 |
|
2140 // Class RBuf16 |
|
2141 inline RBuf16& RBuf16::operator=(const TUint16* aString) |
|
2142 /** |
|
2143 Copies data into this descriptor replacing any existing data. |
|
2144 |
|
2145 The length of this descriptor is set to reflect the new data. |
|
2146 |
|
2147 @param aString A pointer to a zero-terminated string. |
|
2148 |
|
2149 @return A reference to this, the target descriptor. |
|
2150 |
|
2151 @panic USER 11, if the length of the string, excluding the zero terminator, is |
|
2152 greater than the maximum length of this (target) descriptor. |
|
2153 */ |
|
2154 {Copy(aString);return(*this);} |
|
2155 |
|
2156 |
|
2157 |
|
2158 |
|
2159 inline RBuf16& RBuf16::operator=(const TDesC16& aDes) |
|
2160 /** |
|
2161 Copies data into this descriptor replacing any existing data. |
|
2162 |
|
2163 The length of this descriptor is set to reflect the new data. |
|
2164 |
|
2165 @param aDes A 16-bit non-modifiable descriptor. |
|
2166 |
|
2167 @return A reference to this, the target descriptor. |
|
2168 |
|
2169 @panic USER 11, if the length of the descriptor aDes is greater than the |
|
2170 maximum length of this (target) descriptor. |
|
2171 */ |
|
2172 {Copy(aDes);return(*this);} |
|
2173 |
|
2174 |
|
2175 |
|
2176 |
|
2177 inline RBuf16& RBuf16::operator=(const RBuf16& aDes) |
|
2178 /** |
|
2179 Copies data into this descriptor replacing any existing data. |
|
2180 |
|
2181 The length of this descriptor is set to reflect the new data. |
|
2182 |
|
2183 @param aDes A 16-bit buffer descriptor. |
|
2184 |
|
2185 @return A reference to this, the target descriptor. |
|
2186 |
|
2187 @panic USER 11, if the length of the descriptor aDes is greater than the |
|
2188 maximum length of this (target) descriptor. |
|
2189 */ |
|
2190 {Copy(aDes);return(*this);} |
|
2191 |
|
2192 |
|
2193 |
|
2194 |
|
2195 /** |
|
2196 Creates a 16-bit resizable buffer descriptor that has been initialised with |
|
2197 data from the specified read stream; leaves on failure. |
|
2198 |
|
2199 Data is assigned to the new descriptor from the specified stream. |
|
2200 This variant assumes that the stream contains the length of the data followed |
|
2201 by the data itself. |
|
2202 |
|
2203 The function is implemented by calling the HBufC16::NewL(RReadStream&,TInt) |
|
2204 variant and then assigning the resulting heap descriptor using |
|
2205 the RBuf16::Assign(HBufC16*) variant. The comments that describe |
|
2206 the HBufC16::NewL() variant also apply to this RBuf16::CreateL() function. |
|
2207 |
|
2208 The function may leave with one of the system-wide error codes, specifically |
|
2209 KErrOverflow, if the length of the data as read from the stream is greater than |
|
2210 the upper limit as specified by the aMaxLength parameter. |
|
2211 |
|
2212 @param aStream The stream from which the data length and the data to be |
|
2213 assigned to the new descriptor, are taken. |
|
2214 @param aMaxLength The upper limit on the length of data that the descriptor is |
|
2215 to represent. The value of this parameter must be non-negative |
|
2216 otherwise the underlying function will panic. |
|
2217 */ |
|
2218 inline void RBuf16::CreateL(RReadStream &aStream,TInt aMaxLength) |
|
2219 { |
|
2220 Assign(HBufC16::NewL(aStream,aMaxLength)); |
|
2221 } |
|
2222 |
|
2223 |
|
2224 // Template class TLitC16 |
|
2225 template <TInt S> |
|
2226 inline const TDesC16* TLitC16<S>::operator&() const |
|
2227 /** |
|
2228 Returns a const TDesC16 type pointer. |
|
2229 |
|
2230 @return A descriptor type pointer to this literal. |
|
2231 */ |
|
2232 {return REINTERPRET_CAST(const TDesC16*,this);} |
|
2233 |
|
2234 |
|
2235 |
|
2236 |
|
2237 template <TInt S> |
|
2238 inline const TDesC16& TLitC16<S>::operator()() const |
|
2239 /** |
|
2240 Returns a const TDesC16 type reference. |
|
2241 |
|
2242 @return A descriptor type reference to this literal |
|
2243 */ |
|
2244 {return *operator&();} |
|
2245 |
|
2246 |
|
2247 |
|
2248 |
|
2249 template <TInt S> |
|
2250 inline TLitC16<S>::operator const TDesC16&() const |
|
2251 /** |
|
2252 Invoked by the compiler when a TLitC16<TInt> type is passed to a function |
|
2253 which is prototyped to take a const TDesC16& type. |
|
2254 */ |
|
2255 {return *operator&();} |
|
2256 |
|
2257 |
|
2258 |
|
2259 |
|
2260 template <TInt S> |
|
2261 inline TLitC16<S>::operator const __TRefDesC16() const |
|
2262 /** |
|
2263 Invoked by the compiler when a TLitC16<TInt> type is passed to a function |
|
2264 which is prototyped to take a const TRefByValue<const TDesC16> type. |
|
2265 |
|
2266 @see __TRefDesC16 |
|
2267 */ |
|
2268 {return *operator&();} |
|
2269 #endif //__KERNEL_MODE__ |
|
2270 |
|
2271 |
|
2272 |
|
2273 |
|
2274 // Template class TBufC |
|
2275 #if defined(_UNICODE) && !defined(__KERNEL_MODE__) |
|
2276 template <TInt S> |
|
2277 inline TBufC<S>::TBufC() |
|
2278 : TBufCBase16() |
|
2279 /** |
|
2280 Constructs an empty build independent non-modifiable buffer descriptor. |
|
2281 |
|
2282 It contains no data. |
|
2283 |
|
2284 The integer template parameter determines the size of the data area which |
|
2285 is created as part of the buffer descriptor object. |
|
2286 |
|
2287 Data can, subsequently, be assigned into this buffer descriptor using the |
|
2288 assignment operators. |
|
2289 |
|
2290 @see TBufC::operator= |
|
2291 */ |
|
2292 {} |
|
2293 |
|
2294 |
|
2295 |
|
2296 |
|
2297 template <TInt S> |
|
2298 inline TBufC<S>::TBufC(const TText *aString) |
|
2299 : TBufCBase16(aString,S) |
|
2300 /** |
|
2301 Constructs a build independent non-modifiable |
|
2302 buffer descriptor from a zero terminated string. |
|
2303 |
|
2304 The integer template parameter determines the size of the data area which |
|
2305 is created as part of this object. |
|
2306 |
|
2307 The string, excluding the zero terminator, is copied into this buffer descriptor's |
|
2308 data area. The length of this buffer descriptor is set to the length of the |
|
2309 string, excluding the zero terminator. |
|
2310 |
|
2311 @param aString A pointer to a zero terminated string. |
|
2312 |
|
2313 @panic USER 8, if the length of the string, excluding the zero terminator, is |
|
2314 greater than the value of the integer template parameter for |
|
2315 the 16-bit build variant. |
|
2316 |
|
2317 @panic USER 20, if the length of the string, excluding the zero terminator, is |
|
2318 greater than the value of the integer template parameter for |
|
2319 the 8-bit build variant. |
|
2320 */ |
|
2321 {} |
|
2322 |
|
2323 |
|
2324 |
|
2325 |
|
2326 template <TInt S> |
|
2327 inline TBufC<S>::TBufC(const TDesC &aDes) |
|
2328 : TBufCBase16(aDes,S) |
|
2329 /** |
|
2330 Constructs a build-independent non-modifiable buffer descriptor from any |
|
2331 existing build independent descriptor. |
|
2332 |
|
2333 The integer template parameter determines the size of the data area which |
|
2334 is created as part of this object. |
|
2335 |
|
2336 Data is copied from the source descriptor into this buffer descriptor and |
|
2337 the length of this buffer descriptor is set to the length of the source descriptor. |
|
2338 |
|
2339 The length of the source descriptor must not be greater than the value of |
|
2340 the integer template parameter, otherwise the constructor raises a USER 20 |
|
2341 panic for an 8 bit build variant or a USER 8 panic for a 16 bit (Unicode) |
|
2342 build variant. |
|
2343 |
|
2344 @param aDes The source build independent non-modifiable descriptor. |
|
2345 |
|
2346 @panic USER 8, if the length of the source descriptor is |
|
2347 greater than the value of the integer template parameter for |
|
2348 the 16-bit build variant. |
|
2349 |
|
2350 @panic USER 20, if the length of the source descriptor is |
|
2351 greater than the value of the integer template parameter for |
|
2352 the 8-bit build variant. |
|
2353 */ |
|
2354 {} |
|
2355 #else |
|
2356 template <TInt S> |
|
2357 inline TBufC<S>::TBufC() |
|
2358 : TBufCBase8() |
|
2359 {} |
|
2360 template <TInt S> |
|
2361 inline TBufC<S>::TBufC(const TText *aString) |
|
2362 : TBufCBase8(aString,S) |
|
2363 {} |
|
2364 template <TInt S> |
|
2365 inline TBufC<S>::TBufC(const TDesC &aDes) |
|
2366 : TBufCBase8(aDes,S) |
|
2367 {} |
|
2368 #endif |
|
2369 template <TInt S> |
|
2370 inline TBufC<S> &TBufC<S>::operator=(const TText *aString) |
|
2371 /** |
|
2372 Copies data into this descriptor, replacing any existing data. |
|
2373 |
|
2374 The length of this descriptor is set to reflect the new data. |
|
2375 |
|
2376 @param aString A pointer to a zero-terminated string. |
|
2377 |
|
2378 @return A reference to this descriptor. |
|
2379 |
|
2380 @panic USER 11, if the length of the string, excluding the zero terminator, |
|
2381 is greater than the maximum length of this (target) descriptor |
|
2382 for the 16-bit build variant. |
|
2383 |
|
2384 @panic USER 23, if the length of the string, excluding the zero terminator, |
|
2385 is greater than the maximum length of this (target) descriptor |
|
2386 for the 8-bit build variant. |
|
2387 */ |
|
2388 {Copy(aString,S);return(*this);} |
|
2389 |
|
2390 |
|
2391 |
|
2392 |
|
2393 template <TInt S> |
|
2394 inline TBufC<S> &TBufC<S>::operator=(const TDesC &aDes) |
|
2395 /** |
|
2396 Copies data into this descriptor, replacing any existing data. |
|
2397 |
|
2398 The length of this descriptor is set to reflect the new data. |
|
2399 |
|
2400 @param aDes A build independent non-modifiable descriptor. |
|
2401 |
|
2402 @return A reference to this descriptor. |
|
2403 |
|
2404 @panic USER 11, if the length of the descriptor aDes is greater than the |
|
2405 maximum length of this (target) descriptor for the 16-bit |
|
2406 build variant. |
|
2407 |
|
2408 @panic USER 23, if the length of the descriptor aDes is greater than the |
|
2409 maximum length of this (target) descriptor for the 8-bit |
|
2410 build variant. |
|
2411 */ |
|
2412 {Copy(aDes,S);return(*this);} |
|
2413 |
|
2414 |
|
2415 |
|
2416 |
|
2417 template <TInt S> |
|
2418 inline TPtr TBufC<S>::Des() |
|
2419 /** |
|
2420 Creates and returns a build-independent modifiable pointer descriptor for |
|
2421 the data represented by this build-independent non-modifiable buffer |
|
2422 descriptor. |
|
2423 |
|
2424 The content of a non-modifiable buffer descriptor normally cannot be altered, |
|
2425 other than by complete replacement of the data. Creating a modifiable pointer |
|
2426 descriptor provides a way of changing the data. |
|
2427 |
|
2428 The modifiable pointer descriptor is set to point to this non-modifiable buffer |
|
2429 descriptor's data. |
|
2430 |
|
2431 The length of the modifiable pointer descriptor is set to the length of this |
|
2432 non-modifiable buffer descriptor. |
|
2433 |
|
2434 The maximum length of the modifiable pointer descriptor is set to the value |
|
2435 of the integer template parameter. |
|
2436 |
|
2437 When data is modified through this new pointer descriptor, the lengths of |
|
2438 both it and this constant buffer descriptor are changed. |
|
2439 |
|
2440 @return A build independent modifiable pointer descriptor representing the |
|
2441 data in this build independent non-modifiable buffer descriptor. |
|
2442 */ |
|
2443 {return(DoDes(S));} |
|
2444 |
|
2445 |
|
2446 |
|
2447 |
|
2448 // Template class TBuf |
|
2449 #if defined(_UNICODE) && !defined(__KERNEL_MODE__) |
|
2450 template <TInt S> |
|
2451 inline TBuf<S>::TBuf() |
|
2452 : TBufBase16(S) |
|
2453 /** |
|
2454 Creates a build-independent modifiable buffer descriptor which |
|
2455 contains no data. |
|
2456 |
|
2457 The integer template parameter determines the size of the data area that is created |
|
2458 as part of the object, and defines the descriptor's maximum length. |
|
2459 */ |
|
2460 {} |
|
2461 |
|
2462 |
|
2463 |
|
2464 |
|
2465 template <TInt S> |
|
2466 inline TBuf<S>::TBuf(TInt aLength) |
|
2467 : TBufBase16(aLength,S) |
|
2468 /** |
|
2469 Constructs an empty build independent modifiable buffer descriptor and |
|
2470 sets its length to the specified value. |
|
2471 |
|
2472 No data is assigned to the descriptor. |
|
2473 |
|
2474 The integer template parameter determines the size of the data area created |
|
2475 as part of the object and defines the descriptor's maximum length. |
|
2476 |
|
2477 @param aLength The length of this modifiable buffer descriptor. |
|
2478 |
|
2479 @panic USER 8, if aLength is negative and is greater than the value of the |
|
2480 integer template parameter for a 16-bit build variant. |
|
2481 |
|
2482 @panic USER 20, if aLength is negative and is greater than the value of the |
|
2483 integer template parameter for a 8-bit build variant. |
|
2484 */ |
|
2485 {} |
|
2486 |
|
2487 |
|
2488 |
|
2489 |
|
2490 template <TInt S> |
|
2491 inline TBuf<S>::TBuf(const TText *aString) |
|
2492 : TBufBase16(aString,S) |
|
2493 /** |
|
2494 Constructs the build-independent modifiable buffer descriptor from |
|
2495 a zero terminated string. |
|
2496 |
|
2497 The integer template parameter determines the size of the data area which |
|
2498 is created as part of this object. |
|
2499 |
|
2500 The string, excluding the zero terminator, is copied into this buffer |
|
2501 descriptor's data area. The length of this buffer descriptor is set to |
|
2502 the length of the string, excluding the zero terminator. |
|
2503 |
|
2504 @param aString A pointer to a zero terminated string. |
|
2505 |
|
2506 @panic USER 11, if the length of the string, excluding the zero terminator, |
|
2507 is greater than the value of the integer template parameter |
|
2508 for a 16-bit build variant. |
|
2509 @panic USER 23, if the length of the string, excluding the zero terminator, |
|
2510 is greater than the value of the integer template parameter |
|
2511 for a 8-bit build variant. |
|
2512 */ |
|
2513 {} |
|
2514 |
|
2515 |
|
2516 |
|
2517 |
|
2518 template <TInt S> |
|
2519 inline TBuf<S>::TBuf(const TDesC &aDes) |
|
2520 : TBufBase16(aDes,S) |
|
2521 /** |
|
2522 Constructs the build-independent modifiable buffer descriptor from any |
|
2523 existing build-independent descriptor. |
|
2524 |
|
2525 The integer template parameter determines the size of the data area created |
|
2526 as part of this object, and defines the descriptor's maximum length. |
|
2527 |
|
2528 Data is copied from the source descriptor into this modifiable buffer descriptor |
|
2529 and the length of this modifiable buffer descriptor is set to the length of |
|
2530 the source descriptor. |
|
2531 |
|
2532 @param aDes The source build independent non-modifiable descriptor. |
|
2533 |
|
2534 @panic USER 11, if the length of the source descriptor is greater than the |
|
2535 value of the integer template parameter for a 16-bit |
|
2536 build variant. |
|
2537 @panic USER 23, if the length of the source descriptor is greater than the |
|
2538 value of the integer template parameter for an 8-bit |
|
2539 build variant. |
|
2540 |
|
2541 */ |
|
2542 {} |
|
2543 #else |
|
2544 template <TInt S> |
|
2545 inline TBuf<S>::TBuf() |
|
2546 : TBufBase8(S) |
|
2547 {} |
|
2548 template <TInt S> |
|
2549 inline TBuf<S>::TBuf(TInt aLength) |
|
2550 : TBufBase8(aLength,S) |
|
2551 {} |
|
2552 template <TInt S> |
|
2553 inline TBuf<S>::TBuf(const TText *aString) |
|
2554 : TBufBase8(aString,S) |
|
2555 {} |
|
2556 template <TInt S> |
|
2557 inline TBuf<S>::TBuf(const TDesC &aDes) |
|
2558 : TBufBase8(aDes,S) |
|
2559 {} |
|
2560 #endif |
|
2561 template <TInt S> |
|
2562 inline TBuf<S> &TBuf<S>::operator=(const TText *aString) |
|
2563 {Copy(aString);return(*this);} |
|
2564 template <TInt S> |
|
2565 inline TBuf<S> &TBuf<S>::operator=(const TDesC &aDes) |
|
2566 {Copy(aDes);return(*this);} |
|
2567 template <TInt S> |
|
2568 inline TBuf<S> &TBuf<S>::operator=(const TBuf<S> &aBuf) |
|
2569 {Copy(aBuf);return(*this);} |
|
2570 |
|
2571 |
|
2572 |
|
2573 |
|
2574 // Template class TLitC |
|
2575 template <TInt S> |
|
2576 inline const TDesC* TLitC<S>::operator&() const |
|
2577 /** |
|
2578 Returns a const TDesC type pointer. |
|
2579 |
|
2580 @return A descriptor type pointer to this literal. |
|
2581 */ |
|
2582 {return REINTERPRET_CAST(const TDesC*,this);} |
|
2583 |
|
2584 |
|
2585 |
|
2586 |
|
2587 template <TInt S> |
|
2588 inline const TDesC& TLitC<S>::operator()() const |
|
2589 /** |
|
2590 Returns a const TDesC type reference. |
|
2591 |
|
2592 @return A descriptor type reference to this literal |
|
2593 */ |
|
2594 {return *operator&();} |
|
2595 |
|
2596 |
|
2597 |
|
2598 |
|
2599 template <TInt S> |
|
2600 inline TLitC<S>::operator const TDesC&() const |
|
2601 /** |
|
2602 Invoked by the compiler when a TLitC<TInt> type is passed to a function |
|
2603 which is prototyped to take a const TDesC& type. |
|
2604 */ |
|
2605 {return *operator&();} |
|
2606 |
|
2607 |
|
2608 |
|
2609 |
|
2610 template <TInt S> |
|
2611 inline TLitC<S>::operator const __TRefDesC() const |
|
2612 /** |
|
2613 Invoked by the compiler when a TLitC<TInt> type is passed to a function |
|
2614 which is prototyped to take a const TRefByValue<const TDesC> type. |
|
2615 |
|
2616 @see __TRefDesC. |
|
2617 */ |
|
2618 {return *operator&();} |
|
2619 |
|
2620 |
|
2621 |
|
2622 |
|
2623 // Template class TPckgC |
|
2624 template <class T> |
|
2625 inline TPckgC<T>::TPckgC(const T &aRef) |
|
2626 : TPtrC8((const TUint8 *)&aRef,sizeof(T)) |
|
2627 /** |
|
2628 Constructs a packaged non-modifiable pointer descriptor to represent |
|
2629 the specified object whose type is defined by the template parameter. |
|
2630 |
|
2631 @param aRef The object to be represented by this packaged non-modifiable |
|
2632 pointer descriptor. |
|
2633 */ |
|
2634 {} |
|
2635 |
|
2636 |
|
2637 |
|
2638 |
|
2639 template <class T> |
|
2640 inline const T &TPckgC<T>::operator()() const |
|
2641 /** |
|
2642 Gets a reference to the object represented by this packaged non-modifiable |
|
2643 pointer descriptor. |
|
2644 |
|
2645 @return The packaged object |
|
2646 */ |
|
2647 {return(*((const T *)iPtr));} |
|
2648 |
|
2649 |
|
2650 |
|
2651 |
|
2652 // Template class TPckg |
|
2653 template <class T> |
|
2654 inline TPckg<T>::TPckg(const T &aRef) |
|
2655 : TPtr8((TUint8 *)&aRef,sizeof(T),sizeof(T)) |
|
2656 /** |
|
2657 Constructs a packaged modifiable pointer descriptor to represent the specified |
|
2658 object whose type is defined by the template parameter. |
|
2659 |
|
2660 @param aRef The object to be represented by this packaged modifiable pointer |
|
2661 descriptor. |
|
2662 */ |
|
2663 {} |
|
2664 |
|
2665 |
|
2666 |
|
2667 |
|
2668 template <class T> |
|
2669 inline T &TPckg<T>::operator()() |
|
2670 /** |
|
2671 Gets a reference to the object represented by this packaged |
|
2672 modifiable pointer descriptor. |
|
2673 |
|
2674 @return The packaged object. |
|
2675 */ |
|
2676 {return(*((T *)iPtr));} |
|
2677 |
|
2678 |
|
2679 |
|
2680 |
|
2681 // Template class TPckgBuf |
|
2682 template <class T> |
|
2683 inline TPckgBuf<T>::TPckgBuf() |
|
2684 : TAlignedBuf8<sizeof(T)>(sizeof(T)) |
|
2685 /** |
|
2686 Constructs a packaged modifiable buffer descriptor for an object whose type |
|
2687 is defined by the template parameter. |
|
2688 |
|
2689 The length of the packaged descriptor is set to the length of the templated |
|
2690 class but no data is assigned into the descriptor. |
|
2691 */ |
|
2692 {new(&this->iBuf[0]) T;} |
|
2693 |
|
2694 |
|
2695 |
|
2696 |
|
2697 template <class T> |
|
2698 inline TPckgBuf<T>::TPckgBuf(const T &aRef) |
|
2699 : TAlignedBuf8<sizeof(T)>(sizeof(T)) |
|
2700 /** |
|
2701 Constructs a packaged modifiable buffer descriptor for an object whose type |
|
2702 is defined by the template parameter and copies the supplied object into the |
|
2703 descriptor. |
|
2704 |
|
2705 The length of the packaged descriptor is set to the length of the templated |
|
2706 class. |
|
2707 |
|
2708 @param aRef The source object to be copied into the packaged modifiable buffer |
|
2709 descriptor. |
|
2710 */ |
|
2711 {new(&this->iBuf[0]) T(aRef);} |
|
2712 |
|
2713 |
|
2714 |
|
2715 |
|
2716 template <class T> |
|
2717 inline TPckgBuf<T> &TPckgBuf<T>::operator=(const TPckgBuf<T> &aRef) |
|
2718 /** |
|
2719 Copies data from the specified packaged modifiable buffer descriptor into this |
|
2720 packaged modifiable buffer descriptor, replacing any existing data. |
|
2721 |
|
2722 @param aRef The source packaged modifiable buffer descriptor. |
|
2723 @return A reference to this packaged modifiable descriptor. |
|
2724 */ |
|
2725 {this->Copy(aRef);return(*this);} |
|
2726 |
|
2727 |
|
2728 |
|
2729 |
|
2730 template <class T> |
|
2731 inline T &TPckgBuf<T>::operator=(const T &aRef) |
|
2732 /** |
|
2733 Copies data from the specified object into this packaged modifiable buffer |
|
2734 descriptor, replacing any existing data. |
|
2735 |
|
2736 @param aRef The source object. |
|
2737 @return A reference to the copy of the source object in the packaged modifiable |
|
2738 buffer descriptor. |
|
2739 */ |
|
2740 {this->Copy((TUint8 *)&aRef,sizeof(T));return(*((T *)&this->iBuf[0]));} |
|
2741 |
|
2742 |
|
2743 |
|
2744 |
|
2745 template <class T> |
|
2746 inline T &TPckgBuf<T>::operator()() |
|
2747 /** |
|
2748 Gets a reference to the object contained by this packaged modifiable |
|
2749 buffer descriptor. |
|
2750 |
|
2751 @return The packaged object. |
|
2752 */ |
|
2753 {return(*((T *)&this->iBuf[0]));} |
|
2754 |
|
2755 |
|
2756 |
|
2757 |
|
2758 template <class T> |
|
2759 inline const T &TPckgBuf<T>::operator()() const |
|
2760 /** |
|
2761 Gets a const reference to the object contained by this packaged modifiable |
|
2762 buffer descriptor. |
|
2763 |
|
2764 @return The (const) packaged object. |
|
2765 */ |
|
2766 {return(*((T *)&this->iBuf[0]));} |
|
2767 |
|
2768 |
|
2769 |
|
2770 |
|
2771 // Class TRequestStatus |
|
2772 inline TRequestStatus::TRequestStatus() |
|
2773 /** |
|
2774 Default constructor. |
|
2775 */ |
|
2776 : iFlags(0) |
|
2777 {} |
|
2778 |
|
2779 |
|
2780 |
|
2781 |
|
2782 inline TRequestStatus::TRequestStatus(TInt aVal) |
|
2783 /** |
|
2784 Constructs an asynchronous request status object and assigns a completion value |
|
2785 to it. |
|
2786 |
|
2787 @param aVal The completion value to be assigned to the constructed request |
|
2788 status object. |
|
2789 */ |
|
2790 : iStatus(aVal), |
|
2791 iFlags(aVal==KRequestPending ? TRequestStatus::ERequestPending : 0) |
|
2792 |
|
2793 {} |
|
2794 |
|
2795 |
|
2796 |
|
2797 |
|
2798 inline TInt TRequestStatus::operator=(TInt aVal) |
|
2799 /** |
|
2800 Assigns the specified completion code to the request status object. |
|
2801 |
|
2802 @param aVal The value to be assigned. |
|
2803 |
|
2804 @return The value assigned. |
|
2805 */ |
|
2806 { |
|
2807 if(aVal==KRequestPending) |
|
2808 iFlags|=TRequestStatus::ERequestPending; |
|
2809 else |
|
2810 iFlags&=~TRequestStatus::ERequestPending; |
|
2811 return (iStatus=aVal); |
|
2812 } |
|
2813 |
|
2814 |
|
2815 |
|
2816 |
|
2817 inline TBool TRequestStatus::operator==(TInt aVal) const |
|
2818 /** |
|
2819 Tests whether the request status object's completion code is the same as |
|
2820 the specified value. |
|
2821 |
|
2822 @param aVal The value to be compared. |
|
2823 |
|
2824 @return True, if the values are equal; false otherwise. |
|
2825 */ |
|
2826 {return(iStatus==aVal);} |
|
2827 |
|
2828 |
|
2829 |
|
2830 |
|
2831 inline TBool TRequestStatus::operator!=(TInt aVal) const |
|
2832 /** |
|
2833 Tests whether the request status object's completion code is not equal to |
|
2834 the specified value. |
|
2835 |
|
2836 @param aVal The value to be compared. |
|
2837 |
|
2838 @return True, if the values are unequal; false otherwise. |
|
2839 */ |
|
2840 {return(iStatus!=aVal);} |
|
2841 |
|
2842 |
|
2843 |
|
2844 |
|
2845 inline TBool TRequestStatus::operator>=(TInt aVal) const |
|
2846 /** |
|
2847 Tests whether the request status object's completion code is greater than |
|
2848 or equal to the specified value. |
|
2849 |
|
2850 @param aVal The value to be compared. |
|
2851 |
|
2852 @return True, if the request status object's value is greater than or equal |
|
2853 to the specified value; false, otherwise. |
|
2854 */ |
|
2855 {return(iStatus>=aVal);} |
|
2856 |
|
2857 |
|
2858 |
|
2859 |
|
2860 inline TBool TRequestStatus::operator<=(TInt aVal) const |
|
2861 /** |
|
2862 Tests whether the request status object's completion code is less than or |
|
2863 equal to the specified value. |
|
2864 |
|
2865 @param aVal The value to be compared. |
|
2866 |
|
2867 @return True, if the request status object's value is less than or equal |
|
2868 to the specified value; false, otherwise. |
|
2869 */ |
|
2870 {return(iStatus<=aVal);} |
|
2871 |
|
2872 |
|
2873 |
|
2874 |
|
2875 inline TBool TRequestStatus::operator>(TInt aVal) const |
|
2876 /** |
|
2877 Tests whether the request status object's completion code is greater than |
|
2878 the specified value. |
|
2879 |
|
2880 @param aVal The value to be compared. |
|
2881 |
|
2882 @return True, if the request status object's value is greater than |
|
2883 the specified value; false, otherwise. |
|
2884 */ |
|
2885 {return(iStatus>aVal);} |
|
2886 |
|
2887 |
|
2888 |
|
2889 |
|
2890 inline TBool TRequestStatus::operator<(TInt aVal) const |
|
2891 /** |
|
2892 Tests whether the request status object's completion code is less than the |
|
2893 specified value. |
|
2894 |
|
2895 @param aVal The value to be compared. |
|
2896 |
|
2897 @return True, if the request status object's value is less than the specified |
|
2898 value; false, otherwise. |
|
2899 */ |
|
2900 {return(iStatus<aVal);} |
|
2901 |
|
2902 |
|
2903 |
|
2904 |
|
2905 inline TInt TRequestStatus::Int() const |
|
2906 /** |
|
2907 Gets this request status object's completion code value. |
|
2908 |
|
2909 @return The completion code. |
|
2910 */ |
|
2911 {return(iStatus);} |
|
2912 |
|
2913 |
|
2914 |
|
2915 |
|
2916 // Class TPoint |
|
2917 #ifndef __KERNEL_MODE__ |
|
2918 inline TPoint::TPoint() |
|
2919 : iX(0),iY(0) |
|
2920 /** |
|
2921 Constructs default point, initialising its iX and iY members to zero. |
|
2922 */ |
|
2923 {} |
|
2924 |
|
2925 |
|
2926 |
|
2927 |
|
2928 inline TPoint::TPoint(TInt aX,TInt aY) |
|
2929 : iX(aX),iY(aY) |
|
2930 /** |
|
2931 Constructs a point with the specified x and y co-ordinates. |
|
2932 |
|
2933 @param aX The x co-ordinate value. |
|
2934 @param aY The y co-ordinate value. |
|
2935 */ |
|
2936 {} |
|
2937 |
|
2938 |
|
2939 |
|
2940 |
|
2941 // Class TSize |
|
2942 inline TSize::TSize() |
|
2943 : iWidth(0),iHeight(0) |
|
2944 /** |
|
2945 Constructs the size object with its iWidth and iHeight members set to zero. |
|
2946 */ |
|
2947 {} |
|
2948 |
|
2949 |
|
2950 |
|
2951 |
|
2952 inline TSize::TSize(TInt aWidth,TInt aHeight) |
|
2953 : iWidth(aWidth),iHeight(aHeight) |
|
2954 /** |
|
2955 Constructs the size object with the specified width and height values. |
|
2956 |
|
2957 @param aWidth The width value. |
|
2958 @param aHeight The height value . |
|
2959 */ |
|
2960 {} |
|
2961 #endif |
|
2962 |
|
2963 |
|
2964 |
|
2965 // Class TPoint3D |
|
2966 #ifndef __KERNEL_MODE__ |
|
2967 inline TPoint3D::TPoint3D() |
|
2968 : iX(0),iY(0),iZ(0) |
|
2969 /** |
|
2970 Constructs default 3Dpoint, initialising its iX, iY and iZ members to zero. |
|
2971 */ |
|
2972 {} |
|
2973 |
|
2974 inline TPoint3D::TPoint3D(TInt aX,TInt aY,TInt aZ) |
|
2975 : iX(aX),iY(aY),iZ(aZ) |
|
2976 /** |
|
2977 Constructs TPoint3D with the specified x,y and z co-ordinates. |
|
2978 |
|
2979 @param aX The x co-ordinate value. |
|
2980 @param aY The y co-ordinate value. |
|
2981 @param aZ The z co-ordinate value. |
|
2982 */ |
|
2983 {} |
|
2984 |
|
2985 |
|
2986 |
|
2987 |
|
2988 inline TPoint3D::TPoint3D(const TPoint& aPoint) |
|
2989 :iX(aPoint.iX),iY(aPoint.iY),iZ(0) |
|
2990 /* |
|
2991 Copy Construct from TPoint , initialises Z co-ordinate to Zero |
|
2992 @param aPoint The TPoint from which we create TPoint3D object |
|
2993 */ |
|
2994 {} |
|
2995 |
|
2996 |
|
2997 #endif |
|
2998 |
|
2999 |
|
3000 // Class TFindHandle |
|
3001 inline TFindHandle::TFindHandle() |
|
3002 : iHandle(0), iSpare1(0), iObjectIdLow(0), iObjectIdHigh(0) |
|
3003 {} |
|
3004 |
|
3005 |
|
3006 |
|
3007 |
|
3008 inline TInt TFindHandle::Handle() const |
|
3009 /** |
|
3010 @publishedAll |
|
3011 @released |
|
3012 |
|
3013 Gets the find-handle number associated with the Kernel object. |
|
3014 |
|
3015 The find-handle number identifies the kernel object with respect to |
|
3016 its container. |
|
3017 |
|
3018 Note that setting the find-handle number into a TFindHandle object is not |
|
3019 implemented by this class; it is implemented by derived classes, typically by |
|
3020 their Next() member functions. The class TFindSemaphore is a good example. |
|
3021 |
|
3022 @return The find-handle number. |
|
3023 */ |
|
3024 {return iHandle;} |
|
3025 |
|
3026 |
|
3027 |
|
3028 |
|
3029 #ifdef __KERNEL_MODE__ |
|
3030 const TInt KFindHandleUniqueIdShift=16; ///< @internalComponent |
|
3031 const TInt KFindHandleUniqueIdMask=0x7fff; ///< @internalComponent |
|
3032 const TInt KFindHandleIndexMask=0x7fff; ///< @internalComponent |
|
3033 |
|
3034 |
|
3035 |
|
3036 |
|
3037 /** |
|
3038 Gets the index into its container at which the kernel object was last seen. |
|
3039 |
|
3040 @return The object's index in its container. |
|
3041 */ |
|
3042 inline TInt TFindHandle::Index() const |
|
3043 {return(iHandle&KFindHandleIndexMask);} |
|
3044 |
|
3045 |
|
3046 |
|
3047 |
|
3048 /** |
|
3049 Gets the unique ID of the kernel container this object resides in. |
|
3050 |
|
3051 @return The ID of this object's container. |
|
3052 */ |
|
3053 inline TInt TFindHandle::UniqueID() const |
|
3054 {return((iHandle>>KFindHandleUniqueIdShift)&KFindHandleUniqueIdMask);} |
|
3055 |
|
3056 |
|
3057 |
|
3058 |
|
3059 /** |
|
3060 Gets the unique ID of the kernel object itself. |
|
3061 |
|
3062 @return The ID of the object. |
|
3063 */ |
|
3064 inline TUint64 TFindHandle::ObjectID() const |
|
3065 {return MAKE_TUINT64(iObjectIdHigh, iObjectIdLow);} |
|
3066 |
|
3067 |
|
3068 |
|
3069 |
|
3070 /** |
|
3071 Sets the find handle to refer to a specific object. |
|
3072 |
|
3073 @oaram aIndex The current index of the object in its container. |
|
3074 @param aUniqueId The unique ID of the container object. |
|
3075 @param aObjectId The unique ID of the object iteself. |
|
3076 */ |
|
3077 inline void TFindHandle::Set(TInt aIndex, TInt aUniqueId, TUint64 aObjectId) |
|
3078 { |
|
3079 iHandle=(TInt)((aUniqueId<<KFindHandleUniqueIdShift)|aIndex); |
|
3080 iObjectIdLow=I64LOW(aObjectId); |
|
3081 iObjectIdHigh=I64HIGH(aObjectId); |
|
3082 } |
|
3083 |
|
3084 |
|
3085 #else |
|
3086 |
|
3087 |
|
3088 /** |
|
3089 Resets the find handle to its initial state. |
|
3090 */ |
|
3091 inline void TFindHandle::Reset() |
|
3092 { |
|
3093 iHandle=iSpare1=iObjectIdLow=iObjectIdHigh=0; |
|
3094 } |
|
3095 #endif |
|
3096 |
|
3097 |
|
3098 |
|
3099 |
|
3100 // Class RHandleBase |
|
3101 inline RHandleBase::RHandleBase() |
|
3102 : iHandle(0) |
|
3103 /** |
|
3104 Default constructor. |
|
3105 */ |
|
3106 {} |
|
3107 |
|
3108 |
|
3109 |
|
3110 |
|
3111 #ifndef __KERNEL_MODE__ |
|
3112 inline RHandleBase::RHandleBase(TInt aHandle) |
|
3113 : iHandle(aHandle) |
|
3114 /** |
|
3115 Copy constructor. |
|
3116 |
|
3117 It constructs this handle from an existing one. Specifically, the handle-number |
|
3118 encapsulated by the specified handle is copied to this handle. |
|
3119 |
|
3120 @param aHandle The existing handle to be copied. |
|
3121 */ |
|
3122 {} |
|
3123 #endif |
|
3124 |
|
3125 |
|
3126 |
|
3127 |
|
3128 inline void RHandleBase::SetHandle(TInt aHandle) |
|
3129 /** |
|
3130 Sets the handle-number of this handle to the specified |
|
3131 value. |
|
3132 |
|
3133 @param aHandle The handle-number to be set. |
|
3134 */ |
|
3135 { iHandle=aHandle; } |
|
3136 |
|
3137 |
|
3138 |
|
3139 |
|
3140 inline TInt RHandleBase::Handle() const |
|
3141 /** |
|
3142 Retrieves the handle-number of the object associated with this handle. |
|
3143 |
|
3144 @return The handle number |
|
3145 */ |
|
3146 {return(iHandle);} |
|
3147 |
|
3148 |
|
3149 |
|
3150 |
|
3151 inline TInt RHandleBase::SetReturnedHandle(TInt aHandleOrError) |
|
3152 /** |
|
3153 Sets the handle-number of this handle to the specified |
|
3154 value. |
|
3155 |
|
3156 The function can take a (zero or positive) handle-number, |
|
3157 or a (negative) error number. |
|
3158 |
|
3159 If aHandleOrError represents a handle-number, then the handle-number of this handle |
|
3160 is set to that value. |
|
3161 If aHandleOrError represents an error number, then the handle-number of this handle is set to zero |
|
3162 and the negative value is returned. |
|
3163 |
|
3164 @param aHandleOrError A handle-number, if zero or positive; an error value, if negative. |
|
3165 |
|
3166 @return KErrNone, if aHandle is a handle-number; the value of aHandleOrError, otherwise. |
|
3167 */ |
|
3168 { |
|
3169 if(aHandleOrError>=0) |
|
3170 { |
|
3171 iHandle = aHandleOrError; |
|
3172 return KErrNone; |
|
3173 } |
|
3174 iHandle = 0; |
|
3175 return aHandleOrError; |
|
3176 } |
|
3177 |
|
3178 |
|
3179 |
|
3180 |
|
3181 // Class RSemaphore |
|
3182 #ifndef __KERNEL_MODE__ |
|
3183 inline TInt RSemaphore::Open(const TFindSemaphore& aFind,TOwnerType aType) |
|
3184 /** |
|
3185 Opens a handle to the global semaphore found using a TFindSemaphore object. |
|
3186 |
|
3187 A TFindSemaphore object is used to find all global semaphores whose full names |
|
3188 match a specified pattern. |
|
3189 |
|
3190 By default, any thread in the process can use this instance of RSemaphore |
|
3191 to access the semaphore. However, specifying EOwnerThread as the second parameter |
|
3192 to this function, means that only the opening thread can use this instance |
|
3193 of RSemaphore to access the semaphore; any other thread in this process that |
|
3194 wants to access the semaphore must either duplicate the handle or use OpenGlobal() |
|
3195 again. |
|
3196 |
|
3197 @param aFind A reference to the TFindSemaphore object used to find the semaphore. |
|
3198 @param aType An enumeration whose enumerators define the ownership of this |
|
3199 semaphore handle. If not explicitly specified, EOwnerProcess is |
|
3200 taken as default. |
|
3201 |
|
3202 @return KErrNone if successful otherwise another of the system wide error codes. |
|
3203 */ |
|
3204 {return(RHandleBase::Open((const TFindHandleBase&)aFind,aType));} |
|
3205 #endif |
|
3206 |
|
3207 |
|
3208 |
|
3209 |
|
3210 // Class RFastLock |
|
3211 |
|
3212 |
|
3213 /** |
|
3214 Default constructor. |
|
3215 */ |
|
3216 inline RFastLock::RFastLock() |
|
3217 : iCount(0) |
|
3218 {} |
|
3219 |
|
3220 |
|
3221 |
|
3222 |
|
3223 // Class RMessagePtr2 |
|
3224 |
|
3225 |
|
3226 /** |
|
3227 Default constructor |
|
3228 */ |
|
3229 inline RMessagePtr2::RMessagePtr2() |
|
3230 : iHandle(0) |
|
3231 {} |
|
3232 |
|
3233 |
|
3234 |
|
3235 |
|
3236 /** |
|
3237 Tests whether this message handle is empty. |
|
3238 |
|
3239 @return True, if this message handle is empty, false, otherwise. |
|
3240 */ |
|
3241 inline TBool RMessagePtr2::IsNull() const |
|
3242 {return iHandle==0;} |
|
3243 |
|
3244 |
|
3245 |
|
3246 |
|
3247 /** |
|
3248 Gets the message handle value. |
|
3249 |
|
3250 @return The message handle value. |
|
3251 */ |
|
3252 inline TInt RMessagePtr2::Handle() const |
|
3253 {return iHandle;} |
|
3254 inline TBool operator==(RMessagePtr2 aLeft,RMessagePtr2 aRight) |
|
3255 {return aLeft.Handle()==aRight.Handle();} |
|
3256 inline TBool operator!=(RMessagePtr2 aLeft,RMessagePtr2 aRight) |
|
3257 {return aLeft.Handle()!=aRight.Handle();} |
|
3258 |
|
3259 |
|
3260 |
|
3261 |
|
3262 |
|
3263 // Class RMessage |
|
3264 |
|
3265 |
|
3266 /** |
|
3267 Default constructor |
|
3268 */ |
|
3269 inline RMessage2::RMessage2() |
|
3270 {} |
|
3271 |
|
3272 |
|
3273 |
|
3274 |
|
3275 /** |
|
3276 Gets the the number of the function requested by the client. |
|
3277 |
|
3278 @return The function number. |
|
3279 */ |
|
3280 inline TInt RMessage2::Function() const |
|
3281 {return(iFunction);} |
|
3282 |
|
3283 |
|
3284 |
|
3285 |
|
3286 /** |
|
3287 Gets the first message argument as an integer value. |
|
3288 |
|
3289 @return The first message argument. |
|
3290 */ |
|
3291 inline TInt RMessage2::Int0() const |
|
3292 {return(iArgs[0]);} |
|
3293 |
|
3294 |
|
3295 |
|
3296 |
|
3297 /** |
|
3298 Gets the second message argument as an integer value. |
|
3299 |
|
3300 @return The second message argument. |
|
3301 */ |
|
3302 inline TInt RMessage2::Int1() const |
|
3303 {return(iArgs[1]);} |
|
3304 |
|
3305 |
|
3306 |
|
3307 |
|
3308 /** |
|
3309 Gets the third message argument as an integer value. |
|
3310 |
|
3311 @return The third message argument. |
|
3312 */ |
|
3313 inline TInt RMessage2::Int2() const |
|
3314 {return(iArgs[2]);} |
|
3315 |
|
3316 |
|
3317 |
|
3318 /** |
|
3319 Gets the fourth message argument as an integer value. |
|
3320 |
|
3321 @return The fourth message argument. |
|
3322 */ |
|
3323 inline TInt RMessage2::Int3() const |
|
3324 {return(iArgs[3]);} |
|
3325 |
|
3326 |
|
3327 |
|
3328 /** |
|
3329 Gets the first message argument as a pointer type. |
|
3330 |
|
3331 @return The first message argument. |
|
3332 */ |
|
3333 inline const TAny *RMessage2::Ptr0() const |
|
3334 {return((const TAny *)iArgs[0]);} |
|
3335 |
|
3336 |
|
3337 |
|
3338 |
|
3339 /** |
|
3340 Gets the second message argument as a pointer type. |
|
3341 |
|
3342 @return The second message argument. |
|
3343 */ |
|
3344 inline const TAny *RMessage2::Ptr1() const |
|
3345 {return((const TAny *)iArgs[1]);} |
|
3346 |
|
3347 |
|
3348 |
|
3349 |
|
3350 /** |
|
3351 Gets the third message argument as a pointer type. |
|
3352 |
|
3353 @return The third message argument. |
|
3354 */ |
|
3355 inline const TAny *RMessage2::Ptr2() const |
|
3356 {return((const TAny *)iArgs[2]);} |
|
3357 |
|
3358 |
|
3359 |
|
3360 |
|
3361 /** |
|
3362 Gets the fourth message argument as a pointer type. |
|
3363 |
|
3364 @return The fourth message argument. |
|
3365 */ |
|
3366 inline const TAny *RMessage2::Ptr3() const |
|
3367 {return((const TAny *)iArgs[3]);} |
|
3368 |
|
3369 |
|
3370 |
|
3371 /** |
|
3372 Gets a pointer to the session. |
|
3373 |
|
3374 @return A pointer to the session object. |
|
3375 */ |
|
3376 inline CSession2* RMessage2::Session() const |
|
3377 {return (CSession2*)iSessionPtr; } |
|
3378 |
|
3379 |
|
3380 |
|
3381 |
|
3382 // Class TUid |
|
3383 inline TUid TUid::Uid(TInt aUid) |
|
3384 /** |
|
3385 Constructs the TUid object from a 32-bit integer. |
|
3386 |
|
3387 @param aUid The 32-bit integer value from which the TUid object is to be |
|
3388 constructed. |
|
3389 |
|
3390 @return The constructed TUid object. |
|
3391 */ |
|
3392 {TUid uid={aUid};return uid;} |
|
3393 |
|
3394 |
|
3395 |
|
3396 |
|
3397 inline TUid TUid::Null() |
|
3398 /** |
|
3399 Constructs a Null-valued TUid object. |
|
3400 |
|
3401 @return The constructed Null-valued TUid object. |
|
3402 */ |
|
3403 {TUid uid={KNullUidValue};return uid;} |
|
3404 |
|
3405 |
|
3406 |
|
3407 |
|
3408 #ifndef __KERNEL_MODE__ |
|
3409 // Template class TArray |
|
3410 template <class T> |
|
3411 inline TArray<T>::TArray(TInt (*aCount)(const CBase *aPtr),const TAny *(*anAt)(const CBase *aPtr,TInt anIndex),const CBase *aPtr) |
|
3412 : iPtr(aPtr),iCount(aCount),iAt(anAt) |
|
3413 /** |
|
3414 Constructor. |
|
3415 |
|
3416 A TArray object is not intended to be instantiated explicitly. An object of |
|
3417 this type is instantiated as a result of a call to to the Array() member |
|
3418 function of a concrete array class |
|
3419 |
|
3420 @param aCount A pointer to a function which takes a |
|
3421 @code |
|
3422 const CBase* |
|
3423 @endcode |
|
3424 argument and returns a |
|
3425 @code |
|
3426 TInt |
|
3427 @endcode |
|
3428 aCount must point to the member function which returns the |
|
3429 current number of elements of type class T contained in the |
|
3430 array at aPtr, for which this TArray is being constructed. |
|
3431 This argument is supplied by the Array() member function of the |
|
3432 array class. |
|
3433 @param anAt A pointer to a function which takes a |
|
3434 @code |
|
3435 const CBase* |
|
3436 @endcode |
|
3437 and a |
|
3438 @code |
|
3439 TInt |
|
3440 @endcode |
|
3441 argument, and returns a pointer to |
|
3442 @code |
|
3443 TAny |
|
3444 @endcode |
|
3445 anAt must point to the member function which returns a reference |
|
3446 to the element located at position anIndex within the array at |
|
3447 aPtr, for which this TArray is being constructed. |
|
3448 This argument is supplied by the Array() member function of the |
|
3449 array class. |
|
3450 @param aPtr A pointer to the array for which this TArray is being |
|
3451 constructed. This argument is supplied by the Array() member |
|
3452 function of the array class. |
|
3453 |
|
3454 @see CArrayFixFlat::Array |
|
3455 @see CArrayFixSeg::Array |
|
3456 @see CArrayVarFlat::Array |
|
3457 @see CArrayVarSeg::Array |
|
3458 @see CArrayPakFlat::Array |
|
3459 @see RArray::Array |
|
3460 @see RPointerArray::Array |
|
3461 @see RArray<TInt>::Array |
|
3462 @see RArray<TUint>::Array |
|
3463 */ |
|
3464 {} |
|
3465 |
|
3466 |
|
3467 |
|
3468 |
|
3469 template <class T> |
|
3470 inline TInt TArray<T>::Count() const |
|
3471 /** |
|
3472 Gets the number of elements currently held in the array for which this generic |
|
3473 array has been constructed. |
|
3474 |
|
3475 @return The number of array elements. |
|
3476 */ |
|
3477 {return((*iCount)(iPtr));} |
|
3478 |
|
3479 |
|
3480 |
|
3481 |
|
3482 template <class T> |
|
3483 inline const T &TArray<T>::operator[](TInt anIndex) const |
|
3484 /** |
|
3485 Gets a reference to the element located at the specified position. |
|
3486 |
|
3487 The returned reference is const and cannot be used to change the element. |
|
3488 Any member function of the referenced template class T must be declared |
|
3489 as const if that function is to be accessed through this operator. |
|
3490 |
|
3491 @param anIndex The position of the element within the array for which this |
|
3492 TArray has been constructed. The position is relative to zero; |
|
3493 i.e. zero implies the first element in the array. |
|
3494 |
|
3495 @return A const reference to the element located at position anIndex within |
|
3496 the array for which this TArray has been constructed. |
|
3497 |
|
3498 @panic E32USER-CBase 21, if anIndex is negative, or greater than or equal to |
|
3499 the number of objects currently within the array. |
|
3500 */ |
|
3501 {return(*((const T *)(*iAt)(iPtr,anIndex)));} |
|
3502 #endif |
|
3503 |
|
3504 |
|
3505 |
|
3506 |
|
3507 // Class TIdentityRelation<T> |
|
3508 template <class T> |
|
3509 inline TIdentityRelation<T>::TIdentityRelation() |
|
3510 /** |
|
3511 Constructs the object to use the equality operator (==) defined for class T |
|
3512 to determine whether two class T type objects match. |
|
3513 */ |
|
3514 {iIdentity=(TGeneralIdentityRelation)&EqualityOperatorCompare;} |
|
3515 |
|
3516 |
|
3517 |
|
3518 |
|
3519 template <class T> |
|
3520 inline TIdentityRelation<T>::TIdentityRelation( TBool (*anIdentity)(const T&, const T&) ) |
|
3521 /** |
|
3522 Constructs the object taking the specified function as an argument. |
|
3523 |
|
3524 The specified function should implement an algorithm for determining whether |
|
3525 two class T type objects match. It should return: |
|
3526 |
|
3527 1. true, if the two objects match. |
|
3528 |
|
3529 2. false, if the two objects do not match. |
|
3530 |
|
3531 @param anIdentity A pointer to a function that takes constant references to two |
|
3532 class T objects and returns a TInt value. |
|
3533 */ |
|
3534 { iIdentity=(TGeneralIdentityRelation)anIdentity; } |
|
3535 |
|
3536 |
|
3537 |
|
3538 |
|
3539 template <class T> |
|
3540 inline TIdentityRelation<T>::operator TGeneralIdentityRelation() const |
|
3541 /** |
|
3542 Operator that gets the function that determines whether two |
|
3543 objects of a given class type match. |
|
3544 */ |
|
3545 { return iIdentity; } |
|
3546 |
|
3547 |
|
3548 |
|
3549 template <class T> |
|
3550 inline TBool TIdentityRelation<T>::EqualityOperatorCompare(const T& aLeft, const T& aRight) |
|
3551 /** |
|
3552 Compares two objects of class T using the equality operator defined for class T. |
|
3553 */ |
|
3554 {return aLeft == aRight;} |
|
3555 |
|
3556 |
|
3557 |
|
3558 // Class TLinearOrder<T> |
|
3559 template <class T> |
|
3560 inline TLinearOrder<T>::TLinearOrder( TInt(*anOrder)(const T&, const T&) ) |
|
3561 /** |
|
3562 Constructs the object taking the specified function as an argument. |
|
3563 |
|
3564 The specified function should implement an algorithm that determines the |
|
3565 order of two class T type objects. It should return: |
|
3566 |
|
3567 1. zero, if the two objects are equal. |
|
3568 |
|
3569 2. a negative value, if the first object is less than the second. |
|
3570 |
|
3571 3. a positive value, if the first object is greater than the second. |
|
3572 |
|
3573 @param anOrder A pointer to a function that takes constant references to two |
|
3574 class T objects and returns a TInt value. |
|
3575 */ |
|
3576 { iOrder=(TGeneralLinearOrder)anOrder; } |
|
3577 |
|
3578 |
|
3579 |
|
3580 |
|
3581 template <class T> |
|
3582 inline TLinearOrder<T>::operator TGeneralLinearOrder() const |
|
3583 /** |
|
3584 Operator that gets the function that determines the order of two |
|
3585 objects of a given class type. |
|
3586 */ |
|
3587 { return iOrder; } |
|
3588 |
|
3589 |
|
3590 |
|
3591 |
|
3592 // Class RPointerArray<T> |
|
3593 |
|
3594 /** |
|
3595 Default C++ constructor. |
|
3596 |
|
3597 This constructs an array object for an array of pointers with default |
|
3598 granularity, which is 8. |
|
3599 */ |
|
3600 template <class T> |
|
3601 inline RPointerArray<T>::RPointerArray() |
|
3602 : RPointerArrayBase() |
|
3603 {} |
|
3604 |
|
3605 |
|
3606 |
|
3607 |
|
3608 /** |
|
3609 C++ constructor with granularity. |
|
3610 |
|
3611 This constructs an array object for an array of pointers with the specified |
|
3612 granularity. |
|
3613 |
|
3614 @param aGranularity The granularity of the array. |
|
3615 |
|
3616 @panic USER 127, if aGranularity is not positive, or greater than or equal |
|
3617 to 0x10000000. |
|
3618 */ |
|
3619 template <class T> |
|
3620 inline RPointerArray<T>::RPointerArray(TInt aGranularity) |
|
3621 : RPointerArrayBase(aGranularity) |
|
3622 {} |
|
3623 |
|
3624 |
|
3625 |
|
3626 |
|
3627 /** |
|
3628 C++ constructor with minimum growth step and exponential growth factor. |
|
3629 |
|
3630 This constructs an array object for an array of pointers with the specified |
|
3631 minimum growth step and exponential growth factor. |
|
3632 |
|
3633 @param aMinGrowBy The minimum growth step of the array. Must be between 1 and |
|
3634 65535 inclusive. |
|
3635 @param aFactor The factor by which the array grows, multiplied by 256. |
|
3636 For example 512 specifies a factor of 2. Must be between 257 |
|
3637 and 32767 inclusive. |
|
3638 |
|
3639 @panic USER 192, if aMinGrowBy<=0 or aMinGrowBy>65535. |
|
3640 @panic USER 193, if aFactor<=257 or aFactor>32767. |
|
3641 */ |
|
3642 template <class T> |
|
3643 inline RPointerArray<T>::RPointerArray(TInt aMinGrowBy, TInt aFactor) |
|
3644 : RPointerArrayBase(aMinGrowBy, aFactor) |
|
3645 {} |
|
3646 |
|
3647 |
|
3648 |
|
3649 |
|
3650 template <class T> |
|
3651 inline void RPointerArray<T>::Close() |
|
3652 /** |
|
3653 Closes the array and frees all memory allocated to it. |
|
3654 |
|
3655 The function must be called before this array object goes out of scope. |
|
3656 |
|
3657 Note that the function does not delete the objects whose pointers are contained |
|
3658 in the array. |
|
3659 */ |
|
3660 {RPointerArrayBase::Close();} |
|
3661 |
|
3662 |
|
3663 |
|
3664 |
|
3665 template <class T> |
|
3666 inline TInt RPointerArray<T>::Count() const |
|
3667 /** |
|
3668 Gets the number of object pointers in the array. |
|
3669 |
|
3670 @return The number of object pointers in the array. |
|
3671 */ |
|
3672 { return RPointerArrayBase::Count(); } |
|
3673 |
|
3674 |
|
3675 |
|
3676 |
|
3677 template <class T> |
|
3678 inline T* const& RPointerArray<T>::operator[](TInt anIndex) const |
|
3679 /** |
|
3680 Gets a reference to the object pointer located at the specified |
|
3681 position within the array. |
|
3682 |
|
3683 The compiler chooses this option if the returned reference is used in |
|
3684 an expression where the reference cannot be modified. |
|
3685 |
|
3686 @param anIndex The position of the object pointer within the array. The |
|
3687 position is relative to zero, i.e. zero implies the object |
|
3688 pointer at the beginning of the array. |
|
3689 |
|
3690 @return A const reference to the object pointer at position anIndex within |
|
3691 the array. |
|
3692 |
|
3693 @panic USER 130, if anIndex is negative, or is greater than the number of |
|
3694 objects currently in the array. |
|
3695 */ |
|
3696 {return (T* const&)At(anIndex);} |
|
3697 |
|
3698 |
|
3699 |
|
3700 |
|
3701 template <class T> |
|
3702 inline T*& RPointerArray<T>::operator[](TInt anIndex) |
|
3703 /** |
|
3704 Gets a reference to the object pointer located at the specified |
|
3705 position within the array. |
|
3706 |
|
3707 The compiler chooses this option if the returned reference is used in |
|
3708 an expression where the reference can be modified. |
|
3709 |
|
3710 @param anIndex The position of the object pointer within the array. The |
|
3711 position is relative to zero, i.e. zero implies the object |
|
3712 pointer at the beginning of the array. |
|
3713 |
|
3714 @return A non-const reference to the object pointer at position anIndex within |
|
3715 the array. |
|
3716 |
|
3717 @panic USER 130, if anIndex is negative, or is greater than the number of |
|
3718 objects currently in the array. |
|
3719 */ |
|
3720 {return (T*&)At(anIndex);} |
|
3721 |
|
3722 |
|
3723 |
|
3724 |
|
3725 template <class T> |
|
3726 inline TInt RPointerArray<T>::Append(const T* anEntry) |
|
3727 /** |
|
3728 Appends an object pointer onto the array. |
|
3729 |
|
3730 @param anEntry The object pointer to be appended. |
|
3731 |
|
3732 @return KErrNone, if the insertion is successful, otherwise one of the system |
|
3733 wide error codes. |
|
3734 */ |
|
3735 { return RPointerArrayBase::Append(anEntry); } |
|
3736 |
|
3737 |
|
3738 |
|
3739 |
|
3740 template <class T> |
|
3741 inline TInt RPointerArray<T>::Insert(const T* anEntry, TInt aPos) |
|
3742 /** |
|
3743 Inserts an object pointer into the array at the specified position. |
|
3744 |
|
3745 @param anEntry The object pointer to be inserted. |
|
3746 @param aPos The position within the array where the object pointer is to be |
|
3747 inserted. The position is relative to zero, i.e. zero implies |
|
3748 that a pointer is inserted at the beginning of the array. |
|
3749 |
|
3750 @return KErrNone, if the insertion is successful, otherwise one of the system |
|
3751 wide error codes. |
|
3752 |
|
3753 @panic USER 131, if aPos is negative, or is greater than the number of object |
|
3754 pointers currently in the array. |
|
3755 */ |
|
3756 { return RPointerArrayBase::Insert(anEntry,aPos); } |
|
3757 |
|
3758 |
|
3759 |
|
3760 |
|
3761 template <class T> |
|
3762 inline void RPointerArray<T>::Remove(TInt anIndex) |
|
3763 /** |
|
3764 Removes the object pointer at the specified position from the array. |
|
3765 |
|
3766 Note that the function does not delete the object whose pointer is removed. |
|
3767 |
|
3768 @param anIndex The position within the array from where the object pointer |
|
3769 is to be removed. The position is relative to zero, i.e. zero |
|
3770 implies that a pointer at the beginning of the array is to be |
|
3771 removed. |
|
3772 |
|
3773 @panic USER 130, if anIndex is negative, or is greater than the number of |
|
3774 objects currently in the array. |
|
3775 */ |
|
3776 {RPointerArrayBase::Remove(anIndex);} |
|
3777 |
|
3778 |
|
3779 |
|
3780 |
|
3781 template <class T> |
|
3782 inline void RPointerArray<T>::Compress() |
|
3783 /** |
|
3784 Compresses the array down to a minimum. |
|
3785 |
|
3786 After a call to this function, the memory allocated to the array is just |
|
3787 sufficient for its contained object pointers. |
|
3788 Subsequently adding a new object pointer to the array |
|
3789 always results in a re-allocation of memory. |
|
3790 */ |
|
3791 {RPointerArrayBase::Compress();} |
|
3792 |
|
3793 |
|
3794 |
|
3795 |
|
3796 template <class T> |
|
3797 inline void RPointerArray<T>::Reset() |
|
3798 /** |
|
3799 Empties the array. |
|
3800 |
|
3801 It frees all memory allocated to the array and resets the internal state so |
|
3802 that it is ready to be reused. |
|
3803 |
|
3804 This array object can be allowed to go out of scope after a call to this |
|
3805 function. |
|
3806 |
|
3807 Note that the function does not delete the objects whose pointers are contained |
|
3808 in the array. |
|
3809 */ |
|
3810 {RPointerArrayBase::Reset();} |
|
3811 |
|
3812 |
|
3813 |
|
3814 |
|
3815 template <class T> |
|
3816 inline TInt RPointerArray<T>::Find(const T* anEntry) const |
|
3817 /** |
|
3818 Finds the first object pointer in the array which matches the specified object |
|
3819 pointer, using a sequential search. |
|
3820 |
|
3821 Matching is based on the comparison of pointers. |
|
3822 |
|
3823 The find operation always starts at the low index end of the array. There |
|
3824 is no assumption about the order of objects in the array. |
|
3825 |
|
3826 @param anEntry The object pointer to be found. |
|
3827 @return The index of the first matching object pointer within the array. |
|
3828 KErrNotFound, if no matching object pointer can be found. |
|
3829 */ |
|
3830 { return RPointerArrayBase::Find(anEntry); } |
|
3831 |
|
3832 |
|
3833 |
|
3834 |
|
3835 template <class T> |
|
3836 inline TInt RPointerArray<T>::Find(const T* anEntry, TIdentityRelation<T> anIdentity) const |
|
3837 /** |
|
3838 Finds the first object pointer in the array whose object matches the specified |
|
3839 object, using a sequential search and a matching algorithm. |
|
3840 |
|
3841 The algorithm for determining whether two class T objects match is provided |
|
3842 by a function supplied by the caller. |
|
3843 |
|
3844 The find operation always starts at the low index end of the array. There |
|
3845 is no assumption about the order of objects in the array. |
|
3846 |
|
3847 @param anEntry The object pointer to be found. |
|
3848 @param anIdentity A package encapsulating the function which determines whether |
|
3849 two class T objects match. |
|
3850 |
|
3851 @return The index of the first matching object pointer within the array. |
|
3852 KErrNotFound, if no suitable object pointer can be found. |
|
3853 */ |
|
3854 { return RPointerArrayBase::Find(anEntry,anIdentity); } |
|
3855 |
|
3856 |
|
3857 |
|
3858 |
|
3859 template <class T> |
|
3860 inline TInt RPointerArray<T>::FindReverse(const T* anEntry) const |
|
3861 /** |
|
3862 Finds the last object pointer in the array which matches the specified object |
|
3863 pointer, using a sequential search. |
|
3864 |
|
3865 Matching is based on the comparison of pointers. |
|
3866 |
|
3867 The find operation always starts at the high index end of the array. There |
|
3868 is no assumption about the order of objects in the array. |
|
3869 |
|
3870 @param anEntry The object pointer to be found. |
|
3871 @return The index of the last matching object pointer within the array. |
|
3872 KErrNotFound, if no matching object pointer can be found. |
|
3873 */ |
|
3874 { return RPointerArrayBase::FindReverse(anEntry); } |
|
3875 |
|
3876 |
|
3877 |
|
3878 |
|
3879 template <class T> |
|
3880 inline TInt RPointerArray<T>::FindReverse(const T* anEntry, TIdentityRelation<T> anIdentity) const |
|
3881 /** |
|
3882 Finds the last object pointer in the array whose object matches the specified |
|
3883 object, using a sequential search and a matching algorithm. |
|
3884 |
|
3885 The algorithm for determining whether two class T objects match is provided |
|
3886 by a function supplied by the caller. |
|
3887 |
|
3888 The find operation always starts at the high index end of the array. There |
|
3889 is no assumption about the order of objects in the array. |
|
3890 |
|
3891 @param anEntry The object pointer to be found. |
|
3892 @param anIdentity A package encapsulating the function which determines whether |
|
3893 two class T objects match. |
|
3894 |
|
3895 @return The index of the last matching object pointer within the array. |
|
3896 KErrNotFound, if no suitable object pointer can be found. |
|
3897 */ |
|
3898 { return RPointerArrayBase::FindReverse(anEntry,anIdentity); } |
|
3899 |
|
3900 |
|
3901 |
|
3902 |
|
3903 template <class T> |
|
3904 inline TInt RPointerArray<T>::FindInAddressOrder(const T* anEntry) const |
|
3905 /** |
|
3906 Finds the object pointer in the array that matches the specified object |
|
3907 pointer, using a binary search technique. |
|
3908 |
|
3909 The function assumes that object pointers in the array are in address order. |
|
3910 |
|
3911 @param anEntry The object pointer to be found. |
|
3912 |
|
3913 @return The index of the matching object pointer within the array or KErrNotFound |
|
3914 if no suitable object pointer can be found. |
|
3915 */ |
|
3916 { return RPointerArrayBase::FindIsqUnsigned((TUint)anEntry); } |
|
3917 |
|
3918 |
|
3919 |
|
3920 |
|
3921 template <class T> |
|
3922 inline TInt RPointerArray<T>::FindInOrder(const T* anEntry, TLinearOrder<T> anOrder) const |
|
3923 /** |
|
3924 Finds the object pointer in the array whose object matches the specified |
|
3925 object, using a binary search technique and an ordering algorithm. |
|
3926 |
|
3927 The function assumes that existing object pointers in the array are ordered |
|
3928 so that the objects themselves are in object order as determined by an algorithm |
|
3929 supplied by the caller and packaged as a TLinearOrder<T>. |
|
3930 |
|
3931 @param anEntry The object pointer to be found. |
|
3932 @param anOrder A package encapsulating the function which determines the order |
|
3933 of two class T objects. |
|
3934 |
|
3935 @return The index of the matching object pointer within the array or KErrNotFound, |
|
3936 if no suitable object pointer can be found. |
|
3937 */ |
|
3938 { return RPointerArrayBase::FindIsq(anEntry,anOrder); } |
|
3939 |
|
3940 |
|
3941 |
|
3942 |
|
3943 template <class T> |
|
3944 inline TInt RPointerArray<T>::FindInAddressOrder(const T* anEntry, TInt& anIndex) const |
|
3945 /** |
|
3946 Finds the object pointer in the array that matches the specified object |
|
3947 pointer, using a binary search technique. |
|
3948 |
|
3949 The function assumes that object pointers in the array are in address order. |
|
3950 |
|
3951 @param anEntry The object pointer to be found. |
|
3952 @param anIndex A TInt supplied by the caller. On return, contains an index |
|
3953 value: |
|
3954 If the function returns KErrNone, this is the index of the |
|
3955 matching object pointer within the array. |
|
3956 If the function returns KErrNotFound, this is the |
|
3957 index of the first object pointer within the array which |
|
3958 logically follows after anEntry. |
|
3959 |
|
3960 @return KErrNone, if a matching object pointer is found. |
|
3961 KErrNotFound, if no suitable object pointer can be found. |
|
3962 */ |
|
3963 { return RPointerArrayBase::BinarySearchUnsigned((TUint)anEntry,anIndex); } |
|
3964 |
|
3965 |
|
3966 |
|
3967 |
|
3968 template <class T> |
|
3969 inline TInt RPointerArray<T>::FindInOrder(const T* anEntry, TInt& anIndex, TLinearOrder<T> anOrder) const |
|
3970 /** |
|
3971 Finds the object pointer in the array whose object matches the specified |
|
3972 object, using a binary search technique and an ordering algorithm. |
|
3973 |
|
3974 The function assumes that existing object pointers in the array are ordered |
|
3975 so that the objects themselves are in object order as determined by an |
|
3976 algorithm supplied by the caller and packaged as a TLinearOrder<T>. |
|
3977 |
|
3978 @param anEntry The object pointer to be found. |
|
3979 @param anIndex A TInt supplied by the caller. On return, contains an |
|
3980 index value: |
|
3981 If the function returns KErrNone, this is the index of the |
|
3982 matching object pointer within the array. |
|
3983 If the function returns KErrNotFound, this is the index of |
|
3984 the first object pointer in the array whose object is larger |
|
3985 than the entry being searched for - if no objects pointed to in |
|
3986 the array are larger, then the index value is the same as the |
|
3987 total number of object pointers in the array. |
|
3988 |
|
3989 @param anOrder A package encapsulating the function which determines the order |
|
3990 of two class T objects. |
|
3991 |
|
3992 @return KErrNone, if a matching object pointer is found. |
|
3993 KErrNotFound, if no suitable object pointer can be found. |
|
3994 */ |
|
3995 { return RPointerArrayBase::BinarySearch(anEntry,anIndex,anOrder); } |
|
3996 |
|
3997 |
|
3998 |
|
3999 |
|
4000 template <class T> |
|
4001 inline TInt RPointerArray<T>::SpecificFindInAddressOrder(const T* anEntry, TInt aMode) const |
|
4002 /** |
|
4003 Finds the object pointer in the array that matches the specified object |
|
4004 pointer, using a binary search technique. |
|
4005 |
|
4006 Where there is more than one matching element, it finds the first, the last |
|
4007 or any matching element as specified by the value of aMode. |
|
4008 |
|
4009 The function assumes that object pointers in the array are in address order. |
|
4010 |
|
4011 @param anEntry The object pointer to be found. |
|
4012 @param aMode Specifies whether to find the first match, the last match or |
|
4013 any match, as defined by one of the TArrayFindMode enum values. |
|
4014 |
|
4015 @return KErrNotFound, if there is no matching element, otherwise the array |
|
4016 index of a matching element - what the index refers to depends on the |
|
4017 value of aMode: |
|
4018 if this is EArrayFindMode_First, then the index refers to the first matching element; |
|
4019 if this is EArrayFindMode_Any, then the index can refer to any of the matching elements; |
|
4020 if this is EArrayFindMode_Last, then the index refers to first element that follows |
|
4021 the last matching element - if the last matching element is also the last element of |
|
4022 the array, then the index value is the same as the total number of elements in the array. |
|
4023 |
|
4024 @see TArrayFindMode |
|
4025 */ |
|
4026 { return RPointerArrayBase::FindIsqUnsigned((TUint)anEntry, aMode); } |
|
4027 |
|
4028 |
|
4029 |
|
4030 |
|
4031 template <class T> |
|
4032 inline TInt RPointerArray<T>::SpecificFindInOrder(const T* anEntry, TLinearOrder<T> anOrder, TInt aMode) const |
|
4033 /** |
|
4034 Finds the object pointer in the array whose object matches the specified |
|
4035 object, using a binary search technique and an ordering algorithm. |
|
4036 |
|
4037 Where there is more than one matching element, it finds the first, the last |
|
4038 or any matching element as specified by the value of aMode. |
|
4039 |
|
4040 The function assumes that existing object pointers in the array are ordered |
|
4041 so that the objects themselves are in object order as determined by an algorithm |
|
4042 supplied by the caller and packaged as a TLinearOrder<T> type. |
|
4043 |
|
4044 @param anEntry The object pointer to be found. |
|
4045 @param anOrder A package encapsulating the function which determines the order |
|
4046 of two class T objects. |
|
4047 @param aMode Specifies whether to find the first match, the last match or any match, |
|
4048 as defined by one of the TArrayFindMode enum values. |
|
4049 |
|
4050 @return KErrNotFound, if there is no matching element, otherwise the array |
|
4051 index of a matching element - what the index refers to depends on |
|
4052 the value of aMode: |
|
4053 if this is EArrayFindMode_First, then the index refers to the first matching element; |
|
4054 if this is EArrayFindMode_Any, then the index can refer to any of the matching elements; |
|
4055 if this is EArrayFindMode_Last, then the index refers to first element that follows |
|
4056 the last matching element - if the last matching element is also the last element of the array, |
|
4057 then the index value is the same as the total number of elements in the array. |
|
4058 |
|
4059 @see TArrayFindMode |
|
4060 */ |
|
4061 { return RPointerArrayBase::FindIsq(anEntry,anOrder,aMode); } |
|
4062 |
|
4063 |
|
4064 |
|
4065 |
|
4066 template <class T> |
|
4067 inline TInt RPointerArray<T>::SpecificFindInAddressOrder(const T* anEntry, TInt& anIndex, TInt aMode) const |
|
4068 /** |
|
4069 Finds the object pointer in the array that matches the specified object |
|
4070 pointer, using a binary search technique. |
|
4071 |
|
4072 Where there is more than one matching element, it finds the first, the last |
|
4073 or any matching element as specified by the value of aMode. |
|
4074 |
|
4075 The function assumes that object pointers in the array are in address order. |
|
4076 |
|
4077 @param anEntry The object pointer to be found. |
|
4078 @param anIndex A TInt type supplied by the caller. On return, it contains an |
|
4079 index value depending on whether a match is found and on the |
|
4080 value of aMode. |
|
4081 If there is no matching element in the array, then this is |
|
4082 the index of the first element in the array that is bigger than |
|
4083 the element being searched for - if no elements in the array are |
|
4084 bigger, then the index value is the same as the total number of |
|
4085 elements in the array. If there is a matching element, then what |
|
4086 the index refers to depends on the value of aMode: |
|
4087 if this is EArrayFindMode_First, then the index refers to the first matching element; |
|
4088 if this is EArrayFindMode_Any, then the index can refer to any of the matching elements; |
|
4089 if this is EArrayFindMode_Last, then the index refers to first element that follows the |
|
4090 last matching element - if the last matching element is also the last element of the array, |
|
4091 then the index value is the same as the total number of elements in the array. |
|
4092 |
|
4093 @param aMode Specifies whether to find the first match, the last match or any |
|
4094 match, as defined by one of the TArrayFindMode enum values. |
|
4095 |
|
4096 @return KErrNone, if a matching object pointer is found. |
|
4097 KErrNotFound, if no suitable object pointer can be found. |
|
4098 |
|
4099 @see TArrayFindMode |
|
4100 */ |
|
4101 { return RPointerArrayBase::BinarySearchUnsigned((TUint)anEntry,anIndex,aMode); } |
|
4102 |
|
4103 |
|
4104 |
|
4105 |
|
4106 template <class T> |
|
4107 inline TInt RPointerArray<T>::SpecificFindInOrder(const T* anEntry, TInt& anIndex, TLinearOrder<T> anOrder, TInt aMode) const |
|
4108 /** |
|
4109 Finds the object pointer in the array whose object matches the specified |
|
4110 object, using a binary search technique and an ordering algorithm. |
|
4111 |
|
4112 Where there is more than one matching element, it finds the first, the last or any |
|
4113 matching element as specified by the value of aMode. |
|
4114 |
|
4115 The function assumes that existing object pointers in the array are ordered |
|
4116 so that the objects themselves are in object order as determined by an |
|
4117 algorithm supplied by the caller and packaged as a TLinearOrder<T> type. |
|
4118 |
|
4119 @param anEntry The object pointer to be found. |
|
4120 @param anIndex A TInt type supplied by the caller. On return, it contains an |
|
4121 index value depending on whether a match is found and on the |
|
4122 value of aMode. If there is no matching element in the array, |
|
4123 then this is the index of the first element in the array |
|
4124 that is bigger than the element being searched for - if |
|
4125 no elements in the array are bigger, then the index value |
|
4126 is the same as the total number of elements in the array. |
|
4127 If there is a matching element, then what the index refers to |
|
4128 depends on the value of aMode: |
|
4129 if this is EArrayFindMode_First, then the index refers to the first matching element; |
|
4130 if this is EArrayFindMode_Any, then the index can refer to any of the matching elements; |
|
4131 if this is EArrayFindMode_Last, then the index refers to first element that follows |
|
4132 the last matching element - if the last matching element is also the last element |
|
4133 of the array, then the index value is the same as the total number of elements in the array. |
|
4134 |
|
4135 @param anOrder A package encapsulating the function which determines the order |
|
4136 of two class T objects. |
|
4137 @param aMode Specifies whether to find the first match, the last match or |
|
4138 any match, as defined by one of the TArrayFindMode enum values. |
|
4139 |
|
4140 @return KErrNone, if a matching object pointer is found. |
|
4141 KErrNotFound, if no suitable object pointer can be found. |
|
4142 |
|
4143 @see TArrayFindMode |
|
4144 */ |
|
4145 { return RPointerArrayBase::BinarySearch(anEntry,anIndex,anOrder,aMode); } |
|
4146 |
|
4147 |
|
4148 |
|
4149 |
|
4150 template <class T> |
|
4151 inline TInt RPointerArray<T>::InsertInAddressOrder(const T* anEntry) |
|
4152 /** |
|
4153 Inserts an object pointer into the array in address order. |
|
4154 |
|
4155 No duplicate entries are permitted. The array remains unchanged following |
|
4156 an attempt to insert a duplicate entry. |
|
4157 |
|
4158 The function assumes that existing object pointers within the array are in |
|
4159 address order. |
|
4160 |
|
4161 @param anEntry The object pointer to be inserted. |
|
4162 |
|
4163 @return KErrNone, if the insertion is successful; |
|
4164 KErrAlreadyExists, if an attempt is being made |
|
4165 to insert a duplicate entry; otherwise one of the other system wide |
|
4166 error codes. |
|
4167 */ |
|
4168 { return RPointerArrayBase::InsertIsqUnsigned((TUint)anEntry,EFalse); } |
|
4169 |
|
4170 |
|
4171 |
|
4172 |
|
4173 template <class T> |
|
4174 inline TInt RPointerArray<T>::InsertInOrder(const T* anEntry, TLinearOrder<T> anOrder) |
|
4175 /** |
|
4176 Inserts an object pointer into the array so that the object itself is in object |
|
4177 order. |
|
4178 |
|
4179 The algorithm for determining the order of two class T objects is provided |
|
4180 by a function supplied by the caller. |
|
4181 |
|
4182 No duplicate entries are permitted. The array remains unchanged following |
|
4183 an attempt to insert a duplicate entry. |
|
4184 |
|
4185 The function assumes that the array is ordered so that the referenced objects |
|
4186 are in object order. |
|
4187 |
|
4188 @param anEntry The object pointer to be inserted. |
|
4189 @param anOrder A package encapsulating the function which determines the order |
|
4190 of two class T objects. |
|
4191 |
|
4192 @return KErrNone, if the insertion is successful; |
|
4193 KErrAlreadyExists, if an attempt is being made |
|
4194 to insert a duplicate entry; otherwise one of the other system wide |
|
4195 error codes. |
|
4196 */ |
|
4197 { return RPointerArrayBase::InsertIsq(anEntry,anOrder,EFalse); } |
|
4198 |
|
4199 |
|
4200 |
|
4201 |
|
4202 template <class T> |
|
4203 inline TInt RPointerArray<T>::InsertInAddressOrderAllowRepeats(const T* anEntry) |
|
4204 /** |
|
4205 Inserts an object pointer into the array in address order, allowing duplicates. |
|
4206 |
|
4207 If the new object pointer is a duplicate of an existing object pointer in |
|
4208 the array, then the new pointer is inserted after the existing one. If more |
|
4209 than one duplicate object pointer already exists in the array, then any new |
|
4210 duplicate pointer is inserted after the last one. |
|
4211 |
|
4212 The function assumes that existing object pointers within the array are in |
|
4213 address order. |
|
4214 |
|
4215 @param anEntry The object pointer to be inserted. |
|
4216 |
|
4217 @return KErrNone, if the insertion is successful, otherwise one of the system |
|
4218 wide error codes. |
|
4219 */ |
|
4220 { return RPointerArrayBase::InsertIsqUnsigned((TUint)anEntry,ETrue); } |
|
4221 |
|
4222 |
|
4223 |
|
4224 |
|
4225 template <class T> |
|
4226 inline TInt RPointerArray<T>::InsertInOrderAllowRepeats(const T* anEntry, TLinearOrder<T> anOrder) |
|
4227 /** |
|
4228 Inserts an object pointer into the array so that the object itself is in object |
|
4229 order, allowing duplicates |
|
4230 |
|
4231 The algorithm for determining the order of two class T objects is provided |
|
4232 by a function supplied by the caller. |
|
4233 |
|
4234 If the specified object is a duplicate of an existing object, then the new |
|
4235 pointer is inserted after the pointer to the existing object. If more than |
|
4236 one duplicate object already exists, then the new pointer is inserted after |
|
4237 the pointer to the last one. |
|
4238 |
|
4239 @param anEntry The object pointer to be inserted. |
|
4240 @param anOrder A package encapsulating the function which determines the order |
|
4241 of two class T objects. |
|
4242 |
|
4243 @return KErrNone, if the insertion is successful, otherwise one of the system |
|
4244 wide error codes. |
|
4245 */ |
|
4246 { return RPointerArrayBase::InsertIsq(anEntry,anOrder,ETrue); } |
|
4247 |
|
4248 |
|
4249 |
|
4250 |
|
4251 #ifndef __KERNEL_MODE__ |
|
4252 template <class T> |
|
4253 inline RPointerArray<T>::RPointerArray(T** aEntries, TInt aCount) |
|
4254 : RPointerArrayBase((TAny **)aEntries, aCount) |
|
4255 /** |
|
4256 C++ constructor with a pointer to the first array entry in a pre-existing |
|
4257 array, and the number of entries in that array. |
|
4258 |
|
4259 This constructor takes a pointer to a pre-existing set of entries of type |
|
4260 pointer to class T, which is owned by another RPointerArray object. Ownership |
|
4261 of the set of entries still resides with the original RPointerArray object. |
|
4262 |
|
4263 @param aEntries A pointer to the first entry of type pointer to class T in |
|
4264 the set of entries belonging to the existing array. |
|
4265 @param aCount The number of entries in the existing array. The granularity of |
|
4266 this array is set to this value. |
|
4267 |
|
4268 @panic USER 156, if aCount is not positive. |
|
4269 */ |
|
4270 {} |
|
4271 |
|
4272 |
|
4273 |
|
4274 |
|
4275 template <class T> |
|
4276 inline void RPointerArray<T>::GranularCompress() |
|
4277 /** |
|
4278 Compresses the array down to a granular boundary. |
|
4279 |
|
4280 After a call to this function, the memory allocated to the array is sufficient |
|
4281 for its contained object pointers. Adding new object pointers to the array |
|
4282 does not result in a re-allocation of memory until the the total number of |
|
4283 pointers reaches a multiple of the granularity. |
|
4284 */ |
|
4285 {RPointerArrayBase::GranularCompress();} |
|
4286 |
|
4287 |
|
4288 |
|
4289 |
|
4290 template <class T> |
|
4291 inline TInt RPointerArray<T>::Reserve(TInt aCount) |
|
4292 /** |
|
4293 Reserves space for the specified number of elements. |
|
4294 |
|
4295 After a call to this function, the memory allocated to the array is sufficient |
|
4296 to hold the number of object pointers specified. Adding new object pointers to the array |
|
4297 does not result in a re-allocation of memory until the the total number of |
|
4298 pointers exceeds the specified count. |
|
4299 |
|
4300 @param aCount The number of object pointers for which space should be reserved |
|
4301 @return KErrNone If the operation completed successfully |
|
4302 @return KErrNoMemory If the requested amount of memory could not be allocated |
|
4303 */ |
|
4304 { return RPointerArrayBase::DoReserve(aCount); } |
|
4305 |
|
4306 |
|
4307 |
|
4308 |
|
4309 template <class T> |
|
4310 inline void RPointerArray<T>::SortIntoAddressOrder() |
|
4311 /** |
|
4312 Sorts the object pointers within the array into address order. |
|
4313 */ |
|
4314 { HeapSortUnsigned(); } |
|
4315 |
|
4316 |
|
4317 |
|
4318 |
|
4319 template <class T> |
|
4320 inline void RPointerArray<T>::Sort(TLinearOrder<T> anOrder) |
|
4321 /** |
|
4322 Sorts the object pointers within the array. |
|
4323 |
|
4324 The sort order of the pointers is based on the order of the referenced objects. |
|
4325 The referenced object order is determined by an algorithm supplied by the |
|
4326 caller and packaged as a TLinerOrder<T>. |
|
4327 |
|
4328 @param anOrder A package encapsulating the function which determines the order |
|
4329 of two class T objects. |
|
4330 */ |
|
4331 { HeapSort(anOrder); } |
|
4332 |
|
4333 |
|
4334 |
|
4335 |
|
4336 template <class T> |
|
4337 inline TArray<T*> RPointerArray<T>::Array() const |
|
4338 /** |
|
4339 Constructs and returns a generic array. |
|
4340 |
|
4341 @return A generic array representing this array. |
|
4342 |
|
4343 @see TArray |
|
4344 */ |
|
4345 { return TArray<T*>(GetCount,GetElementPtr,(const CBase*)this); } |
|
4346 #endif |
|
4347 |
|
4348 |
|
4349 |
|
4350 template <class T> |
|
4351 void RPointerArray<T>::ResetAndDestroy() |
|
4352 /** |
|
4353 Empties the array and deletes the referenced objects. |
|
4354 |
|
4355 It frees all memory allocated to the array and resets the internal state so |
|
4356 that it is ready to be reused. The function also deletes all of the objects |
|
4357 whose pointers are contained by the array. |
|
4358 |
|
4359 This array object can be allowed to go out of scope after a call to this function. |
|
4360 */ |
|
4361 { |
|
4362 TInt c=Count(); |
|
4363 T** pE=(T**)Entries(); |
|
4364 ZeroCount(); |
|
4365 TInt i; |
|
4366 for (i=0; i<c; i++) |
|
4367 { |
|
4368 delete *pE; |
|
4369 pE++; |
|
4370 } |
|
4371 Reset(); |
|
4372 } |
|
4373 |
|
4374 |
|
4375 |
|
4376 // Specialization for RPointerArray<TAny> |
|
4377 |
|
4378 /** |
|
4379 Default C++ constructor. |
|
4380 |
|
4381 This constructs an array object for an array of TAny pointers with default |
|
4382 granularity, which is 8. |
|
4383 */ |
|
4384 inline RPointerArray<TAny>::RPointerArray() |
|
4385 : RPointerArrayBase() |
|
4386 {} |
|
4387 |
|
4388 |
|
4389 |
|
4390 |
|
4391 /** |
|
4392 C++ constructor with granularity. |
|
4393 |
|
4394 This constructs an array object for an array of TAny pointers with the specified |
|
4395 granularity. |
|
4396 |
|
4397 @param aGranularity The granularity of the array. |
|
4398 |
|
4399 @panic USER 127, if aGranularity is not positive, or greater than or equal |
|
4400 to 0x10000000. |
|
4401 */ |
|
4402 inline RPointerArray<TAny>::RPointerArray(TInt aGranularity) |
|
4403 : RPointerArrayBase(aGranularity) |
|
4404 {} |
|
4405 |
|
4406 |
|
4407 |
|
4408 |
|
4409 /** |
|
4410 C++ constructor with minimum growth step and exponential growth factor. |
|
4411 |
|
4412 This constructs an array object for an array of TAny pointers with the specified |
|
4413 minimum growth step and exponential growth factor. |
|
4414 |
|
4415 @param aMinGrowBy The minimum growth step of the array. Must be between 1 and |
|
4416 65535 inclusive. |
|
4417 @param aFactor The factor by which the array grows, multiplied by 256. |
|
4418 For example 512 specifies a factor of 2. Must be between 257 |
|
4419 and 32767 inclusive. |
|
4420 |
|
4421 @panic USER 192, if aMinGrowBy<=0 or aMinGrowBy>65535. |
|
4422 @panic USER 193, if aFactor<=257 or aFactor>32767. |
|
4423 */ |
|
4424 inline RPointerArray<TAny>::RPointerArray(TInt aMinGrowBy, TInt aFactor) |
|
4425 : RPointerArrayBase(aMinGrowBy, aFactor) |
|
4426 {} |
|
4427 |
|
4428 |
|
4429 |
|
4430 |
|
4431 inline void RPointerArray<TAny>::Close() |
|
4432 /** |
|
4433 Closes the array and frees all memory allocated to it. |
|
4434 |
|
4435 The function must be called before this array object goes out of scope. |
|
4436 |
|
4437 Note that the function does not delete the objects whose pointers are contained |
|
4438 in the array. |
|
4439 */ |
|
4440 {RPointerArrayBase::Close();} |
|
4441 |
|
4442 |
|
4443 |
|
4444 |
|
4445 inline TInt RPointerArray<TAny>::Count() const |
|
4446 /** |
|
4447 Gets the number of pointers in the array. |
|
4448 |
|
4449 @return The number of pointers in the array. |
|
4450 */ |
|
4451 { return RPointerArrayBase::Count(); } |
|
4452 |
|
4453 |
|
4454 |
|
4455 |
|
4456 inline TAny* const& RPointerArray<TAny>::operator[](TInt anIndex) const |
|
4457 /** |
|
4458 Gets a reference to the pointer located at the specified |
|
4459 position within the array. |
|
4460 |
|
4461 The compiler chooses this option if the returned reference is used in |
|
4462 an expression where the reference cannot be modified. |
|
4463 |
|
4464 @param anIndex The position of the pointer within the array. The |
|
4465 position is relative to zero, i.e. zero implies the object |
|
4466 pointer at the beginning of the array. |
|
4467 |
|
4468 @return A const reference to the pointer at position anIndex within |
|
4469 the array. |
|
4470 |
|
4471 @panic USER 130, if anIndex is negative, or is greater than the number of |
|
4472 objects currently in the array. |
|
4473 */ |
|
4474 {return At(anIndex);} |
|
4475 |
|
4476 |
|
4477 |
|
4478 |
|
4479 inline TAny*& RPointerArray<TAny>::operator[](TInt anIndex) |
|
4480 /** |
|
4481 Gets a reference to the pointer located at the specified |
|
4482 position within the array. |
|
4483 |
|
4484 The compiler chooses this option if the returned reference is used in |
|
4485 an expression where the reference can be modified. |
|
4486 |
|
4487 @param anIndex The position of the pointer within the array. The |
|
4488 position is relative to zero, i.e. zero implies the object |
|
4489 pointer at the beginning of the array. |
|
4490 |
|
4491 @return A non-const reference to the pointer at position anIndex within |
|
4492 the array. |
|
4493 |
|
4494 @panic USER 130, if anIndex is negative, or is greater than the number of |
|
4495 objects currently in the array. |
|
4496 */ |
|
4497 {return At(anIndex);} |
|
4498 |
|
4499 |
|
4500 |
|
4501 |
|
4502 inline TInt RPointerArray<TAny>::Append(const TAny* anEntry) |
|
4503 /** |
|
4504 Appends an pointer onto the array. |
|
4505 |
|
4506 @param anEntry The pointer to be appended. |
|
4507 |
|
4508 @return KErrNone, if the insertion is successful, otherwise one of the system |
|
4509 wide error codes. |
|
4510 */ |
|
4511 { return RPointerArrayBase::Append(anEntry); } |
|
4512 |
|
4513 |
|
4514 |
|
4515 |
|
4516 inline TInt RPointerArray<TAny>::Insert(const TAny* anEntry, TInt aPos) |
|
4517 /** |
|
4518 Inserts an pointer into the array at the specified position. |
|
4519 |
|
4520 @param anEntry The pointer to be inserted. |
|
4521 @param aPos The position within the array where the pointer is to be |
|
4522 inserted. The position is relative to zero, i.e. zero implies |
|
4523 that a pointer is inserted at the beginning of the array. |
|
4524 |
|
4525 @return KErrNone, if the insertion is successful, otherwise one of the system |
|
4526 wide error codes. |
|
4527 |
|
4528 @panic USER 131, if aPos is negative, or is greater than the number of object |
|
4529 pointers currently in the array. |
|
4530 */ |
|
4531 { return RPointerArrayBase::Insert(anEntry,aPos); } |
|
4532 |
|
4533 |
|
4534 |
|
4535 |
|
4536 inline void RPointerArray<TAny>::Remove(TInt anIndex) |
|
4537 /** |
|
4538 Removes the pointer at the specified position from the array. |
|
4539 |
|
4540 Note that the function does not delete the object whose pointer is removed. |
|
4541 |
|
4542 @param anIndex The position within the array from where the pointer |
|
4543 is to be removed. The position is relative to zero, i.e. zero |
|
4544 implies that a pointer at the beginning of the array is to be |
|
4545 removed. |
|
4546 |
|
4547 @panic USER 130, if anIndex is negative, or is greater than the number of |
|
4548 objects currently in the array. |
|
4549 */ |
|
4550 {RPointerArrayBase::Remove(anIndex);} |
|
4551 |
|
4552 |
|
4553 |
|
4554 |
|
4555 inline void RPointerArray<TAny>::Compress() |
|
4556 /** |
|
4557 Compresses the array down to a minimum. |
|
4558 |
|
4559 After a call to this function, the memory allocated to the array is just |
|
4560 sufficient for its contained pointers. |
|
4561 Subsequently adding a new pointer to the array |
|
4562 always results in a re-allocation of memory. |
|
4563 */ |
|
4564 {RPointerArrayBase::Compress();} |
|
4565 |
|
4566 |
|
4567 |
|
4568 |
|
4569 inline void RPointerArray<TAny>::Reset() |
|
4570 /** |
|
4571 Empties the array. |
|
4572 |
|
4573 It frees all memory allocated to the array and resets the internal state so |
|
4574 that it is ready to be reused. |
|
4575 |
|
4576 This array object can be allowed to go out of scope after a call to this |
|
4577 function. |
|
4578 |
|
4579 Note that the function does not delete the objects whose pointers are contained |
|
4580 in the array. |
|
4581 */ |
|
4582 {RPointerArrayBase::Reset();} |
|
4583 |
|
4584 |
|
4585 |
|
4586 |
|
4587 inline TInt RPointerArray<TAny>::Find(const TAny* anEntry) const |
|
4588 /** |
|
4589 Finds the first pointer in the array which matches the specified pointer, using |
|
4590 a sequential search. |
|
4591 |
|
4592 Matching is based on the comparison of pointers. |
|
4593 |
|
4594 The find operation always starts at the low index end of the array. There |
|
4595 is no assumption about the order of objects in the array. |
|
4596 |
|
4597 @param anEntry The pointer to be found. |
|
4598 @return The index of the first matching pointer within the array. |
|
4599 KErrNotFound, if no matching pointer can be found. |
|
4600 */ |
|
4601 { return RPointerArrayBase::Find(anEntry); } |
|
4602 |
|
4603 |
|
4604 |
|
4605 |
|
4606 inline TInt RPointerArray<TAny>::FindReverse(const TAny* anEntry) const |
|
4607 /** |
|
4608 Finds the last pointer in the array which matches the specified pointer, using |
|
4609 a sequential search. |
|
4610 |
|
4611 Matching is based on the comparison of pointers. |
|
4612 |
|
4613 The find operation always starts at the high index end of the array. There |
|
4614 is no assumption about the order of objects in the array. |
|
4615 |
|
4616 @param anEntry The pointer to be found. |
|
4617 @return The index of the last matching pointer within the array. |
|
4618 KErrNotFound, if no matching pointer can be found. |
|
4619 */ |
|
4620 { return RPointerArrayBase::FindReverse(anEntry); } |
|
4621 |
|
4622 |
|
4623 |
|
4624 |
|
4625 inline TInt RPointerArray<TAny>::FindInAddressOrder(const TAny* anEntry) const |
|
4626 /** |
|
4627 Finds the pointer in the array that matches the specified object |
|
4628 pointer, using a binary search technique. |
|
4629 |
|
4630 The function assumes that pointers in the array are in address order. |
|
4631 |
|
4632 @param anEntry The pointer to be found. |
|
4633 |
|
4634 @return The index of the matching pointer within the array or KErrNotFound |
|
4635 if no suitable pointer can be found. |
|
4636 */ |
|
4637 { return RPointerArrayBase::FindIsqUnsigned((TUint)anEntry); } |
|
4638 |
|
4639 |
|
4640 |
|
4641 |
|
4642 inline TInt RPointerArray<TAny>::FindInAddressOrder(const TAny* anEntry, TInt& anIndex) const |
|
4643 /** |
|
4644 Finds the pointer in the array that matches the specified object |
|
4645 pointer, using a binary search technique. |
|
4646 |
|
4647 The function assumes that pointers in the array are in address order. |
|
4648 |
|
4649 @param anEntry The pointer to be found. |
|
4650 @param anIndex A TInt supplied by the caller. On return, contains an index |
|
4651 value: |
|
4652 If the function returns KErrNone, this is the index of the |
|
4653 matching pointer within the array. |
|
4654 If the function returns KErrNotFound, this is the index of the |
|
4655 last pointer within the array which logically |
|
4656 precedes anEntry. |
|
4657 |
|
4658 @return KErrNone, if a matching pointer is found. |
|
4659 KErrNotFound, if no suitable pointer can be found. |
|
4660 */ |
|
4661 { return RPointerArrayBase::BinarySearchUnsigned((TUint)anEntry,anIndex); } |
|
4662 |
|
4663 |
|
4664 |
|
4665 |
|
4666 inline TInt RPointerArray<TAny>::SpecificFindInAddressOrder(const TAny* anEntry, TInt aMode) const |
|
4667 /** |
|
4668 Finds the pointer in the array that matches the specified pointer, using a |
|
4669 binary search technique. |
|
4670 |
|
4671 Where there is more than one matching element, it finds the first, the last |
|
4672 or any matching element as specified by the value of aMode. |
|
4673 |
|
4674 The function assumes that pointers in the array are in address order. |
|
4675 |
|
4676 @param anEntry The pointer to be found. |
|
4677 @param aMode Specifies whether to find the first match, the last match or |
|
4678 any match, as defined by one of the TArrayFindMode enum values. |
|
4679 |
|
4680 @return KErrNotFound, if there is no matching element, otherwise the array |
|
4681 index of a matching element - what the index refers to depends on the |
|
4682 value of aMode: |
|
4683 if this is EArrayFindMode_First, then the index refers to the first matching element; |
|
4684 if this is EArrayFindMode_Any, then the index can refer to any of the matching elements; |
|
4685 if this is EArrayFindMode_Last, then the index refers to first element that follows |
|
4686 the last matching element - if the last matching element is also the last element of |
|
4687 the array, then the index value is the same as the total number of elements in the array. |
|
4688 |
|
4689 @see TArrayFindMode |
|
4690 */ |
|
4691 { return RPointerArrayBase::FindIsqUnsigned((TUint)anEntry, aMode); } |
|
4692 |
|
4693 |
|
4694 |
|
4695 |
|
4696 inline TInt RPointerArray<TAny>::SpecificFindInAddressOrder(const TAny* anEntry, TInt& anIndex, TInt aMode) const |
|
4697 /** |
|
4698 Finds the pointer in the array that matches the specified pointer, using a |
|
4699 binary search technique. |
|
4700 |
|
4701 Where there is more than one matching element, it finds the first, the last |
|
4702 or any matching element as specified by the value of aMode. |
|
4703 |
|
4704 The function assumes that pointers in the array are in address order. |
|
4705 |
|
4706 @param anEntry The pointer to be found. |
|
4707 @param anIndex A TInt type supplied by the caller. On return, it contains an |
|
4708 index value depending on whether a match is found and on the |
|
4709 value of aMode. |
|
4710 If there is no matching element in the array, then this is |
|
4711 the index of the first element in the array that is bigger than |
|
4712 the element being searched for - if no elements in the array are |
|
4713 bigger, then the index value is the same as the total number of |
|
4714 elements in the array. If there is a matching element, then what |
|
4715 the index refers to depends on the value of aMode: |
|
4716 if this is EArrayFindMode_First, then the index refers to the first matching element; |
|
4717 if this is EArrayFindMode_Any, then the index can refer to any of the matching elements; |
|
4718 if this is EArrayFindMode_Last, then the index refers to first element that follows the |
|
4719 last matching element - if the last matching element is also the last element of the array, |
|
4720 then the index value is the same as the total number of elements in the array. |
|
4721 |
|
4722 @param aMode Specifies whether to find the first match, the last match or any |
|
4723 match, as defined by one of the TArrayFindMode enum values. |
|
4724 |
|
4725 @return KErrNone, if a matching pointer is found. |
|
4726 KErrNotFound, if no suitable pointer can be found. |
|
4727 |
|
4728 @see TArrayFindMode |
|
4729 */ |
|
4730 { return RPointerArrayBase::BinarySearchUnsigned((TUint)anEntry,anIndex,aMode); } |
|
4731 |
|
4732 |
|
4733 |
|
4734 |
|
4735 inline TInt RPointerArray<TAny>::InsertInAddressOrder(const TAny* anEntry) |
|
4736 /** |
|
4737 Inserts an pointer into the array in address order. |
|
4738 |
|
4739 No duplicate entries are permitted. The array remains unchanged following |
|
4740 an attempt to insert a duplicate entry. |
|
4741 |
|
4742 The function assumes that existing pointers within the array are in |
|
4743 address order. |
|
4744 |
|
4745 @param anEntry The pointer to be inserted. |
|
4746 |
|
4747 @return KErrNone, if the insertion is successful; |
|
4748 KErrAlreadyExists, if an attempt is being made |
|
4749 to insert a duplicate entry; otherwise one of the other system wide |
|
4750 error codes. |
|
4751 */ |
|
4752 { return RPointerArrayBase::InsertIsqUnsigned((TUint)anEntry,EFalse); } |
|
4753 |
|
4754 |
|
4755 |
|
4756 |
|
4757 inline TInt RPointerArray<TAny>::InsertInAddressOrderAllowRepeats(const TAny* anEntry) |
|
4758 /** |
|
4759 Inserts an pointer into the array in address order, allowing duplicates. |
|
4760 |
|
4761 If the new pointer is a duplicate of an existing pointer in |
|
4762 the array, then the new pointer is inserted after the existing one. If more |
|
4763 than one duplicate pointer already exists in the array, then any new |
|
4764 duplicate pointer is inserted after the last one. |
|
4765 |
|
4766 The function assumes that existing pointers within the array are in |
|
4767 address order. |
|
4768 |
|
4769 @param anEntry The pointer to be inserted. |
|
4770 |
|
4771 @return KErrNone, if the insertion is successful, otherwise one of the system |
|
4772 wide error codes. |
|
4773 */ |
|
4774 { return RPointerArrayBase::InsertIsqUnsigned((TUint)anEntry,ETrue); } |
|
4775 |
|
4776 |
|
4777 |
|
4778 |
|
4779 #ifndef __KERNEL_MODE__ |
|
4780 inline RPointerArray<TAny>::RPointerArray(TAny** aEntries, TInt aCount) |
|
4781 : RPointerArrayBase((TAny **)aEntries, aCount) |
|
4782 /** |
|
4783 C++ constructor with a pointer to the first array entry in a pre-existing |
|
4784 array, and the number of entries in that array. |
|
4785 |
|
4786 This constructor takes a pointer to a pre-existing set of entries of type TAny*, |
|
4787 which is owned by another RPointerArray object. Ownership of the set of entries |
|
4788 still resides with the original RPointerArray object. |
|
4789 |
|
4790 @param aEntries A pointer to the first entry of type TAny* in the set of entries |
|
4791 belonging to the existing array. |
|
4792 @param aCount The number of entries in the existing array. The granularity of |
|
4793 this array is set to this value. |
|
4794 |
|
4795 @panic USER 156, if aCount is not positive. |
|
4796 */ |
|
4797 {} |
|
4798 |
|
4799 |
|
4800 |
|
4801 |
|
4802 inline void RPointerArray<TAny>::GranularCompress() |
|
4803 /** |
|
4804 Compresses the array down to a granular boundary. |
|
4805 |
|
4806 After a call to this function, the memory allocated to the array is sufficient |
|
4807 for its contained pointers. Adding new pointers to the array |
|
4808 does not result in a re-allocation of memory until the the total number of |
|
4809 pointers reaches a multiple of the granularity. |
|
4810 */ |
|
4811 {RPointerArrayBase::GranularCompress();} |
|
4812 |
|
4813 |
|
4814 |
|
4815 |
|
4816 inline void RPointerArray<TAny>::SortIntoAddressOrder() |
|
4817 /** |
|
4818 Sorts the pointers within the array into address order. |
|
4819 */ |
|
4820 { HeapSortUnsigned(); } |
|
4821 |
|
4822 |
|
4823 |
|
4824 |
|
4825 inline TArray<TAny*> RPointerArray<TAny>::Array() const |
|
4826 /** |
|
4827 Constructs and returns a generic array. |
|
4828 |
|
4829 @return A generic array representing this array. |
|
4830 |
|
4831 @see TArray |
|
4832 */ |
|
4833 { return TArray<TAny*>(GetCount,GetElementPtr,(const CBase*)this); } |
|
4834 #endif |
|
4835 |
|
4836 |
|
4837 |
|
4838 template <class T> |
|
4839 inline RArray<T>::RArray() |
|
4840 : RArrayBase(sizeof(T)) |
|
4841 /** |
|
4842 Default C++ constructor. |
|
4843 |
|
4844 This constructs an array object for an array of type class T objects with |
|
4845 default granularity and key offset value. The default granularity is 8 and |
|
4846 the defaul key offset value is zero. |
|
4847 |
|
4848 @panic USER 129, if the size of class T is not positive or is not less |
|
4849 than 640. |
|
4850 */ |
|
4851 {} |
|
4852 |
|
4853 |
|
4854 |
|
4855 |
|
4856 template <class T> |
|
4857 inline RArray<T>::RArray(TInt aGranularity) |
|
4858 : RArrayBase(sizeof(T),aGranularity) |
|
4859 /** |
|
4860 C++ constructor with granularity. |
|
4861 |
|
4862 This constructs an array object for an array of type class T objects with |
|
4863 a specified granularity and default key offset value. The default key offset |
|
4864 value is zero. |
|
4865 |
|
4866 @param aGranularity The granularity of the array. |
|
4867 |
|
4868 @panic USER 129, if the size of class T is not positive or is not less |
|
4869 than 640. |
|
4870 @panic USER 127, if aGranularity is not positive or the product of this |
|
4871 value and the size of class T is not less than 0x10000000. |
|
4872 */ |
|
4873 {} |
|
4874 |
|
4875 |
|
4876 |
|
4877 |
|
4878 template <class T> |
|
4879 inline RArray<T>::RArray(TInt aGranularity, TInt aKeyOffset) |
|
4880 : RArrayBase(sizeof(T),aGranularity,aKeyOffset) |
|
4881 /** |
|
4882 C++ constructor with granularity and key offset. |
|
4883 |
|
4884 This constructs an array object for an array of type class T objects with |
|
4885 a specified granularity and a specified key offset value. |
|
4886 |
|
4887 @param aGranularity The granularity of the array. |
|
4888 @param aKeyOffset The key offset. |
|
4889 |
|
4890 @panic USER 129, if the size of class T is not positive or is not less |
|
4891 than 640. |
|
4892 @panic USER 127, if aGranularity is not positive or the product of this |
|
4893 value and the size of class T is not less than 0x10000000. |
|
4894 @panic USER 128, if aKeyOffset is not positive, or is not less than the |
|
4895 size of class T, or is not a multiple of 4. |
|
4896 */ |
|
4897 {} |
|
4898 |
|
4899 |
|
4900 |
|
4901 |
|
4902 /** |
|
4903 C++ constructor with minimum growth step and exponential growth factor. |
|
4904 |
|
4905 This constructs an array object for an array of class T objects with the |
|
4906 specified minimum growth step and exponential growth factor. |
|
4907 |
|
4908 @param aMinGrowBy The minimum growth step of the array. Must be between 1 and |
|
4909 65535 inclusive. |
|
4910 @param aKeyOffset The key offset. |
|
4911 @param aFactor The factor by which the array grows, multiplied by 256. |
|
4912 For example 512 specifies a factor of 2. Must be between 257 |
|
4913 and 32767 inclusive. |
|
4914 |
|
4915 @panic USER 129, if the size of class T is not positive or is not less than 640. |
|
4916 @panic USER 128, if aKeyOffset is negative, or is not less than the |
|
4917 size of class T, or is not a multiple of 4. |
|
4918 @panic USER 192, if aMinGrowBy<=0 or aMinGrowBy>65535. |
|
4919 @panic USER 193, if aFactor<=257 or aFactor>32767. |
|
4920 */ |
|
4921 template <class T> |
|
4922 inline RArray<T>::RArray(TInt aMinGrowBy, TInt aKeyOffset, TInt aFactor) |
|
4923 : RArrayBase(sizeof(T), aMinGrowBy, aKeyOffset, aFactor) |
|
4924 {} |
|
4925 |
|
4926 |
|
4927 |
|
4928 |
|
4929 template <class T> |
|
4930 inline RArray<T>::RArray(TInt aEntrySize,T* aEntries, TInt aCount) |
|
4931 : RArrayBase(aEntrySize,aEntries,aCount) |
|
4932 /** |
|
4933 C++ constructor with size of entry, a pointer to the first array entry in a |
|
4934 pre-existing array, and the number of entries in that array. |
|
4935 |
|
4936 This constructor takes a pointer to a pre-existing set of entries of type |
|
4937 class T objects owned by another RArray object. Ownership of the set of entries |
|
4938 still resides with the original RArray object. |
|
4939 |
|
4940 This array is assigned a default granularity and key offset value. The default |
|
4941 granularity is 8 and the default key offset value is zero. |
|
4942 |
|
4943 The purpose of constructing an array in this way is to allow sorting and |
|
4944 finding operations to be done without further allocation of memory. |
|
4945 |
|
4946 @param aEntrySize The size of an entry in the existing array. |
|
4947 @param aEntries A pointer to the first entry of type class T in the set of |
|
4948 entries belonging to the existing array. |
|
4949 @param aCount The number of entries in the existing array. |
|
4950 |
|
4951 @panic USER 129, if aEntrySize is not positive or is not less than 640. |
|
4952 @panic USER 156, if aCount is not positive. |
|
4953 */ |
|
4954 {} |
|
4955 |
|
4956 |
|
4957 |
|
4958 |
|
4959 template <class T> |
|
4960 inline void RArray<T>::Close() |
|
4961 /** |
|
4962 Closes the array and frees all memory allocated to the array. |
|
4963 |
|
4964 The function must be called before this array object is destroyed. |
|
4965 */ |
|
4966 {RArrayBase::Close();} |
|
4967 |
|
4968 |
|
4969 |
|
4970 |
|
4971 template <class T> |
|
4972 inline TInt RArray<T>::Count() const |
|
4973 /** |
|
4974 Gets the number of objects in the array. |
|
4975 |
|
4976 @return The number of objects in the array. |
|
4977 */ |
|
4978 {return RArrayBase::Count();} |
|
4979 |
|
4980 |
|
4981 |
|
4982 |
|
4983 template <class T> |
|
4984 inline const T& RArray<T>::operator[](TInt anIndex) const |
|
4985 /** |
|
4986 Gets a reference to an object located at a specified position within the array. |
|
4987 |
|
4988 The compiler chooses this function if the returned reference is used in an |
|
4989 expression where the reference cannot be modified. |
|
4990 |
|
4991 @param anIndex The position of the object within the array. The position is |
|
4992 relative to zero, i.e. zero implies the object at the beginning |
|
4993 of the array. |
|
4994 |
|
4995 @return A const reference to the object at position anIndex within the array. |
|
4996 |
|
4997 @panic USER 130, if anIndex is negative or is greater than the number of |
|
4998 objects currently in the array |
|
4999 */ |
|
5000 {return *(const T*)At(anIndex); } |
|
5001 |
|
5002 |
|
5003 |
|
5004 |
|
5005 template <class T> |
|
5006 inline T& RArray<T>::operator[](TInt anIndex) |
|
5007 /** |
|
5008 Gets a reference to an object located at a specified position within the array. |
|
5009 |
|
5010 The compiler chooses this function if the returned reference is used in an |
|
5011 expression where the reference can be modified. |
|
5012 |
|
5013 @param anIndex The position of the object within the array. The position is |
|
5014 relative to zero, i.e. zero implies the object at the beginning |
|
5015 of the array. |
|
5016 |
|
5017 @return A non-const reference to the object at position anIndex within the array. |
|
5018 |
|
5019 @panic USER 130, if anIndex is negative or is greater than the number of |
|
5020 objects currently in the array |
|
5021 */ |
|
5022 {return *(T*)At(anIndex); } |
|
5023 |
|
5024 |
|
5025 |
|
5026 |
|
5027 template <class T> |
|
5028 inline TInt RArray<T>::Append(const T& anEntry) |
|
5029 /** |
|
5030 Apends an object onto the array. |
|
5031 |
|
5032 @param anEntry A reference to the object of type class T to be appended. |
|
5033 |
|
5034 @return KErrNone, if the insertion is successful, otherwise one of the system |
|
5035 wide error codes. |
|
5036 */ |
|
5037 {return RArrayBase::Append(&anEntry);} |
|
5038 |
|
5039 |
|
5040 |
|
5041 |
|
5042 template <class T> |
|
5043 inline TInt RArray<T>::Insert(const T& anEntry, TInt aPos) |
|
5044 /** |
|
5045 Inserts an object into the array at a specified position. |
|
5046 |
|
5047 @param anEntry The class T object to be inserted. |
|
5048 @param aPos The position within the array where the object is to |
|
5049 be inserted. The position is relative to zero, i.e. zero |
|
5050 implies that an object is inserted at the beginning of |
|
5051 the array. |
|
5052 |
|
5053 @return KErrNone, if the insertion is successful, otherwise one of the system |
|
5054 wide error codes. |
|
5055 |
|
5056 @panic USER 131, if aPos is negative or is greater than the number of objects |
|
5057 currently in the array. |
|
5058 */ |
|
5059 {return RArrayBase::Insert(&anEntry,aPos);} |
|
5060 |
|
5061 |
|
5062 |
|
5063 |
|
5064 template <class T> |
|
5065 inline void RArray<T>::Remove(TInt anIndex) |
|
5066 /** |
|
5067 Removes the object at a specified position from the array. |
|
5068 |
|
5069 @param anIndex The position within the array from where the object is to be |
|
5070 removed. The position is relative to zero, i.e. zero implies |
|
5071 that an object at the beginning of the array is to be removed. |
|
5072 |
|
5073 @panic USER 130, if anIndex is negative or is greater than the number of |
|
5074 objects currently in the array. |
|
5075 */ |
|
5076 {RArrayBase::Remove(anIndex);} |
|
5077 |
|
5078 |
|
5079 |
|
5080 |
|
5081 template <class T> |
|
5082 inline void RArray<T>::Compress() |
|
5083 /** |
|
5084 Compresses the array down to a minimum. |
|
5085 |
|
5086 After a call to this function, the memory allocated to the array is just |
|
5087 sufficient for its contained objects. Subsequently adding a new object to the |
|
5088 array always results in a re-allocation of memory. |
|
5089 */ |
|
5090 {RArrayBase::Compress();} |
|
5091 |
|
5092 |
|
5093 |
|
5094 |
|
5095 template <class T> |
|
5096 inline void RArray<T>::Reset() |
|
5097 /** |
|
5098 Empties the array, so that it is ready to be reused. |
|
5099 |
|
5100 The function frees all memory allocated to the array and resets the internal |
|
5101 state so that it is ready to be reused. |
|
5102 |
|
5103 This array object can be allowed to go out of scope after a call to this function. |
|
5104 */ |
|
5105 {RArrayBase::Reset();} |
|
5106 |
|
5107 |
|
5108 |
|
5109 |
|
5110 template <class T> |
|
5111 inline TInt RArray<T>::Find(const T& anEntry) const |
|
5112 /** |
|
5113 Finds the first object in the array which matches the specified object using |
|
5114 a sequential search. |
|
5115 |
|
5116 Matching is based on the comparison of a TInt value at the key offset position |
|
5117 within the objects. |
|
5118 |
|
5119 For classes which define their own equality operator (==), the alternative method |
|
5120 Find(const T& anEntry, TIdentityRelation<T> anIdentity) is recommended. |
|
5121 |
|
5122 The find operation always starts at the low index end of the array. There |
|
5123 is no assumption about the order of objects in the array. |
|
5124 |
|
5125 @param anEntry A reference to an object of type class T to be used for matching. |
|
5126 |
|
5127 @return The index of the first matching object within the array. |
|
5128 KErrNotFound, if no matching object can be found. |
|
5129 */ |
|
5130 {return RArrayBase::Find(&anEntry);} |
|
5131 |
|
5132 |
|
5133 |
|
5134 |
|
5135 template <class T> |
|
5136 inline TInt RArray<T>::Find(const T& anEntry, TIdentityRelation<T> anIdentity) const |
|
5137 /** |
|
5138 Finds the first object in the array which matches the specified object using |
|
5139 a sequential search and a matching algorithm. |
|
5140 |
|
5141 The algorithm for determining whether two class T type objects match is provided |
|
5142 by a function supplied by the caller. |
|
5143 |
|
5144 Such a function need not be supplied if an equality operator (==) is defined for class T. |
|
5145 In this case, default construction of anIdentity provides matching, as in the example below: |
|
5146 |
|
5147 @code |
|
5148 //Construct a TPoint and append to an RArray<TPoint> |
|
5149 TPoint p1(0,0); |
|
5150 RArray<TPoint> points; |
|
5151 points.AppendL(p1); |
|
5152 //Find position of p1 in points using TIdentityRelation<TPoint> default construction |
|
5153 TInt r = points.Find(p1, TIdentityRelation<TPoint>()); |
|
5154 @endcode |
|
5155 |
|
5156 The find operation always starts at the low index end of the array. There |
|
5157 is no assumption about the order of objects in the array. |
|
5158 |
|
5159 @param anEntry A reference to an object of type class T to be used |
|
5160 for matching. |
|
5161 @param anIdentity A package encapsulating the function which determines whether |
|
5162 two class T type objects match. |
|
5163 |
|
5164 @return The index of the first matching object within the array. |
|
5165 KErrNotFound, if no matching object can be found. |
|
5166 */ |
|
5167 {return RArrayBase::Find(&anEntry,anIdentity);} |
|
5168 |
|
5169 |
|
5170 |
|
5171 |
|
5172 template <class T> |
|
5173 inline TInt RArray<T>::FindReverse(const T& anEntry) const |
|
5174 /** |
|
5175 Finds the last object in the array which matches the specified object using |
|
5176 a sequential search. |
|
5177 |
|
5178 Matching is based on the comparison of a TInt value at the key offset position |
|
5179 within the objects. |
|
5180 |
|
5181 For classes which define their own equality operator (==), the alternative method |
|
5182 FindReverse(const T& anEntry, TIdentityRelation<T> anIdentity) is recommended. |
|
5183 |
|
5184 The find operation always starts at the high index end of the array. There |
|
5185 is no assumption about the order of objects in the array. |
|
5186 |
|
5187 @param anEntry A reference to an object of type class T to be used for matching. |
|
5188 |
|
5189 @return The index of the last matching object within the array. |
|
5190 KErrNotFound, if no matching object can be found. |
|
5191 */ |
|
5192 {return RArrayBase::FindReverse(&anEntry);} |
|
5193 |
|
5194 |
|
5195 |
|
5196 |
|
5197 template <class T> |
|
5198 inline TInt RArray<T>::FindReverse(const T& anEntry, TIdentityRelation<T> anIdentity) const |
|
5199 /** |
|
5200 Finds the last object in the array which matches the specified object using |
|
5201 a sequential search and a matching algorithm. |
|
5202 |
|
5203 The algorithm for determining whether two class T type objects match is provided |
|
5204 by a function supplied by the caller. |
|
5205 |
|
5206 Such a function need not be supplied if an equality operator (==) is defined for class T. |
|
5207 In this case, default construction of anIdentity provides matching. |
|
5208 |
|
5209 See Find(const T& anEntry, TIdentityRelation<T> anIdentity) for more details. |
|
5210 |
|
5211 The find operation always starts at the high index end of the array. There |
|
5212 is no assumption about the order of objects in the array. |
|
5213 |
|
5214 @param anEntry A reference to an object of type class T to be used |
|
5215 for matching. |
|
5216 @param anIdentity A package encapsulating the function which determines whether |
|
5217 two class T type objects match. |
|
5218 |
|
5219 @return The index of the last matching object within the array. |
|
5220 KErrNotFound, if no matching object can be found. |
|
5221 */ |
|
5222 {return RArrayBase::FindReverse(&anEntry,anIdentity);} |
|
5223 |
|
5224 |
|
5225 |
|
5226 |
|
5227 template <class T> |
|
5228 inline TInt RArray<T>::FindInSignedKeyOrder(const T& anEntry) const |
|
5229 /** |
|
5230 Finds the object in the array which matches the specified object using a binary |
|
5231 search technique. |
|
5232 |
|
5233 The function assumes that existing objects within the array are in signed |
|
5234 key order. |
|
5235 |
|
5236 @param anEntry A reference to an object of type class T to be used for matching. |
|
5237 |
|
5238 @return The index of the matching object within the array, or KErrNotFound |
|
5239 if no matching object can be found. |
|
5240 */ |
|
5241 {return RArrayBase::FindIsqSigned(&anEntry);} |
|
5242 |
|
5243 |
|
5244 |
|
5245 |
|
5246 template <class T> |
|
5247 inline TInt RArray<T>::FindInUnsignedKeyOrder(const T& anEntry) const |
|
5248 /** |
|
5249 Finds the object in the array which matches the specified object using a binary |
|
5250 search technique. |
|
5251 |
|
5252 The function assumes that existing objects within the array are in unsigned |
|
5253 key order. |
|
5254 |
|
5255 @param anEntry A reference to an object of type class T to be used for matching. |
|
5256 |
|
5257 @return The index of the matching object within the array, or KErrNotFound |
|
5258 if no matching object can be found. |
|
5259 */ |
|
5260 {return RArrayBase::FindIsqUnsigned(&anEntry);} |
|
5261 |
|
5262 |
|
5263 |
|
5264 |
|
5265 template <class T> |
|
5266 inline TInt RArray<T>::FindInOrder(const T& anEntry, TLinearOrder<T> anOrder) const |
|
5267 /** |
|
5268 Finds the object in the array which matches the specified object using a binary |
|
5269 search technique and an ordering algorithm. |
|
5270 |
|
5271 The function assumes that existing objects within the array are in object |
|
5272 order as determined by an algorithm supplied by the caller and packaged as |
|
5273 a TLinearOrder<T>. |
|
5274 |
|
5275 @param anEntry A reference to an object of type class T to be used for matching. |
|
5276 @param anOrder A package encapsulating the function which determines the order |
|
5277 of two class T objects. |
|
5278 |
|
5279 @return The index of the matching object within the array, or KErrNotFound if |
|
5280 no matching object can be found. |
|
5281 */ |
|
5282 {return RArrayBase::FindIsq(&anEntry,anOrder);} |
|
5283 |
|
5284 |
|
5285 |
|
5286 |
|
5287 template <class T> |
|
5288 inline TInt RArray<T>::FindInSignedKeyOrder(const T& anEntry, TInt& anIndex) const |
|
5289 /** |
|
5290 Finds the object in the array which matches the specified object using a binary |
|
5291 search technique. |
|
5292 |
|
5293 The function assumes that existing objects within the array are in signed |
|
5294 key order. |
|
5295 |
|
5296 @param anEntry A reference to an object of type class T to be used for matching. |
|
5297 @param anIndex On return contains an index value. If the function returns KErrNone, |
|
5298 this is the index of the matching object within the array. |
|
5299 If the function returns KErrNotFound, this is the index of the |
|
5300 first element in the array whose key is bigger than the key of the |
|
5301 element being sought. If there are no elements in the array with |
|
5302 a bigger key, then the index value is the same as the total |
|
5303 number of elements in the array. |
|
5304 @return KErrNone if a matching object is found, or KErrNotFound if no matching |
|
5305 object can be found. |
|
5306 */ |
|
5307 {return RArrayBase::BinarySearchSigned(&anEntry,anIndex);} |
|
5308 |
|
5309 |
|
5310 |
|
5311 |
|
5312 template <class T> |
|
5313 inline TInt RArray<T>::FindInUnsignedKeyOrder(const T& anEntry, TInt& anIndex) const |
|
5314 /** |
|
5315 Finds the object in the array which matches the specified object using a binary |
|
5316 search technique. |
|
5317 |
|
5318 The function assumes that existing objects within the array are in unsigned |
|
5319 key order. |
|
5320 |
|
5321 @param anEntry A reference to an object of type class T to be used for matching. |
|
5322 @param anIndex On return contains an index value. If the function returns |
|
5323 KErrNone, this is the index of the matching object within the |
|
5324 array. |
|
5325 If the function returns KErrNotFound, this is the index of the |
|
5326 first element in the array whose key is bigger than the key of the |
|
5327 element being sought. If there are no elements in the array with |
|
5328 a bigger key, then the index value is the same as the total |
|
5329 number of elements in the array. |
|
5330 @return KErrNone if a matching object is found, or KErrNotFound if no matching |
|
5331 object can be found. |
|
5332 */ |
|
5333 {return RArrayBase::BinarySearchUnsigned(&anEntry,anIndex);} |
|
5334 |
|
5335 |
|
5336 |
|
5337 |
|
5338 template <class T> |
|
5339 inline TInt RArray<T>::FindInOrder(const T& anEntry, TInt& anIndex, TLinearOrder<T> anOrder) const |
|
5340 /** |
|
5341 Finds the object in the array which matches the specified object using a binary |
|
5342 search technique and an ordering algorithm. |
|
5343 |
|
5344 The function assumes that existing objects within the array are in object |
|
5345 order as determined by an algorithm supplied by the caller and packaged as |
|
5346 a TLinearOrder<T>. |
|
5347 |
|
5348 @param anEntry A reference to an object of type class T to be used for matching. |
|
5349 @param anIndex On return contains an index value. If the function returns |
|
5350 KErrNone, this is the index of the matching object within the |
|
5351 array. |
|
5352 If the function returns KErrNotFound, this is the index of the |
|
5353 first element in the array that is bigger than the element being |
|
5354 searched for - if no elements in the array are bigger, then |
|
5355 the index value is the same as the total number of elements in |
|
5356 the array. |
|
5357 @param anOrder A package encapsulating the function which determines the order |
|
5358 of two class T objects. |
|
5359 |
|
5360 @return KErrNone if a matching object is found. KErrNotFound if no matching |
|
5361 object can be found. |
|
5362 */ |
|
5363 {return RArrayBase::BinarySearch(&anEntry,anIndex,anOrder);} |
|
5364 |
|
5365 |
|
5366 |
|
5367 |
|
5368 template <class T> |
|
5369 inline TInt RArray<T>::SpecificFindInSignedKeyOrder(const T& anEntry, TInt aMode) const |
|
5370 /** |
|
5371 Finds the object in the array which matches the specified object using a binary |
|
5372 search technique. |
|
5373 |
|
5374 The element ordering is determined by a signed 32-bit word |
|
5375 (the key) embedded in each array element. In the case that there is more than |
|
5376 one matching element, finds the first, last or any match as specified by |
|
5377 the value of aMode. |
|
5378 |
|
5379 The function assumes that existing objects within the array are in signed |
|
5380 key order. |
|
5381 |
|
5382 @param anEntry A reference to an object of type class T to be used for matching. |
|
5383 @param aMode Specifies whether to find the first match, the last match or |
|
5384 any match, as defined by one of the TArrayFindMode enum values. |
|
5385 |
|
5386 @return KErrNotFound, if there is no matching element, otherwise the array |
|
5387 index of a matching element - what the index refers to depends on the |
|
5388 value of aMode: |
|
5389 if this is EArrayFindMode_First, then the index refers to the first matching element; |
|
5390 if this is EArrayFindMode_Any, then the index can refer to any of the matching elements; |
|
5391 if this is EArrayFindMode_Last, then the index refers to first element that follows |
|
5392 the last matching element - if the last matching element is also the last element of |
|
5393 the array, then the index value is the same as the total number of elements in the array. |
|
5394 |
|
5395 @see TArrayFindMode |
|
5396 */ |
|
5397 {return RArrayBase::FindIsqSigned(&anEntry,aMode);} |
|
5398 |
|
5399 |
|
5400 |
|
5401 |
|
5402 template <class T> |
|
5403 inline TInt RArray<T>::SpecificFindInUnsignedKeyOrder(const T& anEntry, TInt aMode) const |
|
5404 /** |
|
5405 Finds the object in the array which matches the specified object using a binary |
|
5406 search technique. |
|
5407 |
|
5408 The element ordering is determined by an unsigned 32-bit word |
|
5409 (the key) embedded in each array element. Where there is more than |
|
5410 one matching element, it finds the first, last or any matching element |
|
5411 as specified by the value of aMode. |
|
5412 |
|
5413 The function assumes that existing objects within the array are in unsigned |
|
5414 key order. |
|
5415 |
|
5416 @param anEntry A reference to an object of type class T to be used for matching. |
|
5417 @param aMode Specifies whether to find the first match, the last match or |
|
5418 any match, as defined by one of the TArrayFindMode enum values. |
|
5419 |
|
5420 @return KErrNotFound, if there is no matching element, otherwise the array |
|
5421 index of a matching element - what the index refers to depends on the |
|
5422 value of aMode: |
|
5423 if this is EArrayFindMode_First, then the index refers to the first matching element; |
|
5424 if this is EArrayFindMode_Any, then the index can refer to any of the matching elements; |
|
5425 if this is EArrayFindMode_Last, then the index refers to first element that follows the |
|
5426 last matching element - if the last matching element is also the last element of the array, |
|
5427 then the index value is the same as the total number of elements in the array. |
|
5428 |
|
5429 @see TArrayFindMode |
|
5430 */ |
|
5431 {return RArrayBase::FindIsqUnsigned(&anEntry,aMode);} |
|
5432 |
|
5433 |
|
5434 |
|
5435 |
|
5436 template <class T> |
|
5437 inline TInt RArray<T>::SpecificFindInOrder(const T& anEntry, TLinearOrder<T> anOrder, TInt aMode) const |
|
5438 /** |
|
5439 Finds the object in the array which matches the specified object using a binary |
|
5440 search technique and an ordering algorithm. |
|
5441 |
|
5442 Where there is more than one matching element, it finds the first, the last |
|
5443 or any matching element as specified by the value of aMode. |
|
5444 |
|
5445 The function assumes that existing objects within the array are in object |
|
5446 order as determined by an algorithm supplied by the caller and packaged as |
|
5447 a TLinearOrder<T> type. |
|
5448 |
|
5449 @param anEntry A reference to an object of type class T to be used for matching. |
|
5450 @param anOrder A package encapsulating the function which determines the order |
|
5451 of two class T objects. |
|
5452 @param aMode Specifies whether to find the first match, the last match or any |
|
5453 match, as defined by one of the TArrayFindMode enum values. |
|
5454 |
|
5455 @return KErrNotFound, if there is no matching element, otherwise the array index |
|
5456 of a matching element - what the index refers to depends on the value of |
|
5457 aMode: |
|
5458 if this is EArrayFindMode_First, then the index refers to the first matching element; |
|
5459 if this is EArrayFindMode_Any, then the index can refer to any of the matching elements; |
|
5460 if this is EArrayFindMode_Last, then the index refers to first element that follows |
|
5461 the last matching element - if the last matching element is also the last element of |
|
5462 the array, then the index value is the same as the total number of elements in the array. |
|
5463 */ |
|
5464 {return RArrayBase::FindIsq(&anEntry,anOrder,aMode);} |
|
5465 |
|
5466 |
|
5467 |
|
5468 |
|
5469 template <class T> |
|
5470 inline TInt RArray<T>::SpecificFindInSignedKeyOrder(const T& anEntry, TInt& anIndex, TInt aMode) const |
|
5471 /** |
|
5472 Finds the object in the array which matches the specified object using a binary |
|
5473 search technique. |
|
5474 |
|
5475 The element ordering is determined by a signed 32-bit word |
|
5476 (the key) embedded in each array element. Where there is more than |
|
5477 one matching element, finds the first, last or any matching element as |
|
5478 specified specified by the value of aMode. |
|
5479 |
|
5480 The function assumes that existing objects within the array are in signed |
|
5481 key order. |
|
5482 |
|
5483 @param anEntry A reference to an object of type class T to be used for matching. |
|
5484 @param anIndex A TInt type supplied by the caller. On return, it contains |
|
5485 an index value depending on whether a match is found and on the |
|
5486 value of aMode. If there is no matching element in the array, |
|
5487 then this is the index of the first element in the array that |
|
5488 is bigger than the element being searched for - if no elements |
|
5489 in the array are bigger, then the index value is the same as the |
|
5490 total number of elements in the array. If there is a matching |
|
5491 element, then what the index refers to depends on the value of aMode: |
|
5492 if this is EArrayFindMode_First, then the index refers to the first matching element; |
|
5493 if this is EArrayFindMode_Any, then the index can refer to any of the matching elements; |
|
5494 if this is EArrayFindMode_Last, then the index refers to first element that follows |
|
5495 the last matching element - if the last matching element is also the last element of |
|
5496 the array, then the index value is the same as the total number of elements in the array. |
|
5497 @param aMode Specifies whether to find the first match, the last match or any match, |
|
5498 as defined by one of the TArrayFindMode enum values. |
|
5499 |
|
5500 @return KErrNone, if a matching object pointer is found; |
|
5501 KErrNotFound, if no suitable object pointer can be found. |
|
5502 */ |
|
5503 {return RArrayBase::BinarySearchSigned(&anEntry,anIndex,aMode);} |
|
5504 |
|
5505 |
|
5506 |
|
5507 |
|
5508 template <class T> |
|
5509 inline TInt RArray<T>::SpecificFindInUnsignedKeyOrder(const T& anEntry, TInt& anIndex, TInt aMode) const |
|
5510 /** |
|
5511 Finds the object in the array which matches the specified object using a binary |
|
5512 search technique. |
|
5513 |
|
5514 The element ordering is determined by an unsigned 32-bit word |
|
5515 (the key) embedded in each array element. Where there is more than |
|
5516 one matching element, it finds the first, last or any matching element as |
|
5517 specified by the value of aMode. |
|
5518 |
|
5519 The function assumes that existing objects within the array are in unsigned |
|
5520 key order. |
|
5521 |
|
5522 @param anEntry A reference to an object of type class T to be used for matching. |
|
5523 @param anIndex A TInt type supplied by the caller. On return, it contains an index |
|
5524 value depending on whether a match is found and on the value of aMode. |
|
5525 If there is no matching element in the array, then this is the index |
|
5526 of the first element in the array that is bigger than the element |
|
5527 being searched for - if no elements in the array are bigger, then |
|
5528 the index value is the same as the total number of elements in the array. |
|
5529 If there is a matching element, then what the index refers to depends on |
|
5530 the value of aMode: |
|
5531 if this is EArrayFindMode_First, then the index refers to the first matching element; |
|
5532 if this is EArrayFindMode_Any, then the index can refer to any of the matching elements; |
|
5533 if this is EArrayFindMode_Last, then the index refers to first element that follows the |
|
5534 last matching element - if the last matching element is also the last element of the array, |
|
5535 then the index value is the same as the total number of elements in the array. |
|
5536 @param aMode Specifies whether to find the first match, the last match or any match, as defined by one |
|
5537 of the TArrayFindMode enum values. |
|
5538 @return KErrNone, if a matching object pointer is found; KErrNotFound, if no suitable object pointer can be found. |
|
5539 |
|
5540 @see TArrayFindMode |
|
5541 */ |
|
5542 {return RArrayBase::BinarySearchUnsigned(&anEntry,anIndex,aMode);} |
|
5543 |
|
5544 |
|
5545 |
|
5546 |
|
5547 template <class T> |
|
5548 inline TInt RArray<T>::SpecificFindInOrder(const T& anEntry, TInt& anIndex, TLinearOrder<T> anOrder, TInt aMode) const |
|
5549 /** |
|
5550 Finds the object in the array which matches the specified object using a binary |
|
5551 search technique and a specified ordering algorithm. |
|
5552 |
|
5553 Where there is more than one matching element, it finds the first, the last or |
|
5554 any matching element as specified by the value of aMode. |
|
5555 |
|
5556 The function assumes that existing objects within the array are in object |
|
5557 order as determined by an algorithm supplied by the caller and packaged as |
|
5558 a TLinearOrder<T> type. |
|
5559 |
|
5560 @param anEntry A reference to an object of type class T to be used for matching. |
|
5561 @param anIndex A TInt type supplied by the caller. On return, it contains |
|
5562 an index value depending on whether a match is found and on the |
|
5563 value of aMode. If there is no matching element in the array, |
|
5564 then this is the index of the first element in the array that |
|
5565 is bigger than the element being searched for - if no elements |
|
5566 in the array are bigger, then the index value is the same as |
|
5567 the total number of elements in the array. |
|
5568 If there is a matching element, then what the index refers to |
|
5569 depends on the value of aMode: |
|
5570 if this is EArrayFindMode_First, then the index refers to the first matching element; |
|
5571 if this is EArrayFindMode_Any, then the index can refer to any of the matching elements; |
|
5572 if this is EArrayFindMode_Last, then the index refers to first element that follows |
|
5573 the last matching element - if the last matching element is also |
|
5574 the last element of the array, then the index value is the same as |
|
5575 the total number of elements in the array. |
|
5576 @param anOrder A package encapsulating the function which determines the order |
|
5577 of two class T objects. |
|
5578 @param aMode Specifies whether to find the first match, the last match or any match, |
|
5579 as defined by one of the TArrayFindMode enum values. |
|
5580 @return KErrNone, if a matching object pointer is found; |
|
5581 KErrNotFound, if no suitable object pointer can be found. |
|
5582 |
|
5583 */ |
|
5584 {return RArrayBase::BinarySearch(&anEntry,anIndex,anOrder,aMode);} |
|
5585 |
|
5586 |
|
5587 |
|
5588 |
|
5589 template <class T> |
|
5590 inline TInt RArray<T>::InsertInSignedKeyOrder(const T& anEntry) |
|
5591 /** |
|
5592 Inserts an object into the array in ascending signed key order. |
|
5593 |
|
5594 The order of two class T type objects is based on comparing a TInt value |
|
5595 located at the key offset position within the class T object. |
|
5596 |
|
5597 No duplicate entries are permitted. The array remains unchanged following |
|
5598 an attempt to insert a duplicate entry. |
|
5599 |
|
5600 @param anEntry A reference to the object of type class T to be inserted. |
|
5601 |
|
5602 @return KErrNone, if the insertion is successful; |
|
5603 KErrAlreadyExists, if an attempt is being made |
|
5604 to insert a duplicate entry; otherwise one of the other system wide |
|
5605 error codes. |
|
5606 */ |
|
5607 {return RArrayBase::InsertIsqSigned(&anEntry,EFalse);} |
|
5608 |
|
5609 |
|
5610 |
|
5611 |
|
5612 template <class T> |
|
5613 inline TInt RArray<T>::InsertInUnsignedKeyOrder(const T& anEntry) |
|
5614 /** |
|
5615 Inserts an object into the array in ascending unsigned key order. |
|
5616 |
|
5617 The order of two class T type objects is based on comparing a TUint value |
|
5618 located at the key offset position within the class T object. |
|
5619 |
|
5620 No duplicate entries are permitted. The array remains unchanged following |
|
5621 an attempt to insert a duplicate entry. |
|
5622 |
|
5623 @param anEntry A reference to the object of type class T to be inserted. |
|
5624 |
|
5625 @return KErrNone, if the insertion is successful; |
|
5626 KErrAlreadyExists, if an attempt is being made |
|
5627 to insert a duplicate entry; otherwise one of the other system wide |
|
5628 error codes. |
|
5629 */ |
|
5630 {return RArrayBase::InsertIsqUnsigned(&anEntry,EFalse);} |
|
5631 |
|
5632 |
|
5633 |
|
5634 |
|
5635 template <class T> |
|
5636 inline TInt RArray<T>::InsertInOrder(const T& anEntry, TLinearOrder<T> anOrder) |
|
5637 /** |
|
5638 Inserts an object of into the array in object order. |
|
5639 |
|
5640 The algorithm for determining the order of two class T type objects is provided |
|
5641 by a function supplied by the caller. |
|
5642 |
|
5643 No duplicate entries are permitted. The array remains unchanged following |
|
5644 an attempt to insert a duplicate entry. |
|
5645 |
|
5646 The function assumes that existing objects within the array are in object |
|
5647 order. |
|
5648 |
|
5649 @param anEntry A reference to the object of type class T to be inserted. |
|
5650 @param anOrder A package encapsulating the function which determines the order |
|
5651 of two class T objects. |
|
5652 |
|
5653 @return KErrNone, if the insertion is successful; |
|
5654 KErrAlreadyExists, if an attempt is being made |
|
5655 to insert a duplicate entry; otherwise one of the other system wide |
|
5656 error codes. |
|
5657 */ |
|
5658 {return RArrayBase::InsertIsq(&anEntry,anOrder,EFalse);} |
|
5659 |
|
5660 |
|
5661 |
|
5662 |
|
5663 template <class T> |
|
5664 inline TInt RArray<T>::InsertInSignedKeyOrderAllowRepeats(const T& anEntry) |
|
5665 /** |
|
5666 Inserts an object into the array in ascending signed key order, |
|
5667 allowing duplicates. |
|
5668 |
|
5669 The order of two class T type objects is based on comparing a TInt value |
|
5670 located at the key offset position within the class T object. |
|
5671 |
|
5672 If anEntry is a duplicate of an existing object in the array, then the new |
|
5673 object is inserted after the existing object. If more than one duplicate object |
|
5674 already exists in the array, then any new duplicate object is inserted after |
|
5675 the last one. |
|
5676 |
|
5677 @param anEntry A reference to the object of type class T to be inserted. |
|
5678 |
|
5679 @return KErrNone, if the insertion is successful, otherwise one of the system |
|
5680 wide error codes. |
|
5681 */ |
|
5682 {return RArrayBase::InsertIsqSigned(&anEntry,ETrue);} |
|
5683 |
|
5684 |
|
5685 |
|
5686 |
|
5687 template <class T> |
|
5688 inline TInt RArray<T>::InsertInUnsignedKeyOrderAllowRepeats(const T& anEntry) |
|
5689 /** |
|
5690 Inserts an object into the array in ascending unsigned key order, allowing |
|
5691 duplicates. |
|
5692 |
|
5693 The order of two class T type objects is based on comparing a TUint value |
|
5694 located at the key offset position within the class T object. |
|
5695 |
|
5696 If anEntry is a duplicate of an existing object in the array, then the new |
|
5697 object is inserted after the existing object. If more than one duplicate object |
|
5698 already exists in the array, then any new duplicate object is inserted after |
|
5699 the last one. |
|
5700 |
|
5701 @param anEntry A reference to the object of type class T to be inserted. |
|
5702 |
|
5703 @return KErrNone, if the insertion is successful, otherwise one of the system |
|
5704 wide error codes. |
|
5705 */ |
|
5706 {return RArrayBase::InsertIsqUnsigned(&anEntry,ETrue);} |
|
5707 |
|
5708 |
|
5709 |
|
5710 |
|
5711 template <class T> |
|
5712 inline TInt RArray<T>::InsertInOrderAllowRepeats(const T& anEntry, TLinearOrder<T> anOrder) |
|
5713 /** |
|
5714 Inserts an object into the array in object order, allowing duplicates. |
|
5715 |
|
5716 The algorithm for determining the order of two class T type objects is provided |
|
5717 by a function supplied by the caller. |
|
5718 |
|
5719 If anEntry is a duplicate of an existing object in the array, then the new |
|
5720 object is inserted after the existing object. If more than one duplicate object |
|
5721 already exists in the array, then anEntry is inserted after the last one. |
|
5722 |
|
5723 The function assumes that existing objects within the array are in object |
|
5724 order. |
|
5725 |
|
5726 @param anEntry A reference to the object of type class T to be inserted. |
|
5727 @param anOrder A package encapsulating the function which determines the order |
|
5728 of two class T objects. |
|
5729 |
|
5730 @return KErrNone, if the insertion is successful, otherwise one of the system |
|
5731 wide error codes. |
|
5732 */ |
|
5733 {return RArrayBase::InsertIsq(&anEntry,anOrder,ETrue);} |
|
5734 |
|
5735 |
|
5736 |
|
5737 #ifndef __KERNEL_MODE__ |
|
5738 |
|
5739 template <class T> |
|
5740 inline void RArray<T>::GranularCompress() |
|
5741 /** |
|
5742 Compresses the array down to a granular boundary. |
|
5743 |
|
5744 After a call to this function, the memory allocated to the array is sufficient |
|
5745 for its contained objects. Adding new objects to the array does not result |
|
5746 in a re-allocation of memory until the the total number of objects reaches |
|
5747 a multiple of the granularity. |
|
5748 */ |
|
5749 {RArrayBase::GranularCompress();} |
|
5750 |
|
5751 |
|
5752 |
|
5753 |
|
5754 template <class T> |
|
5755 inline TInt RArray<T>::Reserve(TInt aCount) |
|
5756 /** |
|
5757 Reserves space for the specified number of elements. |
|
5758 |
|
5759 After a call to this function, the memory allocated to the array is sufficient |
|
5760 to hold the number of objects specified. Adding new objects to the array |
|
5761 does not result in a re-allocation of memory until the the total number of |
|
5762 objects exceeds the specified count. |
|
5763 |
|
5764 @param aCount The number of objects for which space should be reserved |
|
5765 @return KErrNone If the operation completed successfully |
|
5766 @return KErrNoMemory If the requested amount of memory could not be allocated |
|
5767 */ |
|
5768 { return RArrayBase::DoReserve(aCount); } |
|
5769 |
|
5770 |
|
5771 |
|
5772 |
|
5773 template <class T> |
|
5774 inline void RArray<T>::SortSigned() |
|
5775 /** |
|
5776 Sorts the objects within the array; the sort order is assumed to be in signed |
|
5777 integer order. |
|
5778 */ |
|
5779 {HeapSortSigned();} |
|
5780 |
|
5781 |
|
5782 |
|
5783 |
|
5784 template <class T> |
|
5785 inline void RArray<T>::SortUnsigned() |
|
5786 /** |
|
5787 Sorts the objects within the array; the sort order is assumed to be in unsigned |
|
5788 integer order. |
|
5789 */ |
|
5790 {HeapSortUnsigned();} |
|
5791 |
|
5792 |
|
5793 |
|
5794 |
|
5795 template <class T> |
|
5796 inline void RArray<T>::Sort(TLinearOrder<T> anOrder) |
|
5797 /** |
|
5798 Sorts the objects within the array using the specified TLinearOrder. |
|
5799 |
|
5800 The sort order is determined by an algorithm supplied by the caller and |
|
5801 packaged as a TLinerOrder<T>. |
|
5802 |
|
5803 @param anOrder A package encapsulating the function which determines the order |
|
5804 of two class T type objects. |
|
5805 */ |
|
5806 {HeapSort(anOrder);} |
|
5807 |
|
5808 |
|
5809 |
|
5810 |
|
5811 template <class T> |
|
5812 inline TArray<T> RArray<T>::Array() const |
|
5813 /** |
|
5814 Constructs and returns a generic array. |
|
5815 |
|
5816 @return A generic array representing this array. |
|
5817 */ |
|
5818 { return TArray<T>(GetCount,GetElementPtr,(const CBase*)this); } |
|
5819 #endif |
|
5820 |
|
5821 |
|
5822 |
|
5823 |
|
5824 inline RArray<TInt>::RArray() |
|
5825 : RPointerArrayBase() |
|
5826 /** |
|
5827 Constructs an array object for an array of signed integers with |
|
5828 default granularity. |
|
5829 |
|
5830 The default granularity is 8. |
|
5831 */ |
|
5832 {} |
|
5833 |
|
5834 |
|
5835 |
|
5836 |
|
5837 inline RArray<TInt>::RArray(TInt aGranularity) |
|
5838 : RPointerArrayBase(aGranularity) |
|
5839 /** |
|
5840 Constructs an array object for an array of signed integers with the specified |
|
5841 granularity. |
|
5842 |
|
5843 @param aGranularity The granularity of the array. |
|
5844 |
|
5845 @panic USER 127, if aGranularity is not positive or is greater than or |
|
5846 equal to 0x10000000. |
|
5847 */ |
|
5848 {} |
|
5849 |
|
5850 |
|
5851 |
|
5852 |
|
5853 /** |
|
5854 C++ constructor with minimum growth step and exponential growth factor. |
|
5855 |
|
5856 This constructs an array object for an array of signed integers with the |
|
5857 specified minimum growth step and exponential growth factor. |
|
5858 |
|
5859 @param aMinGrowBy The minimum growth step of the array. Must be between 1 and |
|
5860 65535 inclusive. |
|
5861 @param aFactor The factor by which the array grows, multiplied by 256. |
|
5862 For example 512 specifies a factor of 2. Must be between 257 |
|
5863 and 32767 inclusive. |
|
5864 |
|
5865 @panic USER 192, if aMinGrowBy<=0 or aMinGrowBy>65535. |
|
5866 @panic USER 193, if aFactor<=257 or aFactor>32767. |
|
5867 */ |
|
5868 inline RArray<TInt>::RArray(TInt aMinGrowBy, TInt aFactor) |
|
5869 : RPointerArrayBase(aMinGrowBy, aFactor) |
|
5870 {} |
|
5871 |
|
5872 |
|
5873 |
|
5874 |
|
5875 inline void RArray<TInt>::Close() |
|
5876 /** |
|
5877 Closes the array and frees all memory allocated to the array. |
|
5878 |
|
5879 The function must be called before this array object goes out of scope. |
|
5880 */ |
|
5881 {RPointerArrayBase::Close();} |
|
5882 |
|
5883 |
|
5884 |
|
5885 |
|
5886 inline TInt RArray<TInt>::Count() const |
|
5887 /** |
|
5888 Gets the number of signed integers in the array. |
|
5889 |
|
5890 @return The number of signed integers in the array. |
|
5891 */ |
|
5892 { return RPointerArrayBase::Count(); } |
|
5893 |
|
5894 |
|
5895 |
|
5896 |
|
5897 inline const TInt& RArray<TInt>::operator[](TInt anIndex) const |
|
5898 /** |
|
5899 Gets a reference to the signed integer located at a specified position within |
|
5900 the array. |
|
5901 |
|
5902 The compiler chooses this function if the returned reference is used in an |
|
5903 expression where the reference cannot be modified. |
|
5904 |
|
5905 @param anIndex The position of the signed integer within the array. The |
|
5906 position is relative to zero, i.e. zero implies the entry |
|
5907 at the beginning of the array. |
|
5908 |
|
5909 @return A const reference to the signed integer at position anIndex within |
|
5910 the array. |
|
5911 |
|
5912 @panic USER 130, if anIndex is negative, or is greater than the number of |
|
5913 entries currently in the array. |
|
5914 */ |
|
5915 {return (const TInt&)At(anIndex);} |
|
5916 |
|
5917 |
|
5918 |
|
5919 |
|
5920 inline TInt& RArray<TInt>::operator[](TInt anIndex) |
|
5921 /** |
|
5922 Gets a reference to the signed integer located at a specified position within |
|
5923 the array. |
|
5924 |
|
5925 The compiler chooses this function if the returned reference is used in an |
|
5926 expression where the reference can be modified. |
|
5927 |
|
5928 @param anIndex The position of the signed integer within the array. The |
|
5929 position is relative to zero, i.e. zero implies the entry |
|
5930 at the beginning of the array. |
|
5931 |
|
5932 @return A non-const reference to the signed integer at position anIndex within |
|
5933 the array. |
|
5934 |
|
5935 @panic USER 130, if anIndex is negative, or is greater than the number of |
|
5936 entries currently in the array. |
|
5937 */ |
|
5938 {return (TInt&)At(anIndex);} |
|
5939 |
|
5940 |
|
5941 |
|
5942 |
|
5943 inline TInt RArray<TInt>::Append(TInt anEntry) |
|
5944 /** |
|
5945 Appends a signed integer onto the array. |
|
5946 |
|
5947 @param anEntry The signed integer to be appended. |
|
5948 |
|
5949 @return KErrNone, if the insertion is successful, otherwise one of the system |
|
5950 wide error codes. |
|
5951 */ |
|
5952 { return RPointerArrayBase::Append((const TAny*)anEntry); } |
|
5953 |
|
5954 |
|
5955 |
|
5956 |
|
5957 inline TInt RArray<TInt>::Insert(TInt anEntry, TInt aPos) |
|
5958 /** |
|
5959 Inserts a signed integer into the array at the specified position. |
|
5960 |
|
5961 @param anEntry The signed integer to be inserted. |
|
5962 @param aPos The position within the array where the signed integer is to be |
|
5963 inserted. The position is relative to zero, i.e. zero implies |
|
5964 that an entry is inserted at the beginning of the array. |
|
5965 |
|
5966 @return KErrNone, if the insertion is successful, otherwise one of the system |
|
5967 wide error codes. |
|
5968 |
|
5969 @panic USER 131, if aPos is negative, or is greater than the number of entries |
|
5970 currently in the array. |
|
5971 */ |
|
5972 { return RPointerArrayBase::Insert((const TAny*)anEntry,aPos); } |
|
5973 |
|
5974 |
|
5975 |
|
5976 |
|
5977 inline void RArray<TInt>::Remove(TInt anIndex) |
|
5978 /** |
|
5979 Removes the signed integer at the specified position from the array. |
|
5980 |
|
5981 @param anIndex The position within the array from where the signed integer |
|
5982 is to be removed. The position is relative to zero, i.e. zero |
|
5983 implies that an entry at the beginning of the array is to be |
|
5984 removed. |
|
5985 |
|
5986 @panic USER 130, if anIndex is negative or is greater than the number of |
|
5987 entries currently in the array. |
|
5988 */ |
|
5989 {RPointerArrayBase::Remove(anIndex);} |
|
5990 |
|
5991 |
|
5992 |
|
5993 |
|
5994 inline void RArray<TInt>::Compress() |
|
5995 /** |
|
5996 Compresses the array down to a minimum. |
|
5997 |
|
5998 After a call to this function, the memory allocated to the array is just |
|
5999 sufficient for its entries. Subsequently adding a new signed integer to the |
|
6000 array always results in a re-allocation of memory. |
|
6001 */ |
|
6002 {RPointerArrayBase::Compress();} |
|
6003 |
|
6004 |
|
6005 |
|
6006 |
|
6007 inline void RArray<TInt>::Reset() |
|
6008 /** |
|
6009 Empties the array. |
|
6010 |
|
6011 The function frees all memory allocated to the array and |
|
6012 resets the internal state so that it is ready to be reused. |
|
6013 |
|
6014 This array object can be allowed to go out of scope after a call to this |
|
6015 function. |
|
6016 */ |
|
6017 {RPointerArrayBase::Reset();} |
|
6018 |
|
6019 |
|
6020 |
|
6021 |
|
6022 inline TInt RArray<TInt>::Find(TInt anEntry) const |
|
6023 /** |
|
6024 Finds the first signed integer in the array which matches the specified signed |
|
6025 integer using a sequential search. |
|
6026 |
|
6027 The find operation always starts at the low index end of the array. There |
|
6028 is no assumption about the order of entries in the array. |
|
6029 |
|
6030 @param anEntry The signed integer to be found. |
|
6031 |
|
6032 @return The index of the first matching signed integer within the array. |
|
6033 KErrNotFound, if no matching entry can be found. |
|
6034 */ |
|
6035 { return RPointerArrayBase::Find((const TAny*)anEntry); } |
|
6036 |
|
6037 |
|
6038 |
|
6039 |
|
6040 inline TInt RArray<TInt>::FindReverse(TInt anEntry) const |
|
6041 /** |
|
6042 Finds the last signed integer in the array which matches the specified signed |
|
6043 integer using a sequential search. |
|
6044 |
|
6045 The find operation always starts at the high index end of the array. There |
|
6046 is no assumption about the order of entries in the array. |
|
6047 |
|
6048 @param anEntry The signed integer to be found. |
|
6049 |
|
6050 @return The index of the last matching signed integer within the array. |
|
6051 KErrNotFound, if no matching entry can be found. |
|
6052 */ |
|
6053 { return RPointerArrayBase::FindReverse((const TAny*)anEntry); } |
|
6054 |
|
6055 |
|
6056 |
|
6057 |
|
6058 inline TInt RArray<TInt>::FindInOrder(TInt anEntry) const |
|
6059 /** |
|
6060 Finds the signed integer in the array that matches the specified signed integer |
|
6061 using a binary search technique. |
|
6062 |
|
6063 The function assumes that the array is in signed integer order. |
|
6064 |
|
6065 @param anEntry The signed integer to find. |
|
6066 |
|
6067 @return The index of the matching signed integer within the array or KErrNotFound, |
|
6068 if no match can be found. |
|
6069 */ |
|
6070 { return RPointerArrayBase::FindIsqSigned(anEntry); } |
|
6071 |
|
6072 |
|
6073 |
|
6074 |
|
6075 inline TInt RArray<TInt>::FindInOrder(TInt anEntry, TInt& anIndex) const |
|
6076 /** |
|
6077 Finds the signed integer in the array that matches the specified signed integer |
|
6078 using a binary search technique. |
|
6079 |
|
6080 The function assumes that the array is in signed integer order. |
|
6081 |
|
6082 @param anEntry The signed integer to find. |
|
6083 @param anIndex A TInt suplied by the caller. On return contains an index value. |
|
6084 If the function returns KErrNone, this is the index of the |
|
6085 matching signed integer within the array. |
|
6086 If the function returns KErrNotFound, this is the index of the |
|
6087 first signed integer within the array that is bigger than the |
|
6088 signed integer being searched for - if no signed integers within |
|
6089 the array are bigger, then the index value is the same as the |
|
6090 total number of signed integers within the array. |
|
6091 |
|
6092 @return KErrNone if a matching signed integer is found. |
|
6093 KErrNotFound if no match can be found. |
|
6094 */ |
|
6095 { return RPointerArrayBase::BinarySearchSigned(anEntry,anIndex); } |
|
6096 |
|
6097 |
|
6098 |
|
6099 |
|
6100 inline TInt RArray<TInt>::SpecificFindInOrder(TInt anEntry, TInt aMode) const |
|
6101 /** |
|
6102 Finds the signed integer in the array that matches the specified signed integer |
|
6103 using a binary search technique. |
|
6104 |
|
6105 Where there is more than one matching element, it finds the first, last or any |
|
6106 matching element as specified by the value of aMode. |
|
6107 |
|
6108 The function assumes that the array is in signed integer order. |
|
6109 |
|
6110 @param anEntry The signed integer to be found. |
|
6111 @param aMode Specifies whether to find the first match, the last match or any |
|
6112 match, as defined by one of the TArrayFindMode enum values. |
|
6113 |
|
6114 @return KErrNotFound, if there is no matching element, otherwise the array |
|
6115 index of a matching element - what the index refers to depends on the |
|
6116 value of aMode: |
|
6117 if this is EArrayFindMode_First, then the index refers to the first matching element; |
|
6118 if this is EArrayFindMode_Any, then the index can refer to any of the matching elements; |
|
6119 if this is EArrayFindMode_Last, then the index refers to first element that follows |
|
6120 the last matching element - if the last matching element is also the last element |
|
6121 of the array, then the index value is the same as the total number of elements in |
|
6122 the array. |
|
6123 |
|
6124 @see TArrayFindMode |
|
6125 */ |
|
6126 { return RPointerArrayBase::FindIsqSigned(anEntry,aMode); } |
|
6127 |
|
6128 |
|
6129 |
|
6130 |
|
6131 inline TInt RArray<TInt>::SpecificFindInOrder(TInt anEntry, TInt& anIndex, TInt aMode) const |
|
6132 /** |
|
6133 Finds the signed integer in the array that matches the specified signed integer |
|
6134 using a binary search technique. |
|
6135 |
|
6136 Where there is more than one matching element, it finds the first, last or any |
|
6137 matching element as specified by the value of aMode. |
|
6138 |
|
6139 The function assumes that the array is in signed integer order. |
|
6140 |
|
6141 @param anEntry The signed integer to be found. |
|
6142 @param anIndex A TInt type supplied by the caller. On return, it contains an index |
|
6143 value depending on whether a match is found and on the value of aMode. |
|
6144 If there is no matching element in the array, then this is the index of |
|
6145 the first element in the array that is bigger than the element being |
|
6146 searched for - if no elements in the array are bigger, then the index |
|
6147 value is the same as the total number of elements in the array. |
|
6148 If there is a matching element, then what the index refers to depends |
|
6149 on the value of aMode: |
|
6150 if this is EArrayFindMode_First, then the index refers to the first matching element; |
|
6151 if this is EArrayFindMode_Any, then the index can refer to any of the matching elements; |
|
6152 if this is EArrayFindMode_Last, then the index refers to first element that follows |
|
6153 the last matching element - if the last matching element is also the last element |
|
6154 of the array, then the index value is the same as the total number of elements in the array. |
|
6155 |
|
6156 @param aMode Specifies whether to find the first match, the last match or any match, |
|
6157 as defined by one of the TArrayFindMode enum values. |
|
6158 |
|
6159 @return KErrNone, if a matching element is found; |
|
6160 KErrNotFound, if no suitable element can be found. |
|
6161 |
|
6162 @see TArrayFindMode |
|
6163 */ |
|
6164 { return RPointerArrayBase::BinarySearchSigned(anEntry,anIndex,aMode); } |
|
6165 |
|
6166 |
|
6167 |
|
6168 |
|
6169 inline TInt RArray<TInt>::InsertInOrder(TInt anEntry) |
|
6170 /** |
|
6171 Inserts a signed integer into the array in signed integer order. |
|
6172 |
|
6173 No duplicate entries are permitted. The array remains unchanged following |
|
6174 an attempt to insert a duplicate entry. |
|
6175 |
|
6176 The function assumes that existing entries within the array are in signed |
|
6177 integer order. |
|
6178 |
|
6179 @param anEntry The signed integer to be inserted |
|
6180 |
|
6181 @return KErrNone, if the insertion is successful; |
|
6182 KErrAlreadyExists, if an attempt is being made |
|
6183 to insert a duplicate entry; otherwise one of the other system wide |
|
6184 error codes. |
|
6185 */ |
|
6186 { return RPointerArrayBase::InsertIsqSigned(anEntry,EFalse); } |
|
6187 |
|
6188 |
|
6189 |
|
6190 |
|
6191 inline TInt RArray<TInt>::InsertInOrderAllowRepeats(TInt anEntry) |
|
6192 /** |
|
6193 Inserts a signed integer into the array in signed integer order, |
|
6194 allowing duplicates. |
|
6195 |
|
6196 If anEntry is a duplicate of an existing entry in the array, then the new |
|
6197 signed integer is inserted after the existing one. If more than one duplicate |
|
6198 entry already exists in the array, then any new duplicate signed integer is |
|
6199 inserted after the last one. |
|
6200 |
|
6201 The function assumes that existing entries within the array are in signed |
|
6202 integer order. |
|
6203 |
|
6204 @param anEntry The signed integer to be inserted. |
|
6205 |
|
6206 @return KErrNone, if the insertion is successful, otherwise one of the system |
|
6207 wide error codes. |
|
6208 */ |
|
6209 { return RPointerArrayBase::InsertIsqSigned(anEntry,ETrue); } |
|
6210 |
|
6211 |
|
6212 |
|
6213 |
|
6214 #ifndef __KERNEL_MODE__ |
|
6215 inline RArray<TInt>::RArray(TInt* aEntries, TInt aCount) |
|
6216 : RPointerArrayBase((TAny**)aEntries, aCount) |
|
6217 /** |
|
6218 C++ constructor with a pointer to the first array entry in a |
|
6219 pre-existing array, and the number of entries in that array. |
|
6220 |
|
6221 This constructor takes a pointer to a pre-existing set of entries of type |
|
6222 TInt objects. Ownership of the set of entries does not transfer to |
|
6223 this RArray object. |
|
6224 |
|
6225 The purpose of constructing an array in this way is to allow sorting and |
|
6226 finding operations to be done without further allocation of memory. |
|
6227 |
|
6228 @param aEntries A pointer to the first entry of type class TInt in the set of |
|
6229 entries belonging to the existing array. |
|
6230 @param aCount The number of entries in the existing array. |
|
6231 */ |
|
6232 {} |
|
6233 |
|
6234 inline void RArray<TInt>::GranularCompress() |
|
6235 /** |
|
6236 Compresses the array down to a granular boundary. |
|
6237 |
|
6238 After a call to this function, the memory allocated to the array is sufficient |
|
6239 for its contained entries. Adding new signed integers to the array does not |
|
6240 result in a re-allocation of memory until the total number of entries reaches |
|
6241 a multiple of the granularity. |
|
6242 */ |
|
6243 {RPointerArrayBase::GranularCompress();} |
|
6244 |
|
6245 |
|
6246 |
|
6247 |
|
6248 inline TInt RArray<TInt>::Reserve(TInt aCount) |
|
6249 /** |
|
6250 Reserves space for the specified number of elements. |
|
6251 |
|
6252 After a call to this function, the memory allocated to the array is sufficient |
|
6253 to hold the number of integers specified. Adding new integers to the array |
|
6254 does not result in a re-allocation of memory until the the total number of |
|
6255 integers exceeds the specified count. |
|
6256 |
|
6257 @param aCount The number of integers for which space should be reserved |
|
6258 @return KErrNone If the operation completed successfully |
|
6259 @return KErrNoMemory If the requested amount of memory could not be allocated |
|
6260 */ |
|
6261 { return RPointerArrayBase::DoReserve(aCount); } |
|
6262 |
|
6263 |
|
6264 |
|
6265 |
|
6266 inline void RArray<TInt>::Sort() |
|
6267 /** |
|
6268 Sorts the array entries into signed integer order. |
|
6269 */ |
|
6270 { HeapSortSigned(); } |
|
6271 |
|
6272 |
|
6273 |
|
6274 |
|
6275 inline TArray<TInt> RArray<TInt>::Array() const |
|
6276 /** |
|
6277 Constructs and returns a generic array. |
|
6278 |
|
6279 @return A generic array representing this array. |
|
6280 |
|
6281 @see TArray |
|
6282 */ |
|
6283 { return TArray<TInt>(GetCount,GetElementPtr,(const CBase*)this); } |
|
6284 #endif |
|
6285 |
|
6286 |
|
6287 |
|
6288 inline RArray<TUint>::RArray() |
|
6289 : RPointerArrayBase() |
|
6290 /** |
|
6291 Default C++ constructor. |
|
6292 |
|
6293 This constructs an array object for an array of unsigned |
|
6294 integers with default granularity. |
|
6295 |
|
6296 The default granularity of the array is 8. |
|
6297 */ |
|
6298 {} |
|
6299 |
|
6300 |
|
6301 |
|
6302 |
|
6303 inline RArray<TUint>::RArray(TInt aGranularity) |
|
6304 : RPointerArrayBase(aGranularity) |
|
6305 /** |
|
6306 Constructs an array object for an array of unsigned integers with the specified |
|
6307 granularity. |
|
6308 |
|
6309 @param aGranularity The granularity of the array. |
|
6310 |
|
6311 @panic USER 127, if aGranularity is not positive or is greater than or |
|
6312 equal to 0x10000000. |
|
6313 */ |
|
6314 {} |
|
6315 |
|
6316 |
|
6317 |
|
6318 |
|
6319 /** |
|
6320 C++ constructor with minimum growth step and exponential growth factor. |
|
6321 |
|
6322 This constructs an array object for an array of unsigned integers with the |
|
6323 specified minimum growth step and exponential growth factor. |
|
6324 |
|
6325 @param aMinGrowBy The minimum growth step of the array. Must be between 1 and |
|
6326 65535 inclusive. |
|
6327 @param aFactor The factor by which the array grows, multiplied by 256. |
|
6328 For example 512 specifies a factor of 2. Must be between 257 |
|
6329 and 32767 inclusive. |
|
6330 |
|
6331 @panic USER 192, if aMinGrowBy<=0 or aMinGrowBy>65535. |
|
6332 @panic USER 193, if aFactor<=257 or aFactor>32767. |
|
6333 */ |
|
6334 inline RArray<TUint>::RArray(TInt aMinGrowBy, TInt aFactor) |
|
6335 : RPointerArrayBase(aMinGrowBy, aFactor) |
|
6336 {} |
|
6337 |
|
6338 |
|
6339 |
|
6340 |
|
6341 inline void RArray<TUint>::Close() |
|
6342 /** |
|
6343 Closes the array and frees all memory allocated to the array. |
|
6344 |
|
6345 The function must be called before this array object goes out of scope. |
|
6346 */ |
|
6347 {RPointerArrayBase::Close();} |
|
6348 |
|
6349 |
|
6350 |
|
6351 |
|
6352 inline TInt RArray<TUint>::Count() const |
|
6353 /** |
|
6354 Gets the number of unsigned integers in the array. |
|
6355 |
|
6356 @return The number of unsigned integers in the array. |
|
6357 */ |
|
6358 {return RPointerArrayBase::Count(); } |
|
6359 |
|
6360 |
|
6361 |
|
6362 |
|
6363 inline const TUint& RArray<TUint>::operator[](TInt anIndex) const |
|
6364 /** |
|
6365 Gets a reference to the unsigned integer located at the specified position |
|
6366 within the array. |
|
6367 |
|
6368 The compiler uses this variant if the returned reference is used in an |
|
6369 expression where the reference cannot be modified. |
|
6370 |
|
6371 @param anIndex The position of the unsigned integer within the array, relative |
|
6372 to zero, i.e. zero implies the entry at the beginning of |
|
6373 the array. |
|
6374 |
|
6375 @return A reference to the const unsigned integer at position anIndex within |
|
6376 the array. |
|
6377 |
|
6378 @panic USER 130, if anIndex is negative, or is greater than the number of |
|
6379 entries currently in the array. |
|
6380 */ |
|
6381 {return (const TUint&)At(anIndex);} |
|
6382 |
|
6383 |
|
6384 |
|
6385 |
|
6386 inline TUint& RArray<TUint>::operator[](TInt anIndex) |
|
6387 /** |
|
6388 Gets a reference to the unsigned integer located at the specified position |
|
6389 within the array. |
|
6390 |
|
6391 The compiler uses this variant if the returned reference is used in an |
|
6392 expression where the reference can be modified. |
|
6393 |
|
6394 @param anIndex The position of the unsigned integer within the array, relative |
|
6395 to zero, i.e. zero implies the entry at the beginning of |
|
6396 the array. |
|
6397 |
|
6398 @return A reference to the non-const unsigned integer at position anIndex |
|
6399 within the array. |
|
6400 |
|
6401 @panic USER 130, if anIndex is negative, or is greater than the number of |
|
6402 entries currently in the array. |
|
6403 */ |
|
6404 {return (TUint&)At(anIndex);} |
|
6405 |
|
6406 |
|
6407 |
|
6408 |
|
6409 inline TInt RArray<TUint>::Append(TUint anEntry) |
|
6410 /** |
|
6411 Appends an unsigned integer onto the array. |
|
6412 |
|
6413 @param anEntry The unsigned integer to be appended. |
|
6414 @return KErrNone, if the insertion is successful, otherwise one of the system |
|
6415 wide error codes. |
|
6416 */ |
|
6417 { return RPointerArrayBase::Append((const TAny*)anEntry); } |
|
6418 |
|
6419 |
|
6420 |
|
6421 |
|
6422 inline TInt RArray<TUint>::Insert(TUint anEntry, TInt aPos) |
|
6423 /** |
|
6424 Inserts an unsigned integer into the array at the specified position. |
|
6425 |
|
6426 @param anEntry The unsigned integer to be inserted. |
|
6427 @param aPos The position within the array where the unsigned integer is to |
|
6428 be inserted. The position is relative to zero, i.e. zero |
|
6429 implies that an entry is inserted at the beginning of |
|
6430 the array. |
|
6431 |
|
6432 @return KErrNone, if the insertion is successful, otherwise one of the system |
|
6433 wide error codes. |
|
6434 |
|
6435 @panic USER 131, if aPos is negative, or is greater than the number of entries |
|
6436 currently in the array. |
|
6437 */ |
|
6438 { return RPointerArrayBase::Insert((const TAny*)anEntry,aPos); } |
|
6439 |
|
6440 |
|
6441 |
|
6442 |
|
6443 inline void RArray<TUint>::Remove(TInt anIndex) |
|
6444 /** |
|
6445 Removes the unsigned integer at the specified position from the array. |
|
6446 |
|
6447 @param anIndex The position within the array from where the unsigned integer |
|
6448 is to be removed. The position is relative to zero, i.e. zero |
|
6449 implies that an entry at the beginning of the array is to be |
|
6450 removed. |
|
6451 |
|
6452 |
|
6453 @panic USER 130, if anIndex is negative, or is greater than the number of |
|
6454 entries currently in the array. |
|
6455 */ |
|
6456 {RPointerArrayBase::Remove(anIndex);} |
|
6457 |
|
6458 |
|
6459 |
|
6460 |
|
6461 inline void RArray<TUint>::Compress() |
|
6462 /** |
|
6463 Compresses the array down to a minimum. |
|
6464 |
|
6465 After a call to this function, the memory allocated to the array is just |
|
6466 sufficient for its entries. Subsequently adding a new unsigned integer to the |
|
6467 array always results in a re-allocation of memory. |
|
6468 */ |
|
6469 {RPointerArrayBase::Compress();} |
|
6470 |
|
6471 |
|
6472 |
|
6473 |
|
6474 inline void RArray<TUint>::Reset() |
|
6475 /** |
|
6476 Empties the array. |
|
6477 |
|
6478 It frees all memory allocated to the array and resets the |
|
6479 internal state so that it is ready to be reused. |
|
6480 |
|
6481 This array object can be allowed to go out of scope after a call to |
|
6482 this function. |
|
6483 */ |
|
6484 {RPointerArrayBase::Reset();} |
|
6485 |
|
6486 |
|
6487 |
|
6488 |
|
6489 inline TInt RArray<TUint>::Find(TUint anEntry) const |
|
6490 /** |
|
6491 Finds the first unsigned integer in the array which matches the specified |
|
6492 value, using a sequential search. |
|
6493 |
|
6494 The find operation always starts at the low index end of the array. There |
|
6495 is no assumption about the order of entries in the array. |
|
6496 |
|
6497 @param anEntry The unsigned integer to be found. |
|
6498 |
|
6499 @return The index of the first matching unsigned integer within the array. |
|
6500 KErrNotFound, if no matching entry can be found. |
|
6501 */ |
|
6502 { return RPointerArrayBase::Find((const TAny*)anEntry); } |
|
6503 |
|
6504 |
|
6505 |
|
6506 |
|
6507 inline TInt RArray<TUint>::FindReverse(TUint anEntry) const |
|
6508 /** |
|
6509 Finds the last unsigned integer in the array which matches the specified |
|
6510 value, using a sequential search. |
|
6511 |
|
6512 The find operation always starts at the high index end of the array. There |
|
6513 is no assumption about the order of entries in the array. |
|
6514 |
|
6515 @param anEntry The unsigned integer to be found. |
|
6516 |
|
6517 @return The index of the last matching unsigned integer within the array. |
|
6518 KErrNotFound, if no matching entry can be found. |
|
6519 */ |
|
6520 { return RPointerArrayBase::FindReverse((const TAny*)anEntry); } |
|
6521 |
|
6522 |
|
6523 |
|
6524 |
|
6525 inline TInt RArray<TUint>::FindInOrder(TUint anEntry) const |
|
6526 /** |
|
6527 Finds the unsigned integer in the array which matches the specified value, |
|
6528 using a binary search technique. |
|
6529 |
|
6530 The functions assume that existing entries within the array are in unsigned |
|
6531 integer order. |
|
6532 |
|
6533 @param anEntry The unsigned integer to be found. |
|
6534 |
|
6535 @return This is either: the index of the matching unsigned integer within the |
|
6536 array; |
|
6537 KErrNotFound, if no suitable entry can be found. |
|
6538 */ |
|
6539 { return RPointerArrayBase::FindIsqUnsigned(anEntry); } |
|
6540 |
|
6541 |
|
6542 |
|
6543 |
|
6544 inline TInt RArray<TUint>::FindInOrder(TUint anEntry, TInt& anIndex) const |
|
6545 /** |
|
6546 Finds the unsigned integer in the array which matches the specified value, |
|
6547 using a binary search technique. |
|
6548 |
|
6549 If the index cannot be found, the function returns the index of the last |
|
6550 unsigned integer within the array which logically precedes anEntry. |
|
6551 |
|
6552 The functions assume that existing entries within the array are in unsigned |
|
6553 integer order. |
|
6554 |
|
6555 @param anEntry The unsigned integer to be found. |
|
6556 @param anIndex A TInt supplied by the caller. On return, contains an index |
|
6557 value. |
|
6558 If the function returns KErrNone, this is the index of the |
|
6559 matching unsigned integer within the array. |
|
6560 If the function returns KErrNotFound, this is the index of the |
|
6561 first unsigned integer within the array that is bigger than the |
|
6562 unsigned integer being searched for - if no unsigned integers within |
|
6563 the array are bigger, then the index value is the same as the |
|
6564 total number of unsigned integers within the array. |
|
6565 @return KErrNone, if a matching unsigned integer is found. |
|
6566 KErrNotFound, if no suitable entry can be found. |
|
6567 */ |
|
6568 { return RPointerArrayBase::BinarySearchUnsigned(anEntry,anIndex); } |
|
6569 |
|
6570 |
|
6571 |
|
6572 |
|
6573 inline TInt RArray<TUint>::SpecificFindInOrder(TUint anEntry, TInt aMode) const |
|
6574 /** |
|
6575 Finds the unsigned integer in the array that matches the specified unsigned integer |
|
6576 using a binary search technique. |
|
6577 |
|
6578 In the case that there is more than one matching element, finds the first, last |
|
6579 or any match as specified by the value of aMode. |
|
6580 |
|
6581 The function assumes that the array is in unsigned integer order. |
|
6582 |
|
6583 @param anEntry The unsigned integer to be found.. |
|
6584 @param aMode Specifies whether to find the first match, the last match or any match, |
|
6585 as defined by one of the TArrayFindMode enum values. |
|
6586 |
|
6587 @return KErrNotFound, if there is no matching element, otherwise the array index of |
|
6588 a matching element - what the index refers to depends on the value of |
|
6589 aMode: |
|
6590 if this is EArrayFindMode_First, then the index refers to the first matching element; |
|
6591 if this is EArrayFindMode_Any, then the index can refer to any of the matching elements; |
|
6592 if this is EArrayFindMode_Last, then the index refers to first element that follows |
|
6593 the last matching element - if the last matching element is also the last element of |
|
6594 the array, then the index value is the same as the total number of elements in the array. |
|
6595 |
|
6596 @see TArrayFindMode |
|
6597 */ |
|
6598 { return RPointerArrayBase::FindIsqUnsigned(anEntry,aMode); } |
|
6599 |
|
6600 |
|
6601 |
|
6602 |
|
6603 inline TInt RArray<TUint>::SpecificFindInOrder(TUint anEntry, TInt& anIndex, TInt aMode) const |
|
6604 /** |
|
6605 Finds the unsigned integer in the array that matches the specified unsigned integer |
|
6606 using a binary search technique. |
|
6607 |
|
6608 In the case that there is more than one matching element, finds the first, last or any match as specified. |
|
6609 |
|
6610 The function assumes that the array is in unsigned integer order. |
|
6611 |
|
6612 @param anEntry The unsigned integer to be found. |
|
6613 @param anIndex A TInt type supplied by the caller. On return, it contains an index |
|
6614 value depending on whether a match is found and on the value of aMode. |
|
6615 If there is no matching element in the array, then this is the index |
|
6616 of the first element in the array that is bigger than the element being |
|
6617 searched for - if no elements in the array are bigger, then the index |
|
6618 value is the same as the total number of elements in the array. |
|
6619 If there is a matching element, then what the index refers to depends |
|
6620 on the value of aMode: |
|
6621 if this is EArrayFindMode_First, then the index refers to the first matching element; |
|
6622 if this is EArrayFindMode_Any, then the index can refer to any of the matching elements; |
|
6623 if this is EArrayFindMode_Last, then the index refers to first element that follows |
|
6624 the last matching element - if the last matching element is also the last element of the array, |
|
6625 then the index value is the same as the total number of elements in the array. |
|
6626 @param aMode Specifies whether to find the first match, the last match or any match, as defined by one |
|
6627 of the TArrayFindMode enum values. |
|
6628 |
|
6629 @return KErrNone, if a matching entry is found; KErrNotFound, if no matching entry exists. |
|
6630 |
|
6631 @see TArrayFindMode |
|
6632 */ |
|
6633 { return RPointerArrayBase::BinarySearchUnsigned(anEntry,anIndex,aMode); } |
|
6634 |
|
6635 |
|
6636 |
|
6637 |
|
6638 inline TInt RArray<TUint>::InsertInOrder(TUint anEntry) |
|
6639 /** |
|
6640 Inserts an unsigned integer into the array in unsigned integer order. |
|
6641 |
|
6642 No duplicate entries are permitted. The array remains unchanged following |
|
6643 an attempt to insert a duplicate entry. |
|
6644 |
|
6645 The function assumes that existing entries within the array are in unsigned |
|
6646 integer order. |
|
6647 |
|
6648 @param anEntry The unsigned integer to be inserted. |
|
6649 |
|
6650 @return KErrNone, if the insertion is successful; |
|
6651 KErrAlreadyExists, if an attempt is being made |
|
6652 to insert a duplicate entry; otherwise one of the other system wide |
|
6653 error codes. |
|
6654 */ |
|
6655 { return RPointerArrayBase::InsertIsqUnsigned(anEntry,EFalse); } |
|
6656 |
|
6657 |
|
6658 |
|
6659 |
|
6660 inline TInt RArray<TUint>::InsertInOrderAllowRepeats(TUint anEntry) |
|
6661 /** |
|
6662 Inserts an unsigned integer into the array in unsigned integer order, allowing |
|
6663 duplicates. |
|
6664 |
|
6665 If the new integer is a duplicate of an existing entry in the array, then |
|
6666 the new unsigned integer is inserted after the existing one. If more than |
|
6667 one duplicate entry already exists in the array, then any new duplicate |
|
6668 unsigned integer is inserted after the last one. |
|
6669 |
|
6670 The function assumes that existing entries within the array are in unsigned |
|
6671 integer order. |
|
6672 |
|
6673 @param anEntry The unsigned integer to be inserted. |
|
6674 |
|
6675 @return KErrNone, if the insertion is successful, otherwise one of the system |
|
6676 wide error codes. |
|
6677 */ |
|
6678 { return RPointerArrayBase::InsertIsqUnsigned(anEntry,ETrue); } |
|
6679 |
|
6680 |
|
6681 |
|
6682 |
|
6683 #ifndef __KERNEL_MODE__ |
|
6684 inline RArray<TUint>::RArray(TUint* aEntries, TInt aCount) |
|
6685 : RPointerArrayBase((TAny**)aEntries, aCount) |
|
6686 /** |
|
6687 C++ constructor with a pointer to the first array entry in a |
|
6688 pre-existing array, and the number of entries in that array. |
|
6689 |
|
6690 This constructor takes a pointer to a pre-existing set of entries of type |
|
6691 TUint objects. Ownership of the set of entries does not transfer to |
|
6692 this RArray object. |
|
6693 |
|
6694 The purpose of constructing an array in this way is to allow sorting and |
|
6695 finding operations to be done without further allocation of memory. |
|
6696 |
|
6697 @param aEntries A pointer to the first entry of type class TUint in the set of |
|
6698 entries belonging to the existing array. |
|
6699 @param aCount The number of entries in the existing array. |
|
6700 */ |
|
6701 {} |
|
6702 |
|
6703 |
|
6704 |
|
6705 inline void RArray<TUint>::GranularCompress() |
|
6706 /** |
|
6707 Compresses the array down to a granular boundary. |
|
6708 |
|
6709 After a call to this function, the memory allocated to the array is sufficient |
|
6710 for its contained entries. Adding new unsigned integers to the array does not |
|
6711 result in a re-allocation of memory until the total number of entries reaches |
|
6712 a multiple of the granularity. |
|
6713 */ |
|
6714 {RPointerArrayBase::GranularCompress();} |
|
6715 |
|
6716 |
|
6717 |
|
6718 |
|
6719 inline TInt RArray<TUint>::Reserve(TInt aCount) |
|
6720 /** |
|
6721 Reserves space for the specified number of elements. |
|
6722 |
|
6723 After a call to this function, the memory allocated to the array is sufficient |
|
6724 to hold the number of integers specified. Adding new integers to the array |
|
6725 does not result in a re-allocation of memory until the the total number of |
|
6726 integers exceeds the specified count. |
|
6727 |
|
6728 @param aCount The number of integers for which space should be reserved |
|
6729 @return KErrNone If the operation completed successfully |
|
6730 @return KErrNoMemory If the requested amount of memory could not be allocated |
|
6731 */ |
|
6732 { return RPointerArrayBase::DoReserve(aCount); } |
|
6733 |
|
6734 |
|
6735 |
|
6736 |
|
6737 inline void RArray<TUint>::Sort() |
|
6738 /** |
|
6739 Sorts the array entries into unsigned integer order. |
|
6740 */ |
|
6741 { HeapSortUnsigned(); } |
|
6742 |
|
6743 |
|
6744 |
|
6745 |
|
6746 inline TArray<TUint> RArray<TUint>::Array() const |
|
6747 /** |
|
6748 Constructs and returns a generic array. |
|
6749 |
|
6750 @return A generic array representing this array. |
|
6751 |
|
6752 @see TArray |
|
6753 */ |
|
6754 { return TArray<TUint>(GetCount,GetElementPtr,(const CBase*)this); } |
|
6755 #endif |
|
6756 |
|
6757 |
|
6758 |
|
6759 |
|
6760 /** |
|
6761 Sets an argument to default value and type. |
|
6762 */ |
|
6763 inline void TIpcArgs::Set(TInt,TNothing) |
|
6764 {} |
|
6765 |
|
6766 |
|
6767 |
|
6768 |
|
6769 /** |
|
6770 Sets an argument value of TInt type. |
|
6771 |
|
6772 @param aIndex An index value that identifies the slot in the array of arguments |
|
6773 into which the argument value is to be placed. |
|
6774 This must be a value in the range 0 to 3. |
|
6775 @param aValue The argument value. |
|
6776 */ |
|
6777 inline void TIpcArgs::Set(TInt aIndex,TInt aValue) |
|
6778 { |
|
6779 iArgs[aIndex] = aValue; |
|
6780 iFlags |= EUnspecified<<(aIndex*KBitsPerType); |
|
6781 } |
|
6782 |
|
6783 |
|
6784 |
|
6785 |
|
6786 /** |
|
6787 Sets an argument value of TAny* type. |
|
6788 |
|
6789 @param aIndex An index value that identifies the slot in the array of arguments |
|
6790 into which the argument value is to be placed. |
|
6791 This must be a value in the range 0 to 3. |
|
6792 @param aValue The argument value. |
|
6793 */ |
|
6794 inline void TIpcArgs::Set(TInt aIndex,const TAny* aValue) |
|
6795 { |
|
6796 iArgs[aIndex] = (TInt)aValue; |
|
6797 iFlags |= EUnspecified<<(aIndex*KBitsPerType); |
|
6798 } |
|
6799 |
|
6800 |
|
6801 |
|
6802 |
|
6803 /** |
|
6804 Sets an argument value of RHandleBase type. |
|
6805 |
|
6806 @param aIndex An index value that identifies the slot in the array of arguments |
|
6807 into which the argument value is to be placed. |
|
6808 This must be a value in the range 0 to 3. |
|
6809 @param aValue The argument value. |
|
6810 */ |
|
6811 inline void TIpcArgs::Set(TInt aIndex,RHandleBase aValue) |
|
6812 { |
|
6813 iArgs[aIndex] = (TInt)aValue.Handle(); |
|
6814 iFlags |= EHandle<<(aIndex*KBitsPerType); |
|
6815 } |
|
6816 |
|
6817 |
|
6818 |
|
6819 |
|
6820 /** |
|
6821 Sets an argument value TDesC8* type. |
|
6822 |
|
6823 @param aIndex An index value that identifies the slot in the array of arguments |
|
6824 into which the argument value is to be placed. |
|
6825 This must be a value in the range 0 to 3. |
|
6826 @param aValue The argument value. |
|
6827 */ |
|
6828 inline void TIpcArgs::Set(TInt aIndex,const TDesC8* aValue) |
|
6829 { |
|
6830 iArgs[aIndex] = (TInt)aValue; |
|
6831 iFlags |= EDesC8<<(aIndex*KBitsPerType); |
|
6832 } |
|
6833 |
|
6834 |
|
6835 |
|
6836 |
|
6837 #ifndef __KERNEL_MODE__ |
|
6838 |
|
6839 /** |
|
6840 Sets an argument value of TDesC16* type. |
|
6841 |
|
6842 @param aIndex An index value that identifies the slot in the array of arguments |
|
6843 into which the argument value is to be placed. |
|
6844 This must be a value in the range 0 to 3. |
|
6845 @param aValue The argument value. |
|
6846 */ |
|
6847 inline void TIpcArgs::Set(TInt aIndex,const TDesC16* aValue) |
|
6848 { |
|
6849 iArgs[aIndex] = (TInt)aValue; |
|
6850 iFlags |= EDesC16<<(aIndex*KBitsPerType); |
|
6851 } |
|
6852 |
|
6853 #endif |
|
6854 |
|
6855 |
|
6856 |
|
6857 |
|
6858 /** |
|
6859 Sets an argument value of TDes8* type. |
|
6860 |
|
6861 @param aIndex An index value that identifies the slot in the array of arguments |
|
6862 into which the argument value is to be placed. |
|
6863 This must be a value in the range 0 to 3. |
|
6864 @param aValue The argument value. |
|
6865 */ |
|
6866 inline void TIpcArgs::Set(TInt aIndex,TDes8* aValue) |
|
6867 { |
|
6868 iArgs[aIndex] = (TInt)aValue; |
|
6869 iFlags |= EDes8<<(aIndex*KBitsPerType); |
|
6870 } |
|
6871 |
|
6872 |
|
6873 |
|
6874 |
|
6875 #ifndef __KERNEL_MODE__ |
|
6876 |
|
6877 /** |
|
6878 Sets an argument value of TDes16* type. |
|
6879 |
|
6880 @param aIndex An index value that identifies the slot in the array of arguments |
|
6881 into which the argument value is to be placed. |
|
6882 This must be a value in the range 0 to 3. |
|
6883 @param aValue The argument value. |
|
6884 */ |
|
6885 inline void TIpcArgs::Set(TInt aIndex,TDes16* aValue) |
|
6886 { |
|
6887 iArgs[aIndex] = (TInt)aValue; |
|
6888 iFlags |= EDes16<<(aIndex*KBitsPerType); |
|
6889 } |
|
6890 |
|
6891 #endif |
|
6892 |
|
6893 |
|
6894 |
|
6895 |
|
6896 inline TIpcArgs::TArgType TIpcArgs::Type(TNothing) |
|
6897 { return EUnspecified; } |
|
6898 inline TIpcArgs::TArgType TIpcArgs::Type(TInt) |
|
6899 { return EUnspecified; } |
|
6900 inline TIpcArgs::TArgType TIpcArgs::Type(const TAny*) |
|
6901 { return EUnspecified; } |
|
6902 inline TIpcArgs::TArgType TIpcArgs::Type(RHandleBase) |
|
6903 { return EHandle; } |
|
6904 inline TIpcArgs::TArgType TIpcArgs::Type(const TDesC8*) |
|
6905 { return EDesC8; } |
|
6906 #ifndef __KERNEL_MODE__ |
|
6907 inline TIpcArgs::TArgType TIpcArgs::Type(const TDesC16*) |
|
6908 { return EDesC16; } |
|
6909 #endif |
|
6910 inline TIpcArgs::TArgType TIpcArgs::Type(TDes8*) |
|
6911 { return EDes8; } |
|
6912 #ifndef __KERNEL_MODE__ |
|
6913 inline TIpcArgs::TArgType TIpcArgs::Type(TDes16*) |
|
6914 { return EDes16; } |
|
6915 #endif |
|
6916 inline void TIpcArgs::Assign(TInt&,TIpcArgs::TNothing) |
|
6917 {} |
|
6918 inline void TIpcArgs::Assign(TInt& aArg,TInt aValue) |
|
6919 { aArg = aValue; } |
|
6920 inline void TIpcArgs::Assign(TInt& aArg,const TAny* aValue) |
|
6921 { aArg = (TInt)aValue; } |
|
6922 inline void TIpcArgs::Assign(TInt& aArg,RHandleBase aValue) |
|
6923 { aArg = (TInt)aValue.Handle(); } |
|
6924 inline void TIpcArgs::Assign(TInt& aArg,const TDesC8* aValue) |
|
6925 { aArg = (TInt)aValue; } |
|
6926 #ifndef __KERNEL_MODE__ |
|
6927 inline void TIpcArgs::Assign(TInt& aArg,const TDesC16* aValue) |
|
6928 { aArg = (TInt)aValue; } |
|
6929 #endif |
|
6930 inline void TIpcArgs::Assign(TInt& aArg,TDes8* aValue) |
|
6931 { aArg = (TInt)aValue; } |
|
6932 #ifndef __KERNEL_MODE__ |
|
6933 inline void TIpcArgs::Assign(TInt& aArg,TDes16* aValue) |
|
6934 { aArg = (TInt)aValue; } |
|
6935 #endif |
|
6936 |
|
6937 |
|
6938 |
|
6939 // Structures for passing 64 bit integers and doubles across GCC/EABI boundaries |
|
6940 |
|
6941 inline SInt64::SInt64() |
|
6942 {} |
|
6943 |
|
6944 inline SInt64::SInt64(Int64 a) |
|
6945 { |
|
6946 iData[0] = (TUint32)((Uint64)a); |
|
6947 iData[1] = (TUint32)(((Uint64)a)>>32); |
|
6948 } |
|
6949 |
|
6950 inline SInt64& SInt64::operator=(Int64 a) |
|
6951 { |
|
6952 iData[0] = (TUint32)((Uint64)a); |
|
6953 iData[1] = (TUint32)(((Uint64)a)>>32); |
|
6954 return *this; |
|
6955 } |
|
6956 |
|
6957 inline SInt64::operator Int64() const |
|
6958 { |
|
6959 Int64 x; |
|
6960 TUint32* px = (TUint32*)&x; |
|
6961 px[0] = iData[0]; |
|
6962 px[1] = iData[1]; |
|
6963 return x; |
|
6964 } |
|
6965 |
|
6966 inline SUint64::SUint64() |
|
6967 {} |
|
6968 |
|
6969 inline SUint64::SUint64(Uint64 a) |
|
6970 { |
|
6971 iData[0] = (TUint32)a; |
|
6972 iData[1] = (TUint32)(a>>32); |
|
6973 } |
|
6974 |
|
6975 inline SUint64& SUint64::operator=(Uint64 a) |
|
6976 { |
|
6977 iData[0] = (TUint32)a; |
|
6978 iData[1] = (TUint32)(a>>32); |
|
6979 return *this; |
|
6980 } |
|
6981 |
|
6982 inline SUint64::operator Uint64() const |
|
6983 { |
|
6984 Uint64 x; |
|
6985 TUint32* px = (TUint32*)&x; |
|
6986 px[0] = iData[0]; |
|
6987 px[1] = iData[1]; |
|
6988 return x; |
|
6989 } |
|
6990 |
|
6991 inline SDouble::SDouble() |
|
6992 {} |
|
6993 |
|
6994 inline SDouble::SDouble(TReal a) |
|
6995 { |
|
6996 const TUint32* pa = (const TUint32*)&a; |
|
6997 #ifdef __DOUBLE_WORDS_SWAPPED__ |
|
6998 iData[0] = pa[1]; |
|
6999 iData[1] = pa[0]; // compiler puts MS word of double first |
|
7000 #else |
|
7001 iData[0] = pa[0]; |
|
7002 iData[1] = pa[1]; // compiler puts MS word of double second |
|
7003 #endif |
|
7004 } |
|
7005 |
|
7006 inline SDouble& SDouble::operator=(TReal a) |
|
7007 { |
|
7008 new (this) SDouble(a); |
|
7009 return *this; |
|
7010 } |
|
7011 |
|
7012 inline SDouble::operator TReal() const |
|
7013 { |
|
7014 TReal x; |
|
7015 TUint32* px = (TUint32*)&x; |
|
7016 #ifdef __DOUBLE_WORDS_SWAPPED__ |
|
7017 px[1] = iData[0]; |
|
7018 px[0] = iData[1]; // compiler puts MS word of double first |
|
7019 #else |
|
7020 px[0] = iData[0]; |
|
7021 px[1] = iData[1]; // compiler puts MS word of double second |
|
7022 #endif |
|
7023 return x; |
|
7024 } |
|
7025 |
|
7026 // |
|
7027 // TSecureId |
|
7028 // |
|
7029 |
|
7030 /** Default constructor. This leaves the object in an undefined state */ |
|
7031 inline TSecureId::TSecureId() |
|
7032 {} |
|
7033 |
|
7034 /** Construct 'this' using a TUint32 |
|
7035 @param aId The value for the ID */ |
|
7036 inline TSecureId::TSecureId(TUint32 aId) |
|
7037 : iId(aId) {} |
|
7038 |
|
7039 /** Convert 'this' into a TUint32 |
|
7040 */ |
|
7041 inline TSecureId::operator TUint32() const |
|
7042 { return iId; } |
|
7043 |
|
7044 /** Construct 'this' using a TUid |
|
7045 @param aId The value for the ID */ |
|
7046 inline TSecureId::TSecureId(TUid aId) |
|
7047 : iId(aId.iUid) {} |
|
7048 |
|
7049 /** Convert 'this' into a TUid |
|
7050 */ |
|
7051 inline TSecureId::operator TUid() const |
|
7052 { return (TUid&)iId; } |
|
7053 |
|
7054 // |
|
7055 // SSecureId |
|
7056 // |
|
7057 inline const TSecureId* SSecureId::operator&() const |
|
7058 { return (const TSecureId*)this; } |
|
7059 inline SSecureId::operator const TSecureId&() const |
|
7060 { return (const TSecureId&)iId; } |
|
7061 inline SSecureId::operator TUint32() const |
|
7062 { return iId; } |
|
7063 inline SSecureId::operator TUid() const |
|
7064 { return (TUid&)iId; } |
|
7065 |
|
7066 // |
|
7067 // TVendorId |
|
7068 // |
|
7069 |
|
7070 /** Default constructor which leaves the object in an undefined state */ |
|
7071 inline TVendorId::TVendorId() |
|
7072 {} |
|
7073 |
|
7074 /** Construct 'this' using a TUint32 |
|
7075 @param aId The value for the ID */ |
|
7076 inline TVendorId::TVendorId(TUint32 aId) |
|
7077 : iId(aId) {} |
|
7078 |
|
7079 /** Convert 'this' into a TUint32 |
|
7080 */ |
|
7081 inline TVendorId::operator TUint32() const |
|
7082 { return iId; } |
|
7083 |
|
7084 /** Construct 'this' using a TUid |
|
7085 @param aId The value for the ID */ |
|
7086 inline TVendorId::TVendorId(TUid aId) |
|
7087 : iId(aId.iUid) {} |
|
7088 |
|
7089 /** Convert 'this' into a TUid |
|
7090 */ |
|
7091 inline TVendorId::operator TUid() const |
|
7092 { return (TUid&)iId; } |
|
7093 |
|
7094 // |
|
7095 // SSecureId |
|
7096 // |
|
7097 inline const TVendorId* SVendorId::operator&() const |
|
7098 { return (const TVendorId*)this; } |
|
7099 inline SVendorId::operator const TVendorId&() const |
|
7100 { return (const TVendorId&)iId; } |
|
7101 inline SVendorId::operator TUint32() const |
|
7102 { return iId; } |
|
7103 inline SVendorId::operator TUid() const |
|
7104 { return (TUid&)iId; } |
|
7105 |
|
7106 // |
|
7107 // TSharedChunkBufConfigBase |
|
7108 // |
|
7109 inline TSharedChunkBufConfigBase::TSharedChunkBufConfigBase() |
|
7110 {memset(this,0,sizeof(TSharedChunkBufConfigBase));} |
|
7111 |
|
7112 /** |
|
7113 Default constructor. This leaves the set in an undefned state. |
|
7114 */ |
|
7115 inline TCapabilitySet::TCapabilitySet() |
|
7116 {} |
|
7117 |
|
7118 /** |
|
7119 Construct a set consisting of a single capability. |
|
7120 @param aCapability The single capability |
|
7121 */ |
|
7122 inline TCapabilitySet::TCapabilitySet(TCapability aCapability) |
|
7123 { new (this) TCapabilitySet(aCapability, aCapability); } |
|
7124 |
|
7125 /** |
|
7126 Make this set consist of a single capability. |
|
7127 @param aCapability The single capability. |
|
7128 */ |
|
7129 inline void TCapabilitySet::Set(TCapability aCapability) |
|
7130 { new (this) TCapabilitySet(aCapability, aCapability); } |
|
7131 |
|
7132 /** |
|
7133 Make this set consist of two capabilities. |
|
7134 @param aCapability1 The first capability. |
|
7135 @param aCapability2 The second capability. |
|
7136 */ |
|
7137 inline void TCapabilitySet::Set(TCapability aCapability1, TCapability aCapability2) |
|
7138 { new (this) TCapabilitySet(aCapability1, aCapability2); } |
|
7139 |
|
7140 |
|
7141 /** |
|
7142 Default constructor. This leaves the object in an undefned state. |
|
7143 */ |
|
7144 inline TSecurityInfo::TSecurityInfo() |
|
7145 {} |
|
7146 |
|
7147 /** Constructs a TSecurityPolicy that will always fail, irrespective of the |
|
7148 checked object's attributes. |
|
7149 */ |
|
7150 inline TSecurityPolicy::TSecurityPolicy() |
|
7151 { new (this) TSecurityPolicy(EAlwaysFail); } |
|
7152 |
|
7153 /** |
|
7154 'Address of' operator which generates a TSecurityPolicy* |
|
7155 @return A pointer of type TSecurityPolicy which refers to this object |
|
7156 */ |
|
7157 inline const TSecurityPolicy* TStaticSecurityPolicy::operator&() const |
|
7158 { return (const TSecurityPolicy*)this; } |
|
7159 |
|
7160 /** |
|
7161 'Reference of' operator which generates a TSecurityPolicy& |
|
7162 @return A reference of type TSecurityPolicy which refers to this object |
|
7163 */ |
|
7164 inline TStaticSecurityPolicy::operator const TSecurityPolicy&() const |
|
7165 { return *(const TSecurityPolicy*)this; } |
|
7166 |
|
7167 /** |
|
7168 A method to explicity generate a TSecurityPolicy reference. |
|
7169 @return A reference of type TSecurityPolicy which refers to this object |
|
7170 */ |
|
7171 inline const TSecurityPolicy& TStaticSecurityPolicy::operator()() const |
|
7172 { return *(const TSecurityPolicy*)this; } |
|
7173 |
|
7174 #ifdef __KERNEL_MODE__ |
|
7175 #ifndef __REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__ |
|
7176 |
|
7177 /** Checks this policy against the platform security attributes of aProcess. |
|
7178 |
|
7179 When a check fails the action taken is determined by the system wide Platform Security |
|
7180 configuration. If PlatSecDiagnostics is ON, then a diagnostic message is emitted. |
|
7181 If PlatSecEnforcement is OFF, then this function will return ETrue even though the |
|
7182 check failed. |
|
7183 |
|
7184 @param aProcess The DProcess object to check against this TSecurityPolicy. |
|
7185 @param aDiagnostic A string that will be emitted along with any diagnostic message |
|
7186 that may be issued if the policy check fails. |
|
7187 This string must be enclosed in the __PLATSEC_DIAGNOSTIC_STRING macro |
|
7188 which enables it to be easily removed from the system. |
|
7189 @return ETrue if all the requirements of this TSecurityPolicy are met by the |
|
7190 platform security attributes of aProcess, EFalse otherwise. |
|
7191 @panic KERN-COMMON 190 if 'this' is an invalid SSecurityInfo object |
|
7192 */ |
|
7193 inline TBool TSecurityPolicy::CheckPolicy(DProcess* aProcess, const char* aDiagnostic) const |
|
7194 { |
|
7195 return DoCheckPolicy(aProcess, aDiagnostic); |
|
7196 } |
|
7197 |
|
7198 /** Checks this policy against the platform security attributes of the process |
|
7199 owning aThread. |
|
7200 |
|
7201 When a check fails the action taken is determined by the system wide Platform Security |
|
7202 configuration. If PlatSecDiagnostics is ON, then a diagnostic message is emitted. |
|
7203 If PlatSecEnforcement is OFF, then this function will return ETrue even though the |
|
7204 check failed. |
|
7205 |
|
7206 @param aThread The thread whose owning process' platform security attributes |
|
7207 are to be checked against this TSecurityPolicy. |
|
7208 @param aDiagnostic A string that will be emitted along with any diagnostic message |
|
7209 that may be issued if the policy check fails. |
|
7210 This string must be enclosed in the __PLATSEC_DIAGNOSTIC_STRING macro |
|
7211 which enables it to be easily removed from the system. |
|
7212 @return ETrue if all the requirements of this TSecurityPolicy are met by the |
|
7213 platform security parameters of the owning process of aThread, EFalse otherwise. |
|
7214 @panic KERN-COMMON 190 if 'this' is an invalid SSecurityInfo object |
|
7215 */ |
|
7216 inline TBool TSecurityPolicy::CheckPolicy(DThread* aThread, const char* aDiagnostic) const |
|
7217 { |
|
7218 return DoCheckPolicy(aThread, aDiagnostic); |
|
7219 } |
|
7220 |
|
7221 #else //__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__ |
|
7222 |
|
7223 /** Checks this policy against the platform security attributes of aProcess. |
|
7224 |
|
7225 When a check fails the action taken is determined by the system wide Platform Security |
|
7226 configuration. If PlatSecDiagnostics is ON, then a diagnostic message is emitted. |
|
7227 If PlatSecEnforcement is OFF, then this function will return ETrue even though the |
|
7228 check failed. |
|
7229 |
|
7230 @param aProcess The DProcess object to check against this TSecurityPolicy. |
|
7231 @param aDiagnostic A string that will be emitted along with any diagnostic message |
|
7232 that may be issued if the policy check fails. |
|
7233 This string must be enclosed in the __PLATSEC_DIAGNOSTIC_STRING macro |
|
7234 which enables it to be easily removed from the system. |
|
7235 @return ETrue if all the requirements of this TSecurityPolicy are met by the |
|
7236 platform security attributes of aProcess, EFalse otherwise. |
|
7237 @panic KERN-COMMON 190 if 'this' is an invalid SSecurityInfo object |
|
7238 */ |
|
7239 inline TBool TSecurityPolicy::CheckPolicy(DProcess* aProcess, OnlyCreateWithNull /*aDiagnostic*/) const |
|
7240 { |
|
7241 return DoCheckPolicy(aProcess); |
|
7242 } |
|
7243 |
|
7244 /** Checks this policy against the platform security attributes of the process |
|
7245 owning aThread. |
|
7246 |
|
7247 When a check fails the action taken is determined by the system wide Platform Security |
|
7248 configuration. If PlatSecDiagnostics is ON, then a diagnostic message is emitted. |
|
7249 If PlatSecEnforcement is OFF, then this function will return ETrue even though the |
|
7250 check failed. |
|
7251 |
|
7252 @param aThread The thread whose owning process' platform security attributes |
|
7253 are to be checked against this TSecurityPolicy. |
|
7254 @param aDiagnostic A string that will be emitted along with any diagnostic message |
|
7255 that may be issued if the policy check fails. |
|
7256 This string must be enclosed in the __PLATSEC_DIAGNOSTIC_STRING macro |
|
7257 which enables it to be easily removed from the system. |
|
7258 @return ETrue if all the requirements of this TSecurityPolicy are met by the |
|
7259 platform security parameters of the owning process of aThread, EFalse otherwise. |
|
7260 @panic KERN-COMMON 190 if 'this' is an invalid SSecurityInfo object |
|
7261 */ |
|
7262 inline TBool TSecurityPolicy::CheckPolicy(DThread* aThread, OnlyCreateWithNull /*aDiagnostic*/) const |
|
7263 { |
|
7264 return DoCheckPolicy(aThread); |
|
7265 } |
|
7266 |
|
7267 #endif // !__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__ |
|
7268 #endif // __KERNEL_MODE__ |