CMTPTypeCompoundBase Class Reference

class CMTPTypeCompoundBase : public CBase

Defines the MTP compound data types base class. Compound data types are used to represent MTP datasets comprising mixed sequences of simple, flat, and complex data type elements. These elements may be either of fixed or variable length. This class implements generic compound data type storage management capabilities and is intended for derivation by concrete classes which implement specific MTP datasets. Note that this class does NOT assume ownership of any of the data elements passed to it.

Inherits from

Public Member Functions
~CMTPTypeCompoundBase ()
IMPORT_C MMTPType * CommitChunkL ( TPtr8 &)
IMPORT_C TBool CommitRequired ()
IMPORT_C TInt FirstReadChunk ( TPtrC8 &)
IMPORT_C TInt FirstWriteChunk ( TPtr8 &)
IMPORT_C void GetL ( TInt , MMTPType &)
IMPORT_C TInt16 Int16L ( TInt )
IMPORT_C TInt32 Int32L ( TInt )
IMPORT_C TInt64 Int64L ( TInt )
IMPORT_C TInt8 Int8L ( TInt )
IMPORT_C TInt NextReadChunk ( TPtrC8 &)
IMPORT_C TInt NextWriteChunk ( TPtr8 &)
IMPORT_C TInt NextWriteChunk ( TPtr8 &, TUint )
IMPORT_C void SetInt16L ( TInt , TInt16 )
IMPORT_C void SetInt32L ( TInt , TInt32 )
IMPORT_C void SetInt64L ( TInt , TInt64 )
IMPORT_C void SetInt8L ( TInt , TInt8 )
IMPORT_C void SetL ( TInt , const MMTPType &)
IMPORT_C void SetStringL ( TInt , const TDesC &)
IMPORT_C void SetUint16L ( TInt , TUint16 )
IMPORT_C void SetUint32L ( TInt , TUint32 )
IMPORT_C void SetUint64L ( TInt , TUint64 )
IMPORT_C void SetUint8L ( TInt , TUint8 )
IMPORT_C TUint64 Size ()
IMPORT_C const TDesC & StringCharsL ( TInt )
IMPORT_C TUint8 StringNumCharsL ( TInt )
IMPORT_C TUint Type ()
IMPORT_C TUint16 Uint16L ( TInt )
IMPORT_C TUint32 Uint32L ( TInt )
IMPORT_C TUint64 Uint64L ( TInt )
IMPORT_C TUint8 Uint8L ( TInt )
IMPORT_C TInt Validate ()
Protected Member Functions
CMTPTypeCompoundBase ( TBool , TUint )
IMPORT_C void ChunkAppendL (const MMTPType &)
IMPORT_C TUint ChunkCount ()
IMPORT_C void ChunkRemove ( TUint )
const TElementInfo & ElementInfo ( TInt )
IMPORT_C TBool ReadableElementL ( TInt )
IMPORT_C void Reset ()
IMPORT_C void SetExpectedChunkCount ( TUint )
IMPORT_C TInt ValidateChunkCount ()
IMPORT_C TBool WriteableElementL ( TInt )
Private Member Functions
TInt UpdateReadState ( TInt )
TInt UpdateWriteState ( TInt )
Inherited Functions
CBase::CBase()
CBase::Delete(CBase *)
CBase::Extension_(TUint,TAny *&,TAny *)
CBase::operator new(TUint)
CBase::operator new(TUint,TAny *)
CBase::operator new(TUint,TLeave)
CBase::operator new(TUint,TLeave,TUint)
CBase::operator new(TUint,TUint)
CBase::~CBase()
Protected Member Enumerations
enum TReadWriteSequenceState { EIdle , EInProgressFirst , EInProgressNext }
Public Attributes
const TInt KMTPNotApplicable
Protected Attributes
const TBool KJustInTimeConstruction
const TUint KVariableChunkCount
RPointerArray < MMTPType > iChunks
TUint iWriteChunk
TUint iWriteSequenceState
Private Attributes
TUint iExpectedChunkCount
TBool iJustInTimeConstruction
TUint iReadChunk
TUint iReadSequenceState
TInt iWriteErr

