1 // Boost string_algo library find_format_store.hpp header file ---------------------------//
3 // Copyright Pavol Droba 2002-2003.
5 // Distributed under the Boost Software License, Version 1.0.
6 // (See accompanying file LICENSE_1_0.txt or copy at
7 // http://www.boost.org/LICENSE_1_0.txt)
9 // See http://www.boost.org/ for updates, documentation, and revision history.
11 #ifndef BOOST_STRING_FIND_FORMAT_STORE_DETAIL_HPP
12 #define BOOST_STRING_FIND_FORMAT_STORE_DETAIL_HPP
14 #include <boost/algorithm/string/config.hpp>
15 #include <boost/range/iterator_range_core.hpp>
21 // temporary format and find result storage --------------------------------//
23 #if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
25 #pragma warning(disable:4512) //assignment operator could not be generated
28 typename ForwardIteratorT,
30 typename FormatResultT >
31 class find_format_store :
32 public iterator_range<ForwardIteratorT>
36 typedef iterator_range<ForwardIteratorT> base_type;
37 typedef FormatterT formatter_type;
38 typedef FormatResultT format_result_type;
43 const base_type& FindResult,
44 const format_result_type& FormatResult,
45 const formatter_type& Formatter ) :
46 base_type(FindResult),
47 m_FormatResult(FormatResult),
48 m_Formatter(Formatter) {}
51 template< typename FindResultT >
52 find_format_store& operator=( FindResultT FindResult )
54 iterator_range<ForwardIteratorT>::operator=(FindResult);
55 if( !this->empty() ) {
56 m_FormatResult=m_Formatter(FindResult);
62 // Retrieve format result
63 const format_result_type& format_result()
65 return m_FormatResult;
69 format_result_type m_FormatResult;
70 const formatter_type& m_Formatter;
73 template<typename InputT, typename FindResultT>
74 bool check_find_result(InputT&, FindResultT& FindResult)
76 typedef BOOST_STRING_TYPENAME
77 range_const_iterator<InputT>::type input_iterator_type;
78 iterator_range<input_iterator_type> ResultRange(FindResult);
79 return !ResultRange.empty();
82 #if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
86 } // namespace algorithm
89 #endif // BOOST_STRING_FIND_FORMAT_STORE_DETAIL_HPP