srsf/sisrscontrollerplugin/src/asrplugindataloader.h
branchRCL_3
changeset 19 e36f3802f733
parent 0 bf1d17376201
equal deleted inserted replaced
18:cad71a31b7fc 19:e36f3802f733
       
     1 /*
       
     2 * Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Utility class for SI Plugin to read data from file.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef ASRPLUGINDATALOADER_H
       
    20 #define ASRPLUGINDATALOADER_H
       
    21 
       
    22 //  INCLUDES
       
    23 #include <e32std.h>
       
    24 #include <e32base.h>
       
    25 #include <f32file.h>
       
    26 #include "srsfbldvariant.hrh"
       
    27 
       
    28 
       
    29 // FORWARD DECLARATION
       
    30 class MSysConfigProvider;
       
    31 
       
    32 // CLASS DECLARATION
       
    33 
       
    34 /**
       
    35 * Class for SI Plugin to load language package file.
       
    36 *
       
    37 *  @lib SIControllerPlugin.lib
       
    38 *  @since 2.8
       
    39 */
       
    40 class CDataLoader : public CBase
       
    41     {
       
    42     public: // Constructors and destructor
       
    43         
       
    44         /**
       
    45         * Two-phased constructor.
       
    46         */
       
    47         static CDataLoader* NewL( const TDesC& aPrefixOfFileName,
       
    48                                   const TDesC& aSeparator,
       
    49                                   const TDesC& aPostfixOfFileName,
       
    50                                   MSysConfigProvider *aProvider = NULL );
       
    51         
       
    52         /**
       
    53         * Destructor.
       
    54         */
       
    55         virtual ~CDataLoader();
       
    56         
       
    57     public: // New functions
       
    58         
       
    59        /**
       
    60 		* Load language package file. It resovles the name of the langage package
       
    61 		*
       
    62 		* @since 2.8
       
    63 		* @param  aPackageType   Type identifier.
       
    64 		* @param  aPackageID     Identifier of package.
       
    65 		* @param  aStartPosition Starting position within package in bytes.
       
    66 		* @param  aEndPosition   Ending position within package in bytes.
       
    67 		* @return Pointer to created buffer containing the request data.
       
    68         *         NULL if error occurs during loading.	
       
    69 		*/
       
    70         HBufC8* LoadData( TUint32 aPackageType, 
       
    71                           TUint32 aPackageID,
       
    72                           TUint32 aStartPosition ,
       
    73                           TUint32 aEndPosition );
       
    74 
       
    75     protected:
       
    76 
       
    77        /**
       
    78 		* Actual file loading function.
       
    79 		*
       
    80 		* @since 2.8
       
    81 		* @param  aFile			  Data file name
       
    82 		* @param  aStartPosition  Starting position within package in bytes.
       
    83 		* @param  aEndPosition    Ending position within package in bytes.
       
    84 		* @return Pointer to created buffer containing the request data.
       
    85 		* 		  NULL if error occurs during loading.	
       
    86 		*/
       
    87         HBufC8* DoLoadL( TFileName& aFile,
       
    88                          TUint32 aStartPosition, 
       
    89                          TUint32 aEndPosition );
       
    90 
       
    91     private:
       
    92         
       
    93         /**
       
    94         * C++ default constructor.
       
    95         */
       
    96         CDataLoader();
       
    97         
       
    98         /**
       
    99         * By default Symbian 2nd phase constructor is private.
       
   100         */
       
   101         void ConstructL( const TDesC& aPrefixOfFileName,
       
   102 						 const TDesC& aSeparator,                                     
       
   103                          const TDesC& aPostfixOfFileName,
       
   104                          MSysConfigProvider *aProvider);
       
   105 
       
   106 		/**
       
   107 		* Helper function for creating data file names
       
   108 		* @param  aFileName	      TFileName where to write the result
       
   109 		* @param  aPackageType    Type identifier.
       
   110 		* @param  aPackageID      Identifier of package.
       
   111 		*/
       
   112 		void PackageName (TFileName &aFileName, TUint32 aPackageType, TUint32 aPackageID);
       
   113 
       
   114 
       
   115 #ifdef __SIND_AUTOCONF_LID
       
   116 		/**
       
   117 		* Special loader for language identification data
       
   118 		* @return Pointer to the loaded data
       
   119 		*         NULL if error occurs during loading
       
   120 		*/ 
       
   121 		HBufC8* ConstructLidDataL();
       
   122 
       
   123 
       
   124 		/**
       
   125 		* Loads a file to the end of a buffer
       
   126 		* @param  aBuffer         The buffer where to load the data
       
   127 		* @param  aPackageType    Type identifier.
       
   128 		* @param  aPackageID      Identifier of package.
       
   129 		*/
       
   130 		void AppendLoadL( CBufBase *aBuffer, TUint32 aPackageType, TUint32 aPackageID );
       
   131 
       
   132 
       
   133 		/**
       
   134 		* Obtains the list of installed languages in the system and loads the corresponding data files
       
   135 		* to the buffer.
       
   136 		* @param  aBuffer         The buffer where to load the data
       
   137 		*/
       
   138 		void SysLangPackagesToBufferL( CBufBase *aBuffer );
       
   139 
       
   140 #endif  // __SIND_AUTOCONF_LID
       
   141 
       
   142         
       
   143     private: // Data
       
   144         
       
   145         // seperator
       
   146         HBufC* iSeparator ;
       
   147         
       
   148         // Prefix of file name 
       
   149         HBufC* iPrefixOfFileName;
       
   150         
       
   151         // Postfix of file name
       
   152         HBufC* iPostfixOfFileName;
       
   153         
       
   154         // File session
       
   155         RFs iFs;
       
   156 
       
   157         // Provides language configuration
       
   158         MSysConfigProvider *iProvider;
       
   159     };
       
   160     
       
   161 #endif // ASRPLUGINDATALOADER_H
       
   162 // End of File