Make x.0.10 publicly available
[ACE_TAO.git] / ACE / ACEXML / common / SAXExceptions.cpp
blob6eed2b94a8f801f269907e8c1ef9e65cb5ef46d3
1 // -*- C++ -*-
3 #include "ACEXML/common/SAXExceptions.h"
4 #include "ace/Log_Msg.h"
5 #include "ace/ACE.h"
6 #include "ace/OS_Memory.h"
7 #include "ace/OS_NS_string.h"
9 const ACEXML_Char * ACEXML_SAXException::exception_name_ = ACE_TEXT ("ACEXML_SAXException");
11 const ACEXML_Char ACEXML_SAXNotSupportedException::exception_name_[] = ACE_TEXT ("ACEXML_SAXNotSupportedException");
13 const ACEXML_Char ACEXML_SAXNotRecognizedException::exception_name_[] = ACE_TEXT ("ACEXML_SAXNotRecognizedException");
15 const ACEXML_Char ACEXML_SAXParseException::exception_name_[] = ACE_TEXT ("ACEXML_SAXParseException");
17 #if !defined (__ACEXML_INLINE__)
18 # include "ACEXML/common/SAXExceptions.inl"
19 #endif /* __ACEXML_INLINE__ */
21 ACEXML_SAXException::ACEXML_SAXException ()
22 : message_ (0)
26 ACEXML_SAXException::ACEXML_SAXException (const ACEXML_Char *msg)
27 : message_ (ACE::strnew (msg))
31 ACEXML_SAXException::ACEXML_SAXException (const ACEXML_SAXException &ex)
32 : ACEXML_Exception (ex),
33 message_ (ACE::strnew (ex.message_))
38 ACEXML_SAXException&
39 ACEXML_SAXException::operator= (const ACEXML_SAXException& src)
41 if (this != &src)
43 ACE::strdelete (this->message_);
44 this->message_ = ACE::strnew (src.message_);
47 return *this;
50 ACEXML_SAXException*
51 ACEXML_SAXException::_downcast (ACEXML_Exception* ex)
53 return dynamic_cast<ACEXML_SAXException*> (ex);
56 ACEXML_SAXException::~ACEXML_SAXException ()
58 ACE::strdelete (this->message_);
61 ACEXML_Exception *
62 ACEXML_SAXException::duplicate () const
64 ACEXML_Exception *tmp;
65 ACE_NEW_RETURN (tmp, ACEXML_SAXException (*this), 0);
66 return tmp;
69 int
70 ACEXML_SAXException::is_a (const ACEXML_Char *name)
72 return ACE_OS::strcmp (ACEXML_SAXException::exception_name_, name) == 0
73 || this->ACEXML_Exception::is_a (name);
76 void
77 ACEXML_SAXException::print () const
79 ACE_ERROR ((LM_ERROR,
80 ACE_TEXT ("ACEXML: (%P|%t) %s: %s\n"),
81 this->exception_name_, this->message()));
84 ACEXML_SAXNotSupportedException::ACEXML_SAXNotSupportedException ()
88 ACEXML_SAXNotSupportedException::ACEXML_SAXNotSupportedException (const ACEXML_SAXNotSupportedException &ex)
89 : ACEXML_SAXException (ex)
93 ACEXML_SAXNotSupportedException&
94 ACEXML_SAXNotSupportedException::operator= (const
95 ACEXML_SAXNotSupportedException &ex)
97 this->ACEXML_SAXException::operator= (ex);
98 return *this;
101 ACEXML_SAXNotSupportedException*
102 ACEXML_SAXNotSupportedException::_downcast (ACEXML_Exception* ex)
104 return dynamic_cast<ACEXML_SAXNotSupportedException*> (ex);
107 ACEXML_SAXNotSupportedException::ACEXML_SAXNotSupportedException (const ACEXML_Char* msg)
108 : ACEXML_SAXException (msg)
112 ACEXML_SAXNotSupportedException::~ACEXML_SAXNotSupportedException ()
117 ACEXML_Exception *
118 ACEXML_SAXNotSupportedException::duplicate () const
120 ACEXML_Exception *tmp;
121 ACE_NEW_RETURN (tmp, ACEXML_SAXNotSupportedException (*this), 0);
122 return tmp;
126 ACEXML_SAXNotSupportedException::is_a (const ACEXML_Char *name)
128 return ACE_OS::strcmp (ACEXML_SAXNotSupportedException::exception_name_,
129 name) == 0
130 || this->ACEXML_SAXException::is_a (name);
133 void
134 ACEXML_SAXNotSupportedException::print () const
136 ACE_DEBUG ((LM_ERROR,
137 ACE_TEXT ("ACEXML: (%P|%t) %s: %s\n"),
138 this->exception_name_, this->message()));
141 ACEXML_SAXNotRecognizedException::ACEXML_SAXNotRecognizedException ()
145 ACEXML_SAXNotRecognizedException::ACEXML_SAXNotRecognizedException (const ACEXML_Char *msg)
146 : ACEXML_SAXException (msg)
150 ACEXML_SAXNotRecognizedException::ACEXML_SAXNotRecognizedException (const ACEXML_SAXNotRecognizedException &ex)
151 : ACEXML_SAXException (ex)
155 ACEXML_SAXNotRecognizedException&
156 ACEXML_SAXNotRecognizedException::operator= (const ACEXML_SAXNotRecognizedException &ex)
158 this->ACEXML_SAXException::operator= (ex);
159 return *this;
162 ACEXML_SAXNotRecognizedException*
163 ACEXML_SAXNotRecognizedException::_downcast (ACEXML_Exception* ex)
165 return dynamic_cast<ACEXML_SAXNotRecognizedException*> (ex);
168 ACEXML_SAXNotRecognizedException::~ACEXML_SAXNotRecognizedException ()
172 ACEXML_Exception *
173 ACEXML_SAXNotRecognizedException::duplicate () const
175 ACEXML_Exception *tmp;
176 ACE_NEW_RETURN (tmp, ACEXML_SAXNotRecognizedException (*this), 0);
177 return tmp;
181 ACEXML_SAXNotRecognizedException::is_a (const ACEXML_Char *name)
183 return ACE_OS::strcmp (ACEXML_SAXNotRecognizedException::exception_name_,
184 name) == 0
185 || this->ACEXML_SAXException::is_a (name);
188 void
189 ACEXML_SAXNotRecognizedException::print () const
191 ACE_DEBUG ((LM_ERROR,
192 ACE_TEXT ("ACEXML: (%P|%t) %s: %s\n"),
193 this->exception_name_, this->message()));
196 ACEXML_SAXParseException::ACEXML_SAXParseException ()
200 ACEXML_SAXParseException::ACEXML_SAXParseException (const ACEXML_Char *msg)
201 : ACEXML_SAXException (msg)
205 ACEXML_SAXParseException::ACEXML_SAXParseException (const ACEXML_SAXParseException &ex)
206 : ACEXML_SAXException (ex)
210 ACEXML_SAXParseException&
211 ACEXML_SAXParseException::operator= (const ACEXML_SAXParseException &ex)
213 this->ACEXML_SAXException::operator= (ex);
214 return *this;
217 ACEXML_SAXParseException*
218 ACEXML_SAXParseException::_downcast (ACEXML_Exception* ex)
220 return dynamic_cast<ACEXML_SAXParseException*> (ex);
223 ACEXML_SAXParseException::~ACEXML_SAXParseException ()
227 ACEXML_Exception *
228 ACEXML_SAXParseException::duplicate () const
230 ACEXML_Exception *tmp;
231 ACE_NEW_RETURN (tmp, ACEXML_SAXParseException (*this), 0);
232 return tmp;
236 ACEXML_SAXParseException::is_a (const ACEXML_Char *name)
238 return ACE_OS::strcmp (ACEXML_SAXParseException::exception_name_,
239 name) == 0
240 || this->ACEXML_SAXException::is_a (name);
243 void
244 ACEXML_SAXParseException::print () const
246 ACE_ERROR ((LM_ERROR,
247 ACE_TEXT ("ACEXML: (%P|%t) %s: %s\n"),
248 this->exception_name_, this->message()));