kernel/eka/include/e32base.inl
changeset 0 a41df078684a
equal deleted inserted replaced
-1:000000000000 0:a41df078684a
       
     1 // Copyright (c) 1994-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of the License "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // e32\include\e32base.inl
       
    15 // 
       
    16 //
       
    17 
       
    18 // Class CBase
       
    19 inline TAny* CBase::operator new(TUint aSize, TAny* aBase) __NO_THROW
       
    20 /**
       
    21 Initialises the object to binary zeroes.
       
    22 
       
    23 @param aSize The size of the derived class. This parameter is specified
       
    24              implicitly by C++ in all circumstances in which a derived
       
    25 			 class is allocated.
       
    26 @param aBase Indicates a base address which is returned as the object's
       
    27              address. 
       
    28 
       
    29 @return A pointer to the base address.
       
    30 */
       
    31 	{ Mem::FillZ(aBase, aSize); return aBase; }
       
    32 
       
    33 
       
    34 
       
    35 
       
    36 inline TAny* CBase::operator new(TUint aSize) __NO_THROW
       
    37 /**
       
    38 Allocates the object from the heap and then initialises its contents
       
    39 to binary zeroes.
       
    40 
       
    41 @param aSize The size of the derived class. This parameter is specified
       
    42              implicitly by C++ in all circumstances in which a derived class
       
    43 			 is allocated.
       
    44 
       
    45 @return      A pointer to the allocated object; NULL if memory could not
       
    46              be allocated.
       
    47 */
       
    48 	{ return User::AllocZ(aSize); }
       
    49 
       
    50 
       
    51 
       
    52 
       
    53 inline TAny* CBase::operator new(TUint aSize, TLeave)
       
    54 /**
       
    55 Allocates the object from the heap and then initialises its contents
       
    56 to binary zeroes.
       
    57 
       
    58 @param aSize  The size of the derived class. This parameter is specified
       
    59               implicitly by C++ in all circumstances in which a derived class
       
    60 			  is allocated.
       
    61 
       
    62 @return       A pointer to the allocated object; the TLeave parameter indicates
       
    63               that the operation leaves if allocation fails with out-of-memory.
       
    64 */
       
    65 	{ return User::AllocZL(aSize); }
       
    66 
       
    67 
       
    68 
       
    69 
       
    70 inline TAny* CBase::operator new(TUint aSize, TUint aExtraSize) __NO_THROW
       
    71 /**
       
    72 Allocates the object from the heap and then initialises its contents
       
    73 to binary zeroes.
       
    74 
       
    75 Use of this overload is rare.
       
    76 
       
    77 @param aSize  The size of the derived class. This parameter is specified
       
    78               implicitly by C++ in all circumstances in which a derived class
       
    79 			  is allocated.
       
    80 
       
    81 @param aExtraSize Indicates additional size beyond the end of the base class.
       
    82 
       
    83 @return      A pointer to the allocated object; NULL if memory could not
       
    84              be allocated.
       
    85 */
       
    86 	{ return User::AllocZ(aSize + aExtraSize); }
       
    87 
       
    88 
       
    89 
       
    90 
       
    91 inline TAny* CBase::operator new(TUint aSize, TLeave, TUint aExtraSize)
       
    92 /**
       
    93 Allocates the object from the heap and then initialises its contents
       
    94 to binary zeroes.
       
    95 
       
    96 Use of this overload is rare.
       
    97 
       
    98 @param aSize  The size of the derived class. This parameter is specified
       
    99               implicitly by C++ in all circumstances in which a derived class
       
   100 			  is allocated.
       
   101 
       
   102 @param aExtraSize Indicates additional size beyond the end of the base class.
       
   103 
       
   104 @return      A pointer to the allocated object; the TLeave parameter indicates
       
   105               that the operation leaves if allocation fails with out-of-memory.
       
   106 */
       
   107 	{ return User::AllocZL(aSize + aExtraSize); }
       
   108 
       
   109 
       
   110 
       
   111 
       
   112 // Class CBufBase
       
   113 inline TInt CBufBase::Size() const
       
   114 /**
       
   115 Gets the number of data bytes in the buffer.
       
   116 
       
   117 Note that the number of heap bytes used by the buffer may be greater than its
       
   118 size, because there is typically extra room to allow for expansion. Use the
       
   119 Compress() function to reduce the extra allocation as much as possible.
       
   120 
       
   121 @return The number of data bytes in the buffer.
       
   122 */
       
   123 	{return(iSize);}
       
   124 
       
   125 
       
   126 
       
   127 
       
   128 // Class CBufFlat
       
   129 inline TInt CBufFlat::Capacity() const
       
   130 /**
       
   131 Gets the size to which the buffer may expand without re-allocation.
       
   132 
       
   133 @return The size of the allocated cell associated with the buffer. This is 
       
   134         the maximum size the buffer may be expanded to without re-allocation.
       
   135 */
       
   136 	{return(iMaxSize);}
       
   137 
       
   138 
       
   139 
       
   140 
       
   141 // Class CArrayFixBase
       
   142 inline TInt CArrayFixBase::Count() const
       
   143 /**
       
   144 Gets the number of elements held in the array.
       
   145 
       
   146 @return The number of array elements
       
   147 */
       
   148 	{return(iCount);}
       
   149 
       
   150 
       
   151 
       
   152 
       
   153 inline TInt CArrayFixBase::Length() const
       
   154 /**
       
   155 Gets the length of an element.
       
   156 
       
   157 @return The length of an element of type class T.
       
   158 */
       
   159 	{return(iLength);}
       
   160 
       
   161 
       
   162 
       
   163 
       
   164 // Template class CArrayFix
       
   165 template <class T>
       
   166 inline CArrayFix<T>::CArrayFix(TBufRep aRep,TInt aGranularity)
       
   167 	: CArrayFixBase(aRep,sizeof(T),aGranularity)
       
   168 /**
       
   169 @internalComponent
       
   170 */
       
   171 	{}
       
   172 
       
   173 
       
   174 
       
   175 
       
   176 template <class T>
       
   177 inline const T &CArrayFix<T>::operator[](TInt anIndex) const
       
   178 /**
       
   179 Gets a const reference to the element located at the specified position 
       
   180 within the array.
       
   181 
       
   182 Note that if a pointer to the returned referenced class T object is taken,
       
   183 be aware that the pointer value becomes invalid once elements have been added
       
   184 to, or removed from the array. Always refresh the pointer.
       
   185 
       
   186 @param anIndex The position of the element within the array. The position 
       
   187                is relative to zero; i.e. zero implies the first element in
       
   188 			   the array.
       
   189 			   
       
   190 @return A const reference to the required element.
       
   191 
       
   192 @panic E32USER-CBase 21, if anIndex is negative or greater than or equal to the
       
   193                          number of objects currently within the array.
       
   194 */
       
   195 	{return(*((const T *)CArrayFixBase::At(anIndex)));}
       
   196 
       
   197 
       
   198 
       
   199 
       
   200 template <class T>
       
   201 inline T &CArrayFix<T>::operator[](TInt anIndex)
       
   202 /**
       
   203 Gets a non-const reference to the element located at the specified position 
       
   204 within the array.
       
   205 
       
   206 Note that if a pointer to the returned referenced class T object is taken,
       
   207 be aware that the pointer value becomes invalid once elements have been added
       
   208 to, or removed from the array. Always refresh the pointer.
       
   209 
       
   210 @param anIndex The position of the element within the array. The position 
       
   211                is relative to zero; i.e. zero implies the first element in
       
   212 			   the array.
       
   213 			   
       
   214 @return A non-const reference to the required element.
       
   215 
       
   216 @panic E32USER-CBase 21, if anIndex is negative or greater than or equal to the
       
   217                          number of objects currently within the array.
       
   218 */
       
   219 	{return(*((T *)CArrayFixBase::At(anIndex)));}
       
   220 
       
   221 
       
   222 
       
   223 
       
   224 template <class T>
       
   225 inline const T &CArrayFix<T>::At(TInt anIndex) const
       
   226 /** 
       
   227 Gets a const reference to the element located at the specified position 
       
   228 within the array.
       
   229 
       
   230 Note that if a pointer to the returned referenced class T object is taken,
       
   231 be aware that the pointer value becomes invalid once elements have been added
       
   232 to, or removed from the array. Always refresh the pointer.
       
   233 
       
   234 @param anIndex The position of the element within the array. The position 
       
   235                is relative to zero; i.e. zero implies the first element in
       
   236 			   the array.
       
   237 			   
       
   238 @return A const reference to the required element.
       
   239 
       
   240 @panic E32USER-CBase 21, if anIndex is negative or greater than or equal to the
       
   241                          number of objects currently within the array.
       
   242 */
       
   243 	{return(*((const T *)CArrayFixBase::At(anIndex)));}
       
   244 
       
   245 
       
   246 
       
   247 
       
   248 template <class T>
       
   249 inline const T *CArrayFix<T>::End(TInt anIndex) const
       
   250 /**
       
   251 Gets a pointer to the (const) first byte following the end of the 
       
   252 contiguous region containing the element at the specified position within
       
   253 the array.
       
   254 
       
   255 For arrays implemented using flat buffers, the pointer always points to the 
       
   256 first byte following the end of the buffer.
       
   257 
       
   258 For arrays implemented using segmented buffers, the pointer always points 
       
   259 to the first byte following the end of the segment which contains the element.
       
   260 
       
   261 @param anIndex The position of the element within the array. The position 
       
   262                is relative to zero; i.e. zero implies the first element
       
   263 			   in the array.
       
   264 			   
       
   265 @return A pointer to the constant byte following the end of the contiguous 
       
   266         region. 
       
   267 
       
   268 @panic E32USER-CBase 21, if anIndex is negative or greater than or equal to the
       
   269                          number of objects currently within the array.
       
   270 */
       
   271 	{return((const T *)CArrayFixBase::End(anIndex));}
       
   272 
       
   273 
       
   274 
       
   275 
       
   276 template <class T>
       
   277 inline const T *CArrayFix<T>::Back(TInt anIndex) const
       
   278 /**
       
   279 Gets a pointer to the (const) beginning of a contiguous region.
       
   280 
       
   281 For arrays implemented using flat buffers, the function always returns a
       
   282 pointer to the beginning of the buffer.
       
   283 
       
   284 For arrays implemented using segmented buffers, the function returns a pointer 
       
   285 to the beginning of the segment for all elements in that segment except the 
       
   286 first. If the element at position anIndex is the first in a segment, then 
       
   287 the function returns a pointer the beginning of the previous segment.
       
   288 
       
   289 For the first element in the array, the function returns a NULL pointer.
       
   290 
       
   291 @param anIndex The position of the element within the array. The position 
       
   292                is relative to zero; i.e. zero implies the first element
       
   293 			   in the array.
       
   294 			   
       
   295 @return A pointer to the (const) beginning of the contiguous region.
       
   296 
       
   297 @panic E32USER-CBase 21, if anIndex is negative or greater than or equal to the
       
   298                          number of objects currently within the array.
       
   299 */
       
   300 	{return((const T *)CArrayFixBase::Back(anIndex));}
       
   301 
       
   302 
       
   303 
       
   304 
       
   305 template <class T>
       
   306 inline T &CArrayFix<T>::At(TInt anIndex)
       
   307 /**
       
   308 Gets a non-const reference to the element located at the specified position 
       
   309 within the array.
       
   310 
       
   311 Note that if a pointer to the returned referenced class T object is taken,
       
   312 be aware that the pointer value becomes invalid once elements have been added
       
   313 to, or removed from the array. Always refresh the pointer.
       
   314 
       
   315 @param anIndex The position of the element within the array. The position 
       
   316                is relative to zero; i.e. zero implies the first element in
       
   317 			   the array.
       
   318 			   
       
   319 @return A non-const reference to the required element.
       
   320 
       
   321 @panic E32USER-CBase 21, if anIndex is negative or greater than or equal to the
       
   322                          number of objects currently within the array.
       
   323 */
       
   324 	{return(*((T *)CArrayFixBase::At(anIndex)));}
       
   325 
       
   326 
       
   327 
       
   328 
       
   329 template <class T>
       
   330 inline T *CArrayFix<T>::End(TInt anIndex)
       
   331 /**
       
   332 Gets a pointer to the first byte following the end of the contiguous region 
       
   333 containing the element at the specified position within the array.
       
   334 
       
   335 For arrays implemented using flat buffers, the pointer always points to the 
       
   336 first byte following the end of the buffer.
       
   337 
       
   338 For arrays implemented using segmented buffers, the pointer always points 
       
   339 to the first byte following the end of the segment which contains the element.
       
   340 
       
   341 @param anIndex The position of the element within the array. The position 
       
   342                is relative to zero; i.e. zero implies the first element
       
   343 			   in the array.
       
   344 			   
       
   345 @return A pointer to the byte following the end of the contiguous region.
       
   346 
       
   347 @panic E32USER-CBase 21, if anIndex is negative or greater than or equal to the
       
   348                          number of objects currently within the array.
       
   349 */
       
   350 	{return(((T *)CArrayFixBase::End(anIndex)));}
       
   351 
       
   352 
       
   353 
       
   354 
       
   355 template <class T>
       
   356 inline T *CArrayFix<T>::Back(TInt anIndex)
       
   357 /**
       
   358 Gets a pointer to the beginning of a contiguous region.
       
   359 
       
   360 For arrays implemented using flat buffers, the function always returns a pointer 
       
   361 to the beginning of the buffer.
       
   362 
       
   363 For arrays implemented using segmented buffers, the function returns a pointer 
       
   364 to the beginning of the segment for all elements in that segment except the 
       
   365 first. If the element at position anIndex is the first in a segment, then 
       
   366 the function returns a pointer the beginning of the previous segment.
       
   367 
       
   368 For the first element in the array, the function returns a NULL pointer.
       
   369 
       
   370 @param anIndex The position of the element within the array. The position 
       
   371                is relative to zero; i.e. zero implies the first element
       
   372 			   in the array.
       
   373 			   
       
   374 @return A pointer to the beginning of the contiguous region.
       
   375 
       
   376 @panic E32USER-CBase 21, if anIndex is negative or greater than or equal to the
       
   377                          number of objects currently within the array.
       
   378 */
       
   379 	{return(((T *)CArrayFixBase::Back(anIndex)));}
       
   380 
       
   381 
       
   382 
       
   383 
       
   384 template <class T>
       
   385 inline void CArrayFix<T>::AppendL(const T &aRef)
       
   386 /**
       
   387 Appends a single element onto the end of the array.
       
   388 
       
   389 @param aRef A reference to the class T element to be appended.
       
   390 
       
   391 @leave KErrNoMemory The function may attempt to expand the array buffer. If 
       
   392        there is insufficient memory available, the function leaves, in which
       
   393 	   case the array is left in the state it was in before the call.
       
   394 */
       
   395 	{CArrayFixBase::InsertL(Count(),&aRef);}
       
   396 
       
   397 
       
   398 
       
   399 
       
   400 template <class T>
       
   401 inline void CArrayFix<T>::AppendL(const T *aPtr,TInt aCount)
       
   402 /**
       
   403 Appends one or more elements onto the end of the array.
       
   404 
       
   405 @param aPtr   A pointer to a contiguous set of type <class T> objects to be
       
   406               appended.
       
   407 @param aCount The number of contiguous objects of type <class T> located at 
       
   408               aPtr to be appended.
       
   409 			  
       
   410 @leave KErrNoMemory The function may attempt to expand the array buffer. If 
       
   411        there is insufficient memory available, the function leaves, in which
       
   412 	   case the array is left in the state it was in before the call.
       
   413 
       
   414 @panic E32USER-CBase 23, if aCount is negative.
       
   415 */
       
   416 	{CArrayFixBase::InsertL(Count(),aPtr,aCount);}
       
   417 
       
   418 
       
   419 
       
   420 
       
   421 template <class T>
       
   422 inline void CArrayFix<T>::AppendL(const T &aRef,TInt aReplicas)
       
   423 /**
       
   424 Appends replicated copies of an element onto the end of the array.
       
   425 
       
   426 @param aRef      A reference to the <class T> object to be replicated and appended.
       
   427 @param aReplicas The number of copies of the aRef element to be appended. 
       
   428 
       
   429 @leave KErrNoMemory The function may attempt to expand the array buffer. If 
       
   430        there is insufficient memory available, the function leaves, in which
       
   431 	   case the array is left in the state it was in before the call.
       
   432 
       
   433 @panic E32USER-CBase 28 if aReplicas is negative.
       
   434 */
       
   435 	{CArrayFixBase::InsertRepL(Count(),&aRef,aReplicas);}
       
   436 
       
   437 
       
   438 
       
   439 
       
   440 template <class T>
       
   441 inline T &CArrayFix<T>::ExpandL(TInt anIndex)
       
   442 /**
       
   443 Expands the array by one element at the specified position.
       
   444 
       
   445 It:
       
   446 
       
   447 1. expands the array by one element at the specified position
       
   448 
       
   449 2. constructs a new element at that position
       
   450 
       
   451 3. returns a reference to the new element.
       
   452 
       
   453 All existing elements from position anIndex to the end of the array are moved 
       
   454 up, so that the element originally at position anIndex is now at position 
       
   455 anIndex + 1 etc.
       
   456 
       
   457 The new element of type class T is constructed at position anIndex, using 
       
   458 the default constructor of that class.
       
   459 
       
   460 @param anIndex The position within the array where the array is to be expanded 
       
   461                and the new class T object is to be constructed. 
       
   462 
       
   463 @leave KErrNoMemory The function may attempt to expand the array buffer. If 
       
   464        there is insufficient memory available, the function leaves, in which
       
   465 	   case the array is left in the state it was in before the call.
       
   466 
       
   467 @return A reference to the newly constructed class T object at position 
       
   468         anIndex within the array.
       
   469 
       
   470 @panic E32USER-CBase 21 if anIndex is negative or greater than the number
       
   471                         of elements currently in the array.
       
   472 */
       
   473 	{return(*new(CArrayFixBase::ExpandL(anIndex)) T);}
       
   474 
       
   475 
       
   476 
       
   477 
       
   478 template <class T>
       
   479 inline T &CArrayFix<T>::ExtendL()
       
   480 /**
       
   481 Expands the array by one element at the end of the array.
       
   482 
       
   483 It:
       
   484 
       
   485 1. expands the array by one element at the end of the array, i.e. at position 
       
   486    CArrayFixBase::Count()
       
   487 
       
   488 2. constructs a new element at that position
       
   489 
       
   490 3. returns a reference to the new element.
       
   491 
       
   492 The new element of type class T is constructed at the end of the array, 
       
   493 using the default constructor of that class.
       
   494 
       
   495 @leave KErrNoMemory The function may attempt to expand the array buffer. If 
       
   496        there is insufficient memory available, the function leaves, in which
       
   497 	   case the array is left in the state it was in before the call.
       
   498 
       
   499 @return A reference to the newly constructed class T object at the end of 
       
   500         the array.
       
   501 
       
   502 @see CArrayFixBase::Count
       
   503 */
       
   504 	{return(*new(CArrayFixBase::ExpandL(Count())) T);}
       
   505 
       
   506 
       
   507 
       
   508 
       
   509 template <class T>
       
   510 inline TInt CArrayFix<T>::Find(const T &aRef,TKeyArrayFix &aKey,TInt &anIndex) const
       
   511 /**
       
   512 Finds the position of an element within the array, based on the matching of
       
   513 keys, using a sequential search.
       
   514 
       
   515 The array is searched sequentially for an element whose key matches the key of the
       
   516 supplied class T object. The search starts with the first element in the array.
       
   517 
       
   518 Note that where an array has elements with duplicate keys, the function only
       
   519 supplies the position of the first element in the array with that key.
       
   520 
       
   521 @param aRef    A reference to an object of type class T whose key is used
       
   522                for comparison.
       
   523 @param aKey    A reference to a key object defining the properties of the key.
       
   524 @param anIndex A reference to a TInt supplied by the caller. On return, if the
       
   525                element is found, the reference is set to the position of that
       
   526 			   element within the array. The position is relative to zero, 
       
   527 			   (i.e. the first element in the array is at position 0).
       
   528 			   If the element is not found and the array is not empty, then
       
   529 			   the value of the reference is set to the number of elements in
       
   530 			   the array. 
       
   531 			   If the element is not found and the array is empty, then the
       
   532 			   reference is set to zero.
       
   533 
       
   534 @return Zero, if the element with the specified key is found. 
       
   535         Non-zero, if the element with the specified key is not found.
       
   536 */
       
   537 	{return(CArrayFixBase::Find(&aRef,aKey,anIndex));}
       
   538 
       
   539 
       
   540 
       
   541 
       
   542 template <class T>
       
   543 inline TInt CArrayFix<T>::FindIsq(const T &aRef,TKeyArrayFix &aKey,TInt &anIndex) const
       
   544 /**
       
   545 Finds the position of an element within the array, based on the matching of 
       
   546 keys, using a binary search technique.
       
   547 
       
   548 The array is searched, using a binary search technique, for an element whose 
       
   549 key matches the key of the supplied class T object.
       
   550 
       
   551 The array must be in key order.
       
   552 
       
   553 Note that where an array has elements with duplicate keys, the function cannot
       
   554 guarantee which element, with the given key value, it will return, except that
       
   555 it will find one of them.
       
   556 
       
   557 @param aRef    A reference to an object of type class T whose key is used 
       
   558                for comparison. 
       
   559 @param aKey    A reference to a key object defining the properties of the key.
       
   560 @param anIndex A reference to a TInt supplied by the caller. On return, if the
       
   561                element is found, the reference is set to the position of that
       
   562 			   element within the array. The position is relative to zero,
       
   563 			   (i.e. the first element in the array is at position 0).
       
   564 			   If the element is not found and the array is not empty, then the
       
   565 			   reference is set to the position of the first element in the
       
   566 			   array with a key which is greater than the key of the 
       
   567                object aRef.
       
   568 			   If the element is not found and the array is empty, then the 
       
   569                reference is set to zero.
       
   570 
       
   571 @return Zero, if the element with the specified key is found.
       
   572         Non-zero, if the element with the specified key is not found.
       
   573 */
       
   574 	{return(CArrayFixBase::FindIsq(&aRef,aKey,anIndex));}
       
   575 
       
   576 
       
   577 
       
   578 
       
   579 template <class T>
       
   580 inline void CArrayFix<T>::InsertL(TInt anIndex,const T &aRef)
       
   581 /**
       
   582 Inserts an element into the array at the specified position.
       
   583 
       
   584 Note that passing a value of anIndex which is the same as the current number
       
   585 of elements in the array, has the effect of appending the element.
       
   586 
       
   587 @param anIndex The position within the array where the element is to be
       
   588                inserted. The position is relative to zero, i.e. zero implies
       
   589 			   that elements are inserted at the beginning of the array. 
       
   590 			   
       
   591 @param aRef    A reference to the class T object to be inserted into the array 
       
   592                at position anIndex.
       
   593 
       
   594 @leave KErrNoMemory The function may attempt to expand the array buffer. If 
       
   595        there is insufficient memory available, the function leaves, in which
       
   596 	   case the array is left in the state it was in before the call.
       
   597 
       
   598 @panic E32USER-CBase 21 if anIndex is negative, or is greater than the number
       
   599        of elements currently in the array.
       
   600 */
       
   601 	{CArrayFixBase::InsertL(anIndex,&aRef);}
       
   602 
       
   603 
       
   604 
       
   605 
       
   606 template <class T>
       
   607 inline void CArrayFix<T>::InsertL(TInt anIndex,const T *aPtr,TInt aCount)
       
   608 /**
       
   609 Inserts one or more elements into the array at the specified position.
       
   610 
       
   611 The objects to be added must all be contiguous.
       
   612 
       
   613 Note that passing a value of anIndex which is the same as the current number
       
   614 of elements in the array, has the effect of appending the element.
       
   615 
       
   616 @param anIndex The position within the array where the elements are to be 
       
   617                inserted. The position is relative to zero, i.e. zero implies
       
   618 			   that elements are inserted at the beginning of the array.
       
   619 			   
       
   620 @param aPtr    A pointer to the first of the contiguous elements of type 
       
   621                class T to be inserted into the array at position anIndex.
       
   622 
       
   623 @param aCount  The number of contiguous elements of type class T located at 
       
   624                aPtr to be inserted into the array. 
       
   625 
       
   626 @leave KErrNoMemory The function may attempt to expand the array buffer. If 
       
   627        there is insufficient memory available, the function leaves, in which
       
   628 	   case the array is left in the state it was in before the call.
       
   629 
       
   630 @panic E32USER-CBase 21  if anIndex is negative or is greater than the number
       
   631                          of elements currently in the array.
       
   632 @panic E32USER-CBase 23  if aCount is negative.
       
   633 */
       
   634 	{CArrayFixBase::InsertL(anIndex,aPtr,aCount);}
       
   635 
       
   636 
       
   637 
       
   638 
       
   639 template <class T>
       
   640 inline void CArrayFix<T>::InsertL(TInt anIndex,const T &aRef,TInt aReplicas)
       
   641 /**
       
   642 Inserts replicated copies of an element into the array at the specified
       
   643 position.
       
   644 
       
   645 Note that passing a value of anIndex which is the same as the current number
       
   646 of elements in the array, has the effect of appending the element.
       
   647 
       
   648 
       
   649 @param anIndex   The position within the array where elements are to be
       
   650                  inserted. The position is relative to zero, i.e. zero implies
       
   651 				 that elements are inserted at the beginning of the array.
       
   652 				 
       
   653 @param aRef      A reference to the class T object to be replicated and
       
   654                  inserted into the array at position anIndex. 
       
   655 
       
   656 @param aReplicas The number of copies of the aRef element to be inserted into 
       
   657                  the array.
       
   658 				 
       
   659 @leave KErrNoMemory The function may attempt to expand the array buffer. If 
       
   660        there is insufficient memory available, the function leaves, in which
       
   661 	   case the array is left in the state it was in before the call.
       
   662 	   
       
   663 @panic E32USER-CBase 21, if anIndex is negative or is greater than the number
       
   664                          of elements currently in the array.
       
   665 @panic E32USER-CBase 28, if aReplicas is negative.
       
   666 */
       
   667 	{CArrayFixBase::InsertRepL(anIndex,&aRef,aReplicas);}
       
   668 
       
   669 
       
   670 
       
   671 
       
   672 template <class T>
       
   673 inline TInt CArrayFix<T>::InsertIsqL(const T &aRef,TKeyArrayFix &aKey)
       
   674 /**
       
   675 Inserts a single element into the array at a position determined by a key.
       
   676 
       
   677 The array MUST already be in key sequence (as defined by the key), otherwise 
       
   678 the position of the new element is unpredictable, or duplicates may occur.
       
   679 
       
   680 Elements with duplicate keys are not permitted.
       
   681 
       
   682 @param aRef A reference to the element of type <class T> to be inserted into 
       
   683             the array.
       
   684 @param aKey A reference to a key object defining the properties of the key. 
       
   685 
       
   686 @return The position within the array of the newly inserted element. 
       
   687 
       
   688 @leave KErrAlreadyExists An element with the same key already exists within 
       
   689        the array. NB the array MUST already be in key sequence, otherwise
       
   690 	   the function may insert a duplicate and fail to leave with
       
   691 	   this value.
       
   692 @leave KErrNoMemory The function may attempt to expand the array buffer. If 
       
   693        there is insufficient memory available, the function leaves, in which
       
   694 	   case the array is left in the state it was in before the call.
       
   695 */
       
   696 	{return(CArrayFixBase::InsertIsqL(&aRef,aKey));}
       
   697 
       
   698 
       
   699 
       
   700 
       
   701 template <class T>
       
   702 inline TInt CArrayFix<T>::InsertIsqAllowDuplicatesL(const T &aRef,TKeyArrayFix &aKey)
       
   703 /**
       
   704 Inserts a single element into the array at a position determined by a key, 
       
   705 allowing duplicates.
       
   706 
       
   707 The array MUST already be in key sequence (as defined by the key), otherwise 
       
   708 the position of the new element is unpredictable.
       
   709 
       
   710 If the new element's key is a duplicate of an existing element's key, then 
       
   711 the new element is positioned after the existing element.
       
   712 
       
   713 @param aRef A reference to the element of type <class T> to be inserted into 
       
   714             the array.
       
   715 @param aKey A reference to a key object defining the properties of the key. 
       
   716 
       
   717 @return The position within the array of the newly inserted element.
       
   718 
       
   719 @leave KErrNoMemory The function may attempt to expand the array buffer. If 
       
   720        there is insufficient memory available, the function leaves, in which
       
   721 	   case the array is left in the state it was in before the call.
       
   722 */
       
   723 	{return(CArrayFixBase::InsertIsqAllowDuplicatesL(&aRef,aKey));}
       
   724 
       
   725 
       
   726 
       
   727 
       
   728 template <class T>
       
   729 inline void CArrayFix<T>::ResizeL(TInt aCount)
       
   730 /**
       
   731 Changes the size of the array so that it contains the specified number
       
   732 of elements.
       
   733 
       
   734 The following describes the effects of calling this function:
       
   735 
       
   736 1. If aCount is less than the current number of elements in the array, then the 
       
   737    array is shrunk. The elements at positions aCount and above are discarded. 
       
   738    The array buffer is not compressed.
       
   739 
       
   740 2. If aCount is greater than the current number of elements in the array, then 
       
   741    the array is extended.
       
   742 
       
   743 3. New elements are replicated copies of an object of type <class T>,
       
   744    constructed using the default constructor of that class.
       
   745 
       
   746 The new elements are positioned after the existing elements in the array.
       
   747 
       
   748 The function may attempt to expand the array buffer. If there is insufficient 
       
   749 memory available, the function leaves. The leave code is one of the system 
       
   750 wide error codes. If the function leaves, the array is left in the state it 
       
   751 was in before the call.
       
   752 
       
   753 @param aCount The number of elements the array is to contain after the resizing 
       
   754               operation. 
       
   755 			  
       
   756 @panic E32USER-CBase 24, if aCount is negative.
       
   757 */
       
   758 	{TUint8 b[sizeof(T)]; new(&b[0]) T; CArrayFixBase::ResizeL(aCount,&b[0]);}
       
   759 
       
   760 
       
   761 
       
   762 
       
   763 template <class T>
       
   764 inline void CArrayFix<T>::ResizeL(TInt aCount,const T &aRef)
       
   765 /**
       
   766 Changes the size of the array so that it contains the specified number
       
   767 of elements.
       
   768 
       
   769 The following describes the effects of calling this function:
       
   770 
       
   771 1. If aCount is less than the current number of elements in the array, then the 
       
   772    array is shrunk. The elements at positions aCount and above are discarded. 
       
   773    The array buffer is not compressed.
       
   774 
       
   775 2. If aCount is greater than the current number of elements in the array, then 
       
   776    the array is extended.
       
   777 
       
   778 3. New elements are replicated copies of aRef.
       
   779 
       
   780 The new elements are positioned after the existing elements in the array.
       
   781 
       
   782 The function may attempt to expand the array buffer. If there is insufficient 
       
   783 memory available, the function leaves. The leave code is one of the system 
       
   784 wide error codes. If the function leaves, the array is left in the state it 
       
   785 was in before the call.
       
   786 
       
   787 @param aCount The number of elements the array is to contain after the resizing 
       
   788               operation.
       
   789 
       
   790 @param aRef   A reference to an object of type <class T>, copies of which are
       
   791               used as the new elements of the array, if the array is extended.
       
   792 
       
   793 @panic E32USER-CBase 24, if aCount is negative.
       
   794 */
       
   795 	{CArrayFixBase::ResizeL(aCount,&aRef);}
       
   796 
       
   797 
       
   798 
       
   799 
       
   800 template <class T>
       
   801 inline const TArray<T> CArrayFix<T>::Array() const
       
   802 /**
       
   803 Constructs and returns a TArray<T> object.
       
   804 
       
   805 @return A TArray<T> object representing this array.
       
   806 */
       
   807 	{return(TArray<T>(CountR,AtR,this));}
       
   808 
       
   809 
       
   810 
       
   811 
       
   812 inline CArrayFix<TAny>::CArrayFix(TBufRep aRep,TInt aRecordLength,TInt aGranularity)
       
   813 	: CArrayFixBase(aRep,aRecordLength,aGranularity)
       
   814 /**
       
   815 @internalComponent
       
   816 */
       
   817 	{}
       
   818 
       
   819 
       
   820 
       
   821 
       
   822 inline const TAny *CArrayFix<TAny>::At(TInt anIndex) const
       
   823 /**
       
   824 Gets a pointer to the untyped element located at the specified position 
       
   825 within the array.
       
   826 	
       
   827 @param anIndex The position of the element within the array. The position 
       
   828 	           is relative to zero; i.e. zero implies the first element in the
       
   829 			   array. 
       
   830 			   
       
   831 @return A pointer to the untyped element located at position anIndex within 
       
   832 	    the array. 
       
   833 
       
   834 @panic E32User-CBase 21, if anIndex is negative or is greater than or equal
       
   835        to the number of objects currently within the array.
       
   836 */
       
   837 	{return(CArrayFixBase::At(anIndex));}
       
   838 
       
   839 
       
   840 
       
   841 
       
   842 inline const TAny *CArrayFix<TAny>::End(TInt anIndex) const
       
   843 /**
       
   844 Gets a pointer to the first byte following the end of the contiguous region 
       
   845 containing the element at the specfied position within the array.
       
   846 	
       
   847 For flat buffers, the pointer always points to the first byte following the 
       
   848 end of the buffer.
       
   849 	
       
   850 For segmented buffers, the pointer always points to the first byte following 
       
   851 the end of the segment which contains the element.
       
   852 	
       
   853 @param anIndex The position of the element within the array. The position 
       
   854 	           is relative to zero; i.e. zero implies the first element in
       
   855 			   the array.
       
   856 
       
   857 @return A pointer to the byte following the end of the contiguous region.
       
   858 
       
   859 @panic E32USER-CBase 21, if anIndex is negative or greater than or equal to
       
   860        the number of objects currently within the array.
       
   861 */
       
   862 	{return(CArrayFixBase::End(anIndex));}
       
   863 
       
   864 
       
   865 
       
   866 
       
   867 inline const TAny *CArrayFix<TAny>::Back(TInt anIndex) const
       
   868 /**
       
   869 Gets a pointer to the beginning of a contiguous region.
       
   870 	
       
   871 For flat buffers, the function always returns a pointer to the beginning of 
       
   872 the buffer.
       
   873 	
       
   874 For segmented buffers, the function returns a pointer to the beginning of 
       
   875 the segment for all elements in that segment except the first. If the element 
       
   876 at the specified position is the first in a segment, then the function returns 
       
   877 a pointer the beginning of the previous segment.
       
   878 	
       
   879 For the first element in the array, the function returns a NULL pointer.
       
   880 	
       
   881 @param anIndex The position of the element within the array. The position 
       
   882                is relative to zero; i.e. zero implies the first element in the array.
       
   883 	
       
   884 @return A pointer to the beginning of the contiguous region.
       
   885 
       
   886 @panic E32User-CBase 21, if anIndex is negative or is greater than or equal to
       
   887        the number of objects currently within the array.
       
   888 */
       
   889 	{return(CArrayFixBase::Back(anIndex));}
       
   890 
       
   891 
       
   892 
       
   893 
       
   894 inline TAny *CArrayFix<TAny>::At(TInt anIndex)
       
   895 /**
       
   896 Gets a pointer to the untyped element located at the specified position 
       
   897 within the array.
       
   898 	
       
   899 @param anIndex The position of the element within the array. The position 
       
   900 	           is relative to zero; i.e. zero implies the first element in the
       
   901 			   array. 
       
   902 			   
       
   903 @return A pointer to the untyped element located at position anIndex within 
       
   904 	    the array. 
       
   905 
       
   906 @panic E32User-CBase 21, if anIndex is negative or is greater than or equal
       
   907        to the number of objects currently within the array.
       
   908 */
       
   909 	{return(CArrayFixBase::At(anIndex));}
       
   910 
       
   911 
       
   912 
       
   913 
       
   914 inline TAny *CArrayFix<TAny>::End(TInt anIndex)
       
   915 /**
       
   916 Gets a pointer to the first byte following the end of the contiguous region 
       
   917 containing the element at the specfied position within the array.
       
   918 	
       
   919 For flat buffers, the pointer always points to the first byte following the 
       
   920 end of the buffer.
       
   921 	
       
   922 For segmented buffers, the pointer always points to the first byte following 
       
   923 the end of the segment which contains the element.
       
   924 	
       
   925 @param anIndex The position of the element within the array. The position 
       
   926 	           is relative to zero; i.e. zero implies the first element in
       
   927 			   the array.
       
   928 
       
   929 @return A pointer to the byte following the end of the contiguous region.
       
   930 
       
   931 @panic E32USER-CBase 21, if anIndex is negative or greater than or equal to
       
   932        the number of objects currently within the array.
       
   933 */
       
   934 	{return(CArrayFixBase::End(anIndex));}
       
   935 
       
   936 
       
   937 
       
   938 
       
   939 inline TAny *CArrayFix<TAny>::Back(TInt anIndex)
       
   940 /**
       
   941 Gets a pointer to the beginning of a contiguous region.
       
   942 	
       
   943 For flat buffers, the function always returns a pointer to the beginning of 
       
   944 the buffer.
       
   945 	
       
   946 For segmented buffers, the function returns a pointer to the beginning of 
       
   947 the segment for all elements in that segment except the first. If the element 
       
   948 at the specified position is the first in a segment, then the function returns 
       
   949 a pointer the beginning of the previous segment.
       
   950 	
       
   951 For the first element in the array, the function returns a NULL pointer.
       
   952 	
       
   953 @param anIndex The position of the element within the array. The position 
       
   954                is relative to zero; i.e. zero implies the first element in the array.
       
   955 	
       
   956 @return A pointer to the beginning of the contiguous region.
       
   957 
       
   958 @panic E32User-CBase 21, if anIndex is negative or is greater than or equal to
       
   959        the number of objects currently within the array.
       
   960 */
       
   961 	{return(CArrayFixBase::Back(anIndex));}
       
   962 
       
   963 
       
   964 
       
   965 
       
   966 inline void CArrayFix<TAny>::AppendL(const TAny *aPtr)
       
   967 /**
       
   968 Appends the specified untyped element onto the end of the array.
       
   969 	
       
   970 @param aPtr A pointer to an untyped element to be appended. 
       
   971 
       
   972 @leave KErrNoMemory The function may attempt to expand the array buffer. If 
       
   973 	   there is insufficient memory available, the function leaves, in which
       
   974 	   case the array is left in the state it was in before the call. 
       
   975 */
       
   976 	{CArrayFixBase::InsertL(Count(),aPtr);}
       
   977 
       
   978 
       
   979 
       
   980 
       
   981 inline void CArrayFix<TAny>::AppendL(const TAny *aPtr,TInt aCount)
       
   982 /**
       
   983 Appends one or more untyped elements onto the end of the array.
       
   984 	
       
   985 @param aPtr   A pointer to the first of the contiguous untyped elements to be 
       
   986 	          appended. 
       
   987 @param aCount The number of contiguous elements located at aPtr to be appended. 
       
   988 
       
   989 @leave KErrNoMemory The function may attempt to expand the array buffer. If 
       
   990        there is insufficient memory available, the function leaves, in which
       
   991 	   case the array is left in the state it was in before the call. 
       
   992 @panic E32USER-CBase 23, if aCount is negative.
       
   993 */
       
   994 	{CArrayFixBase::InsertL(Count(),aPtr,aCount);}
       
   995 
       
   996 
       
   997 
       
   998 
       
   999 inline TAny *CArrayFix<TAny>::ExtendL()
       
  1000 /**
       
  1001 Expands the array by the length of one element at the end of the array and 
       
  1002 returns a pointer to this new location.
       
  1003 	
       
  1004 As elements are untyped, no construction is possible and the content of the 
       
  1005 new location remains undefined.
       
  1006 
       
  1007 @return A pointer to the new element location at the end of the array.
       
  1008 
       
  1009 @leave KErrNoMemory The function may attempt to expand the array buffer. If 
       
  1010 	   there is insufficient memory available, the function leaves, in which
       
  1011 	   case the array is left in the state it was in before the call. 
       
  1012 */
       
  1013 	{return(CArrayFixBase::ExpandL(Count()));}
       
  1014 
       
  1015 
       
  1016 
       
  1017 
       
  1018 // Template class CArrayFixFlat
       
  1019 template <class T>
       
  1020 inline CArrayFixFlat<T>::CArrayFixFlat(TInt aGranularity)
       
  1021 	: CArrayFix<T>((TBufRep)CBufFlat::NewL,aGranularity)
       
  1022 /**
       
  1023 Constructs a flat array of fixed length objects with the specified granularity.
       
  1024 
       
  1025 The length of all array elements is the length of the class passed as the 
       
  1026 template parameter. The length must be non-zero.
       
  1027 
       
  1028 Note that no memory is allocated to the array buffer by this constructor.
       
  1029 
       
  1030 @param aGranularity The granularity of the array. 
       
  1031   
       
  1032 @panic E32USER-CBase 17, if the length of the class implied by the template parameter is zero.
       
  1033 
       
  1034 @panic E32USER-CBase 18, if aGranularity is not positive.
       
  1035 */
       
  1036 	{}
       
  1037 
       
  1038 
       
  1039 
       
  1040 
       
  1041 template <class T>
       
  1042 inline void CArrayFixFlat<T>::SetReserveL(TInt aCount)
       
  1043 /**
       
  1044 Reserves space in the array buffer.
       
  1045 
       
  1046 If necessary, the array buffer is allocated or re-allocated so that it can
       
  1047 accommodate the specified number of elements.
       
  1048 
       
  1049 After a successful call to this function, elements can be added to the array 
       
  1050 and the process is guaranteed not to fail for lack of memory - provided the 
       
  1051 total number of elements does not exceed the number specified in this function.
       
  1052 
       
  1053 This function does not increase the number of elements in the array; i.e. 
       
  1054 the member function CArrayFixBase::Count() returns the same value both before 
       
  1055 and after a call to CArrayFixFlat::SetReserveL().
       
  1056 
       
  1057 @param aCount The total number of elements for which space is to be reserved. 
       
  1058 	
       
  1059 @panic E32USER-CBase 27, if aCount is less than the current number of elements
       
  1060                          in the array.
       
  1061 */
       
  1062 	{this->SetReserveFlatL(aCount);}
       
  1063 
       
  1064 
       
  1065 
       
  1066 
       
  1067 inline CArrayFixFlat<TAny>::CArrayFixFlat(TInt aRecordLength,TInt aGranularity)
       
  1068 	: CArrayFix<TAny>((TBufRep)CBufFlat::NewL,aRecordLength,aGranularity)
       
  1069 /**
       
  1070 Constructs a flat array of fixed length objects with the specified granularity 
       
  1071 to contain elements of the specified length.
       
  1072 	
       
  1073 Note that no memory is allocated to the array buffer by this constructor.
       
  1074 	
       
  1075 @param aRecordLength The length of the elements of this fixed length array. 
       
  1076 @param aGranularity  The granularity of the array.
       
  1077 	
       
  1078 @panic E32USER-CBase 17, if aRecordLength is not positive.
       
  1079 @panic E32USER-CBase 18, if aGranularity is  not positive.
       
  1080 */
       
  1081 	{}
       
  1082 
       
  1083 
       
  1084 
       
  1085 
       
  1086 inline void CArrayFixFlat<TAny>::SetReserveL(TInt aCount)
       
  1087 /**
       
  1088 Reserves space in the array buffer.
       
  1089 
       
  1090 If necessary, the array buffer is allocated or re-allocated so that it can
       
  1091 accommodate the specified number of elements.
       
  1092 	
       
  1093 After a successful call to this function, elements can be added to the array 
       
  1094 and the process is guaranteed not to fail for lack of memory - provided the 
       
  1095 total number of elements does not exceed the specified number.
       
  1096 	
       
  1097 This function does not increase the number of elements in the array; i.e. 
       
  1098 the member function CArrayFixBase::Count() returns the same value both before 
       
  1099 and after a call to this function.
       
  1100 	
       
  1101 @param aCount The total number of elements for which space is to be reserved. 
       
  1102 
       
  1103 @panic E32USER-CBase 27, if aCount is less than the current number of elements
       
  1104                          in the array.
       
  1105 */
       
  1106 	{SetReserveFlatL(aCount);}
       
  1107 
       
  1108 
       
  1109 
       
  1110 
       
  1111 inline void CArrayFixFlat<TInt>::SetReserveL(TInt aCount)
       
  1112 /**
       
  1113 Reserves space in the array buffer.
       
  1114 	
       
  1115 If necessary, the array buffer is allocated or re-allocated so that it can 
       
  1116 accommodate the specified number of TInt elements.
       
  1117 	
       
  1118 After a successful call to this function, elements can be added to the array 
       
  1119 and the process is guaranteed not to fail for lack of memory - provided the 
       
  1120 total number of elements does not exceed the specified number.
       
  1121 	
       
  1122 This function does not increase the number of elements in the array; i.e. 
       
  1123 the member function CArrayFixBase::Count() returns the same value both before 
       
  1124 and after a call to this function.
       
  1125 	
       
  1126 @param aCount The total number of elements for which space is to be reserved. 
       
  1127 
       
  1128 @panic E32USER-CBase 27, if aCount is less than the current number of elements
       
  1129                          in the array.
       
  1130 */
       
  1131 	{SetReserveFlatL(aCount);}
       
  1132 
       
  1133 
       
  1134 
       
  1135 
       
  1136 inline void CArrayFixFlat<TUid>::SetReserveL(TInt aCount)
       
  1137 /**
       
  1138 Reserves space in the array buffer.
       
  1139 	
       
  1140 If necessary, the array buffer is allocated or re-allocated so that it can 
       
  1141 accommodate the specified number of TUid elements.
       
  1142 	
       
  1143 After a successful call to this function, elements can be added to the array 
       
  1144 and the process is guaranteed not to fail for lack of memory - provided the 
       
  1145 total number of elements does not exceed the specified number.
       
  1146 	
       
  1147 This function does not increase the number of elements in the array; i.e. 
       
  1148 the member function CArrayFixBase::Count() returns the same value both before 
       
  1149 and after a call to this function.
       
  1150 	
       
  1151 @param aCount The total number of elements for which space is to be reserved. 
       
  1152 
       
  1153 @panic E32USER-CBase 27, if aCount is less than the current number of elements
       
  1154                          in the array.
       
  1155 */
       
  1156 	{SetReserveFlatL(aCount);}
       
  1157 
       
  1158 
       
  1159 
       
  1160 
       
  1161 // Template class CArrayFixSeg
       
  1162 template <class T>
       
  1163 inline CArrayFixSeg<T>::CArrayFixSeg(TInt aGranularity)
       
  1164 	: CArrayFix<T>((TBufRep)CBufSeg::NewL,aGranularity)
       
  1165 /**
       
  1166 Constructs a segmented array of fixed length objects with the specified
       
  1167 granularity.
       
  1168 
       
  1169 The length of all array elements is the length of the class passed as the 
       
  1170 template parameter. The length must be non-zero.
       
  1171 
       
  1172 Note that no memory is allocated to the array buffer by this constructor.
       
  1173 
       
  1174 @param aGranularity The granularity of the array. 
       
  1175 
       
  1176 @panic E32USER-CBase 17, if the length of the class implied by the template
       
  1177                          parameter is zero.
       
  1178 @panic E32USER-CBase 18, if aGranularity is not positive.
       
  1179 */
       
  1180 	{}
       
  1181 
       
  1182 
       
  1183 
       
  1184 
       
  1185 inline CArrayFixSeg<TAny>::CArrayFixSeg(TInt aRecordLength,TInt aGranularity)
       
  1186 	: CArrayFix<TAny>((TBufRep)CBufSeg::NewL,aRecordLength,aGranularity)
       
  1187 /**
       
  1188 Constructs a segmented array of fixed length objects with the specified
       
  1189 granularity to contain elements of the specified length.
       
  1190 	
       
  1191 Note that no memory is allocated to the array buffer by this constructor.
       
  1192 	
       
  1193 @param aRecordLength The length of the elements of this array.
       
  1194 
       
  1195 @param aGranularity The granularity of the array.
       
  1196 
       
  1197 @panic E32USER-CBase 17, if aRecordLength is not positive.
       
  1198 @panic E32USER-CBase 18, if aGranularity is not positive.
       
  1199 */
       
  1200 	{}
       
  1201 
       
  1202 
       
  1203 
       
  1204 
       
  1205 // Template class CArrayPtr
       
  1206 template <class T>
       
  1207 inline CArrayPtr<T>::CArrayPtr(TBufRep aRep,TInt aGranularity)
       
  1208 	: CArrayFix<T*>(aRep,aGranularity)
       
  1209 /**
       
  1210 @internalComponent
       
  1211 */
       
  1212 	{}
       
  1213 
       
  1214 
       
  1215 
       
  1216 
       
  1217 template <class T>
       
  1218 void CArrayPtr<T>::ResetAndDestroy()
       
  1219 /**
       
  1220 Destroys all objects whose pointers form the elements of the array, before 
       
  1221 resetting the array.
       
  1222 
       
  1223 The destructor of each class T object is called before the objects themselves 
       
  1224 are destroyed.
       
  1225 
       
  1226 If the array is not empty, this member function must be called before the 
       
  1227 array is deleted to prevent the CBase derived objects from being orphaned 
       
  1228 on the heap.
       
  1229 
       
  1230 Note that each call to this function results in a small, but non-trivial,
       
  1231 amount of code being generated.
       
  1232 */
       
  1233 	{
       
  1234 	for (TInt i=0;i<this->Count();++i)
       
  1235 		delete this->At(i);
       
  1236 	this->Reset();
       
  1237 	}
       
  1238 
       
  1239 
       
  1240 
       
  1241 
       
  1242 // Template class CArrayPtrFlat
       
  1243 template <class T>
       
  1244 inline CArrayPtrFlat<T>::CArrayPtrFlat(TInt aGranularity)
       
  1245 	: CArrayPtr<T>((TBufRep)CBufFlat::NewL,aGranularity)
       
  1246 /** 
       
  1247 Constructs a flat array of pointers with specified granularity.
       
  1248 
       
  1249 Note that no memory is allocated to the array buffer by this constructor.
       
  1250 
       
  1251 @param aGranularity The granularity of the array. 
       
  1252 
       
  1253 @panic E32USER-CBase 18, if aGranularity is not positive.
       
  1254 */
       
  1255 	{}
       
  1256 
       
  1257 
       
  1258 
       
  1259 
       
  1260 template <class T>
       
  1261 inline void CArrayPtrFlat<T>::SetReserveL(TInt aCount)
       
  1262 /**
       
  1263 Reserves space in the array buffer.
       
  1264 
       
  1265 If necessary, the array buffer is allocated or re-allocated so that it can
       
  1266 accommodate the specified number of elements.
       
  1267 
       
  1268 After a successful call to this function, elements can be added to the array 
       
  1269 and the process is guaranteed not to fail for lack of memory - provided the 
       
  1270 total number of elements does not exceed the specified number.
       
  1271 
       
  1272 This function does not increase the number of elements in the array; i.e. 
       
  1273 the member function CArrayFixBase::Count() returns the same value both before 
       
  1274 and after a call to this function.
       
  1275 
       
  1276 @param aCount The total number of elements for which space is to be reserved. 
       
  1277 
       
  1278 @panic E32USER-CBase 27, if aCount is less than the current number of elements
       
  1279        in the array.
       
  1280 */
       
  1281 	{this->SetReserveFlatL(aCount);}
       
  1282 
       
  1283 
       
  1284 
       
  1285 
       
  1286 // Template class CArrayPtrSeg
       
  1287 template <class T>
       
  1288 inline CArrayPtrSeg<T>::CArrayPtrSeg(TInt aGranularity)
       
  1289 	: CArrayPtr<T>((TBufRep)CBufSeg::NewL,aGranularity)
       
  1290 /**
       
  1291 Constructs a segmented array of pointers with specified granularity.
       
  1292 
       
  1293 Note that no memory is allocated to the array buffer by this constructor.
       
  1294 
       
  1295 @param aGranularity The granularity of the array. 
       
  1296 
       
  1297 @panic E32USER-CBase 18, if aGranularity is not positive.
       
  1298 */
       
  1299 	{}
       
  1300 
       
  1301 
       
  1302 
       
  1303 
       
  1304 // Class CArrayVarBase
       
  1305 inline TInt CArrayVarBase::Count() const
       
  1306 /**
       
  1307 Gets the number of elements held in the array.
       
  1308 
       
  1309 @return The number of array elements.
       
  1310 */
       
  1311 	{return(iCount);}
       
  1312 
       
  1313 
       
  1314 
       
  1315 
       
  1316 // Template class CArrayVar
       
  1317 template <class T>
       
  1318 inline CArrayVar<T>::CArrayVar(TBufRep aRep,TInt aGranularity)
       
  1319 	: CArrayVarBase(aRep,aGranularity)
       
  1320 /**
       
  1321 @internalComponent
       
  1322 */
       
  1323 	{}
       
  1324 
       
  1325 
       
  1326 
       
  1327 
       
  1328 template <class T>
       
  1329 inline const T &CArrayVar<T>::operator[](TInt anIndex) const
       
  1330 /** 
       
  1331 Gets a reference to the const element located at the specified position 
       
  1332 within the array.
       
  1333 
       
  1334 The compiler uses this variant of the function if the returned reference is 
       
  1335 used in an expression where it cannot be modified.
       
  1336 
       
  1337 @param anIndex The position of the element within the array, relative to zero; 
       
  1338                i.e. zero implies the first element.
       
  1339 			   
       
  1340 @return A const reference to the element located at position anIndex within 
       
  1341         the array. 
       
  1342 
       
  1343 @panic E32USER-CBase 21, if anIndex is negative or greater than or equal to the
       
  1344        number of objects currently within the array.
       
  1345 */
       
  1346 	{return(*((const T *)CArrayVarBase::At(anIndex)));}
       
  1347 
       
  1348 
       
  1349 
       
  1350 
       
  1351 template <class T>
       
  1352 inline T &CArrayVar<T>::operator[](TInt anIndex)
       
  1353 /**
       
  1354 Gets a reference to the element located at the specified position within 
       
  1355 the array.
       
  1356 
       
  1357 The compiler uses this variant of the function if the returned reference is 
       
  1358 used in an expression where it can be modified.
       
  1359 
       
  1360 @param anIndex The position of the element within the array, relative to zero; 
       
  1361                i.e. zero implies the first element.
       
  1362 
       
  1363 
       
  1364 @return A reference to the non-const element located at position anIndex within 
       
  1365         the array.
       
  1366 
       
  1367 @panic E32USER-CBase 21, if anIndex is negative or greater than or equal to the
       
  1368        number of objects currently within the array.
       
  1369 */
       
  1370 	{return(*((T *)CArrayVarBase::At(anIndex)));}
       
  1371 
       
  1372 
       
  1373 
       
  1374 
       
  1375 template <class T>
       
  1376 inline const T &CArrayVar<T>::At(TInt anIndex) const
       
  1377 /** 
       
  1378 Gets a reference to the const element located at the specified position 
       
  1379 within the array.
       
  1380 
       
  1381 The compiler uses this variant of the function if the returned reference is 
       
  1382 used in an expression where it cannot be modified.
       
  1383 
       
  1384 @param anIndex The position of the element within the array, relative to zero; 
       
  1385                i.e. zero implies the first element.
       
  1386 			   
       
  1387 @return A const reference to the element located at position anIndex within 
       
  1388         the array. 
       
  1389 
       
  1390 @panic E32USER-CBase 21, if anIndex is negative or greater than or equal to the
       
  1391        number of objects currently within the array.
       
  1392 */
       
  1393 	{return(*((const T *)CArrayVarBase::At(anIndex)));}
       
  1394 
       
  1395 
       
  1396 
       
  1397 template <class T>
       
  1398 inline T &CArrayVar<T>::At(TInt anIndex)
       
  1399 /**
       
  1400 Gets a reference to the element located at the specified position within 
       
  1401 the array.
       
  1402 
       
  1403 The compiler uses this variant of the function if the returned reference is 
       
  1404 used in an expression where it can be modified.
       
  1405 
       
  1406 @param anIndex The position of the element within the array, relative to zero; 
       
  1407                i.e. zero implies the first element.
       
  1408 
       
  1409 @return A reference to the non-const element located at position anIndex within 
       
  1410         the array.
       
  1411 
       
  1412 @panic E32USER-CBase 21, if anIndex is negative or greater than or equal to the
       
  1413        number of objects currently within the array.
       
  1414 */
       
  1415 	{return(*((T *)CArrayVarBase::At(anIndex)));}
       
  1416 
       
  1417 
       
  1418 
       
  1419 
       
  1420 template <class T>
       
  1421 inline void CArrayVar<T>::AppendL(const T &aRef,TInt aLength)
       
  1422 /**
       
  1423 Appends an element of a specified length onto the array.
       
  1424 
       
  1425 @param aRef    A reference to the <class T> element to be appended.
       
  1426 @param aLength The length of the element to be appended.
       
  1427 
       
  1428 @leave KErrNoMemory The function always attempts to allocate a cell to
       
  1429        contain the new element and may also attempt to expand the array buffer.
       
  1430 	   If there is insufficient memory available, the function leaves, in which
       
  1431 	   case, the array is left in the state it was in before the call.
       
  1432 
       
  1433 @panic E32USER-CBase 30, if aLength is negative.
       
  1434 */
       
  1435 	{CArrayVarBase::InsertL(Count(),&aRef,aLength);}
       
  1436 
       
  1437 
       
  1438 
       
  1439 
       
  1440 template <class T>
       
  1441 inline T &CArrayVar<T>::ExpandL(TInt anIndex,TInt aLength)
       
  1442 /**
       
  1443 Expands the array by one element of specified length at the specified position. 
       
  1444 
       
  1445 It:
       
  1446 
       
  1447 1. expands the array by one element position anIndex
       
  1448 
       
  1449 2. constructs a new element of specified length at that position
       
  1450 
       
  1451 3. returns a reference to the new element.
       
  1452 
       
  1453 All existing elements from position anIndex to the end of the array are moved 
       
  1454 up, so that the element originally at position anIndex is now at position 
       
  1455 anIndex + 1 etc.
       
  1456 
       
  1457 The new element of type <class T> and length aLength is constructed at position 
       
  1458 anIndex, using the default constructor of that class.
       
  1459 
       
  1460 @param anIndex The position within the array where the array is to be expanded 
       
  1461                and the new <class T> object is to be constructed.
       
  1462 			   
       
  1463 @param aLength The length of the new element. 
       
  1464 
       
  1465 @return A reference to the newly constructed <class T> object at position 
       
  1466         anIndex within the array.
       
  1467 
       
  1468 @leave KErrNoMemory The function always attempts to allocate a cell to contain 
       
  1469        the new element and may also attempt to expand the array buffer. If there 
       
  1470        is insufficient memory available, the function leaves, in which case, the 
       
  1471        array is left in the state it was in before the call.
       
  1472 
       
  1473 @panic E32USER-CBase 21, if anIndex is negative or is greater than the number
       
  1474        of elements currently in the array.
       
  1475 @panic E32USER-CBase 30, if aLength is negative.
       
  1476 */
       
  1477 	{return(*new(CArrayVarBase::ExpandL(anIndex,aLength)) T);}
       
  1478 
       
  1479 
       
  1480 
       
  1481 
       
  1482 template <class T>
       
  1483 inline T &CArrayVar<T>::ExtendL(TInt aLength)
       
  1484 /**
       
  1485 Expands the array by one element of specified length at the end of the array. 
       
  1486 
       
  1487 It:
       
  1488 
       
  1489 1. expands the array by one element at the end of the array, i.e. at position 
       
  1490    CArrayVarBase::Count()
       
  1491 
       
  1492 2. constructs a new element of specified length at that position.
       
  1493 
       
  1494 3. returns a reference to the new element.
       
  1495 
       
  1496 The new element of type <class T> is constructed at the end of the array, 
       
  1497 using the default constructor of that class.
       
  1498 
       
  1499 @param aLength The length of the new element.
       
  1500 
       
  1501 @return A reference to the newly constructed <class T> object at the end of 
       
  1502         the array.
       
  1503 
       
  1504 @leave KErrNoMemory The function always attempts to allocate a cell to contain 
       
  1505        the new element and may also attempt to expand the array buffer. If there 
       
  1506        is insufficient memory available, the function leaves, in which case, the 
       
  1507        array is left in the state it was in before the call.
       
  1508   
       
  1509 @panic E32USER-CBase 30, if aLength is negative.
       
  1510 */
       
  1511 	{return(*new(CArrayVarBase::ExpandL(Count(),aLength)) T);}
       
  1512 
       
  1513 
       
  1514 
       
  1515 
       
  1516 template <class T>
       
  1517 inline TInt CArrayVar<T>::Find(const T &aRef,TKeyArrayVar &aKey,TInt &anIndex) const
       
  1518 /**
       
  1519 Finds the position of an element within the array, based on the matching of 
       
  1520 keys, using a sequential search.
       
  1521 
       
  1522 The array is searched sequentially for an element whose key matches the key 
       
  1523 of the supplied object. The search starts with the first element in the array.
       
  1524 
       
  1525 Note that where an array has elements with duplicate keys, the function only
       
  1526 supplies the position of the first element in the array with that key.
       
  1527 
       
  1528 @param aRef    A reference to an object of type <class T> whose key is used 
       
  1529                for comparison.
       
  1530 @param aKey    A reference to a key object defining the properties of the key.
       
  1531 @param anIndex A TInt supplied by the caller. On return, if the element is
       
  1532                found, this is set to the position of that element
       
  1533 			   within the array. The position is relative to zero, (i.e. 
       
  1534                the first element in the array is at position 0).
       
  1535 			   If the element is not found or the array is empty, then
       
  1536 			   this is undefined.
       
  1537 
       
  1538 @return Zero, if the element with the specified key is found. Non-zero, if 
       
  1539         the element with the specified key is not found.
       
  1540 */
       
  1541 	{return(CArrayVarBase::Find(&aRef,aKey,anIndex));}
       
  1542 
       
  1543 
       
  1544 
       
  1545 
       
  1546 template <class T>
       
  1547 inline TInt CArrayVar<T>::FindIsq(const T &aRef,TKeyArrayVar &aKey,TInt &anIndex) const
       
  1548 /**
       
  1549 Finds the position of an element within the array, based on the matching of 
       
  1550 keys, using a binary search technique.
       
  1551 
       
  1552 The array is searched, using a binary search technique, for an element whose 
       
  1553 key matches the key of the supplied <class T> object.
       
  1554 
       
  1555 The array must be in key order.
       
  1556 
       
  1557 Note that where an array has elements with duplicate keys, the function cannot
       
  1558 guarantee which element, with the given key value, it will return, except that
       
  1559 it will find one of them.
       
  1560 
       
  1561 @param aRef    A reference to an object of type <class T> whose key is used 
       
  1562                for comparison.
       
  1563 @param aKey    A reference to a key object defining the properties of the key.
       
  1564 @param anIndex A TInt supplied by the caller. On return, if the element is
       
  1565                found, this is set to the position  of that element within
       
  1566 			   the array. The position is relative to zero, (i.e. 
       
  1567                the first element in the array is at position zero).
       
  1568 			   If the element is not found and the array is not empty, then
       
  1569 			   this is set to the position of the first element in the array
       
  1570 			   with a key which is greater than the key of the object aRef.
       
  1571 			   If the element is not found and the array is empty, then 
       
  1572                this is undefined.
       
  1573 
       
  1574 @return Zero, if the element with the specified key is found or the array is 
       
  1575         empty. Non-zero, if the element with the specified key is not found.
       
  1576 */
       
  1577 	{return(CArrayVarBase::FindIsq(&aRef,aKey,anIndex));}
       
  1578 
       
  1579 
       
  1580 
       
  1581 
       
  1582 template <class T>
       
  1583 inline void CArrayVar<T>::InsertL(TInt anIndex,const T &aRef,TInt aLength)
       
  1584 /**
       
  1585 Inserts an element of a specified length into the array at the specified
       
  1586 position.
       
  1587 
       
  1588 Note that passing a value of anIndex which is the same as the current number
       
  1589 of elements in the array, has the effect of appending that element.
       
  1590 
       
  1591 @param anIndex The position within the array where the element is to be
       
  1592                inserted. The position is relative to zero, i.e. zero implies
       
  1593 			   that elements are inserted at the beginning of the array.
       
  1594 @param aRef    A reference to the <class T> object to be inserted into
       
  1595                the array.
       
  1596 @param aLength The length of the element to be inserted into the array. 
       
  1597 
       
  1598 @leave KErrNoMemory The function always attempts to allocate a cell to contain 
       
  1599        the new element and may also attempt to expand the array buffer. If
       
  1600 	   there is insufficient memory available, the function leaves, in which
       
  1601 	   case, the array is left in the state it was in before the call.
       
  1602 
       
  1603 @panic E32USER-CBase 21, if anIndex is negative or is greater than the number
       
  1604        of objects currently in the array.
       
  1605 @panic E32USER-CBase 30, if aLength is is negative.
       
  1606 */
       
  1607 	{CArrayVarBase::InsertL(anIndex,&aRef,aLength);}
       
  1608 
       
  1609 
       
  1610 
       
  1611 
       
  1612 template <class T>
       
  1613 inline TInt CArrayVar<T>::InsertIsqL(const T &aRef,TInt aLength,TKeyArrayVar &aKey)
       
  1614 /**
       
  1615 Inserts a single element of a specified length into the array at a position 
       
  1616 determined by a key.
       
  1617 
       
  1618 The array MUST already be in key sequence (as defined by the key), otherwise 
       
  1619 the position of the new element is unpredictable, or duplicates may occur.
       
  1620 
       
  1621 Elements with duplicate keys are not permitted.
       
  1622 
       
  1623 @param aRef    A reference to the element of type <class T> to be inserted into 
       
  1624                the array.
       
  1625 @param aLength The length of the new element of type <class T> to be inserted 
       
  1626                into the array.
       
  1627 @param aKey    A reference to a key object defining the properties of the key.
       
  1628 
       
  1629 @return The position within the array of the newly inserted element.
       
  1630 
       
  1631 @leave KErrAlreadyExists An element with the same key already exists within 
       
  1632        the array. NB the array MUST already be in key sequence, otherwise
       
  1633 	   the function may insert a duplicate and fail to leave with
       
  1634 	   this value.
       
  1635 @leave KErrNoMemory The function always attempts to allocate a cell to contain 
       
  1636        the new element and may also attempt to expand the array buffer. If
       
  1637 	   there is insufficient memory available, the function leaves, in which
       
  1638 	   case, the array is left in the state it was in before the call.
       
  1639 */
       
  1640 	{return(CArrayVarBase::InsertIsqL(&aRef,aLength,aKey));}
       
  1641 
       
  1642 
       
  1643 
       
  1644 
       
  1645 template <class T>
       
  1646 inline TInt CArrayVar<T>::InsertIsqAllowDuplicatesL(const T &aRef,TInt aLength,TKeyArrayVar &aKey)
       
  1647 /**
       
  1648 Inserts a single element of a specified length into the array at a position 
       
  1649 determined by a key, allowing duplicates.
       
  1650 
       
  1651 The array MUST already be in key sequence, otherwise the position of the 
       
  1652 new element is unpredictable.
       
  1653 
       
  1654 Elements with duplicate keys are permitted. If the new element's key is a 
       
  1655 duplicate of an existing element's key, then the new element is positioned 
       
  1656 after the existing element.
       
  1657 
       
  1658 @param aRef    A reference to the element of type <class T> to be inserted
       
  1659                into the array.
       
  1660 @param aLength The length of the new element to be inserted into the array. 
       
  1661 @param aKey    A reference to a key object defining the properties of the key. 
       
  1662 
       
  1663 @return The position within the array of the newly inserted element.
       
  1664 
       
  1665 @leave KErrNoMemory The function always attempts to allocate a cell to contain 
       
  1666        the new element and may also attempt to expand the array buffer. If
       
  1667 	   there is insufficient memory available, the function leaves, in which
       
  1668 	   case, the array is left in the state it was in before the call.
       
  1669 */
       
  1670 	{return(CArrayVarBase::InsertIsqAllowDuplicatesL(&aRef,aLength,aKey));}
       
  1671 
       
  1672 
       
  1673 
       
  1674 
       
  1675 template <class T>
       
  1676 inline const TArray<T> CArrayVar<T>::Array() const
       
  1677 /**
       
  1678 Constructs and returns a TArray<T> object.
       
  1679 
       
  1680 @return A TArray<T> object for this array.
       
  1681 */
       
  1682 	{return(TArray<T>(CountR,AtR,this));}
       
  1683 
       
  1684 
       
  1685 
       
  1686 
       
  1687 inline const TAny *CArrayVar<TAny>::At(TInt anIndex) const
       
  1688 /**
       
  1689 Returns a pointer to the untyped element located at the specified position 
       
  1690 within the array.
       
  1691 	
       
  1692 The compiler uses this variant of the function if the returned pointer is 
       
  1693 used in an expression where it cannot be modified.
       
  1694 	
       
  1695 @param anIndex The position of the element within the array, relative to zero; 
       
  1696 	           i.e. zero implies the first element.
       
  1697 
       
  1698 @return A pointer to the const element located at position anIndex within the 
       
  1699         array.
       
  1700 
       
  1701 @panic E32USER-CBase 21, if anIndex is negative or greater than or equal to the
       
  1702        number of objects currently within the array.
       
  1703 */
       
  1704 	{return(CArrayVarBase::At(anIndex));}
       
  1705 
       
  1706 
       
  1707 
       
  1708 
       
  1709 inline CArrayVar<TAny>::CArrayVar(TBufRep aRep,TInt aGranularity)
       
  1710 	: CArrayVarBase(aRep,aGranularity)
       
  1711 /**
       
  1712 Constructs a variable array with the specified granularity and buffer
       
  1713 organization.
       
  1714 	
       
  1715 Note that no memory is allocated to the array buffer by this constructor.
       
  1716 	
       
  1717 @param aRep         A pointer to a function used to expand the array buffer.
       
  1718                     The organisation of the array buffer is implied by the
       
  1719 					choice of this function.
       
  1720 			        For a flat array buffer, pass (TBufRep)CBufFlat::NewL.
       
  1721 			        For a segmented array buffer, pass (TBufRep)CBufSeg::NewL. 
       
  1722 @param aGranularity The granularity of the array. 
       
  1723 
       
  1724 @panic E32USER-CBase 19, if aGranularity is not positive.
       
  1725 */
       
  1726 	{}
       
  1727 
       
  1728 
       
  1729 
       
  1730 
       
  1731 inline TAny *CArrayVar<TAny>::At(TInt anIndex)
       
  1732 /**
       
  1733 Returns a pointer to the untyped element located at the specified position 
       
  1734 within the array.
       
  1735 	
       
  1736 The compiler uses this variant of the function if the returned pointer is 
       
  1737 used in an expression where it can be modified.
       
  1738 	
       
  1739 @param anIndex The position of the element within the array, relative to zero; 
       
  1740 	           i.e. zero implies the first element.
       
  1741 
       
  1742 @return A pointer to the non-const element located at position anIndex within the 
       
  1743         array.
       
  1744 
       
  1745 @panic E32USER-CBase 21, if anIndex is negative or greater than or equal to the
       
  1746        number of objects currently within the array.
       
  1747 */
       
  1748 	{return(CArrayVarBase::At(anIndex));}
       
  1749 
       
  1750 
       
  1751 
       
  1752 
       
  1753 inline void CArrayVar<TAny>::AppendL(const TAny *aPtr,TInt aLength)
       
  1754 /**
       
  1755 Appends an untyped element of specified length onto the end of the array.
       
  1756 	
       
  1757 @param aPtr    A pointer to an untyped element to be appended. 
       
  1758 @param aLength The length of the untyped element.
       
  1759 */
       
  1760 	{CArrayVarBase::InsertL(Count(),aPtr,aLength);}
       
  1761 
       
  1762 
       
  1763 
       
  1764 
       
  1765 inline TAny *CArrayVar<TAny>::ExtendL(TInt aLength)
       
  1766 /**
       
  1767 Extends the array by one element of specified length at the end of the array,
       
  1768 i.e. at position CArrayVarBase::Count(), and returns a pointer to the new
       
  1769 element location.
       
  1770 
       
  1771 As elements are untyped, no construction is possible and the content of the
       
  1772 new location remains undefined.
       
  1773 
       
  1774 Note that the function always attempts to allocate a cell to contain the new
       
  1775 element and may also attempt to expand the array buffer. If there is
       
  1776 insufficient memory available, the function leaves.
       
  1777 The leave code is one of the system wide error codes.
       
  1778 If the function leaves, the array is left in the state it was in before
       
  1779 the call. 
       
  1780 
       
  1781 @param aLength The length of the new element.
       
  1782 
       
  1783 @return A pointer to the new element location at the end of the array. 
       
  1784 */
       
  1785 	{return(CArrayVarBase::ExpandL(Count(),aLength));}
       
  1786 
       
  1787 
       
  1788 
       
  1789 
       
  1790 // Template class CArrayVarFlat
       
  1791 template <class T>
       
  1792 inline CArrayVarFlat<T>::CArrayVarFlat(TInt aGranularity)
       
  1793 	: CArrayVar<T>((TBufRep)CBufFlat::NewL,aGranularity)
       
  1794 /**
       
  1795 Constructs a variable flat array with specified granularity.
       
  1796 
       
  1797 Note that no memory is allocated to the array buffer by this constructor.
       
  1798 
       
  1799 @param aGranularity The granularity of the array. 
       
  1800 
       
  1801 @panic E32USER-CBase 19, if aGranularity is not positive.
       
  1802 */
       
  1803 	{}
       
  1804 
       
  1805 
       
  1806 
       
  1807 
       
  1808 // Template class CArrayVarSeg
       
  1809 template <class T>
       
  1810 inline CArrayVarSeg<T>::CArrayVarSeg(TInt aGranularity)
       
  1811 	: CArrayVar<T>((TBufRep)CBufSeg::NewL,aGranularity)
       
  1812 /**
       
  1813 Constructs a variable segmented array with specified granularity.
       
  1814 
       
  1815 Note that no memory is allocated to the array buffer by this constructor.
       
  1816 
       
  1817 @param aGranularity The granularity of the array.
       
  1818 
       
  1819 @panic E32USER-CBase 19, if aGranularity is not positive.
       
  1820 */
       
  1821 	{}
       
  1822 
       
  1823 
       
  1824 
       
  1825 
       
  1826 // Class CArrayPakBase
       
  1827 inline TInt CArrayPakBase::Count() const
       
  1828 /**
       
  1829 Gets the number of elements held in the array.
       
  1830 
       
  1831 @return The number of array elements.
       
  1832 */
       
  1833 	{return(iCount);}
       
  1834 
       
  1835 
       
  1836 
       
  1837 
       
  1838 // Template class CArrayPak
       
  1839 template <class T>
       
  1840 inline CArrayPak<T>::CArrayPak(TBufRep aRep,TInt aGranularity)
       
  1841 	: CArrayPakBase(aRep,aGranularity)
       
  1842 /**
       
  1843 @internalComponent
       
  1844 */
       
  1845 	{}
       
  1846 
       
  1847 
       
  1848 
       
  1849 
       
  1850 template <class T>
       
  1851 inline const T &CArrayPak<T>::operator[](TInt anIndex) const
       
  1852 /**
       
  1853 Gets a reference to the element located at the specified position within the 
       
  1854 array.
       
  1855 
       
  1856 The compiler uses this variant of the function when the returned reference 
       
  1857 is used in an expression where it cannot be modified.
       
  1858 
       
  1859 @param anIndex The position of the element within the array. The position 
       
  1860                is relative to zero; i.e. zero implies the first element in
       
  1861 			   the array.  
       
  1862 		
       
  1863 @return A const reference to the element located at position anIndex within 
       
  1864         the array.
       
  1865 
       
  1866 @panic E32USER-CBase 21, if anIndex is negative or greater than or equal to
       
  1867        number of objects currently within the array.
       
  1868 */
       
  1869 	{return(*((const T *)CArrayPakBase::At(anIndex)));}
       
  1870 
       
  1871 
       
  1872 
       
  1873 
       
  1874 template <class T>
       
  1875 inline T &CArrayPak<T>::operator[](TInt anIndex)
       
  1876 /**
       
  1877 Gets a reference to the element located at the specified position within the 
       
  1878 array.
       
  1879 
       
  1880 The compiler uses this variant of the function when the returned reference 
       
  1881 is used in an expression where it can be modified.
       
  1882 
       
  1883 @param anIndex The position of the element within the array. The position 
       
  1884                is relative to zero; i.e. zero implies the first element in
       
  1885 			   the array.  
       
  1886 		
       
  1887 @return A non-const reference to the element located at position anIndex within 
       
  1888         the array.
       
  1889 
       
  1890 @panic E32USER-CBase 21, if anIndex is negative or greater than or equal to
       
  1891        number of objects currently within the array.
       
  1892 */
       
  1893 	{return(*((T *)CArrayPakBase::At(anIndex)));}
       
  1894 
       
  1895 
       
  1896 
       
  1897 
       
  1898 template <class T>
       
  1899 inline const T &CArrayPak<T>::At(TInt anIndex) const
       
  1900 /**
       
  1901 Gets a reference to the element located at the specified position within the 
       
  1902 array.
       
  1903 
       
  1904 The compiler uses this variant of the function when the returned reference 
       
  1905 is used in an expression where it cannot be modified.
       
  1906 
       
  1907 @param anIndex The position of the element within the array. The position 
       
  1908                is relative to zero; i.e. zero implies the first element in
       
  1909 			   the array.  
       
  1910 		
       
  1911 @return A const reference to the element located at position anIndex within 
       
  1912         the array.
       
  1913 
       
  1914 @panic E32USER-CBase 21, if anIndex is negative or greater than or equal to
       
  1915        number of objects currently within the array.
       
  1916 */
       
  1917 	{return(*((const T *)CArrayPakBase::At(anIndex)));}
       
  1918 
       
  1919 
       
  1920 
       
  1921 
       
  1922 template <class T>
       
  1923 inline T &CArrayPak<T>::At(TInt anIndex)
       
  1924 /**
       
  1925 Gets a reference to the element located at the specified position within the 
       
  1926 array.
       
  1927 
       
  1928 The compiler uses this variant of the function when the returned reference 
       
  1929 is used in an expression where it can be modified.
       
  1930 
       
  1931 @param anIndex The position of the element within the array. The position 
       
  1932                is relative to zero; i.e. zero implies the first element in
       
  1933 			   the array.  
       
  1934 		
       
  1935 @return A non-const reference to the element located at position anIndex within 
       
  1936         the array.
       
  1937 
       
  1938 @panic E32USER-CBase 21, if anIndex is negative or greater than or equal to
       
  1939        number of objects currently within the array.
       
  1940 */
       
  1941 	{return(*((T *)CArrayPakBase::At(anIndex)));}
       
  1942 
       
  1943 
       
  1944 
       
  1945 
       
  1946 template <class T>
       
  1947 inline void CArrayPak<T>::AppendL(const T &aRef,TInt aLength)
       
  1948 /**
       
  1949 Appends an element of a specified length onto the array.
       
  1950 
       
  1951 @param aRef    A reference to the class T element to be appended.
       
  1952 @param aLength The length of the element to be appended.
       
  1953 
       
  1954 @leave KErrNoMemory The function attempted to allocate from the heap and there 
       
  1955        is insufficient memory available. In this case, the array is left in
       
  1956 	   the state it was in before the call.
       
  1957 
       
  1958 @panic E32USER-CBase 30, if aLength is negative.
       
  1959 */
       
  1960 	{CArrayPakBase::InsertL(Count(),&aRef,aLength);}
       
  1961 
       
  1962 
       
  1963 
       
  1964 
       
  1965 template <class T>
       
  1966 inline T &CArrayPak<T>::ExpandL(TInt anIndex,TInt aLength)
       
  1967 /**
       
  1968 Expands the array by one element of specified length at the specified position. 
       
  1969 
       
  1970 It:
       
  1971 
       
  1972 1. expands the array by one element at the specified position.
       
  1973 
       
  1974 2. constructs a new element of specified length at that position.
       
  1975 
       
  1976 3. returns a reference to the new element.
       
  1977 
       
  1978 All existing elements from position anIndex to the end of the array are moved 
       
  1979 up, so that the element originally at position anIndex is now at position 
       
  1980 anIndex + 1 etc.
       
  1981 
       
  1982 The new element of type <class T> and length aLength is constructed at position 
       
  1983 anIndex, using the default constructor of that class.
       
  1984 
       
  1985 @param anIndex The position within the array where the array is to be expanded 
       
  1986                and the new <class T> object is to be constructed. 
       
  1987 @param aLength The length of the new element.
       
  1988 
       
  1989 @return A reference to the newly constructed <class T> object at position 
       
  1990         anIndex within the array.
       
  1991 
       
  1992 @leave KErrNoMemory The function attempted to allocate from the heap and there 
       
  1993        is insufficient memory available. In this case, the array is left in the
       
  1994 	   state it was in before the call.
       
  1995 
       
  1996 @panic E32USER-CBase 21, if anIndex is negative or greater than the number of
       
  1997        elements currently in the array.
       
  1998 @panic E32USER-CBase 30, if aLength is negative.
       
  1999 */
       
  2000 	{return(*new(CArrayPakBase::ExpandL(anIndex,aLength)) T);}
       
  2001 
       
  2002 
       
  2003 
       
  2004 
       
  2005 template <class T>
       
  2006 inline T &CArrayPak<T>::ExtendL(TInt aLength)
       
  2007 /**
       
  2008 Expands the array by one element of specified length at the end of the array. 
       
  2009 
       
  2010 It:
       
  2011 
       
  2012 1. expands the array by one element at the end of the array, i.e. at position 
       
  2013    CArrayPakbase::Count().
       
  2014 
       
  2015 2. constructs a new element of length aLength at that position.
       
  2016 
       
  2017 3. returns a reference to the new element.
       
  2018 
       
  2019 The new element of type <class T> is constructed at the end of the array, 
       
  2020 using the default constructor of that class.
       
  2021 
       
  2022 @param aLength The length of the new element.
       
  2023 
       
  2024 @return A reference to the newly constructed <class T> object at the end of 
       
  2025         the array.
       
  2026 
       
  2027 @leave KErrNoMemory The function attempted to allocate from the heap and there 
       
  2028        is insufficient memory available. In this case, the array is left in the
       
  2029 	   state it was in before the call.
       
  2030 
       
  2031 @panic E32USER-CBase 30, if aLength is negative.
       
  2032 */
       
  2033 	{return(*new(CArrayPakBase::ExpandL(Count(),aLength)) T);}
       
  2034 
       
  2035 
       
  2036 
       
  2037 
       
  2038 template <class T>
       
  2039 inline TInt CArrayPak<T>::Find(const T &aRef,TKeyArrayPak &aKey,TInt &anIndex) const
       
  2040 /**
       
  2041 Finds the position of an element within the array, based on the matching of 
       
  2042 keys, using a sequential search.
       
  2043 
       
  2044 The array is searched sequentially for an element whose key matches the key 
       
  2045 of the supplied <class T> object. The search starts with the first element 
       
  2046 in the array.
       
  2047 
       
  2048 Note that where an array has elements with duplicate keys, the function only
       
  2049 supplies the position of the first element in the array with that key.
       
  2050 
       
  2051 @param aRef    A reference to an object of type <class T> whose key is used 
       
  2052                for comparison.
       
  2053 @param aKey    A reference to a key object defining the properties of the key.
       
  2054 @param anIndex A reference to a TInt supplied by the caller. On return, if the
       
  2055                element is found, this is set to the position 
       
  2056                of that element within the array. The position is relative to zero, (i.e. 
       
  2057                the first element in the array is at position 0).
       
  2058 			   If the element is not found or the array is empty, then this is undefined.
       
  2059 
       
  2060 @return Zero, if the element with the specified key is found. Non-zero, if 
       
  2061         the element with the specified key is not found.
       
  2062 */
       
  2063 	{return(CArrayPakBase::Find(&aRef,aKey,anIndex));}
       
  2064 
       
  2065 
       
  2066 
       
  2067 
       
  2068 template <class T>
       
  2069 inline TInt CArrayPak<T>::FindIsq(const T &aRef,TKeyArrayPak &aKey,TInt &anIndex) const
       
  2070 /**
       
  2071 Finds the position of an element within the array, based on the matching of 
       
  2072 keys, using a binary search technique.
       
  2073 
       
  2074 The array is searched, using a binary search technique, for an element whose 
       
  2075 key matches the key of the supplied <class T> object.
       
  2076 
       
  2077 The array must be in key order.
       
  2078 
       
  2079 Note that where an array has elements with duplicate keys, the function cannot
       
  2080 guarantee which element, with the given key value, it will return, except that it
       
  2081 will find one of them.
       
  2082 
       
  2083 @param aRef    A reference to an object of type <class T> whose key is used 
       
  2084                for comparison.
       
  2085 @param aKey    A reference to a key object defining the properties of the key.
       
  2086 @param anIndex A reference to a TInt supplied by the caller. On return, if the
       
  2087                element is found, this is set to the position of that element
       
  2088 			   within the array. The position is relative to zero, (i.e. 
       
  2089                the first element in the array is at position 0).
       
  2090 			   If the element is not found and the array is not empty, then
       
  2091 			   this is set to the position of the first element in the array
       
  2092 			   with a key which is greater than the key of the object aRef.
       
  2093 			   If the element is not found and the array is empty, then this 
       
  2094                is undefined.
       
  2095 
       
  2096 @return Zero, if the element with the specified key is found or the array is 
       
  2097         empty.
       
  2098 		Non-zero, if the element with the specified key is not found.
       
  2099 */
       
  2100 	{return(CArrayPakBase::FindIsq(&aRef,aKey,anIndex));}
       
  2101 
       
  2102 
       
  2103 
       
  2104 
       
  2105 template <class T>
       
  2106 inline void CArrayPak<T>::InsertL(TInt anIndex,const T &aRef,TInt aLength)
       
  2107 /** 
       
  2108 Inserts an element of a specified length into the array at the specified
       
  2109 position.
       
  2110 
       
  2111 @param anIndex The position within the array where the element is to be
       
  2112                inserted. The position is relative to zero, i.e. zero implies
       
  2113 			   that elements are inserted at the beginning of the array.
       
  2114 @param aRef    A reference to the class T object to be inserted into
       
  2115                the array.
       
  2116 @param aLength The length of the element to be inserted into the array.
       
  2117 
       
  2118 @leave KErrNoMemory The function attempted to expand the array buffer and there
       
  2119        is insufficient memory available. In this case, the array is left in the
       
  2120 	   state it was in before the call.
       
  2121 
       
  2122 @panic E32USER-CBase 21, if anIndex is negative or greater than the number of
       
  2123        objects currently in the array.
       
  2124 @panic E32USER-CBase 30, if aLength is negative.
       
  2125 */
       
  2126 	{CArrayPakBase::InsertL(anIndex,&aRef,aLength);}
       
  2127 
       
  2128 
       
  2129 
       
  2130 
       
  2131 template <class T>
       
  2132 inline TInt CArrayPak<T>::InsertIsqL(const T &aRef,TInt aLength,TKeyArrayPak &aKey)
       
  2133 /**
       
  2134 Inserts a single element of a specified length into the array at a position 
       
  2135 determined by a key.
       
  2136 
       
  2137 The array MUST already be in key sequence (as defined by the key), otherwise 
       
  2138 the position of the new element is unpredictable, or duplicates may occur.
       
  2139 
       
  2140 Elements with duplicate keys are not permitted.
       
  2141 
       
  2142 @param aRef    A reference to the element of type <class T> to be inserted into 
       
  2143                the array.
       
  2144 @param aLength The length of the new element of type <class T> to be inserted 
       
  2145                into the array.
       
  2146 @param aKey    A reference to a key object defining the properties of the key.
       
  2147 
       
  2148 @return The position within the array of the newly inserted element.
       
  2149 
       
  2150 @leave KErrAlreadyExists An element with the same key already exists within 
       
  2151        the array. NB the array MUST already be in key sequence, otherwise
       
  2152 	   the function may insert a duplicate and fail to leave with
       
  2153 	   this value.
       
  2154 @leave KErrNoMemory The function attempted to expand the array buffer and there 
       
  2155        is insufficient memory available. In this case, the array is left in the
       
  2156 	   state it was in before the call.
       
  2157 */
       
  2158 	{return(CArrayPakBase::InsertIsqL(&aRef,aLength,aKey));}
       
  2159 
       
  2160 
       
  2161 
       
  2162 
       
  2163 template <class T>
       
  2164 inline TInt CArrayPak<T>::InsertIsqAllowDuplicatesL(const T &aRef,TInt aLength,TKeyArrayPak &aKey)
       
  2165 /**
       
  2166 Inserts a single element of a specified length into the array at a position 
       
  2167 determined by a key, allowing duplicates.
       
  2168 
       
  2169 The array MUST already be in key sequence, otherwise the position of the 
       
  2170 new element is unpredictable.
       
  2171 
       
  2172 Elements with duplicate keys are permitted. If the new element's key is a 
       
  2173 duplicate of an existing element's key, then the new element is positioned 
       
  2174 after the existing element.
       
  2175 
       
  2176 @param aRef    A reference to the element of type <class T> to be inserted into
       
  2177                the array.
       
  2178 @param aLength The length of the new element to be inserted into the array.
       
  2179 @param aKey    A reference to a key object defining the properties of the key.
       
  2180 
       
  2181 @return The position within the array of the newly inserted element. 
       
  2182 
       
  2183 @leave KErrNoMemory The function attempted to expand the array buffer and there 
       
  2184        is insufficient memory available. In this case, the array is left in the
       
  2185 	   state it was in before the call.
       
  2186 */
       
  2187 	{return(CArrayPakBase::InsertIsqAllowDuplicatesL(&aRef,aLength,aKey));}
       
  2188 
       
  2189 
       
  2190 
       
  2191 
       
  2192 template <class T>
       
  2193 inline const TArray<T> CArrayPak<T>::Array() const
       
  2194 /**
       
  2195 Constructs and returns a TArray<T> object.
       
  2196 
       
  2197 @return A Tarray<T> object for this array.
       
  2198 */
       
  2199 	{return(TArray<T>(CountR,AtR,this));}
       
  2200 
       
  2201 
       
  2202 
       
  2203 
       
  2204 inline CArrayPak<TAny>::CArrayPak(TBufRep aRep,TInt aGranularity)
       
  2205 	: CArrayPakBase(aRep,aGranularity)
       
  2206 /**
       
  2207 Constructs a variable array with the specified granularity and
       
  2208 buffer organisation.
       
  2209 	
       
  2210 Note that no memory is allocated to the array buffer by this constructor.
       
  2211 	
       
  2212 @param aRep         A pointer to a function used to expand the array buffer. 
       
  2213                     The organisation of the array buffer is implied by the
       
  2214 					choice of this function.
       
  2215 	                For a flat array buffer, pass (TBufRep)CBufFlat::NewL.
       
  2216 			        For a segmented array buffer, pass (TBufRep)CBufSeg::NewL. 
       
  2217 @param aGranularity The granularity of the array. 
       
  2218 
       
  2219 @panic E32USER-CBase 19, if aGranularity is not positive.
       
  2220 */
       
  2221 	{}
       
  2222 
       
  2223 
       
  2224 
       
  2225 
       
  2226 inline const TAny *CArrayPak<TAny>::At(TInt anIndex) const
       
  2227 /**
       
  2228 Gets a pointer to the untyped element located at the specified position 
       
  2229 within the array.
       
  2230 	
       
  2231 The compiler uses this variant of the function if the returned reference is 
       
  2232 used in an expression where that reference cannot be modified.
       
  2233 	
       
  2234 @param anIndex The position of the element within the array, relative to zero; 
       
  2235                i.e. zero implies the first element.
       
  2236 
       
  2237 @return A pointer to the const element located at position anIndex within 
       
  2238 	    the array.
       
  2239 
       
  2240 @panic E32USER-CBase 21, if anIndex is negative or greater than or equal to
       
  2241        the number of objects currently within the array.
       
  2242 */
       
  2243 	{return(CArrayPakBase::At(anIndex));}
       
  2244 
       
  2245 
       
  2246 
       
  2247 
       
  2248 inline TAny *CArrayPak<TAny>::At(TInt anIndex)
       
  2249 /**
       
  2250 Gets a pointer to the untyped element located at the specified position 
       
  2251 within the array.
       
  2252 	
       
  2253 The compiler uses this variant of the function if the returned reference is 
       
  2254 used in an expression where that reference can be modified.
       
  2255 	
       
  2256 @param anIndex The position of the element within the array, relative to zero; 
       
  2257                i.e. zero implies the first element.
       
  2258 
       
  2259 @return A pointer to the non-const element located at position anIndex within 
       
  2260 	    the array.
       
  2261 
       
  2262 @panic E32USER-CBase 21, if anIndex is negative or greater than or equal to
       
  2263        the number of objects currently within the array.
       
  2264 */
       
  2265 	{return(CArrayPakBase::At(anIndex));}
       
  2266 
       
  2267 
       
  2268 
       
  2269 
       
  2270 inline void CArrayPak<TAny>::AppendL(const TAny *aPtr,TInt aLength)
       
  2271 /**
       
  2272 Appends the untyped element of the specified length onto the end of the array.
       
  2273 	
       
  2274 @param aPtr    A pointer to an untyped element to be appended. 
       
  2275 @param aLength The length of the untyped element. 
       
  2276 
       
  2277 @leave KErrNoMemory The function attempted to expand the array buffer and there 
       
  2278        is insufficient memory available. In this case, the array is left in the
       
  2279 	   state it was in before the call.
       
  2280 */
       
  2281 	{CArrayPakBase::InsertL(Count(),aPtr,aLength);}
       
  2282 
       
  2283 
       
  2284 
       
  2285 
       
  2286 inline TAny *CArrayPak<TAny>::ExtendL(TInt aLength)
       
  2287 /**
       
  2288 Expands the array by one element of the specified length at the end of
       
  2289 the array, and returns a pointer to this new location.
       
  2290 
       
  2291 As elements are untyped, no construction is possible and the content of
       
  2292 the new location remains undefined.
       
  2293 
       
  2294 @param aLength  The length of the new element.
       
  2295 
       
  2296 @return A pointer to the new element location at the end of the array.
       
  2297 
       
  2298 @leave KErrNoMemory The function attempted to expand the array buffer and there
       
  2299        is insufficient memory available. In this case, the array is left in the
       
  2300 	   state it was in before the call.
       
  2301 */
       
  2302 	{return(CArrayPakBase::ExpandL(Count(),aLength));}
       
  2303 
       
  2304 
       
  2305 
       
  2306 
       
  2307 // Template class CArrayPakFlat
       
  2308 template <class T>
       
  2309 inline CArrayPakFlat<T>::CArrayPakFlat(TInt aGranularity)
       
  2310 	: CArrayPak<T>((TBufRep)CBufFlat::NewL,aGranularity)
       
  2311 /**
       
  2312 Constructs a packed flat array with specified granularity.
       
  2313 
       
  2314 Note that no memory is allocated to the array buffer by this  constructor.
       
  2315 
       
  2316 @param aGranularity The granularity of the array.
       
  2317 
       
  2318 @panic E32USER-CBase 20, if aGranularity is not positive.
       
  2319 */
       
  2320 	{}
       
  2321 
       
  2322 
       
  2323 
       
  2324 
       
  2325 // Class CObject
       
  2326 inline TInt CObject::UniqueID() const
       
  2327 /**
       
  2328 Gets this reference counting object's unique ID.
       
  2329 
       
  2330 The unique ID is an integer which is a property of the object container. It 
       
  2331 forms part of the identity of all reference counting objects and is the same 
       
  2332 value for all reference counting objects held within the same object container.
       
  2333 
       
  2334 @return This reference counting object's unique ID.
       
  2335 
       
  2336 @see CObjectCon
       
  2337 */
       
  2338 	{return(iContainer->UniqueID());}
       
  2339 
       
  2340 
       
  2341 
       
  2342 
       
  2343 inline TInt CObject::AccessCount() const
       
  2344 /**
       
  2345 Gets the number of open references to this reference counting object.
       
  2346 
       
  2347 @return The number of open references.
       
  2348 */
       
  2349 	{return(iAccessCount);}
       
  2350 
       
  2351 
       
  2352 
       
  2353 
       
  2354 inline void CObject::Inc()
       
  2355 /**
       
  2356 Adds one to the reference count.
       
  2357 
       
  2358 This function is called by the default implementation of the Open() member 
       
  2359 function of this class.
       
  2360 
       
  2361 @see CObject::Open
       
  2362 */
       
  2363 	{iAccessCount++;}
       
  2364 
       
  2365 
       
  2366 
       
  2367 
       
  2368 inline void CObject::Dec()
       
  2369 /**
       
  2370 Subtracts one from the reference count.
       
  2371 
       
  2372 This function is called by the default implementation of the Close() member 
       
  2373 function of this class.
       
  2374 
       
  2375 @see CObject::Close
       
  2376 */
       
  2377 	{iAccessCount--;}
       
  2378 
       
  2379 
       
  2380 
       
  2381 
       
  2382 inline CObject * CObject::Owner() const
       
  2383 /**
       
  2384 Gets a pointer to the reference counting object which owns this
       
  2385 reference counting object.
       
  2386 
       
  2387 @return A pointer to the owning reference counting object. This is NULL, if 
       
  2388         there is no owner.
       
  2389 */
       
  2390 	{return(iOwner);}
       
  2391 
       
  2392 
       
  2393 
       
  2394 
       
  2395 inline void CObject::SetOwner(CObject *anOwner)
       
  2396 /**
       
  2397 Sets the owner of this reference counting object.
       
  2398 
       
  2399 If this reference counting object already has an owner, then all knowledge 
       
  2400 of that owner is lost.
       
  2401 
       
  2402 @param anOwner A pointer to the reference counting object which is to be the 
       
  2403                new owner of this reference counting object.
       
  2404 */
       
  2405 	{iOwner=anOwner;}
       
  2406 
       
  2407 
       
  2408 
       
  2409 
       
  2410 // class CObjectIx
       
  2411 inline TInt CObjectIx::Count() const
       
  2412 /**
       
  2413 Gets the number greater then the last slot number used to hold valid CObject pointer.
       
  2414 The input argument of CObject* CObjectIx::operator[]() must be less then the number returned by this method.
       
  2415 
       
  2416 @return The number greater then the last used slot.
       
  2417 
       
  2418 @see CObjectIx::ActiveCount
       
  2419 @see CObjectIx::operator[]
       
  2420 */
       
  2421 	{return iHighWaterMark;}
       
  2422 
       
  2423 
       
  2424 
       
  2425 
       
  2426 inline TInt CObjectIx::ActiveCount() const
       
  2427 /**
       
  2428 Gets the current number of reference counting objects held by this
       
  2429 object index.
       
  2430 
       
  2431 @return The current number.
       
  2432 */
       
  2433 	{return iNumEntries;}
       
  2434 
       
  2435 
       
  2436 
       
  2437 // class CObjectCon
       
  2438 inline TInt CObjectCon::UniqueID() const
       
  2439 /**
       
  2440 Gets this object container's unique ID.
       
  2441 
       
  2442 @return The unique ID value.
       
  2443 */
       
  2444 	{return iUniqueID;}
       
  2445 
       
  2446 
       
  2447 
       
  2448 
       
  2449 inline TInt CObjectCon::Count() const
       
  2450 /**
       
  2451 Gets the number of reference counting objects in this object container.
       
  2452 
       
  2453 @return The number of objects.
       
  2454 */
       
  2455 	{return iCount;}
       
  2456 
       
  2457 
       
  2458 
       
  2459 
       
  2460 
       
  2461 // class CCirBufBase
       
  2462 inline TInt CCirBufBase::Count() const
       
  2463 /**
       
  2464 Gets the current number of objects in this circular buffer.
       
  2465 
       
  2466 @return The number of objects in this circular buffer.
       
  2467         This value can never be greater than the maximum capacity.
       
  2468 */
       
  2469 	{return(iCount);}
       
  2470 
       
  2471 
       
  2472 
       
  2473 
       
  2474 inline TInt CCirBufBase::Length() const
       
  2475 /**
       
  2476 Gets the maximum capacity of this circular buffer.
       
  2477 
       
  2478 The capacity is the maximum number of elements that the buffer can hold.
       
  2479 
       
  2480 Use SetLengthL() to change the capacity of the circular buffer.
       
  2481 
       
  2482 @return The maximum capacity of this circular buffer.
       
  2483 
       
  2484 @see CCirBufBase::SetLengthL
       
  2485 */
       
  2486 	{return(iLength);}
       
  2487 
       
  2488 
       
  2489 
       
  2490 
       
  2491 // Template class CCirBuf
       
  2492 template <class T>
       
  2493 inline CCirBuf<T>::CCirBuf()
       
  2494 	: CCirBufBase(sizeof(T))
       
  2495 /**
       
  2496 Default C++ constructor.
       
  2497 
       
  2498 The size of each object in the buffer is fixed and is the length of the class 
       
  2499 passed as the template parameter. 
       
  2500 
       
  2501 @panic E32USER-CBase 72, if the length of the template class is zero.
       
  2502 */
       
  2503 	{}
       
  2504 
       
  2505 
       
  2506 
       
  2507 
       
  2508 template <class T>
       
  2509 inline TInt CCirBuf<T>::Add(const T *aPtr)
       
  2510 /**
       
  2511 Adds a single object to the circular buffer.
       
  2512 
       
  2513 The object is of type class T and is only added if there is space available.
       
  2514 
       
  2515 @param aPtr A pointer to the object of type class T to be added to the circular 
       
  2516             buffer.
       
  2517 
       
  2518 @return 1 if the object is successfully added. 0 if the object cannot be added 
       
  2519         because the circular buffer is full.
       
  2520 
       
  2521 @panic E32USER-CBase 74, if a call to CCirBufBase::SetLengthL() has not been
       
  2522                          made before calling this function.
       
  2523 
       
  2524 @see CCirBufBase::SetLengthL
       
  2525 */
       
  2526 	{return(DoAdd((const TUint8 *)aPtr));}
       
  2527 
       
  2528 
       
  2529 
       
  2530 
       
  2531 template <class T>
       
  2532 inline TInt CCirBuf<T>::Add(const T *aPtr,TInt aCount)
       
  2533 /**
       
  2534 Adds multiple objects to the circular buffer.
       
  2535 
       
  2536 The function attempts to add aCount objects of type class T. The objects are
       
  2537 only added if there is space available.
       
  2538 
       
  2539 @param aPtr   A pointer to a set of contiguous objects of type class T to be 
       
  2540               added to the circular buffer.
       
  2541 
       
  2542 @param aCount The number of objects to be added to the circular buffer.
       
  2543 
       
  2544 @return The number of objects successfully added to the buffer. This value 
       
  2545         may be less than the number requested and can range from 0 to aCount. 
       
  2546 
       
  2547 @panic E32USER-CBase 74, if a call to CCirBufBase::SetLengthL() has not been
       
  2548                          made before calling this function.
       
  2549 @panic E32USER-CBase 75, if aCount is not a positive value. 
       
  2550 
       
  2551 @see CCirBufBase::SetLengthL
       
  2552 */
       
  2553 	{return(DoAdd((const TUint8 *)aPtr,aCount));}
       
  2554 
       
  2555 
       
  2556 
       
  2557 
       
  2558 template <class T>
       
  2559 inline TInt CCirBuf<T>::Remove(T *aPtr)
       
  2560 /**
       
  2561 Removes a single object from the circular buffer.
       
  2562 
       
  2563 An object can only be removed if there are objects in the buffer.
       
  2564 
       
  2565 A binary copy of the object is made to aPtr.
       
  2566 
       
  2567 @param aPtr A pointer to an object of type class T supplied by the caller.
       
  2568 
       
  2569 @return 1 if an object is successfully removed. 0 if an object cannot be removed 
       
  2570         because the circular buffer is empty.
       
  2571 */
       
  2572 	{return(DoRemove((TUint8 *)aPtr));}
       
  2573 
       
  2574 
       
  2575 
       
  2576 
       
  2577 template <class T>
       
  2578 inline TInt CCirBuf<T>::Remove(T *aPtr,TInt aCount)
       
  2579 /**
       
  2580 Removes multiple objects from the circular buffer.
       
  2581 
       
  2582 The function attempts to remove aCount objects of type class T.
       
  2583 Objects can only be removed if there are objects in the buffer
       
  2584 
       
  2585 A binary copy of the objects is made to aPtr.
       
  2586 
       
  2587 @param aPtr   A pointer to contiguous memory able to hold aCount class T objects, 
       
  2588               supplied by the caller. 
       
  2589 
       
  2590 @param aCount The number of objects to be removed from the circular buffer.
       
  2591 
       
  2592 @return The number of objects successfully removed from the buffer. This value
       
  2593         may be less than the number requested, and can range from 0 to aCount.
       
  2594 
       
  2595 @panic E32USER-CBase 76, if aCount is not a positive value.
       
  2596 */
       
  2597 	{return(DoRemove((TUint8 *)aPtr,aCount));}
       
  2598 
       
  2599 
       
  2600 
       
  2601 
       
  2602 // Class CActive
       
  2603 inline TBool CActive::IsActive() const
       
  2604 /**
       
  2605 Determines whether the active object has a request outstanding.
       
  2606 
       
  2607 A request is outstanding when:
       
  2608 
       
  2609 1. it has been issued
       
  2610 
       
  2611 2. it has not been cancelled
       
  2612 
       
  2613 3. it servicing has not yet begun.
       
  2614 
       
  2615 @return True, if a request is outstanding; false, otherwise.
       
  2616 */
       
  2617 	{return(iStatus.iFlags&TRequestStatus::EActive);}
       
  2618 
       
  2619 
       
  2620 
       
  2621 
       
  2622 inline TBool CActive::IsAdded() const
       
  2623 /**
       
  2624 Determines whether the active object has been added to the active scheduler's 
       
  2625 list of active objects.
       
  2626 
       
  2627 If the active object has not been added to a scheduler, it cannot handle the 
       
  2628 completion of any request. No request should be issued until the active object 
       
  2629 has been added to a scheduler because completion of that request generates 
       
  2630 what appears to be a stray signal.
       
  2631 
       
  2632 Use the active object function Deque() to remove the active object from the 
       
  2633 scheduler.
       
  2634 
       
  2635 @return True, if the active object has been added to an active scheduler; 
       
  2636         false, otherwise. 
       
  2637 
       
  2638 @see CActive::Deque
       
  2639 */
       
  2640 	{return(iLink.iNext!=NULL);}
       
  2641 
       
  2642 
       
  2643 
       
  2644 
       
  2645 inline TInt CActive::Priority() const
       
  2646 /**
       
  2647 Gets the priority of the active object.
       
  2648 
       
  2649 @return The active object's priority value.
       
  2650 */
       
  2651 	{return iLink.iPriority;}
       
  2652 
       
  2653 
       
  2654 
       
  2655 
       
  2656 // class CDeltaTimer
       
  2657 inline TDeltaTimerEntry::TDeltaTimerEntry(const TCallBack& aCallback)
       
  2658 /**
       
  2659 Constructor specifying a general callback.
       
  2660 
       
  2661 @param aCallback The callback to be called when this timed event entry expires.
       
  2662 */
       
  2663 	{iCallBack=aCallback;}
       
  2664 
       
  2665 
       
  2666 
       
  2667 
       
  2668 inline TDeltaTimerEntry::TDeltaTimerEntry()
       
  2669 /**
       
  2670 Default constructor.
       
  2671 */
       
  2672 	{}
       
  2673 
       
  2674 
       
  2675 
       
  2676 
       
  2677 inline void TDeltaTimerEntry::Set(TCallBack& aCallback)
       
  2678 /**
       
  2679 Sets the specified callback.
       
  2680 
       
  2681 @param aCallback The callback to be called when this timed event entry expires.
       
  2682 */
       
  2683 	{iCallBack=aCallback;}
       
  2684 
       
  2685 
       
  2686 
       
  2687 
       
  2688 /**
       
  2689 Gets a reference to the server's current message.
       
  2690 
       
  2691 @return The current message that contains the client request details.
       
  2692 */
       
  2693 inline const RMessage2 &CServer2::Message() const
       
  2694 	{return iMessage;}
       
  2695 
       
  2696 
       
  2697 
       
  2698 	
       
  2699 /**
       
  2700 Gets the server active object that handles messages for this session.
       
  2701 
       
  2702 This is the instance of the CServer2 derived class that created
       
  2703 this session object.
       
  2704 
       
  2705 @return The server active object.
       
  2706 */
       
  2707 inline const CServer2 *CSession2::Server() const
       
  2708 	{return iServer;}
       
  2709 
       
  2710 
       
  2711 
       
  2712 
       
  2713 // Class CAsyncOneShot
       
  2714 inline RThread& CAsyncOneShot::Thread()
       
  2715 /**
       
  2716 Gets a handle to the current thread.
       
  2717 
       
  2718 @return The handle to the current thread.
       
  2719 */
       
  2720 	{ return iThread; }
       
  2721 
       
  2722 
       
  2723 
       
  2724 
       
  2725 // Class CActiveScheduler
       
  2726 inline TInt CActiveScheduler::Level() const
       
  2727 /**
       
  2728 @deprecated Use the StackDepth() function instead.
       
  2729 
       
  2730 Gets the scheduler's level of nestedness.
       
  2731 
       
  2732 @return The level of nestedness.
       
  2733 
       
  2734 @see StackDepth()
       
  2735 */
       
  2736 	{return StackDepth();}
       
  2737 
       
  2738 
       
  2739 
       
  2740 
       
  2741 // Class CActiveSchedulerWait
       
  2742 inline TBool CActiveSchedulerWait::IsStarted() const
       
  2743 /**
       
  2744 Reports whether this CActiveSchedulerWait object is currently started.
       
  2745 
       
  2746 Note: a CActiveSchedulerWait object itself becomes "stopped" as
       
  2747 soon as AsyncStop() is called, and can be started again immediately if
       
  2748 required (but this would start a new nested level of the scheduler).
       
  2749 
       
  2750 @return True if the scheduling loop is active; false, otherwise.
       
  2751 
       
  2752 @see CActiveSchedulerWait::Start
       
  2753 @see CActiveSchedulerWait::AsyncStop
       
  2754 */
       
  2755 	{return iLoop != NULL;}
       
  2756 
       
  2757 
       
  2758 
       
  2759 
       
  2760 // Class CleanupStack
       
  2761 #ifdef _DEBUG
       
  2762 inline void CleanupStack::Pop(TAny* aExpectedItem)
       
  2763 /**
       
  2764 Pops an object from the top of the cleanup stack.
       
  2765 
       
  2766 The function has two modes of operation, depending on whether it is part of 
       
  2767 a debug build or a release build.
       
  2768 
       
  2769 1. In a debug build, the function checks that the specified item is at the top 
       
  2770    of the cleanup stack before attempting to pop it; an E32USER-CBase 90 panic 
       
  2771    is raised if the check fails.
       
  2772 
       
  2773 2  In a release build, the function just pops the object which is at the top 
       
  2774    of the cleanup stack; no checking is done.
       
  2775 
       
  2776 @param aExpectedItem A pointer to the item expected to be at the top of the 
       
  2777                      cleanup stack. In a release build, this parameter
       
  2778 					 is not used.
       
  2779 */
       
  2780 	{ CleanupStack::Check(aExpectedItem); CleanupStack::Pop(); }
       
  2781 
       
  2782 
       
  2783 
       
  2784 
       
  2785 inline void CleanupStack::Pop(TInt aCount, TAny* aLastExpectedItem)
       
  2786 /**
       
  2787 Pops the specified number of objects from the top of the cleanup stack.
       
  2788 
       
  2789 The function has two modes of operation, depending on whether it is part of 
       
  2790 a debug build or a release build.
       
  2791 
       
  2792 1. In a debug build, the function pops (aCount-1) items from the cleanup stack, 
       
  2793    and then checks that the specified item is the next one on the cleanup stack 
       
  2794    before attempting to pop it; an E32USER-CBase 90 panic is raised if the
       
  2795    check fails.
       
  2796 
       
  2797 2. In a release build, the function just pops aCount items from the cleanup stack; 
       
  2798    no checking is done.
       
  2799 
       
  2800 @param aCount            The number of items top be popped from
       
  2801                          the cleanup stack.
       
  2802 @param aLastExpectedItem A pointer to the item expected to be at the top of 
       
  2803                          the cleanup stack, after (aCount-1) items have been
       
  2804 						 popped. In a release build, this parameter is
       
  2805 						 not used.
       
  2806 */
       
  2807 	{
       
  2808 	if (--aCount)
       
  2809 		CleanupStack::Pop(aCount);
       
  2810 	CleanupStack::Check(aLastExpectedItem);
       
  2811 	CleanupStack::Pop();
       
  2812 	}
       
  2813 
       
  2814 
       
  2815 
       
  2816 
       
  2817 inline void CleanupStack::PopAndDestroy(TAny* aExpectedItem)
       
  2818 /**
       
  2819 Pops an object from the top of the cleanup stack, and cleans it up.
       
  2820 
       
  2821 The function has two modes of operation, depending on whether it is part of 
       
  2822 a debug build or a release build.
       
  2823 
       
  2824 1. In a debug build, the function checks that the specified item is at the top 
       
  2825    of the cleanup stack before attempting to pop and clean it up;
       
  2826    an E32USER-CBase 90 panic is raised if the check fails.
       
  2827 
       
  2828 2. In a release build, the function just pops and cleans up the object at 
       
  2829    the top of the cleanup stack; no checking is done.
       
  2830 
       
  2831 @param aExpectedItem A pointer to the item expected to be at the top of the 
       
  2832                      cleanup stack. In a release build, this parameter is
       
  2833 					 not used.
       
  2834 */
       
  2835 	{ CleanupStack::Check(aExpectedItem); CleanupStack::PopAndDestroy(); }
       
  2836 
       
  2837 
       
  2838 
       
  2839 
       
  2840 inline void CleanupStack::PopAndDestroy(TInt aCount, TAny* aLastExpectedItem)
       
  2841 /**
       
  2842 Pops the specified number of objects from the top of the cleanup stack, and 
       
  2843 cleans them up.
       
  2844 
       
  2845 The function has two modes of operation, depending on whether it is part of 
       
  2846 a debug build or a release build.
       
  2847 
       
  2848 1. In a debug build, the function pops and cleans up (aCount-1) items from the 
       
  2849    cleanup stack, and then checks that the specified item is the next one on 
       
  2850    the cleanup stack before attempting to pop it and clean it up;
       
  2851    an E32USER-CBase  90 panic is raised if the check fails.
       
  2852 
       
  2853 2. In a release build, the function just pops and cleans up aCount items from 
       
  2854    the cleanup stack; no checking is done.
       
  2855 
       
  2856 @param aCount            The number of items top be popped from the
       
  2857                          cleanup stack, and cleaned up.
       
  2858 @param aLastExpectedItem A pointer to the item expected to be at the top of 
       
  2859                          the cleanup stack, after (aCount-1) items have been
       
  2860 						 popped and cleaned up. In a release build, this 
       
  2861 						 parameter is not used.
       
  2862 */
       
  2863 	{
       
  2864 	if (--aCount)
       
  2865 		CleanupStack::PopAndDestroy(aCount);
       
  2866 	CleanupStack::Check(aLastExpectedItem);
       
  2867 	CleanupStack::PopAndDestroy();
       
  2868 	}
       
  2869 #else
       
  2870 inline void CleanupStack::Pop(TAny*)
       
  2871 /**
       
  2872 Pops an object from the top of the cleanup stack.
       
  2873 
       
  2874 The function has two modes of operation, depending on whether it is part of 
       
  2875 a debug build or a release build.
       
  2876 
       
  2877 1. In a debug build, the function checks that the specified item is at the top 
       
  2878    of the cleanup stack before attempting to pop it; an E32USER-CBase 90 panic 
       
  2879    is raised if the check fails.
       
  2880 
       
  2881 2  In a release build, the function just pops the object which is at the top 
       
  2882    of the cleanup stack; no checking is done.
       
  2883 
       
  2884 @param aExpectedItem A pointer to the item expected to be at the top of the 
       
  2885                      cleanup stack. In a release build, this parameter
       
  2886 					 is not used.
       
  2887 */
       
  2888 	{ CleanupStack::Pop(); }
       
  2889 
       
  2890 
       
  2891 
       
  2892 
       
  2893 inline void CleanupStack::Pop(TInt aCount, TAny*)
       
  2894 /**
       
  2895 Pops the specified number of objects from the top of the cleanup stack.
       
  2896 
       
  2897 The function has two modes of operation, depending on whether it is part of 
       
  2898 a debug build or a release build.
       
  2899 
       
  2900 1. In a debug build, the function pops (aCount-1) items from the cleanup stack, 
       
  2901    and then checks that the specified item is the next one on the cleanup stack 
       
  2902    before attempting to pop it; an E32USER-CBase 90 panic is raised if the
       
  2903    check fails.
       
  2904 
       
  2905 2. In a release build, the function just pops aCount items from the cleanup stack; 
       
  2906    no checking is done.
       
  2907 
       
  2908 @param aCount            The number of items top be popped from
       
  2909                          the cleanup stack.
       
  2910 @param aLastExpectedItem A pointer to the item expected to be at the top of 
       
  2911                          the cleanup stack, after (aCount-1) items have been
       
  2912 						 popped. In a release build, this parameter is
       
  2913 						 not used.
       
  2914 */
       
  2915 	{ CleanupStack::Pop(aCount); }
       
  2916 
       
  2917 
       
  2918 
       
  2919 
       
  2920 inline void CleanupStack::PopAndDestroy(TAny*)
       
  2921 /**
       
  2922 Pops an object from the top of the cleanup stack, and cleans it up.
       
  2923 
       
  2924 The function has two modes of operation, depending on whether it is part of 
       
  2925 a debug build or a release build.
       
  2926 
       
  2927 1. In a debug build, the function checks that the specified item is at the top 
       
  2928    of the cleanup stack before attempting to pop and clean it up;
       
  2929    an E32USER-CBase 90 panic is raised if the check fails.
       
  2930 
       
  2931 2. In a release build, the function just pops and cleans up the object at 
       
  2932    the top of the cleanup stack; no checking is done.
       
  2933 
       
  2934 @param aExpectedItem A pointer to the item expected to be at the top of the 
       
  2935                      cleanup stack. In a release build, this parameter is
       
  2936 					 not used.
       
  2937 */
       
  2938 	{ CleanupStack::PopAndDestroy(); }
       
  2939 
       
  2940 
       
  2941 
       
  2942 
       
  2943 inline void CleanupStack::PopAndDestroy(TInt aCount, TAny*)
       
  2944 /**
       
  2945 Pops the specified number of objects from the top of the cleanup stack, and 
       
  2946 cleans them up.
       
  2947 
       
  2948 The function has two modes of operation, depending on whether it is part of 
       
  2949 a debug build or a release build.
       
  2950 
       
  2951 1. In a debug build, the function pops and cleans up (aCount-1) items from the 
       
  2952    cleanup stack, and then checks that the specified item is the next one on 
       
  2953    the cleanup stack before attempting to pop it and clean it up;
       
  2954    an E32USER-CBase  90 panic is raised if the check fails.
       
  2955 
       
  2956 2. In a release build, the function just pops and cleans up aCount items from 
       
  2957    the cleanup stack; no checking is done.
       
  2958 
       
  2959 @param aCount            The number of items top be popped from the
       
  2960                          cleanup stack, and cleaned up.
       
  2961 @param aLastExpectedItem A pointer to the item expected to be at the top of 
       
  2962                          the cleanup stack, after (aCount-1) items have been
       
  2963 						 popped and cleaned up. In a release build, this 
       
  2964 						 parameter is not used.
       
  2965 */
       
  2966 	{ CleanupStack::PopAndDestroy(aCount); }
       
  2967 #endif
       
  2968 
       
  2969 
       
  2970 
       
  2971 
       
  2972 // Class TCleanupItem
       
  2973 inline TCleanupItem::TCleanupItem(TCleanupOperation anOperation)
       
  2974 	: iOperation(anOperation)
       
  2975 /**
       
  2976 Constructs the object with a cleanup operation.
       
  2977 
       
  2978 @param anOperation  A cleanup operation which will be invoked by the pop and
       
  2979                     destroy action resulting from a subsequent call to
       
  2980 					CleanupStack::PopAndDestroy().
       
  2981 */
       
  2982 	{}
       
  2983 
       
  2984 
       
  2985 
       
  2986 
       
  2987 inline TCleanupItem::TCleanupItem(TCleanupOperation anOperation,TAny *aPtr)
       
  2988 	: iOperation(anOperation), iPtr(aPtr)
       
  2989 /**
       
  2990 Constructs the object with a cleanup operation and a pointer to the object
       
  2991 to be cleaned up.
       
  2992 
       
  2993 @param anOperation A cleanup operation which will be invoked by the pop
       
  2994                    and destroy action resulting from a subsequent call to
       
  2995 				   CleanupStack::PopAndDestroy().
       
  2996 
       
  2997 @param aPtr        A pointer to an object which is the target of the
       
  2998                    cleanup operation.
       
  2999 */
       
  3000 	{}
       
  3001 
       
  3002 
       
  3003 
       
  3004 
       
  3005 // Class TCleanupTrapHandler
       
  3006 inline CCleanup &TCleanupTrapHandler::Cleanup()
       
  3007 	{return(*iCleanup);}
       
  3008 
       
  3009 // Class TAutoClose
       
  3010 template <class T>
       
  3011 inline TAutoClose<T>::~TAutoClose()
       
  3012 /**
       
  3013 Destructor.
       
  3014 
       
  3015 The implementation calls Close() on iObj, the instance of the template class.
       
  3016 */
       
  3017 #ifdef __LEAVE_EQUALS_THROW__
       
  3018 	{if (!std::uncaught_exception()) iObj.Close();}
       
  3019 #else
       
  3020 	{iObj.Close();}
       
  3021 #endif
       
  3022 
       
  3023 
       
  3024 
       
  3025 
       
  3026 template <class T>
       
  3027 inline void TAutoClose<T>::PushL()
       
  3028 /**
       
  3029 Pushes a cleanup item onto the cleanup stack, so that Close() is called on the 
       
  3030 templated class object, iObj, if a leave occurs.
       
  3031 */
       
  3032 	{CleanupStack::PushL(TCleanupItem(Close, (TAny *)&iObj));}
       
  3033 
       
  3034 
       
  3035 
       
  3036 
       
  3037 template <class T>
       
  3038 inline void TAutoClose<T>::Pop()
       
  3039 /**
       
  3040 Pops a single cleanup item from the cleanup stack.
       
  3041 */
       
  3042 	{CleanupStack::Pop();}
       
  3043 
       
  3044 
       
  3045 
       
  3046 
       
  3047 template <class T>
       
  3048 void TAutoClose<T>::Close(TAny *aObj)
       
  3049 	{((T *)aObj)->Close();}
       
  3050 
       
  3051 
       
  3052 
       
  3053 
       
  3054 // Template class CleanupDelete
       
  3055 template <class T>
       
  3056 inline void CleanupDelete<T>::PushL(T* aPtr)
       
  3057 /**
       
  3058 Creates a TCleanupItem for the specified object.
       
  3059 
       
  3060 The cleanup operation is the private static function Delete() of this class, which
       
  3061 deletes the specified object.
       
  3062 
       
  3063 @param aPtr The object for which a TCleanupItem is to be constructed.
       
  3064 */
       
  3065 	{CleanupStack::PushL(TCleanupItem(&Delete,aPtr));}
       
  3066 
       
  3067 
       
  3068 
       
  3069 
       
  3070 template <class T>
       
  3071 void CleanupDelete<T>::Delete(TAny *aPtr)
       
  3072 /**
       
  3073 The cleanup operation to be performed.
       
  3074 
       
  3075 @param aPtr A pointer to the object for which clean up is to be performed. 
       
  3076             The implementation deletes this object.
       
  3077 */
       
  3078 	{delete STATIC_CAST(T*,aPtr);}
       
  3079 
       
  3080 
       
  3081 
       
  3082 
       
  3083 // See header file e32base.h for in-source comment.
       
  3084 template <class T>
       
  3085 inline void CleanupDeletePushL(T* aPtr)
       
  3086 	{CleanupDelete<T>::PushL(aPtr);}
       
  3087 
       
  3088 
       
  3089 
       
  3090 
       
  3091 // Template class CleanupArrayDelete
       
  3092 template <class T>
       
  3093 inline void CleanupArrayDelete<T>::PushL(T* aPtr)
       
  3094 /**
       
  3095 Creates a TCleanupItem for the specified array.
       
  3096 
       
  3097 The cleanup operation is the private static function ArrayDelete() of
       
  3098 this class, which deletes the specified array.
       
  3099 
       
  3100 @param aPtr The array of class T type objects for which a TCleanupItem is
       
  3101             to be constructed.
       
  3102 */
       
  3103 	{CleanupStack::PushL(TCleanupItem(&ArrayDelete,aPtr));}
       
  3104 
       
  3105 
       
  3106 
       
  3107 
       
  3108 template <class T>
       
  3109 void CleanupArrayDelete<T>::ArrayDelete(TAny *aPtr)
       
  3110 /**
       
  3111 The cleanup operation to be performed.
       
  3112 
       
  3113 @param aPtr A pointer to the array for which clean up is to be performed. 
       
  3114             The implementation deletes this array.
       
  3115 */
       
  3116 	{delete [] STATIC_CAST(T*,aPtr);}
       
  3117 
       
  3118 
       
  3119 
       
  3120 
       
  3121 // See header file e32base.h for in-source comment.
       
  3122 template <class T>
       
  3123 inline void CleanupArrayDeletePushL(T* aPtr)
       
  3124 	{CleanupArrayDelete<T>::PushL(aPtr);}
       
  3125 
       
  3126 
       
  3127 
       
  3128 
       
  3129 // Template class CleanupClose
       
  3130 template <class T>
       
  3131 inline void CleanupClose<T>::PushL(T& aRef)
       
  3132 /**
       
  3133 Creates a TCleanupItem for the specified object.
       
  3134 
       
  3135 The cleanup operation is the private static function Close() of this class.
       
  3136 
       
  3137 @param aRef The object for which a TCleanupItem is to be constructed.
       
  3138 */
       
  3139 	{CleanupStack::PushL(TCleanupItem(&Close,&aRef));}
       
  3140 
       
  3141 
       
  3142 
       
  3143 
       
  3144 template <class T>
       
  3145 void CleanupClose<T>::Close(TAny *aPtr)
       
  3146 /**
       
  3147 The cleanup operation to be performed.
       
  3148 
       
  3149 @param aPtr A pointer to the object for which clean up is to be performed. 
       
  3150             The implementation calls Close() on this object.
       
  3151 */
       
  3152 	{(STATIC_CAST(T*,aPtr))->Close();}
       
  3153 
       
  3154 
       
  3155 
       
  3156 
       
  3157 // See header file e32base.h for in-source comment.
       
  3158 template <class T>
       
  3159 inline void CleanupClosePushL(T& aRef)
       
  3160 	{CleanupClose<T>::PushL(aRef);}
       
  3161 
       
  3162 
       
  3163 
       
  3164 
       
  3165 // Template class CleanupRelease
       
  3166 template <class T>
       
  3167 inline void CleanupRelease<T>::PushL(T& aRef)
       
  3168 /**
       
  3169 Creates a TCleanupItem for the specified object.
       
  3170 
       
  3171 The cleanup operation is the private static function Release() of this class.
       
  3172 
       
  3173 @param aRef The object for which a TCleanupItem is to be constructed.
       
  3174 */
       
  3175 	{CleanupStack::PushL(TCleanupItem(&Release,&aRef));}
       
  3176 
       
  3177 
       
  3178 
       
  3179 
       
  3180 template <class T>
       
  3181 void CleanupRelease<T>::Release(TAny *aPtr)
       
  3182 /**
       
  3183 The cleanup operation to be performed.
       
  3184 
       
  3185 @param aPtr A pointer to the object for which clean up is to be performed. 
       
  3186             The implementation calls Release() on this object.
       
  3187 */
       
  3188 	{(STATIC_CAST(T*,aPtr))->Release();}
       
  3189 
       
  3190 
       
  3191 
       
  3192 
       
  3193 // See header file e32base.h for in-source comment.
       
  3194 template <class T>
       
  3195 inline void CleanupReleasePushL(T& aRef)
       
  3196 	{CleanupRelease<T>::PushL(aRef);}
       
  3197 
       
  3198 
       
  3199