BinFileInputStream.hpp

Go to the documentation of this file.
00001 /*
00002  * Licensed to the Apache Software Foundation (ASF) under one or more
00003  * contributor license agreements.  See the NOTICE file distributed with
00004  * this work for additional information regarding copyright ownership.
00005  * The ASF licenses this file to You under the Apache License, Version 2.0
00006  * (the "License"); you may not use this file except in compliance with
00007  * the License.  You may obtain a copy of the License at
00008  * 
00009  *      http://www.apache.org/licenses/LICENSE-2.0
00010  * 
00011  * Unless required by applicable law or agreed to in writing, software
00012  * distributed under the License is distributed on an "AS IS" BASIS,
00013  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  * See the License for the specific language governing permissions and
00015  * limitations under the License.
00016  */
00017 
00018 /*
00019  * $Id: BinFileInputStream.hpp 568078 2007-08-21 11:43:25Z amassari $
00020  */
00021 
00022 #if !defined(BINFILEINPUTSTREAM_HPP)
00023 #define BINFILEINPUTSTREAM_HPP
00024 
00025 #include <xercesc/util/BinInputStream.hpp>
00026 #include <xercesc/util/PlatformUtils.hpp>
00027 
00028 XERCES_CPP_NAMESPACE_BEGIN
00029 
00030 class XMLUTIL_EXPORT BinFileInputStream : public BinInputStream
00031 {
00032 public :
00033     // -----------------------------------------------------------------------
00034     //  Constructors and Destructor
00035     // -----------------------------------------------------------------------
00036     BinFileInputStream
00037     (
00038         const   XMLCh* const    fileName
00039         , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
00040     );
00041 
00042     BinFileInputStream
00043     (
00044         const   char* const     fileName
00045         , MemoryManager* const  manager = XMLPlatformUtils::fgMemoryManager
00046     );
00047 
00048     BinFileInputStream
00049     (
00050         const   FileHandle      toUse
00051         , MemoryManager* const  manager = XMLPlatformUtils::fgMemoryManager
00052     );
00053 
00054     virtual ~BinFileInputStream();
00055 
00056 
00057     // -----------------------------------------------------------------------
00058     //  Getter methods
00059     // -----------------------------------------------------------------------
00060     bool getIsOpen() const;
00061     unsigned int getSize() const;
00062     void reset();
00063 
00064 
00065     // -----------------------------------------------------------------------
00066     //  Implementation of the input stream interface
00067     // -----------------------------------------------------------------------
00068     virtual unsigned int curPos() const;
00069 
00070     virtual unsigned int readBytes
00071     (
00072                 XMLByte* const      toFill
00073         , const unsigned int        maxToRead
00074     );
00075 
00076 
00077 private :
00078     // -----------------------------------------------------------------------
00079     //  Unimplemented constructors and operators
00080     // -----------------------------------------------------------------------
00081     BinFileInputStream(const BinFileInputStream&);
00082     BinFileInputStream& operator=(const BinFileInputStream&);   
00083 
00084     // -----------------------------------------------------------------------
00085     //  Private data members
00086     //
00087     //  fSource
00088     //      The source file that we represent. The FileHandle type is defined
00089     //      per platform.
00090     // -----------------------------------------------------------------------
00091     FileHandle              fSource;
00092     MemoryManager* const    fMemoryManager;
00093 };
00094 
00095 
00096 // ---------------------------------------------------------------------------
00097 //  BinFileInputStream: Getter methods
00098 // ---------------------------------------------------------------------------
00099 inline bool BinFileInputStream::getIsOpen() const
00100 {
00101     return (fSource != (FileHandle) XERCES_Invalid_File_Handle);
00102 }
00103 
00104 XERCES_CPP_NAMESPACE_END
00105 
00106 #endif

Generated on Thu Feb 19 11:35:43 2009 for Xerces-C++ by  doxygen 1.5.4