Update contrib.
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 "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // e32\include\e32cmn.inl
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
24 // Global placement operator delete
25 inline void operator delete(TAny* /*aPtr*/, TAny* /*aBase*/) __NO_THROW
27 #endif //__PLACEMENT_NEW_INLINE
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
35 // Global placement operator delete[]
36 inline void operator delete[](TAny* /*aPtr*/, TAny* /*aBase*/) __NO_THROW
38 #endif //__PLACEMENT_VEC_NEW_INLINE
42 inline RAllocator::RAllocator()
51 inline void RAllocator::__DbgMarkCheck(TBool aCountAll, TInt aCount, const TUint8* aFileName, TInt aLineNum)
52 {__DbgMarkCheck(aCountAll, aCount, TPtrC8(aFileName), aLineNum);}
59 @return The maximum length to which the heap can grow.
64 inline TInt RHeap::MaxLength() const
67 inline void RHeap::operator delete(TAny*, TAny*)
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.
75 inline TUint8* RHeap::Base() const
77 Gets a pointer to the start of the heap.
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.
82 @return A pointer to the base of the heap.
89 inline TInt RHeap::Size() const
91 Gets the current size of the heap.
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:
97 Size = (Rounded committed size - Size of RHeap - Cell Alignment Overhead).
99 The cell alignment overhead varies between release builds and debug builds.
101 Note that this value is always greater than the total space available across all allocated cells.
103 @return The size of the heap.
105 @see Rheap::Available( )
112 inline TInt RHeap::Align(TInt a) const
116 {return _ALIGN_UP(a, iAlign);}
121 inline const TAny* RHeap::Align(const TAny* a) const
125 {return (const TAny*)_ALIGN_UP((TLinAddr)a, iAlign);}
130 inline TBool RHeap::IsLastCell(const SCell* aCell) const
134 {return (((TUint8*)aCell) + aCell->len) == iTop;}
139 #ifndef __KERNEL_MODE__
140 inline void RHeap::Lock() const
144 {((RFastLock&)iLock).Wait();}
149 inline void RHeap::Unlock() const
153 {((RFastLock&)iLock).Signal();}
156 inline TInt RHeap::ChunkHandle() const
170 inline TRefByValue<T>::TRefByValue(T &aRef)
173 Constructs this value reference for the specified referenced object.
175 @param aRef The referenced object.
183 inline TRefByValue<T>::operator T &()
185 Gets a reference to the object encapsulated inside this value reference.
193 Creates the logical channel.
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
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
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
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.
225 @return KErrNone, if successful; otherwise one of the other system wide
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) ); }
235 inline TChar::TChar()
239 Constructs this character object with an undefined value.
246 inline TChar::TChar(TUint aChar)
249 Constructs this character object and initialises it with the specified value.
251 @param aChar The initialisation value.
258 inline TChar& TChar::operator-=(TUint aChar)
260 Subtracts an unsigned integer value from this character object.
262 This character object is changed by the operation.
264 @param aChar The value to be subtracted.
266 @return A reference to this character object.
268 {iChar-=aChar;return(*this);}
273 inline TChar& TChar::operator+=(TUint aChar)
275 Adds an unsigned integer value to this character object.
277 This character object is changed by the operation.
279 @param aChar The value to be added.
281 @return A reference to this character object.
283 {iChar+=aChar;return(*this);}
288 inline TChar TChar::operator-(TUint aChar)
290 Gets the result of subtracting an unsigned integer value from this character
293 This character object is not changed.
295 @param aChar The value to be subtracted.
297 @return A character object whose value is the result of the subtraction
300 {return(iChar-aChar);}
305 inline TChar TChar::operator+(TUint aChar)
307 Gets the result of adding an unsigned integer value to this character object.
309 This character object is not changed.
311 @param aChar The value to be added.
313 @return A character object whose value is the result of the addition operation.
315 {return(iChar+aChar);}
320 inline TChar::operator TUint() const
322 Gets the value of the character as an unsigned integer.
324 The operator casts a TChar to a TUint, returning the TUint value wrapped by
325 this character object.
333 inline TBool TDesC8::operator<(const TDesC8 &aDes) const
335 Determines whether this descriptor's data is less than the specified
338 The comparison is implemented using the Compare() member function.
340 @param aDes The 8-bit non-modifable descriptor whose data is to be compared
341 with this descriptor's data.
343 @return True if greater than or equal, false otherwise.
347 {return(Compare(aDes)<0);}
352 inline TBool TDesC8::operator<=(const TDesC8 &aDes) const
354 Determines whether this descriptor's data is less than or equal to the
355 specified descriptor's data.
357 The comparison is implemented using the Compare() member function.
359 @param aDes The 8-bit non-modifable descriptor whose data is to be compared
360 with this descriptor's data.
362 @return True if less than or equal, false otherwise.
366 {return(Compare(aDes)<=0);}
371 inline TBool TDesC8::operator>(const TDesC8 &aDes) const
373 Determines whether this descriptor's data is greater than the specified
376 The comparison is implemented using the Compare() member function.
378 @param aDes The 8-bit non-modifable descriptor whose data is to be compared
379 with this descriptor's data.
381 @return True if greater than, false otherwise.
385 {return(Compare(aDes)>0);}
390 inline TBool TDesC8::operator>=(const TDesC8 &aDes) const
392 Determines whether this descriptor's data is greater than or equal to the
393 specified descriptor's data.
395 The comparison is implemented using the Compare() member function.
397 @param aDes The 8-bit non-modifable descriptor whose data is to be compared
398 with this descriptor's data.
400 @return True if greater than, false otherwise.
404 {return(Compare(aDes)>=0);}
409 inline TBool TDesC8::operator==(const TDesC8 &aDes) const
411 Determines whether this descriptor's data is equal to the specified
414 The comparison is implemented using the Compare() member function.
416 @param aDes The 8-bit non-modifable descriptor whose data is to be compared
417 with this descriptor's data.
419 @return True if equal, false otherwise.
423 {return(Compare(aDes)==0);}
428 inline TBool TDesC8::operator!=(const TDesC8 &aDes) const
430 Determines whether this descriptor's data is not equal to the specified
433 The comparison is implemented using the Compare() member function.
435 @param aDes The 8-bit non-modifable descriptor whose data is to be compared
436 with this descriptor's data.
438 @return True if not equal, false otherwise.
442 {return(Compare(aDes)!=0);}
447 inline const TUint8 &TDesC8::operator[](TInt anIndex) const
449 Gets a reference to a single data item within this descriptor's data.
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.
455 @return A reference to the data item.
457 @panic USER 21, if anIndex is negative or greater than or equal to the current
458 length of the descriptor.
460 {return(AtC(anIndex));}
465 inline TInt TDesC8::Length() const
467 Gets the length of the data.
469 This is the number of 8-bit values or data items represented by the descriptor.
471 @return The length of the data represented by the descriptor.
473 {return(iLength&KMaskDesLength8);}
478 inline TInt TDesC8::Size() const
480 Gets the size of the data.
482 This is the number of bytes occupied by the data represented by the descriptor.
484 @return The size of the data represented by the descriptor.
491 inline void TDesC8::DoSetLength(TInt aLength)
492 {iLength=(iLength&(~KMaskDesLength8))|aLength;}
498 inline void TPtrC8::Set(const TUint8 *aBuf,TInt aLength)
500 Sets the 8-bit non-modifiable pointer descriptor to point to the specified
501 location in memory, whether in RAM or ROM.
503 The length of the descriptor is set to the specified length.
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.
508 @panic USER 29, if aLength is negative.
510 {new(this) TPtrC8(aBuf,aLength);}
515 inline void TPtrC8::Set(const TDesC8 &aDes)
517 Sets the 8-bit non-modifiable pointer descriptor from the specified descriptor.
519 It is set to point to the same data and is given the same length.
521 @param aDes A reference to an 8-bit non-modifiable descriptor.
523 {new(this) TPtrC8(aDes);}
528 inline void TPtrC8::Set(const TPtrC8& aPtr)
530 Sets the 8-bit non-modifiable pointer descriptor from the specified
531 non-modifiable pointer descriptor.
533 It is set to point to the same data and is given the same length.
535 @param aPtr A reference to an 8-bit non-modifiable pointer descriptor.
537 {new(this) TPtrC8(aPtr);}
544 inline TPtr8 TBufCBase8::DoDes(TInt aMaxLength)
545 {return TPtr8(*this,aMaxLength);}
550 // Template class TBufC8
552 inline TBufC8<S>::TBufC8()
555 Constructs an empty 8-bit non-modifiable buffer descriptor.
559 The integer template parameter determines the size of the data area which
560 is created as part of the buffer descriptor object.
562 Data can, subsequently, be assigned into this buffer descriptor using the
563 assignment operators.
565 @see TBufC8::operator=
573 inline TBufC8<S>::TBufC8(const TUint8 *aString)
574 : TBufCBase8(aString,S)
576 Constructs the 8-bit non-modifiable buffer descriptor from a zero terminated
579 The integer template parameter determines the size of the data area which
580 is created as part of this object.
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.
586 @param aString A pointer to a zero terminated string.
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.
597 inline TBufC8<S>::TBufC8(const TDesC8 &aDes)
600 Constructs the 8-bit non-modifiable buffer descriptor from any
603 The integer template parameter determines the size of the data area which
604 is created as part of this object.
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
610 @param aDes The source 8-bit non-modifiable descriptor.
612 @panic USER 20, if the length of the source descriptor is
613 greater than the value of the integer template parameter.
621 inline TBufC8<S> &TBufC8<S>::operator=(const TUint8 *aString)
623 Copies data into this descriptor, replacing any existing data.
625 The length of this descriptor is set to reflect the new data.
627 @param aString A pointer to a zero-terminated string.
629 @return A reference to this descriptor.
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.
634 {Copy(aString,S);return(*this);}
640 inline TBufC8<S> &TBufC8<S>::operator=(const TDesC8 &aDes)
642 Copies data into this descriptor, replacing any existing data.
644 The length of this descriptor is set to reflect the new data.
646 @param aDes An 8-bit non-modifiable descriptor.
648 @return A reference to this descriptor.
650 @panic USER 23, if the length of the descriptor aDes is
651 greater than the maximum length of this (target) descriptor.
653 {Copy(aDes,S);return(*this);}
659 inline TPtr8 TBufC8<S>::Des()
661 Creates and returns an 8-bit modifiable pointer descriptor for the data
662 represented by this 8-bit non-modifiable buffer descriptor.
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.
668 The modifiable pointer descriptor is set to point to this non-modifiable buffer
671 The length of the modifiable pointer descriptor is set to the length of this
672 non-modifiable buffer descriptor.
674 The maximum length of the modifiable pointer descriptor is set to the value
675 of the integer template parameter.
677 When data is modified through this new pointer descriptor, the lengths of
678 both it and this constant buffer descriptor are changed.
680 @return An 8-bit modifiable pointer descriptor representing the data in this
681 8-bit non-modifiable buffer descriptor.
688 #ifndef __KERNEL_MODE__
690 inline HBufC8 &HBufC8::operator=(const HBufC8 &aLcb)
692 Copies data into this 8-bit heap descriptor replacing any existing data.
694 The length of this descriptor is set to reflect the new data.
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
701 @param aLcb The source 8-bit heap descriptor.
703 @return A reference to this 8-bit heap descriptor.
705 @panic USER 23, if the length of the descriptor aLcb is greater than the
706 maximum length of this (target) descriptor
708 {return *this=static_cast<const TDesC8&>(aLcb);}
714 inline RBuf8& RBuf8::operator=(const TUint8* aString)
716 Copies data into this descriptor replacing any existing data.
718 The length of this descriptor is set to reflect the new data.
720 @param aString A pointer to a zero-terminated string.
722 @return A reference to this, the target descriptor.
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.
727 {Copy(aString);return(*this);}
732 inline RBuf8& RBuf8::operator=(const TDesC8& aDes)
734 Copies data into this descriptor replacing any existing data.
736 The length of this descriptor is set to reflect the new data.
738 @param aDes An 8-bit non-modifiable descriptor.
740 @return A reference to this, the target descriptor.
742 @panic USER 11, if the length of the descriptor aDes is greater than the
743 maximum length of this (target) descriptor.
745 {Copy(aDes);return(*this);}
750 inline RBuf8& RBuf8::operator=(const RBuf8& aDes)
752 Copies data into this descriptor replacing any existing data.
754 The length of this descriptor is set to reflect the new data.
756 @param aDes A 8-bit buffer descriptor.
758 @return A reference to this, the target descriptor.
760 @panic USER 11, if the length of the descriptor aDes is greater than the
761 maximum length of this (target) descriptor.
763 {Copy(aDes);return(*this);}
769 Creates an 8-bit resizable buffer descriptor that has been initialised with
770 data from the specified read stream; leaves on failure.
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
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.
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.
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.
791 inline void RBuf8::CreateL(RReadStream &aStream,TInt aMaxLength)
793 Assign(HBufC8::NewL(aStream,aMaxLength));
801 inline TDes8 &TDes8::operator=(const TUint8 *aString)
803 Copies data into this descriptor replacing any existing data.
805 The length of this descriptor is set to reflect the new data.
807 @param aString A pointer to a zero-terminated string.
809 @return A reference to this, the target descriptor.
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.
814 {Copy(aString);return(*this);}
819 inline TDes8 &TDes8::operator=(const TDesC8 &aDes)
821 Copies data into this descriptor replacing any existing data.
823 The length of this descriptor is set to reflect the new data.
825 @param aDes An 8-bit non-modifiable descriptor.
827 @return A reference to this, the target descriptor.
829 @panic USER 23, if the length of the descriptor aDes is greater than the
830 maximum length of this (target) descriptor.
832 {Copy(aDes);return(*this);}
837 inline TDes8 &TDes8::operator=(const TDes8 &aDes)
839 Copies data into this descriptor replacing any existing data.
841 The length of this descriptor is set to reflect the new data.
843 @param aDes An 8-bit modifiable descriptor.
845 @return A reference to this, the target descriptor.
847 @panic USER 23, if the length of the descriptor aDes is greater than the
848 maximum length of this (target) descriptor.
850 {Copy(aDes);return(*this);}
855 inline TDes8 &TDes8::operator+=(const TDesC8 &aDes)
857 Appends data onto the end of this descriptor's data and returns a reference
860 The length of this descriptor is incremented to reflect the new content.
862 @param aDes An-8 bit non-modifiable descriptor whose data is to be appended.
864 @return A reference to this descriptor.
866 @panic USER 23, if the resulting length of this descriptor is greater than its
869 {Append(aDes);return(*this);}
874 inline const TUint8 &TDes8::operator[](TInt anIndex) const
876 Gets a const reference to a single data item within this descriptor's data.
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
882 @return A const reference to the data item at the specified position.
884 @panic USER 21, if anIndex is negative or is greater than or equal to the
885 current length of this descriptor.
887 {return(AtC(anIndex));}
892 inline TUint8 &TDes8::operator[](TInt anIndex)
894 Gets a non-const reference to a single data item within this descriptor's
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
901 @return A non-const reference to the data item at the specified position.
903 @panic USER 21, if anIndex is negative or is greater than or equal to the
904 current length of this descriptor.
906 {return((TUint8 &)AtC(anIndex));}
911 inline TInt TDes8::MaxLength() const
913 Gets the maximum length of the descriptor.
915 This is the upper limit for the number of 8-bit values or data items that
916 the descriptor can represent.
918 @return The maximum length of data that the descriptor can represent.
920 {return(iMaxLength);}
925 inline TInt TDes8::MaxSize() const
927 Gets the maximum size of the descriptor.
929 This is the upper limit for the number of bytes which the data represented by
930 the descriptor can occupy.
932 @return The maximum size of the descriptor data.
934 {return(iMaxLength);}
939 inline TUint8 * TDes8::WPtr() const
940 {return((TUint8 *)Ptr());}
946 inline TPtr8 &TPtr8::operator=(const TUint8 *aString)
948 Copies data into this 8-bit modifiable pointer descriptor replacing any
951 The length of this descriptor is set to reflect the new data.
953 @param aString A pointer to a zero-terminated string.
955 @return A reference to this 8-bit modifiable pointer descriptor.
957 @panic USER 23, if the length of the string, excluding the zero terminator, is
958 greater than the maximum length of this descriptor.
960 {Copy(aString);return(*this);}
965 inline TPtr8 &TPtr8::operator=(const TDesC8 &aDes)
967 Copies data into this 8-bit modifiable pointer descriptor replacing any
970 The length of this descriptor is set to reflect the new data.
972 @param aDes An 8-bit modifiable pointer descriptor whose data is to be copied
973 into this descriptor.
975 @return A reference to this 8-bit modifiable pointer descriptor.
977 @panic USER 23, if the length of aDes is greater than the maximum
978 length of this descriptor.
980 {Copy(aDes);return(*this);}
985 inline TPtr8 &TPtr8::operator=(const TPtr8 &aDes)
987 Copies data into this 8-bit modifiable pointer descriptor replacing any
990 The length of this descriptor is set to reflect the new data.
992 @param aDes An 8-bit modifiable pointer descriptor whose data is to be copied
993 into this descriptor.
995 @return A reference to this 8-bit modifiable pointer descriptor.
997 @panic USER 23, if the length of aDes is greater than the maximum
998 length of this descriptor.
1000 {Copy(aDes);return(*this);}
1005 inline void TPtr8::Set(TUint8 *aBuf,TInt aLength,TInt aMaxLength)
1007 Sets the 8-bit modifiable pointer descriptor to point to the specified location
1008 in memory, whether in RAM or ROM.
1010 The length of the descriptor and its maximum length are set to the specified
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.
1017 @panic USER 20, if aLength is negative or is greater than the maximum length of
1019 @panic USER 30, if aMaxLength is negative.
1021 {new(this) TPtr8(aBuf,aLength,aMaxLength);}
1026 inline void TPtr8::Set(const TPtr8 &aPtr)
1028 Sets the 8-bit modifiable pointer descriptor from an existing 8-bit modifiable
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.
1034 @param aPtr The source 8-bit modifiable pointer descriptor.
1036 {new(this) TPtr8(aPtr);}
1041 // Template class TBuf8
1043 inline TBuf8<S>::TBuf8()
1046 Constructs an empty 8-bit modifiable buffer descriptor.
1048 It contains no data.
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.
1059 inline TBuf8<S>::TBuf8(TInt aLength)
1060 : TBufBase8(aLength,S)
1062 Constructs an empty 8-bit modifiable buffer descriptor and sets the its length
1063 to the specified value.
1065 No data is assigned to the descriptor.
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.
1070 @param aLength The length of this modifiable buffer descriptor.
1072 @panic USER 20, if aLength is negative or is greater than the
1073 value of the integer template parameter.
1081 inline TBuf8<S>::TBuf8(const TUint8 *aString)
1082 : TBufBase8(aString,S)
1084 Constructs the 8-bit modifiable buffer descriptor from a
1085 zero terminated string.
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.
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.
1094 @param aString A pointer to a zero terminated string.
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.
1105 inline TBuf8<S>::TBuf8(const TDesC8 &aDes)
1108 Constructs the 8-bit modifiable buffer descriptor from any existing
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.
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.
1118 @param aDes The source 8-bit non-modifiable descriptor.
1120 @panic USER 23, if the length of the source descriptor is greater than the
1121 value of the integer template parameter.
1129 inline TBuf8<S> &TBuf8<S>::operator=(const TUint8 *aString)
1131 Copies data into this 8-bit modifiable buffer descriptor, replacing any
1134 The length of this descriptor is set to reflect the new data.
1136 @param aString A pointer to a zero-terminated string.
1138 @return A reference to this 8-bit modifiable buffer descriptor.
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.
1143 {Copy(aString);return(*this);}
1149 inline TBuf8<S> &TBuf8<S>::operator=(const TDesC8 &aDes)
1151 Copies data into this 8-bit modifiable buffer descriptor, replacing any
1154 The length of this descriptor is set to reflect the new data.
1156 @param aDes An 8 bit non-modifiable descriptor.
1158 @return A reference to this 8-bit modifiable buffer descriptor.
1160 @panic USER 23, if the length of the descriptor aDes is greater than the
1161 maximum length of this (target) descriptor.
1163 {Copy(aDes);return(*this);}
1169 inline TBuf8<S>& TBuf8<S>::operator=(const TBuf8<S>& aBuf)
1171 Copies data into this 8-bit modifiable buffer descriptor replacing any
1174 The length of this descriptor is set to reflect the new data.
1176 @param aBuf The source 8-bit modifiable buffer descriptor with the same
1179 @return A reference to this 8-bit modifiable buffer descriptor.
1181 {Copy(aBuf);return *this;}
1186 // Template class TAlignedBuf8
1188 inline TAlignedBuf8<S>::TAlignedBuf8()
1191 Constructs an empty 8-bit modifiable buffer descriptor.
1193 It contains no data.
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.
1204 inline TAlignedBuf8<S>::TAlignedBuf8(TInt aLength)
1205 : TBufBase8(aLength,S)
1207 Constructs an empty 8-bit modifiable buffer descriptor and sets the its length
1208 to the specified value.
1210 No data is assigned to the descriptor.
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.
1215 @param aLength The length of this modifiable buffer descriptor.
1217 @panic USER 20, if aLength is negative or is greater than the
1218 value of the integer template parameter.
1226 inline TAlignedBuf8<S>::TAlignedBuf8(const TUint8 *aString)
1227 : TBufBase8(aString,S)
1229 Constructs the 8-bit modifiable buffer descriptor from a
1230 zero terminated string.
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.
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.
1239 @param aString A pointer to a zero terminated string.
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.
1250 inline TAlignedBuf8<S>::TAlignedBuf8(const TDesC8 &aDes)
1253 Constructs the 8-bit modifiable buffer descriptor from any existing
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.
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.
1263 @param aDes The source 8-bit non-modifiable descriptor.
1265 @panic USER 23, if the length of the source descriptor is greater than the
1266 value of the integer template parameter.
1274 inline TAlignedBuf8<S> &TAlignedBuf8<S>::operator=(const TUint8 *aString)
1276 Copies data into this 8-bit modifiable buffer descriptor, replacing any
1279 The length of this descriptor is set to reflect the new data.
1281 @param aString A pointer to a zero-terminated string.
1283 @return A reference to this 8-bit modifiable buffer descriptor.
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.
1288 {Copy(aString);return(*this);}
1294 inline TAlignedBuf8<S> &TAlignedBuf8<S>::operator=(const TDesC8 &aDes)
1296 Copies data into this 8-bit modifiable buffer descriptor, replacing any
1299 The length of this descriptor is set to reflect the new data.
1301 @param aDes An 8 bit non-modifiable descriptor.
1303 @return A reference to this 8-bit modifiable buffer descriptor.
1305 @panic USER 23, if the length of the descriptor aDes is greater than the
1306 maximum length of this (target) descriptor.
1308 {Copy(aDes);return(*this);}
1314 inline TAlignedBuf8<S>& TAlignedBuf8<S>::operator=(const TAlignedBuf8<S>& aBuf)
1316 Copies data into this 8-bit modifiable buffer descriptor replacing any
1319 The length of this descriptor is set to reflect the new data.
1321 @param aBuf The source 8-bit modifiable buffer descriptor with the same
1324 @return A reference to this 8-bit modifiable buffer descriptor.
1326 {Copy(aBuf);return *this;}
1331 // Template class TLitC8
1333 inline const TDesC8* TLitC8<S>::operator&() const
1335 Returns a const TDesC8 type pointer.
1337 @return A descriptor type pointer to this literal.
1339 {return REINTERPRET_CAST(const TDesC8*,this);}
1345 inline const TDesC8& TLitC8<S>::operator()() const
1347 Returns a const TDesC8 type reference.
1349 @return A descriptor type reference to this literal
1351 {return *operator&();}
1357 inline TLitC8<S>::operator const TDesC8&() const
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.
1362 {return *operator&();}
1367 inline TLitC8<S>::operator const __TRefDesC8() const
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.
1374 {return *operator&();}
1379 #ifndef __KERNEL_MODE__
1381 inline TBool TDesC16::operator<(const TDesC16 &aDes) const
1383 Determines whether this descriptor's data is less than the specified descriptor's
1386 The comparison is implemented using the Compare() member function.
1388 @param aDes The 16-bit non-modifable descriptor whose data is to be compared
1389 with this descriptor's data.
1391 @return True if less than, false otherwise.
1393 @see TDesC16::Compare
1395 {return(Compare(aDes)<0);}
1400 inline TBool TDesC16::operator<=(const TDesC16 &aDes) const
1402 Determines whether this descriptor's data is less than or equal
1403 to the specified descriptor's data.
1405 The comparison is implemented using the Compare() member function.
1407 @param aDes The 16-bit non- modifiable descriptor whose data is to be compared
1408 with this descriptor's data.
1410 @return True if less than or equal, false otherwise.
1412 @see TDesC16::Compare
1414 {return(Compare(aDes)<=0);}
1419 inline TBool TDesC16::operator>(const TDesC16 &aDes) const
1421 Determines whether this descriptor's data is greater than the specified
1424 The comparison is implemented using the Compare() member function.
1426 @param aDes The 16-bit non-modifiable descriptor whose data is to be compared
1427 with this descriptor's data.
1429 @return True if greater than, false otherwise.
1431 @see TDesC16::Compare
1433 {return(Compare(aDes)>0);}
1438 inline TBool TDesC16::operator>=(const TDesC16 &aDes) const
1440 Determines whether this descriptor's data is greater than or equal to the
1441 specified descriptor's data.
1443 The comparison is implemented using the Compare() member function.
1445 @param aDes The 16-bit non-modifiable descriptor whose data is to be compared
1446 with this descriptor's data.
1448 @return True if greater than or equal, false otherwise.
1450 @see TDesC16::Compare
1452 {return(Compare(aDes)>=0);}
1457 inline TBool TDesC16::operator==(const TDesC16 &aDes) const
1459 Determines whether this descriptor's data is equal to the specified
1462 The comparison is implemented using the Compare() member function.
1464 @param aDes The 16-bit non-modifiable descriptor whose data is to be compared
1465 with this descriptor's data.
1467 @return True if equal, false otherwise.
1469 @see TDesC16::Compare
1471 {return(Compare(aDes)==0);}
1476 inline TBool TDesC16::operator!=(const TDesC16 &aDes) const
1478 Determines whether this descriptor's data is not equal to the specified
1481 The comparison is implemented using the Compare() member function.
1483 @param aDes The 16-bit non-modifiable descriptor whose data is to be compared
1484 with this descriptor's data.
1486 @return True if not equal, false otherwise.
1488 @see TDesC16::Compare
1490 {return(Compare(aDes)!=0);}
1495 inline const TUint16 &TDesC16::operator[](TInt anIndex) const
1497 Gets a reference to a single data item within this descriptor's data.
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.
1503 @return A reference to the data item.
1505 @panic USER 9, if anIndex is negative or greater than or equal to the current
1506 length of the descriptor.
1508 {return(AtC(anIndex));}
1513 inline TInt TDesC16::Length() const
1515 Gets the length of the data.
1517 This is the number of 16-bit values or data items represented by the descriptor.
1519 @return The length of the data represented by the descriptor.
1521 {return(iLength&KMaskDesLength16);}
1526 inline TInt TDesC16::Size() const
1528 Gets the size of the data.
1530 This is the number of bytes occupied by the data represented by the descriptor.
1532 @return The size of the data represented by the descriptor. This is always
1535 {return(Length()<<1);}
1540 inline void TDesC16::DoSetLength(TInt aLength)
1541 {iLength=(iLength&(~KMaskDesLength16))|aLength;}
1547 inline void TPtrC16::Set(const TUint16 *aBuf,TInt aLength)
1549 Sets the 16-bit non-modifiable pointer descriptor to point to the specified
1550 location in memory, whether in RAM or ROM.
1552 The length of the descriptor is set to the specified length.
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
1557 @panic USER 17, if aLength is negative.
1559 {new(this) TPtrC16(aBuf,aLength);}
1564 inline void TPtrC16::Set(const TDesC16 &aDes)
1566 Sets the 16-bit non-modifiable pointer descriptor from the specified descriptor.
1568 It is set to point to the same data and is given the same length.
1570 @param aDes A reference to a 16-bit non-modifiable descriptor
1572 {new(this) TPtrC16(aDes);}
1577 inline void TPtrC16::Set(const TPtrC16& aPtr)
1578 {new(this) TPtrC16(aPtr);}
1583 // class TBufCBase16
1584 inline TPtr16 TBufCBase16::DoDes(TInt aMaxLength)
1585 {return TPtr16(*this,aMaxLength);}
1590 // Template class TBufC16
1592 inline TBufC16<S>::TBufC16()
1595 Constructs an empty 16-bit non-modifiable buffer descriptor.
1597 It contains no data.
1599 The integer template parameter determines the size of the data area which
1600 is created as part of the buffer descriptor object.
1602 Data can, subsequently, be assigned into this buffer descriptor using the
1603 assignment operators.
1605 @see TBufC16::operator=
1613 inline TBufC16<S>::TBufC16(const TUint16 *aString)
1614 : TBufCBase16(aString,S)
1616 Constructs the 16-bit non-modifiable buffer descriptor from a zero terminated
1619 The integer template parameter determines the size of the data area which
1620 is created as part of this object.
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.
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.
1629 @param aString A pointer to a zero terminated string.
1637 inline TBufC16<S>::TBufC16(const TDesC16 &aDes)
1638 : TBufCBase16(aDes,S)
1640 Constructs the 16-bit non-modifiable buffer descriptor from any
1641 existing descriptor.
1643 The integer template parameter determines the size of the data area which
1644 is created as part of this object.
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
1650 @param aDes The source 16-bit non-modifiable descriptor.
1652 @panic USER 8, if the length of the source descriptor is
1653 greater than the value of the integer template parameter.
1661 inline TBufC16<S> &TBufC16<S>::operator=(const TUint16 *aString)
1663 Copies data into this descriptor replacing any existing data.
1665 The length of this descriptor is set to reflect the new data.
1667 @param aString A pointer to a zero-terminated string.
1669 @return A reference to this descriptor.
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.
1674 {Copy(aString,S);return(*this);}
1680 inline TBufC16<S> &TBufC16<S>::operator=(const TDesC16 &aDes)
1682 Copies data into this descriptor, replacing any existing data.
1684 The length of this descriptor is set to reflect the new data.
1686 @param aDes A 16-bit non-modifiable descriptor.
1688 @panic USER 11, if the length of the descriptor aDes is
1689 greater than the maximum length of this (target) descriptor.
1691 @return A reference to this descriptor.
1693 {Copy(aDes,S);return(*this);}
1699 inline TPtr16 TBufC16<S>::Des()
1701 Creates and returns a 16-bit modifiable pointer descriptor for the data
1702 represented by this 16-bit non-modifiable buffer descriptor.
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.
1708 The modifiable pointer descriptor is set to point to this non-modifiable buffer
1711 The length of the modifiable pointer descriptor is set to the length of this
1712 non-modifiable buffer descriptor.
1714 The maximum length of the modifiable pointer descriptor is set to the value
1715 of the integer template parameter.
1717 When data is modified through this new pointer descriptor, the lengths of
1718 both it and this constant buffer descriptor are changed.
1720 @return A 16-bit modifiable pointer descriptor representing the data in this
1721 16-bit non-modifiable buffer descriptor.
1728 #ifndef __KERNEL_MODE__
1730 inline HBufC16 &HBufC16::operator=(const HBufC16 &aLcb)
1732 Copies data into this 16-bit heap descriptor replacing any existing data.
1734 The length of this descriptor is set to reflect the new data.
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
1741 @param aLcb The source 16-bit heap descriptor.
1743 @return A reference to this 16-bit heap descriptor.
1745 @panic USER 11, if the length of the descriptor aLcb is greater than the
1746 maximum length of this (target) descriptor
1748 {return *this=static_cast<const TDesC16&>(aLcb);}
1755 inline TDes16 &TDes16::operator=(const TUint16 *aString)
1757 Copies data into this descriptor replacing any existing data.
1759 The length of this descriptor is set to reflect the new data.
1761 @param aString A pointer to a zero-terminated string.
1763 @return A reference to this, the target descriptor.
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.
1768 {Copy(aString);return(*this);}
1773 inline TDes16 &TDes16::operator=(const TDesC16 &aDes)
1775 Copies data into this descriptor replacing any existing data.
1777 The length of this descriptor is set to reflect the new data.
1779 @param aDes A 16-bit non-modifiable descriptor.
1781 @return A reference to this, the target descriptor.
1783 @panic USER 11, if the length of the descriptor aDes is greater than the
1784 maximum length of this (target) descriptor.
1786 {Copy(aDes);return(*this);}
1791 inline TDes16 &TDes16::operator=(const TDes16 &aDes)
1793 Copies data into this descriptor replacing any existing data.
1795 The length of this descriptor is set to reflect the new data.
1797 @param aDes A 16-bit modifiable descriptor.
1799 @return A reference to this, the target descriptor.
1801 @panic USER 11, if the length of the descriptor aDes is greater than the
1802 maximum length of this (target) descriptor.
1804 {Copy(aDes);return(*this);}
1809 inline TDes16 &TDes16::operator+=(const TDesC16 &aDes)
1811 Appends data onto the end of this descriptor's data and returns a reference
1814 The length of this descriptor is incremented to reflect the new content.
1816 @param aDes A 16-bit non-modifiable descriptor whose data is to be appended.
1818 @return A reference to this descriptor.
1820 @panic USER 11, if the resulting length of this descriptor is greater than its
1823 {Append(aDes);return(*this);}
1828 inline const TUint16 &TDes16::operator[](TInt anIndex) const
1830 Gets a const reference to a single data item within this descriptor's data.
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.
1835 @return A const reference to the data item at the specified position.
1837 @panic USER 9, if anIndex is negative or is greater than or equal to the
1838 current length of this descriptor.
1840 {return(AtC(anIndex));}
1845 inline TUint16 &TDes16::operator[](TInt anIndex)
1847 Gets a non-const reference to a single data item within this descriptor's
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
1854 @return A non-const reference to the data item at the specified position.
1856 @panic USER 9, if anIndex is negative or is greater than or equal to the
1857 current length of this descriptor.
1859 {return((TUint16 &)AtC(anIndex));}
1864 inline TInt TDes16::MaxLength() const
1866 Gets the maximum length of the descriptor.
1868 This is the upper limit for the number of 16-bit values or data items that
1869 the descriptor can represent.
1871 @return The maximum length of data that the descriptor can represent.
1873 {return(iMaxLength);}
1878 inline TInt TDes16::MaxSize() const
1880 Gets the maximum size of the descriptor.
1882 This is the upper limit for the number of bytes which the data represented by
1883 the descriptor can occupy.
1885 @return The maximum size of the descriptor data.
1887 {return(iMaxLength<<1);}
1892 inline TUint16 * TDes16::WPtr() const
1893 {return((TUint16 *)Ptr());}
1899 inline TPtr16 &TPtr16::operator=(const TUint16 *aString)
1901 Copies data into this 16-bit modifiable pointer descriptor replacing
1904 The length of this descriptor is set to reflect the new data.
1906 @param aString A pointer to a zero-terminated string.
1908 @return A reference to this 16-bit modifiable pointer descriptor.
1910 @panic USER 11, if the length of the string, excluding the zero terminator, is
1911 greater than the maximum length of this descriptor.
1913 {Copy(aString);return(*this);}
1918 inline TPtr16 &TPtr16::operator=(const TDesC16 &aDes)
1920 Copies data into this 16-bit modifiable pointer descriptor replacing any
1923 The length of this descriptor is set to reflect the new data.
1925 @param aDes A 16-bit non-modifiable descriptor whose data is to be copied
1926 into this descriptor.
1928 @return A reference to this 16-bit modifiable pointer descriptor.
1930 @panic USER 11, if the length of aDes is greater than the maximum
1931 length of this descriptor.
1933 {Copy(aDes);return(*this);}
1938 inline TPtr16 &TPtr16::operator=(const TPtr16 &aDes)
1940 Copies data into this 16-bit modifiable pointer descriptor replacing any
1943 The length of this descriptor is set to reflect the new data.
1945 @param aDes A 16-bit modifiable pointer descriptor whose data is to be copied
1946 into this descriptor.
1948 @return A reference to this 16-bit modifiable pointer descriptor.
1950 @panic USER 11, if the length of aDes is greater than the maximum
1951 length of this descriptor.
1953 {Copy(aDes);return(*this);}
1958 inline void TPtr16::Set(TUint16 *aBuf,TInt aLength,TInt aMaxLength)
1960 Sets the 16-bit modifiable pointer descriptor to point to the specified location
1961 in memory, whether in RAM or ROM.
1963 The length of the descriptor and its maximum length are set to the specified
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.
1970 @panic USER 8, if aLength is negative or is greater than the maximum length of
1972 @panic USER 18, if aMaxLength is negative.
1974 {new(this) TPtr16(aBuf,aLength,aMaxLength);}
1979 inline void TPtr16::Set(const TPtr16 &aPtr)
1981 Sets the 16-bit modifiable pointer descriptor from an existing
1982 16-bit modifiable pointer descriptor.
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.
1987 @param aPtr The source 16-bit modifiable pointer descriptor.
1989 {new(this) TPtr16(aPtr);}
1994 // Template class TBuf16
1996 inline TBuf16<S>::TBuf16()
1999 Constructs an empty 16-bit modifiable buffer descriptor.
2001 It contains no data.
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.
2012 inline TBuf16<S>::TBuf16(TInt aLength)
2013 : TBufBase16(aLength,S)
2015 Constructs an empty 16-bit modifiable buffer descriptor and sets the its length
2016 to the specified value.
2018 No data is assigned to the descriptor.
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.
2023 @param aLength The length of this modifiable buffer descriptor.
2025 @panic USER 8, if aLength is negative or is greater than the
2026 value of the integer template parameter.
2034 inline TBuf16<S>::TBuf16(const TUint16 *aString)
2035 : TBufBase16(aString,S)
2037 Constructs the 16-bit modifiable buffer descriptor from
2038 a zero terminated string.
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.
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.
2047 @param aString A pointer to a zero terminated string.
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.
2058 inline TBuf16<S>::TBuf16(const TDesC16 &aDes)
2059 : TBufBase16(aDes,S)
2061 Constructs the 16-bit modifiable buffer descriptor from any existing
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.
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.
2071 @param aDes The source 16-bit non-modifiable descriptor.
2073 @panic USER 11, if the length of the source descriptor is greater than the
2074 value of the integer template parameter.
2082 inline TBuf16<S> &TBuf16<S>::operator=(const TUint16 *aString)
2084 Copies data into this 16-bit modifiable buffer descriptor, replacing any
2087 The length of this descriptor is set to reflect the new data.
2089 @param aString A pointer to a zero-terminated string.
2091 @return A reference to this descriptor.
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.
2096 {Copy(aString);return(*this);}
2102 inline TBuf16<S> &TBuf16<S>::operator=(const TDesC16 &aDes)
2104 Copies data into this 16-bit modifiable descriptor, replacing any
2107 The length of this descriptor is set to reflect the new data.
2109 @param aDes A 16-bit non-modifiable descriptor.
2111 @return A reference to this descriptor.
2113 @panic USER 11, if the length of the descriptor aDes is greater than the
2114 maximum length of this (target) descriptor.
2116 {Copy(aDes);return(*this);}
2122 inline TBuf16<S>& TBuf16<S>::operator=(const TBuf16<S>& aBuf)
2124 Copies data into this 16-bit modifiable buffer descriptor replacing any
2127 The length of this descriptor is set to reflect the new data.
2129 @param aBuf The source 16-bit modifiable buffer descriptor with the same
2132 @return A reference to this 16-bit modifiable buffer descriptor.
2134 @panic USER 11, if the length of the descriptor aDes is greater than the
2135 maximum length of this (target) descriptor.
2137 {Copy(aBuf);return *this;}
2141 inline RBuf16& RBuf16::operator=(const TUint16* aString)
2143 Copies data into this descriptor replacing any existing data.
2145 The length of this descriptor is set to reflect the new data.
2147 @param aString A pointer to a zero-terminated string.
2149 @return A reference to this, the target descriptor.
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.
2154 {Copy(aString);return(*this);}
2159 inline RBuf16& RBuf16::operator=(const TDesC16& aDes)
2161 Copies data into this descriptor replacing any existing data.
2163 The length of this descriptor is set to reflect the new data.
2165 @param aDes A 16-bit non-modifiable descriptor.
2167 @return A reference to this, the target descriptor.
2169 @panic USER 11, if the length of the descriptor aDes is greater than the
2170 maximum length of this (target) descriptor.
2172 {Copy(aDes);return(*this);}
2177 inline RBuf16& RBuf16::operator=(const RBuf16& aDes)
2179 Copies data into this descriptor replacing any existing data.
2181 The length of this descriptor is set to reflect the new data.
2183 @param aDes A 16-bit buffer descriptor.
2185 @return A reference to this, the target descriptor.
2187 @panic USER 11, if the length of the descriptor aDes is greater than the
2188 maximum length of this (target) descriptor.
2190 {Copy(aDes);return(*this);}
2196 Creates a 16-bit resizable buffer descriptor that has been initialised with
2197 data from the specified read stream; leaves on failure.
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
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.
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.
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.
2218 inline void RBuf16::CreateL(RReadStream &aStream,TInt aMaxLength)
2220 Assign(HBufC16::NewL(aStream,aMaxLength));
2224 // Template class TLitC16
2226 inline const TDesC16* TLitC16<S>::operator&() const
2228 Returns a const TDesC16 type pointer.
2230 @return A descriptor type pointer to this literal.
2232 {return REINTERPRET_CAST(const TDesC16*,this);}
2238 inline const TDesC16& TLitC16<S>::operator()() const
2240 Returns a const TDesC16 type reference.
2242 @return A descriptor type reference to this literal
2244 {return *operator&();}
2250 inline TLitC16<S>::operator const TDesC16&() const
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.
2255 {return *operator&();}
2261 inline TLitC16<S>::operator const __TRefDesC16() const
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.
2268 {return *operator&();}
2269 #endif //__KERNEL_MODE__
2274 // Template class TBufC
2275 #if defined(_UNICODE) && !defined(__KERNEL_MODE__)
2277 inline TBufC<S>::TBufC()
2280 Constructs an empty build independent non-modifiable buffer descriptor.
2282 It contains no data.
2284 The integer template parameter determines the size of the data area which
2285 is created as part of the buffer descriptor object.
2287 Data can, subsequently, be assigned into this buffer descriptor using the
2288 assignment operators.
2290 @see TBufC::operator=
2298 inline TBufC<S>::TBufC(const TText *aString)
2299 : TBufCBase16(aString,S)
2301 Constructs a build independent non-modifiable
2302 buffer descriptor from a zero terminated string.
2304 The integer template parameter determines the size of the data area which
2305 is created as part of this object.
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.
2311 @param aString A pointer to a zero terminated string.
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.
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.
2327 inline TBufC<S>::TBufC(const TDesC &aDes)
2328 : TBufCBase16(aDes,S)
2330 Constructs a build-independent non-modifiable buffer descriptor from any
2331 existing build independent descriptor.
2333 The integer template parameter determines the size of the data area which
2334 is created as part of this object.
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.
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)
2344 @param aDes The source build independent non-modifiable descriptor.
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.
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.
2357 inline TBufC<S>::TBufC()
2361 inline TBufC<S>::TBufC(const TText *aString)
2362 : TBufCBase8(aString,S)
2365 inline TBufC<S>::TBufC(const TDesC &aDes)
2366 : TBufCBase8(aDes,S)
2370 inline TBufC<S> &TBufC<S>::operator=(const TText *aString)
2372 Copies data into this descriptor, replacing any existing data.
2374 The length of this descriptor is set to reflect the new data.
2376 @param aString A pointer to a zero-terminated string.
2378 @return A reference to this descriptor.
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.
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.
2388 {Copy(aString,S);return(*this);}
2394 inline TBufC<S> &TBufC<S>::operator=(const TDesC &aDes)
2396 Copies data into this descriptor, replacing any existing data.
2398 The length of this descriptor is set to reflect the new data.
2400 @param aDes A build independent non-modifiable descriptor.
2402 @return A reference to this descriptor.
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
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
2412 {Copy(aDes,S);return(*this);}
2418 inline TPtr TBufC<S>::Des()
2420 Creates and returns a build-independent modifiable pointer descriptor for
2421 the data represented by this build-independent non-modifiable buffer
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.
2428 The modifiable pointer descriptor is set to point to this non-modifiable buffer
2431 The length of the modifiable pointer descriptor is set to the length of this
2432 non-modifiable buffer descriptor.
2434 The maximum length of the modifiable pointer descriptor is set to the value
2435 of the integer template parameter.
2437 When data is modified through this new pointer descriptor, the lengths of
2438 both it and this constant buffer descriptor are changed.
2440 @return A build independent modifiable pointer descriptor representing the
2441 data in this build independent non-modifiable buffer descriptor.
2448 // Template class TBuf
2449 #if defined(_UNICODE) && !defined(__KERNEL_MODE__)
2451 inline TBuf<S>::TBuf()
2454 Creates a build-independent modifiable buffer descriptor which
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.
2466 inline TBuf<S>::TBuf(TInt aLength)
2467 : TBufBase16(aLength,S)
2469 Constructs an empty build independent modifiable buffer descriptor and
2470 sets its length to the specified value.
2472 No data is assigned to the descriptor.
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.
2477 @param aLength The length of this modifiable buffer descriptor.
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.
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.
2491 inline TBuf<S>::TBuf(const TText *aString)
2492 : TBufBase16(aString,S)
2494 Constructs the build-independent modifiable buffer descriptor from
2495 a zero terminated string.
2497 The integer template parameter determines the size of the data area which
2498 is created as part of this object.
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.
2504 @param aString A pointer to a zero terminated string.
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.
2519 inline TBuf<S>::TBuf(const TDesC &aDes)
2520 : TBufBase16(aDes,S)
2522 Constructs the build-independent modifiable buffer descriptor from any
2523 existing build-independent descriptor.
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.
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.
2532 @param aDes The source build independent non-modifiable descriptor.
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
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
2545 inline TBuf<S>::TBuf()
2549 inline TBuf<S>::TBuf(TInt aLength)
2550 : TBufBase8(aLength,S)
2553 inline TBuf<S>::TBuf(const TText *aString)
2554 : TBufBase8(aString,S)
2557 inline TBuf<S>::TBuf(const TDesC &aDes)
2562 inline TBuf<S> &TBuf<S>::operator=(const TText *aString)
2563 {Copy(aString);return(*this);}
2565 inline TBuf<S> &TBuf<S>::operator=(const TDesC &aDes)
2566 {Copy(aDes);return(*this);}
2568 inline TBuf<S> &TBuf<S>::operator=(const TBuf<S> &aBuf)
2569 {Copy(aBuf);return(*this);}
2574 // Template class TLitC
2576 inline const TDesC* TLitC<S>::operator&() const
2578 Returns a const TDesC type pointer.
2580 @return A descriptor type pointer to this literal.
2582 {return REINTERPRET_CAST(const TDesC*,this);}
2588 inline const TDesC& TLitC<S>::operator()() const
2590 Returns a const TDesC type reference.
2592 @return A descriptor type reference to this literal
2594 {return *operator&();}
2600 inline TLitC<S>::operator const TDesC&() const
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.
2605 {return *operator&();}
2611 inline TLitC<S>::operator const __TRefDesC() const
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.
2618 {return *operator&();}
2623 // Template class TPckgC
2625 inline TPckgC<T>::TPckgC(const T &aRef)
2626 : TPtrC8((const TUint8 *)&aRef,sizeof(T))
2628 Constructs a packaged non-modifiable pointer descriptor to represent
2629 the specified object whose type is defined by the template parameter.
2631 @param aRef The object to be represented by this packaged non-modifiable
2640 inline const T &TPckgC<T>::operator()() const
2642 Gets a reference to the object represented by this packaged non-modifiable
2645 @return The packaged object
2647 {return(*((const T *)iPtr));}
2652 // Template class TPckg
2654 inline TPckg<T>::TPckg(const T &aRef)
2655 : TPtr8((TUint8 *)&aRef,sizeof(T),sizeof(T))
2657 Constructs a packaged modifiable pointer descriptor to represent the specified
2658 object whose type is defined by the template parameter.
2660 @param aRef The object to be represented by this packaged modifiable pointer
2669 inline T &TPckg<T>::operator()()
2671 Gets a reference to the object represented by this packaged
2672 modifiable pointer descriptor.
2674 @return The packaged object.
2676 {return(*((T *)iPtr));}
2681 // Template class TPckgBuf
2683 inline TPckgBuf<T>::TPckgBuf()
2684 : TAlignedBuf8<sizeof(T)>(sizeof(T))
2686 Constructs a packaged modifiable buffer descriptor for an object whose type
2687 is defined by the template parameter.
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.
2692 {new(&this->iBuf[0]) T;}
2698 inline TPckgBuf<T>::TPckgBuf(const T &aRef)
2699 : TAlignedBuf8<sizeof(T)>(sizeof(T))
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
2705 The length of the packaged descriptor is set to the length of the templated
2708 @param aRef The source object to be copied into the packaged modifiable buffer
2711 {new(&this->iBuf[0]) T(aRef);}
2717 inline TPckgBuf<T> &TPckgBuf<T>::operator=(const TPckgBuf<T> &aRef)
2719 Copies data from the specified packaged modifiable buffer descriptor into this
2720 packaged modifiable buffer descriptor, replacing any existing data.
2722 @param aRef The source packaged modifiable buffer descriptor.
2723 @return A reference to this packaged modifiable descriptor.
2725 {this->Copy(aRef);return(*this);}
2731 inline T &TPckgBuf<T>::operator=(const T &aRef)
2733 Copies data from the specified object into this packaged modifiable buffer
2734 descriptor, replacing any existing data.
2736 @param aRef The source object.
2737 @return A reference to the copy of the source object in the packaged modifiable
2740 {this->Copy((TUint8 *)&aRef,sizeof(T));return(*((T *)&this->iBuf[0]));}
2746 inline T &TPckgBuf<T>::operator()()
2748 Gets a reference to the object contained by this packaged modifiable
2751 @return The packaged object.
2753 {return(*((T *)&this->iBuf[0]));}
2759 inline const T &TPckgBuf<T>::operator()() const
2761 Gets a const reference to the object contained by this packaged modifiable
2764 @return The (const) packaged object.
2766 {return(*((T *)&this->iBuf[0]));}
2771 // Class TRequestStatus
2772 inline TRequestStatus::TRequestStatus()
2774 Default constructor.
2782 inline TRequestStatus::TRequestStatus(TInt aVal)
2784 Constructs an asynchronous request status object and assigns a completion value
2787 @param aVal The completion value to be assigned to the constructed request
2791 iFlags(aVal==KRequestPending ? TRequestStatus::ERequestPending : 0)
2798 inline TInt TRequestStatus::operator=(TInt aVal)
2800 Assigns the specified completion code to the request status object.
2802 @param aVal The value to be assigned.
2804 @return The value assigned.
2807 if(aVal==KRequestPending)
2808 iFlags|=TRequestStatus::ERequestPending;
2810 iFlags&=~TRequestStatus::ERequestPending;
2811 return (iStatus=aVal);
2817 inline TBool TRequestStatus::operator==(TInt aVal) const
2819 Tests whether the request status object's completion code is the same as
2820 the specified value.
2822 @param aVal The value to be compared.
2824 @return True, if the values are equal; false otherwise.
2826 {return(iStatus==aVal);}
2831 inline TBool TRequestStatus::operator!=(TInt aVal) const
2833 Tests whether the request status object's completion code is not equal to
2834 the specified value.
2836 @param aVal The value to be compared.
2838 @return True, if the values are unequal; false otherwise.
2840 {return(iStatus!=aVal);}
2845 inline TBool TRequestStatus::operator>=(TInt aVal) const
2847 Tests whether the request status object's completion code is greater than
2848 or equal to the specified value.
2850 @param aVal The value to be compared.
2852 @return True, if the request status object's value is greater than or equal
2853 to the specified value; false, otherwise.
2855 {return(iStatus>=aVal);}
2860 inline TBool TRequestStatus::operator<=(TInt aVal) const
2862 Tests whether the request status object's completion code is less than or
2863 equal to the specified value.
2865 @param aVal The value to be compared.
2867 @return True, if the request status object's value is less than or equal
2868 to the specified value; false, otherwise.
2870 {return(iStatus<=aVal);}
2875 inline TBool TRequestStatus::operator>(TInt aVal) const
2877 Tests whether the request status object's completion code is greater than
2878 the specified value.
2880 @param aVal The value to be compared.
2882 @return True, if the request status object's value is greater than
2883 the specified value; false, otherwise.
2885 {return(iStatus>aVal);}
2890 inline TBool TRequestStatus::operator<(TInt aVal) const
2892 Tests whether the request status object's completion code is less than the
2895 @param aVal The value to be compared.
2897 @return True, if the request status object's value is less than the specified
2898 value; false, otherwise.
2900 {return(iStatus<aVal);}
2905 inline TInt TRequestStatus::Int() const
2907 Gets this request status object's completion code value.
2909 @return The completion code.
2917 #ifndef __KERNEL_MODE__
2918 inline TPoint::TPoint()
2921 Constructs default point, initialising its iX and iY members to zero.
2928 inline TPoint::TPoint(TInt aX,TInt aY)
2931 Constructs a point with the specified x and y co-ordinates.
2933 @param aX The x co-ordinate value.
2934 @param aY The y co-ordinate value.
2942 inline TSize::TSize()
2943 : iWidth(0),iHeight(0)
2945 Constructs the size object with its iWidth and iHeight members set to zero.
2952 inline TSize::TSize(TInt aWidth,TInt aHeight)
2953 : iWidth(aWidth),iHeight(aHeight)
2955 Constructs the size object with the specified width and height values.
2957 @param aWidth The width value.
2958 @param aHeight The height value .
2966 #ifndef __KERNEL_MODE__
2967 inline TPoint3D::TPoint3D()
2970 Constructs default 3Dpoint, initialising its iX, iY and iZ members to zero.
2974 inline TPoint3D::TPoint3D(TInt aX,TInt aY,TInt aZ)
2975 : iX(aX),iY(aY),iZ(aZ)
2977 Constructs TPoint3D with the specified x,y and z co-ordinates.
2979 @param aX The x co-ordinate value.
2980 @param aY The y co-ordinate value.
2981 @param aZ The z co-ordinate value.
2988 inline TPoint3D::TPoint3D(const TPoint& aPoint)
2989 :iX(aPoint.iX),iY(aPoint.iY),iZ(0)
2991 Copy Construct from TPoint , initialises Z co-ordinate to Zero
2992 @param aPoint The TPoint from which we create TPoint3D object
3000 // Class TFindHandle
3001 inline TFindHandle::TFindHandle()
3002 : iHandle(0), iSpare1(0), iObjectIdLow(0), iObjectIdHigh(0)
3008 inline TInt TFindHandle::Handle() const
3013 Gets the find-handle number associated with the Kernel object.
3015 The find-handle number identifies the kernel object with respect to
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.
3022 @return The find-handle number.
3029 #ifdef __KERNEL_MODE__
3030 const TInt KFindHandleUniqueIdShift=16; ///< @internalComponent
3031 const TInt KFindHandleUniqueIdMask=0x7fff; ///< @internalComponent
3032 const TInt KFindHandleIndexMask=0x7fff; ///< @internalComponent
3038 Gets the index into its container at which the kernel object was last seen.
3040 @return The object's index in its container.
3042 inline TInt TFindHandle::Index() const
3043 {return(iHandle&KFindHandleIndexMask);}
3049 Gets the unique ID of the kernel container this object resides in.
3051 @return The ID of this object's container.
3053 inline TInt TFindHandle::UniqueID() const
3054 {return((iHandle>>KFindHandleUniqueIdShift)&KFindHandleUniqueIdMask);}
3060 Gets the unique ID of the kernel object itself.
3062 @return The ID of the object.
3064 inline TUint64 TFindHandle::ObjectID() const
3065 {return MAKE_TUINT64(iObjectIdHigh, iObjectIdLow);}
3071 Sets the find handle to refer to a specific object.
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.
3077 inline void TFindHandle::Set(TInt aIndex, TInt aUniqueId, TUint64 aObjectId)
3079 iHandle=(TInt)((aUniqueId<<KFindHandleUniqueIdShift)|aIndex);
3080 iObjectIdLow=I64LOW(aObjectId);
3081 iObjectIdHigh=I64HIGH(aObjectId);
3089 Resets the find handle to its initial state.
3091 inline void TFindHandle::Reset()
3093 iHandle=iSpare1=iObjectIdLow=iObjectIdHigh=0;
3100 // Class RHandleBase
3101 inline RHandleBase::RHandleBase()
3104 Default constructor.
3111 #ifndef __KERNEL_MODE__
3112 inline RHandleBase::RHandleBase(TInt aHandle)
3117 It constructs this handle from an existing one. Specifically, the handle-number
3118 encapsulated by the specified handle is copied to this handle.
3120 @param aHandle The existing handle to be copied.
3128 inline void RHandleBase::SetHandle(TInt aHandle)
3130 Sets the handle-number of this handle to the specified
3133 @param aHandle The handle-number to be set.
3135 { iHandle=aHandle; }
3140 inline TInt RHandleBase::Handle() const
3142 Retrieves the handle-number of the object associated with this handle.
3144 @return The handle number
3151 inline TInt RHandleBase::SetReturnedHandle(TInt aHandleOrError)
3153 Sets the handle-number of this handle to the specified
3156 The function can take a (zero or positive) handle-number,
3157 or a (negative) error number.
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.
3164 @param aHandleOrError A handle-number, if zero or positive; an error value, if negative.
3166 @return KErrNone, if aHandle is a handle-number; the value of aHandleOrError, otherwise.
3170 if(aHandleOrError>=0)
3172 iHandle = aHandleOrError;
3176 return aHandleOrError;
3177 #elif defined(_WIN32)
3178 //Our problem is that win32 handles can be negative
3179 if (aHandleOrError==NULL)
3181 //TODO: check GetLastError and return proper error code
3185 iHandle = aHandleOrError;
3188 #error "Platform not supported"
3196 #ifndef __KERNEL_MODE__
3197 inline TInt RSemaphore::Open(const TFindSemaphore& aFind,TOwnerType aType)
3199 Opens a handle to the global semaphore found using a TFindSemaphore object.
3201 A TFindSemaphore object is used to find all global semaphores whose full names
3202 match a specified pattern.
3204 By default, any thread in the process can use this instance of RSemaphore
3205 to access the semaphore. However, specifying EOwnerThread as the second parameter
3206 to this function, means that only the opening thread can use this instance
3207 of RSemaphore to access the semaphore; any other thread in this process that
3208 wants to access the semaphore must either duplicate the handle or use OpenGlobal()
3211 @param aFind A reference to the TFindSemaphore object used to find the semaphore.
3212 @param aType An enumeration whose enumerators define the ownership of this
3213 semaphore handle. If not explicitly specified, EOwnerProcess is
3216 @return KErrNone if successful otherwise another of the system wide error codes.
3218 {return(RHandleBase::Open((const TFindHandleBase&)aFind,aType));}
3228 Default constructor.
3230 inline RFastLock::RFastLock()
3238 Default constructor.
3240 inline RReadWriteLock::RReadWriteLock()
3241 : iValues(0), iPriority(EAlternatePriority), iReaderSem(), iWriterSem()
3247 // Class RMessagePtr2
3253 inline RMessagePtr2::RMessagePtr2()
3261 Tests whether this message handle is empty.
3263 @return True, if this message handle is empty, false, otherwise.
3265 inline TBool RMessagePtr2::IsNull() const
3266 {return iHandle==0;}
3272 Gets the message handle value.
3274 @return The message handle value.
3276 inline TInt RMessagePtr2::Handle() const
3278 inline TBool operator==(RMessagePtr2 aLeft,RMessagePtr2 aRight)
3279 {return aLeft.Handle()==aRight.Handle();}
3280 inline TBool operator!=(RMessagePtr2 aLeft,RMessagePtr2 aRight)
3281 {return aLeft.Handle()!=aRight.Handle();}
3293 inline RMessage2::RMessage2()
3294 :iFunction(0), iSpare1(0), iSessionPtr(NULL), iFlags(0), iSpare3(0)
3301 Gets the the number of the function requested by the client.
3303 @return The function number.
3305 inline TInt RMessage2::Function() const
3306 {return(iFunction);}
3312 Gets the first message argument as an integer value.
3314 @return The first message argument.
3316 inline TInt RMessage2::Int0() const
3323 Gets the second message argument as an integer value.
3325 @return The second message argument.
3327 inline TInt RMessage2::Int1() const
3334 Gets the third message argument as an integer value.
3336 @return The third message argument.
3338 inline TInt RMessage2::Int2() const
3344 Gets the fourth message argument as an integer value.
3346 @return The fourth message argument.
3348 inline TInt RMessage2::Int3() const
3354 Gets the first message argument as a pointer type.
3356 @return The first message argument.
3358 inline const TAny *RMessage2::Ptr0() const
3359 {return((const TAny *)iArgs[0]);}
3365 Gets the second message argument as a pointer type.
3367 @return The second message argument.
3369 inline const TAny *RMessage2::Ptr1() const
3370 {return((const TAny *)iArgs[1]);}
3376 Gets the third message argument as a pointer type.
3378 @return The third message argument.
3380 inline const TAny *RMessage2::Ptr2() const
3381 {return((const TAny *)iArgs[2]);}
3387 Gets the fourth message argument as a pointer type.
3389 @return The fourth message argument.
3391 inline const TAny *RMessage2::Ptr3() const
3392 {return((const TAny *)iArgs[3]);}
3397 Gets a pointer to the session.
3399 @return A pointer to the session object.
3401 inline CSession2* RMessage2::Session() const
3402 {return (CSession2*)iSessionPtr; }
3408 inline TUid TUid::Uid(TInt aUid)
3410 Constructs the TUid object from a 32-bit integer.
3412 @param aUid The 32-bit integer value from which the TUid object is to be
3415 @return The constructed TUid object.
3417 {TUid uid={aUid};return uid;}
3422 inline TUid TUid::Null()
3424 Constructs a Null-valued TUid object.
3426 @return The constructed Null-valued TUid object.
3428 {TUid uid={KNullUidValue};return uid;}
3433 #ifndef __KERNEL_MODE__
3434 // Template class TArray
3436 inline TArray<T>::TArray(TInt (*aCount)(const CBase *aPtr),const TAny *(*anAt)(const CBase *aPtr,TInt anIndex),const CBase *aPtr)
3437 : iPtr(aPtr),iCount(aCount),iAt(anAt)
3441 A TArray object is not intended to be instantiated explicitly. An object of
3442 this type is instantiated as a result of a call to to the Array() member
3443 function of a concrete array class
3445 @param aCount A pointer to a function which takes a
3449 argument and returns a
3453 aCount must point to the member function which returns the
3454 current number of elements of type class T contained in the
3455 array at aPtr, for which this TArray is being constructed.
3456 This argument is supplied by the Array() member function of the
3458 @param anAt A pointer to a function which takes a
3466 argument, and returns a pointer to
3470 anAt must point to the member function which returns a reference
3471 to the element located at position anIndex within the array at
3472 aPtr, for which this TArray is being constructed.
3473 This argument is supplied by the Array() member function of the
3475 @param aPtr A pointer to the array for which this TArray is being
3476 constructed. This argument is supplied by the Array() member
3477 function of the array class.
3479 @see CArrayFixFlat::Array
3480 @see CArrayFixSeg::Array
3481 @see CArrayVarFlat::Array
3482 @see CArrayVarSeg::Array
3483 @see CArrayPakFlat::Array
3485 @see RPointerArray::Array
3486 @see RArray<TInt>::Array
3487 @see RArray<TUint>::Array
3495 inline TInt TArray<T>::Count() const
3497 Gets the number of elements currently held in the array for which this generic
3498 array has been constructed.
3500 @return The number of array elements.
3502 {return((*iCount)(iPtr));}
3508 inline const T &TArray<T>::operator[](TInt anIndex) const
3510 Gets a reference to the element located at the specified position.
3512 The returned reference is const and cannot be used to change the element.
3513 Any member function of the referenced template class T must be declared
3514 as const if that function is to be accessed through this operator.
3516 @param anIndex The position of the element within the array for which this
3517 TArray has been constructed. The position is relative to zero;
3518 i.e. zero implies the first element in the array.
3520 @return A const reference to the element located at position anIndex within
3521 the array for which this TArray has been constructed.
3523 @panic E32USER-CBase 21, if anIndex is negative, or greater than or equal to
3524 the number of objects currently within the array.
3526 {return(*((const T *)(*iAt)(iPtr,anIndex)));}
3532 // Class TIdentityRelation<T>
3534 inline TIdentityRelation<T>::TIdentityRelation()
3536 Constructs the object to use the equality operator (==) defined for class T
3537 to determine whether two class T type objects match.
3539 {iIdentity=(TGeneralIdentityRelation)&EqualityOperatorCompare;}
3545 inline TIdentityRelation<T>::TIdentityRelation( TBool (*anIdentity)(const T&, const T&) )
3547 Constructs the object taking the specified function as an argument.
3549 The specified function should implement an algorithm for determining whether
3550 two class T type objects match. It should return:
3552 1. true, if the two objects match.
3554 2. false, if the two objects do not match.
3556 @param anIdentity A pointer to a function that takes constant references to two
3557 class T objects and returns a TInt value.
3559 { iIdentity=(TGeneralIdentityRelation)anIdentity; }
3565 inline TIdentityRelation<T>::operator TGeneralIdentityRelation() const
3567 Operator that gets the function that determines whether two
3568 objects of a given class type match.
3570 { return iIdentity; }
3575 inline TBool TIdentityRelation<T>::EqualityOperatorCompare(const T& aLeft, const T& aRight)
3577 Compares two objects of class T using the equality operator defined for class T.
3579 {return aLeft == aRight;}
3583 // Class TLinearOrder<T>
3585 inline TLinearOrder<T>::TLinearOrder( TInt(*anOrder)(const T&, const T&) )
3587 Constructs the object taking the specified function as an argument.
3589 The specified function should implement an algorithm that determines the
3590 order of two class T type objects. It should return:
3592 1. zero, if the two objects are equal.
3594 2. a negative value, if the first object is less than the second.
3596 3. a positive value, if the first object is greater than the second.
3598 @param anOrder A pointer to a function that takes constant references to two
3599 class T objects and returns a TInt value.
3601 { iOrder=(TGeneralLinearOrder)anOrder; }
3607 inline TLinearOrder<T>::operator TGeneralLinearOrder() const
3609 Operator that gets the function that determines the order of two
3610 objects of a given class type.
3617 // Class RPointerArray<T>
3620 Default C++ constructor.
3622 This constructs an array object for an array of pointers with default
3623 granularity, which is 8.
3626 inline RPointerArray<T>::RPointerArray()
3627 : RPointerArrayBase()
3634 C++ constructor with granularity.
3636 This constructs an array object for an array of pointers with the specified
3639 @param aGranularity The granularity of the array.
3641 @panic USER 127, if aGranularity is not positive, or greater than or equal
3645 inline RPointerArray<T>::RPointerArray(TInt aGranularity)
3646 : RPointerArrayBase(aGranularity)
3653 C++ constructor with minimum growth step and exponential growth factor.
3655 This constructs an array object for an array of pointers with the specified
3656 minimum growth step and exponential growth factor.
3658 @param aMinGrowBy The minimum growth step of the array. Must be between 1 and
3660 @param aFactor The factor by which the array grows, multiplied by 256.
3661 For example 512 specifies a factor of 2. Must be between 257
3662 and 32767 inclusive.
3664 @panic USER 192, if aMinGrowBy<=0 or aMinGrowBy>65535.
3665 @panic USER 193, if aFactor<=257 or aFactor>32767.
3668 inline RPointerArray<T>::RPointerArray(TInt aMinGrowBy, TInt aFactor)
3669 : RPointerArrayBase(aMinGrowBy, aFactor)
3676 inline void RPointerArray<T>::Close()
3678 Closes the array and frees all memory allocated to it.
3680 The function must be called before this array object goes out of scope.
3682 Note that the function does not delete the objects whose pointers are contained
3685 {RPointerArrayBase::Close();}
3691 inline TInt RPointerArray<T>::Count() const
3693 Gets the number of object pointers in the array.
3695 @return The number of object pointers in the array.
3697 { return RPointerArrayBase::Count(); }
3703 inline T* const& RPointerArray<T>::operator[](TInt anIndex) const
3705 Gets a reference to the object pointer located at the specified
3706 position within the array.
3708 The compiler chooses this option if the returned reference is used in
3709 an expression where the reference cannot be modified.
3711 @param anIndex The position of the object pointer within the array. The
3712 position is relative to zero, i.e. zero implies the object
3713 pointer at the beginning of the array.
3715 @return A const reference to the object pointer at position anIndex within
3718 @panic USER 130, if anIndex is negative, or is greater than the number of
3719 objects currently in the array.
3721 {return (T* const&)At(anIndex);}
3727 inline T*& RPointerArray<T>::operator[](TInt anIndex)
3729 Gets a reference to the object pointer located at the specified
3730 position within the array.
3732 The compiler chooses this option if the returned reference is used in
3733 an expression where the reference can be modified.
3735 @param anIndex The position of the object pointer within the array. The
3736 position is relative to zero, i.e. zero implies the object
3737 pointer at the beginning of the array.
3739 @return A non-const reference to the object pointer at position anIndex within
3742 @panic USER 130, if anIndex is negative, or is greater than the number of
3743 objects currently in the array.
3745 {return (T*&)At(anIndex);}
3751 inline TInt RPointerArray<T>::Append(const T* anEntry)
3753 Appends an object pointer onto the array.
3755 @param anEntry The object pointer to be appended.
3757 @return KErrNone, if the insertion is successful, otherwise one of the system
3760 { return RPointerArrayBase::Append(anEntry); }
3766 inline TInt RPointerArray<T>::Insert(const T* anEntry, TInt aPos)
3768 Inserts an object pointer into the array at the specified position.
3770 @param anEntry The object pointer to be inserted.
3771 @param aPos The position within the array where the object pointer is to be
3772 inserted. The position is relative to zero, i.e. zero implies
3773 that a pointer is inserted at the beginning of the array.
3775 @return KErrNone, if the insertion is successful, otherwise one of the system
3778 @panic USER 131, if aPos is negative, or is greater than the number of object
3779 pointers currently in the array.
3781 { return RPointerArrayBase::Insert(anEntry,aPos); }
3787 inline void RPointerArray<T>::Remove(TInt anIndex)
3789 Removes the object pointer at the specified position from the array.
3791 Note that the function does not delete the object whose pointer is removed.
3793 @param anIndex The position within the array from where the object pointer
3794 is to be removed. The position is relative to zero, i.e. zero
3795 implies that a pointer at the beginning of the array is to be
3798 @panic USER 130, if anIndex is negative, or is greater than the number of
3799 objects currently in the array.
3801 {RPointerArrayBase::Remove(anIndex);}
3807 inline void RPointerArray<T>::Compress()
3809 Compresses the array down to a minimum.
3811 After a call to this function, the memory allocated to the array is just
3812 sufficient for its contained object pointers.
3813 Subsequently adding a new object pointer to the array
3814 always results in a re-allocation of memory.
3816 {RPointerArrayBase::Compress();}
3822 inline void RPointerArray<T>::Reset()
3826 It frees all memory allocated to the array and resets the internal state so
3827 that it is ready to be reused.
3829 This array object can be allowed to go out of scope after a call to this
3832 Note that the function does not delete the objects whose pointers are contained
3835 {RPointerArrayBase::Reset();}
3841 inline TInt RPointerArray<T>::Find(const T* anEntry) const
3843 Finds the first object pointer in the array which matches the specified object
3844 pointer, using a sequential search.
3846 Matching is based on the comparison of pointers.
3848 The find operation always starts at the low index end of the array. There
3849 is no assumption about the order of objects in the array.
3851 @param anEntry The object pointer to be found.
3852 @return The index of the first matching object pointer within the array.
3853 KErrNotFound, if no matching object pointer can be found.
3855 { return RPointerArrayBase::Find(anEntry); }
3861 inline TInt RPointerArray<T>::Find(const T* anEntry, TIdentityRelation<T> anIdentity) const
3863 Finds the first object pointer in the array whose object matches the specified
3864 object, using a sequential search and a matching algorithm.
3866 The algorithm for determining whether two class T objects match is provided
3867 by a function supplied by the caller.
3869 The find operation always starts at the low index end of the array. There
3870 is no assumption about the order of objects in the array.
3872 @param anEntry The object pointer to be found.
3873 @param anIdentity A package encapsulating the function which determines whether
3874 two class T objects match.
3876 @return The index of the first matching object pointer within the array.
3877 KErrNotFound, if no suitable object pointer can be found.
3879 { return RPointerArrayBase::Find(anEntry,anIdentity); }
3885 inline TInt RPointerArray<T>::FindReverse(const T* anEntry) const
3887 Finds the last object pointer in the array which matches the specified object
3888 pointer, using a sequential search.
3890 Matching is based on the comparison of pointers.
3892 The find operation always starts at the high index end of the array. There
3893 is no assumption about the order of objects in the array.
3895 @param anEntry The object pointer to be found.
3896 @return The index of the last matching object pointer within the array.
3897 KErrNotFound, if no matching object pointer can be found.
3899 { return RPointerArrayBase::FindReverse(anEntry); }
3905 inline TInt RPointerArray<T>::FindReverse(const T* anEntry, TIdentityRelation<T> anIdentity) const
3907 Finds the last object pointer in the array whose object matches the specified
3908 object, using a sequential search and a matching algorithm.
3910 The algorithm for determining whether two class T objects match is provided
3911 by a function supplied by the caller.
3913 The find operation always starts at the high index end of the array. There
3914 is no assumption about the order of objects in the array.
3916 @param anEntry The object pointer to be found.
3917 @param anIdentity A package encapsulating the function which determines whether
3918 two class T objects match.
3920 @return The index of the last matching object pointer within the array.
3921 KErrNotFound, if no suitable object pointer can be found.
3923 { return RPointerArrayBase::FindReverse(anEntry,anIdentity); }
3929 inline TInt RPointerArray<T>::FindInAddressOrder(const T* anEntry) const
3931 Finds the object pointer in the array that matches the specified object
3932 pointer, using a binary search technique.
3934 The function assumes that object pointers in the array are in address order.
3936 @param anEntry The object pointer to be found.
3938 @return The index of the matching object pointer within the array or KErrNotFound
3939 if no suitable object pointer can be found.
3941 { return RPointerArrayBase::FindIsqUnsigned((TUint)anEntry); }
3947 inline TInt RPointerArray<T>::FindInOrder(const T* anEntry, TLinearOrder<T> anOrder) const
3949 Finds the object pointer in the array whose object matches the specified
3950 object, using a binary search technique and an ordering algorithm.
3952 The function assumes that existing object pointers in the array are ordered
3953 so that the objects themselves are in object order as determined by an algorithm
3954 supplied by the caller and packaged as a TLinearOrder<T>.
3956 @param anEntry The object pointer to be found.
3957 @param anOrder A package encapsulating the function which determines the order
3958 of two class T objects.
3960 @return The index of the matching object pointer within the array or KErrNotFound,
3961 if no suitable object pointer can be found.
3963 { return RPointerArrayBase::FindIsq(anEntry,anOrder); }
3969 inline TInt RPointerArray<T>::FindInAddressOrder(const T* anEntry, TInt& anIndex) const
3971 Finds the object pointer in the array that matches the specified object
3972 pointer, using a binary search technique.
3974 The function assumes that object pointers in the array are in address order.
3976 @param anEntry The object pointer to be found.
3977 @param anIndex A TInt supplied by the caller. On return, contains an index
3979 If the function returns KErrNone, this is the index of the
3980 matching object pointer within the array.
3981 If the function returns KErrNotFound, this is the
3982 index of the first object pointer within the array which
3983 logically follows after anEntry.
3985 @return KErrNone, if a matching object pointer is found.
3986 KErrNotFound, if no suitable object pointer can be found.
3988 { return RPointerArrayBase::BinarySearchUnsigned((TUint)anEntry,anIndex); }
3994 inline TInt RPointerArray<T>::FindInOrder(const T* anEntry, TInt& anIndex, TLinearOrder<T> anOrder) const
3996 Finds the object pointer in the array whose object matches the specified
3997 object, using a binary search technique and an ordering algorithm.
3999 The function assumes that existing object pointers in the array are ordered
4000 so that the objects themselves are in object order as determined by an
4001 algorithm supplied by the caller and packaged as a TLinearOrder<T>.
4003 @param anEntry The object pointer to be found.
4004 @param anIndex A TInt supplied by the caller. On return, contains an
4006 If the function returns KErrNone, this is the index of the
4007 matching object pointer within the array.
4008 If the function returns KErrNotFound, this is the index of
4009 the first object pointer in the array whose object is larger
4010 than the entry being searched for - if no objects pointed to in
4011 the array are larger, then the index value is the same as the
4012 total number of object pointers in the array.
4014 @param anOrder A package encapsulating the function which determines the order
4015 of two class T objects.
4017 @return KErrNone, if a matching object pointer is found.
4018 KErrNotFound, if no suitable object pointer can be found.
4020 { return RPointerArrayBase::BinarySearch(anEntry,anIndex,anOrder); }
4026 inline TInt RPointerArray<T>::SpecificFindInAddressOrder(const T* anEntry, TInt aMode) const
4028 Finds the object pointer in the array that matches the specified object
4029 pointer, using a binary search technique.
4031 Where there is more than one matching element, it finds the first, the last
4032 or any matching element as specified by the value of aMode.
4034 The function assumes that object pointers in the array are in address order.
4036 @param anEntry The object pointer to be found.
4037 @param aMode Specifies whether to find the first match, the last match or
4038 any match, as defined by one of the TArrayFindMode enum values.
4040 @return KErrNotFound, if there is no matching element, otherwise the array
4041 index of a matching element - what the index refers to depends on the
4043 if this is EArrayFindMode_First, then the index refers to the first matching element;
4044 if this is EArrayFindMode_Any, then the index can refer to any of the matching elements;
4045 if this is EArrayFindMode_Last, then the index refers to first element that follows
4046 the last matching element - if the last matching element is also the last element of
4047 the array, then the index value is the same as the total number of elements in the array.
4051 { return RPointerArrayBase::FindIsqUnsigned((TUint)anEntry, aMode); }
4057 inline TInt RPointerArray<T>::SpecificFindInOrder(const T* anEntry, TLinearOrder<T> anOrder, TInt aMode) const
4059 Finds the object pointer in the array whose object matches the specified
4060 object, using a binary search technique and an ordering algorithm.
4062 Where there is more than one matching element, it finds the first, the last
4063 or any matching element as specified by the value of aMode.
4065 The function assumes that existing object pointers in the array are ordered
4066 so that the objects themselves are in object order as determined by an algorithm
4067 supplied by the caller and packaged as a TLinearOrder<T> type.
4069 @param anEntry The object pointer to be found.
4070 @param anOrder A package encapsulating the function which determines the order
4071 of two class T objects.
4072 @param aMode Specifies whether to find the first match, the last match or any match,
4073 as defined by one of the TArrayFindMode enum values.
4075 @return KErrNotFound, if there is no matching element, otherwise the array
4076 index of a matching element - what the index refers to depends on
4078 if this is EArrayFindMode_First, then the index refers to the first matching element;
4079 if this is EArrayFindMode_Any, then the index can refer to any of the matching elements;
4080 if this is EArrayFindMode_Last, then the index refers to first element that follows
4081 the last matching element - if the last matching element is also the last element of the array,
4082 then the index value is the same as the total number of elements in the array.
4086 { return RPointerArrayBase::FindIsq(anEntry,anOrder,aMode); }
4092 inline TInt RPointerArray<T>::SpecificFindInAddressOrder(const T* anEntry, TInt& anIndex, TInt aMode) const
4094 Finds the object pointer in the array that matches the specified object
4095 pointer, using a binary search technique.
4097 Where there is more than one matching element, it finds the first, the last
4098 or any matching element as specified by the value of aMode.
4100 The function assumes that object pointers in the array are in address order.
4102 @param anEntry The object pointer to be found.
4103 @param anIndex A TInt type supplied by the caller. On return, it contains an
4104 index value depending on whether a match is found and on the
4106 If there is no matching element in the array, then this is
4107 the index of the first element in the array that is bigger than
4108 the element being searched for - if no elements in the array are
4109 bigger, then the index value is the same as the total number of
4110 elements in the array. If there is a matching element, then what
4111 the index refers to depends on the value of aMode:
4112 if this is EArrayFindMode_First, then the index refers to the first matching element;
4113 if this is EArrayFindMode_Any, then the index can refer to any of the matching elements;
4114 if this is EArrayFindMode_Last, then the index refers to first element that follows the
4115 last matching element - if the last matching element is also the last element of the array,
4116 then the index value is the same as the total number of elements in the array.
4118 @param aMode Specifies whether to find the first match, the last match or any
4119 match, as defined by one of the TArrayFindMode enum values.
4121 @return KErrNone, if a matching object pointer is found.
4122 KErrNotFound, if no suitable object pointer can be found.
4126 { return RPointerArrayBase::BinarySearchUnsigned((TUint)anEntry,anIndex,aMode); }
4132 inline TInt RPointerArray<T>::SpecificFindInOrder(const T* anEntry, TInt& anIndex, TLinearOrder<T> anOrder, TInt aMode) const
4134 Finds the object pointer in the array whose object matches the specified
4135 object, using a binary search technique and an ordering algorithm.
4137 Where there is more than one matching element, it finds the first, the last or any
4138 matching element as specified by the value of aMode.
4140 The function assumes that existing object pointers in the array are ordered
4141 so that the objects themselves are in object order as determined by an
4142 algorithm supplied by the caller and packaged as a TLinearOrder<T> type.
4144 @param anEntry The object pointer to be found.
4145 @param anIndex A TInt type supplied by the caller. On return, it contains an
4146 index value depending on whether a match is found and on the
4147 value of aMode. If there is no matching element in the array,
4148 then this is the index of the first element in the array
4149 that is bigger than the element being searched for - if
4150 no elements in the array are bigger, then the index value
4151 is the same as the total number of elements in the array.
4152 If there is a matching element, then what the index refers to
4153 depends on the value of aMode:
4154 if this is EArrayFindMode_First, then the index refers to the first matching element;
4155 if this is EArrayFindMode_Any, then the index can refer to any of the matching elements;
4156 if this is EArrayFindMode_Last, then the index refers to first element that follows
4157 the last matching element - if the last matching element is also the last element
4158 of the array, then the index value is the same as the total number of elements in the array.
4160 @param anOrder A package encapsulating the function which determines the order
4161 of two class T objects.
4162 @param aMode Specifies whether to find the first match, the last match or
4163 any match, as defined by one of the TArrayFindMode enum values.
4165 @return KErrNone, if a matching object pointer is found.
4166 KErrNotFound, if no suitable object pointer can be found.
4170 { return RPointerArrayBase::BinarySearch(anEntry,anIndex,anOrder,aMode); }
4176 inline TInt RPointerArray<T>::InsertInAddressOrder(const T* anEntry)
4178 Inserts an object pointer into the array in address order.
4180 No duplicate entries are permitted. The array remains unchanged following
4181 an attempt to insert a duplicate entry.
4183 The function assumes that existing object pointers within the array are in
4186 @param anEntry The object pointer to be inserted.
4188 @return KErrNone, if the insertion is successful;
4189 KErrAlreadyExists, if an attempt is being made
4190 to insert a duplicate entry; otherwise one of the other system wide
4193 { return RPointerArrayBase::InsertIsqUnsigned((TUint)anEntry,EFalse); }
4199 inline TInt RPointerArray<T>::InsertInOrder(const T* anEntry, TLinearOrder<T> anOrder)
4201 Inserts an object pointer into the array so that the object itself is in object
4204 The algorithm for determining the order of two class T objects is provided
4205 by a function supplied by the caller.
4207 No duplicate entries are permitted. The array remains unchanged following
4208 an attempt to insert a duplicate entry.
4210 The function assumes that the array is ordered so that the referenced objects
4211 are in object order.
4213 @param anEntry The object pointer to be inserted.
4214 @param anOrder A package encapsulating the function which determines the order
4215 of two class T objects.
4217 @return KErrNone, if the insertion is successful;
4218 KErrAlreadyExists, if an attempt is being made
4219 to insert a duplicate entry; otherwise one of the other system wide
4222 { return RPointerArrayBase::InsertIsq(anEntry,anOrder,EFalse); }
4228 inline TInt RPointerArray<T>::InsertInAddressOrderAllowRepeats(const T* anEntry)
4230 Inserts an object pointer into the array in address order, allowing duplicates.
4232 If the new object pointer is a duplicate of an existing object pointer in
4233 the array, then the new pointer is inserted after the existing one. If more
4234 than one duplicate object pointer already exists in the array, then any new
4235 duplicate pointer is inserted after the last one.
4237 The function assumes that existing object pointers within the array are in
4240 @param anEntry The object pointer to be inserted.
4242 @return KErrNone, if the insertion is successful, otherwise one of the system
4245 { return RPointerArrayBase::InsertIsqUnsigned((TUint)anEntry,ETrue); }
4251 inline TInt RPointerArray<T>::InsertInOrderAllowRepeats(const T* anEntry, TLinearOrder<T> anOrder)
4253 Inserts an object pointer into the array so that the object itself is in object
4254 order, allowing duplicates
4256 The algorithm for determining the order of two class T objects is provided
4257 by a function supplied by the caller.
4259 If the specified object is a duplicate of an existing object, then the new
4260 pointer is inserted after the pointer to the existing object. If more than
4261 one duplicate object already exists, then the new pointer is inserted after
4262 the pointer to the last one.
4264 @param anEntry The object pointer to be inserted.
4265 @param anOrder A package encapsulating the function which determines the order
4266 of two class T objects.
4268 @return KErrNone, if the insertion is successful, otherwise one of the system
4271 { return RPointerArrayBase::InsertIsq(anEntry,anOrder,ETrue); }
4276 #ifndef __KERNEL_MODE__
4278 inline RPointerArray<T>::RPointerArray(T** aEntries, TInt aCount)
4279 : RPointerArrayBase((TAny **)aEntries, aCount)
4281 C++ constructor with a pointer to the first array entry in a pre-existing
4282 array, and the number of entries in that array.
4284 This constructor takes a pointer to a pre-existing set of entries of type
4285 pointer to class T, which is owned by another RPointerArray object. Ownership
4286 of the set of entries still resides with the original RPointerArray object.
4288 @param aEntries A pointer to the first entry of type pointer to class T in
4289 the set of entries belonging to the existing array.
4290 @param aCount The number of entries in the existing array. The granularity of
4291 this array is set to this value.
4293 @panic USER 156, if aCount is not positive.
4301 inline void RPointerArray<T>::GranularCompress()
4303 Compresses the array down to a granular boundary.
4305 After a call to this function, the memory allocated to the array is sufficient
4306 for its contained object pointers. Adding new object pointers to the array
4307 does not result in a re-allocation of memory until the the total number of
4308 pointers reaches a multiple of the granularity.
4310 {RPointerArrayBase::GranularCompress();}
4316 inline TInt RPointerArray<T>::Reserve(TInt aCount)
4318 Reserves space for the specified number of elements.
4320 After a call to this function, the memory allocated to the array is sufficient
4321 to hold the number of object pointers specified. Adding new object pointers to the array
4322 does not result in a re-allocation of memory until the the total number of
4323 pointers exceeds the specified count.
4325 @param aCount The number of object pointers for which space should be reserved
4326 @return KErrNone If the operation completed successfully
4327 @return KErrNoMemory If the requested amount of memory could not be allocated
4329 { return RPointerArrayBase::DoReserve(aCount); }
4335 inline void RPointerArray<T>::SortIntoAddressOrder()
4337 Sorts the object pointers within the array into address order.
4339 { HeapSortUnsigned(); }
4345 inline void RPointerArray<T>::Sort(TLinearOrder<T> anOrder)
4347 Sorts the object pointers within the array.
4349 The sort order of the pointers is based on the order of the referenced objects.
4350 The referenced object order is determined by an algorithm supplied by the
4351 caller and packaged as a TLinerOrder<T>.
4353 @param anOrder A package encapsulating the function which determines the order
4354 of two class T objects.
4356 { HeapSort(anOrder); }
4362 inline TArray<T*> RPointerArray<T>::Array() const
4364 Constructs and returns a generic array.
4366 @return A generic array representing this array.
4370 { return TArray<T*>(GetCount,GetElementPtr,(const CBase*)this); }
4376 void RPointerArray<T>::ResetAndDestroy()
4378 Empties the array and deletes the referenced objects.
4380 It frees all memory allocated to the array and resets the internal state so
4381 that it is ready to be reused. The function also deletes all of the objects
4382 whose pointers are contained by the array.
4384 This array object can be allowed to go out of scope after a call to this function.
4388 T** pE=(T**)Entries();
4401 // Specialization for RPointerArray<TAny>
4404 Default C++ constructor.
4406 This constructs an array object for an array of TAny pointers with default
4407 granularity, which is 8.
4409 inline RPointerArray<TAny>::RPointerArray()
4410 : RPointerArrayBase()
4417 C++ constructor with granularity.
4419 This constructs an array object for an array of TAny pointers with the specified
4422 @param aGranularity The granularity of the array.
4424 @panic USER 127, if aGranularity is not positive, or greater than or equal
4427 inline RPointerArray<TAny>::RPointerArray(TInt aGranularity)
4428 : RPointerArrayBase(aGranularity)
4435 C++ constructor with minimum growth step and exponential growth factor.
4437 This constructs an array object for an array of TAny pointers with the specified
4438 minimum growth step and exponential growth factor.
4440 @param aMinGrowBy The minimum growth step of the array. Must be between 1 and
4442 @param aFactor The factor by which the array grows, multiplied by 256.
4443 For example 512 specifies a factor of 2. Must be between 257
4444 and 32767 inclusive.
4446 @panic USER 192, if aMinGrowBy<=0 or aMinGrowBy>65535.
4447 @panic USER 193, if aFactor<=257 or aFactor>32767.
4449 inline RPointerArray<TAny>::RPointerArray(TInt aMinGrowBy, TInt aFactor)
4450 : RPointerArrayBase(aMinGrowBy, aFactor)
4456 inline void RPointerArray<TAny>::Close()
4458 Closes the array and frees all memory allocated to it.
4460 The function must be called before this array object goes out of scope.
4462 Note that the function does not delete the objects whose pointers are contained
4465 {RPointerArrayBase::Close();}
4470 inline TInt RPointerArray<TAny>::Count() const
4472 Gets the number of pointers in the array.
4474 @return The number of pointers in the array.
4476 { return RPointerArrayBase::Count(); }
4481 inline TAny* const& RPointerArray<TAny>::operator[](TInt anIndex) const
4483 Gets a reference to the pointer located at the specified
4484 position within the array.
4486 The compiler chooses this option if the returned reference is used in
4487 an expression where the reference cannot be modified.
4489 @param anIndex The position of the pointer within the array. The
4490 position is relative to zero, i.e. zero implies the object
4491 pointer at the beginning of the array.
4493 @return A const reference to the pointer at position anIndex within
4496 @panic USER 130, if anIndex is negative, or is greater than the number of
4497 objects currently in the array.
4499 {return At(anIndex);}
4504 inline TAny*& RPointerArray<TAny>::operator[](TInt anIndex)
4506 Gets a reference to the pointer located at the specified
4507 position within the array.
4509 The compiler chooses this option if the returned reference is used in
4510 an expression where the reference can be modified.
4512 @param anIndex The position of the pointer within the array. The
4513 position is relative to zero, i.e. zero implies the object
4514 pointer at the beginning of the array.
4516 @return A non-const reference to the pointer at position anIndex within
4519 @panic USER 130, if anIndex is negative, or is greater than the number of
4520 objects currently in the array.
4522 {return At(anIndex);}
4527 inline TInt RPointerArray<TAny>::Append(const TAny* anEntry)
4529 Appends an pointer onto the array.
4531 @param anEntry The pointer to be appended.
4533 @return KErrNone, if the insertion is successful, otherwise one of the system
4536 { return RPointerArrayBase::Append(anEntry); }
4541 inline TInt RPointerArray<TAny>::Insert(const TAny* anEntry, TInt aPos)
4543 Inserts an pointer into the array at the specified position.
4545 @param anEntry The pointer to be inserted.
4546 @param aPos The position within the array where the pointer is to be
4547 inserted. The position is relative to zero, i.e. zero implies
4548 that a pointer is inserted at the beginning of the array.
4550 @return KErrNone, if the insertion is successful, otherwise one of the system
4553 @panic USER 131, if aPos is negative, or is greater than the number of object
4554 pointers currently in the array.
4556 { return RPointerArrayBase::Insert(anEntry,aPos); }
4561 inline void RPointerArray<TAny>::Remove(TInt anIndex)
4563 Removes the pointer at the specified position from the array.
4565 Note that the function does not delete the object whose pointer is removed.
4567 @param anIndex The position within the array from where the pointer
4568 is to be removed. The position is relative to zero, i.e. zero
4569 implies that a pointer at the beginning of the array is to be
4572 @panic USER 130, if anIndex is negative, or is greater than the number of
4573 objects currently in the array.
4575 {RPointerArrayBase::Remove(anIndex);}
4580 inline void RPointerArray<TAny>::Compress()
4582 Compresses the array down to a minimum.
4584 After a call to this function, the memory allocated to the array is just
4585 sufficient for its contained pointers.
4586 Subsequently adding a new pointer to the array
4587 always results in a re-allocation of memory.
4589 {RPointerArrayBase::Compress();}
4594 inline void RPointerArray<TAny>::Reset()
4598 It frees all memory allocated to the array and resets the internal state so
4599 that it is ready to be reused.
4601 This array object can be allowed to go out of scope after a call to this
4604 Note that the function does not delete the objects whose pointers are contained
4607 {RPointerArrayBase::Reset();}
4612 inline TInt RPointerArray<TAny>::Find(const TAny* anEntry) const
4614 Finds the first pointer in the array which matches the specified pointer, using
4615 a sequential search.
4617 Matching is based on the comparison of pointers.
4619 The find operation always starts at the low index end of the array. There
4620 is no assumption about the order of objects in the array.
4622 @param anEntry The pointer to be found.
4623 @return The index of the first matching pointer within the array.
4624 KErrNotFound, if no matching pointer can be found.
4626 { return RPointerArrayBase::Find(anEntry); }
4631 inline TInt RPointerArray<TAny>::FindReverse(const TAny* anEntry) const
4633 Finds the last pointer in the array which matches the specified pointer, using
4634 a sequential search.
4636 Matching is based on the comparison of pointers.
4638 The find operation always starts at the high index end of the array. There
4639 is no assumption about the order of objects in the array.
4641 @param anEntry The pointer to be found.
4642 @return The index of the last matching pointer within the array.
4643 KErrNotFound, if no matching pointer can be found.
4645 { return RPointerArrayBase::FindReverse(anEntry); }
4650 inline TInt RPointerArray<TAny>::FindInAddressOrder(const TAny* anEntry) const
4652 Finds the pointer in the array that matches the specified object
4653 pointer, using a binary search technique.
4655 The function assumes that pointers in the array are in address order.
4657 @param anEntry The pointer to be found.
4659 @return The index of the matching pointer within the array or KErrNotFound
4660 if no suitable pointer can be found.
4662 { return RPointerArrayBase::FindIsqUnsigned((TUint)anEntry); }
4667 inline TInt RPointerArray<TAny>::FindInAddressOrder(const TAny* anEntry, TInt& anIndex) const
4669 Finds the pointer in the array that matches the specified object
4670 pointer, using a binary search technique.
4672 The function assumes that pointers in the array are in address order.
4674 @param anEntry The pointer to be found.
4675 @param anIndex A TInt supplied by the caller. On return, contains an index
4677 If the function returns KErrNone, this is the index of the
4678 matching pointer within the array.
4679 If the function returns KErrNotFound, this is the index of the
4680 last pointer within the array which logically
4683 @return KErrNone, if a matching pointer is found.
4684 KErrNotFound, if no suitable pointer can be found.
4686 { return RPointerArrayBase::BinarySearchUnsigned((TUint)anEntry,anIndex); }
4691 inline TInt RPointerArray<TAny>::SpecificFindInAddressOrder(const TAny* anEntry, TInt aMode) const
4693 Finds the pointer in the array that matches the specified pointer, using a
4694 binary search technique.
4696 Where there is more than one matching element, it finds the first, the last
4697 or any matching element as specified by the value of aMode.
4699 The function assumes that pointers in the array are in address order.
4701 @param anEntry The pointer to be found.
4702 @param aMode Specifies whether to find the first match, the last match or
4703 any match, as defined by one of the TArrayFindMode enum values.
4705 @return KErrNotFound, if there is no matching element, otherwise the array
4706 index of a matching element - what the index refers to depends on the
4708 if this is EArrayFindMode_First, then the index refers to the first matching element;
4709 if this is EArrayFindMode_Any, then the index can refer to any of the matching elements;
4710 if this is EArrayFindMode_Last, then the index refers to first element that follows
4711 the last matching element - if the last matching element is also the last element of
4712 the array, then the index value is the same as the total number of elements in the array.
4716 { return RPointerArrayBase::FindIsqUnsigned((TUint)anEntry, aMode); }
4721 inline TInt RPointerArray<TAny>::SpecificFindInAddressOrder(const TAny* anEntry, TInt& anIndex, TInt aMode) const
4723 Finds the pointer in the array that matches the specified pointer, using a
4724 binary search technique.
4726 Where there is more than one matching element, it finds the first, the last
4727 or any matching element as specified by the value of aMode.
4729 The function assumes that pointers in the array are in address order.
4731 @param anEntry The pointer to be found.
4732 @param anIndex A TInt type supplied by the caller. On return, it contains an
4733 index value depending on whether a match is found and on the
4735 If there is no matching element in the array, then this is
4736 the index of the first element in the array that is bigger than
4737 the element being searched for - if no elements in the array are
4738 bigger, then the index value is the same as the total number of
4739 elements in the array. If there is a matching element, then what
4740 the index refers to depends on the value of aMode:
4741 if this is EArrayFindMode_First, then the index refers to the first matching element;
4742 if this is EArrayFindMode_Any, then the index can refer to any of the matching elements;
4743 if this is EArrayFindMode_Last, then the index refers to first element that follows the
4744 last matching element - if the last matching element is also the last element of the array,
4745 then the index value is the same as the total number of elements in the array.
4747 @param aMode Specifies whether to find the first match, the last match or any
4748 match, as defined by one of the TArrayFindMode enum values.
4750 @return KErrNone, if a matching pointer is found.
4751 KErrNotFound, if no suitable pointer can be found.
4755 { return RPointerArrayBase::BinarySearchUnsigned((TUint)anEntry,anIndex,aMode); }
4760 inline TInt RPointerArray<TAny>::InsertInAddressOrder(const TAny* anEntry)
4762 Inserts an pointer into the array in address order.
4764 No duplicate entries are permitted. The array remains unchanged following
4765 an attempt to insert a duplicate entry.
4767 The function assumes that existing pointers within the array are in
4770 @param anEntry The pointer to be inserted.
4772 @return KErrNone, if the insertion is successful;
4773 KErrAlreadyExists, if an attempt is being made
4774 to insert a duplicate entry; otherwise one of the other system wide
4777 { return RPointerArrayBase::InsertIsqUnsigned((TUint)anEntry,EFalse); }
4782 inline TInt RPointerArray<TAny>::InsertInAddressOrderAllowRepeats(const TAny* anEntry)
4784 Inserts an pointer into the array in address order, allowing duplicates.
4786 If the new pointer is a duplicate of an existing pointer in
4787 the array, then the new pointer is inserted after the existing one. If more
4788 than one duplicate pointer already exists in the array, then any new
4789 duplicate pointer is inserted after the last one.
4791 The function assumes that existing pointers within the array are in
4794 @param anEntry The pointer to be inserted.
4796 @return KErrNone, if the insertion is successful, otherwise one of the system
4799 { return RPointerArrayBase::InsertIsqUnsigned((TUint)anEntry,ETrue); }
4804 #ifndef __KERNEL_MODE__
4805 inline RPointerArray<TAny>::RPointerArray(TAny** aEntries, TInt aCount)
4806 : RPointerArrayBase((TAny **)aEntries, aCount)
4808 C++ constructor with a pointer to the first array entry in a pre-existing
4809 array, and the number of entries in that array.
4811 This constructor takes a pointer to a pre-existing set of entries of type TAny*,
4812 which is owned by another RPointerArray object. Ownership of the set of entries
4813 still resides with the original RPointerArray object.
4815 @param aEntries A pointer to the first entry of type TAny* in the set of entries
4816 belonging to the existing array.
4817 @param aCount The number of entries in the existing array. The granularity of
4818 this array is set to this value.
4820 @panic USER 156, if aCount is not positive.
4827 inline void RPointerArray<TAny>::GranularCompress()
4829 Compresses the array down to a granular boundary.
4831 After a call to this function, the memory allocated to the array is sufficient
4832 for its contained pointers. Adding new pointers to the array
4833 does not result in a re-allocation of memory until the the total number of
4834 pointers reaches a multiple of the granularity.
4836 {RPointerArrayBase::GranularCompress();}
4841 inline void RPointerArray<TAny>::SortIntoAddressOrder()
4843 Sorts the pointers within the array into address order.
4845 { HeapSortUnsigned(); }
4850 inline TArray<TAny*> RPointerArray<TAny>::Array() const
4852 Constructs and returns a generic array.
4854 @return A generic array representing this array.
4858 { return TArray<TAny*>(GetCount,GetElementPtr,(const CBase*)this); }
4864 inline RArray<T>::RArray()
4865 : RArrayBase(sizeof(T))
4867 Default C++ constructor.
4869 This constructs an array object for an array of type class T objects with
4870 default granularity and key offset value. The default granularity is 8 and
4871 the defaul key offset value is zero.
4873 @panic USER 129, if the size of class T is not positive or is not less
4882 inline RArray<T>::RArray(TInt aGranularity)
4883 : RArrayBase(sizeof(T),aGranularity)
4885 C++ constructor with granularity.
4887 This constructs an array object for an array of type class T objects with
4888 a specified granularity and default key offset value. The default key offset
4891 @param aGranularity The granularity of the array.
4893 @panic USER 129, if the size of class T is not positive or is not less
4895 @panic USER 127, if aGranularity is not positive or the product of this
4896 value and the size of class T is not less than 0x10000000.
4904 inline RArray<T>::RArray(TInt aGranularity, TInt aKeyOffset)
4905 : RArrayBase(sizeof(T),aGranularity,aKeyOffset)
4907 C++ constructor with granularity and key offset.
4909 This constructs an array object for an array of type class T objects with
4910 a specified granularity and a specified key offset value.
4912 @param aGranularity The granularity of the array.
4913 @param aKeyOffset The key offset.
4915 @panic USER 129, if the size of class T is not positive or is not less
4917 @panic USER 127, if aGranularity is not positive or the product of this
4918 value and the size of class T is not less than 0x10000000.
4919 @panic USER 128, if aKeyOffset is not positive, or is not less than the
4920 size of class T, or is not a multiple of 4.
4928 C++ constructor with minimum growth step and exponential growth factor.
4930 This constructs an array object for an array of class T objects with the
4931 specified minimum growth step and exponential growth factor.
4933 @param aMinGrowBy The minimum growth step of the array. Must be between 1 and
4935 @param aKeyOffset The key offset.
4936 @param aFactor The factor by which the array grows, multiplied by 256.
4937 For example 512 specifies a factor of 2. Must be between 257
4938 and 32767 inclusive.
4940 @panic USER 129, if the size of class T is not positive or is not less than 640.
4941 @panic USER 128, if aKeyOffset is negative, or is not less than the
4942 size of class T, or is not a multiple of 4.
4943 @panic USER 192, if aMinGrowBy<=0 or aMinGrowBy>65535.
4944 @panic USER 193, if aFactor<=257 or aFactor>32767.
4947 inline RArray<T>::RArray(TInt aMinGrowBy, TInt aKeyOffset, TInt aFactor)
4948 : RArrayBase(sizeof(T), aMinGrowBy, aKeyOffset, aFactor)
4955 inline RArray<T>::RArray(TInt aEntrySize,T* aEntries, TInt aCount)
4956 : RArrayBase(aEntrySize,aEntries,aCount)
4958 C++ constructor with size of entry, a pointer to the first array entry in a
4959 pre-existing array, and the number of entries in that array.
4961 This constructor takes a pointer to a pre-existing set of entries of type
4962 class T objects owned by another RArray object. Ownership of the set of entries
4963 still resides with the original RArray object.
4965 This array is assigned a default granularity and key offset value. The default
4966 granularity is 8 and the default key offset value is zero.
4968 The purpose of constructing an array in this way is to allow sorting and
4969 finding operations to be done without further allocation of memory.
4971 @param aEntrySize The size of an entry in the existing array.
4972 @param aEntries A pointer to the first entry of type class T in the set of
4973 entries belonging to the existing array.
4974 @param aCount The number of entries in the existing array.
4976 @panic USER 129, if aEntrySize is not positive or is not less than 640.
4977 @panic USER 156, if aCount is not positive.
4985 inline void RArray<T>::Close()
4987 Closes the array and frees all memory allocated to the array.
4989 The function must be called before this array object is destroyed.
4991 {RArrayBase::Close();}
4997 inline TInt RArray<T>::Count() const
4999 Gets the number of objects in the array.
5001 @return The number of objects in the array.
5003 {return RArrayBase::Count();}
5009 inline const T& RArray<T>::operator[](TInt anIndex) const
5011 Gets a reference to an object located at a specified position within the array.
5013 The compiler chooses this function if the returned reference is used in an
5014 expression where the reference cannot be modified.
5016 @param anIndex The position of the object within the array. The position is
5017 relative to zero, i.e. zero implies the object at the beginning
5020 @return A const reference to the object at position anIndex within the array.
5022 @panic USER 130, if anIndex is negative or is greater than the number of
5023 objects currently in the array
5025 {return *(const T*)At(anIndex); }
5031 inline T& RArray<T>::operator[](TInt anIndex)
5033 Gets a reference to an object located at a specified position within the array.
5035 The compiler chooses this function if the returned reference is used in an
5036 expression where the reference can be modified.
5038 @param anIndex The position of the object within the array. The position is
5039 relative to zero, i.e. zero implies the object at the beginning
5042 @return A non-const reference to the object at position anIndex within the array.
5044 @panic USER 130, if anIndex is negative or is greater than the number of
5045 objects currently in the array
5047 {return *(T*)At(anIndex); }
5053 inline TInt RArray<T>::Append(const T& anEntry)
5055 Apends an object onto the array.
5057 @param anEntry A reference to the object of type class T to be appended.
5059 @return KErrNone, if the insertion is successful, otherwise one of the system
5062 {return RArrayBase::Append(&anEntry);}
5068 inline TInt RArray<T>::Insert(const T& anEntry, TInt aPos)
5070 Inserts an object into the array at a specified position.
5072 @param anEntry The class T object to be inserted.
5073 @param aPos The position within the array where the object is to
5074 be inserted. The position is relative to zero, i.e. zero
5075 implies that an object is inserted at the beginning of
5078 @return KErrNone, if the insertion is successful, otherwise one of the system
5081 @panic USER 131, if aPos is negative or is greater than the number of objects
5082 currently in the array.
5084 {return RArrayBase::Insert(&anEntry,aPos);}
5090 inline void RArray<T>::Remove(TInt anIndex)
5092 Removes the object at a specified position from the array.
5094 @param anIndex The position within the array from where the object is to be
5095 removed. The position is relative to zero, i.e. zero implies
5096 that an object at the beginning of the array is to be removed.
5098 @panic USER 130, if anIndex is negative or is greater than the number of
5099 objects currently in the array.
5101 {RArrayBase::Remove(anIndex);}
5107 inline void RArray<T>::Compress()
5109 Compresses the array down to a minimum.
5111 After a call to this function, the memory allocated to the array is just
5112 sufficient for its contained objects. Subsequently adding a new object to the
5113 array always results in a re-allocation of memory.
5115 {RArrayBase::Compress();}
5121 inline void RArray<T>::Reset()
5123 Empties the array, so that it is ready to be reused.
5125 The function frees all memory allocated to the array and resets the internal
5126 state so that it is ready to be reused.
5128 This array object can be allowed to go out of scope after a call to this function.
5130 {RArrayBase::Reset();}
5136 inline TInt RArray<T>::Find(const T& anEntry) const
5138 Finds the first object in the array which matches the specified object using
5139 a sequential search.
5141 Matching is based on the comparison of a TInt value at the key offset position
5144 For classes which define their own equality operator (==), the alternative method
5145 Find(const T& anEntry, TIdentityRelation<T> anIdentity) is recommended.
5147 The find operation always starts at the low index end of the array. There
5148 is no assumption about the order of objects in the array.
5150 @param anEntry A reference to an object of type class T to be used for matching.
5152 @return The index of the first matching object within the array.
5153 KErrNotFound, if no matching object can be found.
5155 {return RArrayBase::Find(&anEntry);}
5161 inline TInt RArray<T>::Find(const T& anEntry, TIdentityRelation<T> anIdentity) const
5163 Finds the first object in the array which matches the specified object using
5164 a sequential search and a matching algorithm.
5166 The algorithm for determining whether two class T type objects match is provided
5167 by a function supplied by the caller.
5169 Such a function need not be supplied if an equality operator (==) is defined for class T.
5170 In this case, default construction of anIdentity provides matching, as in the example below:
5173 //Construct a TPoint and append to an RArray<TPoint>
5175 RArray<TPoint> points;
5177 //Find position of p1 in points using TIdentityRelation<TPoint> default construction
5178 TInt r = points.Find(p1, TIdentityRelation<TPoint>());
5181 The find operation always starts at the low index end of the array. There
5182 is no assumption about the order of objects in the array.
5184 @param anEntry A reference to an object of type class T to be used
5186 @param anIdentity A package encapsulating the function which determines whether
5187 two class T type objects match.
5189 @return The index of the first matching object within the array.
5190 KErrNotFound, if no matching object can be found.
5192 {return RArrayBase::Find(&anEntry,anIdentity);}
5198 inline TInt RArray<T>::FindReverse(const T& anEntry) const
5200 Finds the last object in the array which matches the specified object using
5201 a sequential search.
5203 Matching is based on the comparison of a TInt value at the key offset position
5206 For classes which define their own equality operator (==), the alternative method
5207 FindReverse(const T& anEntry, TIdentityRelation<T> anIdentity) is recommended.
5209 The find operation always starts at the high index end of the array. There
5210 is no assumption about the order of objects in the array.
5212 @param anEntry A reference to an object of type class T to be used for matching.
5214 @return The index of the last matching object within the array.
5215 KErrNotFound, if no matching object can be found.
5217 {return RArrayBase::FindReverse(&anEntry);}
5223 inline TInt RArray<T>::FindReverse(const T& anEntry, TIdentityRelation<T> anIdentity) const
5225 Finds the last object in the array which matches the specified object using
5226 a sequential search and a matching algorithm.
5228 The algorithm for determining whether two class T type objects match is provided
5229 by a function supplied by the caller.
5231 Such a function need not be supplied if an equality operator (==) is defined for class T.
5232 In this case, default construction of anIdentity provides matching.
5234 See Find(const T& anEntry, TIdentityRelation<T> anIdentity) for more details.
5236 The find operation always starts at the high index end of the array. There
5237 is no assumption about the order of objects in the array.
5239 @param anEntry A reference to an object of type class T to be used
5241 @param anIdentity A package encapsulating the function which determines whether
5242 two class T type objects match.
5244 @return The index of the last matching object within the array.
5245 KErrNotFound, if no matching object can be found.
5247 {return RArrayBase::FindReverse(&anEntry,anIdentity);}
5253 inline TInt RArray<T>::FindInSignedKeyOrder(const T& anEntry) const
5255 Finds the object in the array which matches the specified object using a binary
5258 The function assumes that existing objects within the array are in signed
5261 @param anEntry A reference to an object of type class T to be used for matching.
5263 @return The index of the matching object within the array, or KErrNotFound
5264 if no matching object can be found.
5266 {return RArrayBase::FindIsqSigned(&anEntry);}
5272 inline TInt RArray<T>::FindInUnsignedKeyOrder(const T& anEntry) const
5274 Finds the object in the array which matches the specified object using a binary
5277 The function assumes that existing objects within the array are in unsigned
5280 @param anEntry A reference to an object of type class T to be used for matching.
5282 @return The index of the matching object within the array, or KErrNotFound
5283 if no matching object can be found.
5285 {return RArrayBase::FindIsqUnsigned(&anEntry);}
5291 inline TInt RArray<T>::FindInOrder(const T& anEntry, TLinearOrder<T> anOrder) const
5293 Finds the object in the array which matches the specified object using a binary
5294 search technique and an ordering algorithm.
5296 The function assumes that existing objects within the array are in object
5297 order as determined by an algorithm supplied by the caller and packaged as
5300 @param anEntry A reference to an object of type class T to be used for matching.
5301 @param anOrder A package encapsulating the function which determines the order
5302 of two class T objects.
5304 @return The index of the matching object within the array, or KErrNotFound if
5305 no matching object can be found.
5307 {return RArrayBase::FindIsq(&anEntry,anOrder);}
5313 inline TInt RArray<T>::FindInSignedKeyOrder(const T& anEntry, TInt& anIndex) const
5315 Finds the object in the array which matches the specified object using a binary
5318 The function assumes that existing objects within the array are in signed
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 KErrNone,
5323 this is the index of the matching object within the array.
5324 If the function returns KErrNotFound, this is the index of the
5325 first element in the array whose key is bigger than the key of the
5326 element being sought. If there are no elements in the array with
5327 a bigger key, then the index value is the same as the total
5328 number of elements in the array.
5329 @return KErrNone if a matching object is found, or KErrNotFound if no matching
5330 object can be found.
5332 {return RArrayBase::BinarySearchSigned(&anEntry,anIndex);}
5338 inline TInt RArray<T>::FindInUnsignedKeyOrder(const T& anEntry, TInt& anIndex) const
5340 Finds the object in the array which matches the specified object using a binary
5343 The function assumes that existing objects within the array are in unsigned
5346 @param anEntry A reference to an object of type class T to be used for matching.
5347 @param anIndex On return contains an index value. If the function returns
5348 KErrNone, this is the index of the matching object within the
5350 If the function returns KErrNotFound, this is the index of the
5351 first element in the array whose key is bigger than the key of the
5352 element being sought. If there are no elements in the array with
5353 a bigger key, then the index value is the same as the total
5354 number of elements in the array.
5355 @return KErrNone if a matching object is found, or KErrNotFound if no matching
5356 object can be found.
5358 {return RArrayBase::BinarySearchUnsigned(&anEntry,anIndex);}
5364 inline TInt RArray<T>::FindInOrder(const T& anEntry, TInt& anIndex, TLinearOrder<T> anOrder) const
5366 Finds the object in the array which matches the specified object using a binary
5367 search technique and an ordering algorithm.
5369 The function assumes that existing objects within the array are in object
5370 order as determined by an algorithm supplied by the caller and packaged as
5373 @param anEntry A reference to an object of type class T to be used for matching.
5374 @param anIndex On return contains an index value. If the function returns
5375 KErrNone, this is the index of the matching object within the
5377 If the function returns KErrNotFound, this is the index of the
5378 first element in the array that is bigger than the element being
5379 searched for - if no elements in the array are bigger, then
5380 the index value is the same as the total number of elements in
5382 @param anOrder A package encapsulating the function which determines the order
5383 of two class T objects.
5385 @return KErrNone if a matching object is found. KErrNotFound if no matching
5386 object can be found.
5388 {return RArrayBase::BinarySearch(&anEntry,anIndex,anOrder);}
5394 inline TInt RArray<T>::SpecificFindInSignedKeyOrder(const T& anEntry, TInt aMode) const
5396 Finds the object in the array which matches the specified object using a binary
5399 The element ordering is determined by a signed 32-bit word
5400 (the key) embedded in each array element. In the case that there is more than
5401 one matching element, finds the first, last or any match as specified by
5404 The function assumes that existing objects within the array are in signed
5407 @param anEntry A reference to an object of type class T to be used for matching.
5408 @param aMode Specifies whether to find the first match, the last match or
5409 any match, as defined by one of the TArrayFindMode enum values.
5411 @return KErrNotFound, if there is no matching element, otherwise the array
5412 index of a matching element - what the index refers to depends on the
5414 if this is EArrayFindMode_First, then the index refers to the first matching element;
5415 if this is EArrayFindMode_Any, then the index can refer to any of the matching elements;
5416 if this is EArrayFindMode_Last, then the index refers to first element that follows
5417 the last matching element - if the last matching element is also the last element of
5418 the array, then the index value is the same as the total number of elements in the array.
5422 {return RArrayBase::FindIsqSigned(&anEntry,aMode);}
5428 inline TInt RArray<T>::SpecificFindInUnsignedKeyOrder(const T& anEntry, TInt aMode) const
5430 Finds the object in the array which matches the specified object using a binary
5433 The element ordering is determined by an unsigned 32-bit word
5434 (the key) embedded in each array element. Where there is more than
5435 one matching element, it finds the first, last or any matching element
5436 as specified by the value of aMode.
5438 The function assumes that existing objects within the array are in unsigned
5441 @param anEntry A reference to an object of type class T to be used for matching.
5442 @param aMode Specifies whether to find the first match, the last match or
5443 any match, as defined by one of the TArrayFindMode enum values.
5445 @return KErrNotFound, if there is no matching element, otherwise the array
5446 index of a matching element - what the index refers to depends on the
5448 if this is EArrayFindMode_First, then the index refers to the first matching element;
5449 if this is EArrayFindMode_Any, then the index can refer to any of the matching elements;
5450 if this is EArrayFindMode_Last, then the index refers to first element that follows the
5451 last matching element - if the last matching element is also the last element of the array,
5452 then the index value is the same as the total number of elements in the array.
5456 {return RArrayBase::FindIsqUnsigned(&anEntry,aMode);}
5462 inline TInt RArray<T>::SpecificFindInOrder(const T& anEntry, TLinearOrder<T> anOrder, TInt aMode) const
5464 Finds the object in the array which matches the specified object using a binary
5465 search technique and an ordering algorithm.
5467 Where there is more than one matching element, it finds the first, the last
5468 or any matching element as specified by the value of aMode.
5470 The function assumes that existing objects within the array are in object
5471 order as determined by an algorithm supplied by the caller and packaged as
5472 a TLinearOrder<T> type.
5474 @param anEntry A reference to an object of type class T to be used for matching.
5475 @param anOrder A package encapsulating the function which determines the order
5476 of two class T objects.
5477 @param aMode Specifies whether to find the first match, the last match or any
5478 match, as defined by one of the TArrayFindMode enum values.
5480 @return KErrNotFound, if there is no matching element, otherwise the array index
5481 of a matching element - what the index refers to depends on the value of
5483 if this is EArrayFindMode_First, then the index refers to the first matching element;
5484 if this is EArrayFindMode_Any, then the index can refer to any of the matching elements;
5485 if this is EArrayFindMode_Last, then the index refers to first element that follows
5486 the last matching element - if the last matching element is also the last element of
5487 the array, then the index value is the same as the total number of elements in the array.
5489 {return RArrayBase::FindIsq(&anEntry,anOrder,aMode);}
5495 inline TInt RArray<T>::SpecificFindInSignedKeyOrder(const T& anEntry, TInt& anIndex, TInt aMode) const
5497 Finds the object in the array which matches the specified object using a binary
5500 The element ordering is determined by a signed 32-bit word
5501 (the key) embedded in each array element. Where there is more than
5502 one matching element, finds the first, last or any matching element as
5503 specified specified by the value of aMode.
5505 The function assumes that existing objects within the array are in signed
5508 @param anEntry A reference to an object of type class T to be used for matching.
5509 @param anIndex A TInt type supplied by the caller. On return, it contains
5510 an index value depending on whether a match is found and on the
5511 value of aMode. If there is no matching element in the array,
5512 then this is the index of the first element in the array that
5513 is bigger than the element being searched for - if no elements
5514 in the array are bigger, then the index value is the same as the
5515 total number of elements in the array. If there is a matching
5516 element, then what the index refers to depends on the value of aMode:
5517 if this is EArrayFindMode_First, then the index refers to the first matching element;
5518 if this is EArrayFindMode_Any, then the index can refer to any of the matching elements;
5519 if this is EArrayFindMode_Last, then the index refers to first element that follows
5520 the last matching element - if the last matching element is also the last element of
5521 the array, then the index value is the same as the total number of elements in the array.
5522 @param aMode Specifies whether to find the first match, the last match or any match,
5523 as defined by one of the TArrayFindMode enum values.
5525 @return KErrNone, if a matching object pointer is found;
5526 KErrNotFound, if no suitable object pointer can be found.
5528 {return RArrayBase::BinarySearchSigned(&anEntry,anIndex,aMode);}
5534 inline TInt RArray<T>::SpecificFindInUnsignedKeyOrder(const T& anEntry, TInt& anIndex, TInt aMode) const
5536 Finds the object in the array which matches the specified object using a binary
5539 The element ordering is determined by an unsigned 32-bit word
5540 (the key) embedded in each array element. Where there is more than
5541 one matching element, it finds the first, last or any matching element as
5542 specified by the value of aMode.
5544 The function assumes that existing objects within the array are in unsigned
5547 @param anEntry A reference to an object of type class T to be used for matching.
5548 @param anIndex A TInt type supplied by the caller. On return, it contains an index
5549 value depending on whether a match is found and on the value of aMode.
5550 If there is no matching element in the array, then this is the index
5551 of the first element in the array that is bigger than the element
5552 being searched for - if no elements in the array are bigger, then
5553 the index value is the same as the total number of elements in the array.
5554 If there is a matching element, then what the index refers to depends on
5556 if this is EArrayFindMode_First, then the index refers to the first matching element;
5557 if this is EArrayFindMode_Any, then the index can refer to any of the matching elements;
5558 if this is EArrayFindMode_Last, then the index refers to first element that follows the
5559 last matching element - if the last matching element is also the last element of the array,
5560 then the index value is the same as the total number of elements in the array.
5561 @param aMode Specifies whether to find the first match, the last match or any match, as defined by one
5562 of the TArrayFindMode enum values.
5563 @return KErrNone, if a matching object pointer is found; KErrNotFound, if no suitable object pointer can be found.
5567 {return RArrayBase::BinarySearchUnsigned(&anEntry,anIndex,aMode);}
5573 inline TInt RArray<T>::SpecificFindInOrder(const T& anEntry, TInt& anIndex, TLinearOrder<T> anOrder, TInt aMode) const
5575 Finds the object in the array which matches the specified object using a binary
5576 search technique and a specified ordering algorithm.
5578 Where there is more than one matching element, it finds the first, the last or
5579 any matching element as specified by the value of aMode.
5581 The function assumes that existing objects within the array are in object
5582 order as determined by an algorithm supplied by the caller and packaged as
5583 a TLinearOrder<T> type.
5585 @param anEntry A reference to an object of type class T to be used for matching.
5586 @param anIndex A TInt type supplied by the caller. On return, it contains
5587 an index value depending on whether a match is found and on the
5588 value of aMode. If there is no matching element in the array,
5589 then this is the index of the first element in the array that
5590 is bigger than the element being searched for - if no elements
5591 in the array are bigger, then the index value is the same as
5592 the total number of elements in the array.
5593 If there is a matching element, then what the index refers to
5594 depends on the value of aMode:
5595 if this is EArrayFindMode_First, then the index refers to the first matching element;
5596 if this is EArrayFindMode_Any, then the index can refer to any of the matching elements;
5597 if this is EArrayFindMode_Last, then the index refers to first element that follows
5598 the last matching element - if the last matching element is also
5599 the last element of the array, then the index value is the same as
5600 the total number of elements in the array.
5601 @param anOrder A package encapsulating the function which determines the order
5602 of two class T objects.
5603 @param aMode Specifies whether to find the first match, the last match or any match,
5604 as defined by one of the TArrayFindMode enum values.
5605 @return KErrNone, if a matching object pointer is found;
5606 KErrNotFound, if no suitable object pointer can be found.
5609 {return RArrayBase::BinarySearch(&anEntry,anIndex,anOrder,aMode);}
5615 inline TInt RArray<T>::InsertInSignedKeyOrder(const T& anEntry)
5617 Inserts an object into the array in ascending signed key order.
5619 The order of two class T type objects is based on comparing a TInt value
5620 located at the key offset position within the class T object.
5622 No duplicate entries are permitted. The array remains unchanged following
5623 an attempt to insert a duplicate entry.
5625 @param anEntry A reference to the object of type class T to be inserted.
5627 @return KErrNone, if the insertion is successful;
5628 KErrAlreadyExists, if an attempt is being made
5629 to insert a duplicate entry; otherwise one of the other system wide
5632 {return RArrayBase::InsertIsqSigned(&anEntry,EFalse);}
5638 inline TInt RArray<T>::InsertInUnsignedKeyOrder(const T& anEntry)
5640 Inserts an object into the array in ascending unsigned key order.
5642 The order of two class T type objects is based on comparing a TUint value
5643 located at the key offset position within the class T object.
5645 No duplicate entries are permitted. The array remains unchanged following
5646 an attempt to insert a duplicate entry.
5648 @param anEntry A reference to the object of type class T to be inserted.
5650 @return KErrNone, if the insertion is successful;
5651 KErrAlreadyExists, if an attempt is being made
5652 to insert a duplicate entry; otherwise one of the other system wide
5655 {return RArrayBase::InsertIsqUnsigned(&anEntry,EFalse);}
5661 inline TInt RArray<T>::InsertInOrder(const T& anEntry, TLinearOrder<T> anOrder)
5663 Inserts an object of into the array in object order.
5665 The algorithm for determining the order of two class T type objects is provided
5666 by a function supplied by the caller.
5668 No duplicate entries are permitted. The array remains unchanged following
5669 an attempt to insert a duplicate entry.
5671 The function assumes that existing objects within the array are in object
5674 @param anEntry A reference to the object of type class T to be inserted.
5675 @param anOrder A package encapsulating the function which determines the order
5676 of two class T objects.
5678 @return KErrNone, if the insertion is successful;
5679 KErrAlreadyExists, if an attempt is being made
5680 to insert a duplicate entry; otherwise one of the other system wide
5683 {return RArrayBase::InsertIsq(&anEntry,anOrder,EFalse);}
5689 inline TInt RArray<T>::InsertInSignedKeyOrderAllowRepeats(const T& anEntry)
5691 Inserts an object into the array in ascending signed key order,
5692 allowing duplicates.
5694 The order of two class T type objects is based on comparing a TInt value
5695 located at the key offset position within the class T object.
5697 If anEntry is a duplicate of an existing object in the array, then the new
5698 object is inserted after the existing object. If more than one duplicate object
5699 already exists in the array, then any new duplicate object is inserted after
5702 @param anEntry A reference to the object of type class T to be inserted.
5704 @return KErrNone, if the insertion is successful, otherwise one of the system
5707 {return RArrayBase::InsertIsqSigned(&anEntry,ETrue);}
5713 inline TInt RArray<T>::InsertInUnsignedKeyOrderAllowRepeats(const T& anEntry)
5715 Inserts an object into the array in ascending unsigned key order, allowing
5718 The order of two class T type objects is based on comparing a TUint value
5719 located at the key offset position within the class T object.
5721 If anEntry is a duplicate of an existing object in the array, then the new
5722 object is inserted after the existing object. If more than one duplicate object
5723 already exists in the array, then any new duplicate object is inserted after
5726 @param anEntry A reference to the object of type class T to be inserted.
5728 @return KErrNone, if the insertion is successful, otherwise one of the system
5731 {return RArrayBase::InsertIsqUnsigned(&anEntry,ETrue);}
5737 inline TInt RArray<T>::InsertInOrderAllowRepeats(const T& anEntry, TLinearOrder<T> anOrder)
5739 Inserts an object into the array in object order, allowing duplicates.
5741 The algorithm for determining the order of two class T type objects is provided
5742 by a function supplied by the caller.
5744 If anEntry is a duplicate of an existing object in the array, then the new
5745 object is inserted after the existing object. If more than one duplicate object
5746 already exists in the array, then anEntry is inserted after the last one.
5748 The function assumes that existing objects within the array are in object
5751 @param anEntry A reference to the object of type class T to be inserted.
5752 @param anOrder A package encapsulating the function which determines the order
5753 of two class T objects.
5755 @return KErrNone, if the insertion is successful, otherwise one of the system
5758 {return RArrayBase::InsertIsq(&anEntry,anOrder,ETrue);}
5762 #ifndef __KERNEL_MODE__
5765 inline void RArray<T>::GranularCompress()
5767 Compresses the array down to a granular boundary.
5769 After a call to this function, the memory allocated to the array is sufficient
5770 for its contained objects. Adding new objects to the array does not result
5771 in a re-allocation of memory until the the total number of objects reaches
5772 a multiple of the granularity.
5774 {RArrayBase::GranularCompress();}
5780 inline TInt RArray<T>::Reserve(TInt aCount)
5782 Reserves space for the specified number of elements.
5784 After a call to this function, the memory allocated to the array is sufficient
5785 to hold the number of objects specified. Adding new objects to the array
5786 does not result in a re-allocation of memory until the the total number of
5787 objects exceeds the specified count.
5789 @param aCount The number of objects for which space should be reserved
5790 @return KErrNone If the operation completed successfully
5791 @return KErrNoMemory If the requested amount of memory could not be allocated
5793 { return RArrayBase::DoReserve(aCount); }
5799 inline void RArray<T>::SortSigned()
5801 Sorts the objects within the array; the sort order is assumed to be in signed
5810 inline void RArray<T>::SortUnsigned()
5812 Sorts the objects within the array; the sort order is assumed to be in unsigned
5815 {HeapSortUnsigned();}
5821 inline void RArray<T>::Sort(TLinearOrder<T> anOrder)
5823 Sorts the objects within the array using the specified TLinearOrder.
5825 The sort order is determined by an algorithm supplied by the caller and
5826 packaged as a TLinerOrder<T>.
5828 @param anOrder A package encapsulating the function which determines the order
5829 of two class T type objects.
5831 {HeapSort(anOrder);}
5837 inline TArray<T> RArray<T>::Array() const
5839 Constructs and returns a generic array.
5841 @return A generic array representing this array.
5843 { return TArray<T>(GetCount,GetElementPtr,(const CBase*)this); }
5849 inline RArray<TInt>::RArray()
5850 : RPointerArrayBase()
5852 Constructs an array object for an array of signed integers with
5853 default granularity.
5855 The default granularity is 8.
5862 inline RArray<TInt>::RArray(TInt aGranularity)
5863 : RPointerArrayBase(aGranularity)
5865 Constructs an array object for an array of signed integers with the specified
5868 @param aGranularity The granularity of the array.
5870 @panic USER 127, if aGranularity is not positive or is greater than or
5871 equal to 0x10000000.
5879 C++ constructor with minimum growth step and exponential growth factor.
5881 This constructs an array object for an array of signed integers with the
5882 specified minimum growth step and exponential growth factor.
5884 @param aMinGrowBy The minimum growth step of the array. Must be between 1 and
5886 @param aFactor The factor by which the array grows, multiplied by 256.
5887 For example 512 specifies a factor of 2. Must be between 257
5888 and 32767 inclusive.
5890 @panic USER 192, if aMinGrowBy<=0 or aMinGrowBy>65535.
5891 @panic USER 193, if aFactor<=257 or aFactor>32767.
5893 inline RArray<TInt>::RArray(TInt aMinGrowBy, TInt aFactor)
5894 : RPointerArrayBase(aMinGrowBy, aFactor)
5900 inline void RArray<TInt>::Close()
5902 Closes the array and frees all memory allocated to the array.
5904 The function must be called before this array object goes out of scope.
5906 {RPointerArrayBase::Close();}
5911 inline TInt RArray<TInt>::Count() const
5913 Gets the number of signed integers in the array.
5915 @return The number of signed integers in the array.
5917 { return RPointerArrayBase::Count(); }
5922 inline const TInt& RArray<TInt>::operator[](TInt anIndex) const
5924 Gets a reference to the signed integer located at a specified position within
5927 The compiler chooses this function if the returned reference is used in an
5928 expression where the reference cannot be modified.
5930 @param anIndex The position of the signed integer within the array. The
5931 position is relative to zero, i.e. zero implies the entry
5932 at the beginning of the array.
5934 @return A const reference to the signed integer at position anIndex within
5937 @panic USER 130, if anIndex is negative, or is greater than the number of
5938 entries currently in the array.
5940 {return (const TInt&)At(anIndex);}
5945 inline TInt& RArray<TInt>::operator[](TInt anIndex)
5947 Gets a reference to the signed integer located at a specified position within
5950 The compiler chooses this function if the returned reference is used in an
5951 expression where the reference can be modified.
5953 @param anIndex The position of the signed integer within the array. The
5954 position is relative to zero, i.e. zero implies the entry
5955 at the beginning of the array.
5957 @return A non-const reference to the signed integer at position anIndex within
5960 @panic USER 130, if anIndex is negative, or is greater than the number of
5961 entries currently in the array.
5963 {return (TInt&)At(anIndex);}
5968 inline TInt RArray<TInt>::Append(TInt anEntry)
5970 Appends a signed integer onto the array.
5972 @param anEntry The signed integer to be appended.
5974 @return KErrNone, if the insertion is successful, otherwise one of the system
5977 { return RPointerArrayBase::Append((const TAny*)anEntry); }
5982 inline TInt RArray<TInt>::Insert(TInt anEntry, TInt aPos)
5984 Inserts a signed integer into the array at the specified position.
5986 @param anEntry The signed integer to be inserted.
5987 @param aPos The position within the array where the signed integer is to be
5988 inserted. The position is relative to zero, i.e. zero implies
5989 that an entry is inserted at the beginning of the array.
5991 @return KErrNone, if the insertion is successful, otherwise one of the system
5994 @panic USER 131, if aPos is negative, or is greater than the number of entries
5995 currently in the array.
5997 { return RPointerArrayBase::Insert((const TAny*)anEntry,aPos); }
6002 inline void RArray<TInt>::Remove(TInt anIndex)
6004 Removes the signed integer at the specified position from the array.
6006 @param anIndex The position within the array from where the signed integer
6007 is to be removed. The position is relative to zero, i.e. zero
6008 implies that an entry at the beginning of the array is to be
6011 @panic USER 130, if anIndex is negative or is greater than the number of
6012 entries currently in the array.
6014 {RPointerArrayBase::Remove(anIndex);}
6019 inline void RArray<TInt>::Compress()
6021 Compresses the array down to a minimum.
6023 After a call to this function, the memory allocated to the array is just
6024 sufficient for its entries. Subsequently adding a new signed integer to the
6025 array always results in a re-allocation of memory.
6027 {RPointerArrayBase::Compress();}
6032 inline void RArray<TInt>::Reset()
6036 The function frees all memory allocated to the array and
6037 resets the internal state so that it is ready to be reused.
6039 This array object can be allowed to go out of scope after a call to this
6042 {RPointerArrayBase::Reset();}
6047 inline TInt RArray<TInt>::Find(TInt anEntry) const
6049 Finds the first signed integer in the array which matches the specified signed
6050 integer using a sequential search.
6052 The find operation always starts at the low index end of the array. There
6053 is no assumption about the order of entries in the array.
6055 @param anEntry The signed integer to be found.
6057 @return The index of the first matching signed integer within the array.
6058 KErrNotFound, if no matching entry can be found.
6060 { return RPointerArrayBase::Find((const TAny*)anEntry); }
6065 inline TInt RArray<TInt>::FindReverse(TInt anEntry) const
6067 Finds the last signed integer in the array which matches the specified signed
6068 integer using a sequential search.
6070 The find operation always starts at the high index end of the array. There
6071 is no assumption about the order of entries in the array.
6073 @param anEntry The signed integer to be found.
6075 @return The index of the last matching signed integer within the array.
6076 KErrNotFound, if no matching entry can be found.
6078 { return RPointerArrayBase::FindReverse((const TAny*)anEntry); }
6083 inline TInt RArray<TInt>::FindInOrder(TInt anEntry) const
6085 Finds the signed integer in the array that matches the specified signed integer
6086 using a binary search technique.
6088 The function assumes that the array is in signed integer order.
6090 @param anEntry The signed integer to find.
6092 @return The index of the matching signed integer within the array or KErrNotFound,
6093 if no match can be found.
6095 { return RPointerArrayBase::FindIsqSigned(anEntry); }
6100 inline TInt RArray<TInt>::FindInOrder(TInt anEntry, TInt& anIndex) const
6102 Finds the signed integer in the array that matches the specified signed integer
6103 using a binary search technique.
6105 The function assumes that the array is in signed integer order.
6107 @param anEntry The signed integer to find.
6108 @param anIndex A TInt suplied by the caller. On return contains an index value.
6109 If the function returns KErrNone, this is the index of the
6110 matching signed integer within the array.
6111 If the function returns KErrNotFound, this is the index of the
6112 first signed integer within the array that is bigger than the
6113 signed integer being searched for - if no signed integers within
6114 the array are bigger, then the index value is the same as the
6115 total number of signed integers within the array.
6117 @return KErrNone if a matching signed integer is found.
6118 KErrNotFound if no match can be found.
6120 { return RPointerArrayBase::BinarySearchSigned(anEntry,anIndex); }
6125 inline TInt RArray<TInt>::SpecificFindInOrder(TInt anEntry, TInt aMode) const
6127 Finds the signed integer in the array that matches the specified signed integer
6128 using a binary search technique.
6130 Where there is more than one matching element, it finds the first, last or any
6131 matching element as specified by the value of aMode.
6133 The function assumes that the array is in signed integer order.
6135 @param anEntry The signed integer to be found.
6136 @param aMode Specifies whether to find the first match, the last match or any
6137 match, as defined by one of the TArrayFindMode enum values.
6139 @return KErrNotFound, if there is no matching element, otherwise the array
6140 index of a matching element - what the index refers to depends on the
6142 if this is EArrayFindMode_First, then the index refers to the first matching element;
6143 if this is EArrayFindMode_Any, then the index can refer to any of the matching elements;
6144 if this is EArrayFindMode_Last, then the index refers to first element that follows
6145 the last matching element - if the last matching element is also the last element
6146 of the array, then the index value is the same as the total number of elements in
6151 { return RPointerArrayBase::FindIsqSigned(anEntry,aMode); }
6156 inline TInt RArray<TInt>::SpecificFindInOrder(TInt anEntry, TInt& anIndex, TInt aMode) const
6158 Finds the signed integer in the array that matches the specified signed integer
6159 using a binary search technique.
6161 Where there is more than one matching element, it finds the first, last or any
6162 matching element as specified by the value of aMode.
6164 The function assumes that the array is in signed integer order.
6166 @param anEntry The signed integer to be found.
6167 @param anIndex A TInt type supplied by the caller. On return, it contains an index
6168 value depending on whether a match is found and on the value of aMode.
6169 If there is no matching element in the array, then this is the index of
6170 the first element in the array that is bigger than the element being
6171 searched for - if no elements in the array are bigger, then the index
6172 value is the same as the total number of elements in the array.
6173 If there is a matching element, then what the index refers to depends
6174 on the value of aMode:
6175 if this is EArrayFindMode_First, then the index refers to the first matching element;
6176 if this is EArrayFindMode_Any, then the index can refer to any of the matching elements;
6177 if this is EArrayFindMode_Last, then the index refers to first element that follows
6178 the last matching element - if the last matching element is also the last element
6179 of the array, then the index value is the same as the total number of elements in the array.
6181 @param aMode Specifies whether to find the first match, the last match or any match,
6182 as defined by one of the TArrayFindMode enum values.
6184 @return KErrNone, if a matching element is found;
6185 KErrNotFound, if no suitable element can be found.
6189 { return RPointerArrayBase::BinarySearchSigned(anEntry,anIndex,aMode); }
6194 inline TInt RArray<TInt>::InsertInOrder(TInt anEntry)
6196 Inserts a signed integer into the array in signed integer order.
6198 No duplicate entries are permitted. The array remains unchanged following
6199 an attempt to insert a duplicate entry.
6201 The function assumes that existing entries within the array are in signed
6204 @param anEntry The signed integer to be inserted
6206 @return KErrNone, if the insertion is successful;
6207 KErrAlreadyExists, if an attempt is being made
6208 to insert a duplicate entry; otherwise one of the other system wide
6211 { return RPointerArrayBase::InsertIsqSigned(anEntry,EFalse); }
6216 inline TInt RArray<TInt>::InsertInOrderAllowRepeats(TInt anEntry)
6218 Inserts a signed integer into the array in signed integer order,
6219 allowing duplicates.
6221 If anEntry is a duplicate of an existing entry in the array, then the new
6222 signed integer is inserted after the existing one. If more than one duplicate
6223 entry already exists in the array, then any new duplicate signed integer is
6224 inserted after the last one.
6226 The function assumes that existing entries within the array are in signed
6229 @param anEntry The signed integer to be inserted.
6231 @return KErrNone, if the insertion is successful, otherwise one of the system
6234 { return RPointerArrayBase::InsertIsqSigned(anEntry,ETrue); }
6239 #ifndef __KERNEL_MODE__
6240 inline RArray<TInt>::RArray(TInt* aEntries, TInt aCount)
6241 : RPointerArrayBase((TAny**)aEntries, aCount)
6243 C++ constructor with a pointer to the first array entry in a
6244 pre-existing array, and the number of entries in that array.
6246 This constructor takes a pointer to a pre-existing set of entries of type
6247 TInt objects. Ownership of the set of entries does not transfer to
6250 The purpose of constructing an array in this way is to allow sorting and
6251 finding operations to be done without further allocation of memory.
6253 @param aEntries A pointer to the first entry of type class TInt in the set of
6254 entries belonging to the existing array.
6255 @param aCount The number of entries in the existing array.
6259 inline void RArray<TInt>::GranularCompress()
6261 Compresses the array down to a granular boundary.
6263 After a call to this function, the memory allocated to the array is sufficient
6264 for its contained entries. Adding new signed integers to the array does not
6265 result in a re-allocation of memory until the total number of entries reaches
6266 a multiple of the granularity.
6268 {RPointerArrayBase::GranularCompress();}
6273 inline TInt RArray<TInt>::Reserve(TInt aCount)
6275 Reserves space for the specified number of elements.
6277 After a call to this function, the memory allocated to the array is sufficient
6278 to hold the number of integers specified. Adding new integers to the array
6279 does not result in a re-allocation of memory until the the total number of
6280 integers exceeds the specified count.
6282 @param aCount The number of integers for which space should be reserved
6283 @return KErrNone If the operation completed successfully
6284 @return KErrNoMemory If the requested amount of memory could not be allocated
6286 { return RPointerArrayBase::DoReserve(aCount); }
6291 inline void RArray<TInt>::Sort()
6293 Sorts the array entries into signed integer order.
6295 { HeapSortSigned(); }
6300 inline TArray<TInt> RArray<TInt>::Array() const
6302 Constructs and returns a generic array.
6304 @return A generic array representing this array.
6308 { return TArray<TInt>(GetCount,GetElementPtr,(const CBase*)this); }
6313 inline RArray<TUint>::RArray()
6314 : RPointerArrayBase()
6316 Default C++ constructor.
6318 This constructs an array object for an array of unsigned
6319 integers with default granularity.
6321 The default granularity of the array is 8.
6328 inline RArray<TUint>::RArray(TInt aGranularity)
6329 : RPointerArrayBase(aGranularity)
6331 Constructs an array object for an array of unsigned integers with the specified
6334 @param aGranularity The granularity of the array.
6336 @panic USER 127, if aGranularity is not positive or is greater than or
6337 equal to 0x10000000.
6345 C++ constructor with minimum growth step and exponential growth factor.
6347 This constructs an array object for an array of unsigned integers with the
6348 specified minimum growth step and exponential growth factor.
6350 @param aMinGrowBy The minimum growth step of the array. Must be between 1 and
6352 @param aFactor The factor by which the array grows, multiplied by 256.
6353 For example 512 specifies a factor of 2. Must be between 257
6354 and 32767 inclusive.
6356 @panic USER 192, if aMinGrowBy<=0 or aMinGrowBy>65535.
6357 @panic USER 193, if aFactor<=257 or aFactor>32767.
6359 inline RArray<TUint>::RArray(TInt aMinGrowBy, TInt aFactor)
6360 : RPointerArrayBase(aMinGrowBy, aFactor)
6366 inline void RArray<TUint>::Close()
6368 Closes the array and frees all memory allocated to the array.
6370 The function must be called before this array object goes out of scope.
6372 {RPointerArrayBase::Close();}
6377 inline TInt RArray<TUint>::Count() const
6379 Gets the number of unsigned integers in the array.
6381 @return The number of unsigned integers in the array.
6383 {return RPointerArrayBase::Count(); }
6388 inline const TUint& RArray<TUint>::operator[](TInt anIndex) const
6390 Gets a reference to the unsigned integer located at the specified position
6393 The compiler uses this variant if the returned reference is used in an
6394 expression where the reference cannot be modified.
6396 @param anIndex The position of the unsigned integer within the array, relative
6397 to zero, i.e. zero implies the entry at the beginning of
6400 @return A reference to the const unsigned integer at position anIndex within
6403 @panic USER 130, if anIndex is negative, or is greater than the number of
6404 entries currently in the array.
6406 {return (const TUint&)At(anIndex);}
6411 inline TUint& RArray<TUint>::operator[](TInt anIndex)
6413 Gets a reference to the unsigned integer located at the specified position
6416 The compiler uses this variant if the returned reference is used in an
6417 expression where the reference can be modified.
6419 @param anIndex The position of the unsigned integer within the array, relative
6420 to zero, i.e. zero implies the entry at the beginning of
6423 @return A reference to the non-const unsigned integer at position anIndex
6426 @panic USER 130, if anIndex is negative, or is greater than the number of
6427 entries currently in the array.
6429 {return (TUint&)At(anIndex);}
6434 inline TInt RArray<TUint>::Append(TUint anEntry)
6436 Appends an unsigned integer onto the array.
6438 @param anEntry The unsigned integer to be appended.
6439 @return KErrNone, if the insertion is successful, otherwise one of the system
6442 { return RPointerArrayBase::Append((const TAny*)anEntry); }
6447 inline TInt RArray<TUint>::Insert(TUint anEntry, TInt aPos)
6449 Inserts an unsigned integer into the array at the specified position.
6451 @param anEntry The unsigned integer to be inserted.
6452 @param aPos The position within the array where the unsigned integer is to
6453 be inserted. The position is relative to zero, i.e. zero
6454 implies that an entry is inserted at the beginning of
6457 @return KErrNone, if the insertion is successful, otherwise one of the system
6460 @panic USER 131, if aPos is negative, or is greater than the number of entries
6461 currently in the array.
6463 { return RPointerArrayBase::Insert((const TAny*)anEntry,aPos); }
6468 inline void RArray<TUint>::Remove(TInt anIndex)
6470 Removes the unsigned integer at the specified position from the array.
6472 @param anIndex The position within the array from where the unsigned integer
6473 is to be removed. The position is relative to zero, i.e. zero
6474 implies that an entry at the beginning of the array is to be
6478 @panic USER 130, if anIndex is negative, or is greater than the number of
6479 entries currently in the array.
6481 {RPointerArrayBase::Remove(anIndex);}
6486 inline void RArray<TUint>::Compress()
6488 Compresses the array down to a minimum.
6490 After a call to this function, the memory allocated to the array is just
6491 sufficient for its entries. Subsequently adding a new unsigned integer to the
6492 array always results in a re-allocation of memory.
6494 {RPointerArrayBase::Compress();}
6499 inline void RArray<TUint>::Reset()
6503 It frees all memory allocated to the array and resets the
6504 internal state so that it is ready to be reused.
6506 This array object can be allowed to go out of scope after a call to
6509 {RPointerArrayBase::Reset();}
6514 inline TInt RArray<TUint>::Find(TUint anEntry) const
6516 Finds the first unsigned integer in the array which matches the specified
6517 value, using a sequential search.
6519 The find operation always starts at the low index end of the array. There
6520 is no assumption about the order of entries in the array.
6522 @param anEntry The unsigned integer to be found.
6524 @return The index of the first matching unsigned integer within the array.
6525 KErrNotFound, if no matching entry can be found.
6527 { return RPointerArrayBase::Find((const TAny*)anEntry); }
6532 inline TInt RArray<TUint>::FindReverse(TUint anEntry) const
6534 Finds the last unsigned integer in the array which matches the specified
6535 value, using a sequential search.
6537 The find operation always starts at the high index end of the array. There
6538 is no assumption about the order of entries in the array.
6540 @param anEntry The unsigned integer to be found.
6542 @return The index of the last matching unsigned integer within the array.
6543 KErrNotFound, if no matching entry can be found.
6545 { return RPointerArrayBase::FindReverse((const TAny*)anEntry); }
6550 inline TInt RArray<TUint>::FindInOrder(TUint anEntry) const
6552 Finds the unsigned integer in the array which matches the specified value,
6553 using a binary search technique.
6555 The functions assume that existing entries within the array are in unsigned
6558 @param anEntry The unsigned integer to be found.
6560 @return This is either: the index of the matching unsigned integer within the
6562 KErrNotFound, if no suitable entry can be found.
6564 { return RPointerArrayBase::FindIsqUnsigned(anEntry); }
6569 inline TInt RArray<TUint>::FindInOrder(TUint anEntry, TInt& anIndex) const
6571 Finds the unsigned integer in the array which matches the specified value,
6572 using a binary search technique.
6574 If the index cannot be found, the function returns the index of the last
6575 unsigned integer within the array which logically precedes anEntry.
6577 The functions assume that existing entries within the array are in unsigned
6580 @param anEntry The unsigned integer to be found.
6581 @param anIndex A TInt supplied by the caller. On return, contains an index
6583 If the function returns KErrNone, this is the index of the
6584 matching unsigned integer within the array.
6585 If the function returns KErrNotFound, this is the index of the
6586 first unsigned integer within the array that is bigger than the
6587 unsigned integer being searched for - if no unsigned integers within
6588 the array are bigger, then the index value is the same as the
6589 total number of unsigned integers within the array.
6590 @return KErrNone, if a matching unsigned integer is found.
6591 KErrNotFound, if no suitable entry can be found.
6593 { return RPointerArrayBase::BinarySearchUnsigned(anEntry,anIndex); }
6598 inline TInt RArray<TUint>::SpecificFindInOrder(TUint anEntry, TInt aMode) const
6600 Finds the unsigned integer in the array that matches the specified unsigned integer
6601 using a binary search technique.
6603 In the case that there is more than one matching element, finds the first, last
6604 or any match as specified by the value of aMode.
6606 The function assumes that the array is in unsigned integer order.
6608 @param anEntry The unsigned integer to be found..
6609 @param aMode Specifies whether to find the first match, the last match or any match,
6610 as defined by one of the TArrayFindMode enum values.
6612 @return KErrNotFound, if there is no matching element, otherwise the array index of
6613 a matching element - what the index refers to depends on the value of
6615 if this is EArrayFindMode_First, then the index refers to the first matching element;
6616 if this is EArrayFindMode_Any, then the index can refer to any of the matching elements;
6617 if this is EArrayFindMode_Last, then the index refers to first element that follows
6618 the last matching element - if the last matching element is also the last element of
6619 the array, then the index value is the same as the total number of elements in the array.
6623 { return RPointerArrayBase::FindIsqUnsigned(anEntry,aMode); }
6628 inline TInt RArray<TUint>::SpecificFindInOrder(TUint anEntry, TInt& anIndex, TInt aMode) const
6630 Finds the unsigned integer in the array that matches the specified unsigned integer
6631 using a binary search technique.
6633 In the case that there is more than one matching element, finds the first, last or any match as specified.
6635 The function assumes that the array is in unsigned integer order.
6637 @param anEntry The unsigned integer to be found.
6638 @param anIndex A TInt type supplied by the caller. On return, it contains an index
6639 value depending on whether a match is found and on the value of aMode.
6640 If there is no matching element in the array, then this is the index
6641 of the first element in the array that is bigger than the element being
6642 searched for - if no elements in the array are bigger, then the index
6643 value is the same as the total number of elements in the array.
6644 If there is a matching element, then what the index refers to depends
6645 on the value of aMode:
6646 if this is EArrayFindMode_First, then the index refers to the first matching element;
6647 if this is EArrayFindMode_Any, then the index can refer to any of the matching elements;
6648 if this is EArrayFindMode_Last, then the index refers to first element that follows
6649 the last matching element - if the last matching element is also the last element of the array,
6650 then the index value is the same as the total number of elements in the array.
6651 @param aMode Specifies whether to find the first match, the last match or any match, as defined by one
6652 of the TArrayFindMode enum values.
6654 @return KErrNone, if a matching entry is found; KErrNotFound, if no matching entry exists.
6658 { return RPointerArrayBase::BinarySearchUnsigned(anEntry,anIndex,aMode); }
6663 inline TInt RArray<TUint>::InsertInOrder(TUint anEntry)
6665 Inserts an unsigned integer into the array in unsigned integer order.
6667 No duplicate entries are permitted. The array remains unchanged following
6668 an attempt to insert a duplicate entry.
6670 The function assumes that existing entries within the array are in unsigned
6673 @param anEntry The unsigned integer to be inserted.
6675 @return KErrNone, if the insertion is successful;
6676 KErrAlreadyExists, if an attempt is being made
6677 to insert a duplicate entry; otherwise one of the other system wide
6680 { return RPointerArrayBase::InsertIsqUnsigned(anEntry,EFalse); }
6685 inline TInt RArray<TUint>::InsertInOrderAllowRepeats(TUint anEntry)
6687 Inserts an unsigned integer into the array in unsigned integer order, allowing
6690 If the new integer is a duplicate of an existing entry in the array, then
6691 the new unsigned integer is inserted after the existing one. If more than
6692 one duplicate entry already exists in the array, then any new duplicate
6693 unsigned integer is inserted after the last one.
6695 The function assumes that existing entries within the array are in unsigned
6698 @param anEntry The unsigned integer to be inserted.
6700 @return KErrNone, if the insertion is successful, otherwise one of the system
6703 { return RPointerArrayBase::InsertIsqUnsigned(anEntry,ETrue); }
6708 #ifndef __KERNEL_MODE__
6709 inline RArray<TUint>::RArray(TUint* aEntries, TInt aCount)
6710 : RPointerArrayBase((TAny**)aEntries, aCount)
6712 C++ constructor with a pointer to the first array entry in a
6713 pre-existing array, and the number of entries in that array.
6715 This constructor takes a pointer to a pre-existing set of entries of type
6716 TUint objects. Ownership of the set of entries does not transfer to
6719 The purpose of constructing an array in this way is to allow sorting and
6720 finding operations to be done without further allocation of memory.
6722 @param aEntries A pointer to the first entry of type class TUint in the set of
6723 entries belonging to the existing array.
6724 @param aCount The number of entries in the existing array.
6730 inline void RArray<TUint>::GranularCompress()
6732 Compresses the array down to a granular boundary.
6734 After a call to this function, the memory allocated to the array is sufficient
6735 for its contained entries. Adding new unsigned integers to the array does not
6736 result in a re-allocation of memory until the total number of entries reaches
6737 a multiple of the granularity.
6739 {RPointerArrayBase::GranularCompress();}
6744 inline TInt RArray<TUint>::Reserve(TInt aCount)
6746 Reserves space for the specified number of elements.
6748 After a call to this function, the memory allocated to the array is sufficient
6749 to hold the number of integers specified. Adding new integers to the array
6750 does not result in a re-allocation of memory until the the total number of
6751 integers exceeds the specified count.
6753 @param aCount The number of integers for which space should be reserved
6754 @return KErrNone If the operation completed successfully
6755 @return KErrNoMemory If the requested amount of memory could not be allocated
6757 { return RPointerArrayBase::DoReserve(aCount); }
6762 inline void RArray<TUint>::Sort()
6764 Sorts the array entries into unsigned integer order.
6766 { HeapSortUnsigned(); }
6771 inline TArray<TUint> RArray<TUint>::Array() const
6773 Constructs and returns a generic array.
6775 @return A generic array representing this array.
6779 { return TArray<TUint>(GetCount,GetElementPtr,(const CBase*)this); }
6786 Sets an argument to default value and type.
6788 inline void TIpcArgs::Set(TInt,TNothing)
6795 Sets an argument value of TInt type.
6797 @param aIndex An index value that identifies the slot in the array of arguments
6798 into which the argument value is to be placed.
6799 This must be a value in the range 0 to 3.
6800 @param aValue The argument value.
6802 inline void TIpcArgs::Set(TInt aIndex,TInt aValue)
6804 iArgs[aIndex] = aValue;
6805 iFlags |= EUnspecified<<(aIndex*KBitsPerType);
6812 Sets an argument value of TAny* type.
6814 @param aIndex An index value that identifies the slot in the array of arguments
6815 into which the argument value is to be placed.
6816 This must be a value in the range 0 to 3.
6817 @param aValue The argument value.
6819 inline void TIpcArgs::Set(TInt aIndex,const TAny* aValue)
6821 iArgs[aIndex] = (TInt)aValue;
6822 iFlags |= EUnspecified<<(aIndex*KBitsPerType);
6829 Sets an argument value of RHandleBase type.
6831 @param aIndex An index value that identifies the slot in the array of arguments
6832 into which the argument value is to be placed.
6833 This must be a value in the range 0 to 3.
6834 @param aValue The argument value.
6836 inline void TIpcArgs::Set(TInt aIndex,RHandleBase aValue)
6838 iArgs[aIndex] = (TInt)aValue.Handle();
6839 iFlags |= EHandle<<(aIndex*KBitsPerType);
6846 Sets an argument value TDesC8* type.
6848 @param aIndex An index value that identifies the slot in the array of arguments
6849 into which the argument value is to be placed.
6850 This must be a value in the range 0 to 3.
6851 @param aValue The argument value.
6853 inline void TIpcArgs::Set(TInt aIndex,const TDesC8* aValue)
6855 iArgs[aIndex] = (TInt)aValue;
6856 iFlags |= EDesC8<<(aIndex*KBitsPerType);
6862 #ifndef __KERNEL_MODE__
6865 Sets an argument value of TDesC16* type.
6867 @param aIndex An index value that identifies the slot in the array of arguments
6868 into which the argument value is to be placed.
6869 This must be a value in the range 0 to 3.
6870 @param aValue The argument value.
6872 inline void TIpcArgs::Set(TInt aIndex,const TDesC16* aValue)
6874 iArgs[aIndex] = (TInt)aValue;
6875 iFlags |= EDesC16<<(aIndex*KBitsPerType);
6884 Sets an argument value of TDes8* type.
6886 @param aIndex An index value that identifies the slot in the array of arguments
6887 into which the argument value is to be placed.
6888 This must be a value in the range 0 to 3.
6889 @param aValue The argument value.
6891 inline void TIpcArgs::Set(TInt aIndex,TDes8* aValue)
6893 iArgs[aIndex] = (TInt)aValue;
6894 iFlags |= EDes8<<(aIndex*KBitsPerType);
6900 #ifndef __KERNEL_MODE__
6903 Sets an argument value of TDes16* type.
6905 @param aIndex An index value that identifies the slot in the array of arguments
6906 into which the argument value is to be placed.
6907 This must be a value in the range 0 to 3.
6908 @param aValue The argument value.
6910 inline void TIpcArgs::Set(TInt aIndex,TDes16* aValue)
6912 iArgs[aIndex] = (TInt)aValue;
6913 iFlags |= EDes16<<(aIndex*KBitsPerType);
6920 Allows the client to specify whether each argument of the TIpcArgs object will
6921 be pinned before being sent to the server.
6923 To pin all the arguments in the TIpcArgs object pass no parameters to this
6926 @return A reference to this TIpcArgs object that can be passed as a parameter to
6927 one of the overloads the DSession::Send() and DSession::SendReceive() methods.
6929 inline TIpcArgs& TIpcArgs::PinArgs(TBool aPinArg0, TBool aPinArg1, TBool aPinArg2, TBool aPinArg3)
6931 __ASSERT_COMPILE(!((1 << ((KBitsPerType*KMaxMessageArguments)-1)) & KPinMask));
6944 inline TIpcArgs::TArgType TIpcArgs::Type(TNothing)
6945 { return EUnspecified; }
6946 inline TIpcArgs::TArgType TIpcArgs::Type(TInt)
6947 { return EUnspecified; }
6948 inline TIpcArgs::TArgType TIpcArgs::Type(const TAny*)
6949 { return EUnspecified; }
6950 inline TIpcArgs::TArgType TIpcArgs::Type(RHandleBase)
6952 inline TIpcArgs::TArgType TIpcArgs::Type(const TDesC8*)
6954 #ifndef __KERNEL_MODE__
6955 inline TIpcArgs::TArgType TIpcArgs::Type(const TDesC16*)
6958 inline TIpcArgs::TArgType TIpcArgs::Type(TDes8*)
6960 #ifndef __KERNEL_MODE__
6961 inline TIpcArgs::TArgType TIpcArgs::Type(TDes16*)
6964 inline void TIpcArgs::Assign(TInt&,TIpcArgs::TNothing)
6966 inline void TIpcArgs::Assign(TInt& aArg,TInt aValue)
6968 inline void TIpcArgs::Assign(TInt& aArg,const TAny* aValue)
6969 { aArg = (TInt)aValue; }
6970 inline void TIpcArgs::Assign(TInt& aArg,RHandleBase aValue)
6971 { aArg = (TInt)aValue.Handle(); }
6972 inline void TIpcArgs::Assign(TInt& aArg,const TDesC8* aValue)
6973 { aArg = (TInt)aValue; }
6974 #ifndef __KERNEL_MODE__
6975 inline void TIpcArgs::Assign(TInt& aArg,const TDesC16* aValue)
6976 { aArg = (TInt)aValue; }
6978 inline void TIpcArgs::Assign(TInt& aArg,TDes8* aValue)
6979 { aArg = (TInt)aValue; }
6980 #ifndef __KERNEL_MODE__
6981 inline void TIpcArgs::Assign(TInt& aArg,TDes16* aValue)
6982 { aArg = (TInt)aValue; }
6987 // Structures for passing 64 bit integers and doubles across GCC/EABI boundaries
6989 inline SInt64::SInt64()
6992 inline SInt64::SInt64(Int64 a)
6994 iData[0] = (TUint32)((Uint64)a);
6995 iData[1] = (TUint32)(((Uint64)a)>>32);
6998 inline SInt64& SInt64::operator=(Int64 a)
7000 iData[0] = (TUint32)((Uint64)a);
7001 iData[1] = (TUint32)(((Uint64)a)>>32);
7005 inline SInt64::operator Int64() const
7008 TUint32* px = (TUint32*)&x;
7014 inline SUint64::SUint64()
7017 inline SUint64::SUint64(Uint64 a)
7019 iData[0] = (TUint32)a;
7020 iData[1] = (TUint32)(a>>32);
7023 inline SUint64& SUint64::operator=(Uint64 a)
7025 iData[0] = (TUint32)a;
7026 iData[1] = (TUint32)(a>>32);
7030 inline SUint64::operator Uint64() const
7033 TUint32* px = (TUint32*)&x;
7039 inline SDouble::SDouble()
7042 inline SDouble::SDouble(TReal a)
7044 const TUint32* pa = (const TUint32*)&a;
7045 #ifdef __DOUBLE_WORDS_SWAPPED__
7047 iData[1] = pa[0]; // compiler puts MS word of double first
7050 iData[1] = pa[1]; // compiler puts MS word of double second
7054 inline SDouble& SDouble::operator=(TReal a)
7056 new (this) SDouble(a);
7060 inline SDouble::operator TReal() const
7063 TUint32* px = (TUint32*)&x;
7064 #ifdef __DOUBLE_WORDS_SWAPPED__
7066 px[0] = iData[1]; // compiler puts MS word of double first
7069 px[1] = iData[1]; // compiler puts MS word of double second
7078 /** Default constructor. This leaves the object in an undefined state */
7079 inline TSecureId::TSecureId()
7082 /** Construct 'this' using a TUint32
7083 @param aId The value for the ID */
7084 inline TSecureId::TSecureId(TUint32 aId)
7087 /** Convert 'this' into a TUint32
7089 inline TSecureId::operator TUint32() const
7092 /** Construct 'this' using a TUid
7093 @param aId The value for the ID */
7094 inline TSecureId::TSecureId(TUid aId)
7097 /** Convert 'this' into a TUid
7099 inline TSecureId::operator TUid() const
7100 { return (TUid&)iId; }
7105 inline const TSecureId* SSecureId::operator&() const
7106 { return (const TSecureId*)this; }
7107 inline SSecureId::operator const TSecureId&() const
7108 { /* coverity[return_local_addr] */ return (const TSecureId&)iId; }
7109 inline SSecureId::operator TUint32() const
7111 inline SSecureId::operator TUid() const
7112 { return (TUid&)iId; }
7118 /** Default constructor which leaves the object in an undefined state */
7119 inline TVendorId::TVendorId()
7122 /** Construct 'this' using a TUint32
7123 @param aId The value for the ID */
7124 inline TVendorId::TVendorId(TUint32 aId)
7127 /** Convert 'this' into a TUint32
7129 inline TVendorId::operator TUint32() const
7132 /** Construct 'this' using a TUid
7133 @param aId The value for the ID */
7134 inline TVendorId::TVendorId(TUid aId)
7137 /** Convert 'this' into a TUid
7139 inline TVendorId::operator TUid() const
7140 { return (TUid&)iId; }
7145 inline const TVendorId* SVendorId::operator&() const
7146 { return (const TVendorId*)this; }
7147 inline SVendorId::operator const TVendorId&() const
7148 { /* coverity[return_local_addr] */ return (const TVendorId&)iId; }
7149 inline SVendorId::operator TUint32() const
7151 inline SVendorId::operator TUid() const
7152 { return (TUid&)iId; }
7155 // TSharedChunkBufConfigBase
7157 inline TSharedChunkBufConfigBase::TSharedChunkBufConfigBase()
7158 {memset(this,0,sizeof(TSharedChunkBufConfigBase));}
7161 Default constructor. This leaves the set in an undefned state.
7163 inline TCapabilitySet::TCapabilitySet()
7167 Construct a set consisting of a single capability.
7168 @param aCapability The single capability
7170 inline TCapabilitySet::TCapabilitySet(TCapability aCapability)
7171 { new (this) TCapabilitySet(aCapability, aCapability); }
7174 Make this set consist of a single capability.
7175 @param aCapability The single capability.
7177 inline void TCapabilitySet::Set(TCapability aCapability)
7178 { new (this) TCapabilitySet(aCapability, aCapability); }
7181 Make this set consist of two capabilities.
7182 @param aCapability1 The first capability.
7183 @param aCapability2 The second capability.
7185 inline void TCapabilitySet::Set(TCapability aCapability1, TCapability aCapability2)
7186 { new (this) TCapabilitySet(aCapability1, aCapability2); }
7190 Default constructor. This leaves the object in an undefned state.
7192 inline TSecurityInfo::TSecurityInfo()
7195 /** Constructs a TSecurityPolicy that will always fail, irrespective of the
7196 checked object's attributes.
7198 inline TSecurityPolicy::TSecurityPolicy()
7199 { new (this) TSecurityPolicy(EAlwaysFail); }
7202 'Address of' operator which generates a TSecurityPolicy*
7203 @return A pointer of type TSecurityPolicy which refers to this object
7205 inline const TSecurityPolicy* TStaticSecurityPolicy::operator&() const
7206 { return (const TSecurityPolicy*)this; }
7209 'Reference of' operator which generates a TSecurityPolicy&
7210 @return A reference of type TSecurityPolicy which refers to this object
7212 inline TStaticSecurityPolicy::operator const TSecurityPolicy&() const
7213 { return *(const TSecurityPolicy*)this; }
7216 A method to explicity generate a TSecurityPolicy reference.
7217 @return A reference of type TSecurityPolicy which refers to this object
7219 inline const TSecurityPolicy& TStaticSecurityPolicy::operator()() const
7220 { return *(const TSecurityPolicy*)this; }
7222 #ifdef __KERNEL_MODE__
7223 #ifndef __REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
7225 /** Checks this policy against the platform security attributes of aProcess.
7227 When a check fails the action taken is determined by the system wide Platform Security
7228 configuration. If PlatSecDiagnostics is ON, then a diagnostic message is emitted.
7229 If PlatSecEnforcement is OFF, then this function will return ETrue even though the
7232 @param aProcess The DProcess object to check against this TSecurityPolicy.
7233 @param aDiagnostic A string that will be emitted along with any diagnostic message
7234 that may be issued if the policy check fails.
7235 This string must be enclosed in the __PLATSEC_DIAGNOSTIC_STRING macro
7236 which enables it to be easily removed from the system.
7237 @return ETrue if all the requirements of this TSecurityPolicy are met by the
7238 platform security attributes of aProcess, EFalse otherwise.
7239 @panic KERN-COMMON 190 if 'this' is an invalid SSecurityInfo object
7241 inline TBool TSecurityPolicy::CheckPolicy(DProcess* aProcess, const char* aDiagnostic) const
7243 return DoCheckPolicy(aProcess, aDiagnostic);
7246 /** Checks this policy against the platform security attributes of the process
7249 When a check fails the action taken is determined by the system wide Platform Security
7250 configuration. If PlatSecDiagnostics is ON, then a diagnostic message is emitted.
7251 If PlatSecEnforcement is OFF, then this function will return ETrue even though the
7254 @param aThread The thread whose owning process' platform security attributes
7255 are to be checked against this TSecurityPolicy.
7256 @param aDiagnostic A string that will be emitted along with any diagnostic message
7257 that may be issued if the policy check fails.
7258 This string must be enclosed in the __PLATSEC_DIAGNOSTIC_STRING macro
7259 which enables it to be easily removed from the system.
7260 @return ETrue if all the requirements of this TSecurityPolicy are met by the
7261 platform security parameters of the owning process of aThread, EFalse otherwise.
7262 @panic KERN-COMMON 190 if 'this' is an invalid SSecurityInfo object
7264 inline TBool TSecurityPolicy::CheckPolicy(DThread* aThread, const char* aDiagnostic) const
7266 return DoCheckPolicy(aThread, aDiagnostic);
7269 #else //__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
7271 /** Checks this policy against the platform security attributes of aProcess.
7273 When a check fails the action taken is determined by the system wide Platform Security
7274 configuration. If PlatSecDiagnostics is ON, then a diagnostic message is emitted.
7275 If PlatSecEnforcement is OFF, then this function will return ETrue even though the
7278 @param aProcess The DProcess object to check against this TSecurityPolicy.
7279 @param aDiagnostic A string that will be emitted along with any diagnostic message
7280 that may be issued if the policy check fails.
7281 This string must be enclosed in the __PLATSEC_DIAGNOSTIC_STRING macro
7282 which enables it to be easily removed from the system.
7283 @return ETrue if all the requirements of this TSecurityPolicy are met by the
7284 platform security attributes of aProcess, EFalse otherwise.
7285 @panic KERN-COMMON 190 if 'this' is an invalid SSecurityInfo object
7287 inline TBool TSecurityPolicy::CheckPolicy(DProcess* aProcess, OnlyCreateWithNull /*aDiagnostic*/) const
7289 return DoCheckPolicy(aProcess);
7292 /** Checks this policy against the platform security attributes of the process
7295 When a check fails the action taken is determined by the system wide Platform Security
7296 configuration. If PlatSecDiagnostics is ON, then a diagnostic message is emitted.
7297 If PlatSecEnforcement is OFF, then this function will return ETrue even though the
7300 @param aThread The thread whose owning process' platform security attributes
7301 are to be checked against this TSecurityPolicy.
7302 @param aDiagnostic A string that will be emitted along with any diagnostic message
7303 that may be issued if the policy check fails.
7304 This string must be enclosed in the __PLATSEC_DIAGNOSTIC_STRING macro
7305 which enables it to be easily removed from the system.
7306 @return ETrue if all the requirements of this TSecurityPolicy are met by the
7307 platform security parameters of the owning process of aThread, EFalse otherwise.
7308 @panic KERN-COMMON 190 if 'this' is an invalid SSecurityInfo object
7310 inline TBool TSecurityPolicy::CheckPolicy(DThread* aThread, OnlyCreateWithNull /*aDiagnostic*/) const
7312 return DoCheckPolicy(aThread);
7315 #endif // !__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
7316 #endif // __KERNEL_MODE__