locationdataharvester/mylocationsengine/inc/lookupmaptiledb.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: Maptile database lookup table header.
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef __LOOKUPMAPTILEDB_H__
       
    19 #define __LOOKUPMAPTILEDB_H__
       
    20 
       
    21 //Headers needed
       
    22 #include <f32file.h> //RFs
       
    23 #include <d32dbms.h>  //RDbNamedDatabase,RDbView 
       
    24 
       
    25 #include "mylocationsdefines.h"
       
    26  
       
    27 /**
       
    28  * CLookupMapTileDatabase class.
       
    29  * This class handles all the operations related to maptile lookup database.
       
    30  *
       
    31  */
       
    32  
       
    33 class CLookupMapTileDatabase : public CBase
       
    34 {
       
    35 public:
       
    36     // Two phase constructors
       
    37  
       
    38     /**
       
    39     * This is a static function, which creates and returns an instance of this class.
       
    40     */
       
    41     static CLookupMapTileDatabase* NewL( const TDesC& aLookupTableName );
       
    42 
       
    43     /**
       
    44     * This is a static function, which creates and returns an instance of this class. Pushes the created object 
       
    45     * to the cleanup stack.
       
    46     */
       
    47     static CLookupMapTileDatabase* NewLC( const TDesC& aLookupTableName );
       
    48 
       
    49     /**
       
    50     * Destructor
       
    51     */
       
    52     ~CLookupMapTileDatabase();
       
    53 
       
    54 public:
       
    55 
       
    56     /**
       
    57     * Opens the lookup database.
       
    58     */
       
    59     TInt Open();
       
    60 
       
    61     /**
       
    62     * Closes the lookup database.
       
    63     */
       
    64     void Close();
       
    65 
       
    66     /**
       
    67     * Creates an entry in the lookup table.
       
    68     * @param[in] aLookupItem The lookup item to be created in the database.
       
    69     */
       
    70     void CreateEntryL( const TLookupItem& aLookupItem );
       
    71 
       
    72     /**
       
    73     * Updates an entry in the lookup table.
       
    74     * @param[in] aLookupItem The lookup item to be updated in the database.
       
    75     */
       
    76     void UpdateEntryL( const TLookupItem& aLookupItem );
       
    77 
       
    78     /**
       
    79     * Deletes an entry from the lookup table.
       
    80     * @param[in] aLookupItem The lookup item to be deleted from the database.
       
    81     */
       
    82     void DeleteEntryL( const TLookupItem& aLookupItem );
       
    83 
       
    84     /**
       
    85     * Finds an entry in the lookup table.
       
    86     * @param[in/out] aLookupItem The lookup item to be found in the database. The source iUid is passed
       
    87     * in the lookup item
       
    88     * @return ETrue if found, else EFalse
       
    89     */
       
    90     TBool FindEntryL( TLookupItem& aLookupItem);
       
    91 
       
    92 
       
    93 
       
    94 private:
       
    95     
       
    96     // default constructor
       
    97     CLookupMapTileDatabase();
       
    98     
       
    99     // Second phase constructor
       
   100     void ConstructL( const TDesC& aLookupTableName );
       
   101     
       
   102     // Creates a lookup table in the lookup database.
       
   103     void CreateTableL(RDbDatabase& aDatabase);
       
   104           
       
   105 private:
       
   106     
       
   107     // Handle to the items database
       
   108     RDbNamedDatabase iItemsDatabase;
       
   109     
       
   110     // handle to the file session
       
   111     RFs iFsSession;
       
   112         
       
   113     // holds the database file name
       
   114     TFileName iDbFileName;
       
   115 
       
   116 };
       
   117 
       
   118 
       
   119 #endif  // __LOOKUPMAPTILEDB_H__
       
   120 
       
   121 // End of file
       
   122