00001 /* 00002 * Copyright 1999-2000,2004 The Apache Software Foundation. 00003 * 00004 * Licensed under the Apache License, Version 2.0 (the "License"); 00005 * you may not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 */ 00016 00017 /* 00018 * $Log: BinFileInputStream.hpp,v $ 00019 * Revision 1.7 2004/09/08 13:56:21 peiyongz 00020 * Apache License Version 2.0 00021 * 00022 * Revision 1.6 2004/01/29 11:48:46 cargilld 00023 * Code cleanup changes to get rid of various compiler diagnostic messages. 00024 * 00025 * Revision 1.5 2003/12/17 13:58:02 cargilld 00026 * Platform update for memory management so that the static memory manager (one 00027 * used to call Initialize) is only for static data. 00028 * 00029 * Revision 1.4 2003/06/03 18:12:29 knoaman 00030 * Add default value for memory manager argument. 00031 * 00032 * Revision 1.3 2003/05/16 03:11:22 knoaman 00033 * Partial implementation of the configurable memory manager. 00034 * 00035 * Revision 1.2 2002/11/04 15:22:03 tng 00036 * C++ Namespace Support. 00037 * 00038 * Revision 1.1.1.1 2002/02/01 22:22:09 peiyongz 00039 * sane_include 00040 * 00041 * Revision 1.3 2000/02/24 20:05:23 abagchi 00042 * Swat for removing Log from API docs 00043 * 00044 * Revision 1.2 2000/02/06 07:48:01 rahulj 00045 * Year 2K copyright swat. 00046 * 00047 * Revision 1.1.1.1 1999/11/09 01:04:00 twl 00048 * Initial checkin 00049 * 00050 * Revision 1.3 1999/11/08 20:45:03 rahul 00051 * Swat for adding in Product name and CVS comment log variable. 00052 * 00053 */ 00054 00055 #if !defined(BINFILEINPUTSTREAM_HPP) 00056 #define BINFILEINPUTSTREAM_HPP 00057 00058 #include <xercesc/util/BinInputStream.hpp> 00059 #include <xercesc/util/PlatformUtils.hpp> 00060 00061 XERCES_CPP_NAMESPACE_BEGIN 00062 00063 class BinFileInputStream : public BinInputStream 00064 { 00065 public : 00066 // ----------------------------------------------------------------------- 00067 // Constructors and Destructor 00068 // ----------------------------------------------------------------------- 00069 BinFileInputStream 00070 ( 00071 const XMLCh* const fileName 00072 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager 00073 ); 00074 00075 BinFileInputStream 00076 ( 00077 const char* const fileName 00078 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager 00079 ); 00080 00081 BinFileInputStream 00082 ( 00083 const FileHandle toUse 00084 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager 00085 ); 00086 00087 virtual ~BinFileInputStream(); 00088 00089 00090 // ----------------------------------------------------------------------- 00091 // Getter methods 00092 // ----------------------------------------------------------------------- 00093 bool getIsOpen() const; 00094 unsigned int getSize() const; 00095 void reset(); 00096 00097 00098 // ----------------------------------------------------------------------- 00099 // Implementation of the input stream interface 00100 // ----------------------------------------------------------------------- 00101 virtual unsigned int curPos() const; 00102 00103 virtual unsigned int readBytes 00104 ( 00105 XMLByte* const toFill 00106 , const unsigned int maxToRead 00107 ); 00108 00109 00110 private : 00111 // ----------------------------------------------------------------------- 00112 // Unimplemented constructors and operators 00113 // ----------------------------------------------------------------------- 00114 BinFileInputStream(const BinFileInputStream&); 00115 BinFileInputStream& operator=(const BinFileInputStream&); 00116 00117 // ----------------------------------------------------------------------- 00118 // Private data members 00119 // 00120 // fSource 00121 // The source file that we represent. The FileHandle type is defined 00122 // per platform. 00123 // ----------------------------------------------------------------------- 00124 FileHandle fSource; 00125 MemoryManager* const fMemoryManager; 00126 }; 00127 00128 00129 // --------------------------------------------------------------------------- 00130 // BinFileInputStream: Getter methods 00131 // --------------------------------------------------------------------------- 00132 inline bool BinFileInputStream::getIsOpen() const 00133 { 00134 return (fSource != 0); 00135 } 00136 00137 XERCES_CPP_NAMESPACE_END 00138 00139 #endif