PPL  1.2
c_streambuf_defs.hh
Go to the documentation of this file.
1 /* c_streambuf 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_c_streambuf_defs_hh
25 #define PPL_c_streambuf_defs_hh 1
26 
27 #include "c_streambuf_types.hh"
28 #include <streambuf>
29 #include <cstddef>
30 
32  : public std::basic_streambuf<char, std::char_traits<char> > {
33 public:
35  c_streambuf();
36 
38  virtual ~c_streambuf();
39 
40 protected:
47  virtual int_type underflow();
48 
55  virtual int_type uflow();
56 
63  virtual std::streamsize xsgetn(char_type* s, std::streamsize n);
64 
71  virtual int_type pbackfail(int_type c = traits_type::eof());
72 
79  virtual std::streamsize xsputn(const char_type* s, std::streamsize n);
80 
86  virtual int_type overflow(int_type c);
87 
93  virtual int sync();
94 
95 private:
97  typedef char char_type;
98 
100  typedef std::char_traits<char_type> traits_type;
101 
103  typedef traits_type::int_type int_type;
104 
106  int_type unget_char_buf;
107 
109  int_type next_char_buf;
110 
111  virtual size_t cb_read(char *, size_t) {
112  return 0;
113  }
114  virtual size_t cb_write(const char *, size_t) {
115  return 0;
116  }
117  virtual int cb_sync() {
118  return 0;
119  }
120  virtual int cb_flush() {
121  return 0;
122  }
123 };
124 
125 #include "c_streambuf_inlines.hh"
126 
127 #endif // !defined(PPL_c_streambuf_defs_hh)
virtual int_type uflow()
In case of underflow, gets a character and advances the next pointer.
Definition: c_streambuf.cc:35
int_type next_char_buf
Buffer for next character.
virtual int sync()
Synchronizes the stream buffer.
Definition: c_streambuf.cc:115
traits_type::int_type int_type
Integer type of the streambuf.
virtual size_t cb_read(char *, size_t)
virtual ~c_streambuf()
Destructor.
Definition: c_streambuf.cc:31
virtual int_type pbackfail(int_type c=traits_type::eof())
Puts character back in case of backup underflow.
Definition: c_streambuf.cc:83
int_type unget_char_buf
Buffer for the last character read.
char char_type
Character type of the streambuf.
virtual int_type overflow(int_type c)
Writes a character in case of overflow.
Definition: c_streambuf.cc:98
virtual int_type underflow()
Gets a character in case of underflow.
Definition: c_streambuf.cc:42
virtual std::streamsize xsputn(const char_type *s, std::streamsize n)
Writes a sequence of characters.
Definition: c_streambuf.cc:91
virtual size_t cb_write(const char *, size_t)
std::char_traits< char_type > traits_type
Traits type of the streambuf.
virtual std::streamsize xsgetn(char_type *s, std::streamsize n)
Gets a sequence of characters.
Definition: c_streambuf.cc:57
Coefficient c
Definition: PIP_Tree.cc:64