Constructor & Destructor Documentation

CMTPTypeCompoundBase(TBool, TUint)

IMPORT_C CMTPTypeCompoundBase ( TBool aJustInTimeConstruction,
TUint aExpectedChunkCount
) [protected]

Parameters

TBool aJustInTimeConstruction This flag indicates that the derived class uses a just-in-time construction technique when constructing iteself from a write data stream. Typically this is used for types whose final structure is dependant upon data contained within the data stream itself, e.g. a dataset with an element whose data type is determined by meta data which precedes the element in the data stream.
TUint aExpectedChunkCount This flag is used by the derived class to indicate the number of chunks which make up the compound type. A value of KVariableChunkCount indicates that the type is of variable rather than fixed length (e.g. a list of elements). If KVariableChunkCount is specified then the derived class's ValidChunkCount method is invoked when the compound type is validated (

~CMTPTypeCompoundBase()

IMPORT_C ~CMTPTypeCompoundBase ( ) [virtual]

Destructor

Member Functions Documentation

ChunkAppendL(const MMTPType &)

IMPORT_C void ChunkAppendL ( const MMTPType & aElement ) [protected]

Appends the specified data chunk to the compound type's sequence of chunks.

Parameters

const MMTPType & aElement The chunk to be appended.

ChunkCount()

IMPORT_C TUint ChunkCount ( ) const [protected]

Provides the number of discrete data chunks of which the compound type is composed.

ChunkRemove(TUint)

IMPORT_C void ChunkRemove ( TUint aChunkId ) [protected]

Removes the chunk at the specified position in the chunk sequence.

Parameters

TUint aChunkId The index of the chunk in in the chunk sequence.

CommitChunkL(TPtr8 &)

IMPORT_C MMTPType * CommitChunkL ( TPtr8 & aChunk ) [virtual]

Parameters

TPtr8 & aChunk

CommitRequired()

IMPORT_C TBool CommitRequired ( ) const [virtual]

ElementInfo(TInt)

const TElementInfo & ElementInfo ( TInt aElementId ) const [protected, pure virtual]

Provides the TElementInfo data for the specified element.

Parameters

TInt aElementId The identifier of the requested element.

FirstReadChunk(TPtrC8 &)

IMPORT_C TInt FirstReadChunk ( TPtrC8 & aChunk ) const [virtual]

Parameters

TPtrC8 & aChunk

FirstWriteChunk(TPtr8 &)

IMPORT_C TInt FirstWriteChunk ( TPtr8 & aChunk ) [virtual]

Parameters

TPtr8 & aChunk

GetL(TInt, MMTPType &)

IMPORT_C void GetL ( TInt aElementId,
MMTPType & aElement
) const [virtual]
Provides a copy of the specified element.
leave
KErrNotSupported, if the element is not readable.
leave
One of the system wide error code, if a processing error occurs.
panic
MTPDataTypes 3, if the target buffer type does not match the requested element.

Parameters

TInt aElementId The identifier of the requested element.
MMTPType & aElement The MMTPType target data buffer.

Int16L(TInt)

IMPORT_C TInt16 Int16L ( TInt aElementId ) const [virtual]
Provides the value of the specified element.
leave
KErrNotSupported, if the element is not readable.
leave
One of the system wide error code, if a processing error occurs.
panic
MTPDataTypes 3, if the source buffer type does not match the requested element.

Parameters

TInt aElementId The identifier of the requested element.

Int32L(TInt)

IMPORT_C TInt32 Int32L ( TInt aElementId ) const [virtual]
Provides the value of the specified element.
leave
KErrNotSupported, if the element is not readable.
leave
One of the system wide error code, if a processing error occurs.
panic
MTPDataTypes 3, if the source buffer type does not match the requested element.

Parameters

TInt aElementId The identifier of the requested element.

Int64L(TInt)

