Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:30:26

0001 
0002 #ifndef BOOST_CONTRACT_DETAIL_FUNCTION_HPP_
0003 #define BOOST_CONTRACT_DETAIL_FUNCTION_HPP_
0004 
0005 // Copyright (C) 2008-2018 Lorenzo Caminiti
0006 // Distributed under the Boost Software License, Version 1.0 (see accompanying
0007 // file LICENSE_1_0.txt or a copy at http://www.boost.org/LICENSE_1_0.txt).
0008 // See: http://www.boost.org/doc/libs/release/libs/contract/doc/html/index.html
0009 
0010 #include <boost/contract/core/exception.hpp>
0011 #include <boost/contract/core/config.hpp>
0012 #include <boost/contract/detail/condition/cond_post.hpp>
0013 #include <boost/contract/detail/exception.hpp>
0014 #if     !defined(BOOST_CONTRACT_ALL_DISABLE_NO_ASSERTION) && ( \
0015         !defined(BOOST_CONTRACT_NO_PRECONDITIONS) || \
0016         !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \
0017         !defined(BOOST_CONTRACT_NO_EXCEPTS))
0018     #include <boost/contract/detail/checking.hpp>
0019 #endif
0020 #if     !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \
0021         !defined(BOOST_CONTRACT_NO_EXCEPTS)
0022     #include <boost/config.hpp>
0023     #include <exception>
0024 #endif
0025 
0026 namespace boost { namespace contract { namespace detail {
0027 
0028 // Used for free function, private and protected member functions.
0029 class function : public cond_post</* VR = */ none> { // Non-copyable base.
0030 public:
0031     explicit function() : cond_post</* VR = */ none>(
0032             boost::contract::from_function) {}
0033 
0034 private:
0035     #if     !defined(BOOST_CONTRACT_NO_PRECONDITIONS) || \
0036             !defined(BOOST_CONTRACT_NO_OLDS)
0037         void init() /* override */ {
0038             #ifndef  BOOST_CONTRACT_ALL_DISABLE_NO_ASSERTION
0039                 if(checking::already()) return;
0040             #endif
0041             #ifndef BOOST_CONTRACT_NO_PRECONDITIONS
0042                 {
0043                     #if !defined(BOOST_CONTRACT_ALL_DISABLE_NO_ASSERTION) && \
0044                         !defined( \
0045                             BOOST_CONTRACT_PRECONDITIONS_DISABLE_NO_ASSERTION)
0046                         checking k;
0047                     #endif
0048                     this->check_pre();
0049                 }
0050             #endif
0051             #ifndef BOOST_CONTRACT_NO_OLDS
0052                 this->copy_old();
0053             #endif
0054         }
0055     #endif
0056 
0057 public:
0058     #if     !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \
0059             !defined(BOOST_CONTRACT_NO_EXCEPTS)
0060         ~function() BOOST_NOEXCEPT_IF(false) {
0061             this->assert_initialized();
0062             #ifndef  BOOST_CONTRACT_ALL_DISABLE_NO_ASSERTION
0063                 if(checking::already()) return;
0064                 checking k;
0065             #endif
0066             
0067             if(uncaught_exception()) {
0068                 #ifndef BOOST_CONTRACT_NO_EXCEPTS
0069                     this->check_except();
0070                 #endif
0071             } else {
0072                 #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS
0073                     this->check_post(none());
0074                 #endif
0075             }
0076         }
0077     #endif
0078 };
0079 
0080 } } } // namespace
0081 
0082 #endif // #include guard
0083