00001 /* stdiobuf class declaration. 00002 Copyright (C) 2001-2008 Roberto Bagnara <bagnara@cs.unipr.it> 00003 00004 This file is part of the Parma Polyhedra Library (PPL). 00005 00006 The PPL is free software; you can redistribute it and/or modify it 00007 under the terms of the GNU General Public License as published by the 00008 Free Software Foundation; either version 3 of the License, or (at your 00009 option) any later version. 00010 00011 The PPL is distributed in the hope that it will be useful, but WITHOUT 00012 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00013 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 00014 for more details. 00015 00016 You should have received a copy of the GNU General Public License 00017 along with this program; if not, write to the Free Software Foundation, 00018 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1307, USA. 00019 00020 For the most up-to-date information see the Parma Polyhedra Library 00021 site: http://www.cs.unipr.it/ppl/ . */ 00022 00023 #ifndef PPL_stdiobuf_defs_hh 00024 #define PPL_stdiobuf_defs_hh 1 00025 00026 #include "stdiobuf.types.hh" 00027 #include <cstdio> 00028 #include <streambuf> 00029 00030 class Parma_Polyhedra_Library::stdiobuf 00031 : public std::basic_streambuf<char, std::char_traits<char> > { 00032 public: 00034 stdiobuf(FILE* file); 00035 00036 protected: 00043 virtual int_type underflow(); 00044 00051 virtual int_type uflow(); 00052 00059 virtual std::streamsize xsgetn(char_type* s, std::streamsize n); 00060 00067 virtual int_type pbackfail(int_type c = traits_type::eof()); 00068 00075 virtual std::streamsize xsputn(const char_type* s, std::streamsize n); 00076 00082 virtual int_type overflow(int_type c); 00083 00089 virtual int sync(); 00090 00091 private: 00093 typedef char char_type; 00094 00096 typedef std::char_traits<char_type> traits_type; 00097 00099 typedef traits_type::int_type int_type; 00100 00102 FILE* fp; 00103 00105 int_type ungetc_buf; 00106 }; 00107 00108 #include "stdiobuf.inlines.hh" 00109 00110 #endif // !defined(PPL_stdiobuf_defs_hh)