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