Original Symbian headers
Selected EUSER, Window Server, networking, graphics and device declarations
Loading...
Searching...
No Matches
CArrayPak< TAny > Class Reference

A template specialisation base class for variable length, packed, arrays. More...

#include <e32base.h>

Inheritance diagram for CArrayPak< TAny >:
CArrayPakBase CBase

Public Member Functions

 CArrayPak (TBufRep aRep, TInt aGranularity)
 Constructs a variable array with the specified granularity and buffer organisation.
 
const TAny * At (TInt anIndex) const
 Gets a pointer to the untyped element located at the specified position within the array.
 
TAny * At (TInt anIndex)
 Gets a pointer to the untyped element located at the specified position within the array.
 
void AppendL (const TAny *aPtr, TInt aLength)
 Appends the untyped element of the specified length onto the end of the array.
 
TAny * ExtendL (TInt aLength)
 Expands the array by one element of the specified length at the end of the array, and returns a pointer to this new location.
 
- Public Member Functions inherited from CArrayPakBase
IMPORT_C ~CArrayPakBase ()
 Destructor.
 
TInt Count () const
 Gets the number of elements held in the array.
 
IMPORT_C TInt Length (TInt anIndex) const
 Gets the length of the specified element.
 
IMPORT_C void Compress ()
 Removes excess space from the array buffer.
 
IMPORT_C void Reset ()
 Deletes all elements from the array and frees the memory allocated to the array buffer.
 
IMPORT_C void SortL (TKeyArrayVar &aKey)
 Sorts the elements of the array into key sequence.
 
IMPORT_C TAny * At (TInt anIndex) const
 TAny points to the data associated with the record with anIndex.
 
IMPORT_C void Delete (TInt anIndex)
 Removes a single element from the array.
 
IMPORT_C void Delete (TInt anIndex, TInt aCount)
 Removes one or more contiguous elements from the array, starting at a specific position.
 
IMPORT_C TAny * ExpandL (TInt anIndex, TInt aLength)
 Expand the array at anIndex.
 
IMPORT_C TInt Find (const TAny *aPtr, TKeyArrayPak &aKey, TInt &anIndex) const
 Find using a sequential search.
 
IMPORT_C TInt FindIsq (const TAny *aPtr, TKeyArrayPak &aKey, TInt &anIndex) const
 Find using a binary search.
 
IMPORT_C void InsertL (TInt anIndex, const TAny *aPtr, TInt aLength)
 Inserts a record at index anIndex.
 
IMPORT_C TInt InsertIsqL (const TAny *aPtr, TInt aLength, TKeyArrayPak &aKey)
 Insert in sequence, no duplicates allowed.
 
IMPORT_C TInt InsertIsqAllowDuplicatesL (const TAny *aPtr, TInt aLength, TKeyArrayPak &aKey)
 Insert in sequence, allow duplicates.
 
- Public Member Functions inherited from CBase
 CBase ()
 Default constructor.
 
virtual IMPORT_C ~CBase ()
 Virtual destructor.
 
TAny * operator new (TUint aSize, TAny *aBase) __NO_THROW
 Initialises the object to binary zeroes.
 
TAny * operator new (TUint aSize) __NO_THROW
 Allocates the object from the heap and then initialises its contents to binary zeroes.
 
TAny * operator new (TUint aSize, TLeave)
 Allocates the object from the heap and then initialises its contents to binary zeroes.
 
TAny * operator new (TUint aSize, TUint aExtraSize) __NO_THROW
 Allocates the object from the heap and then initialises its contents to binary zeroes.
 
TAny * operator new (TUint aSize, TLeave, TUint aExtraSize)
 Allocates the object from the heap and then initialises its contents to binary zeroes.
 

Additional Inherited Members

- Static Public Member Functions inherited from CBase
static IMPORT_C void Delete (CBase *aPtr)
 Deletes the specified object.
 
- Protected Member Functions inherited from CArrayPakBase
IMPORT_C CArrayPakBase (TBufRep aRep, TInt aGranularity)
 Constructor.
 
