annotate DEPENDENCIES/generic/include/boost/algorithm/string/case_conv.hpp @ 133:4acb5d8d80b6 tip

Don't fail environmental check if README.md exists (but .txt and no-suffix don't)
author Chris Cannam
date Tue, 30 Jul 2019 12:25:44 +0100
parents 2665513ce2d3
children
rev   line source
Chris@16 1 // Boost string_algo library case_conv.hpp header file ---------------------------//
Chris@16 2
Chris@16 3 // Copyright Pavol Droba 2002-2003.
Chris@16 4 //
Chris@16 5 // Distributed under the Boost Software License, Version 1.0.
Chris@16 6 // (See accompanying file LICENSE_1_0.txt or copy at
Chris@16 7 // http://www.boost.org/LICENSE_1_0.txt)
Chris@16 8
Chris@16 9 // See http://www.boost.org/ for updates, documentation, and revision history.
Chris@16 10
Chris@16 11 #ifndef BOOST_STRING_CASE_CONV_HPP
Chris@16 12 #define BOOST_STRING_CASE_CONV_HPP
Chris@16 13
Chris@16 14 #include <boost/algorithm/string/config.hpp>
Chris@16 15 #include <algorithm>
Chris@16 16 #include <locale>
Chris@16 17 #include <boost/iterator/transform_iterator.hpp>
Chris@16 18
Chris@16 19 #include <boost/range/as_literal.hpp>
Chris@16 20 #include <boost/range/begin.hpp>
Chris@16 21 #include <boost/range/end.hpp>
Chris@16 22 #include <boost/range/value_type.hpp>
Chris@16 23
Chris@16 24 #include <boost/algorithm/string/detail/case_conv.hpp>
Chris@16 25
Chris@16 26 /*! \file
Chris@16 27 Defines sequence case-conversion algorithms.
Chris@16 28 Algorithms convert each element in the input sequence to the
Chris@16 29 desired case using provided locales.
Chris@16 30 */
Chris@16 31
Chris@16 32 namespace boost {
Chris@16 33 namespace algorithm {
Chris@16 34
Chris@16 35 // to_lower -----------------------------------------------//
Chris@16 36
Chris@16 37 //! Convert to lower case
Chris@16 38 /*!
Chris@16 39 Each element of the input sequence is converted to lower
Chris@16 40 case. The result is a copy of the input converted to lower case.
Chris@16 41 It is returned as a sequence or copied to the output iterator.
Chris@16 42
Chris@16 43 \param Output An output iterator to which the result will be copied
Chris@16 44 \param Input An input range
Chris@16 45 \param Loc A locale used for conversion
Chris@16 46 \return
Chris@16 47 An output iterator pointing just after the last inserted character or
Chris@16 48 a copy of the input
Chris@16 49
Chris@16 50 \note The second variant of this function provides the strong exception-safety guarantee
Chris@16 51
Chris@16 52 */
Chris@16 53 template<typename OutputIteratorT, typename RangeT>
Chris@16 54 inline OutputIteratorT
Chris@16 55 to_lower_copy(
Chris@16 56 OutputIteratorT Output,
Chris@16 57 const RangeT& Input,
Chris@16 58 const std::locale& Loc=std::locale())
Chris@16 59 {
Chris@16 60 return ::boost::algorithm::detail::transform_range_copy(
Chris@16 61 Output,
Chris@16 62 ::boost::as_literal(Input),
Chris@16 63 ::boost::algorithm::detail::to_lowerF<
Chris@16 64 typename range_value<RangeT>::type >(Loc));
Chris@16 65 }
Chris@16 66
Chris@16 67 //! Convert to lower case
Chris@16 68 /*!
Chris@16 69 \overload
Chris@16 70 */
Chris@16 71 template<typename SequenceT>
Chris@16 72 inline SequenceT to_lower_copy(
Chris@16 73 const SequenceT& Input,
Chris@16 74 const std::locale& Loc=std::locale())
Chris@16 75 {
Chris@16 76 return ::boost::algorithm::detail::transform_range_copy<SequenceT>(
Chris@16 77 Input,
Chris@16 78 ::boost::algorithm::detail::to_lowerF<
Chris@16 79 typename range_value<SequenceT>::type >(Loc));
Chris@16 80 }
Chris@16 81
Chris@16 82 //! Convert to lower case
Chris@16 83 /*!
Chris@16 84 Each element of the input sequence is converted to lower
Chris@16 85 case. The input sequence is modified in-place.
Chris@16 86
Chris@16 87 \param Input A range
Chris@16 88 \param Loc a locale used for conversion
Chris@16 89 */
Chris@16 90 template<typename WritableRangeT>
Chris@16 91 inline void to_lower(
Chris@16 92 WritableRangeT& Input,
Chris@16 93 const std::locale& Loc=std::locale())
Chris@16 94 {
Chris@16 95 ::boost::algorithm::detail::transform_range(
Chris@16 96 ::boost::as_literal(Input),
Chris@16 97 ::boost::algorithm::detail::to_lowerF<
Chris@16 98 typename range_value<WritableRangeT>::type >(Loc));
Chris@16 99 }
Chris@16 100
Chris@16 101 // to_upper -----------------------------------------------//
Chris@16 102
Chris@16 103 //! Convert to upper case
Chris@16 104 /*!
Chris@16 105 Each element of the input sequence is converted to upper
Chris@16 106 case. The result is a copy of the input converted to upper case.
Chris@16 107 It is returned as a sequence or copied to the output iterator
Chris@16 108
Chris@16 109 \param Output An output iterator to which the result will be copied
Chris@16 110 \param Input An input range
Chris@16 111 \param Loc A locale used for conversion
Chris@16 112 \return
Chris@16 113 An output iterator pointing just after the last inserted character or
Chris@16 114 a copy of the input
Chris@16 115
Chris@16 116 \note The second variant of this function provides the strong exception-safety guarantee
Chris@16 117 */
Chris@16 118 template<typename OutputIteratorT, typename RangeT>
Chris@16 119 inline OutputIteratorT
Chris@16 120 to_upper_copy(
Chris@16 121 OutputIteratorT Output,
Chris@16 122 const RangeT& Input,
Chris@16 123 const std::locale& Loc=std::locale())
Chris@16 124 {
Chris@16 125 return ::boost::algorithm::detail::transform_range_copy(
Chris@16 126 Output,
Chris@16 127 ::boost::as_literal(Input),
Chris@16 128 ::boost::algorithm::detail::to_upperF<
Chris@16 129 typename range_value<RangeT>::type >(Loc));
Chris@16 130 }
Chris@16 131
Chris@16 132 //! Convert to upper case
Chris@16 133 /*!
Chris@16 134 \overload
Chris@16 135 */
Chris@16 136 template<typename SequenceT>
Chris@16 137 inline SequenceT to_upper_copy(
Chris@16 138 const SequenceT& Input,
Chris@16 139 const std::locale& Loc=std::locale())
Chris@16 140 {
Chris@16 141 return ::boost::algorithm::detail::transform_range_copy<SequenceT>(
Chris@16 142 Input,
Chris@16 143 ::boost::algorithm::detail::to_upperF<
Chris@16 144 typename range_value<SequenceT>::type >(Loc));
Chris@16 145 }
Chris@16 146
Chris@16 147 //! Convert to upper case
Chris@16 148 /*!
Chris@16 149 Each element of the input sequence is converted to upper
Chris@16 150 case. The input sequence is modified in-place.
Chris@16 151
Chris@16 152 \param Input An input range
Chris@16 153 \param Loc a locale used for conversion
Chris@16 154 */
Chris@16 155 template<typename WritableRangeT>
Chris@16 156 inline void to_upper(
Chris@16 157 WritableRangeT& Input,
Chris@16 158 const std::locale& Loc=std::locale())
Chris@16 159 {
Chris@16 160 ::boost::algorithm::detail::transform_range(
Chris@16 161 ::boost::as_literal(Input),
Chris@16 162 ::boost::algorithm::detail::to_upperF<
Chris@16 163 typename range_value<WritableRangeT>::type >(Loc));
Chris@16 164 }
Chris@16 165
Chris@16 166 } // namespace algorithm
Chris@16 167
Chris@16 168 // pull names to the boost namespace
Chris@16 169 using algorithm::to_lower;
Chris@16 170 using algorithm::to_lower_copy;
Chris@16 171 using algorithm::to_upper;
Chris@16 172 using algorithm::to_upper_copy;
Chris@16 173
Chris@16 174 } // namespace boost
Chris@16 175
Chris@16 176 #endif // BOOST_STRING_CASE_CONV_HPP