source: NonGTP/Boost/boost/algorithm/string/detail/find_format_store.hpp @ 857

Revision 857, 2.5 KB checked in by igarcia, 18 years ago (diff)
Line 
1//  Boost string_algo library find_format_store.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_FIND_FORMAT_STORE_DETAIL_HPP
11#define BOOST_STRING_FIND_FORMAT_STORE_DETAIL_HPP
12
13#include <boost/algorithm/string/config.hpp>
14#include <boost/range/iterator_range.hpp>
15
16namespace boost {
17    namespace algorithm {
18        namespace detail {
19
20//  temporary format and find result storage --------------------------------//
21
22            template<
23                typename ForwardIteratorT,
24                typename FormatterT,
25                typename FormatResultT >
26            class find_format_store :
27                public iterator_range<ForwardIteratorT>
28            {
29            public:
30                // typedefs
31                typedef iterator_range<ForwardIteratorT> base_type;
32                typedef FormatterT  formatter_type;
33                typedef FormatResultT format_result_type;
34               
35            public:
36                // Construction
37                find_format_store(
38                        const base_type& FindResult,
39                        const format_result_type& FormatResult,
40                        const formatter_type& Formatter ) :
41                    base_type(FindResult),
42                    m_FormatResult(FormatResult),
43                    m_Formatter(Formatter) {}
44
45                // Assignment
46                template< typename FindResultT >
47                find_format_store& operator=( FindResultT FindResult )
48                {
49                    iterator_range<ForwardIteratorT>::operator=(FindResult);
50                    m_FormatResult=m_Formatter(FindResult);
51                   
52                    return *this;
53                }
54
55                // Retrieve format result
56                const format_result_type& format_result()
57                {   
58                    return m_FormatResult;
59                }
60
61            private:
62                format_result_type m_FormatResult;
63                const formatter_type& m_Formatter;
64            };
65
66        } // namespace detail
67    } // namespace algorithm
68} // namespace boost
69
70#endif  // BOOST_STRING_FIND_FORMAT_STORE_DETAIL_HPP
Note: See TracBrowser for help on using the repository browser.