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