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