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