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 #ifdef BOOST_MSVC
24 #pragma warning(push)
25 #pragma warning(disable: 4103)
26 #endif
27 #ifdef BOOST_HAS_ABI_HEADERS
28 #  include BOOST_ABI_PREFIX
29 #endif
30 #ifdef BOOST_MSVC
31 #pragma warning(pop)
32 #endif
33 
34 namespace boost{
35 namespace BOOST_REGEX_DETAIL_NS{
36 
37 class BOOST_REGEX_DECL abstract_protected_call
38 {
39 public:
40    bool BOOST_REGEX_CALL execute()const;
41    // this stops gcc-4 from complaining:
~abstract_protected_call()42    virtual ~abstract_protected_call(){}
43 private:
44    virtual bool call()const = 0;
45 };
46 
47 template <class T>
48 class concrete_protected_call
49    : public abstract_protected_call
50 {
51 public:
52    typedef bool (T::*proc_type)();
concrete_protected_call(T * o,proc_type p)53    concrete_protected_call(T* o, proc_type p)
54       : obj(o), proc(p) {}
55 private:
56    virtual bool call()const;
57    T* obj;
58    proc_type proc;
59 };
60 
61 template <class T>
call() const62 bool concrete_protected_call<T>::call()const
63 {
64    return (obj->*proc)();
65 }
66 
67 }
68 } // namespace boost
69 
70 #ifdef BOOST_MSVC
71 #pragma warning(push)
72 #pragma warning(disable: 4103)
73 #endif
74 #ifdef BOOST_HAS_ABI_HEADERS
75 #  include BOOST_ABI_SUFFIX
76 #endif
77 #ifdef BOOST_MSVC
78 #pragma warning(pop)
79 #endif
80 
81 #endif
82