xcfw/inc/xcfwlocalizer.h
changeset 0 79c6a41cd166
equal deleted inserted replaced
-1:000000000000 0:79c6a41cd166
       
     1 /*
       
     2 * Copyright (c) 2002-2005 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:  Class definition of XCFW DTD handler responsible for 
       
    15 *                entity conversions (localization)
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 #ifndef CXCFWLOCALIZER_H
       
    22 #define CXCFWLOCALIZER_H
       
    23 
       
    24 //  INCLUDES
       
    25 #include <s32std.h>
       
    26 #include <badesca.h>
       
    27 //#include <gmxmlentityconverter.h>
       
    28 //#include <gmxmlcomposer.h>
       
    29 
       
    30 // FORWARD DECLARATIONS
       
    31 class RFileReadStream;
       
    32 class RFs;
       
    33 
       
    34 /**
       
    35 * Localization handling class. Responsible for holding entity references 
       
    36 * and their corresponding text values loaded from a DTD file. Used for content 
       
    37 * localization purposes in XCFW.
       
    38 *
       
    39 *  @lib XCFW.lib
       
    40 *  @since Series 60 3.1
       
    41 */
       
    42 class CXCFWLocalizer :  public CBase //CMDXMLEntityConverter
       
    43     {
       
    44     public:  // Constructors and destructor
       
    45         
       
    46         /**
       
    47         * Two-phased constructor.
       
    48         * @param aData Node data object
       
    49         */
       
    50         static CXCFWLocalizer* NewL();
       
    51 
       
    52         /**
       
    53         * Destructor.
       
    54         */
       
    55         virtual ~CXCFWLocalizer();
       
    56 
       
    57     public: // New functions
       
    58         
       
    59         /**
       
    60         * Loads Entity references from DTD file
       
    61         * @since Series 60 3.1
       
    62         * @param aDTD File to load
       
    63         * @param aFs File system handle to use
       
    64         * @param aStatus Engine's request status, which Localizer will
       
    65         *   complete when DTD parsing is ready
       
    66         */
       
    67         void LoadDTDL(const TDesC& aDTD, 
       
    68             RFs& aFileSystem, 
       
    69             TRequestStatus* aStatus );
       
    70         
       
    71         /**
       
    72         * Converts a XML entity reference to localized text
       
    73         * @since Series 60 3.1
       
    74         * @param aRef Entity reference to convert
       
    75         * @param aText Localized text returned
       
    76         * @return Error code, e.g. KErrNotFound if given entity reference
       
    77         *  is not found.
       
    78         */
       
    79         TInt EntityRefToText(TDesC& aRef, TPtrC& aText);
       
    80         
       
    81         /** 
       
    82         * Converts given localized text into an entity reference
       
    83         * @s
       
    84         ince Series 60 3.1
       
    85         * @param aText text to get entity reference for
       
    86         * @param aRef Entity reference returned
       
    87         * @return Error code, e.g. KErrNotFound if no entity reference
       
    88         *  is found for the given text.
       
    89         */
       
    90         TInt TextToEntityRef(TDesC& aText, TPtrC& aRef);
       
    91         
       
    92         /**
       
    93         * Returns error code from the last LoadDTDL operation
       
    94         * Engine uses this to check that operation was successful when
       
    95         * Localizer completes the pending request.
       
    96         * @since Series 60 3.1
       
    97         * @return Error code from latest DTD load operation
       
    98         */
       
    99         TInt LastError();
       
   100 
       
   101     private:
       
   102 
       
   103         /**
       
   104         * C++ default constructor.
       
   105         */
       
   106         CXCFWLocalizer();
       
   107 
       
   108         /**
       
   109         * By default Symbian 2nd phase constructor is private.
       
   110         */
       
   111         void ConstructL();
       
   112 
       
   113         /**
       
   114         * DTD file parsing facility
       
   115         * @param aStream file stream to parse
       
   116         * @since Series 60 3.1
       
   117         */
       
   118         void ParseDTDL( RFileReadStream& aStream );
       
   119 
       
   120     private:    // Data
       
   121         
       
   122         //Descriptor arrays for entity references and texts
       
   123         CDesCArraySeg*  iReferences; //Own: Entity references without & and ;
       
   124         CDesCArraySeg*  iLocStrings; //Own: Localized texts
       
   125         TRequestStatus* iStatus; //Not owned: 
       
   126                 
       
   127     };
       
   128 
       
   129 #endif      // CXCFWLOCALIZER_H   
       
   130             
       
   131 // End of File