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