PPL  1.2
stdiobuf_defs.hh
Go to the documentation of this file.
1 /* stdiobuf class declaration.
2  Copyright (C) 2001-2010 Roberto Bagnara <bagnara@cs.unipr.it>
3  Copyright (C) 2010-2016 BUGSENG srl (http://bugseng.com)
4 
5 This file is part of the Parma Polyhedra Library (PPL).
6 
7 The PPL is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published by the
9 Free Software Foundation; either version 3 of the License, or (at your
10 option) any later version.
11 
12 The PPL is distributed in the hope that it will be useful, but WITHOUT
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 for more details.
16 
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software Foundation,
19 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1307, USA.
20 
21 For the most up-to-date information see the Parma Polyhedra Library
22 site: http://bugseng.com/products/ppl/ . */
23 
24 #ifndef PPL_stdiobuf_defs_hh
25 #define PPL_stdiobuf_defs_hh 1
26 
27 #include "stdiobuf_types.hh"
28 #include <cstdio>
29 #include <streambuf>
30 
32  : public std::basic_streambuf<char, std::char_traits<char> > {
33 public:
35  stdiobuf(FILE* file);
36 
37 protected:
44  virtual int_type underflow();
45 
52  virtual int_type uflow();
53 
60  virtual std::streamsize xsgetn(char_type* s, std::streamsize n);
61 
68  virtual int_type pbackfail(int_type c = traits_type::eof());
69 
76  virtual std::streamsize xsputn(const char_type* s, std::streamsize n);
77 
83  virtual int_type overflow(int_type c);
84 
90  virtual int sync();
91 
92 private:
94  typedef char char_type;
95 
97  typedef std::char_traits<char_type> traits_type;
98 
100  typedef traits_type::int_type int_type;
101 
103  FILE* fp;
104 
106  int_type unget_char_buf;
107 };
108 
109 #include "stdiobuf_inlines.hh"
110 
111 #endif // !defined(PPL_stdiobuf_defs_hh)
virtual int_type uflow()
In case of underflow, gets a character and advances the next pointer.
Definition: stdiobuf.cc:33
virtual int_type pbackfail(int_type c=traits_type::eof())
Puts character back in case of backup underflow.
Definition: stdiobuf.cc:58
virtual std::streamsize xsgetn(char_type *s, std::streamsize n)
Gets a sequence of characters.
Definition: stdiobuf.cc:45
stdiobuf(FILE *file)
Constructor.
FILE * fp
The encapsulated stdio file.
virtual int_type underflow()
Gets a character in case of underflow.
Definition: stdiobuf.cc:39
char char_type
Character type of the streambuf.
virtual std::streamsize xsputn(const char_type *s, std::streamsize n)
Writes a sequence of characters.
Definition: stdiobuf.cc:66
virtual int_type overflow(int_type c)
Writes a character in case of overflow.
Definition: stdiobuf.cc:73
std::char_traits< char_type > traits_type
Traits type of the streambuf.
int_type unget_char_buf
Buffer for the last character read.
Coefficient c
Definition: PIP_Tree.cc:64
virtual int sync()
Synchronizes the stream buffer.
Definition: stdiobuf.cc:84
traits_type::int_type int_type
Integer type of the streambuf.