Umasoft
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
exception.hpp
Go to the documentation of this file.
1 
9 #ifndef __EXCEPTION_HPP
10 #define __EXCEPTION_HPP 1
11 
12 #include <string>
13 
14 using namespace std;
15 
16 
25 {
26 public:
27  xh_location ();
28  xh_location (const string &path, int line = -1, int column = -1);
29  virtual ~xh_location ();
30  virtual const string &getPath () const;
31  virtual void setPath (const string &path);
32  virtual int getLine () const;
33  virtual void setLine (int line);
34  virtual int getColumn () const;
35  virtual void setColumn (int column);
36  virtual int getByte () const;
37  virtual void setByte (int byte);
38  virtual string asString () const;
39 private:
40  string _path;
41  int _line;
42  int _column;
43  int _byte;
44 };
45 
46 
51 {
52 public:
53  xh_throwable ();
54  xh_throwable (const string &message, const string &origin = "");
55  virtual ~xh_throwable ();
56  virtual const string &getMessage () const;
57  virtual const string getFormattedMessage () const;
58  virtual void setMessage (const string &message);
59  virtual const string &getOrigin () const;
60  virtual void setOrigin (const string &origin);
61 private:
62  string _message;
63  string _origin;
64 };
65 
66 
67 
76 class xh_error : public xh_throwable
77 {
78 public:
79  xh_error ();
80  xh_error (const string &message, const string &origin = "");
81  virtual ~xh_error ();
82 };
83 
84 
97 class xh_exception : public xh_throwable
98 {
99 public:
100  xh_exception ();
101  xh_exception (const string &message, const string &origin = "");
102  virtual ~xh_exception ();
103 };
104 
105 
117 {
118 public:
119  xh_io_exception ();
120  xh_io_exception (const string &message, const string &origin = "");
121  xh_io_exception (const string &message, const xh_location &location,
122  const string &origin = "");
123  virtual ~xh_io_exception ();
124  virtual const string getFormattedMessage () const;
125  virtual const xh_location &getLocation () const;
126  virtual void setLocation (const xh_location &location);
127 private:
128  xh_location _location;
129 };
130 
131 
143 {
144 public:
146  xh_format_exception (const string &message, const string &text,
147  const string &origin = "");
148  virtual ~xh_format_exception ();
149  virtual const string &getText () const;
150  virtual void setText (const string &text);
151 private:
152  string _text;
153 };
154 
155 
165 {
166 public:
168  xh_range_exception (const string &message, const string &origin = "");
169  virtual ~xh_range_exception ();
170 };
171 
172 #endif
173