File indexing completed on 2025-01-18 09:30:26
0001
0002 #ifndef BOOST_CONTRACT_DETAIL_STATIC_PUBLIC_FUNCTION_HPP_
0003 #define BOOST_CONTRACT_DETAIL_STATIC_PUBLIC_FUNCTION_HPP_
0004
0005
0006
0007
0008
0009
0010 #include <boost/contract/core/exception.hpp>
0011 #include <boost/contract/core/config.hpp>
0012 #include <boost/contract/detail/condition/cond_inv.hpp>
0013 #include <boost/contract/detail/none.hpp>
0014 #include <boost/contract/detail/exception.hpp>
0015 #if !defined(BOOST_CONTRACT_ALL_DISABLE_NO_ASSERTION) && ( \
0016 !defined(BOOST_CONTRACT_NO_INVARIANTS) || \
0017 !defined(BOOST_CONTRACT_NO_PRECONDITIONS) || \
0018 !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \
0019 !defined(BOOST_CONTRACT_NO_EXCEPTS))
0020 #include <boost/contract/detail/checking.hpp>
0021 #endif
0022 #if !defined(BOOST_CONTRACT_NO_EXIT_INVARIANTS) || \
0023 !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \
0024 !defined(BOOST_CONTRACT_NO_EXCEPTS)
0025 #include <boost/config.hpp>
0026 #include <exception>
0027 #endif
0028
0029 namespace boost { namespace contract { namespace detail {
0030
0031
0032 template<class C>
0033 class static_public_function : public cond_inv< none, C> {
0034 public:
0035 explicit static_public_function() : cond_inv< none, C>(
0036 boost::contract::from_function, 0) {}
0037
0038 private:
0039 #if !defined(BOOST_CONTRACT_NO_ENTRY_INVARIANTS) || \
0040 !defined(BOOST_CONTRACT_NO_PRECONDITIONS) || \
0041 !defined(BOOST_CONTRACT_NO_OLDS)
0042 void init() {
0043 #ifndef BOOST_CONTRACT_ALL_DISABLE_NO_ASSERTION
0044 if(checking::already()) return;
0045 #endif
0046 #if !defined(BOOST_CONTRACT_NO_ENTRY_INVARIANTS) || \
0047 !defined(BOOST_CONTRACT_NO_PRECONDITIONS)
0048 {
0049 #ifndef BOOST_CONTRACT_ALL_DISABLE_NO_ASSERTION
0050 checking k;
0051 #endif
0052 #ifndef BOOST_CONTRACT_NO_ENTRY_INVARIANTS
0053 this->check_entry_static_inv();
0054 #endif
0055 #ifndef BOOST_CONTRACT_NO_PRECONDITIONS
0056 #ifndef \
0057 BOOST_CONTRACT_PRECONDITIONS_DISABLE_NO_ASSERTION
0058 this->check_pre();
0059 }
0060 #else
0061 }
0062 this->check_pre();
0063 #endif
0064 #else
0065 }
0066 #endif
0067 #endif
0068 #ifndef BOOST_CONTRACT_NO_OLDS
0069 this->copy_old();
0070 #endif
0071 }
0072 #endif
0073
0074 public:
0075 #if !defined(BOOST_CONTRACT_NO_EXIT_INVARIANTS) || \
0076 !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \
0077 !defined(BOOST_CONTRACT_NO_EXCEPTS)
0078 ~static_public_function() BOOST_NOEXCEPT_IF(false) {
0079 this->assert_initialized();
0080 #ifndef BOOST_CONTRACT_ALL_DISABLE_NO_ASSERTION
0081 if(checking::already()) return;
0082 checking k;
0083 #endif
0084
0085 #ifndef BOOST_CONTRACT_NO_EXIT_INVARIANTS
0086 this->check_exit_static_inv();
0087 #endif
0088 if(uncaught_exception()) {
0089 #ifndef BOOST_CONTRACT_NO_EXCEPTS
0090 this->check_except();
0091 #endif
0092 } else {
0093 #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS
0094 this->check_post(none());
0095 #endif
0096 }
0097 }
0098 #endif
0099 };
0100
0101 } } }
0102
0103 #endif
0104