Xerces-C++: BinFileInputStream.hpp Source File

- Main Page
- Related Pages
- Classes
- Files

# 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 670359 2008-06-22 13:43:45Z borisk $
    00020  */
    00021
    00022 #if !defined(XERCESC_INCLUDE_GUARD_BINFILEINPUTSTREAM_HPP)
    00023 #define XERCESC_INCLUDE_GUARD_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     XMLFilePos getSize() const;
    00062     void reset();
    00063
    00064
    00065     // -----------------------------------------------------------------------
    00066     //  Implementation of the input stream interface
    00067     // -----------------------------------------------------------------------
    00068     virtual XMLFilePos curPos() const;
    00069
    00070     virtual XMLSize_t readBytes
    00071     (
    00072                 XMLByte* const      toFill
    00073         , const XMLSize_t           maxToRead
    00074     );
    00075
    00076     virtual const XMLCh* getContentType() const;
    00077
    00078 private :
    00079     // -----------------------------------------------------------------------
    00080     //  Unimplemented constructors and operators
    00081     // -----------------------------------------------------------------------
    00082     BinFileInputStream(const BinFileInputStream&);
    00083     BinFileInputStream& operator=(const BinFileInputStream&);
    00084
    00085     // -----------------------------------------------------------------------
    00086     //  Private data members
    00087     //
    00088     //  fSource
    00089     //      The source file that we represent. The FileHandle type is defined
    00090     //      per platform.
    00091     // -----------------------------------------------------------------------
    00092     FileHandle              fSource;
    00093     MemoryManager* const    fMemoryManager;
    00094 };
    00095
    00096
    00097 // ---------------------------------------------------------------------------
    00098 //  BinFileInputStream: Getter methods
    00099 // ---------------------------------------------------------------------------
    00100 inline bool BinFileInputStream::getIsOpen() const
    00101 {
    00102     return (fSource != (FileHandle) XERCES_Invalid_File_Handle);
    00103 }
    00104
    00105 XERCES_CPP_NAMESPACE_END
    00106
    00107 #endif