InputSource.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (c) Jürgen Riegel          (juergen.riegel@web.de)          *
00003  *                                                                         *
00004  *   This file is part of the FreeCAD CAx development system.              *
00005  *                                                                         *
00006  *   This library is free software; you can redistribute it and/or         *
00007  *   modify it under the terms of the GNU Library General Public           *
00008  *   License as published by the Free Software Foundation; either          *
00009  *   version 2 of the License, or (at your option) any later version.      *
00010  *                                                                         *
00011  *   This library  is distributed in the hope that it will be useful,      *
00012  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00013  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00014  *   GNU Library General Public License for more details.                  *
00015  *                                                                         *
00016  *   You should have received a copy of the GNU Library General Public     *
00017  *   License along with this library; see the file COPYING.LIB. If not,    *
00018  *   write to the Free Software Foundation, Inc., 59 Temple Place,         *
00019  *   Suite 330, Boston, MA  02111-1307, USA                                *
00020  *                                                                         *
00021  ***************************************************************************/
00022 
00023 #ifndef BASE_IINPUTSOURCE_H
00024 #define BASE_IINPUTSOURCE_H
00025 
00026 
00027 #include <iostream>
00028 
00029 #include <xercesc/sax2/Attributes.hpp>
00030 #include <xercesc/util/BinInputStream.hpp>
00031 #include <xercesc/util/PlatformUtils.hpp>
00032 #include <xercesc/util/XercesVersion.hpp>
00033 #include <xercesc/sax/InputSource.hpp>
00034 
00035 
00036 XERCES_CPP_NAMESPACE_BEGIN
00037   class BinInputStream;
00038 XERCES_CPP_NAMESPACE_END
00039 
00040 namespace Base
00041 {
00042 
00043 
00044 class BaseExport StdInputStream : public XERCES_CPP_NAMESPACE_QUALIFIER BinInputStream
00045 {
00046 public :
00047   StdInputStream ( std::istream& Stream, XERCES_CPP_NAMESPACE_QUALIFIER MemoryManager* const manager = XERCES_CPP_NAMESPACE_QUALIFIER XMLPlatformUtils::fgMemoryManager );
00048   virtual ~StdInputStream();
00049 
00050   // -----------------------------------------------------------------------
00051   //  Implementation of the input stream interface
00052   // -----------------------------------------------------------------------
00053 #if (XERCES_VERSION_MAJOR == 2)
00054   virtual unsigned int curPos() const;
00055   virtual unsigned int readBytes( XMLByte* const toFill, const unsigned int maxToRead );
00056 #else
00057   virtual XMLFilePos curPos() const;
00058   virtual XMLSize_t readBytes( XMLByte* const toFill, const XMLSize_t maxToRead );
00059   virtual const XMLCh* getContentType() const {return 0;}
00060 #endif
00061 
00062 private :
00063   // -----------------------------------------------------------------------
00064   //  Unimplemented constructors and operators
00065   // -----------------------------------------------------------------------
00066   StdInputStream(const StdInputStream&);
00067   StdInputStream& operator=(const StdInputStream&);   
00068 
00069   // -----------------------------------------------------------------------
00070   //  Private data members
00071   //
00072   //  fSource
00073   //      The source file that we represent. The FileHandle type is defined
00074   //      per platform.
00075   // -----------------------------------------------------------------------
00076   std::istream            &stream;
00077   XERCES_CPP_NAMESPACE_QUALIFIER MemoryManager* const    fMemoryManager;
00078 };
00079 
00080 
00081 class BaseExport StdInputSource : public XERCES_CPP_NAMESPACE_QUALIFIER InputSource
00082 {
00083 public :
00084   StdInputSource ( std::istream& Stream, const char* filePath, XERCES_CPP_NAMESPACE_QUALIFIER MemoryManager* const manager = XERCES_CPP_NAMESPACE_QUALIFIER XMLPlatformUtils::fgMemoryManager );
00085    ~StdInputSource();
00086 
00087   virtual XERCES_CPP_NAMESPACE_QUALIFIER BinInputStream* makeStream() const;
00088 
00089 private:
00090   StdInputSource(const StdInputSource&);
00091   StdInputSource& operator=(const StdInputSource&);
00092 
00093   std::istream   &stream;
00094 };
00095 
00096 }
00097 
00098 #endif // BASE_IINPUTSOURCE_H

Generated on Wed Nov 23 19:00:19 2011 for FreeCAD by  doxygen 1.6.1