]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/contract/detail/operation/function.hpp
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / src / boost / boost / contract / detail / operation / function.hpp
1
2 #ifndef BOOST_CONTRACT_DETAIL_FUNCTION_HPP_
3 #define BOOST_CONTRACT_DETAIL_FUNCTION_HPP_
4
5 // Copyright (C) 2008-2018 Lorenzo Caminiti
6 // Distributed under the Boost Software License, Version 1.0 (see accompanying
7 // file LICENSE_1_0.txt or a copy at http://www.boost.org/LICENSE_1_0.txt).
8 // See: http://www.boost.org/doc/libs/release/libs/contract/doc/html/index.html
9
10 #include <boost/contract/core/exception.hpp>
11 #include <boost/contract/core/config.hpp>
12 #include <boost/contract/detail/condition/cond_post.hpp>
13 #if !defined(BOOST_CONTRACT_ALL_DISABLE_NO_ASSERTION) && ( \
14 !defined(BOOST_CONTRACT_NO_PRECONDITIONS) || \
15 !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \
16 !defined(BOOST_CONTRACT_NO_EXCEPTS))
17 #include <boost/contract/detail/checking.hpp>
18 #endif
19 #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \
20 !defined(BOOST_CONTRACT_NO_EXCEPTS)
21 #include <boost/config.hpp>
22 #include <exception>
23 #endif
24
25 namespace boost { namespace contract { namespace detail {
26
27 // Used for free function, private and protected member functions.
28 class function : public cond_post</* VR = */ none> { // Non-copyable base.
29 public:
30 explicit function() : cond_post</* VR = */ none>(
31 boost::contract::from_function) {}
32
33 private:
34 #if !defined(BOOST_CONTRACT_NO_PRECONDITIONS) || \
35 !defined(BOOST_CONTRACT_NO_OLDS)
36 void init() /* override */ {
37 #ifndef BOOST_CONTRACT_ALL_DISABLE_NO_ASSERTION
38 if(checking::already()) return;
39 #endif
40 #ifndef BOOST_CONTRACT_NO_PRECONDITIONS
41 {
42 #if !defined(BOOST_CONTRACT_ALL_DISABLE_NO_ASSERTION) && \
43 !defined( \
44 BOOST_CONTRACT_PRECONDITIONS_DISABLE_NO_ASSERTION)
45 checking k;
46 #endif
47 this->check_pre();
48 }
49 #endif
50 #ifndef BOOST_CONTRACT_NO_OLDS
51 this->copy_old();
52 #endif
53 }
54 #endif
55
56 public:
57 #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) || \
58 !defined(BOOST_CONTRACT_NO_EXCEPTS)
59 ~function() BOOST_NOEXCEPT_IF(false) {
60 this->assert_initialized();
61 #ifndef BOOST_CONTRACT_ALL_DISABLE_NO_ASSERTION
62 if(checking::already()) return;
63 checking k;
64 #endif
65
66 if(std::uncaught_exception()) {
67 #ifndef BOOST_CONTRACT_NO_EXCEPTS
68 this->check_except();
69 #endif
70 } else {
71 #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS
72 this->check_post(none());
73 #endif
74 }
75 }
76 #endif
77 };
78
79 } } } // namespace
80
81 #endif // #include guard
82