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: BinFileInputStream.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(BINFILEINPUTSTREAM_HPP)
|
---|
56 | #define BINFILEINPUTSTREAM_HPP
|
---|
57 |
|
---|
58 | #include <xercesc/util/BinInputStream.hpp>
|
---|
59 | #include <xercesc/util/PlatformUtils.hpp>
|
---|
60 |
|
---|
61 | XERCES_CPP_NAMESPACE_BEGIN
|
---|
62 |
|
---|
63 | class XMLUTIL_EXPORT BinFileInputStream : public BinInputStream
|
---|
64 | {
|
---|
65 | public :
|
---|
66 | // -----------------------------------------------------------------------
|
---|
67 | // Constructors and Destructor
|
---|
68 | // -----------------------------------------------------------------------
|
---|
69 | BinFileInputStream
|
---|
70 | (
|
---|
71 | const XMLCh* const fileName
|
---|
72 | , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
|
---|
73 | );
|
---|
74 |
|
---|
75 | BinFileInputStream
|
---|
76 | (
|
---|
77 | const char* const fileName
|
---|
78 | , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
|
---|
79 | );
|
---|
80 |
|
---|
81 | BinFileInputStream
|
---|
82 | (
|
---|
83 | const FileHandle toUse
|
---|
84 | , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
|
---|
85 | );
|
---|
86 |
|
---|
87 | virtual ~BinFileInputStream();
|
---|
88 |
|
---|
89 |
|
---|
90 | // -----------------------------------------------------------------------
|
---|
91 | // Getter methods
|
---|
92 | // -----------------------------------------------------------------------
|
---|
93 | bool getIsOpen() const;
|
---|
94 | unsigned int getSize() const;
|
---|
95 | void reset();
|
---|
96 |
|
---|
97 |
|
---|
98 | // -----------------------------------------------------------------------
|
---|
99 | // Implementation of the input stream interface
|
---|
100 | // -----------------------------------------------------------------------
|
---|
101 | virtual unsigned int curPos() const;
|
---|
102 |
|
---|
103 | virtual unsigned int readBytes
|
---|
104 | (
|
---|
105 | XMLByte* const toFill
|
---|
106 | , const unsigned int maxToRead
|
---|
107 | );
|
---|
108 |
|
---|
109 |
|
---|
110 | private :
|
---|
111 | // -----------------------------------------------------------------------
|
---|
112 | // Unimplemented constructors and operators
|
---|
113 | // -----------------------------------------------------------------------
|
---|
114 | BinFileInputStream(const BinFileInputStream&);
|
---|
115 | BinFileInputStream& operator=(const BinFileInputStream&);
|
---|
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 | // -----------------------------------------------------------------------
|
---|
124 | FileHandle fSource;
|
---|
125 | MemoryManager* const fMemoryManager;
|
---|
126 | };
|
---|
127 |
|
---|
128 |
|
---|
129 | // ---------------------------------------------------------------------------
|
---|
130 | // BinFileInputStream: Getter methods
|
---|
131 | // ---------------------------------------------------------------------------
|
---|
132 | inline bool BinFileInputStream::getIsOpen() const
|
---|
133 | {
|
---|
134 | return (fSource != 0);
|
---|
135 | }
|
---|
136 |
|
---|
137 | XERCES_CPP_NAMESPACE_END
|
---|
138 |
|
---|
139 | #endif
|
---|