1 // Boost string_algo library string_funct.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_CASE_CONV_DETAIL_HPP
12 #define BOOST_STRING_CASE_CONV_DETAIL_HPP
14 #include <boost/algorithm/string/config.hpp>
18 #include <boost/type_traits/make_unsigned.hpp>
24 // case conversion functors -----------------------------------------------//
26 #if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
28 #pragma warning(disable:4512) //assignment operator could not be generated
32 template<typename CharT>
33 struct to_lowerF : public std::unary_function<CharT, CharT>
36 to_lowerF( const std::locale& Loc ) : m_Loc( &Loc ) {}
39 CharT operator ()( CharT Ch ) const
41 #if defined(__BORLANDC__) && (__BORLANDC__ >= 0x560) && (__BORLANDC__ <= 0x564) && !defined(_USE_OLD_RW_STL)
42 return std::tolower( static_cast<typename boost::make_unsigned <CharT>::type> ( Ch ));
44 return std::tolower<CharT>( Ch, *m_Loc );
48 const std::locale* m_Loc;
52 template<typename CharT>
53 struct to_upperF : public std::unary_function<CharT, CharT>
56 to_upperF( const std::locale& Loc ) : m_Loc( &Loc ) {}
59 CharT operator ()( CharT Ch ) const
61 #if defined(__BORLANDC__) && (__BORLANDC__ >= 0x560) && (__BORLANDC__ <= 0x564) && !defined(_USE_OLD_RW_STL)
62 return std::toupper( static_cast<typename boost::make_unsigned <CharT>::type> ( Ch ));
64 return std::toupper<CharT>( Ch, *m_Loc );
68 const std::locale* m_Loc;
71 #if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
75 // algorithm implementation -------------------------------------------------------------------------
78 template<typename OutputIteratorT, typename RangeT, typename FunctorT>
79 OutputIteratorT transform_range_copy(
80 OutputIteratorT Output,
84 return std::transform(
85 ::boost::begin(Input),
91 // Transform a range (in-place)
92 template<typename RangeT, typename FunctorT>
98 ::boost::begin(Input),
100 ::boost::begin(Input),
104 template<typename SequenceT, typename RangeT, typename FunctorT>
105 inline SequenceT transform_range_copy(
110 ::boost::make_transform_iterator(
111 ::boost::begin(Input),
113 ::boost::make_transform_iterator(
118 } // namespace detail
119 } // namespace algorithm
123 #endif // BOOST_STRING_CASE_CONV_DETAIL_HPP