brandingserver/tools/bsimport/inc/cbsimportxmlparser-1.h
author Pat Downey <patd@symbian.org>
Wed, 01 Sep 2010 12:27:45 +0100
branchRCL_3
changeset 22 113b91e0a2ad
parent 21 cfd5c2994f10
permissions -rw-r--r--
Revert incorrect RCL_3 drop: Revision: 201033 Kit: 201035
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
e6b17d312c8b Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     1
/*
e6b17d312c8b Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     2
* Copyright (c) 2006-2006 Nokia Corporation and/or its subsidiary(-ies).
e6b17d312c8b Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     3
* All rights reserved.
e6b17d312c8b Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     4
* This component and the accompanying materials are made available
22
113b91e0a2ad Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 21
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
0
e6b17d312c8b Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     6
* which accompanies this distribution, and is available
e6b17d312c8b Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
e6b17d312c8b Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     8
*
e6b17d312c8b Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     9
* Initial Contributors:
e6b17d312c8b Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
e6b17d312c8b Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    11
*
e6b17d312c8b Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    12
* Contributors:
e6b17d312c8b Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    13
*
22
113b91e0a2ad Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 21
diff changeset
    14
* Description:  Parses XML content and stores data to storage*
0
e6b17d312c8b Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    15
*/
e6b17d312c8b Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    16
#ifndef CBSIMPORTXMLPARSER_H#define CBSIMPORTXMLPARSER_H// INCLUDE FILES#include <e32base.h>#include <f32file.h>#include <GMXMLDocument.h>#include <rbsobjowningptrarray.h>#include <mbselement.h>class CMDXMLNode;class CBSImportStorageManager;// CLASS DEFINITIONclass CBSImportXMLParser : public CBase    {private: // Definitions    struct TImportBitmap        {        TInt iBitmapId;        TInt iBitmapMaskId;        TInt iSkinId;        TInt iSkinMaskId;        };    enum TXMLBaseTagTypes        {        EBrandUnknown,        EBrandAppID,        EBrandID,        EBrandLanguage,        EBrandVersion,        EBrandElement        };        public:    static CBSImportXMLParser* NewL( CBSImportStorageManager* aStorage );        static CBSImportXMLParser* NewLC( CBSImportStorageManager* aStorage );    ~CBSImportXMLParser();    /**     * Parse XML document and store data to storage     *     * @since S60 3.2     * @param aDocument XML document to parse     * @return none     */    void ParseDocumentL( CMDXMLDocument& aDocument );private:    CBSImportXMLParser( CBSImportStorageManager* aStorage );        void ConstructL();        /**     * Parses full the base element <branding> and it's child elements.     *     * @since S60 v3.2     * @param aElement to parse     */    void ParseDocumentBaseL( CMDXMLNode* aElement );        /**     * Analyzes a child node of <branding> and stores the value to storage.     * Ignores undetected XML nodes.     *     * @since S60 v3.2     * @param aElement to parse     */    void AnalyzeNodeL( CMDXMLNode* aNode );        /**     * Converts a given node to TXMLBaseTagTypes. This can handle all     * child nodes of <branding>     *     * @since S60 v3.2     * @param aNode node to check     * @return corresponding TXMLBaseTagTypes value (or EBrandUnknown).     */    TXMLBaseTagTypes SolveTagTypeL( CMDXMLNode* aNode );    /**     * Parses full <element> node. Returns a newly constructed MBSElement     * from the content of teh node.      * Ownership is transferred!     *     * @since S60 v3.2     * @param aNode <element> node     * @return Concrete element constructed from node.      */    MBSElement* ParseBrandElementL( CMDXMLNode* aNode );        /**     * Converts elements type attribute value to TBSElementType      * (see MBSElement).     *     * @since S60 v3.2     * @param aType value of type attribute     * @return corresponding TBrandingElementType value or KErrNotFound.     */    TInt SolveElementType( const TDesC& aType );    /**     * Search a child node with name inside another node. Returns the first match     *     * @since S60 v3.2     * @param aNode parent node to search      * @param aTagName Child nodes name     * @return found node or NULL if not found;     */    CMDXMLNode* SearchChild( CMDXMLNode* aNode, const TDesC& aChildName );    /**     * Parse value from <element_value> tag. Leaves if parse fails.     * Ownership is transferred to caller (NodeTextLC)     *     * @since S60 3.2     * @param aNode XML node to parse. should be <element_value>.     * @return value from <element_value>     */    HBufC* NodeTextLC( CMDXMLNode* elNode );    TInt   NodeIntL  ( CMDXMLNode* elNode );        /**     * Parse <element> tag for given value type. Leaves if parsing fails.     *     * @since S60 3.2     * @param aNode XML node to parse     * @param aValue Parsed value     * @return none     */    void DoParseIntegerL( CMDXMLNode* aNode, TInt& aValue );    void DoParseTextL   ( CMDXMLNode* aNode, HBufC*& aText );    void DoParseFileL   ( CMDXMLNode* aNode, HBufC*& aText );    void DoParseListL   ( CMDXMLNode* aNode, RBSObjOwningPtrArray<MBSElement>& aElementArray );    void DoParseBitmapL ( CMDXMLNode* aNode, CBSBitmap*& aBitmap );    private: // Data        // Not owned. Storage where to put parsed elements    CBSImportStorageManager* iStorage;    };#endif //CBSIMPORTXMLPARSER_H