libsex
3.1.0
simple exception library (C++)
|
00001 /** 00002 * @file 00003 * 00004 * Macro @ref LIBSEX_DEFINE. 00005 */ 00006 00007 #ifndef LIBSEX_DEFINE_HXX 00008 #define LIBSEX_DEFINE_HXX 00009 00010 /** 00011 * Defines an exception inheriting from a supplied parent. 00012 * 00013 * @param parent Parent class (incl. scope). 00014 * @param scope Non-global scope of class to be defined. 00015 * @param name Name of the class to be defined. 00016 * @param message Error message template. 00017 * @see LIBSEX_DECLARE 00018 * @see snprintf 00019 */ 00020 #define LIBSEX_DEFINE(parent, scope, name, message) \ 00021 const char* const scope::name::TEMPLATE = message;\ 00022 \ 00023 scope::name::name(const char* const errorMessage)\ 00024 : parent(errorMessage)\ 00025 {\ 00026 }\ 00027 \ 00028 scope::name::name(\ 00029 const char* const errorMessage,\ 00030 const libsex::Exception& previous)\ 00031 : parent(errorMessage, previous)\ 00032 {\ 00033 }\ 00034 00035 #endif