landmarksui/engine/inc/CLmkEncoder.h
branchRCL_3
changeset 17 1fc85118c3ae
parent 16 8173571d354e
child 18 870918037e16
equal deleted inserted replaced
16:8173571d354e 17:1fc85118c3ae
     1 /*
       
     2 * Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:    LandmarksUi Content File -    This class wraps functionality related to landmark encoding into
       
    15 *                a simpler interface.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 
       
    25 #ifndef CLMKENCODER_H
       
    26 #define CLMKENCODER_H
       
    27 
       
    28 //  INCLUDES
       
    29 #include <EPos_Landmarks.h>
       
    30 #include "MLmkAOOperationObserver.h"
       
    31 #include "CLmkLandmark.h"
       
    32 
       
    33 
       
    34 // FORWARD DECLARATIONS
       
    35 class CPosLandmarkEncoder;
       
    36 class CPosLandmarkDatabase;
       
    37 class CLmkAOOperation;
       
    38 class CPosLandmark;
       
    39 
       
    40 // CLASS DECLARATION
       
    41 /**
       
    42  * This class wraps functionality related to landmark encoding into
       
    43  * a simpler interface.
       
    44  */
       
    45 class CLmkEncoder : public CBase, public MLmkAOOperationObserver
       
    46     {
       
    47 	public:  // Constructors and destructor
       
    48 
       
    49 		/**
       
    50 		* Create CLmkEncoder object
       
    51         * @param aDb landmark database
       
    52         * @param aObserver calling class setting itself as observer to this class
       
    53         * @param aProgressNote Note to show the progress of encoding operation
       
    54 		* @return newly instantiated object
       
    55 		*/
       
    56 		IMPORT_C static CLmkEncoder* NewL( CPosLandmarkDatabase& aDb,
       
    57                                            MLmkAOOperationObserver& aObserver,
       
    58                                            TBool aProgressNote );
       
    59 
       
    60 		/**
       
    61 		* Destructor.
       
    62 		*/
       
    63 		~CLmkEncoder();
       
    64 
       
    65     protected: //from MLmkAOOperationObserver
       
    66         void HandleOperationL( TOperationTypes aType,
       
    67                                TReal32 aProgress,
       
    68                                TInt aStatus );
       
    69 
       
    70     public: // New functions
       
    71         /**
       
    72         * Set package name
       
    73         * @param aName
       
    74         */
       
    75         //IMPORT_C void SetPackageNameL( const TDesC& aName );
       
    76 
       
    77         /**
       
    78         * Start encoding package. Possibly existing file is deleted first.
       
    79         * @param aFile where parsed data is stored
       
    80         * @param aLandmarkIdArray
       
    81         */
       
    82         IMPORT_C void StartEncodingL( const TDesC& aFile,
       
    83                         const RArray<TPosLmItemId>& aLandmarkIdArray );
       
    84 
       
    85         /**
       
    86         * Start encoding package. Possibly existing file is deleted first.
       
    87         * This API can also be used for encoding unsaved landmarks
       
    88         * @param aFile where parsed data is stored
       
    89         * @param aLandmarks
       
    90         */
       
    91         IMPORT_C void StartEncodingL(const TDesC& aFileName,
       
    92                     	const RPointerArray<CLmkLandmark>& aLandmarks );
       
    93 
       
    94         /**
       
    95         * Cancel encode operation
       
    96         */
       
    97         IMPORT_C void CancelEncodeOperationL();
       
    98 
       
    99     private:  // New functions
       
   100     	/**
       
   101         * This function is used for setting the name for landmarks package
       
   102         * @param aName Name to be set for landmarks package
       
   103         */
       
   104     	void SetPackageNameL( const TDesC& aName );
       
   105 
       
   106         /**
       
   107         * Finalize the encode process. It uses the Landmarks Framework method
       
   108         * to signal the finalizing the encode process.
       
   109         */
       
   110         void FinalizeEncodingL();
       
   111 
       
   112         /**
       
   113         * Checks if any Active Object is already running. This is used whenever
       
   114         * a new Active Object operation is started.
       
   115         */
       
   116         void LeaveIfInUseL();
       
   117 
       
   118         /**
       
   119         * Instantiates iEncoder & prepares file to which encoded data is written.
       
   120         */
       
   121         void PrepareEncoderL(const TDesC& aFileName);
       
   122 
       
   123     private:  // Constructors and destructor
       
   124         /**
       
   125         * C++ default constructor.
       
   126         * @param aDb landmark database
       
   127         * @param aObserver calling class sets itself as the observer to this class
       
   128         * @param aProgressNote Note to show the progress of landmark encoding process
       
   129         * @return newly instantiated object
       
   130         */
       
   131         CLmkEncoder( CPosLandmarkDatabase& aDb,
       
   132                     MLmkAOOperationObserver& aObserver,
       
   133                     TBool aProgressNote );
       
   134 
       
   135         /**
       
   136 		* By default Symbian 2nd phase constructor is private.
       
   137         * @param aFile
       
   138 		*/
       
   139         void ConstructL();
       
   140 
       
   141     private:    // Data
       
   142         ///Ref:
       
   143         CPosLandmarkDatabase& iDb;
       
   144 
       
   145         ///Ref:
       
   146         MLmkAOOperationObserver& iObserver;
       
   147 
       
   148         TBool iProgressNote;
       
   149 
       
   150         TBool iExporting; // detailed encoder status
       
   151 
       
   152         ///Own: EPos encoder
       
   153         CPosLandmarkEncoder* iEncoder;
       
   154 
       
   155         ///Own:
       
   156         CLmkAOOperation* iAOOperation;
       
   157     };
       
   158 
       
   159 #endif      // CLMKENCODER_H
       
   160 
       
   161 // End of File