os/kernelhwsrv/kernel/eka/include/e32base.inl
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/kernelhwsrv/kernel/eka/include/e32base.inl	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,3199 @@
     1.4 +// Copyright (c) 1994-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of the License "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +// e32\include\e32base.inl
    1.18 +// 
    1.19 +//
    1.20 +
    1.21 +// Class CBase
    1.22 +inline TAny* CBase::operator new(TUint aSize, TAny* aBase) __NO_THROW
    1.23 +/**
    1.24 +Initialises the object to binary zeroes.
    1.25 +
    1.26 +@param aSize The size of the derived class. This parameter is specified
    1.27 +             implicitly by C++ in all circumstances in which a derived
    1.28 +			 class is allocated.
    1.29 +@param aBase Indicates a base address which is returned as the object's
    1.30 +             address. 
    1.31 +
    1.32 +@return A pointer to the base address.
    1.33 +*/
    1.34 +	{ Mem::FillZ(aBase, aSize); return aBase; }
    1.35 +
    1.36 +
    1.37 +
    1.38 +
    1.39 +inline TAny* CBase::operator new(TUint aSize) __NO_THROW
    1.40 +/**
    1.41 +Allocates the object from the heap and then initialises its contents
    1.42 +to binary zeroes.
    1.43 +
    1.44 +@param aSize The size of the derived class. This parameter is specified
    1.45 +             implicitly by C++ in all circumstances in which a derived class
    1.46 +			 is allocated.
    1.47 +
    1.48 +@return      A pointer to the allocated object; NULL if memory could not
    1.49 +             be allocated.
    1.50 +*/
    1.51 +	{ return User::AllocZ(aSize); }
    1.52 +
    1.53 +
    1.54 +
    1.55 +
    1.56 +inline TAny* CBase::operator new(TUint aSize, TLeave)
    1.57 +/**
    1.58 +Allocates the object from the heap and then initialises its contents
    1.59 +to binary zeroes.
    1.60 +
    1.61 +@param aSize  The size of the derived class. This parameter is specified
    1.62 +              implicitly by C++ in all circumstances in which a derived class
    1.63 +			  is allocated.
    1.64 +
    1.65 +@return       A pointer to the allocated object; the TLeave parameter indicates
    1.66 +              that the operation leaves if allocation fails with out-of-memory.
    1.67 +*/
    1.68 +	{ return User::AllocZL(aSize); }
    1.69 +
    1.70 +
    1.71 +
    1.72 +
    1.73 +inline TAny* CBase::operator new(TUint aSize, TUint aExtraSize) __NO_THROW
    1.74 +/**
    1.75 +Allocates the object from the heap and then initialises its contents
    1.76 +to binary zeroes.
    1.77 +
    1.78 +Use of this overload is rare.
    1.79 +
    1.80 +@param aSize  The size of the derived class. This parameter is specified
    1.81 +              implicitly by C++ in all circumstances in which a derived class
    1.82 +			  is allocated.
    1.83 +
    1.84 +@param aExtraSize Indicates additional size beyond the end of the base class.
    1.85 +
    1.86 +@return      A pointer to the allocated object; NULL if memory could not
    1.87 +             be allocated.
    1.88 +*/
    1.89 +	{ return User::AllocZ(aSize + aExtraSize); }
    1.90 +
    1.91 +
    1.92 +
    1.93 +
    1.94 +inline TAny* CBase::operator new(TUint aSize, TLeave, TUint aExtraSize)
    1.95 +/**
    1.96 +Allocates the object from the heap and then initialises its contents
    1.97 +to binary zeroes.
    1.98 +
    1.99 +Use of this overload is rare.
   1.100 +
   1.101 +@param aSize  The size of the derived class. This parameter is specified
   1.102 +              implicitly by C++ in all circumstances in which a derived class
   1.103 +			  is allocated.
   1.104 +
   1.105 +@param aExtraSize Indicates additional size beyond the end of the base class.
   1.106 +
   1.107 +@return      A pointer to the allocated object; the TLeave parameter indicates
   1.108 +              that the operation leaves if allocation fails with out-of-memory.
   1.109 +*/
   1.110 +	{ return User::AllocZL(aSize + aExtraSize); }
   1.111 +
   1.112 +
   1.113 +
   1.114 +
   1.115 +// Class CBufBase
   1.116 +inline TInt CBufBase::Size() const
   1.117 +/**
   1.118 +Gets the number of data bytes in the buffer.
   1.119 +
   1.120 +Note that the number of heap bytes used by the buffer may be greater than its
   1.121 +size, because there is typically extra room to allow for expansion. Use the
   1.122 +Compress() function to reduce the extra allocation as much as possible.
   1.123 +
   1.124 +@return The number of data bytes in the buffer.
   1.125 +*/
   1.126 +	{return(iSize);}
   1.127 +
   1.128 +
   1.129 +
   1.130 +
   1.131 +// Class CBufFlat
   1.132 +inline TInt CBufFlat::Capacity() const
   1.133 +/**
   1.134 +Gets the size to which the buffer may expand without re-allocation.
   1.135 +
   1.136 +@return The size of the allocated cell associated with the buffer. This is 
   1.137 +        the maximum size the buffer may be expanded to without re-allocation.
   1.138 +*/
   1.139 +	{return(iMaxSize);}
   1.140 +
   1.141 +
   1.142 +
   1.143 +
   1.144 +// Class CArrayFixBase
   1.145 +inline TInt CArrayFixBase::Count() const
   1.146 +/**
   1.147 +Gets the number of elements held in the array.
   1.148 +
   1.149 +@return The number of array elements
   1.150 +*/
   1.151 +	{return(iCount);}
   1.152 +
   1.153 +
   1.154 +
   1.155 +
   1.156 +inline TInt CArrayFixBase::Length() const
   1.157 +/**
   1.158 +Gets the length of an element.
   1.159 +
   1.160 +@return The length of an element of type class T.
   1.161 +*/
   1.162 +	{return(iLength);}
   1.163 +
   1.164 +
   1.165 +
   1.166 +
   1.167 +// Template class CArrayFix
   1.168 +template <class T>
   1.169 +inline CArrayFix<T>::CArrayFix(TBufRep aRep,TInt aGranularity)
   1.170 +	: CArrayFixBase(aRep,sizeof(T),aGranularity)
   1.171 +/**
   1.172 +@internalComponent
   1.173 +*/
   1.174 +	{}
   1.175 +
   1.176 +
   1.177 +
   1.178 +
   1.179 +template <class T>
   1.180 +inline const T &CArrayFix<T>::operator[](TInt anIndex) const
   1.181 +/**
   1.182 +Gets a const reference to the element located at the specified position 
   1.183 +within the array.
   1.184 +
   1.185 +Note that if a pointer to the returned referenced class T object is taken,
   1.186 +be aware that the pointer value becomes invalid once elements have been added
   1.187 +to, or removed from the array. Always refresh the pointer.
   1.188 +
   1.189 +@param anIndex The position of the element within the array. The position 
   1.190 +               is relative to zero; i.e. zero implies the first element in
   1.191 +			   the array.
   1.192 +			   
   1.193 +@return A const reference to the required element.
   1.194 +
   1.195 +@panic E32USER-CBase 21, if anIndex is negative or greater than or equal to the
   1.196 +                         number of objects currently within the array.
   1.197 +*/
   1.198 +	{return(*((const T *)CArrayFixBase::At(anIndex)));}
   1.199 +
   1.200 +
   1.201 +
   1.202 +
   1.203 +template <class T>
   1.204 +inline T &CArrayFix<T>::operator[](TInt anIndex)
   1.205 +/**
   1.206 +Gets a non-const reference to the element located at the specified position 
   1.207 +within the array.
   1.208 +
   1.209 +Note that if a pointer to the returned referenced class T object is taken,
   1.210 +be aware that the pointer value becomes invalid once elements have been added
   1.211 +to, or removed from the array. Always refresh the pointer.
   1.212 +
   1.213 +@param anIndex The position of the element within the array. The position 
   1.214 +               is relative to zero; i.e. zero implies the first element in
   1.215 +			   the array.
   1.216 +			   
   1.217 +@return A non-const reference to the required element.
   1.218 +
   1.219 +@panic E32USER-CBase 21, if anIndex is negative or greater than or equal to the
   1.220 +                         number of objects currently within the array.
   1.221 +*/
   1.222 +	{return(*((T *)CArrayFixBase::At(anIndex)));}
   1.223 +
   1.224 +
   1.225 +
   1.226 +
   1.227 +template <class T>
   1.228 +inline const T &CArrayFix<T>::At(TInt anIndex) const
   1.229 +/** 
   1.230 +Gets a const reference to the element located at the specified position 
   1.231 +within the array.
   1.232 +
   1.233 +Note that if a pointer to the returned referenced class T object is taken,
   1.234 +be aware that the pointer value becomes invalid once elements have been added
   1.235 +to, or removed from the array. Always refresh the pointer.
   1.236 +
   1.237 +@param anIndex The position of the element within the array. The position 
   1.238 +               is relative to zero; i.e. zero implies the first element in
   1.239 +			   the array.
   1.240 +			   
   1.241 +@return A const reference to the required element.
   1.242 +
   1.243 +@panic E32USER-CBase 21, if anIndex is negative or greater than or equal to the
   1.244 +                         number of objects currently within the array.
   1.245 +*/
   1.246 +	{return(*((const T *)CArrayFixBase::At(anIndex)));}
   1.247 +
   1.248 +
   1.249 +
   1.250 +
   1.251 +template <class T>
   1.252 +inline const T *CArrayFix<T>::End(TInt anIndex) const
   1.253 +/**
   1.254 +Gets a pointer to the (const) first byte following the end of the 
   1.255 +contiguous region containing the element at the specified position within
   1.256 +the array.
   1.257 +
   1.258 +For arrays implemented using flat buffers, the pointer always points to the 
   1.259 +first byte following the end of the buffer.
   1.260 +
   1.261 +For arrays implemented using segmented buffers, the pointer always points 
   1.262 +to the first byte following the end of the segment which contains the element.
   1.263 +
   1.264 +@param anIndex The position of the element within the array. The position 
   1.265 +               is relative to zero; i.e. zero implies the first element
   1.266 +			   in the array.
   1.267 +			   
   1.268 +@return A pointer to the constant byte following the end of the contiguous 
   1.269 +        region. 
   1.270 +
   1.271 +@panic E32USER-CBase 21, if anIndex is negative or greater than or equal to the
   1.272 +                         number of objects currently within the array.
   1.273 +*/
   1.274 +	{return((const T *)CArrayFixBase::End(anIndex));}
   1.275 +
   1.276 +
   1.277 +
   1.278 +
   1.279 +template <class T>
   1.280 +inline const T *CArrayFix<T>::Back(TInt anIndex) const
   1.281 +/**
   1.282 +Gets a pointer to the (const) beginning of a contiguous region.
   1.283 +
   1.284 +For arrays implemented using flat buffers, the function always returns a
   1.285 +pointer to the beginning of the buffer.
   1.286 +
   1.287 +For arrays implemented using segmented buffers, the function returns a pointer 
   1.288 +to the beginning of the segment for all elements in that segment except the 
   1.289 +first. If the element at position anIndex is the first in a segment, then 
   1.290 +the function returns a pointer the beginning of the previous segment.
   1.291 +
   1.292 +For the first element in the array, the function returns a NULL pointer.
   1.293 +
   1.294 +@param anIndex The position of the element within the array. The position 
   1.295 +               is relative to zero; i.e. zero implies the first element
   1.296 +			   in the array.
   1.297 +			   
   1.298 +@return A pointer to the (const) beginning of the contiguous region.
   1.299 +
   1.300 +@panic E32USER-CBase 21, if anIndex is negative or greater than or equal to the
   1.301 +                         number of objects currently within the array.
   1.302 +*/
   1.303 +	{return((const T *)CArrayFixBase::Back(anIndex));}
   1.304 +
   1.305 +
   1.306 +
   1.307 +
   1.308 +template <class T>
   1.309 +inline T &CArrayFix<T>::At(TInt anIndex)
   1.310 +/**
   1.311 +Gets a non-const reference to the element located at the specified position 
   1.312 +within the array.
   1.313 +
   1.314 +Note that if a pointer to the returned referenced class T object is taken,
   1.315 +be aware that the pointer value becomes invalid once elements have been added
   1.316 +to, or removed from the array. Always refresh the pointer.
   1.317 +
   1.318 +@param anIndex The position of the element within the array. The position 
   1.319 +               is relative to zero; i.e. zero implies the first element in
   1.320 +			   the array.
   1.321 +			   
   1.322 +@return A non-const reference to the required element.
   1.323 +
   1.324 +@panic E32USER-CBase 21, if anIndex is negative or greater than or equal to the
   1.325 +                         number of objects currently within the array.
   1.326 +*/
   1.327 +	{return(*((T *)CArrayFixBase::At(anIndex)));}
   1.328 +
   1.329 +
   1.330 +
   1.331 +
   1.332 +template <class T>
   1.333 +inline T *CArrayFix<T>::End(TInt anIndex)
   1.334 +/**
   1.335 +Gets a pointer to the first byte following the end of the contiguous region 
   1.336 +containing the element at the specified position within the array.
   1.337 +
   1.338 +For arrays implemented using flat buffers, the pointer always points to the 
   1.339 +first byte following the end of the buffer.
   1.340 +
   1.341 +For arrays implemented using segmented buffers, the pointer always points 
   1.342 +to the first byte following the end of the segment which contains the element.
   1.343 +
   1.344 +@param anIndex The position of the element within the array. The position 
   1.345 +               is relative to zero; i.e. zero implies the first element
   1.346 +			   in the array.
   1.347 +			   
   1.348 +@return A pointer to the byte following the end of the contiguous region.
   1.349 +
   1.350 +@panic E32USER-CBase 21, if anIndex is negative or greater than or equal to the
   1.351 +                         number of objects currently within the array.
   1.352 +*/
   1.353 +	{return(((T *)CArrayFixBase::End(anIndex)));}
   1.354 +
   1.355 +
   1.356 +
   1.357 +
   1.358 +template <class T>
   1.359 +inline T *CArrayFix<T>::Back(TInt anIndex)
   1.360 +/**
   1.361 +Gets a pointer to the beginning of a contiguous region.
   1.362 +
   1.363 +For arrays implemented using flat buffers, the function always returns a pointer 
   1.364 +to the beginning of the buffer.
   1.365 +
   1.366 +For arrays implemented using segmented buffers, the function returns a pointer 
   1.367 +to the beginning of the segment for all elements in that segment except the 
   1.368 +first. If the element at position anIndex is the first in a segment, then 
   1.369 +the function returns a pointer the beginning of the previous segment.
   1.370 +
   1.371 +For the first element in the array, the function returns a NULL pointer.
   1.372 +
   1.373 +@param anIndex The position of the element within the array. The position 
   1.374 +               is relative to zero; i.e. zero implies the first element
   1.375 +			   in the array.
   1.376 +			   
   1.377 +@return A pointer to the beginning of the contiguous region.
   1.378 +
   1.379 +@panic E32USER-CBase 21, if anIndex is negative or greater than or equal to the
   1.380 +                         number of objects currently within the array.
   1.381 +*/
   1.382 +	{return(((T *)CArrayFixBase::Back(anIndex)));}
   1.383 +
   1.384 +
   1.385 +
   1.386 +
   1.387 +template <class T>
   1.388 +inline void CArrayFix<T>::AppendL(const T &aRef)
   1.389 +/**
   1.390 +Appends a single element onto the end of the array.
   1.391 +
   1.392 +@param aRef A reference to the class T element to be appended.
   1.393 +
   1.394 +@leave KErrNoMemory The function may attempt to expand the array buffer. If 
   1.395 +       there is insufficient memory available, the function leaves, in which
   1.396 +	   case the array is left in the state it was in before the call.
   1.397 +*/
   1.398 +	{CArrayFixBase::InsertL(Count(),&aRef);}
   1.399 +
   1.400 +
   1.401 +
   1.402 +
   1.403 +template <class T>
   1.404 +inline void CArrayFix<T>::AppendL(const T *aPtr,TInt aCount)
   1.405 +/**
   1.406 +Appends one or more elements onto the end of the array.
   1.407 +
   1.408 +@param aPtr   A pointer to a contiguous set of type <class T> objects to be
   1.409 +              appended.
   1.410 +@param aCount The number of contiguous objects of type <class T> located at 
   1.411 +              aPtr to be appended.
   1.412 +			  
   1.413 +@leave KErrNoMemory The function may attempt to expand the array buffer. If 
   1.414 +       there is insufficient memory available, the function leaves, in which
   1.415 +	   case the array is left in the state it was in before the call.
   1.416 +
   1.417 +@panic E32USER-CBase 23, if aCount is negative.
   1.418 +*/
   1.419 +	{CArrayFixBase::InsertL(Count(),aPtr,aCount);}
   1.420 +
   1.421 +
   1.422 +
   1.423 +
   1.424 +template <class T>
   1.425 +inline void CArrayFix<T>::AppendL(const T &aRef,TInt aReplicas)
   1.426 +/**
   1.427 +Appends replicated copies of an element onto the end of the array.
   1.428 +
   1.429 +@param aRef      A reference to the <class T> object to be replicated and appended.
   1.430 +@param aReplicas The number of copies of the aRef element to be appended. 
   1.431 +
   1.432 +@leave KErrNoMemory The function may attempt to expand the array buffer. If 
   1.433 +       there is insufficient memory available, the function leaves, in which
   1.434 +	   case the array is left in the state it was in before the call.
   1.435 +
   1.436 +@panic E32USER-CBase 28 if aReplicas is negative.
   1.437 +*/
   1.438 +	{CArrayFixBase::InsertRepL(Count(),&aRef,aReplicas);}
   1.439 +
   1.440 +
   1.441 +
   1.442 +
   1.443 +template <class T>
   1.444 +inline T &CArrayFix<T>::ExpandL(TInt anIndex)
   1.445 +/**
   1.446 +Expands the array by one element at the specified position.
   1.447 +
   1.448 +It:
   1.449 +
   1.450 +1. expands the array by one element at the specified position
   1.451 +
   1.452 +2. constructs a new element at that position
   1.453 +
   1.454 +3. returns a reference to the new element.
   1.455 +
   1.456 +All existing elements from position anIndex to the end of the array are moved 
   1.457 +up, so that the element originally at position anIndex is now at position 
   1.458 +anIndex + 1 etc.
   1.459 +
   1.460 +The new element of type class T is constructed at position anIndex, using 
   1.461 +the default constructor of that class.
   1.462 +
   1.463 +@param anIndex The position within the array where the array is to be expanded 
   1.464 +               and the new class T object is to be constructed. 
   1.465 +
   1.466 +@leave KErrNoMemory The function may attempt to expand the array buffer. If 
   1.467 +       there is insufficient memory available, the function leaves, in which
   1.468 +	   case the array is left in the state it was in before the call.
   1.469 +
   1.470 +@return A reference to the newly constructed class T object at position 
   1.471 +        anIndex within the array.
   1.472 +
   1.473 +@panic E32USER-CBase 21 if anIndex is negative or greater than the number
   1.474 +                        of elements currently in the array.
   1.475 +*/
   1.476 +	{return(*new(CArrayFixBase::ExpandL(anIndex)) T);}
   1.477 +
   1.478 +
   1.479 +
   1.480 +
   1.481 +template <class T>
   1.482 +inline T &CArrayFix<T>::ExtendL()
   1.483 +/**
   1.484 +Expands the array by one element at the end of the array.
   1.485 +
   1.486 +It:
   1.487 +
   1.488 +1. expands the array by one element at the end of the array, i.e. at position 
   1.489 +   CArrayFixBase::Count()
   1.490 +
   1.491 +2. constructs a new element at that position
   1.492 +
   1.493 +3. returns a reference to the new element.
   1.494 +
   1.495 +The new element of type class T is constructed at the end of the array, 
   1.496 +using the default constructor of that class.
   1.497 +
   1.498 +@leave KErrNoMemory The function may attempt to expand the array buffer. If 
   1.499 +       there is insufficient memory available, the function leaves, in which
   1.500 +	   case the array is left in the state it was in before the call.
   1.501 +
   1.502 +@return A reference to the newly constructed class T object at the end of 
   1.503 +        the array.
   1.504 +
   1.505 +@see CArrayFixBase::Count
   1.506 +*/
   1.507 +	{return(*new(CArrayFixBase::ExpandL(Count())) T);}
   1.508 +
   1.509 +
   1.510 +
   1.511 +
   1.512 +template <class T>
   1.513 +inline TInt CArrayFix<T>::Find(const T &aRef,TKeyArrayFix &aKey,TInt &anIndex) const
   1.514 +/**
   1.515 +Finds the position of an element within the array, based on the matching of
   1.516 +keys, using a sequential search.
   1.517 +
   1.518 +The array is searched sequentially for an element whose key matches the key of the
   1.519 +supplied class T object. The search starts with the first element in the array.
   1.520 +
   1.521 +Note that where an array has elements with duplicate keys, the function only
   1.522 +supplies the position of the first element in the array with that key.
   1.523 +
   1.524 +@param aRef    A reference to an object of type class T whose key is used
   1.525 +               for comparison.
   1.526 +@param aKey    A reference to a key object defining the properties of the key.
   1.527 +@param anIndex A reference to a TInt supplied by the caller. On return, if the
   1.528 +               element is found, the reference is set to the position of that
   1.529 +			   element within the array. The position is relative to zero, 
   1.530 +			   (i.e. the first element in the array is at position 0).
   1.531 +			   If the element is not found and the array is not empty, then
   1.532 +			   the value of the reference is set to the number of elements in
   1.533 +			   the array. 
   1.534 +			   If the element is not found and the array is empty, then the
   1.535 +			   reference is set to zero.
   1.536 +
   1.537 +@return Zero, if the element with the specified key is found. 
   1.538 +        Non-zero, if the element with the specified key is not found.
   1.539 +*/
   1.540 +	{return(CArrayFixBase::Find(&aRef,aKey,anIndex));}
   1.541 +
   1.542 +
   1.543 +
   1.544 +
   1.545 +template <class T>
   1.546 +inline TInt CArrayFix<T>::FindIsq(const T &aRef,TKeyArrayFix &aKey,TInt &anIndex) const
   1.547 +/**
   1.548 +Finds the position of an element within the array, based on the matching of 
   1.549 +keys, using a binary search technique.
   1.550 +
   1.551 +The array is searched, using a binary search technique, for an element whose 
   1.552 +key matches the key of the supplied class T object.
   1.553 +
   1.554 +The array must be in key order.
   1.555 +
   1.556 +Note that where an array has elements with duplicate keys, the function cannot
   1.557 +guarantee which element, with the given key value, it will return, except that
   1.558 +it will find one of them.
   1.559 +
   1.560 +@param aRef    A reference to an object of type class T whose key is used 
   1.561 +               for comparison. 
   1.562 +@param aKey    A reference to a key object defining the properties of the key.
   1.563 +@param anIndex A reference to a TInt supplied by the caller. On return, if the
   1.564 +               element is found, the reference is set to the position of that
   1.565 +			   element within the array. The position is relative to zero,
   1.566 +			   (i.e. the first element in the array is at position 0).
   1.567 +			   If the element is not found and the array is not empty, then the
   1.568 +			   reference is set to the position of the first element in the
   1.569 +			   array with a key which is greater than the key of the 
   1.570 +               object aRef.
   1.571 +			   If the element is not found and the array is empty, then the 
   1.572 +               reference is set to zero.
   1.573 +
   1.574 +@return Zero, if the element with the specified key is found.
   1.575 +        Non-zero, if the element with the specified key is not found.
   1.576 +*/
   1.577 +	{return(CArrayFixBase::FindIsq(&aRef,aKey,anIndex));}
   1.578 +
   1.579 +
   1.580 +
   1.581 +
   1.582 +template <class T>
   1.583 +inline void CArrayFix<T>::InsertL(TInt anIndex,const T &aRef)
   1.584 +/**
   1.585 +Inserts an element into the array at the specified position.
   1.586 +
   1.587 +Note that passing a value of anIndex which is the same as the current number
   1.588 +of elements in the array, has the effect of appending the element.
   1.589 +
   1.590 +@param anIndex The position within the array where the element is to be
   1.591 +               inserted. The position is relative to zero, i.e. zero implies
   1.592 +			   that elements are inserted at the beginning of the array. 
   1.593 +			   
   1.594 +@param aRef    A reference to the class T object to be inserted into the array 
   1.595 +               at position anIndex.
   1.596 +
   1.597 +@leave KErrNoMemory The function may attempt to expand the array buffer. If 
   1.598 +       there is insufficient memory available, the function leaves, in which
   1.599 +	   case the array is left in the state it was in before the call.
   1.600 +
   1.601 +@panic E32USER-CBase 21 if anIndex is negative, or is greater than the number
   1.602 +       of elements currently in the array.
   1.603 +*/
   1.604 +	{CArrayFixBase::InsertL(anIndex,&aRef);}
   1.605 +
   1.606 +
   1.607 +
   1.608 +
   1.609 +template <class T>
   1.610 +inline void CArrayFix<T>::InsertL(TInt anIndex,const T *aPtr,TInt aCount)
   1.611 +/**
   1.612 +Inserts one or more elements into the array at the specified position.
   1.613 +
   1.614 +The objects to be added must all be contiguous.
   1.615 +
   1.616 +Note that passing a value of anIndex which is the same as the current number
   1.617 +of elements in the array, has the effect of appending the element.
   1.618 +
   1.619 +@param anIndex The position within the array where the elements are to be 
   1.620 +               inserted. The position is relative to zero, i.e. zero implies
   1.621 +			   that elements are inserted at the beginning of the array.
   1.622 +			   
   1.623 +@param aPtr    A pointer to the first of the contiguous elements of type 
   1.624 +               class T to be inserted into the array at position anIndex.
   1.625 +
   1.626 +@param aCount  The number of contiguous elements of type class T located at 
   1.627 +               aPtr to be inserted into the array. 
   1.628 +
   1.629 +@leave KErrNoMemory The function may attempt to expand the array buffer. If 
   1.630 +       there is insufficient memory available, the function leaves, in which
   1.631 +	   case the array is left in the state it was in before the call.
   1.632 +
   1.633 +@panic E32USER-CBase 21  if anIndex is negative or is greater than the number
   1.634 +                         of elements currently in the array.
   1.635 +@panic E32USER-CBase 23  if aCount is negative.
   1.636 +*/
   1.637 +	{CArrayFixBase::InsertL(anIndex,aPtr,aCount);}
   1.638 +
   1.639 +
   1.640 +
   1.641 +
   1.642 +template <class T>
   1.643 +inline void CArrayFix<T>::InsertL(TInt anIndex,const T &aRef,TInt aReplicas)
   1.644 +/**
   1.645 +Inserts replicated copies of an element into the array at the specified
   1.646 +position.
   1.647 +
   1.648 +Note that passing a value of anIndex which is the same as the current number
   1.649 +of elements in the array, has the effect of appending the element.
   1.650 +
   1.651 +
   1.652 +@param anIndex   The position within the array where elements are to be
   1.653 +                 inserted. The position is relative to zero, i.e. zero implies
   1.654 +				 that elements are inserted at the beginning of the array.
   1.655 +				 
   1.656 +@param aRef      A reference to the class T object to be replicated and
   1.657 +                 inserted into the array at position anIndex. 
   1.658 +
   1.659 +@param aReplicas The number of copies of the aRef element to be inserted into 
   1.660 +                 the array.
   1.661 +				 
   1.662 +@leave KErrNoMemory The function may attempt to expand the array buffer. If 
   1.663 +       there is insufficient memory available, the function leaves, in which
   1.664 +	   case the array is left in the state it was in before the call.
   1.665 +	   
   1.666 +@panic E32USER-CBase 21, if anIndex is negative or is greater than the number
   1.667 +                         of elements currently in the array.
   1.668 +@panic E32USER-CBase 28, if aReplicas is negative.
   1.669 +*/
   1.670 +	{CArrayFixBase::InsertRepL(anIndex,&aRef,aReplicas);}
   1.671 +
   1.672 +
   1.673 +
   1.674 +
   1.675 +template <class T>
   1.676 +inline TInt CArrayFix<T>::InsertIsqL(const T &aRef,TKeyArrayFix &aKey)
   1.677 +/**
   1.678 +Inserts a single element into the array at a position determined by a key.
   1.679 +
   1.680 +The array MUST already be in key sequence (as defined by the key), otherwise 
   1.681 +the position of the new element is unpredictable, or duplicates may occur.
   1.682 +
   1.683 +Elements with duplicate keys are not permitted.
   1.684 +
   1.685 +@param aRef A reference to the element of type <class T> to be inserted into 
   1.686 +            the array.
   1.687 +@param aKey A reference to a key object defining the properties of the key. 
   1.688 +
   1.689 +@return The position within the array of the newly inserted element. 
   1.690 +
   1.691 +@leave KErrAlreadyExists An element with the same key already exists within 
   1.692 +       the array. NB the array MUST already be in key sequence, otherwise
   1.693 +	   the function may insert a duplicate and fail to leave with
   1.694 +	   this value.
   1.695 +@leave KErrNoMemory The function may attempt to expand the array buffer. If 
   1.696 +       there is insufficient memory available, the function leaves, in which
   1.697 +	   case the array is left in the state it was in before the call.
   1.698 +*/
   1.699 +	{return(CArrayFixBase::InsertIsqL(&aRef,aKey));}
   1.700 +
   1.701 +
   1.702 +
   1.703 +
   1.704 +template <class T>
   1.705 +inline TInt CArrayFix<T>::InsertIsqAllowDuplicatesL(const T &aRef,TKeyArrayFix &aKey)
   1.706 +/**
   1.707 +Inserts a single element into the array at a position determined by a key, 
   1.708 +allowing duplicates.
   1.709 +
   1.710 +The array MUST already be in key sequence (as defined by the key), otherwise 
   1.711 +the position of the new element is unpredictable.
   1.712 +
   1.713 +If the new element's key is a duplicate of an existing element's key, then 
   1.714 +the new element is positioned after the existing element.
   1.715 +
   1.716 +@param aRef A reference to the element of type <class T> to be inserted into 
   1.717 +            the array.
   1.718 +@param aKey A reference to a key object defining the properties of the key. 
   1.719 +
   1.720 +@return The position within the array of the newly inserted element.
   1.721 +
   1.722 +@leave KErrNoMemory The function may attempt to expand the array buffer. If 
   1.723 +       there is insufficient memory available, the function leaves, in which
   1.724 +	   case the array is left in the state it was in before the call.
   1.725 +*/
   1.726 +	{return(CArrayFixBase::InsertIsqAllowDuplicatesL(&aRef,aKey));}
   1.727 +
   1.728 +
   1.729 +
   1.730 +
   1.731 +template <class T>
   1.732 +inline void CArrayFix<T>::ResizeL(TInt aCount)
   1.733 +/**
   1.734 +Changes the size of the array so that it contains the specified number
   1.735 +of elements.
   1.736 +
   1.737 +The following describes the effects of calling this function:
   1.738 +
   1.739 +1. If aCount is less than the current number of elements in the array, then the 
   1.740 +   array is shrunk. The elements at positions aCount and above are discarded. 
   1.741 +   The array buffer is not compressed.
   1.742 +
   1.743 +2. If aCount is greater than the current number of elements in the array, then 
   1.744 +   the array is extended.
   1.745 +
   1.746 +3. New elements are replicated copies of an object of type <class T>,
   1.747 +   constructed using the default constructor of that class.
   1.748 +
   1.749 +The new elements are positioned after the existing elements in the array.
   1.750 +
   1.751 +The function may attempt to expand the array buffer. If there is insufficient 
   1.752 +memory available, the function leaves. The leave code is one of the system 
   1.753 +wide error codes. If the function leaves, the array is left in the state it 
   1.754 +was in before the call.
   1.755 +
   1.756 +@param aCount The number of elements the array is to contain after the resizing 
   1.757 +              operation. 
   1.758 +			  
   1.759 +@panic E32USER-CBase 24, if aCount is negative.
   1.760 +*/
   1.761 +	{TUint8 b[sizeof(T)]; new(&b[0]) T; CArrayFixBase::ResizeL(aCount,&b[0]);}
   1.762 +
   1.763 +
   1.764 +
   1.765 +
   1.766 +template <class T>
   1.767 +inline void CArrayFix<T>::ResizeL(TInt aCount,const T &aRef)
   1.768 +/**
   1.769 +Changes the size of the array so that it contains the specified number
   1.770 +of elements.
   1.771 +
   1.772 +The following describes the effects of calling this function:
   1.773 +
   1.774 +1. If aCount is less than the current number of elements in the array, then the 
   1.775 +   array is shrunk. The elements at positions aCount and above are discarded. 
   1.776 +   The array buffer is not compressed.
   1.777 +
   1.778 +2. If aCount is greater than the current number of elements in the array, then 
   1.779 +   the array is extended.
   1.780 +
   1.781 +3. New elements are replicated copies of aRef.
   1.782 +
   1.783 +The new elements are positioned after the existing elements in the array.
   1.784 +
   1.785 +The function may attempt to expand the array buffer. If there is insufficient 
   1.786 +memory available, the function leaves. The leave code is one of the system 
   1.787 +wide error codes. If the function leaves, the array is left in the state it 
   1.788 +was in before the call.
   1.789 +
   1.790 +@param aCount The number of elements the array is to contain after the resizing 
   1.791 +              operation.
   1.792 +
   1.793 +@param aRef   A reference to an object of type <class T>, copies of which are
   1.794 +              used as the new elements of the array, if the array is extended.
   1.795 +
   1.796 +@panic E32USER-CBase 24, if aCount is negative.
   1.797 +*/
   1.798 +	{CArrayFixBase::ResizeL(aCount,&aRef);}
   1.799 +
   1.800 +
   1.801 +
   1.802 +
   1.803 +template <class T>
   1.804 +inline const TArray<T> CArrayFix<T>::Array() const
   1.805 +/**
   1.806 +Constructs and returns a TArray<T> object.
   1.807 +
   1.808 +@return A TArray<T> object representing this array.
   1.809 +*/
   1.810 +	{return(TArray<T>(CountR,AtR,this));}
   1.811 +
   1.812 +
   1.813 +
   1.814 +
   1.815 +inline CArrayFix<TAny>::CArrayFix(TBufRep aRep,TInt aRecordLength,TInt aGranularity)
   1.816 +	: CArrayFixBase(aRep,aRecordLength,aGranularity)
   1.817 +/**
   1.818 +@internalComponent
   1.819 +*/
   1.820 +	{}
   1.821 +
   1.822 +
   1.823 +
   1.824 +
   1.825 +inline const TAny *CArrayFix<TAny>::At(TInt anIndex) const
   1.826 +/**
   1.827 +Gets a pointer to the untyped element located at the specified position 
   1.828 +within the array.
   1.829 +	
   1.830 +@param anIndex The position of the element within the array. The position 
   1.831 +	           is relative to zero; i.e. zero implies the first element in the
   1.832 +			   array. 
   1.833 +			   
   1.834 +@return A pointer to the untyped element located at position anIndex within 
   1.835 +	    the array. 
   1.836 +
   1.837 +@panic E32User-CBase 21, if anIndex is negative or is greater than or equal
   1.838 +       to the number of objects currently within the array.
   1.839 +*/
   1.840 +	{return(CArrayFixBase::At(anIndex));}
   1.841 +
   1.842 +
   1.843 +
   1.844 +
   1.845 +inline const TAny *CArrayFix<TAny>::End(TInt anIndex) const
   1.846 +/**
   1.847 +Gets a pointer to the first byte following the end of the contiguous region 
   1.848 +containing the element at the specfied position within the array.
   1.849 +	
   1.850 +For flat buffers, the pointer always points to the first byte following the 
   1.851 +end of the buffer.
   1.852 +	
   1.853 +For segmented buffers, the pointer always points to the first byte following 
   1.854 +the end of the segment which contains the element.
   1.855 +	
   1.856 +@param anIndex The position of the element within the array. The position 
   1.857 +	           is relative to zero; i.e. zero implies the first element in
   1.858 +			   the array.
   1.859 +
   1.860 +@return A pointer to the byte following the end of the contiguous region.
   1.861 +
   1.862 +@panic E32USER-CBase 21, if anIndex is negative or greater than or equal to
   1.863 +       the number of objects currently within the array.
   1.864 +*/
   1.865 +	{return(CArrayFixBase::End(anIndex));}
   1.866 +
   1.867 +
   1.868 +
   1.869 +
   1.870 +inline const TAny *CArrayFix<TAny>::Back(TInt anIndex) const
   1.871 +/**
   1.872 +Gets a pointer to the beginning of a contiguous region.
   1.873 +	
   1.874 +For flat buffers, the function always returns a pointer to the beginning of 
   1.875 +the buffer.
   1.876 +	
   1.877 +For segmented buffers, the function returns a pointer to the beginning of 
   1.878 +the segment for all elements in that segment except the first. If the element 
   1.879 +at the specified position is the first in a segment, then the function returns 
   1.880 +a pointer the beginning of the previous segment.
   1.881 +	
   1.882 +For the first element in the array, the function returns a NULL pointer.
   1.883 +	
   1.884 +@param anIndex The position of the element within the array. The position 
   1.885 +               is relative to zero; i.e. zero implies the first element in the array.
   1.886 +	
   1.887 +@return A pointer to the beginning of the contiguous region.
   1.888 +
   1.889 +@panic E32User-CBase 21, if anIndex is negative or is greater than or equal to
   1.890 +       the number of objects currently within the array.
   1.891 +*/
   1.892 +	{return(CArrayFixBase::Back(anIndex));}
   1.893 +
   1.894 +
   1.895 +
   1.896 +
   1.897 +inline TAny *CArrayFix<TAny>::At(TInt anIndex)
   1.898 +/**
   1.899 +Gets a pointer to the untyped element located at the specified position 
   1.900 +within the array.
   1.901 +	
   1.902 +@param anIndex The position of the element within the array. The position 
   1.903 +	           is relative to zero; i.e. zero implies the first element in the
   1.904 +			   array. 
   1.905 +			   
   1.906 +@return A pointer to the untyped element located at position anIndex within 
   1.907 +	    the array. 
   1.908 +
   1.909 +@panic E32User-CBase 21, if anIndex is negative or is greater than or equal
   1.910 +       to the number of objects currently within the array.
   1.911 +*/
   1.912 +	{return(CArrayFixBase::At(anIndex));}
   1.913 +
   1.914 +
   1.915 +
   1.916 +
   1.917 +inline TAny *CArrayFix<TAny>::End(TInt anIndex)
   1.918 +/**
   1.919 +Gets a pointer to the first byte following the end of the contiguous region 
   1.920 +containing the element at the specfied position within the array.
   1.921 +	
   1.922 +For flat buffers, the pointer always points to the first byte following the 
   1.923 +end of the buffer.
   1.924 +	
   1.925 +For segmented buffers, the pointer always points to the first byte following 
   1.926 +the end of the segment which contains the element.
   1.927 +	
   1.928 +@param anIndex The position of the element within the array. The position 
   1.929 +	           is relative to zero; i.e. zero implies the first element in
   1.930 +			   the array.
   1.931 +
   1.932 +@return A pointer to the byte following the end of the contiguous region.
   1.933 +
   1.934 +@panic E32USER-CBase 21, if anIndex is negative or greater than or equal to
   1.935 +       the number of objects currently within the array.
   1.936 +*/
   1.937 +	{return(CArrayFixBase::End(anIndex));}
   1.938 +
   1.939 +
   1.940 +
   1.941 +
   1.942 +inline TAny *CArrayFix<TAny>::Back(TInt anIndex)
   1.943 +/**
   1.944 +Gets a pointer to the beginning of a contiguous region.
   1.945 +	
   1.946 +For flat buffers, the function always returns a pointer to the beginning of 
   1.947 +the buffer.
   1.948 +	
   1.949 +For segmented buffers, the function returns a pointer to the beginning of 
   1.950 +the segment for all elements in that segment except the first. If the element 
   1.951 +at the specified position is the first in a segment, then the function returns 
   1.952 +a pointer the beginning of the previous segment.
   1.953 +	
   1.954 +For the first element in the array, the function returns a NULL pointer.
   1.955 +	
   1.956 +@param anIndex The position of the element within the array. The position 
   1.957 +               is relative to zero; i.e. zero implies the first element in the array.
   1.958 +	
   1.959 +@return A pointer to the beginning of the contiguous region.
   1.960 +
   1.961 +@panic E32User-CBase 21, if anIndex is negative or is greater than or equal to
   1.962 +       the number of objects currently within the array.
   1.963 +*/
   1.964 +	{return(CArrayFixBase::Back(anIndex));}
   1.965 +
   1.966 +
   1.967 +
   1.968 +
   1.969 +inline void CArrayFix<TAny>::AppendL(const TAny *aPtr)
   1.970 +/**
   1.971 +Appends the specified untyped element onto the end of the array.
   1.972 +	
   1.973 +@param aPtr A pointer to an untyped element to be appended. 
   1.974 +
   1.975 +@leave KErrNoMemory The function may attempt to expand the array buffer. If 
   1.976 +	   there is insufficient memory available, the function leaves, in which
   1.977 +	   case the array is left in the state it was in before the call. 
   1.978 +*/
   1.979 +	{CArrayFixBase::InsertL(Count(),aPtr);}
   1.980 +
   1.981 +
   1.982 +
   1.983 +
   1.984 +inline void CArrayFix<TAny>::AppendL(const TAny *aPtr,TInt aCount)
   1.985 +/**
   1.986 +Appends one or more untyped elements onto the end of the array.
   1.987 +	
   1.988 +@param aPtr   A pointer to the first of the contiguous untyped elements to be 
   1.989 +	          appended. 
   1.990 +@param aCount The number of contiguous elements located at aPtr to be appended. 
   1.991 +
   1.992 +@leave KErrNoMemory The function may attempt to expand the array buffer. If 
   1.993 +       there is insufficient memory available, the function leaves, in which
   1.994 +	   case the array is left in the state it was in before the call. 
   1.995 +@panic E32USER-CBase 23, if aCount is negative.
   1.996 +*/
   1.997 +	{CArrayFixBase::InsertL(Count(),aPtr,aCount);}
   1.998 +
   1.999 +
  1.1000 +
  1.1001 +
  1.1002 +inline TAny *CArrayFix<TAny>::ExtendL()
  1.1003 +/**
  1.1004 +Expands the array by the length of one element at the end of the array and 
  1.1005 +returns a pointer to this new location.
  1.1006 +	
  1.1007 +As elements are untyped, no construction is possible and the content of the 
  1.1008 +new location remains undefined.
  1.1009 +
  1.1010 +@return A pointer to the new element location at the end of the array.
  1.1011 +
  1.1012 +@leave KErrNoMemory The function may attempt to expand the array buffer. If 
  1.1013 +	   there is insufficient memory available, the function leaves, in which
  1.1014 +	   case the array is left in the state it was in before the call. 
  1.1015 +*/
  1.1016 +	{return(CArrayFixBase::ExpandL(Count()));}
  1.1017 +
  1.1018 +
  1.1019 +
  1.1020 +
  1.1021 +// Template class CArrayFixFlat
  1.1022 +template <class T>
  1.1023 +inline CArrayFixFlat<T>::CArrayFixFlat(TInt aGranularity)
  1.1024 +	: CArrayFix<T>((TBufRep)CBufFlat::NewL,aGranularity)
  1.1025 +/**
  1.1026 +Constructs a flat array of fixed length objects with the specified granularity.
  1.1027 +
  1.1028 +The length of all array elements is the length of the class passed as the 
  1.1029 +template parameter. The length must be non-zero.
  1.1030 +
  1.1031 +Note that no memory is allocated to the array buffer by this constructor.
  1.1032 +
  1.1033 +@param aGranularity The granularity of the array. 
  1.1034 +  
  1.1035 +@panic E32USER-CBase 17, if the length of the class implied by the template parameter is zero.
  1.1036 +
  1.1037 +@panic E32USER-CBase 18, if aGranularity is not positive.
  1.1038 +*/
  1.1039 +	{}
  1.1040 +
  1.1041 +
  1.1042 +
  1.1043 +
  1.1044 +template <class T>
  1.1045 +inline void CArrayFixFlat<T>::SetReserveL(TInt aCount)
  1.1046 +/**
  1.1047 +Reserves space in the array buffer.
  1.1048 +
  1.1049 +If necessary, the array buffer is allocated or re-allocated so that it can
  1.1050 +accommodate the specified number of elements.
  1.1051 +
  1.1052 +After a successful call to this function, elements can be added to the array 
  1.1053 +and the process is guaranteed not to fail for lack of memory - provided the 
  1.1054 +total number of elements does not exceed the number specified in this function.
  1.1055 +
  1.1056 +This function does not increase the number of elements in the array; i.e. 
  1.1057 +the member function CArrayFixBase::Count() returns the same value both before 
  1.1058 +and after a call to CArrayFixFlat::SetReserveL().
  1.1059 +
  1.1060 +@param aCount The total number of elements for which space is to be reserved. 
  1.1061 +	
  1.1062 +@panic E32USER-CBase 27, if aCount is less than the current number of elements
  1.1063 +                         in the array.
  1.1064 +*/
  1.1065 +	{this->SetReserveFlatL(aCount);}
  1.1066 +
  1.1067 +
  1.1068 +
  1.1069 +
  1.1070 +inline CArrayFixFlat<TAny>::CArrayFixFlat(TInt aRecordLength,TInt aGranularity)
  1.1071 +	: CArrayFix<TAny>((TBufRep)CBufFlat::NewL,aRecordLength,aGranularity)
  1.1072 +/**
  1.1073 +Constructs a flat array of fixed length objects with the specified granularity 
  1.1074 +to contain elements of the specified length.
  1.1075 +	
  1.1076 +Note that no memory is allocated to the array buffer by this constructor.
  1.1077 +	
  1.1078 +@param aRecordLength The length of the elements of this fixed length array. 
  1.1079 +@param aGranularity  The granularity of the array.
  1.1080 +	
  1.1081 +@panic E32USER-CBase 17, if aRecordLength is not positive.
  1.1082 +@panic E32USER-CBase 18, if aGranularity is  not positive.
  1.1083 +*/
  1.1084 +	{}
  1.1085 +
  1.1086 +
  1.1087 +
  1.1088 +
  1.1089 +inline void CArrayFixFlat<TAny>::SetReserveL(TInt aCount)
  1.1090 +/**
  1.1091 +Reserves space in the array buffer.
  1.1092 +
  1.1093 +If necessary, the array buffer is allocated or re-allocated so that it can
  1.1094 +accommodate the specified number of elements.
  1.1095 +	
  1.1096 +After a successful call to this function, elements can be added to the array 
  1.1097 +and the process is guaranteed not to fail for lack of memory - provided the 
  1.1098 +total number of elements does not exceed the specified number.
  1.1099 +	
  1.1100 +This function does not increase the number of elements in the array; i.e. 
  1.1101 +the member function CArrayFixBase::Count() returns the same value both before 
  1.1102 +and after a call to this function.
  1.1103 +	
  1.1104 +@param aCount The total number of elements for which space is to be reserved. 
  1.1105 +
  1.1106 +@panic E32USER-CBase 27, if aCount is less than the current number of elements
  1.1107 +                         in the array.
  1.1108 +*/
  1.1109 +	{SetReserveFlatL(aCount);}
  1.1110 +
  1.1111 +
  1.1112 +
  1.1113 +
  1.1114 +inline void CArrayFixFlat<TInt>::SetReserveL(TInt aCount)
  1.1115 +/**
  1.1116 +Reserves space in the array buffer.
  1.1117 +	
  1.1118 +If necessary, the array buffer is allocated or re-allocated so that it can 
  1.1119 +accommodate the specified number of TInt elements.
  1.1120 +	
  1.1121 +After a successful call to this function, elements can be added to the array 
  1.1122 +and the process is guaranteed not to fail for lack of memory - provided the 
  1.1123 +total number of elements does not exceed the specified number.
  1.1124 +	
  1.1125 +This function does not increase the number of elements in the array; i.e. 
  1.1126 +the member function CArrayFixBase::Count() returns the same value both before 
  1.1127 +and after a call to this function.
  1.1128 +	
  1.1129 +@param aCount The total number of elements for which space is to be reserved. 
  1.1130 +
  1.1131 +@panic E32USER-CBase 27, if aCount is less than the current number of elements
  1.1132 +                         in the array.
  1.1133 +*/
  1.1134 +	{SetReserveFlatL(aCount);}
  1.1135 +
  1.1136 +
  1.1137 +
  1.1138 +
  1.1139 +inline void CArrayFixFlat<TUid>::SetReserveL(TInt aCount)
  1.1140 +/**
  1.1141 +Reserves space in the array buffer.
  1.1142 +	
  1.1143 +If necessary, the array buffer is allocated or re-allocated so that it can 
  1.1144 +accommodate the specified number of TUid elements.
  1.1145 +	
  1.1146 +After a successful call to this function, elements can be added to the array 
  1.1147 +and the process is guaranteed not to fail for lack of memory - provided the 
  1.1148 +total number of elements does not exceed the specified number.
  1.1149 +	
  1.1150 +This function does not increase the number of elements in the array; i.e. 
  1.1151 +the member function CArrayFixBase::Count() returns the same value both before 
  1.1152 +and after a call to this function.
  1.1153 +	
  1.1154 +@param aCount The total number of elements for which space is to be reserved. 
  1.1155 +
  1.1156 +@panic E32USER-CBase 27, if aCount is less than the current number of elements
  1.1157 +                         in the array.
  1.1158 +*/
  1.1159 +	{SetReserveFlatL(aCount);}
  1.1160 +
  1.1161 +
  1.1162 +
  1.1163 +
  1.1164 +// Template class CArrayFixSeg
  1.1165 +template <class T>
  1.1166 +inline CArrayFixSeg<T>::CArrayFixSeg(TInt aGranularity)
  1.1167 +	: CArrayFix<T>((TBufRep)CBufSeg::NewL,aGranularity)
  1.1168 +/**
  1.1169 +Constructs a segmented array of fixed length objects with the specified
  1.1170 +granularity.
  1.1171 +
  1.1172 +The length of all array elements is the length of the class passed as the 
  1.1173 +template parameter. The length must be non-zero.
  1.1174 +
  1.1175 +Note that no memory is allocated to the array buffer by this constructor.
  1.1176 +
  1.1177 +@param aGranularity The granularity of the array. 
  1.1178 +
  1.1179 +@panic E32USER-CBase 17, if the length of the class implied by the template
  1.1180 +                         parameter is zero.
  1.1181 +@panic E32USER-CBase 18, if aGranularity is not positive.
  1.1182 +*/
  1.1183 +	{}
  1.1184 +
  1.1185 +
  1.1186 +
  1.1187 +
  1.1188 +inline CArrayFixSeg<TAny>::CArrayFixSeg(TInt aRecordLength,TInt aGranularity)
  1.1189 +	: CArrayFix<TAny>((TBufRep)CBufSeg::NewL,aRecordLength,aGranularity)
  1.1190 +/**
  1.1191 +Constructs a segmented array of fixed length objects with the specified
  1.1192 +granularity to contain elements of the specified length.
  1.1193 +	
  1.1194 +Note that no memory is allocated to the array buffer by this constructor.
  1.1195 +	
  1.1196 +@param aRecordLength The length of the elements of this array.
  1.1197 +
  1.1198 +@param aGranularity The granularity of the array.
  1.1199 +
  1.1200 +@panic E32USER-CBase 17, if aRecordLength is not positive.
  1.1201 +@panic E32USER-CBase 18, if aGranularity is not positive.
  1.1202 +*/
  1.1203 +	{}
  1.1204 +
  1.1205 +
  1.1206 +
  1.1207 +
  1.1208 +// Template class CArrayPtr
  1.1209 +template <class T>
  1.1210 +inline CArrayPtr<T>::CArrayPtr(TBufRep aRep,TInt aGranularity)
  1.1211 +	: CArrayFix<T*>(aRep,aGranularity)
  1.1212 +/**
  1.1213 +@internalComponent
  1.1214 +*/
  1.1215 +	{}
  1.1216 +
  1.1217 +
  1.1218 +
  1.1219 +
  1.1220 +template <class T>
  1.1221 +void CArrayPtr<T>::ResetAndDestroy()
  1.1222 +/**
  1.1223 +Destroys all objects whose pointers form the elements of the array, before 
  1.1224 +resetting the array.
  1.1225 +
  1.1226 +The destructor of each class T object is called before the objects themselves 
  1.1227 +are destroyed.
  1.1228 +
  1.1229 +If the array is not empty, this member function must be called before the 
  1.1230 +array is deleted to prevent the CBase derived objects from being orphaned 
  1.1231 +on the heap.
  1.1232 +
  1.1233 +Note that each call to this function results in a small, but non-trivial,
  1.1234 +amount of code being generated.
  1.1235 +*/
  1.1236 +	{
  1.1237 +	for (TInt i=0;i<this->Count();++i)
  1.1238 +		delete this->At(i);
  1.1239 +	this->Reset();
  1.1240 +	}
  1.1241 +
  1.1242 +
  1.1243 +
  1.1244 +
  1.1245 +// Template class CArrayPtrFlat
  1.1246 +template <class T>
  1.1247 +inline CArrayPtrFlat<T>::CArrayPtrFlat(TInt aGranularity)
  1.1248 +	: CArrayPtr<T>((TBufRep)CBufFlat::NewL,aGranularity)
  1.1249 +/** 
  1.1250 +Constructs a flat array of pointers with specified granularity.
  1.1251 +
  1.1252 +Note that no memory is allocated to the array buffer by this constructor.
  1.1253 +
  1.1254 +@param aGranularity The granularity of the array. 
  1.1255 +
  1.1256 +@panic E32USER-CBase 18, if aGranularity is not positive.
  1.1257 +*/
  1.1258 +	{}
  1.1259 +
  1.1260 +
  1.1261 +
  1.1262 +
  1.1263 +template <class T>
  1.1264 +inline void CArrayPtrFlat<T>::SetReserveL(TInt aCount)
  1.1265 +/**
  1.1266 +Reserves space in the array buffer.
  1.1267 +
  1.1268 +If necessary, the array buffer is allocated or re-allocated so that it can
  1.1269 +accommodate the specified number of elements.
  1.1270 +
  1.1271 +After a successful call to this function, elements can be added to the array 
  1.1272 +and the process is guaranteed not to fail for lack of memory - provided the 
  1.1273 +total number of elements does not exceed the specified number.
  1.1274 +
  1.1275 +This function does not increase the number of elements in the array; i.e. 
  1.1276 +the member function CArrayFixBase::Count() returns the same value both before 
  1.1277 +and after a call to this function.
  1.1278 +
  1.1279 +@param aCount The total number of elements for which space is to be reserved. 
  1.1280 +
  1.1281 +@panic E32USER-CBase 27, if aCount is less than the current number of elements
  1.1282 +       in the array.
  1.1283 +*/
  1.1284 +	{this->SetReserveFlatL(aCount);}
  1.1285 +
  1.1286 +
  1.1287 +
  1.1288 +
  1.1289 +// Template class CArrayPtrSeg
  1.1290 +template <class T>
  1.1291 +inline CArrayPtrSeg<T>::CArrayPtrSeg(TInt aGranularity)
  1.1292 +	: CArrayPtr<T>((TBufRep)CBufSeg::NewL,aGranularity)
  1.1293 +/**
  1.1294 +Constructs a segmented array of pointers with specified granularity.
  1.1295 +
  1.1296 +Note that no memory is allocated to the array buffer by this constructor.
  1.1297 +
  1.1298 +@param aGranularity The granularity of the array. 
  1.1299 +
  1.1300 +@panic E32USER-CBase 18, if aGranularity is not positive.
  1.1301 +*/
  1.1302 +	{}
  1.1303 +
  1.1304 +
  1.1305 +
  1.1306 +
  1.1307 +// Class CArrayVarBase
  1.1308 +inline TInt CArrayVarBase::Count() const
  1.1309 +/**
  1.1310 +Gets the number of elements held in the array.
  1.1311 +
  1.1312 +@return The number of array elements.
  1.1313 +*/
  1.1314 +	{return(iCount);}
  1.1315 +
  1.1316 +
  1.1317 +
  1.1318 +
  1.1319 +// Template class CArrayVar
  1.1320 +template <class T>
  1.1321 +inline CArrayVar<T>::CArrayVar(TBufRep aRep,TInt aGranularity)
  1.1322 +	: CArrayVarBase(aRep,aGranularity)
  1.1323 +/**
  1.1324 +@internalComponent
  1.1325 +*/
  1.1326 +	{}
  1.1327 +
  1.1328 +
  1.1329 +
  1.1330 +
  1.1331 +template <class T>
  1.1332 +inline const T &CArrayVar<T>::operator[](TInt anIndex) const
  1.1333 +/** 
  1.1334 +Gets a reference to the const element located at the specified position 
  1.1335 +within the array.
  1.1336 +
  1.1337 +The compiler uses this variant of the function if the returned reference is 
  1.1338 +used in an expression where it cannot be modified.
  1.1339 +
  1.1340 +@param anIndex The position of the element within the array, relative to zero; 
  1.1341 +               i.e. zero implies the first element.
  1.1342 +			   
  1.1343 +@return A const reference to the element located at position anIndex within 
  1.1344 +        the array. 
  1.1345 +
  1.1346 +@panic E32USER-CBase 21, if anIndex is negative or greater than or equal to the
  1.1347 +       number of objects currently within the array.
  1.1348 +*/
  1.1349 +	{return(*((const T *)CArrayVarBase::At(anIndex)));}
  1.1350 +
  1.1351 +
  1.1352 +
  1.1353 +
  1.1354 +template <class T>
  1.1355 +inline T &CArrayVar<T>::operator[](TInt anIndex)
  1.1356 +/**
  1.1357 +Gets a reference to the element located at the specified position within 
  1.1358 +the array.
  1.1359 +
  1.1360 +The compiler uses this variant of the function if the returned reference is 
  1.1361 +used in an expression where it can be modified.
  1.1362 +
  1.1363 +@param anIndex The position of the element within the array, relative to zero; 
  1.1364 +               i.e. zero implies the first element.
  1.1365 +
  1.1366 +
  1.1367 +@return A reference to the non-const element located at position anIndex within 
  1.1368 +        the array.
  1.1369 +
  1.1370 +@panic E32USER-CBase 21, if anIndex is negative or greater than or equal to the
  1.1371 +       number of objects currently within the array.
  1.1372 +*/
  1.1373 +	{return(*((T *)CArrayVarBase::At(anIndex)));}
  1.1374 +
  1.1375 +
  1.1376 +
  1.1377 +
  1.1378 +template <class T>
  1.1379 +inline const T &CArrayVar<T>::At(TInt anIndex) const
  1.1380 +/** 
  1.1381 +Gets a reference to the const element located at the specified position 
  1.1382 +within the array.
  1.1383 +
  1.1384 +The compiler uses this variant of the function if the returned reference is 
  1.1385 +used in an expression where it cannot be modified.
  1.1386 +
  1.1387 +@param anIndex The position of the element within the array, relative to zero; 
  1.1388 +               i.e. zero implies the first element.
  1.1389 +			   
  1.1390 +@return A const reference to the element located at position anIndex within 
  1.1391 +        the array. 
  1.1392 +
  1.1393 +@panic E32USER-CBase 21, if anIndex is negative or greater than or equal to the
  1.1394 +       number of objects currently within the array.
  1.1395 +*/
  1.1396 +	{return(*((const T *)CArrayVarBase::At(anIndex)));}
  1.1397 +
  1.1398 +
  1.1399 +
  1.1400 +template <class T>
  1.1401 +inline T &CArrayVar<T>::At(TInt anIndex)
  1.1402 +/**
  1.1403 +Gets a reference to the element located at the specified position within 
  1.1404 +the array.
  1.1405 +
  1.1406 +The compiler uses this variant of the function if the returned reference is 
  1.1407 +used in an expression where it can be modified.
  1.1408 +
  1.1409 +@param anIndex The position of the element within the array, relative to zero; 
  1.1410 +               i.e. zero implies the first element.
  1.1411 +
  1.1412 +@return A reference to the non-const element located at position anIndex within 
  1.1413 +        the array.
  1.1414 +
  1.1415 +@panic E32USER-CBase 21, if anIndex is negative or greater than or equal to the
  1.1416 +       number of objects currently within the array.
  1.1417 +*/
  1.1418 +	{return(*((T *)CArrayVarBase::At(anIndex)));}
  1.1419 +
  1.1420 +
  1.1421 +
  1.1422 +
  1.1423 +template <class T>
  1.1424 +inline void CArrayVar<T>::AppendL(const T &aRef,TInt aLength)
  1.1425 +/**
  1.1426 +Appends an element of a specified length onto the array.
  1.1427 +
  1.1428 +@param aRef    A reference to the <class T> element to be appended.
  1.1429 +@param aLength The length of the element to be appended.
  1.1430 +
  1.1431 +@leave KErrNoMemory The function always attempts to allocate a cell to
  1.1432 +       contain the new element and may also attempt to expand the array buffer.
  1.1433 +	   If there is insufficient memory available, the function leaves, in which
  1.1434 +	   case, the array is left in the state it was in before the call.
  1.1435 +
  1.1436 +@panic E32USER-CBase 30, if aLength is negative.
  1.1437 +*/
  1.1438 +	{CArrayVarBase::InsertL(Count(),&aRef,aLength);}
  1.1439 +
  1.1440 +
  1.1441 +
  1.1442 +
  1.1443 +template <class T>
  1.1444 +inline T &CArrayVar<T>::ExpandL(TInt anIndex,TInt aLength)
  1.1445 +/**
  1.1446 +Expands the array by one element of specified length at the specified position. 
  1.1447 +
  1.1448 +It:
  1.1449 +
  1.1450 +1. expands the array by one element position anIndex
  1.1451 +
  1.1452 +2. constructs a new element of specified length at that position
  1.1453 +
  1.1454 +3. returns a reference to the new element.
  1.1455 +
  1.1456 +All existing elements from position anIndex to the end of the array are moved 
  1.1457 +up, so that the element originally at position anIndex is now at position 
  1.1458 +anIndex + 1 etc.
  1.1459 +
  1.1460 +The new element of type <class T> and length aLength is constructed at position 
  1.1461 +anIndex, using the default constructor of that class.
  1.1462 +
  1.1463 +@param anIndex The position within the array where the array is to be expanded 
  1.1464 +               and the new <class T> object is to be constructed.
  1.1465 +			   
  1.1466 +@param aLength The length of the new element. 
  1.1467 +
  1.1468 +@return A reference to the newly constructed <class T> object at position 
  1.1469 +        anIndex within the array.
  1.1470 +
  1.1471 +@leave KErrNoMemory The function always attempts to allocate a cell to contain 
  1.1472 +       the new element and may also attempt to expand the array buffer. If there 
  1.1473 +       is insufficient memory available, the function leaves, in which case, the 
  1.1474 +       array is left in the state it was in before the call.
  1.1475 +
  1.1476 +@panic E32USER-CBase 21, if anIndex is negative or is greater than the number
  1.1477 +       of elements currently in the array.
  1.1478 +@panic E32USER-CBase 30, if aLength is negative.
  1.1479 +*/
  1.1480 +	{return(*new(CArrayVarBase::ExpandL(anIndex,aLength)) T);}
  1.1481 +
  1.1482 +
  1.1483 +
  1.1484 +
  1.1485 +template <class T>
  1.1486 +inline T &CArrayVar<T>::ExtendL(TInt aLength)
  1.1487 +/**
  1.1488 +Expands the array by one element of specified length at the end of the array. 
  1.1489 +
  1.1490 +It:
  1.1491 +
  1.1492 +1. expands the array by one element at the end of the array, i.e. at position 
  1.1493 +   CArrayVarBase::Count()
  1.1494 +
  1.1495 +2. constructs a new element of specified length at that position.
  1.1496 +
  1.1497 +3. returns a reference to the new element.
  1.1498 +
  1.1499 +The new element of type <class T> is constructed at the end of the array, 
  1.1500 +using the default constructor of that class.
  1.1501 +
  1.1502 +@param aLength The length of the new element.
  1.1503 +
  1.1504 +@return A reference to the newly constructed <class T> object at the end of 
  1.1505 +        the array.
  1.1506 +
  1.1507 +@leave KErrNoMemory The function always attempts to allocate a cell to contain 
  1.1508 +       the new element and may also attempt to expand the array buffer. If there 
  1.1509 +       is insufficient memory available, the function leaves, in which case, the 
  1.1510 +       array is left in the state it was in before the call.
  1.1511 +  
  1.1512 +@panic E32USER-CBase 30, if aLength is negative.
  1.1513 +*/
  1.1514 +	{return(*new(CArrayVarBase::ExpandL(Count(),aLength)) T);}
  1.1515 +
  1.1516 +
  1.1517 +
  1.1518 +
  1.1519 +template <class T>
  1.1520 +inline TInt CArrayVar<T>::Find(const T &aRef,TKeyArrayVar &aKey,TInt &anIndex) const
  1.1521 +/**
  1.1522 +Finds the position of an element within the array, based on the matching of 
  1.1523 +keys, using a sequential search.
  1.1524 +
  1.1525 +The array is searched sequentially for an element whose key matches the key 
  1.1526 +of the supplied object. The search starts with the first element in the array.
  1.1527 +
  1.1528 +Note that where an array has elements with duplicate keys, the function only
  1.1529 +supplies the position of the first element in the array with that key.
  1.1530 +
  1.1531 +@param aRef    A reference to an object of type <class T> whose key is used 
  1.1532 +               for comparison.
  1.1533 +@param aKey    A reference to a key object defining the properties of the key.
  1.1534 +@param anIndex A TInt supplied by the caller. On return, if the element is
  1.1535 +               found, this is set to the position of that element
  1.1536 +			   within the array. The position is relative to zero, (i.e. 
  1.1537 +               the first element in the array is at position 0).
  1.1538 +			   If the element is not found or the array is empty, then
  1.1539 +			   this is undefined.
  1.1540 +
  1.1541 +@return Zero, if the element with the specified key is found. Non-zero, if 
  1.1542 +        the element with the specified key is not found.
  1.1543 +*/
  1.1544 +	{return(CArrayVarBase::Find(&aRef,aKey,anIndex));}
  1.1545 +
  1.1546 +
  1.1547 +
  1.1548 +
  1.1549 +template <class T>
  1.1550 +inline TInt CArrayVar<T>::FindIsq(const T &aRef,TKeyArrayVar &aKey,TInt &anIndex) const
  1.1551 +/**
  1.1552 +Finds the position of an element within the array, based on the matching of 
  1.1553 +keys, using a binary search technique.
  1.1554 +
  1.1555 +The array is searched, using a binary search technique, for an element whose 
  1.1556 +key matches the key of the supplied <class T> object.
  1.1557 +
  1.1558 +The array must be in key order.
  1.1559 +
  1.1560 +Note that where an array has elements with duplicate keys, the function cannot
  1.1561 +guarantee which element, with the given key value, it will return, except that
  1.1562 +it will find one of them.
  1.1563 +
  1.1564 +@param aRef    A reference to an object of type <class T> whose key is used 
  1.1565 +               for comparison.
  1.1566 +@param aKey    A reference to a key object defining the properties of the key.
  1.1567 +@param anIndex A TInt supplied by the caller. On return, if the element is
  1.1568 +               found, this is set to the position  of that element within
  1.1569 +			   the array. The position is relative to zero, (i.e. 
  1.1570 +               the first element in the array is at position zero).
  1.1571 +			   If the element is not found and the array is not empty, then
  1.1572 +			   this is set to the position of the first element in the array
  1.1573 +			   with a key which is greater than the key of the object aRef.
  1.1574 +			   If the element is not found and the array is empty, then 
  1.1575 +               this is undefined.
  1.1576 +
  1.1577 +@return Zero, if the element with the specified key is found or the array is 
  1.1578 +        empty. Non-zero, if the element with the specified key is not found.
  1.1579 +*/
  1.1580 +	{return(CArrayVarBase::FindIsq(&aRef,aKey,anIndex));}
  1.1581 +
  1.1582 +
  1.1583 +
  1.1584 +
  1.1585 +template <class T>
  1.1586 +inline void CArrayVar<T>::InsertL(TInt anIndex,const T &aRef,TInt aLength)
  1.1587 +/**
  1.1588 +Inserts an element of a specified length into the array at the specified
  1.1589 +position.
  1.1590 +
  1.1591 +Note that passing a value of anIndex which is the same as the current number
  1.1592 +of elements in the array, has the effect of appending that element.
  1.1593 +
  1.1594 +@param anIndex The position within the array where the element is to be
  1.1595 +               inserted. The position is relative to zero, i.e. zero implies
  1.1596 +			   that elements are inserted at the beginning of the array.
  1.1597 +@param aRef    A reference to the <class T> object to be inserted into
  1.1598 +               the array.
  1.1599 +@param aLength The length of the element to be inserted into the array. 
  1.1600 +
  1.1601 +@leave KErrNoMemory The function always attempts to allocate a cell to contain 
  1.1602 +       the new element and may also attempt to expand the array buffer. If
  1.1603 +	   there is insufficient memory available, the function leaves, in which
  1.1604 +	   case, the array is left in the state it was in before the call.
  1.1605 +
  1.1606 +@panic E32USER-CBase 21, if anIndex is negative or is greater than the number
  1.1607 +       of objects currently in the array.
  1.1608 +@panic E32USER-CBase 30, if aLength is is negative.
  1.1609 +*/
  1.1610 +	{CArrayVarBase::InsertL(anIndex,&aRef,aLength);}
  1.1611 +
  1.1612 +
  1.1613 +
  1.1614 +
  1.1615 +template <class T>
  1.1616 +inline TInt CArrayVar<T>::InsertIsqL(const T &aRef,TInt aLength,TKeyArrayVar &aKey)
  1.1617 +/**
  1.1618 +Inserts a single element of a specified length into the array at a position 
  1.1619 +determined by a key.
  1.1620 +
  1.1621 +The array MUST already be in key sequence (as defined by the key), otherwise 
  1.1622 +the position of the new element is unpredictable, or duplicates may occur.
  1.1623 +
  1.1624 +Elements with duplicate keys are not permitted.
  1.1625 +
  1.1626 +@param aRef    A reference to the element of type <class T> to be inserted into 
  1.1627 +               the array.
  1.1628 +@param aLength The length of the new element of type <class T> to be inserted 
  1.1629 +               into the array.
  1.1630 +@param aKey    A reference to a key object defining the properties of the key.
  1.1631 +
  1.1632 +@return The position within the array of the newly inserted element.
  1.1633 +
  1.1634 +@leave KErrAlreadyExists An element with the same key already exists within 
  1.1635 +       the array. NB the array MUST already be in key sequence, otherwise
  1.1636 +	   the function may insert a duplicate and fail to leave with
  1.1637 +	   this value.
  1.1638 +@leave KErrNoMemory The function always attempts to allocate a cell to contain 
  1.1639 +       the new element and may also attempt to expand the array buffer. If
  1.1640 +	   there is insufficient memory available, the function leaves, in which
  1.1641 +	   case, the array is left in the state it was in before the call.
  1.1642 +*/
  1.1643 +	{return(CArrayVarBase::InsertIsqL(&aRef,aLength,aKey));}
  1.1644 +
  1.1645 +
  1.1646 +
  1.1647 +
  1.1648 +template <class T>
  1.1649 +inline TInt CArrayVar<T>::InsertIsqAllowDuplicatesL(const T &aRef,TInt aLength,TKeyArrayVar &aKey)
  1.1650 +/**
  1.1651 +Inserts a single element of a specified length into the array at a position 
  1.1652 +determined by a key, allowing duplicates.
  1.1653 +
  1.1654 +The array MUST already be in key sequence, otherwise the position of the 
  1.1655 +new element is unpredictable.
  1.1656 +
  1.1657 +Elements with duplicate keys are permitted. If the new element's key is a 
  1.1658 +duplicate of an existing element's key, then the new element is positioned 
  1.1659 +after the existing element.
  1.1660 +
  1.1661 +@param aRef    A reference to the element of type <class T> to be inserted
  1.1662 +               into the array.
  1.1663 +@param aLength The length of the new element to be inserted into the array. 
  1.1664 +@param aKey    A reference to a key object defining the properties of the key. 
  1.1665 +
  1.1666 +@return The position within the array of the newly inserted element.
  1.1667 +
  1.1668 +@leave KErrNoMemory The function always attempts to allocate a cell to contain 
  1.1669 +       the new element and may also attempt to expand the array buffer. If
  1.1670 +	   there is insufficient memory available, the function leaves, in which
  1.1671 +	   case, the array is left in the state it was in before the call.
  1.1672 +*/
  1.1673 +	{return(CArrayVarBase::InsertIsqAllowDuplicatesL(&aRef,aLength,aKey));}
  1.1674 +
  1.1675 +
  1.1676 +
  1.1677 +
  1.1678 +template <class T>
  1.1679 +inline const TArray<T> CArrayVar<T>::Array() const
  1.1680 +/**
  1.1681 +Constructs and returns a TArray<T> object.
  1.1682 +
  1.1683 +@return A TArray<T> object for this array.
  1.1684 +*/
  1.1685 +	{return(TArray<T>(CountR,AtR,this));}
  1.1686 +
  1.1687 +
  1.1688 +
  1.1689 +
  1.1690 +inline const TAny *CArrayVar<TAny>::At(TInt anIndex) const
  1.1691 +/**
  1.1692 +Returns a pointer to the untyped element located at the specified position 
  1.1693 +within the array.
  1.1694 +	
  1.1695 +The compiler uses this variant of the function if the returned pointer is 
  1.1696 +used in an expression where it cannot be modified.
  1.1697 +	
  1.1698 +@param anIndex The position of the element within the array, relative to zero; 
  1.1699 +	           i.e. zero implies the first element.
  1.1700 +
  1.1701 +@return A pointer to the const element located at position anIndex within the 
  1.1702 +        array.
  1.1703 +
  1.1704 +@panic E32USER-CBase 21, if anIndex is negative or greater than or equal to the
  1.1705 +       number of objects currently within the array.
  1.1706 +*/
  1.1707 +	{return(CArrayVarBase::At(anIndex));}
  1.1708 +
  1.1709 +
  1.1710 +
  1.1711 +
  1.1712 +inline CArrayVar<TAny>::CArrayVar(TBufRep aRep,TInt aGranularity)
  1.1713 +	: CArrayVarBase(aRep,aGranularity)
  1.1714 +/**
  1.1715 +Constructs a variable array with the specified granularity and buffer
  1.1716 +organization.
  1.1717 +	
  1.1718 +Note that no memory is allocated to the array buffer by this constructor.
  1.1719 +	
  1.1720 +@param aRep         A pointer to a function used to expand the array buffer.
  1.1721 +                    The organisation of the array buffer is implied by the
  1.1722 +					choice of this function.
  1.1723 +			        For a flat array buffer, pass (TBufRep)CBufFlat::NewL.
  1.1724 +			        For a segmented array buffer, pass (TBufRep)CBufSeg::NewL. 
  1.1725 +@param aGranularity The granularity of the array. 
  1.1726 +
  1.1727 +@panic E32USER-CBase 19, if aGranularity is not positive.
  1.1728 +*/
  1.1729 +	{}
  1.1730 +
  1.1731 +
  1.1732 +
  1.1733 +
  1.1734 +inline TAny *CArrayVar<TAny>::At(TInt anIndex)
  1.1735 +/**
  1.1736 +Returns a pointer to the untyped element located at the specified position 
  1.1737 +within the array.
  1.1738 +	
  1.1739 +The compiler uses this variant of the function if the returned pointer is 
  1.1740 +used in an expression where it can be modified.
  1.1741 +	
  1.1742 +@param anIndex The position of the element within the array, relative to zero; 
  1.1743 +	           i.e. zero implies the first element.
  1.1744 +
  1.1745 +@return A pointer to the non-const element located at position anIndex within the 
  1.1746 +        array.
  1.1747 +
  1.1748 +@panic E32USER-CBase 21, if anIndex is negative or greater than or equal to the
  1.1749 +       number of objects currently within the array.
  1.1750 +*/
  1.1751 +	{return(CArrayVarBase::At(anIndex));}
  1.1752 +
  1.1753 +
  1.1754 +
  1.1755 +
  1.1756 +inline void CArrayVar<TAny>::AppendL(const TAny *aPtr,TInt aLength)
  1.1757 +/**
  1.1758 +Appends an untyped element of specified length onto the end of the array.
  1.1759 +	
  1.1760 +@param aPtr    A pointer to an untyped element to be appended. 
  1.1761 +@param aLength The length of the untyped element.
  1.1762 +*/
  1.1763 +	{CArrayVarBase::InsertL(Count(),aPtr,aLength);}
  1.1764 +
  1.1765 +
  1.1766 +
  1.1767 +
  1.1768 +inline TAny *CArrayVar<TAny>::ExtendL(TInt aLength)
  1.1769 +/**
  1.1770 +Extends the array by one element of specified length at the end of the array,
  1.1771 +i.e. at position CArrayVarBase::Count(), and returns a pointer to the new
  1.1772 +element location.
  1.1773 +
  1.1774 +As elements are untyped, no construction is possible and the content of the
  1.1775 +new location remains undefined.
  1.1776 +
  1.1777 +Note that the function always attempts to allocate a cell to contain the new
  1.1778 +element and may also attempt to expand the array buffer. If there is
  1.1779 +insufficient memory available, the function leaves.
  1.1780 +The leave code is one of the system wide error codes.
  1.1781 +If the function leaves, the array is left in the state it was in before
  1.1782 +the call. 
  1.1783 +
  1.1784 +@param aLength The length of the new element.
  1.1785 +
  1.1786 +@return A pointer to the new element location at the end of the array. 
  1.1787 +*/
  1.1788 +	{return(CArrayVarBase::ExpandL(Count(),aLength));}
  1.1789 +
  1.1790 +
  1.1791 +
  1.1792 +
  1.1793 +// Template class CArrayVarFlat
  1.1794 +template <class T>
  1.1795 +inline CArrayVarFlat<T>::CArrayVarFlat(TInt aGranularity)
  1.1796 +	: CArrayVar<T>((TBufRep)CBufFlat::NewL,aGranularity)
  1.1797 +/**
  1.1798 +Constructs a variable flat array with specified granularity.
  1.1799 +
  1.1800 +Note that no memory is allocated to the array buffer by this constructor.
  1.1801 +
  1.1802 +@param aGranularity The granularity of the array. 
  1.1803 +
  1.1804 +@panic E32USER-CBase 19, if aGranularity is not positive.
  1.1805 +*/
  1.1806 +	{}
  1.1807 +
  1.1808 +
  1.1809 +
  1.1810 +
  1.1811 +// Template class CArrayVarSeg
  1.1812 +template <class T>
  1.1813 +inline CArrayVarSeg<T>::CArrayVarSeg(TInt aGranularity)
  1.1814 +	: CArrayVar<T>((TBufRep)CBufSeg::NewL,aGranularity)
  1.1815 +/**
  1.1816 +Constructs a variable segmented array with specified granularity.
  1.1817 +
  1.1818 +Note that no memory is allocated to the array buffer by this constructor.
  1.1819 +
  1.1820 +@param aGranularity The granularity of the array.
  1.1821 +
  1.1822 +@panic E32USER-CBase 19, if aGranularity is not positive.
  1.1823 +*/
  1.1824 +	{}
  1.1825 +
  1.1826 +
  1.1827 +
  1.1828 +
  1.1829 +// Class CArrayPakBase
  1.1830 +inline TInt CArrayPakBase::Count() const
  1.1831 +/**
  1.1832 +Gets the number of elements held in the array.
  1.1833 +
  1.1834 +@return The number of array elements.
  1.1835 +*/
  1.1836 +	{return(iCount);}
  1.1837 +
  1.1838 +
  1.1839 +
  1.1840 +
  1.1841 +// Template class CArrayPak
  1.1842 +template <class T>
  1.1843 +inline CArrayPak<T>::CArrayPak(TBufRep aRep,TInt aGranularity)
  1.1844 +	: CArrayPakBase(aRep,aGranularity)
  1.1845 +/**
  1.1846 +@internalComponent
  1.1847 +*/
  1.1848 +	{}
  1.1849 +
  1.1850 +
  1.1851 +
  1.1852 +
  1.1853 +template <class T>
  1.1854 +inline const T &CArrayPak<T>::operator[](TInt anIndex) const
  1.1855 +/**
  1.1856 +Gets a reference to the element located at the specified position within the 
  1.1857 +array.
  1.1858 +
  1.1859 +The compiler uses this variant of the function when the returned reference 
  1.1860 +is used in an expression where it cannot be modified.
  1.1861 +
  1.1862 +@param anIndex The position of the element within the array. The position 
  1.1863 +               is relative to zero; i.e. zero implies the first element in
  1.1864 +			   the array.  
  1.1865 +		
  1.1866 +@return A const reference to the element located at position anIndex within 
  1.1867 +        the array.
  1.1868 +
  1.1869 +@panic E32USER-CBase 21, if anIndex is negative or greater than or equal to
  1.1870 +       number of objects currently within the array.
  1.1871 +*/
  1.1872 +	{return(*((const T *)CArrayPakBase::At(anIndex)));}
  1.1873 +
  1.1874 +
  1.1875 +
  1.1876 +
  1.1877 +template <class T>
  1.1878 +inline T &CArrayPak<T>::operator[](TInt anIndex)
  1.1879 +/**
  1.1880 +Gets a reference to the element located at the specified position within the 
  1.1881 +array.
  1.1882 +
  1.1883 +The compiler uses this variant of the function when the returned reference 
  1.1884 +is used in an expression where it can be modified.
  1.1885 +
  1.1886 +@param anIndex The position of the element within the array. The position 
  1.1887 +               is relative to zero; i.e. zero implies the first element in
  1.1888 +			   the array.  
  1.1889 +		
  1.1890 +@return A non-const reference to the element located at position anIndex within 
  1.1891 +        the array.
  1.1892 +
  1.1893 +@panic E32USER-CBase 21, if anIndex is negative or greater than or equal to
  1.1894 +       number of objects currently within the array.
  1.1895 +*/
  1.1896 +	{return(*((T *)CArrayPakBase::At(anIndex)));}
  1.1897 +
  1.1898 +
  1.1899 +
  1.1900 +
  1.1901 +template <class T>
  1.1902 +inline const T &CArrayPak<T>::At(TInt anIndex) const
  1.1903 +/**
  1.1904 +Gets a reference to the element located at the specified position within the 
  1.1905 +array.
  1.1906 +
  1.1907 +The compiler uses this variant of the function when the returned reference 
  1.1908 +is used in an expression where it cannot be modified.
  1.1909 +
  1.1910 +@param anIndex The position of the element within the array. The position 
  1.1911 +               is relative to zero; i.e. zero implies the first element in
  1.1912 +			   the array.  
  1.1913 +		
  1.1914 +@return A const reference to the element located at position anIndex within 
  1.1915 +        the array.
  1.1916 +
  1.1917 +@panic E32USER-CBase 21, if anIndex is negative or greater than or equal to
  1.1918 +       number of objects currently within the array.
  1.1919 +*/
  1.1920 +	{return(*((const T *)CArrayPakBase::At(anIndex)));}
  1.1921 +
  1.1922 +
  1.1923 +
  1.1924 +
  1.1925 +template <class T>
  1.1926 +inline T &CArrayPak<T>::At(TInt anIndex)
  1.1927 +/**
  1.1928 +Gets a reference to the element located at the specified position within the 
  1.1929 +array.
  1.1930 +
  1.1931 +The compiler uses this variant of the function when the returned reference 
  1.1932 +is used in an expression where it can be modified.
  1.1933 +
  1.1934 +@param anIndex The position of the element within the array. The position 
  1.1935 +               is relative to zero; i.e. zero implies the first element in
  1.1936 +			   the array.  
  1.1937 +		
  1.1938 +@return A non-const reference to the element located at position anIndex within 
  1.1939 +        the array.
  1.1940 +
  1.1941 +@panic E32USER-CBase 21, if anIndex is negative or greater than or equal to
  1.1942 +       number of objects currently within the array.
  1.1943 +*/
  1.1944 +	{return(*((T *)CArrayPakBase::At(anIndex)));}
  1.1945 +
  1.1946 +
  1.1947 +
  1.1948 +
  1.1949 +template <class T>
  1.1950 +inline void CArrayPak<T>::AppendL(const T &aRef,TInt aLength)
  1.1951 +/**
  1.1952 +Appends an element of a specified length onto the array.
  1.1953 +
  1.1954 +@param aRef    A reference to the class T element to be appended.
  1.1955 +@param aLength The length of the element to be appended.
  1.1956 +
  1.1957 +@leave KErrNoMemory The function attempted to allocate from the heap and there 
  1.1958 +       is insufficient memory available. In this case, the array is left in
  1.1959 +	   the state it was in before the call.
  1.1960 +
  1.1961 +@panic E32USER-CBase 30, if aLength is negative.
  1.1962 +*/
  1.1963 +	{CArrayPakBase::InsertL(Count(),&aRef,aLength);}
  1.1964 +
  1.1965 +
  1.1966 +
  1.1967 +
  1.1968 +template <class T>
  1.1969 +inline T &CArrayPak<T>::ExpandL(TInt anIndex,TInt aLength)
  1.1970 +/**
  1.1971 +Expands the array by one element of specified length at the specified position. 
  1.1972 +
  1.1973 +It:
  1.1974 +
  1.1975 +1. expands the array by one element at the specified position.
  1.1976 +
  1.1977 +2. constructs a new element of specified length at that position.
  1.1978 +
  1.1979 +3. returns a reference to the new element.
  1.1980 +
  1.1981 +All existing elements from position anIndex to the end of the array are moved 
  1.1982 +up, so that the element originally at position anIndex is now at position 
  1.1983 +anIndex + 1 etc.
  1.1984 +
  1.1985 +The new element of type <class T> and length aLength is constructed at position 
  1.1986 +anIndex, using the default constructor of that class.
  1.1987 +
  1.1988 +@param anIndex The position within the array where the array is to be expanded 
  1.1989 +               and the new <class T> object is to be constructed. 
  1.1990 +@param aLength The length of the new element.
  1.1991 +
  1.1992 +@return A reference to the newly constructed <class T> object at position 
  1.1993 +        anIndex within the array.
  1.1994 +
  1.1995 +@leave KErrNoMemory The function attempted to allocate from the heap and there 
  1.1996 +       is insufficient memory available. In this case, the array is left in the
  1.1997 +	   state it was in before the call.
  1.1998 +
  1.1999 +@panic E32USER-CBase 21, if anIndex is negative or greater than the number of
  1.2000 +       elements currently in the array.
  1.2001 +@panic E32USER-CBase 30, if aLength is negative.
  1.2002 +*/
  1.2003 +	{return(*new(CArrayPakBase::ExpandL(anIndex,aLength)) T);}
  1.2004 +
  1.2005 +
  1.2006 +
  1.2007 +
  1.2008 +template <class T>
  1.2009 +inline T &CArrayPak<T>::ExtendL(TInt aLength)
  1.2010 +/**
  1.2011 +Expands the array by one element of specified length at the end of the array. 
  1.2012 +
  1.2013 +It:
  1.2014 +
  1.2015 +1. expands the array by one element at the end of the array, i.e. at position 
  1.2016 +   CArrayPakbase::Count().
  1.2017 +
  1.2018 +2. constructs a new element of length aLength at that position.
  1.2019 +
  1.2020 +3. returns a reference to the new element.
  1.2021 +
  1.2022 +The new element of type <class T> is constructed at the end of the array, 
  1.2023 +using the default constructor of that class.
  1.2024 +
  1.2025 +@param aLength The length of the new element.
  1.2026 +
  1.2027 +@return A reference to the newly constructed <class T> object at the end of 
  1.2028 +        the array.
  1.2029 +
  1.2030 +@leave KErrNoMemory The function attempted to allocate from the heap and there 
  1.2031 +       is insufficient memory available. In this case, the array is left in the
  1.2032 +	   state it was in before the call.
  1.2033 +
  1.2034 +@panic E32USER-CBase 30, if aLength is negative.
  1.2035 +*/
  1.2036 +	{return(*new(CArrayPakBase::ExpandL(Count(),aLength)) T);}
  1.2037 +
  1.2038 +
  1.2039 +
  1.2040 +
  1.2041 +template <class T>
  1.2042 +inline TInt CArrayPak<T>::Find(const T &aRef,TKeyArrayPak &aKey,TInt &anIndex) const
  1.2043 +/**
  1.2044 +Finds the position of an element within the array, based on the matching of 
  1.2045 +keys, using a sequential search.
  1.2046 +
  1.2047 +The array is searched sequentially for an element whose key matches the key 
  1.2048 +of the supplied <class T> object. The search starts with the first element 
  1.2049 +in the array.
  1.2050 +
  1.2051 +Note that where an array has elements with duplicate keys, the function only
  1.2052 +supplies the position of the first element in the array with that key.
  1.2053 +
  1.2054 +@param aRef    A reference to an object of type <class T> whose key is used 
  1.2055 +               for comparison.
  1.2056 +@param aKey    A reference to a key object defining the properties of the key.
  1.2057 +@param anIndex A reference to a TInt supplied by the caller. On return, if the
  1.2058 +               element is found, this is set to the position 
  1.2059 +               of that element within the array. The position is relative to zero, (i.e. 
  1.2060 +               the first element in the array is at position 0).
  1.2061 +			   If the element is not found or the array is empty, then this is undefined.
  1.2062 +
  1.2063 +@return Zero, if the element with the specified key is found. Non-zero, if 
  1.2064 +        the element with the specified key is not found.
  1.2065 +*/
  1.2066 +	{return(CArrayPakBase::Find(&aRef,aKey,anIndex));}
  1.2067 +
  1.2068 +
  1.2069 +
  1.2070 +
  1.2071 +template <class T>
  1.2072 +inline TInt CArrayPak<T>::FindIsq(const T &aRef,TKeyArrayPak &aKey,TInt &anIndex) const
  1.2073 +/**
  1.2074 +Finds the position of an element within the array, based on the matching of 
  1.2075 +keys, using a binary search technique.
  1.2076 +
  1.2077 +The array is searched, using a binary search technique, for an element whose 
  1.2078 +key matches the key of the supplied <class T> object.
  1.2079 +
  1.2080 +The array must be in key order.
  1.2081 +
  1.2082 +Note that where an array has elements with duplicate keys, the function cannot
  1.2083 +guarantee which element, with the given key value, it will return, except that it
  1.2084 +will find one of them.
  1.2085 +
  1.2086 +@param aRef    A reference to an object of type <class T> whose key is used 
  1.2087 +               for comparison.
  1.2088 +@param aKey    A reference to a key object defining the properties of the key.
  1.2089 +@param anIndex A reference to a TInt supplied by the caller. On return, if the
  1.2090 +               element is found, this is set to the position of that element
  1.2091 +			   within the array. The position is relative to zero, (i.e. 
  1.2092 +               the first element in the array is at position 0).
  1.2093 +			   If the element is not found and the array is not empty, then
  1.2094 +			   this is set to the position of the first element in the array
  1.2095 +			   with a key which is greater than the key of the object aRef.
  1.2096 +			   If the element is not found and the array is empty, then this 
  1.2097 +               is undefined.
  1.2098 +
  1.2099 +@return Zero, if the element with the specified key is found or the array is 
  1.2100 +        empty.
  1.2101 +		Non-zero, if the element with the specified key is not found.
  1.2102 +*/
  1.2103 +	{return(CArrayPakBase::FindIsq(&aRef,aKey,anIndex));}
  1.2104 +
  1.2105 +
  1.2106 +
  1.2107 +
  1.2108 +template <class T>
  1.2109 +inline void CArrayPak<T>::InsertL(TInt anIndex,const T &aRef,TInt aLength)
  1.2110 +/** 
  1.2111 +Inserts an element of a specified length into the array at the specified
  1.2112 +position.
  1.2113 +
  1.2114 +@param anIndex The position within the array where the element is to be
  1.2115 +               inserted. The position is relative to zero, i.e. zero implies
  1.2116 +			   that elements are inserted at the beginning of the array.
  1.2117 +@param aRef    A reference to the class T object to be inserted into
  1.2118 +               the array.
  1.2119 +@param aLength The length of the element to be inserted into the array.
  1.2120 +
  1.2121 +@leave KErrNoMemory The function attempted to expand the array buffer and there
  1.2122 +       is insufficient memory available. In this case, the array is left in the
  1.2123 +	   state it was in before the call.
  1.2124 +
  1.2125 +@panic E32USER-CBase 21, if anIndex is negative or greater than the number of
  1.2126 +       objects currently in the array.
  1.2127 +@panic E32USER-CBase 30, if aLength is negative.
  1.2128 +*/
  1.2129 +	{CArrayPakBase::InsertL(anIndex,&aRef,aLength);}
  1.2130 +
  1.2131 +
  1.2132 +
  1.2133 +
  1.2134 +template <class T>
  1.2135 +inline TInt CArrayPak<T>::InsertIsqL(const T &aRef,TInt aLength,TKeyArrayPak &aKey)
  1.2136 +/**
  1.2137 +Inserts a single element of a specified length into the array at a position 
  1.2138 +determined by a key.
  1.2139 +
  1.2140 +The array MUST already be in key sequence (as defined by the key), otherwise 
  1.2141 +the position of the new element is unpredictable, or duplicates may occur.
  1.2142 +
  1.2143 +Elements with duplicate keys are not permitted.
  1.2144 +
  1.2145 +@param aRef    A reference to the element of type <class T> to be inserted into 
  1.2146 +               the array.
  1.2147 +@param aLength The length of the new element of type <class T> to be inserted 
  1.2148 +               into the array.
  1.2149 +@param aKey    A reference to a key object defining the properties of the key.
  1.2150 +
  1.2151 +@return The position within the array of the newly inserted element.
  1.2152 +
  1.2153 +@leave KErrAlreadyExists An element with the same key already exists within 
  1.2154 +       the array. NB the array MUST already be in key sequence, otherwise
  1.2155 +	   the function may insert a duplicate and fail to leave with
  1.2156 +	   this value.
  1.2157 +@leave KErrNoMemory The function attempted to expand the array buffer and there 
  1.2158 +       is insufficient memory available. In this case, the array is left in the
  1.2159 +	   state it was in before the call.
  1.2160 +*/
  1.2161 +	{return(CArrayPakBase::InsertIsqL(&aRef,aLength,aKey));}
  1.2162 +
  1.2163 +
  1.2164 +
  1.2165 +
  1.2166 +template <class T>
  1.2167 +inline TInt CArrayPak<T>::InsertIsqAllowDuplicatesL(const T &aRef,TInt aLength,TKeyArrayPak &aKey)
  1.2168 +/**
  1.2169 +Inserts a single element of a specified length into the array at a position 
  1.2170 +determined by a key, allowing duplicates.
  1.2171 +
  1.2172 +The array MUST already be in key sequence, otherwise the position of the 
  1.2173 +new element is unpredictable.
  1.2174 +
  1.2175 +Elements with duplicate keys are permitted. If the new element's key is a 
  1.2176 +duplicate of an existing element's key, then the new element is positioned 
  1.2177 +after the existing element.
  1.2178 +
  1.2179 +@param aRef    A reference to the element of type <class T> to be inserted into
  1.2180 +               the array.
  1.2181 +@param aLength The length of the new element to be inserted into the array.
  1.2182 +@param aKey    A reference to a key object defining the properties of the key.
  1.2183 +
  1.2184 +@return The position within the array of the newly inserted element. 
  1.2185 +
  1.2186 +@leave KErrNoMemory The function attempted to expand the array buffer and there 
  1.2187 +       is insufficient memory available. In this case, the array is left in the
  1.2188 +	   state it was in before the call.
  1.2189 +*/
  1.2190 +	{return(CArrayPakBase::InsertIsqAllowDuplicatesL(&aRef,aLength,aKey));}
  1.2191 +
  1.2192 +
  1.2193 +
  1.2194 +
  1.2195 +template <class T>
  1.2196 +inline const TArray<T> CArrayPak<T>::Array() const
  1.2197 +/**
  1.2198 +Constructs and returns a TArray<T> object.
  1.2199 +
  1.2200 +@return A Tarray<T> object for this array.
  1.2201 +*/
  1.2202 +	{return(TArray<T>(CountR,AtR,this));}
  1.2203 +
  1.2204 +
  1.2205 +
  1.2206 +
  1.2207 +inline CArrayPak<TAny>::CArrayPak(TBufRep aRep,TInt aGranularity)
  1.2208 +	: CArrayPakBase(aRep,aGranularity)
  1.2209 +/**
  1.2210 +Constructs a variable array with the specified granularity and
  1.2211 +buffer organisation.
  1.2212 +	
  1.2213 +Note that no memory is allocated to the array buffer by this constructor.
  1.2214 +	
  1.2215 +@param aRep         A pointer to a function used to expand the array buffer. 
  1.2216 +                    The organisation of the array buffer is implied by the
  1.2217 +					choice of this function.
  1.2218 +	                For a flat array buffer, pass (TBufRep)CBufFlat::NewL.
  1.2219 +			        For a segmented array buffer, pass (TBufRep)CBufSeg::NewL. 
  1.2220 +@param aGranularity The granularity of the array. 
  1.2221 +
  1.2222 +@panic E32USER-CBase 19, if aGranularity is not positive.
  1.2223 +*/
  1.2224 +	{}
  1.2225 +
  1.2226 +
  1.2227 +
  1.2228 +
  1.2229 +inline const TAny *CArrayPak<TAny>::At(TInt anIndex) const
  1.2230 +/**
  1.2231 +Gets a pointer to the untyped element located at the specified position 
  1.2232 +within the array.
  1.2233 +	
  1.2234 +The compiler uses this variant of the function if the returned reference is 
  1.2235 +used in an expression where that reference cannot be modified.
  1.2236 +	
  1.2237 +@param anIndex The position of the element within the array, relative to zero; 
  1.2238 +               i.e. zero implies the first element.
  1.2239 +
  1.2240 +@return A pointer to the const element located at position anIndex within 
  1.2241 +	    the array.
  1.2242 +
  1.2243 +@panic E32USER-CBase 21, if anIndex is negative or greater than or equal to
  1.2244 +       the number of objects currently within the array.
  1.2245 +*/
  1.2246 +	{return(CArrayPakBase::At(anIndex));}
  1.2247 +
  1.2248 +
  1.2249 +
  1.2250 +
  1.2251 +inline TAny *CArrayPak<TAny>::At(TInt anIndex)
  1.2252 +/**
  1.2253 +Gets a pointer to the untyped element located at the specified position 
  1.2254 +within the array.
  1.2255 +	
  1.2256 +The compiler uses this variant of the function if the returned reference is 
  1.2257 +used in an expression where that reference can be modified.
  1.2258 +	
  1.2259 +@param anIndex The position of the element within the array, relative to zero; 
  1.2260 +               i.e. zero implies the first element.
  1.2261 +
  1.2262 +@return A pointer to the non-const element located at position anIndex within 
  1.2263 +	    the array.
  1.2264 +
  1.2265 +@panic E32USER-CBase 21, if anIndex is negative or greater than or equal to
  1.2266 +       the number of objects currently within the array.
  1.2267 +*/
  1.2268 +	{return(CArrayPakBase::At(anIndex));}
  1.2269 +
  1.2270 +
  1.2271 +
  1.2272 +
  1.2273 +inline void CArrayPak<TAny>::AppendL(const TAny *aPtr,TInt aLength)
  1.2274 +/**
  1.2275 +Appends the untyped element of the specified length onto the end of the array.
  1.2276 +	
  1.2277 +@param aPtr    A pointer to an untyped element to be appended. 
  1.2278 +@param aLength The length of the untyped element. 
  1.2279 +
  1.2280 +@leave KErrNoMemory The function attempted to expand the array buffer and there 
  1.2281 +       is insufficient memory available. In this case, the array is left in the
  1.2282 +	   state it was in before the call.
  1.2283 +*/
  1.2284 +	{CArrayPakBase::InsertL(Count(),aPtr,aLength);}
  1.2285 +
  1.2286 +
  1.2287 +
  1.2288 +
  1.2289 +inline TAny *CArrayPak<TAny>::ExtendL(TInt aLength)
  1.2290 +/**
  1.2291 +Expands the array by one element of the specified length at the end of
  1.2292 +the array, and returns a pointer to this new location.
  1.2293 +
  1.2294 +As elements are untyped, no construction is possible and the content of
  1.2295 +the new location remains undefined.
  1.2296 +
  1.2297 +@param aLength  The length of the new element.
  1.2298 +
  1.2299 +@return A pointer to the new element location at the end of the array.
  1.2300 +
  1.2301 +@leave KErrNoMemory The function attempted to expand the array buffer and there
  1.2302 +       is insufficient memory available. In this case, the array is left in the
  1.2303 +	   state it was in before the call.
  1.2304 +*/
  1.2305 +	{return(CArrayPakBase::ExpandL(Count(),aLength));}
  1.2306 +
  1.2307 +
  1.2308 +
  1.2309 +
  1.2310 +// Template class CArrayPakFlat
  1.2311 +template <class T>
  1.2312 +inline CArrayPakFlat<T>::CArrayPakFlat(TInt aGranularity)
  1.2313 +	: CArrayPak<T>((TBufRep)CBufFlat::NewL,aGranularity)
  1.2314 +/**
  1.2315 +Constructs a packed flat array with specified granularity.
  1.2316 +
  1.2317 +Note that no memory is allocated to the array buffer by this  constructor.
  1.2318 +
  1.2319 +@param aGranularity The granularity of the array.
  1.2320 +
  1.2321 +@panic E32USER-CBase 20, if aGranularity is not positive.
  1.2322 +*/
  1.2323 +	{}
  1.2324 +
  1.2325 +
  1.2326 +
  1.2327 +
  1.2328 +// Class CObject
  1.2329 +inline TInt CObject::UniqueID() const
  1.2330 +/**
  1.2331 +Gets this reference counting object's unique ID.
  1.2332 +
  1.2333 +The unique ID is an integer which is a property of the object container. It 
  1.2334 +forms part of the identity of all reference counting objects and is the same 
  1.2335 +value for all reference counting objects held within the same object container.
  1.2336 +
  1.2337 +@return This reference counting object's unique ID.
  1.2338 +
  1.2339 +@see CObjectCon
  1.2340 +*/
  1.2341 +	{return(iContainer->UniqueID());}
  1.2342 +
  1.2343 +
  1.2344 +
  1.2345 +
  1.2346 +inline TInt CObject::AccessCount() const
  1.2347 +/**
  1.2348 +Gets the number of open references to this reference counting object.
  1.2349 +
  1.2350 +@return The number of open references.
  1.2351 +*/
  1.2352 +	{return(iAccessCount);}
  1.2353 +
  1.2354 +
  1.2355 +
  1.2356 +
  1.2357 +inline void CObject::Inc()
  1.2358 +/**
  1.2359 +Adds one to the reference count.
  1.2360 +
  1.2361 +This function is called by the default implementation of the Open() member 
  1.2362 +function of this class.
  1.2363 +
  1.2364 +@see CObject::Open
  1.2365 +*/
  1.2366 +	{iAccessCount++;}
  1.2367 +
  1.2368 +
  1.2369 +
  1.2370 +
  1.2371 +inline void CObject::Dec()
  1.2372 +/**
  1.2373 +Subtracts one from the reference count.
  1.2374 +
  1.2375 +This function is called by the default implementation of the Close() member 
  1.2376 +function of this class.
  1.2377 +
  1.2378 +@see CObject::Close
  1.2379 +*/
  1.2380 +	{iAccessCount--;}
  1.2381 +
  1.2382 +
  1.2383 +
  1.2384 +
  1.2385 +inline CObject * CObject::Owner() const
  1.2386 +/**
  1.2387 +Gets a pointer to the reference counting object which owns this
  1.2388 +reference counting object.
  1.2389 +
  1.2390 +@return A pointer to the owning reference counting object. This is NULL, if 
  1.2391 +        there is no owner.
  1.2392 +*/
  1.2393 +	{return(iOwner);}
  1.2394 +
  1.2395 +
  1.2396 +
  1.2397 +
  1.2398 +inline void CObject::SetOwner(CObject *anOwner)
  1.2399 +/**
  1.2400 +Sets the owner of this reference counting object.
  1.2401 +
  1.2402 +If this reference counting object already has an owner, then all knowledge 
  1.2403 +of that owner is lost.
  1.2404 +
  1.2405 +@param anOwner A pointer to the reference counting object which is to be the 
  1.2406 +               new owner of this reference counting object.
  1.2407 +*/
  1.2408 +	{iOwner=anOwner;}
  1.2409 +
  1.2410 +
  1.2411 +
  1.2412 +
  1.2413 +// class CObjectIx
  1.2414 +inline TInt CObjectIx::Count() const
  1.2415 +/**
  1.2416 +Gets the number greater then the last slot number used to hold valid CObject pointer.
  1.2417 +The input argument of CObject* CObjectIx::operator[]() must be less then the number returned by this method.
  1.2418 +
  1.2419 +@return The number greater then the last used slot.
  1.2420 +
  1.2421 +@see CObjectIx::ActiveCount
  1.2422 +@see CObjectIx::operator[]
  1.2423 +*/
  1.2424 +	{return iHighWaterMark;}
  1.2425 +
  1.2426 +
  1.2427 +
  1.2428 +
  1.2429 +inline TInt CObjectIx::ActiveCount() const
  1.2430 +/**
  1.2431 +Gets the current number of reference counting objects held by this
  1.2432 +object index.
  1.2433 +
  1.2434 +@return The current number.
  1.2435 +*/
  1.2436 +	{return iNumEntries;}
  1.2437 +
  1.2438 +
  1.2439 +
  1.2440 +// class CObjectCon
  1.2441 +inline TInt CObjectCon::UniqueID() const
  1.2442 +/**
  1.2443 +Gets this object container's unique ID.
  1.2444 +
  1.2445 +@return The unique ID value.
  1.2446 +*/
  1.2447 +	{return iUniqueID;}
  1.2448 +
  1.2449 +
  1.2450 +
  1.2451 +
  1.2452 +inline TInt CObjectCon::Count() const
  1.2453 +/**
  1.2454 +Gets the number of reference counting objects in this object container.
  1.2455 +
  1.2456 +@return The number of objects.
  1.2457 +*/
  1.2458 +	{return iCount;}
  1.2459 +
  1.2460 +
  1.2461 +
  1.2462 +
  1.2463 +
  1.2464 +// class CCirBufBase
  1.2465 +inline TInt CCirBufBase::Count() const
  1.2466 +/**
  1.2467 +Gets the current number of objects in this circular buffer.
  1.2468 +
  1.2469 +@return The number of objects in this circular buffer.
  1.2470 +        This value can never be greater than the maximum capacity.
  1.2471 +*/
  1.2472 +	{return(iCount);}
  1.2473 +
  1.2474 +
  1.2475 +
  1.2476 +
  1.2477 +inline TInt CCirBufBase::Length() const
  1.2478 +/**
  1.2479 +Gets the maximum capacity of this circular buffer.
  1.2480 +
  1.2481 +The capacity is the maximum number of elements that the buffer can hold.
  1.2482 +
  1.2483 +Use SetLengthL() to change the capacity of the circular buffer.
  1.2484 +
  1.2485 +@return The maximum capacity of this circular buffer.
  1.2486 +
  1.2487 +@see CCirBufBase::SetLengthL
  1.2488 +*/
  1.2489 +	{return(iLength);}
  1.2490 +
  1.2491 +
  1.2492 +
  1.2493 +
  1.2494 +// Template class CCirBuf
  1.2495 +template <class T>
  1.2496 +inline CCirBuf<T>::CCirBuf()
  1.2497 +	: CCirBufBase(sizeof(T))
  1.2498 +/**
  1.2499 +Default C++ constructor.
  1.2500 +
  1.2501 +The size of each object in the buffer is fixed and is the length of the class 
  1.2502 +passed as the template parameter. 
  1.2503 +
  1.2504 +@panic E32USER-CBase 72, if the length of the template class is zero.
  1.2505 +*/
  1.2506 +	{}
  1.2507 +
  1.2508 +
  1.2509 +
  1.2510 +
  1.2511 +template <class T>
  1.2512 +inline TInt CCirBuf<T>::Add(const T *aPtr)
  1.2513 +/**
  1.2514 +Adds a single object to the circular buffer.
  1.2515 +
  1.2516 +The object is of type class T and is only added if there is space available.
  1.2517 +
  1.2518 +@param aPtr A pointer to the object of type class T to be added to the circular 
  1.2519 +            buffer.
  1.2520 +
  1.2521 +@return 1 if the object is successfully added. 0 if the object cannot be added 
  1.2522 +        because the circular buffer is full.
  1.2523 +
  1.2524 +@panic E32USER-CBase 74, if a call to CCirBufBase::SetLengthL() has not been
  1.2525 +                         made before calling this function.
  1.2526 +
  1.2527 +@see CCirBufBase::SetLengthL
  1.2528 +*/
  1.2529 +	{return(DoAdd((const TUint8 *)aPtr));}
  1.2530 +
  1.2531 +
  1.2532 +
  1.2533 +
  1.2534 +template <class T>
  1.2535 +inline TInt CCirBuf<T>::Add(const T *aPtr,TInt aCount)
  1.2536 +/**
  1.2537 +Adds multiple objects to the circular buffer.
  1.2538 +
  1.2539 +The function attempts to add aCount objects of type class T. The objects are
  1.2540 +only added if there is space available.
  1.2541 +
  1.2542 +@param aPtr   A pointer to a set of contiguous objects of type class T to be 
  1.2543 +              added to the circular buffer.
  1.2544 +
  1.2545 +@param aCount The number of objects to be added to the circular buffer.
  1.2546 +
  1.2547 +@return The number of objects successfully added to the buffer. This value 
  1.2548 +        may be less than the number requested and can range from 0 to aCount. 
  1.2549 +
  1.2550 +@panic E32USER-CBase 74, if a call to CCirBufBase::SetLengthL() has not been
  1.2551 +                         made before calling this function.
  1.2552 +@panic E32USER-CBase 75, if aCount is not a positive value. 
  1.2553 +
  1.2554 +@see CCirBufBase::SetLengthL
  1.2555 +*/
  1.2556 +	{return(DoAdd((const TUint8 *)aPtr,aCount));}
  1.2557 +
  1.2558 +
  1.2559 +
  1.2560 +
  1.2561 +template <class T>
  1.2562 +inline TInt CCirBuf<T>::Remove(T *aPtr)
  1.2563 +/**
  1.2564 +Removes a single object from the circular buffer.
  1.2565 +
  1.2566 +An object can only be removed if there are objects in the buffer.
  1.2567 +
  1.2568 +A binary copy of the object is made to aPtr.
  1.2569 +
  1.2570 +@param aPtr A pointer to an object of type class T supplied by the caller.
  1.2571 +
  1.2572 +@return 1 if an object is successfully removed. 0 if an object cannot be removed 
  1.2573 +        because the circular buffer is empty.
  1.2574 +*/
  1.2575 +	{return(DoRemove((TUint8 *)aPtr));}
  1.2576 +
  1.2577 +
  1.2578 +
  1.2579 +
  1.2580 +template <class T>
  1.2581 +inline TInt CCirBuf<T>::Remove(T *aPtr,TInt aCount)
  1.2582 +/**
  1.2583 +Removes multiple objects from the circular buffer.
  1.2584 +
  1.2585 +The function attempts to remove aCount objects of type class T.
  1.2586 +Objects can only be removed if there are objects in the buffer
  1.2587 +
  1.2588 +A binary copy of the objects is made to aPtr.
  1.2589 +
  1.2590 +@param aPtr   A pointer to contiguous memory able to hold aCount class T objects, 
  1.2591 +              supplied by the caller. 
  1.2592 +
  1.2593 +@param aCount The number of objects to be removed from the circular buffer.
  1.2594 +
  1.2595 +@return The number of objects successfully removed from the buffer. This value
  1.2596 +        may be less than the number requested, and can range from 0 to aCount.
  1.2597 +
  1.2598 +@panic E32USER-CBase 76, if aCount is not a positive value.
  1.2599 +*/
  1.2600 +	{return(DoRemove((TUint8 *)aPtr,aCount));}
  1.2601 +
  1.2602 +
  1.2603 +
  1.2604 +
  1.2605 +// Class CActive
  1.2606 +inline TBool CActive::IsActive() const
  1.2607 +/**
  1.2608 +Determines whether the active object has a request outstanding.
  1.2609 +
  1.2610 +A request is outstanding when:
  1.2611 +
  1.2612 +1. it has been issued
  1.2613 +
  1.2614 +2. it has not been cancelled
  1.2615 +
  1.2616 +3. it servicing has not yet begun.
  1.2617 +
  1.2618 +@return True, if a request is outstanding; false, otherwise.
  1.2619 +*/
  1.2620 +	{return(iStatus.iFlags&TRequestStatus::EActive);}
  1.2621 +
  1.2622 +
  1.2623 +
  1.2624 +
  1.2625 +inline TBool CActive::IsAdded() const
  1.2626 +/**
  1.2627 +Determines whether the active object has been added to the active scheduler's 
  1.2628 +list of active objects.
  1.2629 +
  1.2630 +If the active object has not been added to a scheduler, it cannot handle the 
  1.2631 +completion of any request. No request should be issued until the active object 
  1.2632 +has been added to a scheduler because completion of that request generates 
  1.2633 +what appears to be a stray signal.
  1.2634 +
  1.2635 +Use the active object function Deque() to remove the active object from the 
  1.2636 +scheduler.
  1.2637 +
  1.2638 +@return True, if the active object has been added to an active scheduler; 
  1.2639 +        false, otherwise. 
  1.2640 +
  1.2641 +@see CActive::Deque
  1.2642 +*/
  1.2643 +	{return(iLink.iNext!=NULL);}
  1.2644 +
  1.2645 +
  1.2646 +
  1.2647 +
  1.2648 +inline TInt CActive::Priority() const
  1.2649 +/**
  1.2650 +Gets the priority of the active object.
  1.2651 +
  1.2652 +@return The active object's priority value.
  1.2653 +*/
  1.2654 +	{return iLink.iPriority;}
  1.2655 +
  1.2656 +
  1.2657 +
  1.2658 +
  1.2659 +// class CDeltaTimer
  1.2660 +inline TDeltaTimerEntry::TDeltaTimerEntry(const TCallBack& aCallback)
  1.2661 +/**
  1.2662 +Constructor specifying a general callback.
  1.2663 +
  1.2664 +@param aCallback The callback to be called when this timed event entry expires.
  1.2665 +*/
  1.2666 +	{iCallBack=aCallback;}
  1.2667 +
  1.2668 +
  1.2669 +
  1.2670 +
  1.2671 +inline TDeltaTimerEntry::TDeltaTimerEntry()
  1.2672 +/**
  1.2673 +Default constructor.
  1.2674 +*/
  1.2675 +	{}
  1.2676 +
  1.2677 +
  1.2678 +
  1.2679 +
  1.2680 +inline void TDeltaTimerEntry::Set(TCallBack& aCallback)
  1.2681 +/**
  1.2682 +Sets the specified callback.
  1.2683 +
  1.2684 +@param aCallback The callback to be called when this timed event entry expires.
  1.2685 +*/
  1.2686 +	{iCallBack=aCallback;}
  1.2687 +
  1.2688 +
  1.2689 +
  1.2690 +
  1.2691 +/**
  1.2692 +Gets a reference to the server's current message.
  1.2693 +
  1.2694 +@return The current message that contains the client request details.
  1.2695 +*/
  1.2696 +inline const RMessage2 &CServer2::Message() const
  1.2697 +	{return iMessage;}
  1.2698 +
  1.2699 +
  1.2700 +
  1.2701 +	
  1.2702 +/**
  1.2703 +Gets the server active object that handles messages for this session.
  1.2704 +
  1.2705 +This is the instance of the CServer2 derived class that created
  1.2706 +this session object.
  1.2707 +
  1.2708 +@return The server active object.
  1.2709 +*/
  1.2710 +inline const CServer2 *CSession2::Server() const
  1.2711 +	{return iServer;}
  1.2712 +
  1.2713 +
  1.2714 +
  1.2715 +
  1.2716 +// Class CAsyncOneShot
  1.2717 +inline RThread& CAsyncOneShot::Thread()
  1.2718 +/**
  1.2719 +Gets a handle to the current thread.
  1.2720 +
  1.2721 +@return The handle to the current thread.
  1.2722 +*/
  1.2723 +	{ return iThread; }
  1.2724 +
  1.2725 +
  1.2726 +
  1.2727 +
  1.2728 +// Class CActiveScheduler
  1.2729 +inline TInt CActiveScheduler::Level() const
  1.2730 +/**
  1.2731 +@deprecated Use the StackDepth() function instead.
  1.2732 +
  1.2733 +Gets the scheduler's level of nestedness.
  1.2734 +
  1.2735 +@return The level of nestedness.
  1.2736 +
  1.2737 +@see StackDepth()
  1.2738 +*/
  1.2739 +	{return StackDepth();}
  1.2740 +
  1.2741 +
  1.2742 +
  1.2743 +
  1.2744 +// Class CActiveSchedulerWait
  1.2745 +inline TBool CActiveSchedulerWait::IsStarted() const
  1.2746 +/**
  1.2747 +Reports whether this CActiveSchedulerWait object is currently started.
  1.2748 +
  1.2749 +Note: a CActiveSchedulerWait object itself becomes "stopped" as
  1.2750 +soon as AsyncStop() is called, and can be started again immediately if
  1.2751 +required (but this would start a new nested level of the scheduler).
  1.2752 +
  1.2753 +@return True if the scheduling loop is active; false, otherwise.
  1.2754 +
  1.2755 +@see CActiveSchedulerWait::Start
  1.2756 +@see CActiveSchedulerWait::AsyncStop
  1.2757 +*/
  1.2758 +	{return iLoop != NULL;}
  1.2759 +
  1.2760 +
  1.2761 +
  1.2762 +
  1.2763 +// Class CleanupStack
  1.2764 +#ifdef _DEBUG
  1.2765 +inline void CleanupStack::Pop(TAny* aExpectedItem)
  1.2766 +/**
  1.2767 +Pops an object from the top of the cleanup stack.
  1.2768 +
  1.2769 +The function has two modes of operation, depending on whether it is part of 
  1.2770 +a debug build or a release build.
  1.2771 +
  1.2772 +1. In a debug build, the function checks that the specified item is at the top 
  1.2773 +   of the cleanup stack before attempting to pop it; an E32USER-CBase 90 panic 
  1.2774 +   is raised if the check fails.
  1.2775 +
  1.2776 +2  In a release build, the function just pops the object which is at the top 
  1.2777 +   of the cleanup stack; no checking is done.
  1.2778 +
  1.2779 +@param aExpectedItem A pointer to the item expected to be at the top of the 
  1.2780 +                     cleanup stack. In a release build, this parameter
  1.2781 +					 is not used.
  1.2782 +*/
  1.2783 +	{ CleanupStack::Check(aExpectedItem); CleanupStack::Pop(); }
  1.2784 +
  1.2785 +
  1.2786 +
  1.2787 +
  1.2788 +inline void CleanupStack::Pop(TInt aCount, TAny* aLastExpectedItem)
  1.2789 +/**
  1.2790 +Pops the specified number of objects from the top of the cleanup stack.
  1.2791 +
  1.2792 +The function has two modes of operation, depending on whether it is part of 
  1.2793 +a debug build or a release build.
  1.2794 +
  1.2795 +1. In a debug build, the function pops (aCount-1) items from the cleanup stack, 
  1.2796 +   and then checks that the specified item is the next one on the cleanup stack 
  1.2797 +   before attempting to pop it; an E32USER-CBase 90 panic is raised if the
  1.2798 +   check fails.
  1.2799 +
  1.2800 +2. In a release build, the function just pops aCount items from the cleanup stack; 
  1.2801 +   no checking is done.
  1.2802 +
  1.2803 +@param aCount            The number of items top be popped from
  1.2804 +                         the cleanup stack.
  1.2805 +@param aLastExpectedItem A pointer to the item expected to be at the top of 
  1.2806 +                         the cleanup stack, after (aCount-1) items have been
  1.2807 +						 popped. In a release build, this parameter is
  1.2808 +						 not used.
  1.2809 +*/
  1.2810 +	{
  1.2811 +	if (--aCount)
  1.2812 +		CleanupStack::Pop(aCount);
  1.2813 +	CleanupStack::Check(aLastExpectedItem);
  1.2814 +	CleanupStack::Pop();
  1.2815 +	}
  1.2816 +
  1.2817 +
  1.2818 +
  1.2819 +
  1.2820 +inline void CleanupStack::PopAndDestroy(TAny* aExpectedItem)
  1.2821 +/**
  1.2822 +Pops an object from the top of the cleanup stack, and cleans it up.
  1.2823 +
  1.2824 +The function has two modes of operation, depending on whether it is part of 
  1.2825 +a debug build or a release build.
  1.2826 +
  1.2827 +1. In a debug build, the function checks that the specified item is at the top 
  1.2828 +   of the cleanup stack before attempting to pop and clean it up;
  1.2829 +   an E32USER-CBase 90 panic is raised if the check fails.
  1.2830 +
  1.2831 +2. In a release build, the function just pops and cleans up the object at 
  1.2832 +   the top of the cleanup stack; no checking is done.
  1.2833 +
  1.2834 +@param aExpectedItem A pointer to the item expected to be at the top of the 
  1.2835 +                     cleanup stack. In a release build, this parameter is
  1.2836 +					 not used.
  1.2837 +*/
  1.2838 +	{ CleanupStack::Check(aExpectedItem); CleanupStack::PopAndDestroy(); }
  1.2839 +
  1.2840 +
  1.2841 +
  1.2842 +
  1.2843 +inline void CleanupStack::PopAndDestroy(TInt aCount, TAny* aLastExpectedItem)
  1.2844 +/**
  1.2845 +Pops the specified number of objects from the top of the cleanup stack, and 
  1.2846 +cleans them up.
  1.2847 +
  1.2848 +The function has two modes of operation, depending on whether it is part of 
  1.2849 +a debug build or a release build.
  1.2850 +
  1.2851 +1. In a debug build, the function pops and cleans up (aCount-1) items from the 
  1.2852 +   cleanup stack, and then checks that the specified item is the next one on 
  1.2853 +   the cleanup stack before attempting to pop it and clean it up;
  1.2854 +   an E32USER-CBase  90 panic is raised if the check fails.
  1.2855 +
  1.2856 +2. In a release build, the function just pops and cleans up aCount items from 
  1.2857 +   the cleanup stack; no checking is done.
  1.2858 +
  1.2859 +@param aCount            The number of items top be popped from the
  1.2860 +                         cleanup stack, and cleaned up.
  1.2861 +@param aLastExpectedItem A pointer to the item expected to be at the top of 
  1.2862 +                         the cleanup stack, after (aCount-1) items have been
  1.2863 +						 popped and cleaned up. In a release build, this 
  1.2864 +						 parameter is not used.
  1.2865 +*/
  1.2866 +	{
  1.2867 +	if (--aCount)
  1.2868 +		CleanupStack::PopAndDestroy(aCount);
  1.2869 +	CleanupStack::Check(aLastExpectedItem);
  1.2870 +	CleanupStack::PopAndDestroy();
  1.2871 +	}
  1.2872 +#else
  1.2873 +inline void CleanupStack::Pop(TAny*)
  1.2874 +/**
  1.2875 +Pops an object from the top of the cleanup stack.
  1.2876 +
  1.2877 +The function has two modes of operation, depending on whether it is part of 
  1.2878 +a debug build or a release build.
  1.2879 +
  1.2880 +1. In a debug build, the function checks that the specified item is at the top 
  1.2881 +   of the cleanup stack before attempting to pop it; an E32USER-CBase 90 panic 
  1.2882 +   is raised if the check fails.
  1.2883 +
  1.2884 +2  In a release build, the function just pops the object which is at the top 
  1.2885 +   of the cleanup stack; no checking is done.
  1.2886 +
  1.2887 +@param aExpectedItem A pointer to the item expected to be at the top of the 
  1.2888 +                     cleanup stack. In a release build, this parameter
  1.2889 +					 is not used.
  1.2890 +*/
  1.2891 +	{ CleanupStack::Pop(); }
  1.2892 +
  1.2893 +
  1.2894 +
  1.2895 +
  1.2896 +inline void CleanupStack::Pop(TInt aCount, TAny*)
  1.2897 +/**
  1.2898 +Pops the specified number of objects from the top of the cleanup stack.
  1.2899 +
  1.2900 +The function has two modes of operation, depending on whether it is part of 
  1.2901 +a debug build or a release build.
  1.2902 +
  1.2903 +1. In a debug build, the function pops (aCount-1) items from the cleanup stack, 
  1.2904 +   and then checks that the specified item is the next one on the cleanup stack 
  1.2905 +   before attempting to pop it; an E32USER-CBase 90 panic is raised if the
  1.2906 +   check fails.
  1.2907 +
  1.2908 +2. In a release build, the function just pops aCount items from the cleanup stack; 
  1.2909 +   no checking is done.
  1.2910 +
  1.2911 +@param aCount            The number of items top be popped from
  1.2912 +                         the cleanup stack.
  1.2913 +@param aLastExpectedItem A pointer to the item expected to be at the top of 
  1.2914 +                         the cleanup stack, after (aCount-1) items have been
  1.2915 +						 popped. In a release build, this parameter is
  1.2916 +						 not used.
  1.2917 +*/
  1.2918 +	{ CleanupStack::Pop(aCount); }
  1.2919 +
  1.2920 +
  1.2921 +
  1.2922 +
  1.2923 +inline void CleanupStack::PopAndDestroy(TAny*)
  1.2924 +/**
  1.2925 +Pops an object from the top of the cleanup stack, and cleans it up.
  1.2926 +
  1.2927 +The function has two modes of operation, depending on whether it is part of 
  1.2928 +a debug build or a release build.
  1.2929 +
  1.2930 +1. In a debug build, the function checks that the specified item is at the top 
  1.2931 +   of the cleanup stack before attempting to pop and clean it up;
  1.2932 +   an E32USER-CBase 90 panic is raised if the check fails.
  1.2933 +
  1.2934 +2. In a release build, the function just pops and cleans up the object at 
  1.2935 +   the top of the cleanup stack; no checking is done.
  1.2936 +
  1.2937 +@param aExpectedItem A pointer to the item expected to be at the top of the 
  1.2938 +                     cleanup stack. In a release build, this parameter is
  1.2939 +					 not used.
  1.2940 +*/
  1.2941 +	{ CleanupStack::PopAndDestroy(); }
  1.2942 +
  1.2943 +
  1.2944 +
  1.2945 +
  1.2946 +inline void CleanupStack::PopAndDestroy(TInt aCount, TAny*)
  1.2947 +/**
  1.2948 +Pops the specified number of objects from the top of the cleanup stack, and 
  1.2949 +cleans them up.
  1.2950 +
  1.2951 +The function has two modes of operation, depending on whether it is part of 
  1.2952 +a debug build or a release build.
  1.2953 +
  1.2954 +1. In a debug build, the function pops and cleans up (aCount-1) items from the 
  1.2955 +   cleanup stack, and then checks that the specified item is the next one on 
  1.2956 +   the cleanup stack before attempting to pop it and clean it up;
  1.2957 +   an E32USER-CBase  90 panic is raised if the check fails.
  1.2958 +
  1.2959 +2. In a release build, the function just pops and cleans up aCount items from 
  1.2960 +   the cleanup stack; no checking is done.
  1.2961 +
  1.2962 +@param aCount            The number of items top be popped from the
  1.2963 +                         cleanup stack, and cleaned up.
  1.2964 +@param aLastExpectedItem A pointer to the item expected to be at the top of 
  1.2965 +                         the cleanup stack, after (aCount-1) items have been
  1.2966 +						 popped and cleaned up. In a release build, this 
  1.2967 +						 parameter is not used.
  1.2968 +*/
  1.2969 +	{ CleanupStack::PopAndDestroy(aCount); }
  1.2970 +#endif
  1.2971 +
  1.2972 +
  1.2973 +
  1.2974 +
  1.2975 +// Class TCleanupItem
  1.2976 +inline TCleanupItem::TCleanupItem(TCleanupOperation anOperation)
  1.2977 +	: iOperation(anOperation)
  1.2978 +/**
  1.2979 +Constructs the object with a cleanup operation.
  1.2980 +
  1.2981 +@param anOperation  A cleanup operation which will be invoked by the pop and
  1.2982 +                    destroy action resulting from a subsequent call to
  1.2983 +					CleanupStack::PopAndDestroy().
  1.2984 +*/
  1.2985 +	{}
  1.2986 +
  1.2987 +
  1.2988 +
  1.2989 +
  1.2990 +inline TCleanupItem::TCleanupItem(TCleanupOperation anOperation,TAny *aPtr)
  1.2991 +	: iOperation(anOperation), iPtr(aPtr)
  1.2992 +/**
  1.2993 +Constructs the object with a cleanup operation and a pointer to the object
  1.2994 +to be cleaned up.
  1.2995 +
  1.2996 +@param anOperation A cleanup operation which will be invoked by the pop
  1.2997 +                   and destroy action resulting from a subsequent call to
  1.2998 +				   CleanupStack::PopAndDestroy().
  1.2999 +
  1.3000 +@param aPtr        A pointer to an object which is the target of the
  1.3001 +                   cleanup operation.
  1.3002 +*/
  1.3003 +	{}
  1.3004 +
  1.3005 +
  1.3006 +
  1.3007 +
  1.3008 +// Class TCleanupTrapHandler
  1.3009 +inline CCleanup &TCleanupTrapHandler::Cleanup()
  1.3010 +	{return(*iCleanup);}
  1.3011 +
  1.3012 +// Class TAutoClose
  1.3013 +template <class T>
  1.3014 +inline TAutoClose<T>::~TAutoClose()
  1.3015 +/**
  1.3016 +Destructor.
  1.3017 +
  1.3018 +The implementation calls Close() on iObj, the instance of the template class.
  1.3019 +*/
  1.3020 +#ifdef __LEAVE_EQUALS_THROW__
  1.3021 +	{if (!std::uncaught_exception()) iObj.Close();}
  1.3022 +#else
  1.3023 +	{iObj.Close();}
  1.3024 +#endif
  1.3025 +
  1.3026 +
  1.3027 +
  1.3028 +
  1.3029 +template <class T>
  1.3030 +inline void TAutoClose<T>::PushL()
  1.3031 +/**
  1.3032 +Pushes a cleanup item onto the cleanup stack, so that Close() is called on the 
  1.3033 +templated class object, iObj, if a leave occurs.
  1.3034 +*/
  1.3035 +	{CleanupStack::PushL(TCleanupItem(Close, (TAny *)&iObj));}
  1.3036 +
  1.3037 +
  1.3038 +
  1.3039 +
  1.3040 +template <class T>
  1.3041 +inline void TAutoClose<T>::Pop()
  1.3042 +/**
  1.3043 +Pops a single cleanup item from the cleanup stack.
  1.3044 +*/
  1.3045 +	{CleanupStack::Pop();}
  1.3046 +
  1.3047 +
  1.3048 +
  1.3049 +
  1.3050 +template <class T>
  1.3051 +void TAutoClose<T>::Close(TAny *aObj)
  1.3052 +	{((T *)aObj)->Close();}
  1.3053 +
  1.3054 +
  1.3055 +
  1.3056 +
  1.3057 +// Template class CleanupDelete
  1.3058 +template <class T>
  1.3059 +inline void CleanupDelete<T>::PushL(T* aPtr)
  1.3060 +/**
  1.3061 +Creates a TCleanupItem for the specified object.
  1.3062 +
  1.3063 +The cleanup operation is the private static function Delete() of this class, which
  1.3064 +deletes the specified object.
  1.3065 +
  1.3066 +@param aPtr The object for which a TCleanupItem is to be constructed.
  1.3067 +*/
  1.3068 +	{CleanupStack::PushL(TCleanupItem(&Delete,aPtr));}
  1.3069 +
  1.3070 +
  1.3071 +
  1.3072 +
  1.3073 +template <class T>
  1.3074 +void CleanupDelete<T>::Delete(TAny *aPtr)
  1.3075 +/**
  1.3076 +The cleanup operation to be performed.
  1.3077 +
  1.3078 +@param aPtr A pointer to the object for which clean up is to be performed. 
  1.3079 +            The implementation deletes this object.
  1.3080 +*/
  1.3081 +	{delete STATIC_CAST(T*,aPtr);}
  1.3082 +
  1.3083 +
  1.3084 +
  1.3085 +
  1.3086 +// See header file e32base.h for in-source comment.
  1.3087 +template <class T>
  1.3088 +inline void CleanupDeletePushL(T* aPtr)
  1.3089 +	{CleanupDelete<T>::PushL(aPtr);}
  1.3090 +
  1.3091 +
  1.3092 +
  1.3093 +
  1.3094 +// Template class CleanupArrayDelete
  1.3095 +template <class T>
  1.3096 +inline void CleanupArrayDelete<T>::PushL(T* aPtr)
  1.3097 +/**
  1.3098 +Creates a TCleanupItem for the specified array.
  1.3099 +
  1.3100 +The cleanup operation is the private static function ArrayDelete() of
  1.3101 +this class, which deletes the specified array.
  1.3102 +
  1.3103 +@param aPtr The array of class T type objects for which a TCleanupItem is
  1.3104 +            to be constructed.
  1.3105 +*/
  1.3106 +	{CleanupStack::PushL(TCleanupItem(&ArrayDelete,aPtr));}
  1.3107 +
  1.3108 +
  1.3109 +
  1.3110 +
  1.3111 +template <class T>
  1.3112 +void CleanupArrayDelete<T>::ArrayDelete(TAny *aPtr)
  1.3113 +/**
  1.3114 +The cleanup operation to be performed.
  1.3115 +
  1.3116 +@param aPtr A pointer to the array for which clean up is to be performed. 
  1.3117 +            The implementation deletes this array.
  1.3118 +*/
  1.3119 +	{delete [] STATIC_CAST(T*,aPtr);}
  1.3120 +
  1.3121 +
  1.3122 +
  1.3123 +
  1.3124 +// See header file e32base.h for in-source comment.
  1.3125 +template <class T>
  1.3126 +inline void CleanupArrayDeletePushL(T* aPtr)
  1.3127 +	{CleanupArrayDelete<T>::PushL(aPtr);}
  1.3128 +
  1.3129 +
  1.3130 +
  1.3131 +
  1.3132 +// Template class CleanupClose
  1.3133 +template <class T>
  1.3134 +inline void CleanupClose<T>::PushL(T& aRef)
  1.3135 +/**
  1.3136 +Creates a TCleanupItem for the specified object.
  1.3137 +
  1.3138 +The cleanup operation is the private static function Close() of this class.
  1.3139 +
  1.3140 +@param aRef The object for which a TCleanupItem is to be constructed.
  1.3141 +*/
  1.3142 +	{CleanupStack::PushL(TCleanupItem(&Close,&aRef));}
  1.3143 +
  1.3144 +
  1.3145 +
  1.3146 +
  1.3147 +template <class T>
  1.3148 +void CleanupClose<T>::Close(TAny *aPtr)
  1.3149 +/**
  1.3150 +The cleanup operation to be performed.
  1.3151 +
  1.3152 +@param aPtr A pointer to the object for which clean up is to be performed. 
  1.3153 +            The implementation calls Close() on this object.
  1.3154 +*/
  1.3155 +	{(STATIC_CAST(T*,aPtr))->Close();}
  1.3156 +
  1.3157 +
  1.3158 +
  1.3159 +
  1.3160 +// See header file e32base.h for in-source comment.
  1.3161 +template <class T>
  1.3162 +inline void CleanupClosePushL(T& aRef)
  1.3163 +	{CleanupClose<T>::PushL(aRef);}
  1.3164 +
  1.3165 +
  1.3166 +
  1.3167 +
  1.3168 +// Template class CleanupRelease
  1.3169 +template <class T>
  1.3170 +inline void CleanupRelease<T>::PushL(T& aRef)
  1.3171 +/**
  1.3172 +Creates a TCleanupItem for the specified object.
  1.3173 +
  1.3174 +The cleanup operation is the private static function Release() of this class.
  1.3175 +
  1.3176 +@param aRef The object for which a TCleanupItem is to be constructed.
  1.3177 +*/
  1.3178 +	{CleanupStack::PushL(TCleanupItem(&Release,&aRef));}
  1.3179 +
  1.3180 +
  1.3181 +
  1.3182 +
  1.3183 +template <class T>
  1.3184 +void CleanupRelease<T>::Release(TAny *aPtr)
  1.3185 +/**
  1.3186 +The cleanup operation to be performed.
  1.3187 +
  1.3188 +@param aPtr A pointer to the object for which clean up is to be performed. 
  1.3189 +            The implementation calls Release() on this object.
  1.3190 +*/
  1.3191 +	{(STATIC_CAST(T*,aPtr))->Release();}
  1.3192 +
  1.3193 +
  1.3194 +
  1.3195 +
  1.3196 +// See header file e32base.h for in-source comment.
  1.3197 +template <class T>
  1.3198 +inline void CleanupReleasePushL(T& aRef)
  1.3199 +	{CleanupRelease<T>::PushL(aRef);}
  1.3200 +
  1.3201 +
  1.3202 +