CPosLandmarkEncoder Class Reference

#include <mw/EPos_CPosLandmarkEncoder.h>

Link against: eposlandmarks.lib

class CPosLandmarkEncoder : public CBase

Inherits from

  • CPosLandmarkEncoder

    Detailed Description

    Class used for encoding landmark content.

    When creating an instance of this class, the type (e.g. the mime type) of the landmark content must be specified. The client will then receive an encoder implementation which understands the requested landmark content.

    Output is written either to a buffer or to a file.

    The basic protocol for encoding is to
    1. define where to write the output to by calling SetUseOutputBufferL or SetOutputFileL ,

    2. optionally add collection data using AddCollectionDataL ,

    3. add landmark data to encode by using functions in CPosLandmarkEncoder and/or CPosLandmarkDatabase::ExportLandmarksL

    4. finalize the encoding by calling FinalizeEncodingL .

    If this protocol is not followed the client is panicked with error code EPosLmProtocolBreak. Encoding can be performed multiple times using the same encoder object.

    If CPosLandmarkEncoder is used, the client must call the global function ReleaseLandmarkResources before terminating, in order to release all used landmark resources, otherwise the client may receive an ALLOC panic.

    Since
    S60 3.0

    Constructor & Destructor Documentation

    CPosLandmarkEncoder ( )

    IMPORT_CCPosLandmarkEncoder()[protected]

    ~CPosLandmarkEncoder ( )

    IMPORT_C~CPosLandmarkEncoder()[virtual]

    Destructor.

    Member Function Documentation

    AddCategoryForLatestLandmarkL ( const CPosLandmarkCategory & )

    voidAddCategoryForLatestLandmarkL(const CPosLandmarkCategory &aCategory)[pure virtual]

    Add a landmark category for the most recently added landmark.

    Pre-condition
    Output buffer or file is specified.
    The landmark category is added to the landmark which was most recently added using AddLandmarkL .

    The client can either call this function directly or pass this encoder object to CPosLandmarkDatabase::ExportLandmarksL .

    panic
    "Landmarks Client"-EPosLmProtocolBreak
    1. Output buffer or file not specified.

    2. No landmarks have been added yet.

    ParameterDescription
    aCategoryThe landmark category to add.

    AddCollectionDataL ( TPosLmCollectionDataId, const TDesC & )

    voidAddCollectionDataL(TPosLmCollectionDataIdaDataId,
    const TDesC &aCollectionData
    )[pure virtual]

    Add landmark collection data to be encoded.

    Pre-condition
    Output buffer or file is specified.
    Landmark collection data is generic information about the landmark collection. It can for instance contain a name for the landmark collection. Predefined collection attributes are defined by TPosLmCollectionDataId enumeration but also format specific collection meta data can be defined.

    Collection data must be added before any landmarks are added. Each collection ID can only be specified once.

    If the collection data is not a part of the chosen landmark encoding format, it will be silently ignored.

    leave
    KErrAlreadyExists Collection data ID is specified twice.
    panic
    "Landmarks Client"-EPosLmProtocolBreak
    1. Output buffer or file not specified.

    2. Collection data is added after some landmarks are added.

    panic
    "Landmarks Client"-EPosLmInvalidArgument EPosLmCollDataNone is specified as collection data ID.
    ParameterDescription
    aDataIdIdentifies which collection data to add.
    aCollectionDataThe collection data which should be added.

    AddLandmarkL ( const CPosLandmark & )

    voidAddLandmarkL(const CPosLandmark &aLandmark)[pure virtual]

    Add a landmark to be encoded.

    Pre-condition
    Output buffer or file is specified.
    If the landmark contains any categories, those categories may be added by calling AddCategoryForLatestLandmarkL .

    The client can either call this function directly or pass this encoder object to CPosLandmarkDatabase::ExportLandmarksL .

    panic
    "Landmarks Client"-EPosLmProtocolBreak Output buffer or file not specified.
    ParameterDescription
    aLandmarkThe landmark to add.

    FinalizeEncodingL ( )

    CPosLmOperation *FinalizeEncodingL()[pure virtual]

    Finalize the encode process.

    Writes any buffered data to the output buffer/file. If an output buffer is used it is compressed so that unused memory is freed. If an output file is used, it is closed.

    After finalizing, further encoding to the specified output is not possible. To start a new encoding, SetUseOutputBufferL or SetOutputFileL must be called.

    The function returns an operation object which can be run in incremental mode. If it is run incrementally the client can supervise the progress of the operation.

    The client takes ownership of the returned operation object.

    If the CPosLmOperation object is deleted before the operation is complete, finalize is cancelled. Further encoding will not be possible.

    Returns: A handle to the operation.

    NewL ( const TDesC8 & )

    IMPORT_C CPosLandmarkEncoder *NewL(const TDesC8 &aContentMimeType)[static]

    Two-phased constructor.

    The client must specify the type (e.g. the MIME type) of the content format which should be used for encoding.

    leave
    KErrNotSupported Content format is not supported.

    Returns: A new instance of this class.

    SetOutputFileL ( const TDesC & )

    voidSetOutputFileL(const TDesC &aOutputFile)[pure virtual]

    Encode to a file.

    The client specifies an output file for the encoder. The encoder will then write all encoded data to this file.

    The file will be opened in exclusive mode which means that the file cannot be accessed until the file is closed. The file is closed when FinalizeEncodingL has been executed. The file is also closed if a new encoding is initialized by a call to SetUseOutputBufferL or SetOutputFileL . After this, further encoding to the old file is not possible.

    leave
    KErrAlreadyExists Specified file already exists.
    ParameterDescription
    aOutputFileThe file name to write the encoded data to.

    SetUseOutputBufferL ( )

    CBufBase *SetUseOutputBufferL()[pure virtual]

    Encode to a buffer.

    This function returns a dynamic buffer which will be filled with encoded landmark content. The client takes ownership of the buffer.

    The client must not delete the buffer until encoding is finalized.

    Returns: The output buffer.