IMPORT_C void SetKey (TKeyArrayPak &aKey) const
 Set the key data.
 
IMPORT_C TInt GetOffset (TInt anIndex) const
 Return the offset into the buffer of the record with index anIndex;.
 
IMPORT_C void BuildVarArrayL (CArrayVarFlat< TAny > *&aVarFlat)
 Make a copy of the current array as a CArrayVarFlat.
 
- Protected Member Functions inherited from CBase
virtual IMPORT_C TInt Extension_ (TUint aExtensionId, TAny *&a0, TAny *a1)
 Extension function.
 
- Static Protected Member Functions inherited from CArrayPakBase
static IMPORT_C TInt CountR (const CBase *aPtr)
 Return the number of items in the array.
 
static IMPORT_C const TAny * AtR (const CBase *aPtr, TInt anIndex)
 Return the address of an item in the array.
 

Detailed Description

A template specialisation base class for variable length, packed, arrays.

The array buffer organisation is defined at construction.

The class is useful for constructing an array of variable length buffers, where the length is decided at run time.

This class is also useful as a data member of a base class in a thin template class/base class pair where the type of the array element is not known until the owning thin template class is instantiated.

API status
Published to all clients. Released API.

Definition at line 1055 of file e32base.h.

Constructor & Destructor Documentation

◆ CArrayPak()

CArrayPak< TAny >::CArrayPak ( TBufRep  aRep,
TInt  aGranularity 
)
inline

Constructs a variable array with the specified granularity and buffer organisation.

Note that no memory is allocated to the array buffer by this constructor.

Parameters
aRepA pointer to a function used to expand the array buffer. The organisation of the array buffer is implied by the choice of this function. For a flat array buffer, pass (TBufRep)CBufFlat::NewL. For a segmented array buffer, pass (TBufRep)CBufSeg::NewL.
aGranularityThe granularity of the array.

Panic condition: E32USER-CBase 19, if aGranularity is not positive.

(generated from Symbian Developer Library)

Member Function Documentation

◆ AppendL()

void CArrayPak< TAny >::AppendL ( const TAny *  aPtr,
TInt  aLength 
)
inline

Appends the untyped element of the specified length onto the end of the array.

Parameters
aPtrA pointer to an untyped element to be appended.
aLengthThe length of the untyped element.

Leave condition: KErrNoMemory The function attempted to expand the array buffer and there is insufficient memory available. In this case, the array is left in the state it was in before the call.

(generated from Symbian Developer Library)

◆ At() [1/2]

TAny * CArrayPak< TAny >::At ( TInt  anIndex)
inline

Gets a pointer to the untyped element located at the specified position within the array.

The compiler uses this variant of the function if the returned reference is used in an expression where that reference can be modified.

Parameters
anIndexThe position of the element within the array, relative to zero; i.e. zero implies the first element.

Panic condition: E32USER-CBase 21, if anIndex is negative or greater than or equal to the number of objects currently within the array.

(generated from Symbian Developer Library)

◆ At() [2/2]

const TAny * CArrayPak< TAny >::At ( TInt  anIndex) const
inline

Gets a pointer to the untyped element located at the specified position within the array.

The compiler uses this variant of the function if the returned reference is used in an expression where that reference cannot be modified.

Parameters
anIndexThe position of the element within the array, relative to zero; i.e. zero implies the first element.

Panic condition: E32USER-CBase 21, if anIndex is negative or greater than or equal to the number of objects currently within the array.

(generated from Symbian Developer Library)

◆ ExtendL()

TAny * CArrayPak< TAny >::ExtendL ( TInt  aLength)
inline

Expands the array by one element of the specified length at the end of the array, and returns a pointer to this new location.

As elements are untyped, no construction is possible and the content of the new location remains undefined.

Parameters
aLengthThe length of the new element.

Leave condition: KErrNoMemory The function attempted to expand the array buffer and there is insufficient memory available. In this case, the array is left in the state it was in before the call.

(generated from Symbian Developer Library)


The documentation for this class was generated from the following files: