emailservices/emailstore/base_plugin/inc/basepluginresourceloader.h
branchRCL_3
changeset 12 4ce476e64c59
parent 11 0396474f30f5
equal deleted inserted replaced
11:0396474f30f5 12:4ce476e64c59
    20 
    20 
    21 //  INCLUDES
    21 //  INCLUDES
    22 #include <e32base.h>
    22 #include <e32base.h>
    23 #include <f32file.h>
    23 #include <f32file.h>
    24 #include <barsc.h>
    24 #include <barsc.h>
       
    25 #include <biditext.h>
    25 
    26 
    26 /**
    27 /**
    27  * Library to handle resource loading when CCoeEnv is not available.
    28  * Library to handle resource loading when CCoeEnv is not available.
    28  */
    29  */
    29 class CResourceLoader : public CBase
    30 class CResourceLoader : public CBase
    46     * @return reference to opened file session
    47     * @return reference to opened file session
    47     */
    48     */
    48     IMPORT_C RFs& Fs();
    49     IMPORT_C RFs& Fs();
    49     
    50     
    50     /**
    51     /**
    51      * @param aResourceId a resource key
    52      * @param aResourceId a resource key of a resource defined as LBUF
    52      * @return resource value from resource, instance ownership is transferred
    53      * @return resource value from resource, instance ownership is transferred
    53      */
    54      */
    54     IMPORT_C HBufC* LoadLC(TInt aResourceId );
    55     IMPORT_C HBufC* LoadLC(TInt aResourceId );
       
    56 
       
    57     /**
       
    58      * @param aResourceId a resource key of a resource defined as TBUF
       
    59      * @return resource value from resource, instance ownership is transferred
       
    60      */
       
    61     IMPORT_C HBufC* Load2L( TInt aResourceId );
       
    62 
       
    63     /**
       
    64      * @param aResourceId a resource key of a resource defined as TBUF
       
    65      * @return resource value from resource, instance ownership is transferred
       
    66      */
       
    67     IMPORT_C HBufC* Load2LC( TInt aResourceId );
       
    68     
       
    69     /**
       
    70      * @param aResourceId a resource key of a resource defined as TBUF
       
    71      * @param aString a string value used as parameter in formatting
       
    72      * @return resource value from resource, instance ownership is transferred
       
    73      */
       
    74     IMPORT_C HBufC* Load2LC( TInt aResourceId, const TDesC& aString );
       
    75 
       
    76     /**
       
    77      * @param aResourceId a resource key of a resource defined as TBUF
       
    78      * @param aString a string value used as parameter in formatting
       
    79      * @return resource value from resource, instance ownership is transferred
       
    80      */
       
    81     IMPORT_C HBufC* Load2L( TInt aResourceId, const TDesC& aString );
       
    82 
       
    83     /**
       
    84      * @param aResourceId a resource key of a resource defined as TBUF
       
    85      * @param aInt a number to be inserted into the string
       
    86      * @return resource value from resource, instance ownership is transferred
       
    87      */
       
    88     IMPORT_C HBufC* Load2LC( TInt aResourceId, TInt aInt );
       
    89 
       
    90     /**
       
    91      * @param aResourceId a resource key of a resource defined as TBUF
       
    92      * @param aInt a number to be inserted into the string
       
    93      * @return resource value from resource, instance ownership is transferred
       
    94      */
       
    95     IMPORT_C HBufC* Load2L( TInt aResourceId, TInt aInt );
    55 
    96 
    56     /**
    97     /**
    57      * @param aReader a reader
    98      * @param aReader a reader
    58      * @param aResourceId a resource key
    99      * @param aResourceId a resource key
    59      * @return pointer to resource buffer placed on leave stack
   100      * @return pointer to resource buffer placed on leave stack
    60      */
   101      */
    61     IMPORT_C HBufC8* CreateResourceReaderLC( TResourceReader& aReader,TInt aResourceId ) const;
   102     IMPORT_C HBufC8* CreateResourceReaderLC( TResourceReader& aReader, TInt aResourceId ) const;
    62     
   103     
    63 private:
   104 private:
    64 
   105 
    65     /**
   106     /**
    66     * A constructor
   107     * A constructor
    71     * A 2nd phase constructor
   112     * A 2nd phase constructor
    72     * @param aName a HTML macro, e.g. lt
   113     * @param aName a HTML macro, e.g. lt
    73     */
   114     */
    74     void ConstructL( const TDesC& aName );
   115     void ConstructL( const TDesC& aName );
    75 
   116 
       
   117     TInt GetSubStringCount( const TDesC& aText );
       
   118     HBufC* ResolveSubStringDirsL( TDes& aText, TInt aCount, TBool* aMarker );
       
   119     void RemoveNoDirMarkers(TDes& aText);
       
   120     TBidiText::TDirectionality DirectionalityL(const TDesC& aText, TBool* aFound);
       
   121     TBidiText::TDirectionality ResolveDirectionality(TDes& aText, TBool* aFound);
       
   122     HBufC* FormatStringL(const TDesC& aSource, const TDesC& aKey, const TDesC& aSubs, TBidiText::TDirectionality aDir);
       
   123     HBufC* FormatStringL( const TDesC& aSource, const TDesC& aKey, const TDesC& aSubs,
       
   124                           TBidiText::TDirectionality aDirectionality, TInt& aParamCount, TInt aSubCount );
       
   125     TInt Formater( TDes& aDest, const TDesC& aSource, const TDesC& aKey,
       
   126                    const TDesC& aSubs, TBidiText::TDirectionality aDirectionality );
       
   127     HBufC* ResolveSubStringL(TDes& aText, TBool* aMarker);
       
   128     TInt GetParamCount(const TDesC& aText, TInt aIndex = -1);
       
   129 
    76 private:
   130 private:
    77 
   131 
       
   132 class LanguageSpecificNumberConverter
       
   133     {
       
   134 public:
       
   135     static void Convert(TDes &aDes);
       
   136     static void ConvertToWesternNumbers(TDes &aDes);
       
   137     static TBool IsConversionNeeded();
       
   138     };
       
   139 
       
   140 private:
    78     RFs iFs;
   141     RFs iFs;
    79     RResourceFile iResFile;
   142     RResourceFile iResFile;
    80     };
   143     };
    81 
   144 
    82 
   145