Chris@16: // Boost string_algo library case_conv.hpp header file ---------------------------// Chris@16: Chris@16: // Copyright Pavol Droba 2002-2003. Chris@16: // Chris@16: // Distributed under the Boost Software License, Version 1.0. Chris@16: // (See accompanying file LICENSE_1_0.txt or copy at Chris@16: // http://www.boost.org/LICENSE_1_0.txt) Chris@16: Chris@16: // See http://www.boost.org/ for updates, documentation, and revision history. Chris@16: Chris@16: #ifndef BOOST_STRING_CASE_CONV_HPP Chris@16: #define BOOST_STRING_CASE_CONV_HPP Chris@16: Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: Chris@16: #include Chris@16: Chris@16: /*! \file Chris@16: Defines sequence case-conversion algorithms. Chris@16: Algorithms convert each element in the input sequence to the Chris@16: desired case using provided locales. Chris@16: */ Chris@16: Chris@16: namespace boost { Chris@16: namespace algorithm { Chris@16: Chris@16: // to_lower -----------------------------------------------// Chris@16: Chris@16: //! Convert to lower case Chris@16: /*! Chris@16: Each element of the input sequence is converted to lower Chris@16: case. The result is a copy of the input converted to lower case. Chris@16: It is returned as a sequence or copied to the output iterator. Chris@16: Chris@16: \param Output An output iterator to which the result will be copied Chris@16: \param Input An input range Chris@16: \param Loc A locale used for conversion Chris@16: \return Chris@16: An output iterator pointing just after the last inserted character or Chris@16: a copy of the input Chris@16: Chris@16: \note The second variant of this function provides the strong exception-safety guarantee Chris@16: Chris@16: */ Chris@16: template Chris@16: inline OutputIteratorT Chris@16: to_lower_copy( Chris@16: OutputIteratorT Output, Chris@16: const RangeT& Input, Chris@16: const std::locale& Loc=std::locale()) Chris@16: { Chris@16: return ::boost::algorithm::detail::transform_range_copy( Chris@16: Output, Chris@16: ::boost::as_literal(Input), Chris@16: ::boost::algorithm::detail::to_lowerF< Chris@16: typename range_value::type >(Loc)); Chris@16: } Chris@16: Chris@16: //! Convert to lower case Chris@16: /*! Chris@16: \overload Chris@16: */ Chris@16: template Chris@16: inline SequenceT to_lower_copy( Chris@16: const SequenceT& Input, Chris@16: const std::locale& Loc=std::locale()) Chris@16: { Chris@16: return ::boost::algorithm::detail::transform_range_copy( Chris@16: Input, Chris@16: ::boost::algorithm::detail::to_lowerF< Chris@16: typename range_value::type >(Loc)); Chris@16: } Chris@16: Chris@16: //! Convert to lower case Chris@16: /*! Chris@16: Each element of the input sequence is converted to lower Chris@16: case. The input sequence is modified in-place. Chris@16: Chris@16: \param Input A range Chris@16: \param Loc a locale used for conversion Chris@16: */ Chris@16: template Chris@16: inline void to_lower( Chris@16: WritableRangeT& Input, Chris@16: const std::locale& Loc=std::locale()) Chris@16: { Chris@16: ::boost::algorithm::detail::transform_range( Chris@16: ::boost::as_literal(Input), Chris@16: ::boost::algorithm::detail::to_lowerF< Chris@16: typename range_value::type >(Loc)); Chris@16: } Chris@16: Chris@16: // to_upper -----------------------------------------------// Chris@16: Chris@16: //! Convert to upper case Chris@16: /*! Chris@16: Each element of the input sequence is converted to upper Chris@16: case. The result is a copy of the input converted to upper case. Chris@16: It is returned as a sequence or copied to the output iterator Chris@16: Chris@16: \param Output An output iterator to which the result will be copied Chris@16: \param Input An input range Chris@16: \param Loc A locale used for conversion Chris@16: \return Chris@16: An output iterator pointing just after the last inserted character or Chris@16: a copy of the input Chris@16: Chris@16: \note The second variant of this function provides the strong exception-safety guarantee Chris@16: */ Chris@16: template Chris@16: inline OutputIteratorT Chris@16: to_upper_copy( Chris@16: OutputIteratorT Output, Chris@16: const RangeT& Input, Chris@16: const std::locale& Loc=std::locale()) Chris@16: { Chris@16: return ::boost::algorithm::detail::transform_range_copy( Chris@16: Output, Chris@16: ::boost::as_literal(Input), Chris@16: ::boost::algorithm::detail::to_upperF< Chris@16: typename range_value::type >(Loc)); Chris@16: } Chris@16: Chris@16: //! Convert to upper case Chris@16: /*! Chris@16: \overload Chris@16: */ Chris@16: template Chris@16: inline SequenceT to_upper_copy( Chris@16: const SequenceT& Input, Chris@16: const std::locale& Loc=std::locale()) Chris@16: { Chris@16: return ::boost::algorithm::detail::transform_range_copy( Chris@16: Input, Chris@16: ::boost::algorithm::detail::to_upperF< Chris@16: typename range_value::type >(Loc)); Chris@16: } Chris@16: Chris@16: //! Convert to upper case Chris@16: /*! Chris@16: Each element of the input sequence is converted to upper Chris@16: case. The input sequence is modified in-place. Chris@16: Chris@16: \param Input An input range Chris@16: \param Loc a locale used for conversion Chris@16: */ Chris@16: template Chris@16: inline void to_upper( Chris@16: WritableRangeT& Input, Chris@16: const std::locale& Loc=std::locale()) Chris@16: { Chris@16: ::boost::algorithm::detail::transform_range( Chris@16: ::boost::as_literal(Input), Chris@16: ::boost::algorithm::detail::to_upperF< Chris@16: typename range_value::type >(Loc)); Chris@16: } Chris@16: Chris@16: } // namespace algorithm Chris@16: Chris@16: // pull names to the boost namespace Chris@16: using algorithm::to_lower; Chris@16: using algorithm::to_lower_copy; Chris@16: using algorithm::to_upper; Chris@16: using algorithm::to_upper_copy; Chris@16: Chris@16: } // namespace boost Chris@16: Chris@16: #endif // BOOST_STRING_CASE_CONV_HPP