summaryrefslogtreecommitdiff
path: root/ACE/contrib/utility/Utility/ExH/Logic/DescriptiveException.ipp
diff options
context:
space:
mode:
Diffstat (limited to 'ACE/contrib/utility/Utility/ExH/Logic/DescriptiveException.ipp')
-rw-r--r--ACE/contrib/utility/Utility/ExH/Logic/DescriptiveException.ipp104
1 files changed, 104 insertions, 0 deletions
diff --git a/ACE/contrib/utility/Utility/ExH/Logic/DescriptiveException.ipp b/ACE/contrib/utility/Utility/ExH/Logic/DescriptiveException.ipp
new file mode 100644
index 00000000000..4a50a687777
--- /dev/null
+++ b/ACE/contrib/utility/Utility/ExH/Logic/DescriptiveException.ipp
@@ -0,0 +1,104 @@
+// file : Utility/ExH/Logic/DescriptiveException.ipp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2002-2003 Boris Kolpackov
+// license : http://kolpackov.net/license.html
+
+namespace Utility
+{
+ namespace ExH
+ {
+ namespace Logic
+ {
+ // c-tor's & d-tor
+
+ inline DescriptiveException::
+ DescriptiveException () throw ()
+ {
+ }
+
+ inline DescriptiveException::
+ DescriptiveException (char const* description) throw ()
+ {
+ init (description);
+ }
+
+ inline DescriptiveException::
+ DescriptiveException (std::string const& description) throw ()
+ {
+ try
+ {
+ init (description.c_str ());
+ }
+ catch (...)
+ {
+ }
+ }
+
+ inline DescriptiveException::
+ DescriptiveException (DescriptiveException const& src) throw ()
+ {
+ init (src.what ());
+ }
+
+ inline DescriptiveException::
+ ~DescriptiveException () throw ()
+ {
+ }
+
+ inline DescriptiveException& DescriptiveException::
+ operator= (DescriptiveException const& src) throw ()
+ {
+ init (src.what ());
+ return *this;
+ }
+
+
+ // accessors / modifiers
+
+ inline void
+ DescriptiveException::init (char const* description) throw ()
+ {
+ try
+ {
+ if (description == 0 || description[0] == '\0')
+ {
+ description_.reset (0);
+ }
+ else
+ {
+ if (description_.get () != 0)
+ {
+ *description_ = description;
+ }
+ else
+ {
+ description_.reset (new std::string (description));
+ }
+ }
+ }
+ catch (...)
+ {
+ description_.reset (0);
+ }
+ }
+
+ inline char const*
+ DescriptiveException::what () const throw ()
+ {
+ try
+ {
+ if (description_.get () != 0)
+ {
+ return description_->c_str ();
+ }
+ }
+ catch (...)
+ {
+ }
+
+ return Exception::what ();
+ }
+ }
+ }
+}
+//$Id$