xref: /aoo4110/main/package/inc/Deflater.hxx (revision b1cdbd2c)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 #ifndef _DEFLATER_HXX_
24 #define _DEFLATER_HXX_
25 
26 #include <com/sun/star/uno/Sequence.hxx>
27 
28 extern "C"
29 {
30 	typedef struct z_stream_s z_stream;
31 }
32 
33 class Deflater
34 {
35 protected:
36 	com::sun::star::uno::Sequence< sal_Int8 > sInBuffer;
37 	sal_Bool				bFinish;
38 	sal_Bool				bFinished;
39 	sal_Bool				bSetParams;
40 	sal_Int32				nLevel, nStrategy;
41 	sal_Int32				nOffset, nLength;
42 	z_stream*				pStream;
43 
44 	void init (sal_Int32 nLevel, sal_Int32 nStrategy, sal_Bool bNowrap);
45 	sal_Int32 doDeflateBytes (com::sun::star::uno::Sequence < sal_Int8 > &rBuffer, sal_Int32 nNewOffset, sal_Int32 nNewLength);
46 
47 public:
48 	~Deflater();
49 	Deflater(sal_Int32 nSetLevel, sal_Bool bNowrap);
50     void SAL_CALL setInputSegment( const ::com::sun::star::uno::Sequence< sal_Int8 >& rBuffer, sal_Int32 nNewOffset, sal_Int32 nNewLength );
51     void SAL_CALL setLevel( sal_Int32 nNewLevel );
52     sal_Bool SAL_CALL needsInput(  );
53     void SAL_CALL finish(  );
54     sal_Bool SAL_CALL finished(  );
55     sal_Int32 SAL_CALL doDeflateSegment( ::com::sun::star::uno::Sequence< sal_Int8 >& rBuffer, sal_Int32 nNewOffset, sal_Int32 nNewLength );
56     sal_Int32 SAL_CALL getTotalIn(  );
57     sal_Int32 SAL_CALL getTotalOut(  );
58     void SAL_CALL reset(  );
59     void SAL_CALL end(  );
60 };
61 
62 #endif
63