os/kernelhwsrv/kernel/eka/drivers/hcr/hcr_pil.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/kernelhwsrv/kernel/eka/drivers/hcr/hcr_pil.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,669 @@
     1.4 +// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of the License "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +// Hardware Configuration Respoitory Platform Independent Layer (PIL)
    1.18 +// Contains internal definitions for the PIL software of the HCR component
    1.19 +// which includes the singleton class that contains the algorithms and the
    1.20 +// TRepository hierachy that encapsulated the repository data in all its forms
    1.21 +// hiding the specifics from the algoritms in the singleton HCRInternal object.
    1.22 +//
    1.23 +
    1.24 +/**
    1.25 +@file hcr_pil.h
    1.26 +Kernel side definitions for the HCR Platform Independent Layer. 
    1.27 +
    1.28 +@internalTechnology
    1.29 +*/
    1.30 +
    1.31 +#ifndef HCR_PIL_H
    1.32 +#define HCR_PIL_H
    1.33 +
    1.34 +
    1.35 +// -- INCLUDES ----------------------------------------------------------------
    1.36 +
    1.37 +
    1.38 +#include <e32def.h>
    1.39 +#include <e32err.h> 
    1.40 +
    1.41 +#include "hcr_hai.h"
    1.42 +
    1.43 +
    1.44 +// -- CLASSES -----------------------------------------------------------------
    1.45 +
    1.46 +namespace HCR
    1.47 +{
    1.48 +
    1.49 +    class TRepository;
    1.50 +
    1.51 +
    1.52 +    /**< Mask for testing for word size settings */
    1.53 +    static const TInt KMaskWordTypes = 0x0000FFFF;      
    1.54 +
    1.55 +    /**< Mask for testing for large settings */  
    1.56 +    static const TInt KMaskLargeTypes = 0xFFFF0000;
    1.57 +
    1.58 +    
    1.59 +	/**
    1.60 +	 *  Class implements the reference to the setting, it consists of two
    1.61 +	 * pointers to the repository where the setting is set and to the setting
    1.62 +	 * data itself.   
    1.63 +	 */
    1.64 +	class TSettingRef
    1.65 +		{
    1.66 +	public:
    1.67 +
    1.68 +	    /**
    1.69 +	     *  Default C++ constructor. It initiates the reference class 
    1.70 +	     * object with the reference structure data.
    1.71 +	     * @param aSetRef          Reference Setting data 
    1.72 +	     */
    1.73 +	    TSettingRef()
    1.74 +	        {iRep = NULL; iSet = NULL;}
    1.75 +	    
    1.76 +	    /**
    1.77 +	     *  C++ constructor. It initiates the the reference class object 
    1.78 +	     * @param  aRepos          Pointer to the settings repository
    1.79 +	     * @param  aSetting        Pointer to the setting
    1.80 +	     */
    1.81 +	    TSettingRef(TRepository* aRepos, SSettingBase* aSetting)
    1.82 +			{ iRep = aRepos; iSet = aSetting; }
    1.83 +	    
    1.84 +	   
    1.85 +	        
    1.86 +	    /**
    1.87 +	     *   C++ destructor.
    1.88 +	     */
    1.89 +        ~TSettingRef()
    1.90 +        	{ }
    1.91 +        
    1.92 +	public:
    1.93 +	    /**< Pointer to the repository*/
    1.94 +	    TRepository*  iRep;
    1.95 +	    /**< Pointer to the setting*/
    1.96 +	    SSettingBase* iSet;
    1.97 +		};
    1.98 +	
    1.99 +
   1.100 +	//Disable WINS (old Visual C++) warning
   1.101 +	#pragma warning(disable:4284)
   1.102 +	/**
   1.103 +	 * Internal HCR, SafeArray (TSa) class. 
   1.104 +	 * Safe Array implementation is based on a smart pointer
   1.105 +	 * pattern which wraps the pointer by the template class and give it a new
   1.106 +	 * flavour. In this case it guarantees that the heap allocated array 
   1.107 +	 * associated with the class instance variable pointer will be deallocated 
   1.108 +	 * during stack unwinding.
   1.109 +	 * IMPORTANT! 
   1.110 +	 * Please don't instantiate this class on the heap as this will break the 
   1.111 +	 * functionality of this class. Operator [] does not check the boundary of
   1.112 +	 * the array, consider safe array implementation as a simple replacement of
   1.113 +	 * standard pointer with all its drawbacks.
   1.114 +	 */
   1.115 +
   1.116 +	template <typename T>
   1.117 +	    class TSa
   1.118 +	        {
   1.119 +	        public:
   1.120 +	            /** 
   1.121 +	             *  Default constructor.
   1.122 +	             * During initialization it sets the member variable pointer iSa
   1.123 +	             * to NULL. 
   1.124 +	             */
   1.125 +	            inline TSa() :iSa(NULL){}
   1.126 +	            
   1.127 +	           
   1.128 +	            /**
   1.129 +	             *  operator()() returns an address to the array  
   1.130 +	             * maintained by this SafeArray object.
   1.131 +	             * It can be usefull when it's necessary to get the pointer  
   1.132 +	             * value, for instance passing as function parameter.
   1.133 +	             * @return         Pointer to the first element of the 
   1.134 +	             *                 maintained array of elements of type T. 
   1.135 +	             *  
   1.136 +	             */
   1.137 +	            inline T* operator ()(){return iSa;}
   1.138 +	         
   1.139 +	            /**
   1.140 +	             * operator=() changes the memory ownership by   
   1.141 +	             * reinitiazing SafeArray class object with the address to   
   1.142 +	             * already allocated array. The original heap allocation  
   1.143 +	             * associated with this SafeArray object is deallocated before
   1.144 +	             * reassignment. It's implemented in hcr_pil.cpp.
   1.145 +	             * @param  aP      Pointer to the already allocated array of
   1.146 +	             *                 elements of the type T.
   1.147 +	             * @return         Reference to (*this) object.
   1.148 +	             */
   1.149 +	             TSa<T>& operator=(T* aP);
   1.150 +	                
   1.151 +	            
   1.152 +	            /**
   1.153 +	             * operator[]() returns the reference to the element of 
   1.154 +	             * array maintained by this SafeArray object at position defined
   1.155 +	             * by aIndex function parameter. 
   1.156 +	             * @param  aIndex      Position of the element within SafeArray
   1.157 +	             * @return             Reference to the element from the array
   1.158 +	             */
   1.159 +	            inline T& operator[](TInt aIndex){return *(iSa + aIndex);}
   1.160 +	            
   1.161 +	           	             
   1.162 +	            /**
   1.163 +	             *  Destructor
   1.164 +	             */
   1.165 +	            ~TSa();
   1.166 +	                
   1.167 +	                        
   1.168 +	        private:
   1.169 +	            /**
   1.170 +	             *  Copy constructor must not be called explicitly by the
   1.171 +	             * code
   1.172 +	             */
   1.173 +	            inline TSa(TSa& aSa);
   1.174 +	            
   1.175 +	        protected:
   1.176 +	            /**< Pointer to the allocated heap array*/
   1.177 +	            T*     iSa;
   1.178 +	        };
   1.179 +#pragma warning(default:4284)
   1.180 +	 
   1.181 +	                
   1.182 +    /**
   1.183 +     *  Internal HCR class, object of this class is created by the kernel 
   1.184 +     * when the kernel extensions are loaded and initialized.
   1.185 +     */
   1.186 +    class HCRInternal
   1.187 +        {
   1.188 +    public:       
   1.189 +
   1.190 +        /**
   1.191 +         * Internal HCR states
   1.192 +         */
   1.193 +        enum States 
   1.194 +            {
   1.195 +            EStatUndef              = 0x00000000,
   1.196 +            EStatNotReady           = 0x00010000,
   1.197 +            EStatConstructed        = EStatNotReady + 0x0001,
   1.198 +            EStatVariantInitialised = EStatNotReady + 0x0002,
   1.199 +            EStatInitialised        = EStatNotReady + 0x0004,
   1.200 +
   1.201 +            EStatReady              = 0x00020000,
   1.202 +
   1.203 +            EStatFailed             = 0x00800000,
   1.204 +
   1.205 +            EStatMajornMask         = 0xFFFF0000,
   1.206 +            EStatMinorMask          = 0x0000FFFF
   1.207 +            };
   1.208 +
   1.209 +        // For Test
   1.210 +        enum TReposId
   1.211 +            {
   1.212 +            ECoreRepos = 1,
   1.213 +            EOverrideRepos
   1.214 +            };
   1.215 +
   1.216 +    public:
   1.217 +        /**
   1.218 +         *  Default C++ constructor.
   1.219 +         */
   1.220 +        HCRInternal();
   1.221 +        
   1.222 +        /**
   1.223 +         *  C++ constructor with passing MVariant object for further  
   1.224 +         * instance variable initialization.
   1.225 +         */
   1.226 +		HCRInternal(HCR::MVariant* aVar);
   1.227 +		
   1.228 +		/**
   1.229 +		 *  C++ destructor.
   1.230 +		 */
   1.231 +        ~HCRInternal();
   1.232 +     
   1.233 +        /**
   1.234 +         *  The method initializes  internal instance variable pointers
   1.235 +         * to the addresses of repositories by getting them via call to Variant 
   1.236 +         * object functional API.
   1.237 +         * @return          
   1.238 +         *  - KErrNone        No errors reported
   1.239 +         *  - KErrGeneral     Internal HCR fault
   1.240 +         *  - KErrArgument    Programming error in PSL, ptr/rc 
   1.241 +         *                    mismatch
   1.242 +         *  - KErrNoMemory    Memory allocation failure
   1.243 +         */
   1.244 +        TInt Initialise();
   1.245 +
   1.246 +        /**
   1.247 +         *  Based on the input parameter aId it switches the selected repository 
   1.248 +         * to the given name. It is searching the new repository file in 
   1.249 +         * \sys\bin and \sys\Data respectively. It keeps the original value of 
   1.250 +         * the repository if the file not found.
   1.251 +         * @param aFileName     The zero terminated, c-style ASCII string of the 
   1.252 +         *                      new repository file without path. If the name is
   1.253 +         *                      an empty string (NULL) the it deletes the 
   1.254 +         *                      repository object
   1.255 +         * @param aId         The internal repository identifier (see TReposId)
   1.256 +         * @return 
   1.257 +         *  - KErrNone          if successful, the selected internal repository  
   1.258 +         *                      variables point to the new HCR or the referenced 
   1.259 +         *                      repository object deleted.
   1.260 +         *  - KErrNotFound      if the new repository file not found.
   1.261 +         *  - KErrNotSupported  if repository identifier not supported
   1.262 +         */      
   1.263 +        TInt SwitchRepository(const TText * aFileName, const TReposId aId=ECoreRepos);
   1.264 +
   1.265 +        
   1.266 +        /**
   1.267 +         *  Internal HCR method checks all repositories integrity.
   1.268 +         * @return
   1.269 +         *  - KErrNone          Successful, no errors reported
   1.270 +         *  - KErrAlreadyExist  Check for the setting duplicates fails
   1.271 +         *  - KErrCorrupt       One of the repositories was found to be corrupt 
   1.272 +         *                      e.g. repository header incorrect, settings not 
   1.273 +         *                      ordered etc
   1.274 +         */
   1.275 +        TInt CheckIntegrity();
   1.276 +
   1.277 +        /**
   1.278 +         * Internal HCR method returns a current HCR state.
   1.279 +         * @return Current HCR composite status flag data member, @see States 
   1.280 +         *         for more details
   1.281 +         */
   1.282 +        TUint32 GetStatus();
   1.283 +        
   1.284 +        /**
   1.285 +         *  The method searches the given setting defined by aId parameter
   1.286 +         * and with the type defined by aType parameter. Reference setting data
   1.287 +         * is returned in aSetting output parameter. The search procedure is 
   1.288 +         * performed through all enabled repositories. It starts looking in 
   1.289 +         * Override first, then if setting is not found it goes to CoreImg and
   1.290 +         * in the end in Variant repository.
   1.291 +         * @param   aId         in: setting to find
   1.292 +         * @param   aType       in: required type
   1.293 +         * @param   aSetting    out: found setting reference data
   1.294 +         * @return              The following errors are returned:
   1.295 +         *     - KErrNone         It successfuly ends, no errors are reported
   1.296 +         *     - KErrNotFound     The setting was not found
   1.297 +         *     - KErrArgument     The found setting type does not match the aType
   1.298 +         */
   1.299 +        TInt FindSetting(const TSettingId& aId, TSettingType aType,
   1.300 +                                                        TSettingRef& aSetting);
   1.301 +        
   1.302 +        /**
   1.303 +         *  Internal HCR helper method finds setting and its type.
   1.304 +         * @param   aId         in:  setting id to find
   1.305 +         * @param   aType       out: found setting type. If the setting is  
   1.306 +         *                      not found, the returned value is set to 
   1.307 +         *                      ETypeUndefined
   1.308 +         * @param   aSetting    out: found setting data
   1.309 +         * @return               The following errors can be returned:
   1.310 +         *     - KErrNone       It successfuly ends, no errors are reported
   1.311 +         *     - KErrNotFound   The setting was not found
   1.312 +         */
   1.313 +        TInt FindSettingWithType(const TSettingId& aId, TSettingType& aType,
   1.314 +                                 TSettingRef& aSetting);
   1.315 +
   1.316 +       
   1.317 +        /**
   1.318 +         *  Internal helper method search all the word settings provided
   1.319 +         * in aIds[] settings array. The search procedure starts from Override
   1.320 +         * store, if the setting is not found there, it goes through the CoreImg
   1.321 +         * and finaly ends up in the Variant data.
   1.322 +         * @param   aNum        in: number of settings to find
   1.323 +         * @param   aIds        in: array of settings to find
   1.324 +         * @param   aValues     out: all found settings values are written  
   1.325 +         *                      back to this array. If the setting is not found
   1.326 +         *                      the returned setting value is set to 0
   1.327 +         * @param   aTypes      out: If this array is provided by upper user,
   1.328 +         *                      the setting types are written back to this array.
   1.329 +         *                      If the element is not found, its type is set to
   1.330 +         *                      ETypeUndefined. 
   1.331 +         * @param   aErrors     out: user must always provide this array, 
   1.332 +         *                      where the method will report the search result 
   1.333 +         *                      for each individual setting. There are three 
   1.334 +         *                      possible values:
   1.335 +         *                      - KErrNone  Setting is found, no errors reported
   1.336 +         *                      - KErrNotFound Setting is not found
   1.337 +         *                      - KErrErrArgument Found setting has larger than
   1.338 +         *                        four bytes size
   1.339 +         * @return  The following errors can be returned:
   1.340 +         *  - Zero or positive number of settings found in category, -ve on error
   1.341 +         *  - KErrArgument if some parameters are wrong(i.e. aErrors is a null
   1.342 +         *                   pointer, aNum is negative and so on) 
   1.343 +         *  - KErrNotReady if the HCR is used before it has been initialised
   1.344 +         *  - KErrCorrupt  if HCR finds a repository to be corrupt
   1.345 +         *  - KErrGeneral  if an internal failure occurs, see trace
   1.346 +         *  
   1.347 +         * @pre Caller must invoke this function inside the thread critical 
   1.348 +         *      section to let the method finish its job. It avoids memory leak 
   1.349 +         *      in case of possible client thread termination. 
   1.350 +         */
   1.351 +        TInt GetWordSettings(TInt aNum, const SSettingId aIds[], TInt32 aValues[],
   1.352 +                                TSettingType aTypes[], TInt aErrors[]);
   1.353 +        
   1.354 +        /**
   1.355 +         *  Internal HCR method returns the number of settings in the specified
   1.356 +         * category.
   1.357 +         * @param aCatUid   in: The setting identifier category to use in the 
   1.358 +         *                      search
   1.359 +         * @return 
   1.360 +         *  - Zero or positive number of settings found in category, -ve on error
   1.361 +         *  - KErrNotReady if the HCR is used before it has been initialised
   1.362 +         *  - KErrCorrupt if HCR finds a repository to be corrupt
   1.363 +         *  - KErrGeneral if an internal failure occurs, see trace
   1.364 +         */
   1.365 +        TInt FindNumSettingsInCategory (TCategoryUid aCatUid);
   1.366 +        
   1.367 +        
   1.368 +        /**
   1.369 +         * Internal HCR method searches all elements within the specified 
   1.370 +         * category aCatUid.
   1.371 +         * @param aCatUid   in: The setting identifier category to use in the search
   1.372 +         * @param aMaxNum   in: The maximum number of settings to return. It is also 
   1.373 +         *                  the size of the arrays in the following arguments 
   1.374 +         * @param aElIds    out: Client supplied array populated on exit. Large
   1.375 +         *                  enough to hold all elements in category.
   1.376 +         * @param aTypes    out: Client supplied array populated with setting types 
   1.377 +         *                  enumerations on exit. May be 0 if client is 
   1.378 +         *                  not interested.
   1.379 +         * @param aLens     out: Client supplied array populated with setting lengths
   1.380 +         *                  on exit. May be 0 if client is not interested.
   1.381 +         *
   1.382 +         * @return Zero or positive number of settings found in category, -ve on error
   1.383 +         *  - KErrArgument if some parameters are wrong(i.e. aErrors is a null
   1.384 +         *                   pointer, aNum is negative and so on)
   1.385 +         *  - KErrNotReady if the HCR is used before it has been initialised
   1.386 +         *  - KErrCorrupt  if HCR finds a repository to be corrupt
   1.387 +         *  - KErrGeneral  if an internal failure occurs, see trace
   1.388 +         */
   1.389 +        TInt FindSettings(TCategoryUid aCatUid, 
   1.390 +                TInt aMaxNum,  TElementId aIds[],  
   1.391 +                TSettingType aTypes[], TUint16 aLens[]);
   1.392 +
   1.393 +
   1.394 +        /**
   1.395 +         *  Internal HCR method finds all the settings within the specified 
   1.396 +         * category and which matches aMask and aPattern.
   1.397 +         * @param aCat      in: The category to retrieve settings for
   1.398 +         * @param aMaxNum   in: The maximum number of settings to retrieve. It  
   1.399 +         *                  is also the size of the arrays in the following 
   1.400 +         *                  arguments   
   1.401 +         * @param aElemMask in: The bits in the Element ID to be checked against 
   1.402 +         *                  aPattern
   1.403 +         * @param aPattern  in: Identified the bits that must be set for a 
   1.404 +         *                  setting to be returned in the search
   1.405 +         * @param aIds      out: Client supplied array populated on exit. Large
   1.406 +         *                  enough to hold aMaxNum element ids.
   1.407 +         * @param aTypes    out: Client supplied array populated with setting types 
   1.408 +         *                  enumerations on exit. May be 0 if client is 
   1.409 +         *                  not interested.
   1.410 +         * @param aLen      out: Client supplied array populated with setting 
   1.411 +         *                  lengths on exit. May be 0 if client is not interested.
   1.412 +         * @return 
   1.413 +         *  - Zero or positive number of settings found in category, -ve on error
   1.414 +         *  - KErrArgument if some parameters are wrong(i.e. aErrors is a null
   1.415 +         *                   pointer, aNum is negative and so on) 
   1.416 +         *  - KErrNotReady if the HCR is used before it has been initialised
   1.417 +         *  - KErrCorrupt  if HCR finds a repository to be corrupt
   1.418 +         *  - KErrGeneral  if an internal failure occurs, see trace
   1.419 +         */
   1.420 +        TInt FindSettings(TCategoryUid aCat, TInt aMaxNum, 
   1.421 +                TUint32 aMask, TUint32 aPattern,  
   1.422 +                TElementId aIds[], TSettingType aTypes[], TUint16 aLens[]);
   1.423 + 
   1.424 +    private:    
   1.425 +    	/** Member holding the status of the HCR service */
   1.426 +        TUint32 iStatus;
   1.427 +    
   1.428 +        /** Handle on the variant code in the PSL component part */    
   1.429 +        HCR::MVariant* iVariant;    
   1.430 +        
   1.431 +        /** Compiled settings in the PSL code */
   1.432 +        TRepository* iVariantStore;
   1.433 +        
   1.434 +        /** File settings in the core ROM image */
   1.435 +        TRepository* iCoreImgStore;
   1.436 +        
   1.437 +        /** File settings shadowed in RAM from NAND */
   1.438 +        TRepository* iOverrideStore;
   1.439 +        
   1.440 +        friend class HCRInternalTestObserver;
   1.441 +
   1.442 +        };
   1.443 +    
   1.444 +    
   1.445 +    /**
   1.446 +     *  Base Repository class. This class defines API needed to be 
   1.447 +     * implemented in the derived classes.
   1.448 +     */
   1.449 +    class TRepository
   1.450 +        {
   1.451 +    public: 
   1.452 +    	// Repository methods		
   1.453 +		virtual ~TRepository();
   1.454 +        virtual TInt CheckIntegrity ()=0;
   1.455 +        virtual TInt FindSetting (const TSettingId& aId, TSettingRef& aSetting)=0;
   1.456 +        
   1.457 +        /**
   1.458 +         *  Pure virtual function, must implement the search procedure for the
   1.459 +         * setting in the repository within the bounds defined by aLow and aHigh
   1.460 +         * parameters. It returns found setting reference data and its position.
   1.461 +         * @param   aId         in:  Setting to find
   1.462 +         * @param   aSetting    out: Found setting reference data
   1.463 +         * @param   aPosition   out: Position the found setting in the repository
   1.464 +         * @param   aLow        in:  Low index where to start search
   1.465 +         * @param   aHigh       in:  High index where to end search
   1.466 +         * @return
   1.467 +         *  - KErrNone          Successful, no errors were reported 
   1.468 +         *  - KErrNotFound      Either the repository does not have any settings,
   1.469 +         *                      and its length is zero or the setting was not
   1.470 +         *                      found, all output parameters are set to zeros in
   1.471 +         *                      this case. 
   1.472 +         */
   1.473 +        virtual TInt FindSetting (const TSettingId& aId, TSettingRef& aSetting,
   1.474 +                TInt32& aPosition, TInt32 aLow, TInt32 aHigh) = 0;
   1.475 +        
   1.476 +        /**
   1.477 +         *  Pure virtual function, must implement the word setting search 
   1.478 +         * procedure.
   1.479 +         * @param   aNum        in: Number of settings to be found
   1.480 +         * @param   aIds        in: An array of setting ids pointers to be found
   1.481 +         * @param   aValues     out: An array of pointers to the values 
   1.482 +         *                      populated during search procedure.
   1.483 +         * @param   aTypes      out: An array of pointers to the types populated
   1.484 +         *                      during search procedure.
   1.485 +         * @param   aErrors     out: An array of pointers to the errors populated
   1.486 +         *                      during search procedure. This can be the following
   1.487 +         *                      errors:
   1.488 +         *                          - KErrNone      Successfuly done, no errors 
   1.489 +         *                            reported
   1.490 +         *                          - KErrNotFound  The setting was not found
   1.491 +         *                          - KErrArgument  The found setting type is large
   1.492 +         *                            than 4 bytes.
   1.493 +         * @return
   1.494 +         *  - KErrNone      Successfuly done, no errors reported
   1.495 +         *  - KErrNotReady  Repository is not ready
   1.496 +         *  - system wider error
   1.497 +         */
   1.498 +        virtual TInt GetWordSettings(TInt aNum, SSettingId* aIds[], 
   1.499 +                       TInt32* aValues[], TSettingType* aTypes[], 
   1.500 +                       TInt* aErrors[])=0;
   1.501 +
   1.502 +        /**
   1.503 +         * Pure virtual function, must return a reference to TSettingRef
   1.504 +         * structure at specified position within the repository.
   1.505 +         * @param   aIndex      in: Setting position(index) in the repository
   1.506 +         * @param   aRef        out: Reference data storage
   1.507 +         */
   1.508 +        virtual void GetSettingRef(TInt32 aIndex, TSettingRef& aRef) = 0;
   1.509 +        
   1.510 +        /**
   1.511 +         *  Pure virtual function, must implement the search all elements within 
   1.512 +         * the defined category.
   1.513 +         * @param   aCatUid     in: Category id where to search the elements
   1.514 +         * @param   aFirst      out: Repository index where the first element is
   1.515 +         *                           situated
   1.516 +         * @param   aLast       out: Repository index where the last element is
   1.517 +         *                           situated
   1.518 +         * @return
   1.519 +         *  - KErrNone      Successfuly done, no errors were reported
   1.520 +         *  - KErrNotFound  No any elements were found in this category or repo-
   1.521 +         *                  sitory is empty
   1.522 +         */
   1.523 +        virtual TInt FindNumSettingsInCategory(TCategoryUid aCatUid, 
   1.524 +                TInt32& aFirst, TInt32& aLast) = 0;
   1.525 +        
   1.526 +       
   1.527 +        // Setting accessor methods
   1.528 +        virtual TBool IsWordValue(const TSettingRef& aRef);
   1.529 +        virtual TBool IsLargeValue(const TSettingRef& aRef);
   1.530 +        virtual void GetId(const TSettingRef& aRef, SSettingId& aId);
   1.531 +        virtual TInt32 GetType(const TSettingRef& aRef);
   1.532 +        virtual TUint16 GetLength(const TSettingRef& aRef);
   1.533 +        
   1.534 +        virtual void GetSettingInfo(const TSettingRef& aRef, 
   1.535 +                TElementId& aId, TSettingType& aType, TUint16& aLen);
   1.536 +
   1.537 +        
   1.538 +        virtual TInt GetValue(const TSettingRef& aRef, UValueWord& aValue)=0;
   1.539 +        virtual TInt GetLargeValue(const TSettingRef& aRef, UValueLarge& aValue)=0;
   1.540 +
   1.541 +        };
   1.542 +    
   1.543 +    
   1.544 +    /**
   1.545 +     * Compoiled repository class
   1.546 +     */
   1.547 +    class TRepositoryCompiled : public TRepository
   1.548 +        {
   1.549 +    public: 
   1.550 +        static TRepository* New(const SRepositoryCompiled* aRepos);
   1.551 +        virtual ~TRepositoryCompiled();
   1.552 +        
   1.553 +        virtual TInt CheckIntegrity();
   1.554 +        
   1.555 +        virtual TInt FindSetting(const TSettingId& aId, TSettingRef& aSetting);
   1.556 +        
   1.557 +        /**
   1.558 +         *  Pure virtual function defined in the base class TRepository, 
   1.559 +         * it implements the search procedure for the setting in the repository 
   1.560 +         * within the bounds defined by aLow and aHigh parameters. It returns 
   1.561 +         * found setting reference data and its position. Also @see TRepository
   1.562 +         * for more details. 
   1.563 +         */
   1.564 +        virtual TInt FindSetting (const TSettingId& aId, TSettingRef& aSetting,
   1.565 +                 TInt32& aPosition,TInt32 aLow, TInt32 aHigh);
   1.566 +        
   1.567 +                
   1.568 +        /** 
   1.569 +         *  Pure virtual function defined in the base TRepository class,
   1.570 +         * it implement the word setting search procedure. Also @see TRepository
   1.571 +         * for more details.
   1.572 +         */
   1.573 +        virtual TInt GetWordSettings(TInt aNum, SSettingId* aIds[], 
   1.574 +                    TInt32* aValues[], TSettingType* aTypes[], TInt* aErrors[]);
   1.575 +
   1.576 +        
   1.577 +        /**
   1.578 +         *  This method implements returning a reference to TSettingRef
   1.579 +         * structure at specified position within the repository. 
   1.580 +         */
   1.581 +        virtual  void GetSettingRef(TInt32 aIndex, TSettingRef& aRef);
   1.582 +        
   1.583 +        /**
   1.584 +         *  Pure virtual function defined in the base TRepository class, 
   1.585 +         *  implements the search for all elements procedure withinthe defined
   1.586 +         *  category. Also @see TRepository for more details.
   1.587 +         */
   1.588 +        virtual TInt FindNumSettingsInCategory(TCategoryUid aCatUid,
   1.589 +                TInt32& aFirst, TInt32& aLast);
   1.590 +        virtual TInt GetValue(const TSettingRef& aRef, UValueWord& aValue);
   1.591 +        virtual TInt GetLargeValue(const TSettingRef& aRef, UValueLarge& aValue);
   1.592 +
   1.593 +        
   1.594 +    private:
   1.595 +        TRepositoryCompiled(const SRepositoryCompiled* aRepos);
   1.596 +        
   1.597 +    private:   
   1.598 +        const SRepositoryCompiled* iRepos;
   1.599 +        };
   1.600 +    
   1.601 +    /**
   1.602 +    */
   1.603 +    class TRepositoryFile : public TRepository
   1.604 +        {
   1.605 +    public: 
   1.606 +        static TRepository* New(const SRepositoryFile* aRepos);
   1.607 +        virtual ~TRepositoryFile();
   1.608 +        
   1.609 +        virtual TInt CheckIntegrity();
   1.610 +        virtual TInt FindSetting(const TSettingId& aId, TSettingRef& aSetting);
   1.611 +        
   1.612 +        /**
   1.613 +         *  Pure virtual function defined in the base class TRepository, 
   1.614 +         * it implements the search procedure for the setting in the repository 
   1.615 +         * within the bounds defined by aLow and aHigh parameters. It returns 
   1.616 +         * found setting reference data and its position. Also @see TRepository
   1.617 +         * for more details. 
   1.618 +         */
   1.619 +        virtual TInt FindSetting (const TSettingId& aId, TSettingRef& aSetting,
   1.620 +                          TInt32& aPosition, TInt32 aLow, TInt32 aHigh);
   1.621 +
   1.622 +        /** 
   1.623 +         *  Pure virtual function defined in the base TRepository class,
   1.624 +         * it implement the word setting search procedure. Also @see TRepository
   1.625 +         * for more details.
   1.626 +         */
   1.627 +        virtual TInt GetWordSettings(TInt aNum, SSettingId* aIds[], 
   1.628 +                         TInt32* aValues[], TSettingType* aTypes[],
   1.629 +                         TInt* aErrors[]);
   1.630 +
   1.631 +        /**
   1.632 +         *  This method implements returning a reference to TSettingRef
   1.633 +         * structure at specified position within the repository. 
   1.634 +         */
   1.635 +        virtual  void GetSettingRef(TInt32 aIndex, TSettingRef& aRef);
   1.636 +
   1.637 +        /**
   1.638 +         *  Pure virtual function defined in the base TRepository class, 
   1.639 +         *  implements the search for all elements procedure withinthe defined
   1.640 +         *  category. Also @see TRepository for more details.
   1.641 +         */ 
   1.642 +        virtual TInt FindNumSettingsInCategory(TCategoryUid aCatUid,
   1.643 +                TInt32& aFirst, TInt32& aLast);
   1.644 +        virtual TInt GetValue(const TSettingRef& aRef, UValueWord& aValue);
   1.645 +        virtual TInt GetLargeValue(const TSettingRef& aRef, UValueLarge& aValue);
   1.646 +       
   1.647 +    private:
   1.648 +        TRepositoryFile(const SRepositoryFile* aRepos);
   1.649 +        
   1.650 +    private:
   1.651 +        const SRepositoryFile* iRepos;
   1.652 +        };
   1.653 +        
   1.654 +     
   1.655 +    } // namespace HCR
   1.656 +
   1.657 +
   1.658 +
   1.659 +// -- GLOBALS -----------------------------------------------------------------
   1.660 +
   1.661 +
   1.662 +GLREF_C HCR::HCRInternal gHCR;
   1.663 +
   1.664 +#define HCRSingleton (&gHCR)
   1.665 +
   1.666 +#define HCRReady    ((gHCR.GetStatus() & HCRInternal::EStatReady) == HCRInternal::EStatReady)
   1.667 +#define HCRNotReady ((gHCR.GetStatus() & HCRInternal::EStatReady) == 0)
   1.668 +
   1.669 +
   1.670 +
   1.671 +#endif // HCR_PIL_H
   1.672 +