1 | /*
|
---|
2 | * Copyright 1999-2000,2004 The Apache Software Foundation.
|
---|
3 | *
|
---|
4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
---|
5 | * you may not use this file except in compliance with the License.
|
---|
6 | * You may obtain a copy of the License at
|
---|
7 | *
|
---|
8 | * http://www.apache.org/licenses/LICENSE-2.0
|
---|
9 | *
|
---|
10 | * Unless required by applicable law or agreed to in writing, software
|
---|
11 | * distributed under the License is distributed on an "AS IS" BASIS,
|
---|
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
---|
13 | * See the License for the specific language governing permissions and
|
---|
14 | * limitations under the License.
|
---|
15 | */
|
---|
16 |
|
---|
17 | /*
|
---|
18 | * $Log: GzBinFileInputStream.hpp,v $
|
---|
19 | * Revision 1.7 2004/09/08 13:56:21 peiyongz
|
---|
20 | * Apache License Version 2.0
|
---|
21 | *
|
---|
22 | * Revision 1.6 2004/01/29 11:48:46 cargilld
|
---|
23 | * Code cleanup changes to get rid of various compiler diagnostic messages.
|
---|
24 | *
|
---|
25 | * Revision 1.5 2003/12/17 13:58:02 cargilld
|
---|
26 | * Platform update for memory management so that the static memory manager (one
|
---|
27 | * used to call Initialize) is only for static data.
|
---|
28 | *
|
---|
29 | * Revision 1.4 2003/06/03 18:12:29 knoaman
|
---|
30 | * Add default value for memory manager argument.
|
---|
31 | *
|
---|
32 | * Revision 1.3 2003/05/16 03:11:22 knoaman
|
---|
33 | * Partial implementation of the configurable memory manager.
|
---|
34 | *
|
---|
35 | * Revision 1.2 2002/11/04 15:22:03 tng
|
---|
36 | * C++ Namespace Support.
|
---|
37 | *
|
---|
38 | * Revision 1.1.1.1 2002/02/01 22:22:09 peiyongz
|
---|
39 | * sane_include
|
---|
40 | *
|
---|
41 | * Revision 1.3 2000/02/24 20:05:23 abagchi
|
---|
42 | * Swat for removing Log from API docs
|
---|
43 | *
|
---|
44 | * Revision 1.2 2000/02/06 07:48:01 rahulj
|
---|
45 | * Year 2K copyright swat.
|
---|
46 | *
|
---|
47 | * Revision 1.1.1.1 1999/11/09 01:04:00 twl
|
---|
48 | * Initial checkin
|
---|
49 | *
|
---|
50 | * Revision 1.3 1999/11/08 20:45:03 rahul
|
---|
51 | * Swat for adding in Product name and CVS comment log variable.
|
---|
52 | *
|
---|
53 | */
|
---|
54 |
|
---|
55 | #if !defined(GZBINFILEINPUTSTREAM_HPP)
|
---|
56 | #define GZBINFILEINPUTSTREAM_HPP
|
---|
57 |
|
---|
58 | #include <xercesc/util/BinInputStream.hpp>
|
---|
59 | #include <xercesc/util/PlatformUtils.hpp>
|
---|
60 | #include "gzstream.h"
|
---|
61 |
|
---|
62 | XERCES_CPP_NAMESPACE_BEGIN
|
---|
63 |
|
---|
64 | class /*XMLUTIL_EXPORT*/ GzBinFileInputStream : public BinInputStream
|
---|
65 | {
|
---|
66 | public :
|
---|
67 | // -----------------------------------------------------------------------
|
---|
68 | // Constructors and Destructor
|
---|
69 | // -----------------------------------------------------------------------
|
---|
70 | GzBinFileInputStream
|
---|
71 | (
|
---|
72 | const XMLCh* const fileName
|
---|
73 | , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
|
---|
74 | );
|
---|
75 |
|
---|
76 | GzBinFileInputStream
|
---|
77 | (
|
---|
78 | const char* const fileName
|
---|
79 | , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
|
---|
80 | );
|
---|
81 |
|
---|
82 |
|
---|
83 | virtual ~GzBinFileInputStream();
|
---|
84 |
|
---|
85 |
|
---|
86 | // -----------------------------------------------------------------------
|
---|
87 | // Getter methods
|
---|
88 | // -----------------------------------------------------------------------
|
---|
89 | bool getIsOpen() const;
|
---|
90 | unsigned int getSize() const;
|
---|
91 | void reset();
|
---|
92 |
|
---|
93 |
|
---|
94 | // -----------------------------------------------------------------------
|
---|
95 | // Implementation of the input stream interface
|
---|
96 | // -----------------------------------------------------------------------
|
---|
97 | virtual unsigned int curPos() const;
|
---|
98 |
|
---|
99 | virtual unsigned int readBytes
|
---|
100 | (
|
---|
101 | XMLByte* const toFill
|
---|
102 | , const unsigned int maxToRead
|
---|
103 | );
|
---|
104 |
|
---|
105 | igzstream mStream;
|
---|
106 |
|
---|
107 | unsigned int mCurrentPos;
|
---|
108 | private :
|
---|
109 | // -----------------------------------------------------------------------
|
---|
110 | // Unimplemented constructors and operators
|
---|
111 | // -----------------------------------------------------------------------
|
---|
112 | GzBinFileInputStream(const GzBinFileInputStream&);
|
---|
113 | GzBinFileInputStream& operator=(const GzBinFileInputStream&);
|
---|
114 |
|
---|
115 | // -----------------------------------------------------------------------
|
---|
116 | // Private data members
|
---|
117 | //
|
---|
118 | // fSource
|
---|
119 | // The source file that we represent. The FileHandle type is defined
|
---|
120 | // per platform.
|
---|
121 | // -----------------------------------------------------------------------
|
---|
122 | FileHandle fSource;
|
---|
123 | MemoryManager* const fMemoryManager;
|
---|
124 | };
|
---|
125 |
|
---|
126 |
|
---|
127 | // ---------------------------------------------------------------------------
|
---|
128 | // GzBinFileInputStream: Getter methods
|
---|
129 | // ---------------------------------------------------------------------------
|
---|
130 | inline bool GzBinFileInputStream::getIsOpen() const
|
---|
131 | {
|
---|
132 | return (fSource != 0);
|
---|
133 | }
|
---|
134 |
|
---|
135 | XERCES_CPP_NAMESPACE_END
|
---|
136 |
|
---|
137 | #endif
|
---|