devmngt_plat/services_db_api/inc/services_db.h
changeset 0 254040eb3b7d
equal deleted inserted replaced
-1:000000000000 0:254040eb3b7d
       
     1 /*
       
     2 * Copyright (c) 2005-2006 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:  Implementation of class CServicesDB
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef SERVICES_DB_H
       
    21 #define SERVICES_DB_H
       
    22 
       
    23 #include <e32def.h>
       
    24 #include <e32base.h>
       
    25 
       
    26 class TResourceReader;
       
    27  
       
    28 /**
       
    29  *  API for retrieving various localized strings associated with services.
       
    30  *
       
    31  *  This class receives a resource ID during construction (resource type is DAS_SERVICES)
       
    32  *  and retrieves various info defined in this resource. 
       
    33  *
       
    34  *  @lib defaultappclient.dll
       
    35  *  @since S60 v5.0
       
    36  */
       
    37 class CServicesDB : public CBase
       
    38     {
       
    39 
       
    40 public:
       
    41     /**
       
    42      * Symbian OS two-phased constructor
       
    43      * @return
       
    44      */
       
    45     IMPORT_C static CServicesDB* NewL( TResourceReader* aResReader );
       
    46     
       
    47     /**
       
    48      * Symbian OS two-phased constructor
       
    49      * @return
       
    50      */
       
    51     IMPORT_C static CServicesDB* NewLC( TResourceReader* aResReader );
       
    52 
       
    53     /**
       
    54      * Destructor.
       
    55      */
       
    56     IMPORT_C ~CServicesDB();
       
    57     
       
    58 public:
       
    59 
       
    60     /**
       
    61      * Returns the number of available services 
       
    62      * (the number of services read from the resource during construction)
       
    63      *
       
    64      * @since S60 v5.0
       
    65      * @return number of available services/elements
       
    66      */
       
    67     IMPORT_C TInt Count() const;
       
    68     
       
    69     /**
       
    70      * Function to return the Uid of a service (by index).
       
    71      *
       
    72      * @since S60 v5.0
       
    73      * @return the uid of the service (it leaves if aIndex is not a valid index)
       
    74      */
       
    75     IMPORT_C TUid ServiceUidL(TInt aIndex) const;
       
    76     
       
    77     /**
       
    78      * Function to return the localized name associated with a service. If the returned 
       
    79      * strings accepts a parameter, this can be specified as aParam
       
    80      *
       
    81      * @since S60 v5.0
       
    82      * @param aIndex the index of the service
       
    83      * @param aParam parameter for the localized string
       
    84      * @return the localized name (it leaves if aIndex is not a valid index)
       
    85      */
       
    86     IMPORT_C HBufC* ServiceStringLC(TInt aIndex, const TDes& aParam) const;
       
    87     
       
    88     /**
       
    89      * Function to return the localized name associated with a service. If the returned 
       
    90      * strings accepts a parameter, this can be specified as aParam
       
    91      *
       
    92      * @since S60 v5.0
       
    93      * @param aServiceUid the Uid of the service
       
    94      * @param aParam parameter for the localized string
       
    95      * @return the localized name (NULL, if the service is not found)
       
    96      */
       
    97     IMPORT_C HBufC* ServiceStringLC(TUid aServiceUid, const TDes& aParam) const;
       
    98     
       
    99     /**
       
   100      * Function to return the generic name of a service. 
       
   101      *
       
   102      * @since S60 v5.0
       
   103      * @param aIndex the index of the service
       
   104      * @return the generic name of the service (it leaves if aIndex is not a valid index)
       
   105      */
       
   106     IMPORT_C HBufC* ServiceNameLC(TInt aIndex) const;
       
   107     
       
   108     /**
       
   109      * Function to return the generic name of a service. 
       
   110      *
       
   111      * @since S60 v5.0
       
   112      * @param aServiceUid the Uid of the service
       
   113      * @return the generic name of the service (NULL, if the service is not found)
       
   114      */
       
   115     IMPORT_C HBufC* ServiceNameLC(TUid aServiceUid) const;
       
   116     
       
   117 private:
       
   118     
       
   119     /**
       
   120      * C++ default constructor.
       
   121      */
       
   122     CServicesDB();
       
   123     
       
   124     /**
       
   125      * Symbian constructor.
       
   126      */
       
   127     void ConstructL( TResourceReader* aResReader );
       
   128         
       
   129 private:
       
   130     /**
       
   131      * array of service Uids
       
   132      */
       
   133     RArray<TInt> iServiceUids;
       
   134     
       
   135     /**
       
   136      * array of service names
       
   137      */
       
   138     RPointerArray<HBufC> iServiceNames;
       
   139     
       
   140     /**
       
   141      * array of service localized names
       
   142      */
       
   143     RPointerArray<HBufC> iServiceLoc;
       
   144     };
       
   145 
       
   146 #endif // SERVICES_DB_H