xml/xmldomandxpath/src/xmlengineserializer/xmlengdeserializerxop.h
changeset 0 e35f40988205
equal deleted inserted replaced
-1:000000000000 0:e35f40988205
       
     1 // Copyright (c) 2006-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 // XML XOP Deserializer
       
    15 //
       
    16 
       
    17 
       
    18 
       
    19 /**
       
    20  @file
       
    21  @internalComponent
       
    22  @released
       
    23 */
       
    24 #ifndef XMLENGDESERIALIZERXOP_H
       
    25 #define XMLENGDESERIALIZERXOP_H
       
    26 
       
    27 #include <xml/utils/xmlengxestd.h>
       
    28 #include <xml/dom/xmlengdeserializer.h>
       
    29 
       
    30 class RFs;
       
    31 class CBodyPart;
       
    32 
       
    33 using namespace Xml;
       
    34 
       
    35 class CXmlEngContentHandler;
       
    36 
       
    37 /**
       
    38  * XOP deserializer
       
    39  * 
       
    40  */
       
    41 class CXmlEngDeserializerXOP: public CXmlEngDeserializer
       
    42 {
       
    43  public:
       
    44     /**
       
    45      * Creates an instance of CXmlEngDeserializerXOP
       
    46 	 * @param aContentHandler Content handler
       
    47 	 * @param aCleanXOPInfoset Indicates that XOP package contains only clean XOP infoset	      
       
    48      *
       
    49      */
       
    50     static CXmlEngDeserializerXOP* NewL( MContentHandler& aContentHandler, TBool aCleanXOPInfoset );
       
    51 
       
    52     /**
       
    53      * Enables CParser feature
       
    54      *
       
    55 	 * @param aParserFeature Paser feature flag
       
    56      */	
       
    57 	IMPORT_C TInt EnableFeature(TInt aParserFeature);
       
    58 	
       
    59     /**
       
    60      * Disables CParser feature
       
    61      *
       
    62 	 * @param aParserFeature Paser feature flag
       
    63      */	
       
    64 	IMPORT_C TInt DisableFeature(TInt aParserFeature);
       
    65 
       
    66     /**
       
    67      * Checks if a feature is enabled
       
    68      *
       
    69 	 * @param aParserFeature Paser feature flag
       
    70      */	
       
    71 	IMPORT_C TBool IsFeatureEnabled(TInt aParserFeature) const;
       
    72 
       
    73     /**
       
    74      * Deserializes XML
       
    75      *
       
    76      *
       
    77      * @leave KErrNoMemory, KErrGeneral, KXmlEngErrWrongEncoding.
       
    78      */
       
    79 	void DeserializeL();  
       
    80 
       
    81     /**
       
    82      * Deserializes XML
       
    83      *
       
    84      * @param aFileName File to be parsed
       
    85      * @param aHandler Content handler for SAX callbacks
       
    86      * @param aOptions Parsing options
       
    87 	 *
       
    88      * @leave KErrNoMemory, KErrGeneral, KXmlEngErrWrongEncoding.
       
    89      */
       
    90 	void DeserializeL( const TDesC& aFileName, 
       
    91 					   const TXmlEngParsingOptions& aOptions 
       
    92 					   	= TXmlEngParsingOptions());	   
       
    93 
       
    94     /**
       
    95      * Deserializes XML
       
    96      *
       
    97      * @param aRFs File Server session
       
    98      * @param aFileName File to be parsed
       
    99      * @param aHandler Content handler for SAX callbacks
       
   100      * @param aOptions Parsing options
       
   101 	 *
       
   102      * @leave KErrNoMemory, KErrGeneral, KXmlEngErrWrongEncoding.
       
   103      */
       
   104 	void DeserializeL( RFs& aRFs, 
       
   105 					   const TDesC& aFileName, 
       
   106 					   const TXmlEngParsingOptions& aOptions 
       
   107 					   	= TXmlEngParsingOptions());     
       
   108 	
       
   109     /**
       
   110      * Deserializes XML
       
   111      *
       
   112      * @param aBuffer Buffer to be parsed
       
   113      * @param aHandler Content handler for SAX callbacks  
       
   114      * @param aOptions Parsing options   
       
   115 	 *
       
   116      * @leave KErrNoMemory, KErrGeneral, KXmlEngErrWrongEncoding.
       
   117      */
       
   118     void DeserializeL( const TDesC8& aBuffer, 
       
   119 					   const TXmlEngParsingOptions& aOptions 
       
   120 					   	= TXmlEngParsingOptions() );
       
   121     
       
   122     /**
       
   123      * Retrieves pointer to data referenced by CID from parsed multipart package
       
   124      *
       
   125      * @param aCid Content ID   
       
   126 	 *
       
   127  	 * @return Pointer to referenced data, or NULL if data is not found
       
   128      */    
       
   129     TInt GetData(const TDesC8& aCid, TPtrC8& aData);
       
   130       
       
   131     /**
       
   132      * Destructor.
       
   133      *
       
   134      */
       
   135     ~CXmlEngDeserializerXOP();
       
   136 
       
   137 protected:
       
   138     
       
   139 
       
   140 private:
       
   141     /**
       
   142      * Constructor
       
   143      *
       
   144 	 * @param aCleanXOPInfoset Indicates that XOP package contains only clean XOP infoset     
       
   145      */
       
   146     CXmlEngDeserializerXOP( TBool aCleanXOPInfoset );
       
   147 
       
   148     /**
       
   149      * 2nd Phase constructor
       
   150      */	 
       
   151 	 void ConstructL( MContentHandler& aContentHandler );
       
   152 
       
   153 	/**
       
   154 	 * Read the file
       
   155 	 *
       
   156 	 * @param aRFs File Server session
       
   157 	 * @param aFileName File name to be read
       
   158 	 *
       
   159  	 * @return Pointer to memory buffer with file content 
       
   160 	 */
       
   161 	 HBufC8* ReadFileL( RFs& aRFs, const TDesC& aFileName );
       
   162 	   
       
   163 
       
   164 //	TXmlEngDeserializationSource SerializationOutput();
       
   165 	
       
   166 
       
   167 public: //data
       
   168 
       
   169 protected: //data
       
   170 
       
   171 	/** body of multipart package **/
       
   172 	HBufC8* iData;
       
   173 
       
   174 	/** body part array for parsed multipart document **/
       
   175 	RPointerArray<CBodyPart> iBodyPartArray;
       
   176 	
       
   177 	/** pointer to single binary data **/
       
   178 	TPtrC8 iDataPtr;
       
   179 	
       
   180 	/** internal content handler **/
       
   181 	CXmlEngContentHandler* iInternalHandler;
       
   182 	
       
   183 	/**	Indicates that XOP package contains only clean XOP infoset **/
       
   184 	TBool iCleanXOPInfoset;	
       
   185 
       
   186 	//Features mode
       
   187 	TInt iParserMode;		
       
   188 		
       
   189 private: //data
       
   190 
       
   191 }; //class CXmlEngDeserializerXOP
       
   192 
       
   193 
       
   194 
       
   195 #endif /* XMLENGDESERIALIZERXOP_H */