kernel/eka/drivers/hcr/hcr_pil.h
changeset 4 56f325a607ea
parent 0 a41df078684a
child 8 538db54a451d
equal deleted inserted replaced
2:4122176ea935 4:56f325a607ea
    36 
    36 
    37 // -- CLASSES -----------------------------------------------------------------
    37 // -- CLASSES -----------------------------------------------------------------
    38 
    38 
    39 namespace HCR
    39 namespace HCR
    40 {
    40 {
    41 	class TRepository;
    41 
    42 
    42     class TRepository;
    43 
    43 
    44     //!< Mask for testing for word size settings
    44 
       
    45     /**< Mask for testing for word size settings */
    45     static const TInt KMaskWordTypes = 0x0000FFFF;      
    46     static const TInt KMaskWordTypes = 0x0000FFFF;      
    46 
    47 
    47     //!< Mask for testing for large settings  
    48     /**< Mask for testing for large settings */  
    48     static const TInt KMaskLargeTypes = 0xFFFF0000;
    49     static const TInt KMaskLargeTypes = 0xFFFF0000;
    49 
    50 
    50 
    51     
    51 	/**
    52 	/**
    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 	 */
    53 	class TSettingRef
    57 	class TSettingRef
    54 		{
    58 		{
    55 	public:
    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 	     */
    56 	    TSettingRef(TRepository* aRepos, SSettingBase* aSetting)
    74 	    TSettingRef(TRepository* aRepos, SSettingBase* aSetting)
    57 			{ iRep = aRepos; iSet = aSetting; }
    75 			{ iRep = aRepos; iSet = aSetting; }
       
    76 	    
       
    77 	   
       
    78 	        
       
    79 	    /**
       
    80 	     *   C++ destructor.
       
    81 	     */
    58         ~TSettingRef()
    82         ~TSettingRef()
    59         	{ }
    83         	{ }
    60         
    84         
    61     public:
    85 	public:
    62     	TRepository*  iRep;
    86 	    /**< Pointer to the repository*/
    63     	SSettingBase* iSet;
    87 	    TRepository*  iRep;
       
    88 	    /**< Pointer to the setting*/
       
    89 	    SSettingBase* iSet;
    64 		};
    90 		};
    65 
       
    66 	
    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 	                
    67     /**
   195     /**
    68     */
   196      *  Internal HCR class, object of this class is created by the kernel 
       
   197      * when the kernel extensions are loaded and initialized.
       
   198      */
    69     class HCRInternal
   199     class HCRInternal
    70         {
   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 
    71     public:
   229     public:
       
   230         /**
       
   231          *  Default C++ constructor.
       
   232          */
    72         HCRInternal();
   233         HCRInternal();
       
   234         
       
   235         /**
       
   236          *  C++ constructor with passing MVariant object for further  
       
   237          * instance variable initialization.
       
   238          */
    73 		HCRInternal(HCR::MVariant* aVar);
   239 		HCRInternal(HCR::MVariant* aVar);
       
   240 		
       
   241 		/**
       
   242 		 *  C++ destructor.
       
   243 		 */
    74         ~HCRInternal();
   244         ~HCRInternal();
    75      
   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          */
    76         TInt Initialise();
   257         TInt Initialise();
    77         
   258 
    78         TInt FindSetting(const TSettingId& aId, TSettingType aType, TSettingRef& aSetting);
   259         /**
    79         TInt FindWordSettings(TInt aNum, const TSettingId* aIds, TInt32* aValues,
   260          *  Based on the input parameter aId it switches the selected repository 
    80                                 TSettingType* aTypes, TInt* aErrors);
   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          */
    81         TInt CheckIntegrity();
   288         TInt CheckIntegrity();
    82         
   289 
    83         enum States 
   290         /**
    84 			{
   291          * Internal HCR method returns a current HCR state.
    85 			EStatUndef          	= 0x00000000,
   292          * @return Current HCR composite status flag data member, @see States 
    86 			EStatNotReady       	= 0x00010000,
   293          *         for more details
    87 			EStatConstructed    	= EStatNotReady + 0x0001,
   294          */
    88 			EStatVariantInitialised = EStatNotReady + 0x0002,
   295         TUint32 GetStatus();
    89 			EStatInitialised    	= EStatNotReady + 0x0004,
   296         
    90 
   297         /**
    91 			EStatReady				= 0x00020000,
   298          *  The method searches the given setting defined by aId parameter
    92 			
   299          * and with the type defined by aType parameter. Reference setting data
    93 			EStatFailed				= 0x00800000,
   300          * is returned in aSetting output parameter. The search procedure is 
    94 			
   301          * performed through all enabled repositories. It starts looking in 
    95 			EStatMajornMask			= 0xFFFF0000,
   302          * Override first, then if setting is not found it goes to CoreImg and
    96 			EStatMinorMask			= 0x0000FFFF
   303          * in the end in Variant repository.
    97 			};
   304          * @param   aId         in: setting to find
    98 			
   305          * @param   aType       in: required type
    99 		TUint32 GetStatus();
   306          * @param   aSetting    out: found setting reference data
   100 			
   307          * @return              The following errors are returned:
   101     public:		// For Test
   308          *     - KErrNone         It successfuly ends, no errors are reported
   102     	enum TReposId
   309          *     - KErrNotFound     The setting was not found
   103         	{
   310          *     - KErrArgument     The found setting type does not match the aType
   104 			ECoreRepos = 1,
   311          */
   105 	    	EOverrideRepos
   312         TInt FindSetting(const TSettingId& aId, TSettingType aType,
   106 	    	};
   313                                                         TSettingRef& aSetting);
   107 	    	
   314         
   108 	    /**
   315         /**
   109 	    Based on the input parameter aId it switches the selected repository to the given
   316          *  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.
   317          * @param   aId         in:  setting id to find
   111 	    It keeps the original value of the repository if the file not found.
   318          * @param   aType       out: found setting type. If the setting is  
   112 
   319          *                      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.
   320          *                      ETypeUndefined
   114 	    					If the name is an empty string (NULL) the it deletes the repository object
   321          * @param   aSetting    out: found setting data
   115 	    @param aId     		The internal repository identifier (see TReposId)
   322          * @return               The following errors can be returned:
   116 
   323          *     - KErrNone       It successfuly ends, no errors are reported
   117 	        
   324          *     - KErrNotFound   The setting was not found
   118 		@return	KErrNone 			if successful, the selected internal repository variables point to the new HCR 
   325          */
   119 													or the referenced repository object deleted.
   326         TInt FindSettingWithType(const TSettingId& aId, TSettingType& aType,
   120 	            KErrNotFound 		if the new repository file not found.
   327                                  TSettingRef& aSetting);
   121 	            KErrNotSupported 	if repository identifier not supported
   328 
   122 
   329        
   123 	    */    	
   330         /**
   124     	TInt SwitchRepository(const TText * aFileName, const TReposId aId=ECoreRepos);
   331          *  Internal helper method search all the word settings provided
   125         
   332          * in aIds[] settings array. The search procedure starts from Override
   126         
   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  
   127     private:    
   437     private:    
   128     	/** Member holding the status of the HCR service */
   438     	/** Member holding the status of the HCR service */
   129     	TUint32 iStatus; 	
   439         TUint32 iStatus;
   130     
   440     
   131         /** Handle on the variant code in the PSL component part */    
   441         /** Handle on the variant code in the PSL component part */    
   132         HCR::MVariant* iVariant;    
   442         HCR::MVariant* iVariant;    
   133         
   443         
   134         /** Compiled settings in the PSL code */
   444         /** Compiled settings in the PSL code */
   144 
   454 
   145         };
   455         };
   146     
   456     
   147     
   457     
   148     /**
   458     /**
   149     */
   459      *  Base Repository class. This class defines API needed to be 
       
   460      * implemented in the derived classes.
       
   461      */
   150     class TRepository
   462     class TRepository
   151         {
   463         {
   152     public: 
   464     public: 
   153     	// Repository methods
   465     	// Repository methods		
   154         virtual TInt Initialise ()=0;
   466 		virtual ~TRepository();
   155         virtual TInt CheckIntegrity ()=0;
   467         virtual TInt CheckIntegrity ()=0;
   156         virtual TInt FindSetting (const TSettingId& aId, TSettingRef& aSetting)=0;
   468         virtual TInt FindSetting (const TSettingId& aId, TSettingRef& aSetting)=0;
   157         
   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        
   158         // Setting accessor methods
   540         // Setting accessor methods
   159         virtual TBool IsWordValue(const TSettingRef& aRef);
   541         virtual TBool IsWordValue(const TSettingRef& aRef);
   160         virtual TBool IsLargeValue(const TSettingRef& aRef);
   542         virtual TBool IsLargeValue(const TSettingRef& aRef);
   161         virtual void GetId(const TSettingRef& aRef, TCategoryUid& aCat, TElementId& aKey);
   543         virtual void GetId(const TSettingRef& aRef, TCategoryUid& aCat, TElementId& aKey);
   162         virtual void GetId(const TSettingRef& aRef, SSettingId& aId);
   544         virtual void GetId(const TSettingRef& aRef, SSettingId& aId);
   163         virtual TInt32 GetType(const TSettingRef& aRef);
   545         virtual TInt32 GetType(const TSettingRef& aRef);
   164         virtual TUint16 GetLength(const TSettingRef& aRef);
   546         virtual TUint16 GetLength(const TSettingRef& aRef);
   165 
   547         
       
   548         virtual void GetSettingInfo(const TSettingRef& aRef, 
       
   549                 TElementId& aId, TSettingType& aType, TUint16& aLen);
       
   550 
       
   551         
   166         virtual TInt GetValue(const TSettingRef& aRef, UValueWord& aValue)=0;
   552         virtual TInt GetValue(const TSettingRef& aRef, UValueWord& aValue)=0;
   167         virtual TInt GetLargeValue(const TSettingRef& aRef, UValueLarge& aValue)=0;   
   553         virtual TInt GetLargeValue(const TSettingRef& aRef, UValueLarge& aValue)=0;
       
   554 
   168         };
   555         };
   169     
   556     
   170     
   557     
   171     /**
   558     /**
   172     */
   559      * Compoiled repository class
       
   560      */
   173     class TRepositoryCompiled : public TRepository
   561     class TRepositoryCompiled : public TRepository
   174         {
   562         {
   175     public: 
   563     public: 
   176         static TRepository* New(const SRepositoryCompiled* aRepos);
   564         static TRepository* New(const SRepositoryCompiled* aRepos);
   177         virtual ~TRepositoryCompiled();
   565         virtual ~TRepositoryCompiled();
   178         
   566         
   179         virtual TInt Initialise();
       
   180         virtual TInt CheckIntegrity();
   567         virtual TInt CheckIntegrity();
       
   568         
   181         virtual TInt FindSetting(const TSettingId& aId, TSettingRef& aSetting);
   569         virtual TInt FindSetting(const TSettingId& aId, TSettingRef& aSetting);
   182 
   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);
   183         virtual TInt GetValue(const TSettingRef& aRef, UValueWord& aValue);
   604         virtual TInt GetValue(const TSettingRef& aRef, UValueWord& aValue);
   184         virtual TInt GetLargeValue(const TSettingRef& aRef, UValueLarge& aValue);   
   605         virtual TInt GetLargeValue(const TSettingRef& aRef, UValueLarge& aValue);
       
   606 
   185         
   607         
   186     private:
   608     private:
   187         TRepositoryCompiled(const SRepositoryCompiled* aRepos);
   609         TRepositoryCompiled(const SRepositoryCompiled* aRepos);
   188         
   610         
   189     private:   
   611     private:   
   196         {
   618         {
   197     public: 
   619     public: 
   198         static TRepository* New(const SRepositoryFile* aRepos);
   620         static TRepository* New(const SRepositoryFile* aRepos);
   199         virtual ~TRepositoryFile();
   621         virtual ~TRepositoryFile();
   200         
   622         
   201         virtual TInt Initialise();
       
   202         virtual TInt CheckIntegrity();
   623         virtual TInt CheckIntegrity();
   203         virtual TInt FindSetting(const TSettingId& aId, TSettingRef& aSetting);
   624         virtual TInt FindSetting(const TSettingId& aId, TSettingRef& aSetting);
   204 
   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);
   205         virtual TInt GetValue(const TSettingRef& aRef, UValueWord& aValue);
   658         virtual TInt GetValue(const TSettingRef& aRef, UValueWord& aValue);
   206         virtual TInt GetLargeValue(const TSettingRef& aRef, UValueLarge& aValue);   
   659         virtual TInt GetLargeValue(const TSettingRef& aRef, UValueLarge& aValue);
   207        
   660        
   208     private:
   661     private:
   209         TRepositoryFile(const SRepositoryFile* aRepos);
   662         TRepositoryFile(const SRepositoryFile* aRepos);
   210         
   663         
   211     private:
   664     private: