Ugly, not-to-be-pushed sucking in of all of Boost to get windows to work.
[dyninst.git] / external / boost / algorithm / string / detail / formatter.hpp
1 //  Boost string_algo library formatter.hpp header file  ---------------------------//
2
3 //  Copyright Pavol Droba 2002-2003. Use, modification and
4 //  distribution is subject to the Boost Software License, Version
5 //  1.0. (See accompanying file LICENSE_1_0.txt or copy at
6 //  http://www.boost.org/LICENSE_1_0.txt)
7
8 //  See http://www.boost.org for updates, documentation, and revision history.
9
10 #ifndef BOOST_STRING_FORMATTER_DETAIL_HPP
11 #define BOOST_STRING_FORMATTER_DETAIL_HPP
12
13
14 #include <boost/range/iterator_range.hpp>
15 #include <boost/range/begin.hpp>
16 #include <boost/range/end.hpp>
17 #include <boost/range/const_iterator.hpp>
18
19 #include <boost/algorithm/string/detail/util.hpp>
20
21 //  generic replace functors -----------------------------------------------//
22
23 namespace boost {
24     namespace algorithm {
25         namespace detail {
26
27 //  const format functor ----------------------------------------------------//
28
29             // constant format functor
30             template<typename RangeT>
31             struct const_formatF
32             {
33             private:
34                 typedef BOOST_STRING_TYPENAME
35                     range_const_iterator<RangeT>::type format_iterator;
36                 typedef iterator_range<format_iterator> result_type;
37             
38             public:
39                 // Construction
40                 const_formatF(const RangeT& Format) :
41                     m_Format(begin(Format), end(Format)) {}
42
43                 // Operation
44 #if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
45                 template<typename Range2T>
46                 result_type& operator()(const Range2T&)
47                 {
48                     return m_Format;
49                 }
50 #endif
51
52                 template<typename Range2T>
53                 const result_type& operator()(const Range2T&) const
54                 {
55                     return m_Format;
56                 }
57
58             private:
59                 result_type m_Format;
60             };
61
62 //  identity format functor ----------------------------------------------------//
63
64             // identity format functor
65             template<typename RangeT>
66             struct identity_formatF
67             {
68                 // Operation
69                 template< typename Range2T >
70                 const RangeT& operator()(const Range2T& Replace) const
71                 {
72                     return RangeT(begin(Replace), end(Replace));
73                 }
74             };
75
76 //  empty format functor ( used by erase ) ------------------------------------//
77         
78             // empty format functor
79             template< typename CharT >
80             struct empty_formatF
81             {
82                 template< typename ReplaceT >
83                 empty_container<CharT> operator()(const ReplaceT&) const
84                 {
85                     return empty_container<CharT>();
86                 }
87             };
88
89         } // namespace detail
90     } // namespace algorithm
91 } // namespace boost
92
93 #endif  // BOOST_STRING_FORMATTER_DETAIL_HPP