RMTPType Class Reference

class RMTPType : public MMTPType

Defines a general purpose class for containing, accessing, and manipulating a reference to any MMTPType derived data type. The data type buffer itself resides on the heap and is managed by this class.

By default all MTP simple (signed and unsigned integer), array (signed and unsigned integer), and string types are supported. Support for any other data types can be provided by derived subclasses which provide suitable implementions of the CreateL and Destroy methods.

This class and it's derived subclasses can be freely contained as member variables within any CBase derived class (typically a CMTPTypeCompoundBase derived class). When used as a stack variable the class's CleanupClosePushL method should always be used to ensure that the heap storage managed by the class is correctly deallocated.

Inherits from

Constructor & Destructor Documentation

RMTPType()

IMPORT_C RMTPType ( )

Constructor.

~RMTPType()

IMPORT_C ~RMTPType ( ) [virtual]

Destructor

Member Functions Documentation

AllocL(const TUint)

MMTPType * AllocL ( const TUint aDataType ) [static]

Parameters

const TUint aDataType

CleanupClosePushL()

IMPORT_C void CleanupClosePushL ( )

Pushes a cleanup item for the managed data type onto the cleanup stack. The effect of which is to cause Close() to be called on the managed data type when CleanupStack::PopAndDestroy() is called at some later time.

         ...
RMTPType x;
...
x.OpenL(EMTPTypeAUINT32);
x.CleanupClosePushL();
...
CleanupStack::PopAndDestroy();
...
        
RMTPType::Close()

Close()

IMPORT_C void Close ( )
Releases the storage assigned to the data type.
panic
MTPDataTypes 5, if the type's data type identifier datacode is not supported.

CommitChunkL(TPtr8 &)

IMPORT_C MMTPType * CommitChunkL ( TPtr8 & aChunk ) [virtual]
Commits the specified write data chunk. This method should only be invoked if the type indicates that committing data is required ( CommitRequired ). Generally this would only be required by types which are performing intermediate buffering, e.g. a file data object.
leave
KErrNotSupported, if the type does not support data commit.
leave
KMTPDataTypeInvalid, if the data type is structurally invalid.
leave
One of the system wide error codes, if a general processing error occurs.
CommitRequired

Parameters

TPtr8 & aChunk The data chunk to be commited.

CommitRequired()

IMPORT_C TBool CommitRequired ( ) const [virtual]

Indicates if the data type requires that data be committed during data write sequences. Generally this would only be required by types which perform intermediate buffering (e.g. a file data object), or by data types whose final structure is determined by the value of meta data elements within the data stream itself (e.g an MTP ObjectPropDesc dataset). CommitChunkL ChunkWritePtr

CreateL(TUint)

IMPORT_C MMTPType * CreateL ( TUint aDataType ) [protected, virtual]
Allocates storage for non-default data types. Non-default data types can be supported by a derived class which overides both this and the Destroy methods.
leave
KMTPDataTypeInvalid, if the type's data type identifier datacode is not supported.
leave
One of the system wide error codes, if a processing failure occurs.
Destroy

Parameters

TUint aDataType The type's data type identifier datacode.

Data()

IMPORT_C MMTPType & Data ( )

Destroy(const TUint, MMTPType *)

void Destroy ( const TUint aDataType,
MMTPType * aType
) [static]

Parameters

const TUint aDataType
MMTPType * aType

Destroy(MMTPType *)

IMPORT_C void Destroy ( MMTPType * aType ) [protected, virtual]
Releases the storage assigned to the data type. Non-default data types can be supported by a derived class which overides both this and the CreateL methods.
panic
MTPDataTypes 5, if the type's data type identifier datacode is not supported.
CreateL

Parameters

MMTPType * aType

FirstReadChunk(TPtrC8 &)

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

Initiates a data read sequence on the type by providing a const pointer to the first in the sequence of data chunks that make up the type's data stream. Subsequent chunks in the sequence can be sequentially retrieved using NextReadChunk. NextReadChunk .

Parameters

TPtrC8 & aChunk The const pointer to be set to point to the start of the first data chunk. This pointer's length is set to zero if no data chunk exists or a processing error occurs.

FirstWriteChunk(TPtr8 &)

IMPORT_C TInt FirstWriteChunk ( TPtr8 & aChunk ) [virtual]

Initiates a data write sequence on the type by providing a non-const pointer to the first in the sequence of data chunks that make up the type's data stream. Subsequent chunks in the sequence can be sequentially retrieved using NextWriteChunk. NextWriteChunk .

Parameters

TPtr8 & aChunk The non-const pointer to be set to point to the start of the first data chunk. If successful, the pointer's Length is set to zero, and MaxLength is set to the available capacity of the data chunk. If not successful, the pointer's MaxLength is set to zero.

NextReadChunk(TPtrC8 &)

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

Continues a data read sequence on the type by providing a const pointer to the next in the sequence of data chunks that make up the type's data stream. This data read sequence should have been previously initiated by invoking FirstReadChunk. FirstReadChunk .

Parameters

TPtrC8 & aChunk The const pointer to be set to point to the start of the next data chunk. This pointer's length is set to zero if no data chunk exists or a processing error occurs.

NextWriteChunk(TPtr8 &)

IMPORT_C TInt NextWriteChunk ( TPtr8 & aChunk ) [virtual]

Continues a data write sequence on the type by providing a non-const pointer to the next in the sequence of data chunks that make up the type's data stream. This data write sequence should have been previously initiated by invoking FirstWriteChunk. FirstReadChunk .

Parameters

TPtr8 & aChunk The non-const pointer to be set to point to the start of the next data chunk. If successful, the pointer's Length is set to zero, and MaxLength is set to the available capacity of the data chunk. If not successful, the pointer's MaxLength is set to zero..

OpenL(TUint)

IMPORT_C void OpenL ( TUint aDataType )
Allocates storage for the data type. By default all MTP simple (signed and unsigned integer), array (signed and unsigned integer), and string types are supported. Support for any other data types must be provided by a derived subclass which implements suitable CreateL and Destroy methods. This method will release any pre-existing allocated storage.
leave
One of the system wide error codes, if a processing failure occurs.
panic
MTPDataTypes 5, if the type's data type identifier datacode is not supported.
CreateL Destroy

Parameters

TUint aDataType The type's data type identifier datacode.

Size()

IMPORT_C TUint64 Size ( ) const [virtual]

Provides the size in bytes of the MTP data type.

Type()

IMPORT_C TUint Type ( ) const [virtual]

Provides the MTP data type identification datacode.

Validate()

IMPORT_C TInt Validate ( ) const [virtual]

Validates the structural integrity of the data type. This method can be invoked on completion of a data write sequence to validate that the received data represents a structurally valid instance of the data type.

Member Data Documentation

MMTPType * iData

MMTPType * iData [private]

The data type buffer.