Exception.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //=============================================================================
00004 /**
00005  *  @file    Exception.h
00006  *
00007  *  Exception.h,v 1.8 2004/02/22 05:57:44 kitty Exp
00008  *
00009  *  @author Nanbor Wang <nanbor@cs.wustl.edu>
00010  */
00011 //=============================================================================
00012 
00013 #ifndef _ACEXML_EXCEPTION_H_
00014 #define _ACEXML_EXCEPTION_H_
00015 
00016 #include /**/ "ace/pre.h"
00017 #include "ACEXML/common/ACEXML_Export.h"
00018 
00019 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00020 #pragma once
00021 #endif /* ACE_LACKS_PRAGMA_ONCE */
00022 
00023 #include "ACEXML/common/XML_Types.h"
00024 #include "ACEXML/common/XML_Macros.h"
00025 
00026 #if defined (ACE_USES_NATIVE_EXCEPTIONS)
00027 # define ACEXML_RAISE(EXCEPTION) throw EXCEPTION
00028 #else
00029 # define ACEXML_RAISE(EXCEPTION)
00030 #endif
00031 
00032 
00033 /**
00034  * @class ACEXML_Exception Exception.h "ACEXML/common/Exception.h"
00035  *
00036  * @brief ACEXML_Exception
00037  *
00038  * ACEXML_Exception is the base class for all ACEXML related exceptions.
00039  * Since ACEXML currently does not support native exceptions, all
00040  * exceptions should be thrown thru ACEXML_Env.
00041  *
00042  * @sa ACEXML_Env
00043  */
00044 class ACEXML_Export ACEXML_Exception
00045 {
00046 public:
00047 
00048   /// Destructor.
00049   virtual ~ACEXML_Exception (void);
00050 
00051   /// Throw the exception.
00052   virtual void _raise (void) = 0;
00053 
00054   /// Static narrow operation.
00055   static ACEXML_Exception* _downcast (ACEXML_Exception* ex);
00056 
00057   /// Return the exception type.  (for safe downcast.)
00058   virtual const ACEXML_Char *id (void) const ;
00059 
00060   /// Dynamically create a copy of this exception.
00061   virtual ACEXML_Exception *duplicate (void) const = 0;
00062 
00063   /// Check whether this is an exception of type specified by <name>.
00064   virtual int is_a (const ACEXML_Char *name);
00065 
00066   /// Print out exception using ACE_DEBUG.
00067   virtual void print (void) = 0;
00068 
00069 protected:
00070   /// Default contructor.
00071   ACEXML_Exception (void);
00072 
00073   /// All exceptions have names.  This name is used to identify the
00074   /// type of an exception.
00075   static const ACEXML_Char *exception_name_;
00076 
00077   /// A null string that we return when there is no exception.
00078   static const ACEXML_Char *null_;
00079 };
00080 
00081 #if defined (__ACEXML_INLINE__)
00082 # include "ACEXML/common/Exception.i"
00083 #endif /* __ACEXML_INLINE__ */
00084 
00085 #include /**/ "ace/post.h"
00086 
00087 #endif /* _ACEXML_EXCEPTION_H_ */

Generated on Thu Nov 9 11:45:36 2006 for ACEXML by doxygen 1.3.6