]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/wave/include/boost/wave/util/symbol_table.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / wave / include / boost / wave / util / symbol_table.hpp
CommitLineData
7c673cae
FG
1/*=============================================================================
2 Boost.Wave: A Standard compliant C++ preprocessor library
3
4 http://www.boost.org/
5
6 Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost
7 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#if !defined(SYMBOL_TABLE_HPP_32B0F7C6_3DD6_4113_95A5_E16516C6F45A_INCLUDED)
12#define SYMBOL_TABLE_HPP_32B0F7C6_3DD6_4113_95A5_E16516C6F45A_INCLUDED
13
14#include <map>
15
16#include <boost/wave/wave_config.hpp>
17#include <boost/intrusive_ptr.hpp>
18
19#if BOOST_WAVE_SERIALIZATION != 0
20#include <boost/serialization/serialization.hpp>
21#include <boost/serialization/map.hpp>
22#include <boost/shared_ptr.hpp>
23#else
24#include <boost/intrusive_ptr.hpp>
25#endif
26
27#include <boost/iterator/transform_iterator.hpp>
28
29// this must occur after all of the includes and before any code appears
30#ifdef BOOST_HAS_ABI_HEADERS
31#include BOOST_ABI_PREFIX
32#endif
33
34///////////////////////////////////////////////////////////////////////////////
35namespace boost {
36namespace wave {
37namespace util {
38
39///////////////////////////////////////////////////////////////////////////////
40//
41// The symbol_table class is used for the storage of defined macros.
42//
43///////////////////////////////////////////////////////////////////////////////
44
45template <typename StringT, typename MacroDefT>
46struct symbol_table
47#if BOOST_WAVE_SERIALIZATION != 0
48: public std::map<StringT, boost::shared_ptr<MacroDefT> >
49#else
50: public std::map<StringT, boost::intrusive_ptr<MacroDefT> >
51#endif
52{
53#if BOOST_WAVE_SERIALIZATION != 0
54 typedef std::map<StringT, boost::shared_ptr<MacroDefT> > base_type;
55#else
56 typedef std::map<StringT, boost::intrusive_ptr<MacroDefT> > base_type;
57#endif
58 typedef typename base_type::iterator iterator_type;
59 typedef typename base_type::const_iterator const_iterator_type;
60
61 symbol_table(long uid_ = 0)
62 {}
63
64#if BOOST_WAVE_SERIALIZATION != 0
65private:
66 friend class boost::serialization::access;
67 template<typename Archive>
68 void serialize(Archive &ar, const unsigned int version)
69 {
70 using namespace boost::serialization;
71 ar & make_nvp("symbol_table",
72 boost::serialization::base_object<base_type>(*this));
73 }
74#endif
75
76private:
77 ///////////////////////////////////////////////////////////////////////////
78 //
79 // This is a special iterator allowing to iterate the names of all defined
80 // macros.
81 //
82 ///////////////////////////////////////////////////////////////////////////
83 template <typename StringT1>
84 struct get_first
85 {
86 typedef StringT1 const& result_type;
87
88 template <typename First, typename Second>
89 StringT1 const& operator() (std::pair<First, Second> const& p) const
90 {
91 return p.first;
92 }
93 };
94 typedef get_first<StringT> unary_functor;
95
96public:
97 typedef transform_iterator<unary_functor, iterator_type>
98 name_iterator;
99 typedef transform_iterator<unary_functor, const_iterator_type>
100 const_name_iterator;
101
102 template <typename Iterator>
103 static
104 transform_iterator<unary_functor, Iterator> make_iterator(Iterator it)
105 {
106 return boost::make_transform_iterator<unary_functor>(it);
107 }
108};
109
110///////////////////////////////////////////////////////////////////////////////
111} // namespace util
112} // namespace wave
113} // namespace boost
114
115// the suffix header occurs after all of the code
116#ifdef BOOST_HAS_ABI_HEADERS
117#include BOOST_ABI_SUFFIX
118#endif
119
120#endif // !defined(SYMBOL_TABLE_HPP_32B0F7C6_3DD6_4113_95A5_E16516C6F45A_INCLUDED)