xml/xmlfw/src/xmlframework/parserimpl.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 __PARSERIMPL_H__
       
    17 #define __PARSERIMPL_H__
       
    18 
       
    19 #include <xml/contentprocessoruids.h> // needed for the typedef
       
    20 #include <xml/plugins/elementstack.h> // needed for the typedef
       
    21 #include <xml/matchdata.h>
       
    22 
       
    23 class RFs;
       
    24 
       
    25 namespace Xml
       
    26 {
       
    27 class MContentHandler;
       
    28 class MContentProcessor;
       
    29 class MParser;
       
    30 class CCharSetConverter;
       
    31 class RStringDictionaryCollection;
       
    32 
       
    33 
       
    34 class TParserImpl
       
    35 /** The TParserImpl class hides the implementation of the CParser.
       
    36 It is responsible for building and maintaining the list of plugins
       
    37 in the parsing chain, and has ownership of several key objects within
       
    38 the framework. */
       
    39 	{
       
    40 public:
       
    41 
       
    42 	TParserImpl();
       
    43 
       
    44 	void OpenL(const CMatchData& aMatchData, MContentHandler& aCallback);
       
    45 	void Close();
       
    46 
       
    47 
       
    48 	void ParseFileL(RFs& aFs, const TDesC& aFilename);
       
    49 	
       
    50 	void ParseChunkL(const TDesC8& aChunk);
       
    51 	void ParseLastChunkL(const TDesC8& aFinalChunk);
       
    52 
       
    53 	void SetContentHandler(MContentHandler& aCallback);
       
    54 	void SetProcessorChainL(const RContentProcessorUids& aPlugins);
       
    55 	void SetMimeTypeL(const CMatchData& aCriteria);
       
    56 	void ResetMimeTypeL();
       
    57 
       
    58 	TInt EnableFeature(TInt aParserFeature);
       
    59 	TInt DisableFeature(TInt aParserFeature);
       
    60 	TBool IsFeatureEnabled(TInt aParserFeature) const;
       
    61 
       
    62 	void AddPreloadedDictionaryL(const TDesC8& aPublicId);
       
    63 
       
    64 	RStringPool& StringPool();
       
    65 	RStringDictionaryCollection& StringDictionaryCollection();
       
    66 	
       
    67 private:
       
    68 
       
    69 	TParserImpl(const TParserImpl& aOriginal);
       
    70 	TParserImpl& operator=(const TParserImpl& aRhs);
       
    71 
       
    72 	MContentHandler* BuildChainL(MContentHandler& aCallback,
       
    73 								 const RContentProcessorUids& aPlugins);
       
    74 
       
    75 	void DestroyChain();
       
    76 	
       
    77 	MParser* ConstructParserL(const CMatchData& aMatchData, MContentHandler& aCallback);
       
    78 
       
    79 	MContentProcessor* ConstructPluginInReverseL(const TUid& aImplementationUid, 
       
    80 												 MContentHandler& aCallback);
       
    81 
       
    82 private:
       
    83 
       
    84 	/** The common element stack for this collection of plugins. */
       
    85 	RElementStack iElementStack; 
       
    86 
       
    87 	struct TDtorContentProcessorPtrMapping
       
    88 		{
       
    89 		TUid				iDtorKey;
       
    90 		MContentProcessor*	iContentProcessor;
       
    91 		};
       
    92 
       
    93 	static void DestroyContentProcessorPtrMapping(TAny* aPtr);
       
    94 
       
    95 	/** The collection of MContentProcessor pointers and Dtor keys that make up the chain of command.
       
    96     The chain order is determined by the the index, 0 being the first plugin in the chain. */
       
    97 	RPointerArray<TDtorContentProcessorPtrMapping>	iDtorKeyAndPluginList;
       
    98 	
       
    99 	TUid						 iParserDtorKey;
       
   100 	MParser*					 iParser;
       
   101 	CCharSetConverter*  		 iCharSetConverter;
       
   102 	RStringDictionaryCollection* iStringDictionaryCollection;
       
   103 	MContentHandler*			 iClient;
       
   104 	CMatchData                       iDefParserMatchData;
       
   105 	CMatchData                       iCurrentParserMatchData;
       
   106 	};
       
   107 
       
   108 }
       
   109 
       
   110 #endif //__PARSERIMPL_H__