IMPORT_C TInt64 Int64L ( TInt aElementId ) const [virtual]
Provides the value of the specified element.
leave
KErrNotSupported, if the element is not readable.
leave
One of the system wide error code, if a processing error occurs.
panic
MTPDataTypes 3, if the source buffer type does not match the requested element.

Parameters

TInt aElementId The identifier of the requested element.

Int8L(TInt)

IMPORT_C TInt8 Int8L ( TInt aElementId ) const [virtual]
Provides the value of the specified element.
leave
KErrNotSupported, if the element is not readable.
leave
One of the system wide error code, if a processing error occurs.
panic
MTPDataTypes 3, if the source buffer type does not match the requested element.

Parameters

TInt aElementId The identifier of the requested element.

NextReadChunk(TPtrC8 &)

IMPORT_C TInt NextReadChunk ( TPtrC8 & aChunk ) const [virtual]

Parameters

TPtrC8 & aChunk

NextWriteChunk(TPtr8 &)

IMPORT_C TInt NextWriteChunk ( TPtr8 & aChunk ) [virtual]

Parameters

TPtr8 & aChunk

NextWriteChunk(TPtr8 &, TUint)

IMPORT_C TInt NextWriteChunk ( TPtr8 & aChunk,
TUint aDataLength
) [virtual]

Parameters

TPtr8 & aChunk
TUint aDataLength

ReadableElementL(TInt)

IMPORT_C TBool ReadableElementL ( TInt aElementId ) const [protected, virtual]

Indicates if the specified element can be read from.

Parameters

TInt aElementId The identifier of the requested element.

Reset()

IMPORT_C void Reset ( ) [protected]

Resets the compound base, removing all data chunk references.

SetExpectedChunkCount(TUint)

IMPORT_C void SetExpectedChunkCount ( TUint aExpectedChunkCount ) [protected]

Sets the expected chunk count. This flag is used by the derived class to indicate the number of chunks which make up the compound type. A value of KVariableChunkCount indicates that the type is of variable rather than fixed length (e.g. a list of elements). If KVariableChunkCount is specified then the derived class's ValidChunkCount method is invoked when the compound type is validated ( ValidateChunkCount ).

Parameters

TUint aExpectedChunkCount The new expected chunk count.

SetInt16L(TInt, TInt16)

IMPORT_C void SetInt16L ( TInt aElementId,
TInt16 aData
) [virtual]
Updates the specified element.
leave
KErrNotSupported, if the element is not writeable.
leave
One of the system wide error code, if a processing error occurs.
panic
MTPDataTypes 3, if the source data type does not match the requested element.

Parameters

TInt aElementId The identifier of the element to update.
TInt16 aData The source data.

SetInt32L(TInt, TInt32)

IMPORT_C void SetInt32L ( TInt aElementId,
TInt32 aData
) [virtual]
Updates the specified element.
leave
KErrNotSupported, if the element is not writeable.
leave
One of the system wide error code, if a processing error occurs.
panic
MTPDataTypes 3, if the source data type does not match the requested element.

Parameters

TInt aElementId The identifier of the element to update.
TInt32 aData The source data.

SetInt64L(TInt, TInt64)

IMPORT_C void SetInt64L ( TInt aElementId,
TInt64 aData
) [virtual]
Updates the specified element.
leave
KErrNotSupported, if the element is not writeable.
leave
One of the system wide error code, if a processing error occurs.
panic
MTPDataTypes 3, if the source data type does not match the requested element.

Parameters

TInt aElementId The identifier of the element to update.
TInt64 aData The source data.

SetInt8L(TInt, TInt8)

IMPORT_C void SetInt8L ( TInt aElementId,
TInt8 aData
) [virtual]
Updates the specified element.
leave
KErrNotSupported, if the element is not writeable.
leave
One of the system wide error code, if a processing error occurs.
panic
MTPDataTypes 3, if the source data type does not match the requested element.

Parameters

TInt aElementId The identifier of the element to update.
TInt8 aData The source data.

SetL(TInt, const MMTPType &)

