LRDE Tiger Compiler  1.34a $Id: 7fef12e1f5fa43449d667a0eec1d837c40fc1202 $
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
error.hh
Go to the documentation of this file.
1 
6 #ifndef MISC_ERROR_HH
7 # define MISC_ERROR_HH
8 
9 # include <iosfwd>
10 # include <sstream>
11 
14 #define ice_here() ice(__FILE__, __LINE__)
15 #define ice_on_error_here() ice_on_error(__FILE__, __LINE__)
16 
17 
18 namespace misc
19 {
20 
31  class error
32  {
33  public:
34  error();
35  error(const error& e);
36 
37  ~error();
38 
40  error& operator=(const error& e);
41 
44 
47  {
49  success = 0,
51  failure = 1,
53  scan = 2,
55  parse = 3,
57  bind = 4,
59  type = 5
60  };
61 
63  template <typename T> error& operator<<(const T& t);
64 
67 
69  error& operator<<(std::ostream& (*f)(std::ostream&));
70 
72  error& operator<<(const error& rhs);
73 
75  typedef void (error::*member_manip_type)();
77  typedef void (error::*const_member_manip_type)() const;
78 
83 
85 
86 
89 
91  void exit() const;
92 
94  void exit_on_error() const;
95 
97  void ice(const char* file, int line) const;
98 
101  void ice_on_error(const char* file, int line) const;
102 
104  void clear();
105 
107 
108 
111 
113  operator bool() const;
114 
116  error_type status_get() const;
117 
119  const std::ostringstream& stream_get() const;
120 
122 
123  private:
126 
128  std::ostringstream stream_;
129  };
130 
132  std::ostream& operator<<(std::ostream& o, const error& e);
133 
134 } // namespace misc
135 
136 # include <misc/error.hxx>
137 
138 #endif // !MISC_ERROR_HH