Skip to content

Commit 45fda9b

Browse files
committed
Merge remote-tracking branch 'origin/master' into new_libcxx_version
2 parents 6a3c938 + 042ce98 commit 45fda9b

File tree

1,616 files changed

+294331
-20040
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,616 files changed

+294331
-20040
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// Boost string_algo library string_algo.hpp header file ---------------------------//
2+
3+
// Copyright Pavol Droba 2002-2004.
4+
//
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)
8+
9+
// See http://www.boost.org/ for updates, documentation, and revision history.
10+
11+
#ifndef BOOST_STRING_ALGO_HPP
12+
#define BOOST_STRING_ALGO_HPP
13+
14+
/*! \file
15+
Cumulative include for string_algo library
16+
*/
17+
18+
#include <boost/algorithm/string/std_containers_traits.hpp>
19+
#include <boost/algorithm/string/trim.hpp>
20+
#include <boost/algorithm/string/case_conv.hpp>
21+
#include <boost/algorithm/string/predicate.hpp>
22+
#include <boost/algorithm/string/find.hpp>
23+
#include <boost/algorithm/string/split.hpp>
24+
#include <boost/algorithm/string/join.hpp>
25+
#include <boost/algorithm/string/replace.hpp>
26+
#include <boost/algorithm/string/erase.hpp>
27+
#include <boost/algorithm/string/classification.hpp>
28+
#include <boost/algorithm/string/find_iterator.hpp>
29+
30+
31+
#endif // BOOST_STRING_ALGO_HPP
Lines changed: 176 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,176 @@
1+
// Boost string_algo library case_conv.hpp header file ---------------------------//
2+
3+
// Copyright Pavol Droba 2002-2003.
4+
//
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)
8+
9+
// See http://www.boost.org/ for updates, documentation, and revision history.
10+
11+
#ifndef BOOST_STRING_CASE_CONV_HPP
12+
#define BOOST_STRING_CASE_CONV_HPP
13+
14+
#include <boost/algorithm/string/config.hpp>
15+
#include <algorithm>
16+
#include <locale>
17+
#include <boost/iterator/transform_iterator.hpp>
18+
19+
#include <boost/range/as_literal.hpp>
20+
#include <boost/range/begin.hpp>
21+
#include <boost/range/end.hpp>
22+
#include <boost/range/value_type.hpp>
23+
24+
#include <boost/algorithm/string/detail/case_conv.hpp>
25+
26+
/*! \file
27+
Defines sequence case-conversion algorithms.
28+
Algorithms convert each element in the input sequence to the
29+
desired case using provided locales.
30+
*/
31+
32+
namespace boost {
33+
namespace algorithm {
34+
35+
// to_lower -----------------------------------------------//
36+
37+
//! Convert to lower case
38+
/*!
39+
Each element of the input sequence is converted to lower
40+
case. The result is a copy of the input converted to lower case.
41+
It is returned as a sequence or copied to the output iterator.
42+
43+
\param Output An output iterator to which the result will be copied
44+
\param Input An input range
45+
\param Loc A locale used for conversion
46+
\return
47+
An output iterator pointing just after the last inserted character or
48+
a copy of the input
49+
50+
\note The second variant of this function provides the strong exception-safety guarantee
51+
52+
*/
53+
template<typename OutputIteratorT, typename RangeT>
54+
inline OutputIteratorT
55+
to_lower_copy(
56+
OutputIteratorT Output,
57+
const RangeT& Input,
58+
const std::locale& Loc=std::locale())
59+
{
60+
return ::boost::algorithm::detail::transform_range_copy(
61+
Output,
62+
::boost::as_literal(Input),
63+
::boost::algorithm::detail::to_lowerF<
64+
typename range_value<RangeT>::type >(Loc));
65+
}
66+
67+
//! Convert to lower case
68+
/*!
69+
\overload
70+
*/
71+
template<typename SequenceT>
72+
inline SequenceT to_lower_copy(
73+
const SequenceT& Input,
74+
const std::locale& Loc=std::locale())
75+
{
76+
return ::boost::algorithm::detail::transform_range_copy<SequenceT>(
77+
Input,
78+
::boost::algorithm::detail::to_lowerF<
79+
typename range_value<SequenceT>::type >(Loc));
80+
}
81+
82+
//! Convert to lower case
83+
/*!
84+
Each element of the input sequence is converted to lower
85+
case. The input sequence is modified in-place.
86+
87+
\param Input A range
88+
\param Loc a locale used for conversion
89+
*/
90+
template<typename WritableRangeT>
91+
inline void to_lower(
92+
WritableRangeT& Input,
93+
const std::locale& Loc=std::locale())
94+
{
95+
::boost::algorithm::detail::transform_range(
96+
::boost::as_literal(Input),
97+
::boost::algorithm::detail::to_lowerF<
98+
typename range_value<WritableRangeT>::type >(Loc));
99+
}
100+
101+
// to_upper -----------------------------------------------//
102+
103+
//! Convert to upper case
104+
/*!
105+
Each element of the input sequence is converted to upper
106+
case. The result is a copy of the input converted to upper case.
107+
It is returned as a sequence or copied to the output iterator
108+
109+
\param Output An output iterator to which the result will be copied
110+
\param Input An input range
111+
\param Loc A locale used for conversion
112+
\return
113+
An output iterator pointing just after the last inserted character or
114+
a copy of the input
115+
116+
\note The second variant of this function provides the strong exception-safety guarantee
117+
*/
118+
template<typename OutputIteratorT, typename RangeT>
119+
inline OutputIteratorT
120+
to_upper_copy(
121+
OutputIteratorT Output,
122+
const RangeT& Input,
123+
const std::locale& Loc=std::locale())
124+
{
125+
return ::boost::algorithm::detail::transform_range_copy(
126+
Output,
127+
::boost::as_literal(Input),
128+
::boost::algorithm::detail::to_upperF<
129+
typename range_value<RangeT>::type >(Loc));
130+
}
131+
132+
//! Convert to upper case
133+
/*!
134+
\overload
135+
*/
136+
template<typename SequenceT>
137+
inline SequenceT to_upper_copy(
138+
const SequenceT& Input,
139+
const std::locale& Loc=std::locale())
140+
{
141+
return ::boost::algorithm::detail::transform_range_copy<SequenceT>(
142+
Input,
143+
::boost::algorithm::detail::to_upperF<
144+
typename range_value<SequenceT>::type >(Loc));
145+
}
146+
147+
//! Convert to upper case
148+
/*!
149+
Each element of the input sequence is converted to upper
150+
case. The input sequence is modified in-place.
151+
152+
\param Input An input range
153+
\param Loc a locale used for conversion
154+
*/
155+
template<typename WritableRangeT>
156+
inline void to_upper(
157+
WritableRangeT& Input,
158+
const std::locale& Loc=std::locale())
159+
{
160+
::boost::algorithm::detail::transform_range(
161+
::boost::as_literal(Input),
162+
::boost::algorithm::detail::to_upperF<
163+
typename range_value<WritableRangeT>::type >(Loc));
164+
}
165+
166+
} // namespace algorithm
167+
168+
// pull names to the boost namespace
169+
using algorithm::to_lower;
170+
using algorithm::to_lower_copy;
171+
using algorithm::to_upper;
172+
using algorithm::to_upper_copy;
173+
174+
} // namespace boost
175+
176+
#endif // BOOST_STRING_CASE_CONV_HPP
Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
// Boost string_algo library string_funct.hpp header file ---------------------------//
2+
3+
// Copyright Pavol Droba 2002-2003.
4+
//
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)
8+
9+
// See http://www.boost.org/ for updates, documentation, and revision history.
10+
11+
#ifndef BOOST_STRING_CASE_CONV_DETAIL_HPP
12+
#define BOOST_STRING_CASE_CONV_DETAIL_HPP
13+
14+
#include <boost/algorithm/string/config.hpp>
15+
#include <locale>
16+
#include <functional>
17+
18+
#include <boost/iterator/transform_iterator.hpp>
19+
#include <boost/range/begin.hpp>
20+
#include <boost/range/end.hpp>
21+
#include <boost/type_traits/make_unsigned.hpp>
22+
23+
namespace boost {
24+
namespace algorithm {
25+
namespace detail {
26+
27+
// case conversion functors -----------------------------------------------//
28+
29+
#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
30+
#pragma warning(push)
31+
#pragma warning(disable:4512) //assignment operator could not be generated
32+
#endif
33+
34+
// a tolower functor
35+
template<typename CharT>
36+
struct to_lowerF
37+
{
38+
typedef CharT argument_type;
39+
typedef CharT result_type;
40+
// Constructor
41+
to_lowerF( const std::locale& Loc ) : m_Loc( &Loc ) {}
42+
43+
// Operation
44+
CharT operator ()( CharT Ch ) const
45+
{
46+
#if defined(BOOST_BORLANDC) && (BOOST_BORLANDC >= 0x560) && (BOOST_BORLANDC <= 0x564) && !defined(_USE_OLD_RW_STL)
47+
return std::tolower( static_cast<typename boost::make_unsigned <CharT>::type> ( Ch ));
48+
#else
49+
return std::tolower<CharT>( Ch, *m_Loc );
50+
#endif
51+
}
52+
private:
53+
const std::locale* m_Loc;
54+
};
55+
56+
// a toupper functor
57+
template<typename CharT>
58+
struct to_upperF
59+
{
60+
typedef CharT argument_type;
61+
typedef CharT result_type;
62+
// Constructor
63+
to_upperF( const std::locale& Loc ) : m_Loc( &Loc ) {}
64+
65+
// Operation
66+
CharT operator ()( CharT Ch ) const
67+
{
68+
#if defined(BOOST_BORLANDC) && (BOOST_BORLANDC >= 0x560) && (BOOST_BORLANDC <= 0x564) && !defined(_USE_OLD_RW_STL)
69+
return std::toupper( static_cast<typename boost::make_unsigned <CharT>::type> ( Ch ));
70+
#else
71+
return std::toupper<CharT>( Ch, *m_Loc );
72+
#endif
73+
}
74+
private:
75+
const std::locale* m_Loc;
76+
};
77+
78+
#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
79+
#pragma warning(pop)
80+
#endif
81+
82+
// algorithm implementation -------------------------------------------------------------------------
83+
84+
// Transform a range
85+
template<typename OutputIteratorT, typename RangeT, typename FunctorT>
86+
OutputIteratorT transform_range_copy(
87+
OutputIteratorT Output,
88+
const RangeT& Input,
89+
FunctorT Functor)
90+
{
91+
return std::transform(
92+
::boost::begin(Input),
93+
::boost::end(Input),
94+
Output,
95+
Functor);
96+
}
97+
98+
// Transform a range (in-place)
99+
template<typename RangeT, typename FunctorT>
100+
void transform_range(
101+
const RangeT& Input,
102+
FunctorT Functor)
103+
{
104+
std::transform(
105+
::boost::begin(Input),
106+
::boost::end(Input),
107+
::boost::begin(Input),
108+
Functor);
109+
}
110+
111+
template<typename SequenceT, typename RangeT, typename FunctorT>
112+
inline SequenceT transform_range_copy(
113+
const RangeT& Input,
114+
FunctorT Functor)
115+
{
116+
return SequenceT(
117+
::boost::make_transform_iterator(
118+
::boost::begin(Input),
119+
Functor),
120+
::boost::make_transform_iterator(
121+
::boost::end(Input),
122+
Functor));
123+
}
124+
125+
} // namespace detail
126+
} // namespace algorithm
127+
} // namespace boost
128+
129+
130+
#endif // BOOST_STRING_CASE_CONV_DETAIL_HPP

0 commit comments

Comments
 (0)