phonebookengines/cntmaptileservice/inc/cntmaptiledblookuptable.h
changeset 61 d30183af6ca6
parent 56 d508aa856878
child 66 554fe4dbbb59
equal deleted inserted replaced
56:d508aa856878 61:d30183af6ca6
     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 #include "cntmaptileservice.h"
       
    27 
       
    28 // maptile database column names
       
    29 _LIT( NCntColUid, "cntuid" );
       
    30 _LIT( NCntColFilePath, "filepath" );
       
    31 _LIT( NColSource, "source" );
       
    32 _LIT( NColMaptileStatus, "fetchingstatus" );
       
    33 
       
    34 // maptile lookup database name
       
    35 _LIT( KMapTileLookupDatabaseName, "mylocationsmaptilelookup.db" );
       
    36 
       
    37 // maptile database table name
       
    38 _LIT( KMapTileLookupTable, "cntmaptilelookuptable" );
       
    39 
       
    40 _LIT( KLookupDbPath, "c:\\mylocations\\" );
       
    41 
       
    42 // uid column number
       
    43 const TInt KColumncntUid = 1;
       
    44 // source type column number
       
    45 const TInt KColumnSource = 2;
       
    46 // maptile image path column number
       
    47 const TInt KColumnFilePath = 3;
       
    48 // maptile status column number
       
    49 const TInt KColumnMapTileFetchingStatus = 4;
       
    50 
       
    51 
       
    52 /**
       
    53  *  Maptile database lookup entry
       
    54  */
       
    55 class TLookupItem                            
       
    56 {
       
    57 public:
       
    58     // Uid of the source entry
       
    59     TUint32 iUid; 
       
    60     
       
    61     // Source type
       
    62     TUint32 iSource;
       
    63     
       
    64     // File Path
       
    65     TFileName iFilePath;
       
    66     
       
    67     //Map tile fetching status
       
    68     TUint32 iFetchingStatus;    
       
    69 };
       
    70 
       
    71 /**
       
    72  * CLookupMapTileDatabase class.
       
    73  * This class handles all the operations related to maptile lookup database.
       
    74  *
       
    75  */
       
    76 class CLookupMapTileDatabase : public CBase
       
    77 {
       
    78 public:
       
    79  
       
    80     /**
       
    81     * This is a static function, which creates and returns an instance of this class.
       
    82     */
       
    83     static CLookupMapTileDatabase* NewL( const TDesC& aLookupTableName );
       
    84 
       
    85     /**
       
    86     * This is a static function, which creates and returns an instance of this class. 
       
    87     * Pushes the created object to the cleanup stack.
       
    88     */
       
    89     static CLookupMapTileDatabase* NewLC( const TDesC& aLookupTableName );
       
    90 
       
    91     /**
       
    92     * Destructor
       
    93     */
       
    94     ~CLookupMapTileDatabase();
       
    95 
       
    96 public:
       
    97   
       
    98    /**
       
    99     * Finds an entry in the lookup table.
       
   100     * @param[in/out] aLookupItem The lookup item to be found in the database.
       
   101     * The source iUid is passed in the lookup item
       
   102     */
       
   103     void FindEntryL( TLookupItem& aLookupItem );
       
   104     
       
   105    /**
       
   106     * Finds number of address associated with an contact id.
       
   107     * @param[in] aId The contact id .
       
   108     * @return Number of address a contact has.
       
   109     */
       
   110     int FindNumberOfAddressL( int& aId );
       
   111 
       
   112 #ifdef CNTMAPTILESERVICE_UNIT_TEST
       
   113 public:
       
   114 #else     
       
   115 private:
       
   116 #endif  
       
   117     // default constructor
       
   118     CLookupMapTileDatabase();
       
   119     
       
   120     // Second phase constructor
       
   121     void ConstructL( const TDesC& aLookupTableName );
       
   122 
       
   123     
       
   124 #ifdef CNTMAPTILESERVICE_UNIT_TEST
       
   125 public:
       
   126 #else     
       
   127 private:
       
   128 #endif  
       
   129     
       
   130     // Handle to the items database
       
   131     RDbNamedDatabase iItemsDatabase;
       
   132     
       
   133     // handle to the file session
       
   134     RFs iFsSession;
       
   135         
       
   136     // holds the database file name
       
   137     TFileName iDbFileName;
       
   138     
       
   139     // holds the info about database existence.
       
   140     TBool iDatabaseExists;
       
   141 
       
   142 };
       
   143 
       
   144 #endif  // __MAPTILEDBLOOKUPTABLE_H__`
       
   145 
       
   146 // End of file
       
   147