diff options
Diffstat (limited to 'ACEXML')
-rw-r--r-- | ACEXML/ChangeLog | 12 | ||||
-rw-r--r-- | ACEXML/common/Exception.cpp | 26 | ||||
-rw-r--r-- | ACEXML/common/Exception.h | 8 | ||||
-rw-r--r-- | ACEXML/common/SAXExceptions.cpp | 124 | ||||
-rw-r--r-- | ACEXML/common/SAXExceptions.h | 10 |
5 files changed, 92 insertions, 88 deletions
diff --git a/ACEXML/ChangeLog b/ACEXML/ChangeLog index d34bed37311..51e110a9178 100644 --- a/ACEXML/ChangeLog +++ b/ACEXML/ChangeLog @@ -1,3 +1,15 @@ +Sat Feb 21 23:51:25 2004 . <.@isis.vanderbilt.edu> + + * common/Exception.h: + * common/Exception.cpp: + * common/SAXExceptions.h: + * common/SAXExceptions.cpp: + + Fixed a few bugs in the way the exceptions were set-up in the + case when exceptions=0. Provided implementations for operator + assignment and duplicate(). This should fix problems with + throwing and catching exceptions when exceptions=0. + Sat Jan 31 20:06:57 2004 Krishnakumar B <kitty@cse.wustl.edu> * parser/parser/Parser.cpp (parse_PE_reference): Added ACE_TEXT diff --git a/ACEXML/common/Exception.cpp b/ACEXML/common/Exception.cpp index dc82c0a4c65..65d3c373091 100644 --- a/ACEXML/common/Exception.cpp +++ b/ACEXML/common/Exception.cpp @@ -5,42 +5,26 @@ #include "ace/ACE.h" #include "ace/OS_NS_string.h" -static const ACEXML_Char ACEXML_Exception_name[] = { - 'A', 'C', 'E', 'X', 'M', 'L', - '_', 'E', 'x', 'c', 'e', 'p', - 't', 'i', 'o', 'n', 0}; -const ACEXML_Char *ACEXML_Exception::exception_name_ = ACEXML_Exception_name; +const ACEXML_Char *ACEXML_Exception::exception_name_ = ACE_TEXT ("ACEXML_Exception"); -static const ACEXML_Char ACEXML_Exception_null [] = {0}; -const ACEXML_Char *ACEXML_Exception::null_ = ACEXML_Exception_null; +const ACEXML_Char *ACEXML_Exception::null_ = ACE_TEXT (""); #if !defined (__ACEXML_INLINE__) # include "ACEXML/common/Exception.i" #endif /* __ACEXML_INLINE__ */ -ACEXML_Exception::ACEXML_Exception (void) +ACEXML_Exception::ACEXML_Exception() { } -ACEXML_Exception::ACEXML_Exception (const ACEXML_Exception &) +ACEXML_Exception::~ACEXML_Exception() { } - -ACEXML_Exception::~ACEXML_Exception (void) -{ - -} - int ACEXML_Exception::is_a (const ACEXML_Char *name) { - if (name == ACEXML_Exception::exception_name_ - || ACE_OS::strcmp (ACEXML_Exception::exception_name_, - name) == 0) - return 1; - - return 0; + return ACE_OS::strcmp (ACEXML_Exception::exception_name_, name) == 0; } void diff --git a/ACEXML/common/Exception.h b/ACEXML/common/Exception.h index 454a2986dcf..09995b473fa 100644 --- a/ACEXML/common/Exception.h +++ b/ACEXML/common/Exception.h @@ -45,12 +45,6 @@ class ACEXML_Export ACEXML_Exception { public: - /// Copy constructor. - ACEXML_Exception (const ACEXML_Exception &src); - - /// Assignment operator. - ACEXML_Exception& operator= (const ACEXML_Exception& src); - /// Destructor. virtual ~ACEXML_Exception (void); @@ -67,7 +61,7 @@ public: virtual ACEXML_Exception *duplicate (void) const = 0; /// Check whether this is an exception of type specified by <name>. - virtual int is_a (const ACEXML_Char *name) = 0; + virtual int is_a (const ACEXML_Char *name); /// Print out exception using ACE_DEBUG. virtual void print (void) = 0; diff --git a/ACEXML/common/SAXExceptions.cpp b/ACEXML/common/SAXExceptions.cpp index 8ffa992d3b0..77275f03568 100644 --- a/ACEXML/common/SAXExceptions.cpp +++ b/ACEXML/common/SAXExceptions.cpp @@ -5,34 +5,13 @@ #include "ace/ACE.h" #include "ace/OS_NS_string.h" -static const ACEXML_Char ACEXML_SAXException_name[] = { - 'A', 'C', 'E', 'X', 'M', 'L', '_', - 'S', 'A', 'X', - 'E', 'x', 'c', 'e', 'p', 't', 'i', 'o', 'n', 0}; -const ACEXML_Char *ACEXML_SAXException::exception_name_ = ACEXML_SAXException_name; - -static const ACEXML_Char ACEXML_SAXNotSupportedException_name[] = { - 'A', 'C', 'E', 'X', 'M', 'L', '_', - 'S', 'A', 'X', - 'N', 'o', 't', - 'S', 'u', 'p', 'p', 'o', 'r', 't', 'e', 'd', - 'E', 'x', 'c', 'e', 'p', 't', 'i', 'o', 'n', 0}; -const ACEXML_Char *ACEXML_SAXNotSupportedException::exception_name_ = ACEXML_SAXNotSupportedException_name; - -static const ACEXML_Char ACEXML_SAXNotRecognizedException_name[] = { - 'A', 'C', 'E', 'X', 'M', 'L', '_', - 'S', 'A', 'X', - 'N', 'o', 't', - 'R', 'e', 'c', 'o', 'g', 'n', 'i', 'z', 'e', 'd', - 'E', 'x', 'c', 'e', 'p', 't', 'i', 'o', 'n', 0}; -const ACEXML_Char *ACEXML_SAXNotRecognizedException::exception_name_ = ACEXML_SAXNotRecognizedException_name; - -static const ACEXML_Char ACEXML_SAXParseException_name[] = { - 'A', 'C', 'E', 'X', 'M', 'L', '_', - 'S', 'A', 'X', - 'P', 'a', 'r', 's', 'e', - 'E', 'x', 'c', 'e', 'p', 't', 'i', 'o', 'n', 0}; -const ACEXML_Char *ACEXML_SAXParseException::exception_name_ = ACEXML_SAXParseException_name; +const ACEXML_Char *ACEXML_SAXException::exception_name_ = ACE_TEXT ("ACEXML_SAXException"); + +const ACEXML_Char *ACEXML_SAXNotSupportedException::exception_name_ = ACE_TEXT ("ACEXML_SAXNotSupportedException"); + +const ACEXML_Char *ACEXML_SAXNotRecognizedException::exception_name_ = ACE_TEXT ("ACEXML_SAXNotRecognizedException"); + +const ACEXML_Char *ACEXML_SAXParseException::exception_name_ = ACE_TEXT ("ACEXML_SAXParseException"); #if !defined (__ACEXML_INLINE__) # include "ACEXML/common/SAXExceptions.i" @@ -93,14 +72,8 @@ ACEXML_SAXException::duplicate (void) const int ACEXML_SAXException::is_a (const ACEXML_Char *name) { - if (name == ACEXML_SAXException::exception_name_ - || ACE_OS::strcmp (ACEXML_Exception::exception_name_, - name) == 0) - return 1; - else - return this->ACEXML_Exception::is_a (name); - - ACE_NOTREACHED (return 0;) + return ACE_OS::strcmp (ACEXML_SAXException::exception_name_, name) == 0 + || this->ACEXML_Exception::is_a (name); } void @@ -120,6 +93,22 @@ ACEXML_SAXNotSupportedException::ACEXML_SAXNotSupportedException (const ACEXML_S { } +ACEXML_SAXNotSupportedException& +ACEXML_SAXNotSupportedException::operator= (const + ACEXML_SAXNotSupportedException &ex) +{ + this->ACEXML_SAXException::operator= (ex); + return *this; +} + +ACEXML_SAXNotSupportedException* +ACEXML_SAXNotSupportedException::_downcast (ACEXML_Exception* ex) +{ + if (ex->is_a (ACE_TEXT ("ACEXML_SAXNotSupportedException"))) + return ACE_dynamic_cast (ACEXML_SAXNotSupportedException*, ex); + return 0; +} + ACEXML_SAXNotSupportedException::ACEXML_SAXNotSupportedException (const ACEXML_Char* msg) : ACEXML_SAXException (msg) { @@ -142,14 +131,9 @@ ACEXML_SAXNotSupportedException::duplicate (void) const int ACEXML_SAXNotSupportedException::is_a (const ACEXML_Char *name) { - if (name == ACEXML_SAXNotSupportedException::exception_name_ - || ACE_OS::strcmp (ACEXML_Exception::exception_name_, - name) == 0) - return 1; - else - return this->ACEXML_SAXException::is_a (name); - - ACE_NOTREACHED (return 0;) + return ACE_OS::strcmp (ACEXML_SAXNotSupportedException::exception_name_, + name) == 0 + || this->ACEXML_SAXException::is_a (name); } void @@ -174,6 +158,21 @@ ACEXML_SAXNotRecognizedException::ACEXML_SAXNotRecognizedException (const ACEXML { } +ACEXML_SAXNotRecognizedException& +ACEXML_SAXNotRecognizedException::operator= (const ACEXML_SAXNotRecognizedException &ex) +{ + this->ACEXML_SAXException::operator= (ex); + return *this; +} + +ACEXML_SAXNotRecognizedException* +ACEXML_SAXNotRecognizedException::_downcast (ACEXML_Exception* ex) +{ + if (ex->is_a (ACE_TEXT ("ACEXML_SAXNotRecognizedException"))) + return ACE_dynamic_cast (ACEXML_SAXNotRecognizedException*, ex); + return 0; +} + ACEXML_SAXNotRecognizedException::~ACEXML_SAXNotRecognizedException (void) { delete[] this->message_; @@ -190,14 +189,9 @@ ACEXML_SAXNotRecognizedException::duplicate (void) const int ACEXML_SAXNotRecognizedException::is_a (const ACEXML_Char *name) { - if (name == ACEXML_SAXNotRecognizedException::exception_name_ - || ACE_OS::strcmp (ACEXML_Exception::exception_name_, - name) == 0) - return 1; - else - return this->ACEXML_SAXException::is_a (name); - - ACE_NOTREACHED (return 0;) + return ACE_OS::strcmp (ACEXML_SAXNotRecognizedException::exception_name_, + name) == 0 + || this->ACEXML_SAXException::is_a (name); } void @@ -222,6 +216,21 @@ ACEXML_SAXParseException::ACEXML_SAXParseException (const ACEXML_SAXParseExcepti { } +ACEXML_SAXParseException& +ACEXML_SAXParseException::operator= (const ACEXML_SAXParseException &ex) +{ + this->ACEXML_SAXException::operator= (ex); + return *this; +} + +ACEXML_SAXParseException* +ACEXML_SAXParseException::_downcast (ACEXML_Exception* ex) +{ + if (ex->is_a (ACE_TEXT ("ACEXML_SAXParseException"))) + return ACE_dynamic_cast (ACEXML_SAXParseException*, ex); + return 0; +} + ACEXML_SAXParseException::~ACEXML_SAXParseException (void) { } @@ -237,14 +246,9 @@ ACEXML_SAXParseException::duplicate (void) const int ACEXML_SAXParseException::is_a (const ACEXML_Char *name) { - if (name == ACEXML_SAXParseException::exception_name_ - || ACE_OS::strcmp (ACEXML_Exception::exception_name_, - name) == 0) - return 1; - else - return this->ACEXML_SAXException::is_a (name); - - ACE_NOTREACHED (return 0;) + return ACE_OS::strcmp (ACEXML_SAXParseException::exception_name_, + name) == 0 + || this->ACEXML_SAXException::is_a (name); } void diff --git a/ACEXML/common/SAXExceptions.h b/ACEXML/common/SAXExceptions.h index b909e89bb2d..d4965c93ee6 100644 --- a/ACEXML/common/SAXExceptions.h +++ b/ACEXML/common/SAXExceptions.h @@ -87,6 +87,9 @@ public: /// Copy constructor. ACEXML_SAXNotSupportedException (const ACEXML_SAXNotSupportedException &ex); + /// Assignment operator + ACEXML_SAXNotSupportedException& operator= (const ACEXML_SAXNotSupportedException &ex); + /// Constructor which accepts an informational message ACEXML_SAXNotSupportedException (const ACEXML_Char* msg); @@ -128,6 +131,10 @@ public: /// Copy constructor. ACEXML_SAXNotRecognizedException (const ACEXML_SAXNotRecognizedException &ex); + + /// Assignment operator. + ACEXML_SAXNotRecognizedException& operator= (const ACEXML_SAXNotRecognizedException &ex); + /// Destructor. virtual ~ACEXML_SAXNotRecognizedException (void); @@ -168,6 +175,9 @@ public: /// Copy constructor. ACEXML_SAXParseException (const ACEXML_SAXParseException &ex); + /// Assignment operator. + ACEXML_SAXParseException& operator= (const ACEXML_SAXParseException &ex); + /// Destructor. virtual ~ACEXML_SAXParseException (void); |