CPosLandmarkEncoder Class Reference

API published in: S60 3rd Ed

Link against: eposlandmarks.lib

Capability Information

Required Capabilities

None

Exceptions

The capability ReadUserData is required in:

CPosLandmarkDatabase::OpenL();

CPosLandmarkDatabase::OpenL( const TDesC & aDatabaseUri );

CPosLandmarkDatabase::InitializeL();

CPosLandmarkDatabase::ReadLandmarkLC( TPosLmItemId aLandmarkId );

CPosLandmarkDatabase::LandmarkIteratorL();

CPosLandmarkDatabase::LandmarkIteratorL( const TPosLmSortPref & aSortPref );

CPosLandmarkDatabase::AddLandmarkL( CPosLandmark & aLandmark );

CPosLandmarkDatabase::UpdateLandmarkL( const CPosLandmark & aLandmark );

CPosLandmarkDatabase::RemoveLandmarkL( TPosLmItemId aLandmarkId );

CPosLandmarkDatabase::RemoveLandmarksL( const RArray< TPosLmItemId > & aLandmarkIdArray );

CPosLandmarkDatabase::RemoveAllLandmarksL();

CPosLandmarkDatabase::ReadPartialLandmarkLC( TPosLmItemId aLandmarkId );

CPosLandmarkDatabase::PreparePartialLandmarksL( const RArray< TPosLmItemId > & aLandmarkIdArray );

CPosLandmarkDatabase::SizeL();

CPosLandmarkDatabase::CompactL();

CPosLandmarkDatabase::NotifyDatabaseEvent( TPosLmEvent & aEvent, TRequestStatus & aStatus );

CPosLandmarkDatabase::CancelNotifyDatabaseEvent();

CPosLandmarkDatabase::ImportLandmarksL( CPosLandmarkParser& aLandmarkParser, TTransferOptions aTransferOptions );

CPosLandmarkDatabase::ImportLandmarksL( CPosLandmarkParser& aLandmarkParser, const RArray<TUint>& aLandmarkSelection, TTransferOptions aTransferOptions );

CPosLmCategoryManager::ReadCategoryLC( TPosLmItemId aCategoryId );

CPosLmCategoryManager::CategoryIteratorL( TCategorySortPref aSortPref );

CPosLmCategoryManager::ReferencedCategoryIteratorL( TCategorySortPref aSortPref )

CPosLmCategoryManager::AddCategoryL( CPosLandmarkCategory & aCategory );

CPosLmCategoryManager::UpdateCategoryL( const CPosLandmarkCategory & aCategory );

CPosLmCategoryManager::RemoveCategoryL( TPosLmItemId aCategoryId );

CPosLmCategoryManager::RemoveCategoriesL( const RArray< TPosLmItemId > & aCategoryIdArray );

CPosLmCategoryManager::AddCategoryToLandmarksL( TPosLmItemId aCategoryId, RArray< TPosLmItemId > & aLandmarkIdArray );

CPosLmCategoryManager::RemoveCategoryFromLandmarksL( TPosLmItemId aCategoryId, RArray< TPosLmItemId > & aLandmarkIdArray );

CPosLmCategoryManager::GetCategoryL( const TDesC & aCategoryName );

CPosLmCategoryManager::GetGlobalCategoryL( TPosLmGlobalCategory aGlobalCategory );

CPosLmCategoryManager::ResetGlobalCategoriesL();

The capability WriteUserData is required in:

CPosLandmarkDatabase::AddLandmarkL( CPosLandmark& aLandmark );

CPosLandmarkDatabase::UpdateLandmarkL( const CPosLandmark& aLandmark );

CPosLandmarkDatabase::RemoveLandmarkL( TPosLmItemId aLandmarkId );

CPosLandmarkDatabase::RemoveLandmarksL( const RArray<TPosLmItemId>& aLandmarkIdArray );

CPosLandmarkDatabase::RemoveAllLandmarksL();

CPosLandmarkDatabase::CompactL();

CPosLandmarkDatabase::ImportLandmarksL( CPosLandmarkParser& aLandmarkParser, TTransferOptions aTransferOptions );

