1 | /* |
---|
2 | * Licensed to the Apache Software Foundation (ASF) under one or more |
---|
3 | * contributor license agreements. See the NOTICE file distributed with |
---|
4 | * this work for additional information regarding copyright ownership. |
---|
5 | * The ASF licenses this file to You under the Apache License, Version 2.0 |
---|
6 | * (the "License"); you may not use this file except in compliance with |
---|
7 | * the License. You may obtain a copy of the License at |
---|
8 | * |
---|
9 | * http://www.apache.org/licenses/LICENSE-2.0 |
---|
10 | * |
---|
11 | * Unless required by applicable law or agreed to in writing, software |
---|
12 | * distributed under the License is distributed on an "AS IS" BASIS, |
---|
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
---|
14 | * See the License for the specific language governing permissions and |
---|
15 | * limitations under the License. |
---|
16 | */ |
---|
17 | |
---|
18 | /* |
---|
19 | * $Id: FileHandleImpl.hpp 568078 2007-08-21 11:43:25Z amassari $ |
---|
20 | */ |
---|
21 | |
---|
22 | #ifndef FILEHANDLEIMPL_HPP |
---|
23 | #define FILEHANDLEIMPL_HPP |
---|
24 | #include <xercesc/util/PlatformUtils.hpp> |
---|
25 | #include <xercesc/util/XMemory.hpp> |
---|
26 | |
---|
27 | XERCES_CPP_NAMESPACE_BEGIN |
---|
28 | |
---|
29 | class FileHandleImpl : public XMemory |
---|
30 | { |
---|
31 | private: |
---|
32 | FILE* Handle; // handle from fopen |
---|
33 | XMLByte* stgBufferPtr; // address of staging buffer |
---|
34 | int nextByte; // NAB in staging buffer |
---|
35 | int openType; // 0=write, 1=read |
---|
36 | int lrecl; // LRECL if openType is write |
---|
37 | bool recordType; // true if "type=record" |
---|
38 | MemoryManager* const fMemoryManager; |
---|
39 | |
---|
40 | public: |
---|
41 | FileHandleImpl(FILE* open_handle, int o_type, bool r_type, int fileLrecl=0, MemoryManager* const manager=XMLPlatformUtils::fgMemoryManager); |
---|
42 | ~FileHandleImpl(); |
---|
43 | void setHandle(FILE* newHandlePtr) { Handle = newHandlePtr; } |
---|
44 | void* getHandle() { return Handle; } |
---|
45 | XMLByte* getStgBufferPtr() { return stgBufferPtr; } |
---|
46 | int getNextByte() { return nextByte; } |
---|
47 | void setNextByte(int newNextByte) { nextByte = newNextByte; } |
---|
48 | int getOpenType() { return openType; } |
---|
49 | bool isRecordType() { return recordType; } |
---|
50 | void setRecordType(bool newType) { recordType = newType; } |
---|
51 | int getLrecl() { return lrecl; } |
---|
52 | void setLrecl(int newLrecl) { lrecl = newLrecl; } |
---|
53 | }; |
---|
54 | |
---|
55 | // Constants for the openType member |
---|
56 | #define _FHI_WRITE 0 |
---|
57 | #define _FHI_READ 1 |
---|
58 | // Constant for the typeRecord member |
---|
59 | #define _FHI_NOT_TYPE_RECORD 0 |
---|
60 | #define _FHI_TYPE_RECORD 1 |
---|
61 | |
---|
62 | XERCES_CPP_NAMESPACE_END |
---|
63 | |
---|
64 | #endif |
---|