TTlvStruct Class Reference

class TTlvStruct : public TTlvStructBase

Provides methods to append, remove or perform iterative lookup for items in container buffer. Classes ItemIdType and ItemDataLengthType have to implement interfaces MTlvItemIdType and MTlvItemDataLengthType in order to enable proper encoding and decoding of the first two fields in the unit.

Inherits from

Constructor & Destructor Documentation

TTlvStruct(TPtr8 &, TUint8)

TTlvStruct ( TPtr8 & ,
TUint8
) [inline]

Default constructor initializes data members and cursor position to 0.

Parameters

TPtr8 & Ptr descriptor to TLV buffer that is to be read or written to.
TUint8 Character used to populate the zone that hasn't been assigned to any element.

TTlvStruct()

TTlvStruct ( ) [protected]

Default constructor is protected in order to enforce proper initialization of reference to external data buffer via provided public constructor

Member Functions Documentation

AnyNextItemL(ItemIdType &, TPtr8 &)

TInt AnyNextItemL ( ItemIdType & aId,
TPtr8 & aData
) [inline]

Look up in the buffer for the item with specified identifier. Look-up starts from the position of the cursor in the buffer.

Returns KErrNone if item is found, KErrNotFound otherwise (end of buffer is reached). Sets supplied pointer so that it points to item data portion and has length set to value of data length. Internal cursor is moved to first position after the end of the found item (subsequent item start position in the buffer).

Parameters

ItemIdType & aId Id of found item.
TPtr8 & aData Descriptor which will hold the found item.

AppendItemL(ItemIdType, const TPtr8 &)

TInt AppendItemL ( ItemIdType aId,
const TPtr8 & aData
) [inline]

Adds item identified by supplied aId argument to the buffer; content of the item is copied from provided descriptor to the buffer. Supplied item identifier (aId) and length of the descriptor are used to set item identifier field and length field at the start of item unit within the buffer. Returns KErrNone if successful, error code otherwise. Internal cursor is moved to first position after the end of the found item (subsequent item start position in the buffer).

Parameters

ItemIdType aId Id of item to add.
const TPtr8 & aData Descriptor containing data to add.

NextItemL(ItemIdType, TPtr8 &)

TInt NextItemL ( ItemIdType aId,
TPtr8 & aData
) [inline]

Look up in the buffer for an item with specified identifier. Look-up starts from the position of the cursor; Returns KErrNone if the item is present in the buffer, KErrNotFound otherwise. Sets supplied pointer so that it has length of item's data portion and points to it. Internal cursor is moved to first position after the end of the found item (subsequent item start position in the buffer).

Parameters

ItemIdType aId Id of item to find.
TPtr8 & aData Descriptor which will hold the found item.

RemoveNextItemL(ItemIdType)

TInt RemoveNextItemL ( ItemIdType aId ) [inline]

Removes item identified by specified identifier (aId) from the buffer, where look-up starts at current cursor position, or 0 if it's reset. returns KErrNone if item is found ( and removed), otherwise error code - in the case where there is no more space in the assigned buffer, KErrOverflow is passed back.

Parameters

ItemIdType aId Id of item to remove.

Member Data Documentation

ItemDataLengthType iItemDataLengthType

ItemDataLengthType iItemDataLengthType [protected]

The type used to define length of data portion of the item

ItemIdType iItemIdType

ItemIdType iItemIdType [protected]

Type of the identifier