Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:28:24

0001 //  Boost string_algo library find_format_store.hpp header file  ---------------------------//
0002 
0003 //  Copyright Pavol Droba 2002-2003.
0004 //
0005 // Distributed under the Boost Software License, Version 1.0.
0006 //    (See accompanying file LICENSE_1_0.txt or copy at
0007 //          http://www.boost.org/LICENSE_1_0.txt)
0008 
0009 //  See http://www.boost.org/ for updates, documentation, and revision history.
0010 
0011 #ifndef BOOST_STRING_FIND_FORMAT_STORE_DETAIL_HPP
0012 #define BOOST_STRING_FIND_FORMAT_STORE_DETAIL_HPP
0013 
0014 #include <boost/algorithm/string/config.hpp>
0015 #include <boost/range/iterator_range_core.hpp>
0016 
0017 namespace boost {
0018     namespace algorithm {
0019         namespace detail {
0020 
0021 //  temporary format and find result storage --------------------------------//
0022 
0023 #if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
0024 #pragma warning(push)
0025 #pragma warning(disable:4512) //assignment operator could not be generated
0026 #endif
0027             template< 
0028                 typename ForwardIteratorT,
0029                 typename FormatterT,
0030                 typename FormatResultT >
0031             class find_format_store : 
0032                 public iterator_range<ForwardIteratorT>
0033             {
0034             public:
0035                 // typedefs
0036                 typedef iterator_range<ForwardIteratorT> base_type;
0037                 typedef FormatterT  formatter_type;
0038                 typedef FormatResultT format_result_type;
0039                 
0040             public:
0041                 // Construction
0042                 find_format_store( 
0043                         const base_type& FindResult,
0044                         const format_result_type& FormatResult,
0045                         const formatter_type& Formatter ) :
0046                     base_type(FindResult),
0047                     m_FormatResult(FormatResult),
0048                     m_Formatter(Formatter) {}
0049 
0050                 // Assignment
0051                 template< typename FindResultT >
0052                 find_format_store& operator=( FindResultT FindResult )
0053                 {
0054                     iterator_range<ForwardIteratorT>::operator=(FindResult);
0055                     if( !this->empty() ) {
0056                         m_FormatResult=m_Formatter(FindResult);
0057                     }
0058                     
0059                     return *this;
0060                 }
0061 
0062                 // Retrieve format result
0063                 const format_result_type& format_result()
0064                 {   
0065                     return m_FormatResult;
0066                 }
0067 
0068             private:
0069                 format_result_type m_FormatResult;
0070                 const formatter_type& m_Formatter;
0071             };
0072 
0073             template<typename InputT, typename FindResultT>
0074             bool check_find_result(InputT&, FindResultT& FindResult)
0075             {
0076                 typedef BOOST_STRING_TYPENAME 
0077                     range_const_iterator<InputT>::type input_iterator_type; 
0078                 iterator_range<input_iterator_type> ResultRange(FindResult);
0079                 return !ResultRange.empty();
0080             }
0081 
0082 #if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
0083 #pragma warning(pop)
0084 #endif
0085         } // namespace detail
0086     } // namespace algorithm
0087 } // namespace boost
0088 
0089 #endif  // BOOST_STRING_FIND_FORMAT_STORE_DETAIL_HPP