Symbian Developer Library

SYMBIAN OS V6.1 EDITION FOR C++

[Index] [Glossary] [Previous] [Next]



Location: conarc.h
Link against: conarc.lib

Class CConverterBase

CConverterBase

Support

Supported from 6.0

Description

Polymorphic interface for converters from one data format to another.

Clients use this interface to access data converters. The implementator of a data converter derives a class from this in which to implement the appropriate conversion functionality.

The interface offers conversions between files, and between objects that support the stream interfaces, e.g. stream stores.

There are two flavours of conversion methods:

Derivation

CBaseBase class for all classes to be instantiated on the heap
CConverterBasePolymorphic interface for converters from one data format to another

Defined in CConverterBase:
CancelConvert(), Capabilities(), ConvertAL(), ConvertL(), ConvertObjectAL(), ConvertObjectL(), DoConvertL(), EConvertsExtract, EConvertsFiles, EConvertsObjects, EmbeddedObjectL(), GetEmbeddedFileName(), TCapability, Uid()

Inherited from CBase:
operator new()


Conversion


ConvertAL()

virtual void ConvertAL(const TFileName& aSourceFile, const TFileName& aTargetFile, MConverterUiObserver* aObserver=NULL);

Description

Prepares for conversion in multiple steps of a file.

Clients must call this function before calling DoConvertL() one or more times to do the conversion. The function can call back the MaxSteps() function of the supplied MConverterUiObserver to tell the client the maximum number of calls to DoConvertL() that will be required.

The rest of the description describes how to implement this function.

The function should initialise the object before performing a conversion, but should not do the conversion itself. Such initialisation should include:

The default implementation leaves with KErrNotSupported.

Parameters

const TFileName& aSourceFile

File to convert

const TFileName& aTargetFile

File to which to write the converted output. The file can be overwritten if it already exists.

const MConverterUiObserver* aObserver=NULL

Observer of the conversion process

Leave codes

KErrNotSupported

File conversion is not supported


ConvertL()

virtual void ConvertL(const TFileName& aSourceFile, const TFileName& aTargetFile, MConverterUiObserver* aObserver=NULL);

Description

Converts a file in a single step.

The caller can supply a MConverterUiObserver to be informed of progress in the conversion.

The default implementation calls ConvertAL() to prepare the object to perform the conversion, and then calls DoConvertL() in a loop until conversion is complete.

Parameters

const TFileName& aSourceFile

File to convert

const TFileName& aTargetFile

File to which to write the converted output

const MConverterUiObserver* aObserver=NULL

Optional observer of the conversion process

Leave codes

KErrNotSupported

File conversion is not supported

 

Other system-wide error codes can be generated by the conversion process


ConvertObjectAL()

virtual void ConvertObjectAL(RReadStream& aReadStream, RWriteStream& aWriteStream, MConverterUiObserver* aObserver=NULL);

Description

Prepares for conversion in multiple steps of a stream object.

Clients must call this function before calling DoConvertL() one or more times to do the conversion. The function can call back the MaxSteps() function of the supplied MConverterUiObserver to tell the client the maximum number of calls to DoConvertL() that will be required.

For a description of how to implement this function, see ConvertAL().

Parameters

RReadStream& aReadStream

Stream from which to read the data to convert

RWriteStream& aWriteStream

Stream to which to write the converted data

MConverterUiObserver* aObserver=NULL

Optional observer of the conversion process

Leave codes

KErrNotSupported

Stream object conversion is not supported


ConvertObjectL()

virtual void ConvertObjectL(RReadStream& aReadStream, RWriteStream& aWriteStream, MConverterUiObserver* aObserver=NULL);

Description

Converts a stream object in a single step.

The caller can supply a MConverterUiObserver to be informed of progress in the conversion.

The default implementation calls ConvertObjectAL() to prepare the object to perform the conversion, and then calls DoConvertL() in a loop until conversion is complete.

Parameters

RReadStream& aReadStream

Stream from which to read the data to convert

RWriteStream& aWriteStream

Stream to which to write the converted data

MConverterUiObserver* aObserver=NULL

Optional observer of the conversion process


DoConvertL()

virtual TBool DoConvertL();

Description

Performs a step in converting the data.

The function advances a step in converting the data each time that it is called. When conversion is complete, the function returns EFalse.

Return value

TBool

EFalse if conversion is complete, else ETrue


CancelConvert()

virtual void CancelConvert();

Description

Cleans up a conversion that has been prepared or is in progress.

It should free any resources and reset the converter object to an initial state.

The default is to do nothing.

[Top]


Utilities


Capabilities()

virtual TInt Capabilities();

Description

Gets the converter's capabilities.

The default is to return a bitmask of all the TCapability flags.

Return value

TInt

A bitmask of TCapability flags describing the capabilities.


EmbeddedObjectL()

virtual CConverterBase* EmbeddedObjectL(TDataType& aType);

Description

Gets a converter for an embedded object of the specified type.

The default is to return NULL.

Parameters

TDataType& aType

Type of the embedded object

Return value

CConverterBase*

Converter for the embedded object


GetEmbeddedFileName()

virtual TBool GetEmbeddedFileName(TFileName& aFileName);

Description

Gets a filename embedded in the object.

Parameters

TFileName& aFileName

File name found

Return value

TBool

True if a filename found, false otherwise


Uid()

virtual TUid Uid() =0;

Description

Gets the converter's UID.

Return value

TUid

Converter's UID

[Top]


Enum TCapability

TCapability

Description

Bitmask values that describe the capabilities of the converter.

EConvertsFiles

The converter can convert files.

EConvertsObjects

The converter can convert stream objects.

EConvertsExtract

The converter can extract embedded objects.