1 | /*
|
---|
2 | * Copyright 2002,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 | * $Id: FileHandleImpl.hpp,v 1.5 2004/09/08 13:56:41 peiyongz Exp $
|
---|
19 | */
|
---|
20 |
|
---|
21 | #ifndef FILEHANDLEIMPL_HPP
|
---|
22 | #define FILEHANDLEIMPL_HPP
|
---|
23 | #include <xercesc/util/PlatformUtils.hpp>
|
---|
24 | #include <xercesc/util/XMemory.hpp>
|
---|
25 |
|
---|
26 | XERCES_CPP_NAMESPACE_BEGIN
|
---|
27 |
|
---|
28 | class FileHandleImpl : public XMemory
|
---|
29 | {
|
---|
30 | private:
|
---|
31 | FILE* Handle; // handle from fopen
|
---|
32 | XMLByte* stgBufferPtr; // address of staging buffer
|
---|
33 | int nextByte; // NAB in staging buffer
|
---|
34 | int openType; // 0=write, 1=read
|
---|
35 | int lrecl; // LRECL if openType is write
|
---|
36 | bool recordType; // true if "type=record"
|
---|
37 | MemoryManager* const fMemoryManager;
|
---|
38 |
|
---|
39 | public:
|
---|
40 | FileHandleImpl(FILE* open_handle, int o_type, bool r_type, int fileLrecl=0, MemoryManager* const manager=XMLPlatformUtils::fgMemoryManager);
|
---|
41 | ~FileHandleImpl();
|
---|
42 | void setHandle(FILE* newHandlePtr) { Handle = newHandlePtr; }
|
---|
43 | void* getHandle() { return Handle; }
|
---|
44 | XMLByte* getStgBufferPtr() { return stgBufferPtr; }
|
---|
45 | int getNextByte() { return nextByte; }
|
---|
46 | void setNextByte(int newNextByte) { nextByte = newNextByte; }
|
---|
47 | int getOpenType() { return openType; }
|
---|
48 | bool isRecordType() { return recordType; }
|
---|
49 | void setRecordType(bool newType) { recordType = newType; }
|
---|
50 | int getLrecl() { return lrecl; }
|
---|
51 | void setLrecl(int newLrecl) { lrecl = newLrecl; }
|
---|
52 | };
|
---|
53 |
|
---|
54 | // Constants for the openType member
|
---|
55 | #define _FHI_WRITE 0
|
---|
56 | #define _FHI_READ 1
|
---|
57 | // Constant for the typeRecord member
|
---|
58 | #define _FHI_NOT_TYPE_RECORD 0
|
---|
59 | #define _FHI_TYPE_RECORD 1
|
---|
60 |
|
---|
61 | XERCES_CPP_NAMESPACE_END
|
---|
62 |
|
---|
63 | #endif
|
---|