Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages

# XML_Macros.h File Reference

`#include "ace/config-all.h"`
`#include "ace/Exception_Macros.h"`

Include dependency graph for XML_Macros.h:

This graph shows which files directly or indirectly include this file:

## Native C++ exceptions portability macros.
The following macros are used to write code portable between platforms with and without native C++ exception support. Their main goal is to hide the presence of the ACEXML_ENV_TYPE argument, but they collaborate with the ACEXML_TRY_* macros to emulate the try/catch blocks.
#define | ACEXML_ENV_EMIT_CODE(X)
| Define a macro to emit code only when ACEXML_ENV_TYPE is used.
#define | ACEXML_ENV_EMIT_CODE2(X, Y)
| Another macro to emit code only when ACEXML_ENV_TYPE is used.
#define | ACEXML_ENV_EMIT_DUMMY
| Helper macro.
#define | ACEXML_ENV_ARG_DECL
#define | ACEXML_ENV_ARG_DECL_NOT_USED
#define | ACEXML_ENV_SINGLE_ARG_DECL ACEXML_ENV_EMIT_CODE(ACEXML_ENV_TYPE &ACEXML_TRY_ENV)
#define | ACEXML_ENV_SINGLE_ARG_DECL_NOT_USED ACEXML_ENV_EMIT_CODE(ACEXML_ENV_TYPE &)
| Declare a ACEXML_ENV_TYPE argument for methods which don't use it.
#define | ACEXML_ENV_ARG_PARAMETER
| Use the ACEXML_ENV_TYPE argument in a nested call.
#define | ACEXML_ENV_SINGLE_ARG_PARAMETER ACEXML_ENV_EMIT_CODE(ACEXML_TRY_ENV)
#define | ACEXML_ENV_ARG_NOT_USED ACEXML_ENV_EMIT_CODE(ACE_UNUSED_ARG(ACEXML_TRY_ENV))
| Eliminate unused argument warnings about ACEXML_TRY_ENV.
## Defines
#define | ACEXML_ENV_TYPE ACEXML_Env
#define | ACEXML_TRY_ENV _ACEXML_Env_variable
#define | ACEXML_EXCEPTION_TYPE ACEXML_Exception
#define | ACEXML_ANY_EXCEPTION ex
#define | ACEXML_DECLARE_NEW_ENV ACEXML_ENV_TYPE ACEXML_TRY_ENV
#define | ACEXML_ADOPT_ENV (ENV)
#define | ACEXML_CHECK
#define | ACEXML_CHECK_RETURN(RETV)
#define | ACEXML_THROW_R_INT(EXCEPTION) throw EXCEPTION
#define | ACEXML_THROW(EXCEPTION) throw EXCEPTION
#define | ACEXML_THROW_RETURN(EXCEPTION, RETV) throw EXCEPTION
#define | ACEXML_TRY
#define | ACEXML_TRY_NEW_ENV
#define | ACEXML_TRY_EX(LABEL)
#define | ACEXML_TRY_CHECK
#define | ACEXML_TRY_CHECK_EX(LABEL)
#define | ACEXML_TRY_THROW(EXCEPTION) throw EXCEPTION
#define | ACEXML_TRY_THROW_EX(EXCEPTION, LABEL) throw EXCEPTION
#define | ACEXML_CATCH(EXCEPTION, VAR)
#define | ACEXML_CATCHANY ACEXML_CATCH(ACEXML_EXCEPTION_TYPE, ACEXML_ANY_EXCEPTION)
#define | ACEXML_CATCHALL
#define | ACEXML_RE_THROW throw
#define | ACEXML_RE_THROW_EX(LABEL) throw
#define | ACEXML_ENDTRY
#define | ACEXML_NEW_THROW_EX(POINTER, CONSTRUCTOR, EXCEPTION)
#define | ACEXML_GUARD_THROW_EX(MUTEX, OBJ, LOCK, EXCEPTION)
#define | ACEXML_READ_GUARD_THROW_EX(MUTEX, OBJ, LOCK, EXCEPTION)
#define | ACEXML_WRITE_GUARD_THROW_EX(MUTEX, OBJ, LOCK, EXCEPTION)
#define | ACEXML_ENV_RAISE(ex) (ex)->_raise ()

## Detailed Description

Id
  XML_Macros.h,v 1.3 2003/07/19 19:04:10 dhinton Exp

Writing code that is portable between platforms with or without native C++ exceptions is hard. The following macros offer some help on this task.

Author:
  Nanbor Wang <nanbor@cs.wustl.edu>

  Aniruddha Gokhale <gokhale@sahyadri.research.bell-labs.com>

  Carlos O'Ryan <coryan@uci.edu>

  Krishnakumar B <kitty@cs.wustl.edu>, et al.

## Define Documentation

#define ACEXML_ADOPT_ENV (ENV)

#define ACEXML_ANY_EXCEPTION ex

#define ACEXML_CATCH | ( | EXCEPTION,
|  | VAR |  | ) |

| Value:
    } \
           catch (EXCEPTION & VAR) \
             { \
               ACE_UNUSED_ARG (VAR);

#define ACEXML_CATCHALL

| Value:
    } \
           catch (...) \
             {

#define ACEXML_CATCHANY ACEXML_CATCH(ACEXML_EXCEPTION_TYPE, ACEXML_ANY_EXCEPTION)

#define ACEXML_CHECK

#define ACEXML_CHECK_RETURN | ( | RETV |  | ) |

#define ACEXML_DECLARE_NEW_ENV ACEXML_ENV_TYPE ACEXML_TRY_ENV

#define ACEXML_ENDTRY

| Value:
    } \
         } while (0)

