kleopatra
Go to the documentation of this file.
   33 #ifndef __KLEOPATRA_UTILS_KLEO_ASSERT_H__ 
   34 #define __KLEOPATRA_UTILS_KLEO_ASSERT_H__ 
   36 #include <kleo/exception.h> 
   39 #include <boost/preprocessor/stringize.hpp> 
   44 #define kleo_assert_fail_impl( cond, file, line )                       \ 
   45     throw Kleo::Exception( gpg_error( GPG_ERR_INTERNAL ),               \ 
   46                            "assertion \"" #cond "\" failed at " file ":" BOOST_PP_STRINGIZE( line ) ) 
   47 #define kleo_assert_fail_impl_func( cond, file, line, func )            \ 
   48     throw Kleo::Exception( gpg_error( GPG_ERR_INTERNAL ),               \ 
   49                            std::string( "assertion \"" #cond "\" failed in " ) + func + " (" file ":" BOOST_PP_STRINGIZE( line ) ")" ) 
   51 #define kleo_assert_impl( cond, file, line )                  \ 
   53     else kleo_assert_fail_impl( cond, file, line ) 
   54 #define kleo_assert_impl_func( cond, file, line, func )       \ 
   56     else kleo_assert_fail_impl_func( cond, file, line, func ) 
   65 #if defined (__GNUC_PREREQ) 
   66 # define KLEO_GNUC_PREREQ __GNUC_PREREQ 
   67 #elif defined (__MINGW_GNUC_PREREQ) 
   68 # define KLEO_GNUC_PREREQ __MINGW_GNUC_PREREQ 
   70 # define KLEO_GNUC_PREREQ(maj, min) 0 
   73 #if KLEO_GNUC_PREREQ(2, 6) 
   74 # define kleo_assert( cond ) kleo_assert_impl_func( cond, __FILE__, __LINE__, __PRETTY_FUNCTION__ ) 
   75 # define kleo_assert_fail( cond ) kleo_assert_fail_impl_func( cond, __FILE__, __LINE__, __PRETTY_FUNCTION__ ) 
   76 # define notImplemented() throw Exception( gpg_error( GPG_ERR_NOT_IMPLEMENTED ), __PRETTY_FUNCTION__ ) 
   77 #elif defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L 
   78 # define kleo_assert( cond ) kleo_assert_impl_func( cond, __FILE__, __LINE__, __func__ ) 
   79 # define kleo_assert_fail( cond ) kleo_assert_fail_impl_func( cond, __FILE__, __LINE__, __func__ ) 
   80 # define notImplemented() throw Exception( gpg_error( GPG_ERR_NOT_IMPLEMENTED ), __func__ ) 
   83 #undef KLEO_GNUC_PREREQ 
   86 # define kleo_assert( cond ) kleo_assert_impl( cond, __FILE__, __LINE__ ) 
   89 #ifndef kleo_assert_fail 
   90 # define kleo_assert_fail( cond ) kleo_assert_fail_impl( cond, __FILE__, __LINE__ ) 
   93 #ifndef notImplemented 
   94 # define notImplemented() kleo_assert( !"Sorry, not yet implemented" ) 
  
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:33:11 by
doxygen 1.8.7 written
by 
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.