IMPORT_C void SetL ( TInt aElementId,
const MMTPType & aElement
) [virtual]
Updates the specified element.
leave
KErrNotSupported, if the element is not writeable.
leave
One of the system wide error code, if a processing error occurs.
panic
MTPDataTypes 3, if the source buffer type does not match the requested element.

Parameters

TInt aElementId The identifier of the element to update.
const MMTPType & aElement The MMTPType source data buffer.

SetStringL(TInt, const TDesC &)

IMPORT_C void SetStringL ( TInt aElementId,
const TDesC & aString
) [virtual]
Updates the specified element.
leave
KErrNotSupported, if the element is not writeable.
leave
One of the system wide error code, if a processing error occurs.
panic
MTPDataTypes 3, if the source data type does not match the requested element.

Parameters

TInt aElementId The identifier of the element to update.
const TDesC & aString The source data.

SetUint16L(TInt, TUint16)

IMPORT_C void SetUint16L ( TInt aElementId,
TUint16 aData
) [virtual]
Updates the specified element.
leave
KErrNotSupported, if the element is not writeable.
leave
One of the system wide error code, if a processing error occurs.
panic
MTPDataTypes 3, if the source data type does not match the requested element.

Parameters

TInt aElementId The identifier of the element to update.
TUint16 aData The source data.

SetUint32L(TInt, TUint32)

IMPORT_C void SetUint32L ( TInt aElementId,
TUint32 aData
) [virtual]
Updates the specified element.
leave
KErrNotSupported, if the element is not writeable.
leave
One of the system wide error code, if a processing error occurs.
panic
MTPDataTypes 3, if the source data type does not match the requested element.

Parameters

TInt aElementId The identifier of the element to update.
TUint32 aData The source data.

SetUint64L(TInt, TUint64)

IMPORT_C void SetUint64L ( TInt aElementId,
TUint64 aData
) [virtual]
Updates the specified element.
leave
KErrNotSupported, if the element is not writeable.
leave
One of the system wide error code, if a processing error occurs.
panic
MTPDataTypes 3, if the source data type does not match the requested element.

Parameters

TInt aElementId The identifier of the element to update.
TUint64 aData The source data.

SetUint8L(TInt, TUint8)

IMPORT_C void SetUint8L ( TInt aElementId,
TUint8 aData
) [virtual]
Updates the specified element.
leave
KErrNotSupported, if the element is not writeable.
leave
One of the system wide error code, if a processing error occurs.
panic
MTPDataTypes 3, if the source data type does not match the requested element.

Parameters

TInt aElementId The identifier of the element to update.
TUint8 aData The source data.

Size()

IMPORT_C TUint64 Size ( ) const [virtual]

StringCharsL(TInt)

IMPORT_C const TDesC & StringCharsL ( TInt aElementId ) const [virtual]
Provides the value of the specified element.
leave
KErrNotSupported, if the element is not readable.
leave
One of the system wide error code, if a processing error occurs.
panic
MTPDataTypes 3, if the source buffer type does not match the requested element.

Parameters

TInt aElementId The identifier of the requested element.

StringNumCharsL(TInt)

IMPORT_C TUint8 StringNumCharsL ( TInt aElementId ) const [virtual]
Provides the value of the specified element.
leave
KErrNotSupported, if the element is not readable.
leave
One of the system wide error code, if a processing error occurs.
panic
MTPDataTypes 3, if the source buffer type does not match the requested element.

Parameters

TInt aElementId The identifier of the requested element.

Type()

IMPORT_C TUint Type ( ) const [virtual]

Uint16L(TInt)

IMPORT_C TUint16 Uint16L ( TInt aElementId ) const [virtual]
Provides the value of the specified element.
leave
KErrNotSupported, if the element is not readable.
leave
One of the system wide error code, if a processing error occurs.
panic
MTPDataTypes 3, if the source buffer type does not match the requested element.

Parameters

TInt aElementId The identifier of the requested element.

Uint32L(TInt)

IMPORT_C TUint32 Uint32L ( TInt aElementId ) const [virtual]
Provides the value of the specified element.
leave
KErrNotSupported, if the element is not readable.
leave
One of the system wide error code, if a processing error occurs.
panic
MTPDataTypes 3, if the source buffer type does not match the requested element.

