phonebookengines/cntmaptileservice/inc/cntmaptiledblookuptable.h
changeset 25 76a2435edfd4
child 46 efe85016a067
equal deleted inserted replaced
24:0ba2181d7c28 25:76a2435edfd4
       
     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( NCntColFilePath, "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 KColumncntUid = 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 Contact
       
    63     TUint32 icntUid; 
       
    64     
       
    65     // File Path
       
    66     TFileName iFilePath;
       
    67 };
       
    68 
       
    69 /**
       
    70  *  Defines uid source type
       
    71  */
       
    72 enum TUidSourceType
       
    73 {
       
    74     /** Uid Source type contacts default/prefered address */
       
    75     ESourceContactsPref  = 3,
       
    76     /** Uid Source type contacts work address */
       
    77     ESourceContactsWork,
       
    78     /** Uid Source type contacts home address */
       
    79     ESourceContactsHome,
       
    80 };
       
    81 
       
    82 /**
       
    83  * CLookupMapTileDatabase class.
       
    84  * This class handles all the operations related to maptile lookup database.
       
    85  *
       
    86  */
       
    87 class CLookupMapTileDatabase : public CBase
       
    88 {
       
    89 public:
       
    90  
       
    91     /**
       
    92     * This is a static function, which creates and returns an instance of this class.
       
    93     */
       
    94     static CLookupMapTileDatabase* NewL( const TDesC& aLookupTableName );
       
    95 
       
    96     /**
       
    97     * This is a static function, which creates and returns an instance of this class. 
       
    98     * Pushes the created object to the cleanup stack.
       
    99     */
       
   100     static CLookupMapTileDatabase* NewLC( const TDesC& aLookupTableName );
       
   101 
       
   102     /**
       
   103     * Destructor
       
   104     */
       
   105     ~CLookupMapTileDatabase();
       
   106 
       
   107 public:
       
   108   
       
   109    /**
       
   110     * Finds an entry in the lookup table.
       
   111     * @param[in/out] aLookupItem The lookup item to be found in the database.
       
   112     * The source iUid is passed in the lookup item
       
   113     */
       
   114     void FindEntryL( TLookupItem& aLookupItem );
       
   115 
       
   116 private:
       
   117     
       
   118     // default constructor
       
   119     CLookupMapTileDatabase();
       
   120     
       
   121     // Second phase constructor
       
   122     void ConstructL( const TDesC& aLookupTableName );
       
   123     
       
   124 private:
       
   125     
       
   126     // Handle to the items database
       
   127     RDbNamedDatabase iItemsDatabase;
       
   128     
       
   129     // handle to the file session
       
   130     RFs iFsSession;
       
   131         
       
   132     // holds the database file name
       
   133     TFileName iDbFileName;
       
   134     
       
   135     // holds the info about database existence.
       
   136     TBool iDatabaseExists;
       
   137 
       
   138 };
       
   139 
       
   140 
       
   141 #endif  // __MAPTILEDBLOOKUPTABLE_H__`
       
   142 
       
   143 // End of file
       
   144