1 | /*
|
---|
2 | * Copyright 2003,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: BinFileOutputStream.hpp,v $
|
---|
19 | * Revision 1.5 2004/09/08 13:56:13 peiyongz
|
---|
20 | * Apache License Version 2.0
|
---|
21 | *
|
---|
22 | * Revision 1.4 2004/02/16 04:02:34 neilg
|
---|
23 | * fix for bug 26936
|
---|
24 | *
|
---|
25 | * Revision 1.3 2004/01/29 11:46:30 cargilld
|
---|
26 | * Code cleanup changes to get rid of various compiler diagnostic messages.
|
---|
27 | *
|
---|
28 | * Revision 1.2 2003/12/17 13:58:02 cargilld
|
---|
29 | * Platform update for memory management so that the static memory manager (one
|
---|
30 | * used to call Initialize) is only for static data.
|
---|
31 | *
|
---|
32 | * Revision 1.1 2003/09/18 18:39:12 peiyongz
|
---|
33 | * Binary File Output Stream:
|
---|
34 | *
|
---|
35 | * $Id: BinFileOutputStream.hpp,v 1.5 2004/09/08 13:56:13 peiyongz Exp $
|
---|
36 | */
|
---|
37 |
|
---|
38 | #if !defined(BINFILEOUTPUTSTREAM_HPP)
|
---|
39 | #define BINFILEOUTPUTSTREAM_HPP
|
---|
40 |
|
---|
41 | #include <xercesc/framework/BinOutputStream.hpp>
|
---|
42 | #include <xercesc/util/PlatformUtils.hpp>
|
---|
43 |
|
---|
44 | XERCES_CPP_NAMESPACE_BEGIN
|
---|
45 |
|
---|
46 | class XMLUTIL_EXPORT BinFileOutputStream : public BinOutputStream
|
---|
47 | {
|
---|
48 | public :
|
---|
49 | // -----------------------------------------------------------------------
|
---|
50 | // Constructors and Destructor
|
---|
51 | // -----------------------------------------------------------------------
|
---|
52 |
|
---|
53 | ~BinFileOutputStream();
|
---|
54 |
|
---|
55 | BinFileOutputStream
|
---|
56 | (
|
---|
57 | const XMLCh* const fileName
|
---|
58 | , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
|
---|
59 | );
|
---|
60 |
|
---|
61 | BinFileOutputStream
|
---|
62 | (
|
---|
63 | const char* const fileName
|
---|
64 | , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
|
---|
65 | );
|
---|
66 |
|
---|
67 | // -----------------------------------------------------------------------
|
---|
68 | // Getter methods
|
---|
69 | // -----------------------------------------------------------------------
|
---|
70 | bool getIsOpen() const;
|
---|
71 | unsigned int getSize() const;
|
---|
72 | void reset();
|
---|
73 |
|
---|
74 |
|
---|
75 | // -----------------------------------------------------------------------
|
---|
76 | // Implementation of the input stream interface
|
---|
77 | // -----------------------------------------------------------------------
|
---|
78 | virtual unsigned int curPos() const;
|
---|
79 |
|
---|
80 | virtual void writeBytes
|
---|
81 | (
|
---|
82 | const XMLByte* const toGo
|
---|
83 | , const unsigned int maxToWrite
|
---|
84 | );
|
---|
85 |
|
---|
86 |
|
---|
87 | private :
|
---|
88 | // -----------------------------------------------------------------------
|
---|
89 | // Unimplemented constructors and operators
|
---|
90 | // -----------------------------------------------------------------------
|
---|
91 | BinFileOutputStream(const BinFileOutputStream&);
|
---|
92 | BinFileOutputStream& operator=(const BinFileOutputStream&);
|
---|
93 |
|
---|
94 | // -----------------------------------------------------------------------
|
---|
95 | // Private data members
|
---|
96 | //
|
---|
97 | // fSource
|
---|
98 | // The source file that we represent. The FileHandle type is defined
|
---|
99 | // per platform.
|
---|
100 | // -----------------------------------------------------------------------
|
---|
101 | FileHandle fSource;
|
---|
102 | MemoryManager* const fMemoryManager;
|
---|
103 | };
|
---|
104 |
|
---|
105 |
|
---|
106 | // ---------------------------------------------------------------------------
|
---|
107 | // BinFileOutputStream: Getter methods
|
---|
108 | // ---------------------------------------------------------------------------
|
---|
109 | inline bool BinFileOutputStream::getIsOpen() const
|
---|
110 | {
|
---|
111 | return (fSource != 0);
|
---|
112 | }
|
---|
113 |
|
---|
114 | XERCES_CPP_NAMESPACE_END
|
---|
115 |
|
---|
116 | #endif
|
---|