locationdataharvester/maptileservice/inc/maptiledblookuptable.h
changeset 17 0f22fb80ebba
child 26 f3533f6eae3f
equal deleted inserted replaced
15:13ae750350c9 17:0f22fb80ebba
       
     1 /*
       
     2 * Copyright (c) 2010 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: 
       
    15 *     Retrieving maptile path from lookup db
       
    16 *
       
    17 */
       
    18 
       
    19 #ifndef __MAPTILEDBLOOKUPTABLE_H__
       
    20 #define __MAPTILEDBLOOKUPTABLE_H__
       
    21 
       
    22 //Headers needed
       
    23 #include <f32file.h> //RFs
       
    24 #include <d32dbms.h>  //RDbNamedDatabase,RDbView 
       
    25 
       
    26 // maptile database column names
       
    27 _LIT( NCntColUid, "cntuid" );
       
    28 _LIT( NAppColFilePath, "filepath" );
       
    29 _LIT( NColSource, "source" );
       
    30 
       
    31 // maptile lookup database name
       
    32 _LIT( KMapTileLookupDatabaseName, "mylocationsmaptilelookup.db" );
       
    33 
       
    34 // maptile database table name
       
    35 _LIT( KMapTileLookupTable, "cntmaptilelookuptable" );
       
    36 
       
    37 _LIT( KLookupDbPath, "c:\\mylocations\\" );
       
    38 
       
    39 // uid column number
       
    40 const TInt KColumnUid = 1;
       
    41 // source type column number
       
    42 const TInt KColumnSource = 2;
       
    43 // source type column number
       
    44 const TInt KColumnFilePath = 3;
       
    45 
       
    46 
       
    47 /**
       
    48  *  Maptile database lookup entry
       
    49  */
       
    50 class TLookupItem                            
       
    51 {
       
    52 public:
       
    53     // Uid of the source entry
       
    54     TUint32 iUid; 
       
    55     
       
    56     // Source type
       
    57     TUint32 iSource;
       
    58     
       
    59     // Landmark uid in the landmarks database
       
    60     TUint32 iLmId;
       
    61     
       
    62     // Uid of the Application
       
    63     TUint32 iAppUid; 
       
    64     
       
    65     // File Path
       
    66     TFileName iFilePath;
       
    67 };
       
    68 
       
    69 /**
       
    70  *  Defines uid source type
       
    71  */
       
    72 enum TUidSourceType
       
    73 {    
       
    74     /** Uid Source type calendar plain address */
       
    75     ESourceCalendar = 0,
       
    76     /** Uid Source type contacts default/prefered address */
       
    77     ESourceContactsPref = 3,
       
    78     /** Uid Source type contacts work address */
       
    79     ESourceContactsWork,
       
    80     /** Uid Source type contacts home address */
       
    81     ESourceContactsHome,
       
    82     
       
    83 };
       
    84 
       
    85 /**
       
    86  * CLookupMapTileDatabase class.
       
    87  * This class handles all the operations related to maptile lookup database.
       
    88  *
       
    89  */
       
    90 class CLookupMapTileDatabase : public CBase
       
    91 {
       
    92 public:
       
    93  
       
    94     /**
       
    95     * This is a static function, which creates and returns an instance of this class.
       
    96     */
       
    97     static CLookupMapTileDatabase* NewL( const TDesC& aLookupTableName );
       
    98 
       
    99     /**
       
   100     * This is a static function, which creates and returns an instance of this class. 
       
   101     * Pushes the created object to the cleanup stack.
       
   102     */
       
   103     static CLookupMapTileDatabase* NewLC( const TDesC& aLookupTableName );
       
   104 
       
   105     /**
       
   106     * Destructor
       
   107     */
       
   108     ~CLookupMapTileDatabase();
       
   109 
       
   110 public:
       
   111   
       
   112    /**
       
   113     * Finds an entry in the lookup table.
       
   114     * @param[in/out] aLookupItem The lookup item to be found in the database.
       
   115     * The source iUid is passed in the lookup item
       
   116     */
       
   117     void FindEntryL( TLookupItem& aLookupItem );
       
   118 
       
   119 private:
       
   120     
       
   121     // default constructor
       
   122     CLookupMapTileDatabase();
       
   123     
       
   124     // Second phase constructor
       
   125     void ConstructL( const TDesC& aLookupTableName );
       
   126 
       
   127 private:
       
   128     
       
   129     // Handle to the items database
       
   130     RDbNamedDatabase iItemsDatabase;
       
   131     
       
   132     // handle to the file session
       
   133     RFs iFsSession;
       
   134         
       
   135     // holds the database file name
       
   136     TFileName iDbFileName;
       
   137     
       
   138     // holds the info about database existence.
       
   139     TBool iDatabaseExists;
       
   140 
       
   141 };
       
   142 
       
   143 
       
   144 #endif  // __MAPTILEDBLOOKUPTABLE_H__`
       
   145 
       
   146 // End of file
       
   147