#define ACEXML_ENV_ARG_DECL

| Value:
    ACEXML_ENV_EMIT_CODE2(ACEXML_ENV_EMIT_DUMMY, \
                           ACEXML_ENV_TYPE &ACEXML_TRY_ENV)
Normally this macro is used as follows: `void my_funct (int x, int y ACEXML_ENV_ARG_DECL);` Its purpose is to provide developers (and users) with a mechanism to write code that is portable to platforms with and without native C++ exceptions.

#define ACEXML_ENV_ARG_DECL_NOT_USED

| Value:
    ACEXML_ENV_EMIT_CODE2(ACEXML_ENV_EMIT_DUMMY, \
                           ACEXML_ENV_TYPE &)
Similar to ACEXML_ENV_ARG_DECL, but the formal parameter name is dropped to avoid warnings about unused parameters

#define ACEXML_ENV_ARG_NOT_USED ACEXML_ENV_EMIT_CODE(ACE_UNUSED_ARG(ACEXML_TRY_ENV))

| Eliminate unused argument warnings about ACEXML_TRY_ENV.

#define ACEXML_ENV_ARG_PARAMETER

| Value:
    ACEXML_ENV_EMIT_CODE2(ACEXML_ENV_EMIT_DUMMY, \
                           ACEXML_TRY_ENV)
Use the ACEXML_ENV_TYPE argument in a nested call.

#define ACEXML_ENV_EMIT_CODE | ( | X |  | ) |

| Define a macro to emit code only when ACEXML_ENV_TYPE is used.

#define ACEXML_ENV_EMIT_CODE2 | ( | X,
|  | Y |  | ) |

| Another macro to emit code only when ACEXML_ENV_TYPE is used.

#define ACEXML_ENV_EMIT_DUMMY

| Helper macro.

#define ACEXML_ENV_RAISE | ( | ex |  | ) | (ex)->_raise ()

#define ACEXML_ENV_SINGLE_ARG_DECL ACEXML_ENV_EMIT_CODE(ACEXML_ENV_TYPE &ACEXML_TRY_ENV)

| Declare a ACEXML_ENV_TYPE argument for methods that do not take any other parameters

#define ACEXML_ENV_SINGLE_ARG_DECL_NOT_USED ACEXML_ENV_EMIT_CODE(ACEXML_ENV_TYPE &)

| Declare a ACEXML_ENV_TYPE argument for methods which don't use it.

#define ACEXML_ENV_SINGLE_ARG_PARAMETER ACEXML_ENV_EMIT_CODE(ACEXML_TRY_ENV)

| Use the ACEXML_ENV_TYPE argument in a nested call, assuming that the called function takes only the ACEXML_TRY_ENV argument.

#define ACEXML_ENV_TYPE ACEXML_Env

#define ACEXML_EXCEPTION_TYPE ACEXML_Exception

#define ACEXML_GUARD_THROW_EX | ( | MUTEX,
|  | OBJ,
|  | LOCK,
|  | EXCEPTION |  | ) |

| Value:
    ACE_Guard< MUTEX > OBJ (LOCK); \
        if (OBJ.locked () == 0) ACEXML_THROW_R_INT (EXCEPTION);

#define ACEXML_NEW_THROW_EX | ( | POINTER,
|  | CONSTRUCTOR,
|  | EXCEPTION |  | ) |

| Value:
    do { POINTER = new CONSTRUCTOR; \
           if (POINTER == 0) { errno = ENOMEM; ACEXML_THROW_R_INT (EXCEPTION); } \
         } while (0)

#define ACEXML_RE_THROW throw

#define ACEXML_RE_THROW_EX | ( | LABEL |  | ) | throw

#define ACEXML_READ_GUARD_THROW_EX | ( | MUTEX,
|  | OBJ,
|  | LOCK,
|  | EXCEPTION |  | ) |

| Value:
    ACE_Read_Guard< MUTEX > OBJ (LOCK); \
        if (OBJ.locked () == 0) ACEXML_THROW_R_INT (EXCEPTION);

#define ACEXML_THROW | ( | EXCEPTION |  | ) | throw EXCEPTION

#define ACEXML_THROW_R_INT | ( | EXCEPTION |  | ) | throw EXCEPTION

#define ACEXML_THROW_RETURN | ( | EXCEPTION,
|  | RETV |  | ) | throw EXCEPTION

#define ACEXML_TRY

| Value:
    do \
         { \
           try \
             {

#define ACEXML_TRY_CHECK

#define ACEXML_TRY_CHECK_EX | ( | LABEL |  | ) |

#define ACEXML_TRY_ENV _ACEXML_Env_variable

#define ACEXML_TRY_EX | ( | LABEL |  | ) |

| Value:
    do \
         { \
           try \
             {

#define ACEXML_TRY_NEW_ENV

| Value:
    do \
         { \
           ACEXML_ENV_TYPE ACEXML_TRY_ENV; \
           try \
             {

#define ACEXML_TRY_THROW | ( | EXCEPTION |  | ) | throw EXCEPTION

#define ACEXML_TRY_THROW_EX | ( | EXCEPTION,
|  | LABEL |  | ) | throw EXCEPTION

#define ACEXML_WRITE_GUARD_THROW_EX | ( | MUTEX,
|  | OBJ,
|  | LOCK,
|  | EXCEPTION |  | ) |

| Value:
    ACE_Write_Guard< MUTEX > OBJ (LOCK); \
        if (OBJ.locked () == 0) ACEXML_THROW_R_INT (EXCEPTION);