CPosLandmarkDatabase::ImportLandmarksL( CPosLandmarkParser& aLandmarkParser, const RArray<TUint>& aLandmarkSelection, TTransferOptions aTransferOptions );

CPosLmCategoryManager::AddCategoryL( CPosLandmarkCategory & aCategory );

CPosLmCategoryManager::UpdateCategoryL( const CPosLandmarkCategory & aCategory );

CPosLmCategoryManager::RemoveCategoryL( TPosLmItemId aCategoryId );

CPosLmCategoryManager::RemoveCategoriesL( const RArray< TPosLmItemId > & aCategoryIdArray );

CPosLmCategoryManager::AddCategoryToLandmarksL( TPosLmItemId aCategoryId, RArray< TPosLmItemId > & aLandmarkIdArray );

CPosLmCategoryManager::RemoveCategoryFromLandmarksL( TPosLmItemId aCategoryId, RArray< TPosLmItemId > & aLandmarkIdArray );

CPosLmCategoryManager::ResetGlobalCategoriesL();

Other Information

The capability NetworkServices is required to work with remote databases.


#include <epos_cposlandmarkencoder.h>

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.


Public Member Functions

virtual IMPORT_C  ~CPosLandmarkEncoder ()
  Destructor.
virtual CBufBase *  SetUseOutputBufferL ()=0
  Encode to a buffer.
virtual void  SetOutputFileL (const TDesC &aOutputFile)=0
  Encode to a file.
virtual void  AddCollectionDataL (TPosLmCollectionDataId aDataId, const TDesC &aCollectionData)=0
  Add landmark collection data to be encoded.
virtual void  AddLandmarkL (const CPosLandmark &aLandmark)=0
  Add a landmark to be encoded.
virtual void  AddCategoryForLatestLandmarkL (const CPosLandmarkCategory &aCategory)=0
  Add a landmark category for the most recently added landmark.
virtual CPosLmOperation FinalizeEncodingL ()=0
  Finalize the encode process.

Static Public Member Functions

static IMPORT_C CPosLandmarkEncoder NewL (const TDesC8 &aContentMimeType)
  Two-phased constructor.

Protected Member Functions

IMPORT_C  CPosLandmarkEncoder ()

Constructor & Destructor Documentation

virtual IMPORT_C CPosLandmarkEncoder::~CPosLandmarkEncoder  )  [virtual]
 

Destructor.

IMPORT_C CPosLandmarkEncoder::CPosLandmarkEncoder  )  [protected]
 

Member Function Documentation

virtual void CPosLandmarkEncoder::AddCategoryForLatestLandmarkL const CPosLandmarkCategory aCategory  )  [pure virtual]
 

Add a landmark category for the most recently added landmark.

Precondition:
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.

Parameters:
[in]  aCategory  The landmark category to add.
Panic:
"Landmarks Client"-EPosLmProtocolBreak
  1. Output buffer or file not specified.
  2. No landmarks have been added yet.
virtual void CPosLandmarkEncoder::AddCollectionDataL TPosLmCollectionDataId  aDataId,
const TDesC &  aCollectionData
[pure virtual]
 

Add landmark collection data to be encoded.

Precondition:
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.

Parameters:
[in]  aDataId  Identifies which collection data to add.
[in]  aCollectionData  The collection data which should be added.
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.
virtual void CPosLandmarkEncoder::AddLandmarkL const CPosLandmark aLandmark  )  [pure virtual]
 

Add a landmark to be encoded.

Precondition:
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.

Parameters:
[in]  aLandmark  The landmark to add.
Panic:
"Landmarks Client"-EPosLmProtocolBreak Output buffer or file not specified.
virtual CPosLmOperation* CPosLandmarkEncoder::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.
static IMPORT_C CPosLandmarkEncoder* 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.

Parameters:
[in]  The  MIME type of the encode format.
Returns:
A new instance of this class.
Leave:
KErrNotSupported Content format is not supported.
virtual void CPosLandmarkEncoder::SetOutputFileL 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.

Parameters:
[in]  aOutputFile  The file name to write the encoded data to.
Leave:
KErrAlreadyExists Specified file already exists.
virtual CBufBase* CPosLandmarkEncoder::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.

The documentation for this class was generated from the following file:

Copyright © Nokia Corporation 2001-2008
Back to top