Parameters

TInt aElementId The identifier of the requested element.

Uint64L(TInt)

IMPORT_C TUint64 Uint64L ( TInt aElementId ) const [virtual]
Provides the value of the specified element.
leave
KErrNotSupported, if the element is not readable.
leave
One of the system wide error code, if a processing error occurs.
panic
MTPDataTypes 3, if the source buffer type does not match the requested element.

Parameters

TInt aElementId The identifier of the requested element.

Uint8L(TInt)

IMPORT_C TUint8 Uint8L ( TInt aElementId ) const [virtual]
Provides the value of the specified element.
leave
KErrNotSupported, if the element is not readable.
leave
One of the system wide error code, if a processing error occurs.
panic
MTPDataTypes 3, if the source buffer type does not match the requested element.

Parameters

TInt aElementId The identifier of the requested element.

UpdateReadState(TInt)

TInt UpdateReadState ( TInt aErr ) const [private]

Parameters

TInt aErr

UpdateWriteState(TInt)

TInt UpdateWriteState ( TInt aErr ) [private]

Parameters

TInt aErr

Validate()

IMPORT_C TInt Validate ( ) const [virtual]

ValidateChunkCount()

IMPORT_C TInt ValidateChunkCount ( ) const [protected, virtual]

Validates that the number of chunks making up the compound type is valid. This method is invoked on variable length compound types by the default Valid implementation. Valid KVariableChunkCount

WriteableElementL(TInt)

IMPORT_C TBool WriteableElementL ( TInt aElementId ) const [protected, virtual]

Indicates if the specified element can be written to.

Parameters

TInt aElementId The identifier of the requested element.

Member Enumerations Documentation

Enum TReadWriteSequenceState

The read and write data stream states.

Enumerators

EIdle

Data stream is inactive.

EInProgressFirst

Streaming the first data chunk.

EInProgressNext

Streaming a subsequent data chunk.

Member Data Documentation

const TBool KJustInTimeConstruction

const TBool KJustInTimeConstruction [protected, static]

This flag is used by derived classes to signal the use of just-in-time techniques during construction from a write data stream. CMTPTypeCompoundBase

const TInt KMTPNotApplicable

const TInt KMTPNotApplicable [static]

Initialisation value for TElementInfo data values that are non applicable for an element, e.g. when specifying iFlatChunkInfo values for non-flat elements such as arrays and strings.

const TUint KVariableChunkCount

const TUint KVariableChunkCount [protected, static]

This flag is used by the derived class to indicate that the number of chunks making up the compound type is variable rather than fixed (e.g. a list of elements.)

RPointerArray< MMTPType > iChunks

RPointerArray < MMTPType > iChunks [protected]

Ordered data type element chunk table.

TUint iExpectedChunkCount

TUint iExpectedChunkCount [private]

This flag indicates the number of chunks which make up the compound type. A value of KVariableChunkCount indicates that the type is of variable rather than fixed length (e.g. a list of elements). If KVariableChunkCount is specified then the derived class's ValidChunkCount method is invoked by the default Valid implementation.

TBool iJustInTimeConstruction

TBool iJustInTimeConstruction [private]

This flag indicates that the compound data type uses just-in-time techniques when constructing iteself from a write data stream. Typically this is used for types whose final structure is dependant upon data contained within the data stream itself, e.g. a dataset with an element whose data type is determined by meta data which precedes the element in the data stream.

TUint iReadChunk

TUint iReadChunk [private]

The read data stream data chunk table index. Note that this is declared mutable to allow state updates while processing a read data stream.

TUint iReadSequenceState

TUint iReadSequenceState [private]

The read data stream state variable. Note that this is declared mutable to allow state updates while processing a read data stream.

TUint iWriteChunk

TUint iWriteChunk [protected]

The write data stream data chunk table index.

TInt iWriteErr

TInt iWriteErr [private]

The write data stream error state.

TUint iWriteSequenceState

TUint iWriteSequenceState [protected]

The write data stream state variable.