1 /*
2  *
3  * Copyright (c) 2004
4  * John Maddock
5  *
6  * Use, modification and distribution are subject to the
7  * Boost Software License, Version 1.0. (See accompanying file
8  * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
9  *
10  */
11 
12  /*
13   *   LOCATION:    see http://www.boost.org for most recent version.
14   *   FILE         basic_regex_creator.cpp
15   *   VERSION      see <boost/version.hpp>
16   *   DESCRIPTION: Declares template class basic_regex_creator which fills in
17   *                the data members of a regex_data object.
18   */
19 
20 #ifndef BOOST_REGEX_V4_PROTECTED_CALL_HPP
21 #define BOOST_REGEX_V4_PROTECTED_CALL_HPP
22 
23 #include <boost/config.hpp>
24 
25 #ifdef BOOST_MSVC
26 #pragma warning(push)
27 #pragma warning(disable: 4103)
28 #endif
29 #ifdef BOOST_HAS_ABI_HEADERS
30 #  include BOOST_ABI_PREFIX
31 #endif
32 #ifdef BOOST_MSVC
33 #pragma warning(pop)
34 #endif
35 
36 namespace boost{
37 namespace BOOST_REGEX_DETAIL_NS{
38 
39 class BOOST_REGEX_DECL abstract_protected_call
40 {
41 public:
42    bool BOOST_REGEX_CALL execute()const;
43    // this stops gcc-4 from complaining:
~abstract_protected_call()44    virtual ~abstract_protected_call(){}
45 private:
46    virtual bool call()const = 0;
47 };
48 
49 template <class T>
50 class concrete_protected_call
51    : public abstract_protected_call
52 {
53 public:
54    typedef bool (T::*proc_type)();
concrete_protected_call(T * o,proc_type p)55    concrete_protected_call(T* o, proc_type p)
56       : obj(o), proc(p) {}
57 private:
58    bool call()const BOOST_OVERRIDE;
59    T* obj;
60    proc_type proc;
61 };
62 
63 template <class T>
call() const64 bool concrete_protected_call<T>::call()const
65 {
66    return (obj->*proc)();
67 }
68 
69 }
70 } // namespace boost
71 
72 #ifdef BOOST_MSVC
73 #pragma warning(push)
74 #pragma warning(disable: 4103)
75 #endif
76 #ifdef BOOST_HAS_ABI_HEADERS
77 #  include BOOST_ABI_SUFFIX
78 #endif
79 #ifdef BOOST_MSVC
80 #pragma warning(pop)
81 #endif
82 
83 #endif
84