guit  0.1
 All Classes Functions Variables Typedefs Enumerations Friends
giobuffer.hpp
1 
2 //
3 // Gadget IO
4 // Guit GUI Toolkit
5 // Copyright © 2019/2020 Eric Lecolinet. All rights reserved.
6 // http://www.telecom-paris.fr/~elc
7 //
8 
9 #ifndef guit_iobuffer_hpp
10 #define guit_iobuffer_hpp
11 
12 #include <iostream>
13 #include <gstring.hpp>
14 namespace guit {
15 
16 class GIOBuffer {
17 public:
18  struct IOError {};
19 
20  GIOBuffer(std::ostream&);
21  GIOBuffer(std::istream&);
22 
23  GString const& data() const {return data_;}
24  bool valueMode() const {return valuemode_;}
25  void setValueMode(bool);
26 
27  bool read();
28  void clear();
29  void printTabbed(GString const&);
30  void printDelim();
31 
32  int level() const {return level_;}
33  void incrLevel() {++level_;}
34  void decrLevel() {--level_;}
35  void resetLevel() {level_ = 0;}
36 
37  int tabCount() const {return tabcount_;}
38  void setInsideRow(bool);
39 
40 private:
41  friend class Gadget;
42  bool begin_{true}, valuemode_{}, skipbase_{}, insiderow_{};
43  int level_{}, tabcount_{}, hasdata_{};
44  std::ostream* out_{};
45  std::istream* in_{};
46  GString data_;
47 };
48 
49 }
50 #endif
51