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_HAS_ABI_HEADERS
|
---|
24 | # include BOOST_ABI_PREFIX
|
---|
25 | #endif
|
---|
26 |
|
---|
27 | namespace boost{
|
---|
28 | namespace re_detail{
|
---|
29 |
|
---|
30 | class BOOST_REGEX_DECL abstract_protected_call
|
---|
31 | {
|
---|
32 | public:
|
---|
33 | bool BOOST_REGEX_CALL execute()const;
|
---|
34 | // this stops gcc-4 from complaining:
|
---|
35 | virtual ~abstract_protected_call(){}
|
---|
36 | private:
|
---|
37 | virtual bool call()const = 0;
|
---|
38 | };
|
---|
39 |
|
---|
40 | template <class T>
|
---|
41 | class concrete_protected_call
|
---|
42 | : public abstract_protected_call
|
---|
43 | {
|
---|
44 | public:
|
---|
45 | typedef bool (T::*proc_type)();
|
---|
46 | concrete_protected_call(T* o, proc_type p)
|
---|
47 | : obj(o), proc(p) {}
|
---|
48 | private:
|
---|
49 | virtual bool call()const;
|
---|
50 | T* obj;
|
---|
51 | proc_type proc;
|
---|
52 | };
|
---|
53 |
|
---|
54 | template <class T>
|
---|
55 | bool concrete_protected_call<T>::call()const
|
---|
56 | {
|
---|
57 | return (obj->*proc)();
|
---|
58 | }
|
---|
59 |
|
---|
60 | }
|
---|
61 | } // namespace boost
|
---|
62 |
|
---|
63 | #ifdef BOOST_HAS_ABI_HEADERS
|
---|
64 | # include BOOST_ABI_SUFFIX
|
---|
65 | #endif
|
---|
66 |
|
---|
67 | #endif
|
---|