Rice  1.5.2
 All Classes Files Functions Variables Typedefs Friends Pages
Exception_defn.hpp
1 #ifndef Rice__Exception_defn__hpp_
2 #define Rice__Exception_defn__hpp_
3 
4 #include "Exception_Base_defn.hpp"
5 #include "String.hpp"
6 #include "Address_Registration_Guard_defn.hpp"
7 
8 #include <stdexcept>
9 #include "detail/ruby.hpp"
10 
11 namespace Rice
12 {
13 
15 
24 class Exception
25  : public Exception_Base
26 {
27 public:
29  explicit Exception(VALUE e);
30 
32  Exception(Exception const & other);
33 
35 
40  Exception(Object exc, char const * fmt, ...);
41 
43  virtual ~Exception() throw() { }
44 
46 
49  String message() const;
50 
52 
57  virtual char const * what() const throw();
58 
59 private:
60  // Keep message around in case someone calls what() and then the GC
61  // gets invoked.
62  mutable VALUE message_;
63  Address_Registration_Guard message_guard_;
64 };
65 
66 } // namespace Rice
67 
68 #endif // Rice__Exception_defn__hpp_
69 
An abstract interface for Exception.
Definition: Exception_Base_defn.hpp:13
A placeholder for Ruby exceptions.
Definition: Exception_defn.hpp:24
A Wraper for the ruby String class.
Definition: String.hpp:23
String message() const
Get the message the exception holds.
Exception(VALUE e)
Construct a Exception with the exception e.
A guard to register a given address with the GC.
Definition: Address_Registration_Guard_defn.hpp:29
virtual ~Exception()
Destructor.
Definition: Exception_defn.hpp:43
The base class for all Objects.
Definition: Object_defn.hpp:23
virtual char const * what() const
Get message as a char const *.