xml/xmlexpatparser/src/xmlparserplugin.h
changeset 0 e35f40988205
equal deleted inserted replaced
-1:000000000000 0:e35f40988205
       
     1 // Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #ifndef XMLPARSERPLUGIN_H
       
    17 #define XMLPARSERPLUGIN_H
       
    18 
       
    19 #include <xml/plugins/parserinitparams.h>
       
    20 #include <xml/plugins/parserinterface.h>
       
    21 
       
    22 #include "cexpat.h"
       
    23 
       
    24 /*
       
    25 CXmlParserPlugin class.
       
    26 
       
    27 1.
       
    28 This is the top level class of xmlparserplugin.dll - an Ecom plugin
       
    29 for use in the Xml framework.
       
    30 
       
    31 For full details of the plug-in configuration see the files pmlparser.mmp
       
    32 and 101faa0a.rss.
       
    33 
       
    34 Ecom constructs the plug-in by virtue of a call to the static member
       
    35 function EcomNewL, a pointer to which is contained in the associated
       
    36 TImplementationProxy table for the plug-in.
       
    37 
       
    38 2.
       
    39 This class implements the MParser interface defined in xml/parser.h
       
    40 
       
    41 3.
       
    42 The parsing functionality is subcontracted to the Expat parser toolkit,
       
    43 captured in the class CExpat, see the file cexpat.h.
       
    44 */
       
    45 class CXmlParserPlugin : public CBase, Xml::MParser
       
    46 	{
       
    47 public:
       
    48 
       
    49 	/*
       
    50 	EcomNewL function intended for construction by Ecom of implementation MParser interface.
       
    51 	*/
       
    52 	static Xml::MParser* EcomNewL(TAny* aInitParams);
       
    53 
       
    54 	/*
       
    55 	This class has a private destructor.  The Xml Framework destroys the parser using this Release method.
       
    56 	*/
       
    57 	void Release();
       
    58 
       
    59 	/*
       
    60 	Standard NewL function.  This function is used by EcomNewL but has been provided separately for
       
    61 	testing purposes.
       
    62 	*/
       
    63 	static CXmlParserPlugin* NewL(TAny* aInitParams, TInt aDebugFailCount=0);
       
    64 	
       
    65 
       
    66 	/*
       
    67 	Implementation of MParser interface
       
    68 	*/
       
    69 	TInt EnableFeature(TInt aParserFeature);
       
    70 	TInt DisableFeature(TInt aParserFeature);
       
    71 	TBool IsFeatureEnabled(TInt aParserFeature) const;
       
    72 	void ParseChunkL(const TDesC8& aChunk);
       
    73 	void ParseLastChunkL(const TDesC8& aFinalChunk);
       
    74 
       
    75 	void SetContentSink(Xml::MContentHandler& aContentHandler);
       
    76 	
       
    77 	RStringPool& StringPool();
       
    78 
       
    79 	/*
       
    80 	Function used to access internal parser heap for testing
       
    81 	*/
       
    82 	RHeap* GetInternalHeap() const;
       
    83 
       
    84 private:
       
    85 	CXmlParserPlugin(Xml::MContentHandler* aContentHandler);
       
    86 	void ConstructL(Xml::RStringDictionaryCollection* aStringDictionaryCollection, Xml::CCharSetConverter* aCharSetConverter,
       
    87 		RElementStack* aElementStack, TInt aDebugFailCount);
       
    88 	void ParseChunkInPartsL(const TDesC8& aChunk);
       
    89 	virtual ~CXmlParserPlugin();
       
    90 
       
    91 private:
       
    92 	/*
       
    93 	References to client-provided objects
       
    94 	*/
       
    95 	Xml::MContentHandler& iContentHandler;
       
    96 
       
    97 	/*
       
    98 	CExpat is the work horse of the parser
       
    99 	*/
       
   100 	CExpat* iExpat;
       
   101 	TInt iExpatResetError;
       
   102 	};
       
   103 
       
   104 #endif // XMLPARSER_H