xml/xmldomandxpath/src/xmlengineserializer/xmlenggzipoutputstream.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 // Class used to serialize DOM tree to compressed stream
       
    15 //
       
    16 
       
    17 
       
    18 
       
    19 /**
       
    20  @file
       
    21  @internalComponent
       
    22  @released
       
    23 */
       
    24 #ifndef XMLENGCGZIPOUTPUTSTREAM_H
       
    25 #define XMLENGCGZIPOUTPUTSTREAM_H
       
    26 
       
    27 #include <xml/dom/xmlengoutputstream.h>
       
    28 #include <ezbufman.h>   //MEZBufferManager
       
    29 #include <ezgzip.h>     //TEZGZipHeader
       
    30 
       
    31 class CEZCompressor;
       
    32 
       
    33 class CXmlEngGZIPOutputStream : public CBase, public MXmlEngOutputStream, public MEZBufferManager
       
    34 	{
       
    35 	public:
       
    36         static CXmlEngGZIPOutputStream* NewLC(MXmlEngOutputStream& aOutputStream);
       
    37 
       
    38         static CXmlEngGZIPOutputStream* NewL(MXmlEngOutputStream& aOutputStream);
       
    39 
       
    40 	    ~CXmlEngGZIPOutputStream();
       
    41 	    
       
    42 	    /**
       
    43 	     * Get last error
       
    44 	     */
       
    45 		TInt CheckError();
       
    46 
       
    47         /**
       
    48          * Implementation of MXmlEngOutputStream interface.
       
    49          */
       
    50 	    TInt Write( const TDesC8& aBuffer );
       
    51 		TInt Close();
       
    52         
       
    53         /**
       
    54          * Implementation of MEZBufferManager interface.
       
    55          */
       
    56 	    void InitializeL(CEZZStream& aZStream);
       
    57 	    void NeedInputL(CEZZStream& aZStream);
       
    58 	    void NeedOutputL(CEZZStream& aZStream);
       
    59 	    void FinalizeL(CEZZStream& aZStream);
       
    60 
       
    61 
       
    62     protected:
       
    63 	    CXmlEngGZIPOutputStream(MXmlEngOutputStream& aOutputBuffer);
       
    64 	    void ConstructL();
       
    65 
       
    66     private:
       
    67         void WriteL(const TDesC8& aBuffer);
       
    68 		void CloseL();
       
    69 			
       
    70 	private:
       
    71 	    /**
       
    72 	     * Last error
       
    73 	     */
       
    74 	    TInt iError;
       
    75 	    
       
    76 	    RBuf8 iOutputDescriptor;
       
    77 	    RBuf8 iInputDescriptor;
       
    78 	    RBuf8 iOldInputDescriptor;
       
    79 	    
       
    80 	    /**
       
    81 	     * Engine of GZiping
       
    82 	     */
       
    83 	    CEZCompressor* iCompressor;
       
    84 
       
    85 	    MXmlEngOutputStream* iOutputString;
       
    86         /**
       
    87          * State of the object.
       
    88          */	    
       
    89 	    TBool iNoInputNeeded;
       
    90 	    TBool iKeepGoing;
       
    91 	    TBool iCloseInvoked;
       
    92 	    
       
    93 	}; 
       
    94 
       
    95 
       
    96 
       
    97 #endif /* XMLENGCGZIPOUTPUTSTREAM_H */