blob: 88615de82d3b81bda523b6dae9a4f8ddcc557b62 [file] [log] [blame]
Jeff Thompson86b6d642013-10-17 15:01:56 -07001/*
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 <ndnboost/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 NDNBOOST_REGEX_V4_PROTECTED_CALL_HPP
21#define NDNBOOST_REGEX_V4_PROTECTED_CALL_HPP
22
23#ifdef NDNBOOST_MSVC
24#pragma warning(push)
25#pragma warning(disable: 4103)
26#endif
27#ifdef NDNBOOST_HAS_ABI_HEADERS
28# include NDNBOOST_ABI_PREFIX
29#endif
30#ifdef NDNBOOST_MSVC
31#pragma warning(pop)
32#endif
33
34namespace ndnboost{
35namespace re_detail{
36
37class NDNBOOST_REGEX_DECL abstract_protected_call
38{
39public:
40 bool NDNBOOST_REGEX_CALL execute()const;
41 // this stops gcc-4 from complaining:
42 virtual ~abstract_protected_call(){}
43private:
44 virtual bool call()const = 0;
45};
46
47template <class T>
48class concrete_protected_call
49 : public abstract_protected_call
50{
51public:
52 typedef bool (T::*proc_type)();
53 concrete_protected_call(T* o, proc_type p)
54 : obj(o), proc(p) {}
55private:
56 virtual bool call()const;
57 T* obj;
58 proc_type proc;
59};
60
61template <class T>
62bool concrete_protected_call<T>::call()const
63{
64 return (obj->*proc)();
65}
66
67}
68} // namespace ndnboost
69
70#ifdef NDNBOOST_MSVC
71#pragma warning(push)
72#pragma warning(disable: 4103)
73#endif
74#ifdef NDNBOOST_HAS_ABI_HEADERS
75# include NDNBOOST_ABI_SUFFIX
76#endif
77#ifdef NDNBOOST_MSVC
78#pragma warning(pop)
79#endif
80
81#endif