kernel/eka/drivers/hcr/hcr_pil.h
changeset 43 96e5fb8b040d
child 45 329ab0095843
equal deleted inserted replaced
-1:000000000000 43:96e5fb8b040d
       
     1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of the License "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // Hardware Configuration Respoitory Platform Independent Layer (PIL)
       
    15 //
       
    16 
       
    17 /**
       
    18 @file hcr_pil.h
       
    19 Kernel side definitions for the HCR Platform Indepent Layer. 
       
    20 
       
    21 @internalTechnology
       
    22 */
       
    23 
       
    24 #ifndef HCR_PIL_H
       
    25 #define HCR_PIL_H
       
    26 
       
    27 
       
    28 // -- INCLUDES ----------------------------------------------------------------
       
    29 
       
    30 
       
    31 #include <e32def.h>
       
    32 #include <e32err.h> 
       
    33 
       
    34 #include "hcr_hai.h"
       
    35 
       
    36 
       
    37 // -- CLASSES -----------------------------------------------------------------
       
    38 
       
    39 namespace HCR
       
    40 {
       
    41 
       
    42     class TRepository;
       
    43 
       
    44 
       
    45     /**< Mask for testing for word size settings */
       
    46     static const TInt KMaskWordTypes = 0x0000FFFF;      
       
    47 
       
    48     /**< Mask for testing for large settings */  
       
    49     static const TInt KMaskLargeTypes = 0xFFFF0000;
       
    50 
       
    51     
       
    52 	/**
       
    53 	 *  Class implements the reference to the setting, it consists of two
       
    54 	 * pointers to the repository where the setting is set and to the setting
       
    55 	 * data itself.   
       
    56 	 */
       
    57 	class TSettingRef
       
    58 		{
       
    59 	public:
       
    60 
       
    61 	    /**
       
    62 	     *  Default C++ constructor. It initiates the reference class 
       
    63 	     * object with the reference structure data.
       
    64 	     * @param aSetRef          Reference Setting data 
       
    65 	     */
       
    66 	    TSettingRef()
       
    67 	        {iRep = NULL; iSet = NULL;}
       
    68 	    
       
    69 	    /**
       
    70 	     *  C++ constructor. It initiates the the reference class object 
       
    71 	     * @param  aRepos          Pointer to the settings repository
       
    72 	     * @param  aSetting        Pointer to the setting
       
    73 	     */
       
    74 	    TSettingRef(TRepository* aRepos, SSettingBase* aSetting)
       
    75 			{ iRep = aRepos; iSet = aSetting; }
       
    76 	    
       
    77 	   
       
    78 	        
       
    79 	    /**
       
    80 	     *   C++ destructor.
       
    81 	     */
       
    82         ~TSettingRef()
       
    83         	{ }
       
    84         
       
    85 	public:
       
    86 	    /**< Pointer to the repository*/
       
    87 	    TRepository*  iRep;
       
    88 	    /**< Pointer to the setting*/
       
    89 	    SSettingBase* iSet;
       
    90 		};
       
    91 	
       
    92 
       
    93 	//Disable WINS (old Visual C++) warning
       
    94 	#pragma warning(disable:4284)
       
    95 	/**
       
    96 	 * Internal HCR, SafeArray (TSa) class. 
       
    97 	 * Safe Array implementation is based on a smart pointer
       
    98 	 * pattern which wraps the pointer by the template class and give it a new
       
    99 	 * flavour. In this case it guarantees that the heap allocated array 
       
   100 	 * associated with the class instance variable pointer will be deallocated 
       
   101 	 * during stack unwinding.
       
   102 	 * IMPORTANT! 
       
   103 	 * Please don't instantiate this class on the heap as this will break the 
       
   104 	 * functionality of this class. Operator [] does not check the boundary of
       
   105 	 * the array, consider safe array implementation as a simple replacement of
       
   106 	 * standard pointer with all its drawbacks.
       
   107 	 */
       
   108 
       
   109 	template <typename T>
       
   110 	    class TSa
       
   111 	        {
       
   112 	        public:
       
   113 	            /** 
       
   114 	             *  Default constructor.
       
   115 	             * During initialization it sets the member variable pointer iSa
       
   116 	             * to NULL. 
       
   117 	             */
       
   118 	            inline TSa() :iSa(NULL){}
       
   119 	            
       
   120 	            /**
       
   121 	             *  Costructor with a pointer initialization with 
       
   122 	             * already allocated pointer.
       
   123 	             * The member variable pointer iSa is initialized with the 
       
   124 	             * pointer provided by function parameter. Ownership is moved to
       
   125 	             * safe pointer object and source pointer is reset to NULL.
       
   126 	             * 
       
   127 	             * @param  aP      Pointer to a heap allocated array of element 
       
   128 	             *                 with type T. 
       
   129 	             */
       
   130 	            inline TSa(T* aP) {iSa = aP;}
       
   131 	            
       
   132 	            /**
       
   133 	             *  operator()() returns an address to the array  
       
   134 	             * maintained by this SafeArray object.
       
   135 	             * It can be usefull when it's necessary to get the pointer  
       
   136 	             * value, for instance passing as function parameter.
       
   137 	             * @return         Pointer to the first element of the 
       
   138 	             *                 maintained array of elements of type T. 
       
   139 	             *  
       
   140 	             */
       
   141 	            inline T* operator ()(){return iSa;}
       
   142 	         
       
   143 	            /**
       
   144 	             * operator=() changes the memory ownership by   
       
   145 	             * reinitiazing SafeArray class object with the address to   
       
   146 	             * already allocated array. The original heap allocation  
       
   147 	             * associated with this SafeArray object is deallocated before
       
   148 	             * reassignment. It's implemented in hcr_pil.cpp.
       
   149 	             * @param  aP      Pointer to the already allocated array of
       
   150 	             *                 elements of the type T.
       
   151 	             * @return         Reference to (*this) object.
       
   152 	             */
       
   153 	             TSa<T>& operator=(T* aP);
       
   154 	                
       
   155 	            
       
   156 	            /**
       
   157 	             * operator[]() returns the reference to the element of 
       
   158 	             * array maintained by this SafeArray object at position defined
       
   159 	             * by aIndex function parameter. 
       
   160 	             * @param  aIndex      Position of the element within SafeArray
       
   161 	             * @return             Reference to the element from the array
       
   162 	             */
       
   163 	            inline T& operator[](TInt aIndex){return *(iSa + aIndex);}
       
   164 	            
       
   165 	            /**
       
   166 	             *  operator[]() - constant version. Returns the constant 
       
   167 	             * reference to the element of the array.
       
   168 	             * @param  aIndex      Position of the element within SafeArray
       
   169 	             * @return             Constant reference to the element from 
       
   170 	             *                     array 
       
   171 	             */
       
   172 	            inline const T& operator[](TInt aIndex) const {return *(iSa + aIndex);}
       
   173 	           
       
   174 	             
       
   175 	            /**
       
   176 	             *  Destructor
       
   177 	             */
       
   178 	            ~TSa();
       
   179 	                
       
   180 	                        
       
   181 	        private:
       
   182 	            /**
       
   183 	             *  Copy constructor must not be called explicitly by the
       
   184 	             * code
       
   185 	             */
       
   186 	            inline TSa(TSa& aSa){}
       
   187 	            
       
   188 	        protected:
       
   189 	            /**< Pointer to the allocated heap array*/
       
   190 	            T*     iSa;
       
   191 	        };
       
   192 #pragma warning(default:4284)
       
   193 	 
       
   194 	                
       
   195     /**
       
   196      *  Internal HCR class, object of this class is created by the kernel 
       
   197      * when the kernel extensions are loaded and initialized.
       
   198      */
       
   199     class HCRInternal
       
   200         {
       
   201     public:       
       
   202 
       
   203         /**
       
   204          * Internal HCR states
       
   205          */
       
   206         enum States 
       
   207             {
       
   208             EStatUndef              = 0x00000000,
       
   209             EStatNotReady           = 0x00010000,
       
   210             EStatConstructed        = EStatNotReady + 0x0001,
       
   211             EStatVariantInitialised = EStatNotReady + 0x0002,
       
   212             EStatInitialised        = EStatNotReady + 0x0004,
       
   213 
       
   214             EStatReady              = 0x00020000,
       
   215 
       
   216             EStatFailed             = 0x00800000,
       
   217 
       
   218             EStatMajornMask         = 0xFFFF0000,
       
   219             EStatMinorMask          = 0x0000FFFF
       
   220             };
       
   221 
       
   222         // For Test
       
   223         enum TReposId
       
   224             {
       
   225             ECoreRepos = 1,
       
   226             EOverrideRepos
       
   227             };
       
   228 
       
   229     public:
       
   230         /**
       
   231          *  Default C++ constructor.
       
   232          */
       
   233         HCRInternal();
       
   234         
       
   235         /**
       
   236          *  C++ constructor with passing MVariant object for further  
       
   237          * instance variable initialization.
       
   238          */
       
   239 		HCRInternal(HCR::MVariant* aVar);
       
   240 		
       
   241 		/**
       
   242 		 *  C++ destructor.
       
   243 		 */
       
   244         ~HCRInternal();
       
   245      
       
   246         /**
       
   247          *  The method initializes  internal instance variable pointers
       
   248          * to the addresses of repositories by getting them via call to Variant 
       
   249          * object functional API.
       
   250          * @return          
       
   251          *  - KErrNone        No errors reported
       
   252          *  - KErrGeneral     Internal HCR fault
       
   253          *  - KErrArgument    Programming error in PSL, ptr/rc 
       
   254          *                    mismatch
       
   255          *  - KErrNoMemory    Memory allocation failure
       
   256          */
       
   257         TInt Initialise();
       
   258 
       
   259         /**
       
   260          *  Based on the input parameter aId it switches the selected repository 
       
   261          * to the given name. It is searching the new repository file in 
       
   262          * \sys\bin and \sys\Data respectively. It keeps the original value of 
       
   263          * the repository if the file not found.
       
   264          * @param aFileName     The zero terminated, c-style ASCII string of the 
       
   265          *                      new repository file without path. If the name is
       
   266          *                      an empty string (NULL) the it deletes the 
       
   267          *                      repository object
       
   268          * @param aId         The internal repository identifier (see TReposId)
       
   269          * @return 
       
   270          *  - KErrNone          if successful, the selected internal repository  
       
   271          *                      variables point to the new HCR or the referenced 
       
   272          *                      repository object deleted.
       
   273          *  - KErrNotFound      if the new repository file not found.
       
   274          *  - KErrNotSupported  if repository identifier not supported
       
   275          */      
       
   276         TInt SwitchRepository(const TText * aFileName, const TReposId aId=ECoreRepos);
       
   277 
       
   278         
       
   279         /**
       
   280          *  Internal HCR method checks all repositories integrity.
       
   281          * @return
       
   282          *  - KErrNone          Successful, no errors reported
       
   283          *  - KErrAlreadyExist  Check for the setting duplicates fails
       
   284          *  - KErrCorrupt       One of the repositories was found to be corrupt 
       
   285          *                      e.g. repository header incorrect, settings not 
       
   286          *                      ordered etc
       
   287          */
       
   288         TInt CheckIntegrity();
       
   289 
       
   290         /**
       
   291          * Internal HCR method returns a current HCR state.
       
   292          * @return Current HCR composite status flag data member, @see States 
       
   293          *         for more details
       
   294          */
       
   295         TUint32 GetStatus();
       
   296         
       
   297         /**
       
   298          *  The method searches the given setting defined by aId parameter
       
   299          * and with the type defined by aType parameter. Reference setting data
       
   300          * is returned in aSetting output parameter. The search procedure is 
       
   301          * performed through all enabled repositories. It starts looking in 
       
   302          * Override first, then if setting is not found it goes to CoreImg and
       
   303          * in the end in Variant repository.
       
   304          * @param   aId         in: setting to find
       
   305          * @param   aType       in: required type
       
   306          * @param   aSetting    out: found setting reference data
       
   307          * @return              The following errors are returned:
       
   308          *     - KErrNone         It successfuly ends, no errors are reported
       
   309          *     - KErrNotFound     The setting was not found
       
   310          *     - KErrArgument     The found setting type does not match the aType
       
   311          */
       
   312         TInt FindSetting(const TSettingId& aId, TSettingType aType,
       
   313                                                         TSettingRef& aSetting);
       
   314         
       
   315         /**
       
   316          *  Internal HCR helper method finds setting and its type.
       
   317          * @param   aId         in:  setting id to find
       
   318          * @param   aType       out: found setting type. If the setting is  
       
   319          *                      not found, the returned value is set to 
       
   320          *                      ETypeUndefined
       
   321          * @param   aSetting    out: found setting data
       
   322          * @return               The following errors can be returned:
       
   323          *     - KErrNone       It successfuly ends, no errors are reported
       
   324          *     - KErrNotFound   The setting was not found
       
   325          */
       
   326         TInt FindSettingWithType(const TSettingId& aId, TSettingType& aType,
       
   327                                  TSettingRef& aSetting);
       
   328 
       
   329        
       
   330         /**
       
   331          *  Internal helper method search all the word settings provided
       
   332          * in aIds[] settings array. The search procedure starts from Override
       
   333          * store, if the setting is not found there, it goes through the CoreImg
       
   334          * and finaly ends up in the Variant data.
       
   335          * @param   aNum        in: number of settings to find
       
   336          * @param   aIds        in: array of settings to find
       
   337          * @param   aValues     out: all found settings values are written  
       
   338          *                      back to this array. If the setting is not found
       
   339          *                      the returned setting value is set to 0
       
   340          * @param   aTypes      out: If this array is provided by upper user,
       
   341          *                      the setting types are written back to this array.
       
   342          *                      If the element is not found, its type is set to
       
   343          *                      ETypeUndefined. 
       
   344          * @param   aErrors     out: user must always provide this array, 
       
   345          *                      where the method will report the search result 
       
   346          *                      for each individual setting. There are three 
       
   347          *                      possible values:
       
   348          *                      - KErrNone  Setting is found, no errors reported
       
   349          *                      - KErrNotFound Setting is not found
       
   350          *                      - KErrErrArgument Found setting has larger than
       
   351          *                        four bytes size
       
   352          * @return  The following errors can be returned:
       
   353          *  - Zero or positive number of settings found in category, -ve on error
       
   354          *  - KErrArgument if some parameters are wrong(i.e. aErrors is a null
       
   355          *                   pointer, aNum is negative and so on) 
       
   356          *  - KErrNotReady if the HCR is used before it has been initialised
       
   357          *  - KErrCorrupt  if HCR finds a repository to be corrupt
       
   358          *  - KErrGeneral  if an internal failure occurs, see trace
       
   359          *  
       
   360          * @pre Caller must invoke this function inside the thread critical 
       
   361          *      section to let the method finish its job. It avoids memory leak 
       
   362          *      in case of possible client thread termination. 
       
   363          */
       
   364         TInt GetWordSettings(TInt aNum, const SSettingId aIds[], TInt32 aValues[],
       
   365                                 TSettingType aTypes[], TInt aErrors[]);
       
   366         
       
   367         /**
       
   368          *  Internal HCR method returns the number of settings in the specified
       
   369          * category.
       
   370          * @param aCatUid   in: The setting identifier category to use in the 
       
   371          *                      search
       
   372          * @return 
       
   373          *  - Zero or positive number of settings found in category, -ve on error
       
   374          *  - KErrNotReady if the HCR is used before it has been initialised
       
   375          *  - KErrCorrupt if HCR finds a repository to be corrupt
       
   376          *  - KErrGeneral if an internal failure occurs, see trace
       
   377          */
       
   378         TInt FindNumSettingsInCategory (TCategoryUid aCatUid);
       
   379         
       
   380         
       
   381         /**
       
   382          * Internal HCR method searches all elements within the specified 
       
   383          * category aCatUid.
       
   384          * @param aCatUid   in: The setting identifier category to use in the search
       
   385          * @param aMaxNum   in: The maximum number of settings to return. It is also 
       
   386          *                  the size of the arrays in the following arguments 
       
   387          * @param aElIds    out: Client supplied array populated on exit. Large
       
   388          *                  enough to hold all elements in category.
       
   389          * @param aTypes    out: Client supplied array populated with setting types 
       
   390          *                  enumerations on exit. May be 0 if client is 
       
   391          *                  not interested.
       
   392          * @param aLens     out: Client supplied array populated with setting lengths
       
   393          *                  on exit. May be 0 if client is not interested.
       
   394          *
       
   395          * @return Zero or positive number of settings found in category, -ve on error
       
   396          *  - KErrArgument if some parameters are wrong(i.e. aErrors is a null
       
   397          *                   pointer, aNum is negative and so on)
       
   398          *  - KErrNotReady if the HCR is used before it has been initialised
       
   399          *  - KErrCorrupt  if HCR finds a repository to be corrupt
       
   400          *  - KErrGeneral  if an internal failure occurs, see trace
       
   401          */
       
   402         TInt FindSettings(TCategoryUid aCatUid, 
       
   403                 TInt aMaxNum,  TElementId aIds[],  
       
   404                 TSettingType aTypes[], TUint16 aLens[]);
       
   405 
       
   406 
       
   407         /**
       
   408          *  Internal HCR method finds all the settings within the specified 
       
   409          * category and which matches aMask and aPattern.
       
   410          * @param aCat      in: The category to retrieve settings for
       
   411          * @param aMaxNum   in: The maximum number of settings to retrieve. It  
       
   412          *                  is also the size of the arrays in the following 
       
   413          *                  arguments   
       
   414          * @param aElemMask in: The bits in the Element ID to be checked against 
       
   415          *                  aPattern
       
   416          * @param aPattern  in: Identified the bits that must be set for a 
       
   417          *                  setting to be returned in the search
       
   418          * @param aIds      out: Client supplied array populated on exit. Large
       
   419          *                  enough to hold aMaxNum element ids.
       
   420          * @param aTypes    out: Client supplied array populated with setting types 
       
   421          *                  enumerations on exit. May be 0 if client is 
       
   422          *                  not interested.
       
   423          * @param aLen      out: Client supplied array populated with setting 
       
   424          *                  lengths on exit. May be 0 if client is not interested.
       
   425          * @return 
       
   426          *  - Zero or positive number of settings found in category, -ve on error
       
   427          *  - KErrArgument if some parameters are wrong(i.e. aErrors is a null
       
   428          *                   pointer, aNum is negative and so on) 
       
   429          *  - KErrNotReady if the HCR is used before it has been initialised
       
   430          *  - KErrCorrupt  if HCR finds a repository to be corrupt
       
   431          *  - KErrGeneral  if an internal failure occurs, see trace
       
   432          */
       
   433         TInt FindSettings(TCategoryUid aCat, TInt aMaxNum, 
       
   434                 TUint32 aMask, TUint32 aPattern,  
       
   435                 TElementId aIds[], TSettingType aTypes[], TUint16 aLens[]);
       
   436  
       
   437     private:    
       
   438     	/** Member holding the status of the HCR service */
       
   439         TUint32 iStatus;
       
   440     
       
   441         /** Handle on the variant code in the PSL component part */    
       
   442         HCR::MVariant* iVariant;    
       
   443         
       
   444         /** Compiled settings in the PSL code */
       
   445         TRepository* iVariantStore;
       
   446         
       
   447         /** File settings in the core ROM image */
       
   448         TRepository* iCoreImgStore;
       
   449         
       
   450         /** File settings shadowed in RAM from NAND */
       
   451         TRepository* iOverrideStore;
       
   452         
       
   453         friend class HCRInternalTestObserver;
       
   454 
       
   455         };
       
   456     
       
   457     
       
   458     /**
       
   459      *  Base Repository class. This class defines API needed to be 
       
   460      * implemented in the derived classes.
       
   461      */
       
   462     class TRepository
       
   463         {
       
   464     public: 
       
   465     	// Repository methods		
       
   466 		virtual ~TRepository();
       
   467         virtual TInt CheckIntegrity ()=0;
       
   468         virtual TInt FindSetting (const TSettingId& aId, TSettingRef& aSetting)=0;
       
   469         
       
   470         /**
       
   471          *  Pure virtual function, must implement the search procedure for the
       
   472          * setting in the repository within the bounds defined by aLow and aHigh
       
   473          * parameters. It returns found setting reference data and its position.
       
   474          * @param   aId         in:  Setting to find
       
   475          * @param   aSetting    out: Found setting reference data
       
   476          * @param   aPosition   out: Position the found setting in the repository
       
   477          * @param   aLow        in:  Low index where to start search
       
   478          * @param   aHigh       in:  High index where to end search
       
   479          * @return
       
   480          *  - KErrNone          Successful, no errors were reported 
       
   481          *  - KErrNotFound      Either the repository does not have any settings,
       
   482          *                      and its length is zero or the setting was not
       
   483          *                      found, all output parameters are set to zeros in
       
   484          *                      this case. 
       
   485          */
       
   486         virtual TInt FindSetting (const TSettingId& aId, TSettingRef& aSetting,
       
   487                 TInt32& aPosition, TInt32 aLow, TInt32 aHigh) = 0;
       
   488         
       
   489         /**
       
   490          *  Pure virtual function, must implement the word setting search 
       
   491          * procedure.
       
   492          * @param   aNum        in: Number of settings to be found
       
   493          * @param   aIds        in: An array of setting ids pointers to be found
       
   494          * @param   aValues     out: An array of pointers to the values 
       
   495          *                      populated during search procedure.
       
   496          * @param   aTypes      out: An array of pointers to the types populated
       
   497          *                      during search procedure.
       
   498          * @param   aErrors     out: An array of pointers to the errors populated
       
   499          *                      during search procedure. This can be the following
       
   500          *                      errors:
       
   501          *                          - KErrNone      Successfuly done, no errors 
       
   502          *                            reported
       
   503          *                          - KErrNotFound  The setting was not found
       
   504          *                          - KErrArgument  The found setting type is large
       
   505          *                            than 4 bytes.
       
   506          * @return
       
   507          *  - KErrNone      Successfuly done, no errors reported
       
   508          *  - KErrNotReady  Repository is not ready
       
   509          *  - system wider error
       
   510          */
       
   511         virtual TInt GetWordSettings(TInt aNum, SSettingId* aIds[], 
       
   512                        TInt32* aValues[], TSettingType* aTypes[], 
       
   513                        TInt* aErrors[])=0;
       
   514 
       
   515         /**
       
   516          * Pure virtual function, must return a reference to TSettingRef
       
   517          * structure at specified position within the repository.
       
   518          * @param   aIndex      in: Setting position(index) in the repository
       
   519          * @param   aRef        out: Reference data storage
       
   520          */
       
   521         virtual void GetSettingRef(TInt32 aIndex, TSettingRef& aRef) = 0;
       
   522         
       
   523         /**
       
   524          *  Pure virtual function, must implement the search all elements within 
       
   525          * the defined category.
       
   526          * @param   aCatUid     in: Category id where to search the elements
       
   527          * @param   aFirst      out: Repository index where the first element is
       
   528          *                           situated
       
   529          * @param   aLast       out: Repository index where the last element is
       
   530          *                           situated
       
   531          * @return
       
   532          *  - KErrNone      Successfuly done, no errors were reported
       
   533          *  - KErrNotFound  No any elements were found in this category or repo-
       
   534          *                  sitory is empty
       
   535          */
       
   536         virtual TInt FindNumSettingsInCategory(TCategoryUid aCatUid, 
       
   537                 TInt32& aFirst, TInt32& aLast) = 0;
       
   538         
       
   539        
       
   540         // Setting accessor methods
       
   541         virtual TBool IsWordValue(const TSettingRef& aRef);
       
   542         virtual TBool IsLargeValue(const TSettingRef& aRef);
       
   543         virtual void GetId(const TSettingRef& aRef, TCategoryUid& aCat, TElementId& aKey);
       
   544         virtual void GetId(const TSettingRef& aRef, SSettingId& aId);
       
   545         virtual TInt32 GetType(const TSettingRef& aRef);
       
   546         virtual TUint16 GetLength(const TSettingRef& aRef);
       
   547         
       
   548         virtual void GetSettingInfo(const TSettingRef& aRef, 
       
   549                 TElementId& aId, TSettingType& aType, TUint16& aLen);
       
   550 
       
   551         
       
   552         virtual TInt GetValue(const TSettingRef& aRef, UValueWord& aValue)=0;
       
   553         virtual TInt GetLargeValue(const TSettingRef& aRef, UValueLarge& aValue)=0;
       
   554 
       
   555         };
       
   556     
       
   557     
       
   558     /**
       
   559      * Compoiled repository class
       
   560      */
       
   561     class TRepositoryCompiled : public TRepository
       
   562         {
       
   563     public: 
       
   564         static TRepository* New(const SRepositoryCompiled* aRepos);
       
   565         virtual ~TRepositoryCompiled();
       
   566         
       
   567         virtual TInt CheckIntegrity();
       
   568         
       
   569         virtual TInt FindSetting(const TSettingId& aId, TSettingRef& aSetting);
       
   570         
       
   571         /**
       
   572          *  Pure virtual function defined in the base class TRepository, 
       
   573          * it implements the search procedure for the setting in the repository 
       
   574          * within the bounds defined by aLow and aHigh parameters. It returns 
       
   575          * found setting reference data and its position. Also @see TRepository
       
   576          * for more details. 
       
   577          */
       
   578         virtual TInt FindSetting (const TSettingId& aId, TSettingRef& aSetting,
       
   579                  TInt32& aPosition,TInt32 aLow, TInt32 aHigh);
       
   580         
       
   581                 
       
   582         /** 
       
   583          *  Pure virtual function defined in the base TRepository class,
       
   584          * it implement the word setting search procedure. Also @see TRepository
       
   585          * for more details.
       
   586          */
       
   587         virtual TInt GetWordSettings(TInt aNum, SSettingId* aIds[], 
       
   588                     TInt32* aValues[], TSettingType* aTypes[], TInt* aErrors[]);
       
   589 
       
   590         
       
   591         /**
       
   592          *  This method implements returning a reference to TSettingRef
       
   593          * structure at specified position within the repository. 
       
   594          */
       
   595         virtual  void GetSettingRef(TInt32 aIndex, TSettingRef& aRef);
       
   596         
       
   597         /**
       
   598          *  Pure virtual function defined in the base TRepository class, 
       
   599          *  implements the search for all elements procedure withinthe defined
       
   600          *  category. Also @see TRepository for more details.
       
   601          */
       
   602         virtual TInt FindNumSettingsInCategory(TCategoryUid aCatUid,
       
   603                 TInt32& aFirst, TInt32& aLast);
       
   604         virtual TInt GetValue(const TSettingRef& aRef, UValueWord& aValue);
       
   605         virtual TInt GetLargeValue(const TSettingRef& aRef, UValueLarge& aValue);
       
   606 
       
   607         
       
   608     private:
       
   609         TRepositoryCompiled(const SRepositoryCompiled* aRepos);
       
   610         
       
   611     private:   
       
   612         const SRepositoryCompiled* iRepos;
       
   613         };
       
   614     
       
   615     /**
       
   616     */
       
   617     class TRepositoryFile : public TRepository
       
   618         {
       
   619     public: 
       
   620         static TRepository* New(const SRepositoryFile* aRepos);
       
   621         virtual ~TRepositoryFile();
       
   622         
       
   623         virtual TInt CheckIntegrity();
       
   624         virtual TInt FindSetting(const TSettingId& aId, TSettingRef& aSetting);
       
   625         
       
   626         /**
       
   627          *  Pure virtual function defined in the base class TRepository, 
       
   628          * it implements the search procedure for the setting in the repository 
       
   629          * within the bounds defined by aLow and aHigh parameters. It returns 
       
   630          * found setting reference data and its position. Also @see TRepository
       
   631          * for more details. 
       
   632          */
       
   633         virtual TInt FindSetting (const TSettingId& aId, TSettingRef& aSetting,
       
   634                           TInt32& aPosition, TInt32 aLow, TInt32 aHigh);
       
   635 
       
   636         /** 
       
   637          *  Pure virtual function defined in the base TRepository class,
       
   638          * it implement the word setting search procedure. Also @see TRepository
       
   639          * for more details.
       
   640          */
       
   641         virtual TInt GetWordSettings(TInt aNum, SSettingId* aIds[], 
       
   642                          TInt32* aValues[], TSettingType* aTypes[],
       
   643                          TInt* aErrors[]);
       
   644 
       
   645         /**
       
   646          *  This method implements returning a reference to TSettingRef
       
   647          * structure at specified position within the repository. 
       
   648          */
       
   649         virtual  void GetSettingRef(TInt32 aIndex, TSettingRef& aRef);
       
   650 
       
   651         /**
       
   652          *  Pure virtual function defined in the base TRepository class, 
       
   653          *  implements the search for all elements procedure withinthe defined
       
   654          *  category. Also @see TRepository for more details.
       
   655          */ 
       
   656         virtual TInt FindNumSettingsInCategory(TCategoryUid aCatUid,
       
   657                 TInt32& aFirst, TInt32& aLast);
       
   658         virtual TInt GetValue(const TSettingRef& aRef, UValueWord& aValue);
       
   659         virtual TInt GetLargeValue(const TSettingRef& aRef, UValueLarge& aValue);
       
   660        
       
   661     private:
       
   662         TRepositoryFile(const SRepositoryFile* aRepos);
       
   663         
       
   664     private:
       
   665         const SRepositoryFile* iRepos;
       
   666         };
       
   667         
       
   668      
       
   669     } // namespace HCR
       
   670 
       
   671 
       
   672 
       
   673 // -- GLOBALS -----------------------------------------------------------------
       
   674 
       
   675 
       
   676 GLREF_C HCR::HCRInternal gHCR;
       
   677 
       
   678 #define HCRSingleton (&gHCR)
       
   679 
       
   680 #define HCRReady    ((gHCR.GetStatus() & HCRInternal::EStatReady) == HCRInternal::EStatReady)
       
   681 #define HCRNotReady ((gHCR.GetStatus() & HCRInternal::EStatReady) == 0)
       
   682 
       
   683 
       
   684 
       
   685 #endif // HCR_PIL_H
       
   686