[971] | 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
|
---|
[975] | 63 |
|
---|
[971] | 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 |
|
---|
[975] | 107 | unsigned int mCurrentPos;
|
---|
[1264] | 108 |
|
---|
[971] | 109 | private :
|
---|
| 110 | // -----------------------------------------------------------------------
|
---|
| 111 | // Unimplemented constructors and operators
|
---|
| 112 | // -----------------------------------------------------------------------
|
---|
[1294] | 113 |
|
---|
[971] | 114 | GzBinFileInputStream(const GzBinFileInputStream&);
|
---|
| 115 | GzBinFileInputStream& operator=(const GzBinFileInputStream&);
|
---|
| 116 |
|
---|
| 117 | // -----------------------------------------------------------------------
|
---|
| 118 | // Private data members
|
---|
| 119 | //
|
---|
| 120 | // fSource
|
---|
| 121 | // The source file that we represent. The FileHandle type is defined
|
---|
| 122 | // per platform.
|
---|
| 123 | // -----------------------------------------------------------------------
|
---|
[1294] | 124 |
|
---|
[971] | 125 | FileHandle fSource;
|
---|
| 126 | MemoryManager* const fMemoryManager;
|
---|
| 127 | };
|
---|
| 128 |
|
---|
| 129 |
|
---|
| 130 | // ---------------------------------------------------------------------------
|
---|
| 131 | // GzBinFileInputStream: Getter methods
|
---|
| 132 | // ---------------------------------------------------------------------------
|
---|
[1294] | 133 |
|
---|
[971] | 134 | inline bool GzBinFileInputStream::getIsOpen() const
|
---|
| 135 | {
|
---|
[1294] | 136 | return bool (mStream.is_open());//(fSource != 0);
|
---|
[971] | 137 | }
|
---|
| 138 |
|
---|
| 139 | XERCES_CPP_NAMESPACE_END
|
---|
| 140 |
|
---|
| 141 | #endif
|
---|