mirror of
https://github.com/boostorg/algorithm.git
synced 2025-06-26 04:21:58 +02:00
Compare commits
32 Commits
boost-1.32
...
boost-1.33
Author | SHA1 | Date | |
---|---|---|---|
915efd8afd | |||
5af41051f0 | |||
6c5f2a8d33 | |||
924368a775 | |||
344225bce1 | |||
a4137bbae6 | |||
04a40de48d | |||
5ecf446070 | |||
e909726c60 | |||
9878f92a41 | |||
d72eec3093 | |||
bc09128c6e | |||
0f707ed9c9 | |||
77307c2823 | |||
e00fd7f159 | |||
5419d39b2e | |||
7ad6c08c68 | |||
b6c5c86d9c | |||
0f4aa23e9c | |||
b0a2a9d3e0 | |||
8fc117aa7e | |||
0f827f89cf | |||
2074344846 | |||
3b889db8d1 | |||
1489b70457 | |||
c475f8559d | |||
d3d4ffe0e6 | |||
2b5de80031 | |||
aea6f39c11 | |||
54092d7934 | |||
747597c7ef | |||
72b4390091 |
@ -15,7 +15,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <boost/algorithm/string/std_containers_traits.hpp>
|
#include <boost/algorithm/string/std_containers_traits.hpp>
|
||||||
#include <boost/algorithm/string/iterator_range.hpp>
|
|
||||||
#include <boost/algorithm/string/trim.hpp>
|
#include <boost/algorithm/string/trim.hpp>
|
||||||
#include <boost/algorithm/string/case_conv.hpp>
|
#include <boost/algorithm/string/case_conv.hpp>
|
||||||
#include <boost/algorithm/string/predicate.hpp>
|
#include <boost/algorithm/string/predicate.hpp>
|
||||||
|
@ -14,7 +14,11 @@
|
|||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <locale>
|
#include <locale>
|
||||||
#include <boost/iterator/transform_iterator.hpp>
|
#include <boost/iterator/transform_iterator.hpp>
|
||||||
#include <boost/algorithm/string/collection_traits.hpp>
|
|
||||||
|
#include <boost/range/begin.hpp>
|
||||||
|
#include <boost/range/end.hpp>
|
||||||
|
#include <boost/range/value_type.hpp>
|
||||||
|
|
||||||
#include <boost/algorithm/string/detail/case_conv.hpp>
|
#include <boost/algorithm/string/detail/case_conv.hpp>
|
||||||
|
|
||||||
/*! \file
|
/*! \file
|
||||||
@ -35,7 +39,7 @@ namespace boost {
|
|||||||
It is returned as a sequence or copied to the output iterator.
|
It is returned as a sequence or copied to the output iterator.
|
||||||
|
|
||||||
\param Output An output iterator to which the result will be copied
|
\param Output An output iterator to which the result will be copied
|
||||||
\param Input An input collection
|
\param Input An input range
|
||||||
\param Loc A locale used for conversion
|
\param Loc A locale used for conversion
|
||||||
\return
|
\return
|
||||||
An output iterator pointing just after the last inserted character or
|
An output iterator pointing just after the last inserted character or
|
||||||
@ -44,19 +48,19 @@ namespace boost {
|
|||||||
\note The second variant of this function provides the strong exception-safety guarantee
|
\note The second variant of this function provides the strong exception-safety guarantee
|
||||||
|
|
||||||
*/
|
*/
|
||||||
template<typename OutputIteratorT, typename CollectionT>
|
template<typename OutputIteratorT, typename RangeT>
|
||||||
inline OutputIteratorT
|
inline OutputIteratorT
|
||||||
to_lower_copy(
|
to_lower_copy(
|
||||||
OutputIteratorT Output,
|
OutputIteratorT Output,
|
||||||
const CollectionT& Input,
|
const RangeT& Input,
|
||||||
const std::locale& Loc=std::locale())
|
const std::locale& Loc=std::locale())
|
||||||
{
|
{
|
||||||
return std::transform(
|
return std::transform(
|
||||||
begin(Input),
|
begin(Input),
|
||||||
end(Input),
|
end(Input),
|
||||||
Output,
|
Output,
|
||||||
detail::to_lowerF<
|
::boost::algorithm::detail::to_lowerF<
|
||||||
typename value_type_of<CollectionT>::type >(Loc));
|
typename range_value<RangeT>::type >(Loc));
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Convert to lower case
|
//! Convert to lower case
|
||||||
@ -71,12 +75,12 @@ namespace boost {
|
|||||||
return SequenceT(
|
return SequenceT(
|
||||||
make_transform_iterator(
|
make_transform_iterator(
|
||||||
begin(Input),
|
begin(Input),
|
||||||
detail::to_lowerF<
|
::boost::algorithm::detail::to_lowerF<
|
||||||
typename value_type_of<SequenceT>::type >(Loc)),
|
typename range_value<SequenceT>::type >(Loc)),
|
||||||
make_transform_iterator(
|
make_transform_iterator(
|
||||||
end(Input),
|
end(Input),
|
||||||
detail::to_lowerF<
|
::boost::algorithm::detail::to_lowerF<
|
||||||
typename value_type_of<SequenceT>::type >(Loc)));
|
typename range_value<SequenceT>::type >(Loc)));
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Convert to lower case
|
//! Convert to lower case
|
||||||
@ -84,20 +88,20 @@ namespace boost {
|
|||||||
Each element of the input sequence is converted to lower
|
Each element of the input sequence is converted to lower
|
||||||
case. The input sequence is modified in-place.
|
case. The input sequence is modified in-place.
|
||||||
|
|
||||||
\param Input A collection
|
\param Input A range
|
||||||
\param Loc a locale used for conversion
|
\param Loc a locale used for conversion
|
||||||
*/
|
*/
|
||||||
template<typename MutableCollectionT>
|
template<typename WritableRangeT>
|
||||||
inline void to_lower(
|
inline void to_lower(
|
||||||
MutableCollectionT& Input,
|
WritableRangeT& Input,
|
||||||
const std::locale& Loc=std::locale())
|
const std::locale& Loc=std::locale())
|
||||||
{
|
{
|
||||||
std::transform(
|
std::transform(
|
||||||
begin(Input),
|
begin(Input),
|
||||||
end(Input),
|
end(Input),
|
||||||
begin(Input),
|
begin(Input),
|
||||||
detail::to_lowerF<
|
::boost::algorithm::detail::to_lowerF<
|
||||||
typename value_type_of<MutableCollectionT>::type >(Loc));
|
typename range_value<WritableRangeT>::type >(Loc));
|
||||||
}
|
}
|
||||||
|
|
||||||
// to_upper -----------------------------------------------//
|
// to_upper -----------------------------------------------//
|
||||||
@ -109,7 +113,7 @@ namespace boost {
|
|||||||
It is returned as a sequence or copied to the output iterator
|
It is returned as a sequence or copied to the output iterator
|
||||||
|
|
||||||
\param Output An output iterator to which the result will be copied
|
\param Output An output iterator to which the result will be copied
|
||||||
\param Input An input collection
|
\param Input An input range
|
||||||
\param Loc A locale used for conversion
|
\param Loc A locale used for conversion
|
||||||
\return
|
\return
|
||||||
An output iterator pointing just after the last inserted character or
|
An output iterator pointing just after the last inserted character or
|
||||||
@ -117,19 +121,19 @@ namespace boost {
|
|||||||
|
|
||||||
\note The second variant of this function provides the strong exception-safety guarantee
|
\note The second variant of this function provides the strong exception-safety guarantee
|
||||||
*/
|
*/
|
||||||
template<typename OutputIteratorT, typename CollectionT>
|
template<typename OutputIteratorT, typename RangeT>
|
||||||
inline OutputIteratorT
|
inline OutputIteratorT
|
||||||
to_upper_copy(
|
to_upper_copy(
|
||||||
OutputIteratorT Output,
|
OutputIteratorT Output,
|
||||||
const CollectionT& Input,
|
const RangeT& Input,
|
||||||
const std::locale& Loc=std::locale())
|
const std::locale& Loc=std::locale())
|
||||||
{
|
{
|
||||||
return std::transform(
|
return std::transform(
|
||||||
begin(Input),
|
begin(Input),
|
||||||
end(Input),
|
end(Input),
|
||||||
Output,
|
Output,
|
||||||
detail::to_upperF<
|
::boost::algorithm::detail::to_upperF<
|
||||||
typename value_type_of<CollectionT>::type >(Loc));
|
typename range_value<RangeT>::type >(Loc));
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Convert to upper case
|
//! Convert to upper case
|
||||||
@ -144,12 +148,12 @@ namespace boost {
|
|||||||
return SequenceT(
|
return SequenceT(
|
||||||
make_transform_iterator(
|
make_transform_iterator(
|
||||||
begin(Input),
|
begin(Input),
|
||||||
detail::to_upperF<
|
::boost::algorithm::detail::to_upperF<
|
||||||
typename value_type_of<SequenceT>::type >(Loc)),
|
typename range_value<SequenceT>::type >(Loc)),
|
||||||
make_transform_iterator(
|
make_transform_iterator(
|
||||||
end(Input),
|
end(Input),
|
||||||
detail::to_upperF<
|
::boost::algorithm::detail::to_upperF<
|
||||||
typename value_type_of<SequenceT>::type >(Loc)));
|
typename range_value<SequenceT>::type >(Loc)));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -158,20 +162,20 @@ namespace boost {
|
|||||||
Each element of the input sequence is converted to upper
|
Each element of the input sequence is converted to upper
|
||||||
case. The input sequence is modified in-place.
|
case. The input sequence is modified in-place.
|
||||||
|
|
||||||
\param Input An input collection
|
\param Input An input range
|
||||||
\param Loc a locale used for conversion
|
\param Loc a locale used for conversion
|
||||||
*/
|
*/
|
||||||
template<typename MutableCollectionT>
|
template<typename WritableRangeT>
|
||||||
inline void to_upper(
|
inline void to_upper(
|
||||||
MutableCollectionT& Input,
|
WritableRangeT& Input,
|
||||||
const std::locale& Loc=std::locale())
|
const std::locale& Loc=std::locale())
|
||||||
{
|
{
|
||||||
std::transform(
|
std::transform(
|
||||||
begin(Input),
|
begin(Input),
|
||||||
end(Input),
|
end(Input),
|
||||||
begin(Input),
|
begin(Input),
|
||||||
detail::to_upperF<
|
::boost::algorithm::detail::to_upperF<
|
||||||
typename value_type_of<MutableCollectionT>::type >(Loc));
|
typename range_value<WritableRangeT>::type >(Loc));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace algorithm
|
} // namespace algorithm
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <locale>
|
#include <locale>
|
||||||
|
#include <boost/range/value_type.hpp>
|
||||||
#include <boost/algorithm/string/detail/classification.hpp>
|
#include <boost/algorithm/string/detail/classification.hpp>
|
||||||
#include <boost/algorithm/string/predicate_facade.hpp>
|
#include <boost/algorithm/string/predicate_facade.hpp>
|
||||||
|
|
||||||
@ -193,13 +194,13 @@ namespace boost {
|
|||||||
\param Set A set of characters to be recognized
|
\param Set A set of characters to be recognized
|
||||||
\return An instance of the \c is_any_of predicate
|
\return An instance of the \c is_any_of predicate
|
||||||
*/
|
*/
|
||||||
template<typename ContainerT>
|
template<typename RangeT>
|
||||||
inline detail::is_any_ofF<
|
inline detail::is_any_ofF<
|
||||||
BOOST_STRING_TYPENAME value_type_of<ContainerT>::type>
|
BOOST_STRING_TYPENAME range_value<RangeT>::type>
|
||||||
is_any_of( const ContainerT& Set )
|
is_any_of( const RangeT& Set )
|
||||||
{
|
{
|
||||||
return detail::is_any_ofF<
|
return detail::is_any_ofF<
|
||||||
BOOST_STRING_TYPENAME value_type_of<ContainerT>::type>(Set);
|
BOOST_STRING_TYPENAME range_value<RangeT>::type>(Set);
|
||||||
}
|
}
|
||||||
|
|
||||||
//! is_from_range predicate
|
//! is_from_range predicate
|
||||||
|
@ -1,266 +0,0 @@
|
|||||||
// Boost string_algo library collection_traits.hpp header file -------------//
|
|
||||||
|
|
||||||
// Copyright Pavol Droba 2002-2003. Use, modification and
|
|
||||||
// distribution is subject to the Boost Software License, Version
|
|
||||||
// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
|
||||||
// http://www.boost.org/LICENSE_1_0.txt)
|
|
||||||
|
|
||||||
// (C) Copyright Thorsten Ottosen 2002-2003. Use, modification and
|
|
||||||
// distribution is subject to the Boost Software License, Version
|
|
||||||
// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
|
||||||
// http://www.boost.org/LICENSE_1_0.txt)
|
|
||||||
|
|
||||||
// (C) Copyright Jeremy Siek 2001. Use, modification and
|
|
||||||
// distribution is subject to the Boost Software License, Version
|
|
||||||
// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
|
||||||
// http://www.boost.org/LICENSE_1_0.txt)
|
|
||||||
|
|
||||||
// Original idea of container traits was proposed by Jeremy Siek and
|
|
||||||
// Thorsten Ottosen. This implementation is lightweighted version
|
|
||||||
// of container_traits adapter for usage with string_algo library
|
|
||||||
|
|
||||||
#ifndef BOOST_STRING_COLLECTION_TRAITS_HPP
|
|
||||||
#define BOOST_STRING_COLLECTION_TRAITS_HPP
|
|
||||||
|
|
||||||
#include <boost/algorithm/string/config.hpp>
|
|
||||||
#include <boost/type_traits/is_array.hpp>
|
|
||||||
#include <boost/type_traits/is_pointer.hpp>
|
|
||||||
#include <boost/mpl/eval_if.hpp>
|
|
||||||
|
|
||||||
// Implementation
|
|
||||||
#include <boost/algorithm/string/detail/collection_traits.hpp>
|
|
||||||
|
|
||||||
/*! \file
|
|
||||||
Defines collection_traits class and related free-standing functions.
|
|
||||||
This facility is used to unify the access to different types of collections.
|
|
||||||
It allows the algorithms in the library to work with STL collections, c-style
|
|
||||||
array, null-terminated c-strings (and more) using the same interface.
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace boost {
|
|
||||||
namespace algorithm {
|
|
||||||
|
|
||||||
// collection_traits template class -----------------------------------------//
|
|
||||||
|
|
||||||
//! collection_traits class
|
|
||||||
/*!
|
|
||||||
Collection traits provide uniform access to different types of
|
|
||||||
collections. This functionality allows to write generic algorithms
|
|
||||||
which work with several different kinds of collections.
|
|
||||||
|
|
||||||
Currently following collection types are supported:
|
|
||||||
- containers with STL compatible container interface ( see ContainerConcept )
|
|
||||||
( i.e. \c std::vector<>, \c std::list<>, \c std::string<> ... )
|
|
||||||
- c-style array
|
|
||||||
( \c char[10], \c int[15] ... )
|
|
||||||
- null-terminated c-strings
|
|
||||||
( \c char*, \c wchar_T* )
|
|
||||||
- std::pair of iterators
|
|
||||||
( i.e \c std::pair<vector<int>::iterator,vector<int>::iterator> )
|
|
||||||
|
|
||||||
Collection traits provide an external collection interface operations.
|
|
||||||
All are accessible using free-standing functions.
|
|
||||||
|
|
||||||
The following operations are supported:
|
|
||||||
- \c size()
|
|
||||||
- \c empty()
|
|
||||||
- \c begin()
|
|
||||||
- \c end()
|
|
||||||
|
|
||||||
Container traits have somewhat limited functionality on compilers not
|
|
||||||
supporting partial template specialization and partial template ordering.
|
|
||||||
*/
|
|
||||||
template< typename T >
|
|
||||||
struct collection_traits
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
typedef BOOST_STRING_TYPENAME ::boost::mpl::eval_if<
|
|
||||||
::boost::algorithm::detail::is_pair<T>,
|
|
||||||
detail::pair_container_traits_selector<T>,
|
|
||||||
BOOST_STRING_TYPENAME ::boost::mpl::eval_if<
|
|
||||||
::boost::is_array<T>,
|
|
||||||
detail::array_container_traits_selector<T>,
|
|
||||||
BOOST_STRING_TYPENAME ::boost::mpl::eval_if<
|
|
||||||
::boost::is_pointer<T>,
|
|
||||||
detail::pointer_container_traits_selector<T>,
|
|
||||||
detail::default_container_traits_selector<T>
|
|
||||||
>
|
|
||||||
>
|
|
||||||
>::type container_helper_type;
|
|
||||||
public:
|
|
||||||
//! Function type
|
|
||||||
typedef container_helper_type function_type;
|
|
||||||
//! Value type
|
|
||||||
typedef BOOST_STRING_TYPENAME
|
|
||||||
container_helper_type::value_type value_type;
|
|
||||||
//! Size type
|
|
||||||
typedef BOOST_STRING_TYPENAME
|
|
||||||
container_helper_type::size_type size_type;
|
|
||||||
//! Iterator type
|
|
||||||
typedef BOOST_STRING_TYPENAME
|
|
||||||
container_helper_type::iterator iterator;
|
|
||||||
//! Const iterator type
|
|
||||||
typedef BOOST_STRING_TYPENAME
|
|
||||||
container_helper_type::const_iterator const_iterator;
|
|
||||||
//! Result iterator type ( iterator of const_iterator, depending on the constness of the container )
|
|
||||||
typedef BOOST_STRING_TYPENAME
|
|
||||||
container_helper_type::result_iterator result_iterator;
|
|
||||||
//! Difference type
|
|
||||||
typedef BOOST_STRING_TYPENAME
|
|
||||||
container_helper_type::difference_type difference_type;
|
|
||||||
|
|
||||||
}; // 'collection_traits'
|
|
||||||
|
|
||||||
// collection_traits metafunctions -----------------------------------------//
|
|
||||||
|
|
||||||
//! Container value_type trait
|
|
||||||
/*!
|
|
||||||
Extract the type of elements contained in a container
|
|
||||||
*/
|
|
||||||
template< typename C >
|
|
||||||
struct value_type_of
|
|
||||||
{
|
|
||||||
typedef BOOST_STRING_TYPENAME collection_traits<C>::value_type type;
|
|
||||||
};
|
|
||||||
|
|
||||||
//! Container difference trait
|
|
||||||
/*!
|
|
||||||
Extract the container's difference type
|
|
||||||
*/
|
|
||||||
template< typename C >
|
|
||||||
struct difference_type_of
|
|
||||||
{
|
|
||||||
typedef BOOST_STRING_TYPENAME collection_traits<C>::difference_type type;
|
|
||||||
};
|
|
||||||
|
|
||||||
//! Container iterator trait
|
|
||||||
/*!
|
|
||||||
Extract the container's iterator type
|
|
||||||
*/
|
|
||||||
template< typename C >
|
|
||||||
struct iterator_of
|
|
||||||
{
|
|
||||||
typedef BOOST_STRING_TYPENAME collection_traits<C>::iterator type;
|
|
||||||
};
|
|
||||||
|
|
||||||
//! Container const_iterator trait
|
|
||||||
/*!
|
|
||||||
Extract the container's const_iterator type
|
|
||||||
*/
|
|
||||||
template< typename C >
|
|
||||||
struct const_iterator_of
|
|
||||||
{
|
|
||||||
typedef BOOST_STRING_TYPENAME collection_traits<C>::const_iterator type;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
//! Container result_iterator
|
|
||||||
/*!
|
|
||||||
Extract the container's result_iterator type. This type maps to \c C::iterator
|
|
||||||
for mutable container and \c C::const_iterator for const containers.
|
|
||||||
*/
|
|
||||||
template< typename C >
|
|
||||||
struct result_iterator_of
|
|
||||||
{
|
|
||||||
typedef BOOST_STRING_TYPENAME collection_traits<C>::result_iterator type;
|
|
||||||
};
|
|
||||||
|
|
||||||
// collection_traits related functions -----------------------------------------//
|
|
||||||
|
|
||||||
//! Free-standing size() function
|
|
||||||
/*!
|
|
||||||
Get the size of the container. Uses collection_traits.
|
|
||||||
*/
|
|
||||||
template< typename C >
|
|
||||||
inline BOOST_STRING_TYPENAME collection_traits<C>::size_type
|
|
||||||
size( const C& c )
|
|
||||||
{
|
|
||||||
return collection_traits<C>::function_type::size( c );
|
|
||||||
}
|
|
||||||
|
|
||||||
//! Free-standing empty() function
|
|
||||||
/*!
|
|
||||||
Check whether the container is empty. Uses container traits.
|
|
||||||
*/
|
|
||||||
template< typename C >
|
|
||||||
inline bool empty( const C& c )
|
|
||||||
{
|
|
||||||
return collection_traits<C>::function_type::empty( c );
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
|
|
||||||
|
|
||||||
//! Free-standing begin() function
|
|
||||||
/*!
|
|
||||||
Get the begin iterator of the container. Uses collection_traits.
|
|
||||||
*/
|
|
||||||
template< typename C >
|
|
||||||
inline BOOST_STRING_TYPENAME collection_traits<C>::iterator
|
|
||||||
begin( C& c )
|
|
||||||
{
|
|
||||||
return collection_traits<C>::function_type::begin( c );
|
|
||||||
}
|
|
||||||
|
|
||||||
//! Free-standing begin() function
|
|
||||||
/*!
|
|
||||||
\overload
|
|
||||||
*/
|
|
||||||
template< typename C >
|
|
||||||
inline BOOST_STRING_TYPENAME collection_traits<C>::const_iterator
|
|
||||||
begin( const C& c )
|
|
||||||
{
|
|
||||||
return collection_traits<C>::function_type::begin( c );
|
|
||||||
}
|
|
||||||
|
|
||||||
//! Free-standing end() function
|
|
||||||
/*!
|
|
||||||
Get the begin iterator of the container. Uses collection_traits.
|
|
||||||
*/
|
|
||||||
template< typename C >
|
|
||||||
inline BOOST_STRING_TYPENAME collection_traits<C>::iterator
|
|
||||||
end( C& c )
|
|
||||||
{
|
|
||||||
return collection_traits<C>::function_type::end( c );
|
|
||||||
}
|
|
||||||
|
|
||||||
//! Free-standing end() function
|
|
||||||
/*!
|
|
||||||
\overload
|
|
||||||
*/
|
|
||||||
template< typename C >
|
|
||||||
inline BOOST_STRING_TYPENAME collection_traits<C>::const_iterator
|
|
||||||
end( const C& c )
|
|
||||||
{
|
|
||||||
return collection_traits<C>::function_type::end( c );
|
|
||||||
}
|
|
||||||
|
|
||||||
#else // BOOST_NO_FUNCTION_TEMPLATE_ORDERING
|
|
||||||
|
|
||||||
//! Free-standing begin() function
|
|
||||||
/*!
|
|
||||||
\overload
|
|
||||||
*/
|
|
||||||
template< typename C >
|
|
||||||
inline BOOST_STRING_TYPENAME collection_traits<C>::result_iterator
|
|
||||||
begin( C& c )
|
|
||||||
{
|
|
||||||
return collection_traits<C>::function_type::begin( c );
|
|
||||||
}
|
|
||||||
|
|
||||||
//! Free-standing end() function
|
|
||||||
/*!
|
|
||||||
\overload
|
|
||||||
*/
|
|
||||||
template< typename C >
|
|
||||||
inline BOOST_STRING_TYPENAME collection_traits<C>::result_iterator
|
|
||||||
end( C& c )
|
|
||||||
{
|
|
||||||
return collection_traits<C>::function_type::end( c );
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // BOOST_NO_FUNCTION_TEMPLATE_ORDERING
|
|
||||||
|
|
||||||
} // namespace algorithm
|
|
||||||
} // namespace boost
|
|
||||||
|
|
||||||
#endif // BOOST_STRING_COLLECTION_TRAITS_HPP
|
|
@ -64,7 +64,11 @@ namespace boost {
|
|||||||
template< typename T1, typename T2 >
|
template< typename T1, typename T2 >
|
||||||
bool operator ()( const T1& Arg1, const T2& Arg2 ) const
|
bool operator ()( const T1& Arg1, const T2& Arg2 ) const
|
||||||
{
|
{
|
||||||
|
#if defined(__BORLANDC__) && (__BORLANDC__ >= 0x560) && (__BORLANDC__ <= 0x564) && !defined(_USE_OLD_RW_STL)
|
||||||
|
return std::toupper(Arg1)==std::toupper(Arg2);
|
||||||
|
#else
|
||||||
return std::toupper(Arg1,m_Loc)==std::toupper(Arg2,m_Loc);
|
return std::toupper(Arg1,m_Loc)==std::toupper(Arg2,m_Loc);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -11,8 +11,9 @@
|
|||||||
#define BOOST_STRING_CONCEPT_HPP
|
#define BOOST_STRING_CONCEPT_HPP
|
||||||
|
|
||||||
#include <boost/concept_check.hpp>
|
#include <boost/concept_check.hpp>
|
||||||
#include <boost/algorithm/string/iterator_range.hpp>
|
#include <boost/range/iterator_range.hpp>
|
||||||
#include <boost/algorithm/string/collection_traits.hpp>
|
#include <boost/range/begin.hpp>
|
||||||
|
#include <boost/range/end.hpp>
|
||||||
|
|
||||||
/*! \file
|
/*! \file
|
||||||
Defines concepts used in string_algo library
|
Defines concepts used in string_algo library
|
||||||
|
@ -17,11 +17,7 @@
|
|||||||
# error "macro already defined!"
|
# error "macro already defined!"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __BORLANDC__
|
|
||||||
#define BOOST_STRING_TYPENAME
|
|
||||||
#else
|
|
||||||
#define BOOST_STRING_TYPENAME BOOST_DEDUCED_TYPENAME
|
#define BOOST_STRING_TYPENAME BOOST_DEDUCED_TYPENAME
|
||||||
#endif
|
|
||||||
|
|
||||||
// Metrowerks workaround
|
// Metrowerks workaround
|
||||||
#if BOOST_WORKAROUND(__MWERKS__, <= 0x3003) // 8.x
|
#if BOOST_WORKAROUND(__MWERKS__, <= 0x3003) // 8.x
|
||||||
|
@ -30,7 +30,11 @@ namespace boost {
|
|||||||
// Operation
|
// Operation
|
||||||
CharT operator ()( CharT Ch ) const
|
CharT operator ()( CharT Ch ) const
|
||||||
{
|
{
|
||||||
|
#if defined(__BORLANDC__) && (__BORLANDC__ >= 0x560) && (__BORLANDC__ <= 0x564) && !defined(_USE_OLD_RW_STL)
|
||||||
|
return std::tolower( Ch);
|
||||||
|
#else
|
||||||
return std::tolower( Ch, m_Loc );
|
return std::tolower( Ch, m_Loc );
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
const std::locale& m_Loc;
|
const std::locale& m_Loc;
|
||||||
@ -46,7 +50,11 @@ namespace boost {
|
|||||||
// Operation
|
// Operation
|
||||||
CharT operator ()( CharT Ch ) const
|
CharT operator ()( CharT Ch ) const
|
||||||
{
|
{
|
||||||
|
#if defined(__BORLANDC__) && (__BORLANDC__ >= 0x560) && (__BORLANDC__ <= 0x564) && !defined(_USE_OLD_RW_STL)
|
||||||
|
return std::toupper( Ch);
|
||||||
|
#else
|
||||||
return std::toupper( Ch, m_Loc );
|
return std::toupper( Ch, m_Loc );
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
const std::locale& m_Loc;
|
const std::locale& m_Loc;
|
||||||
|
@ -15,7 +15,10 @@
|
|||||||
#include <functional>
|
#include <functional>
|
||||||
#include <locale>
|
#include <locale>
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <boost/algorithm/string/collection_traits.hpp>
|
|
||||||
|
#include <boost/range/begin.hpp>
|
||||||
|
#include <boost/range/end.hpp>
|
||||||
|
|
||||||
#include <boost/algorithm/string/predicate_facade.hpp>
|
#include <boost/algorithm/string/predicate_facade.hpp>
|
||||||
#include <boost/type_traits/remove_const.hpp>
|
#include <boost/type_traits/remove_const.hpp>
|
||||||
|
|
||||||
@ -43,6 +46,14 @@ namespace boost {
|
|||||||
return std::use_facet< std::ctype<CharT> >(m_Locale).is( m_Type, Ch );
|
return std::use_facet< std::ctype<CharT> >(m_Locale).is( m_Type, Ch );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(__BORLANDC__) && (__BORLANDC__ >= 0x560) && (__BORLANDC__ <= 0x564) && !defined(_USE_OLD_RW_STL)
|
||||||
|
template<>
|
||||||
|
bool operator()( char const Ch ) const
|
||||||
|
{
|
||||||
|
return std::use_facet< std::ctype<char> >(m_Locale).is( m_Type, Ch );
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const std::ctype_base::mask m_Type;
|
const std::ctype_base::mask m_Type;
|
||||||
const std::locale m_Locale;
|
const std::locale m_Locale;
|
||||||
@ -60,9 +71,9 @@ namespace boost {
|
|||||||
template <class Args> struct sig { typedef bool type; };
|
template <class Args> struct sig { typedef bool type; };
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
template< typename SeqT >
|
template<typename RangeT>
|
||||||
is_any_ofF( const SeqT& Seq ) :
|
is_any_ofF( const RangeT& Range ) :
|
||||||
m_Set( begin(Seq), end(Seq) ) {}
|
m_Set( begin(Range), end(Range) ) {}
|
||||||
|
|
||||||
// Operation
|
// Operation
|
||||||
template<typename Char2T>
|
template<typename Char2T>
|
||||||
|
@ -1,621 +0,0 @@
|
|||||||
// Boost string_algo library collection_traits.hpp header file -----------------------//
|
|
||||||
|
|
||||||
// Copyright Pavol Droba 2002-2003. Use, modification and
|
|
||||||
// distribution is subject to the Boost Software License, Version
|
|
||||||
// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
|
||||||
// http://www.boost.org/LICENSE_1_0.txt)
|
|
||||||
|
|
||||||
// See http://www.boost.org for updates, documentation, and revision history.
|
|
||||||
|
|
||||||
#ifndef BOOST_STRING_DETAIL_COLLECTION_TRAITS_HPP
|
|
||||||
#define BOOST_STRING_DETAIL_COLLECTION_TRAITS_HPP
|
|
||||||
|
|
||||||
#include <boost/algorithm/string/config.hpp>
|
|
||||||
#include <cstddef>
|
|
||||||
#include <string>
|
|
||||||
#include <boost/type_traits/is_array.hpp>
|
|
||||||
#include <boost/type_traits/is_pointer.hpp>
|
|
||||||
#include <boost/type_traits/is_const.hpp>
|
|
||||||
#include <boost/type_traits/is_convertible.hpp>
|
|
||||||
#include <boost/type_traits/remove_pointer.hpp>
|
|
||||||
#include <boost/type_traits/remove_cv.hpp>
|
|
||||||
#include <boost/mpl/eval_if.hpp>
|
|
||||||
#include <boost/mpl/identity.hpp>
|
|
||||||
#include <boost/mpl/vector.hpp>
|
|
||||||
#include <boost/mpl/fold.hpp>
|
|
||||||
#include <boost/detail/iterator.hpp>
|
|
||||||
#include <boost/algorithm/string/yes_no_type.hpp>
|
|
||||||
|
|
||||||
// Container traits implementation ---------------------------------------------------------
|
|
||||||
|
|
||||||
namespace boost {
|
|
||||||
namespace algorithm {
|
|
||||||
namespace detail {
|
|
||||||
|
|
||||||
// Default collection traits -----------------------------------------------------------------
|
|
||||||
|
|
||||||
// Default collection helper
|
|
||||||
/*
|
|
||||||
Wraps std::container compliant containers
|
|
||||||
*/
|
|
||||||
template< typename ContainerT >
|
|
||||||
struct default_container_traits
|
|
||||||
{
|
|
||||||
typedef BOOST_STRING_TYPENAME ContainerT::value_type value_type;
|
|
||||||
typedef BOOST_STRING_TYPENAME ContainerT::iterator iterator;
|
|
||||||
typedef BOOST_STRING_TYPENAME ContainerT::const_iterator const_iterator;
|
|
||||||
typedef BOOST_STRING_TYPENAME
|
|
||||||
::boost::mpl::if_< ::boost::is_const<ContainerT>,
|
|
||||||
const_iterator,
|
|
||||||
iterator
|
|
||||||
>::type result_iterator;
|
|
||||||
typedef BOOST_STRING_TYPENAME ContainerT::difference_type difference_type;
|
|
||||||
typedef BOOST_STRING_TYPENAME ContainerT::size_type size_type;
|
|
||||||
|
|
||||||
// static operations
|
|
||||||
template< typename C >
|
|
||||||
static size_type size( const C& c )
|
|
||||||
{
|
|
||||||
return c.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
template< typename C >
|
|
||||||
static bool empty( const C& c )
|
|
||||||
{
|
|
||||||
return c.empty();
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
|
|
||||||
|
|
||||||
template< typename C >
|
|
||||||
static iterator begin( C& c )
|
|
||||||
{
|
|
||||||
return c.begin();
|
|
||||||
}
|
|
||||||
|
|
||||||
template< typename C >
|
|
||||||
static const_iterator begin( const C& c )
|
|
||||||
{
|
|
||||||
return c.begin();
|
|
||||||
}
|
|
||||||
|
|
||||||
template< typename C >
|
|
||||||
static iterator end( C& c )
|
|
||||||
{
|
|
||||||
return c.end();
|
|
||||||
}
|
|
||||||
|
|
||||||
template< typename C >
|
|
||||||
static const_iterator end( const C& c )
|
|
||||||
{
|
|
||||||
return c.end();
|
|
||||||
}
|
|
||||||
|
|
||||||
#else // BOOST_NO_FUNCTION_TEMPLATE_ORDERING
|
|
||||||
|
|
||||||
template< typename C >
|
|
||||||
static result_iterator begin( C& c )
|
|
||||||
{
|
|
||||||
return c.begin();
|
|
||||||
}
|
|
||||||
|
|
||||||
template< typename C >
|
|
||||||
static result_iterator end( C& c )
|
|
||||||
{
|
|
||||||
return c.end();
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // BOOST_NO_FUNCTION_TEMPLATE_ORDERING
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
struct default_container_traits_selector
|
|
||||||
{
|
|
||||||
typedef default_container_traits<T> type;
|
|
||||||
};
|
|
||||||
|
|
||||||
// Pair container traits ---------------------------------------------------------------------
|
|
||||||
|
|
||||||
// pair selector
|
|
||||||
template< typename T, typename U >
|
|
||||||
yes_type is_pair_impl( const std::pair<T,U>* );
|
|
||||||
no_type is_pair_impl( ... );
|
|
||||||
|
|
||||||
template<typename T> struct is_pair
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
static T* t;
|
|
||||||
public:
|
|
||||||
BOOST_STATIC_CONSTANT( bool, value=
|
|
||||||
sizeof(is_pair_impl(t))==sizeof(yes_type) );
|
|
||||||
};
|
|
||||||
|
|
||||||
// pair helper
|
|
||||||
template< typename PairT >
|
|
||||||
struct pair_container_traits
|
|
||||||
{
|
|
||||||
typedef BOOST_STRING_TYPENAME PairT::first_type element_type;
|
|
||||||
|
|
||||||
typedef BOOST_STRING_TYPENAME ::boost::detail::
|
|
||||||
iterator_traits<element_type>::value_type value_type;
|
|
||||||
typedef std::size_t size_type;
|
|
||||||
typedef BOOST_STRING_TYPENAME ::boost::detail::
|
|
||||||
iterator_traits<element_type>::difference_type difference_type;
|
|
||||||
|
|
||||||
typedef element_type iterator;
|
|
||||||
typedef element_type const_iterator;
|
|
||||||
typedef element_type result_iterator;
|
|
||||||
|
|
||||||
// static operations
|
|
||||||
template< typename P >
|
|
||||||
static size_type size( const P& p )
|
|
||||||
{
|
|
||||||
difference_type diff = std::distance( p.first, p.second );
|
|
||||||
if ( diff < 0 )
|
|
||||||
return 0;
|
|
||||||
else
|
|
||||||
return diff;
|
|
||||||
}
|
|
||||||
|
|
||||||
template< typename P >
|
|
||||||
static bool empty( const P& p )
|
|
||||||
{
|
|
||||||
return p.first==p.second;
|
|
||||||
}
|
|
||||||
|
|
||||||
template< typename P >
|
|
||||||
static const_iterator begin( const P& p )
|
|
||||||
{
|
|
||||||
return p.first;
|
|
||||||
}
|
|
||||||
|
|
||||||
template< typename P >
|
|
||||||
static const_iterator end( const P& p )
|
|
||||||
{
|
|
||||||
return p.second;
|
|
||||||
}
|
|
||||||
}; // 'pair_container_helper'
|
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
struct pair_container_traits_selector
|
|
||||||
{
|
|
||||||
typedef pair_container_traits<T> type;
|
|
||||||
};
|
|
||||||
|
|
||||||
// Array container traits ---------------------------------------------------------------
|
|
||||||
|
|
||||||
#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
|
||||||
// array traits ( partial specialization )
|
|
||||||
template< typename T >
|
|
||||||
struct array_traits;
|
|
||||||
|
|
||||||
template< typename T, std::size_t sz >
|
|
||||||
struct array_traits<T[sz]>
|
|
||||||
{
|
|
||||||
// typedef
|
|
||||||
typedef T* iterator;
|
|
||||||
typedef const T* const_iterator;
|
|
||||||
typedef T value_type;
|
|
||||||
typedef std::size_t size_type;
|
|
||||||
typedef std::ptrdiff_t difference_type;
|
|
||||||
|
|
||||||
// size of the array ( static );
|
|
||||||
BOOST_STATIC_CONSTANT( size_type, array_size = sz );
|
|
||||||
};
|
|
||||||
|
|
||||||
#else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
|
||||||
|
|
||||||
// array traits ( no partial specialization )
|
|
||||||
/*
|
|
||||||
without parial specialization we are able to
|
|
||||||
provide support only for a limited number of
|
|
||||||
types. Currently the primitive numeric types
|
|
||||||
are supported
|
|
||||||
*/
|
|
||||||
template< typename T, typename BaseT >
|
|
||||||
struct array_traits_impl
|
|
||||||
{
|
|
||||||
typedef BaseT value_type;
|
|
||||||
typedef BaseT* iterator;
|
|
||||||
typedef const BaseT* const_iterator;
|
|
||||||
typedef std::size_t size_type;
|
|
||||||
typedef std::ptrdiff_t difference_type;
|
|
||||||
|
|
||||||
// size of the array
|
|
||||||
BOOST_STATIC_CONSTANT( size_type, array_size = sizeof(T)/sizeof(BaseT) );
|
|
||||||
};
|
|
||||||
|
|
||||||
template< typename T, typename BaseT >
|
|
||||||
struct array_traits_impl_selector
|
|
||||||
{
|
|
||||||
typedef array_traits_impl<T,BaseT> type;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct array_traits_void
|
|
||||||
{
|
|
||||||
typedef void type;
|
|
||||||
};
|
|
||||||
|
|
||||||
template< typename T, typename BaseT >
|
|
||||||
struct array_traits_cv_selector
|
|
||||||
{
|
|
||||||
typedef BOOST_STRING_TYPENAME
|
|
||||||
::boost::mpl::eval_if<
|
|
||||||
::boost::is_convertible<T,BaseT*>,
|
|
||||||
array_traits_impl_selector<T,BaseT>,
|
|
||||||
::boost::mpl::eval_if<
|
|
||||||
::boost::is_convertible<T,const BaseT*>,
|
|
||||||
array_traits_impl_selector<T, const BaseT>,
|
|
||||||
::boost::mpl::eval_if<
|
|
||||||
::boost::is_convertible<T, volatile BaseT*>,
|
|
||||||
array_traits_impl_selector<T, volatile BaseT>,
|
|
||||||
array_traits_impl_selector<T, const volatile BaseT>
|
|
||||||
>
|
|
||||||
>
|
|
||||||
>::type type;
|
|
||||||
};
|
|
||||||
|
|
||||||
template< typename T >
|
|
||||||
struct array_traits_select
|
|
||||||
{
|
|
||||||
template< typename T1, typename T2 >
|
|
||||||
struct apply
|
|
||||||
{
|
|
||||||
typedef BOOST_STRING_TYPENAME
|
|
||||||
::boost::mpl::eval_if<
|
|
||||||
::boost::is_convertible<T,const volatile T2*>,
|
|
||||||
array_traits_cv_selector<T,T2>,
|
|
||||||
::boost::mpl::identity<T1> >::type type;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
template< typename T >
|
|
||||||
struct array_traits_selector
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
// supported array base types
|
|
||||||
#ifndef BOOST_NO_INTRINSIC_WCHAR_T
|
|
||||||
typedef BOOST_STRING_TYPENAME
|
|
||||||
::boost::mpl::vector10<
|
|
||||||
wchar_t,
|
|
||||||
#else // BOOST_NO_INTRINSIC_WCHAR_T
|
|
||||||
typedef BOOST_STRING_TYPENAME
|
|
||||||
::boost::mpl::vector9<
|
|
||||||
#endif // BOOST_NO_INTRINSIC_WCHAR_T
|
|
||||||
char,
|
|
||||||
signed char,
|
|
||||||
unsigned char,
|
|
||||||
signed short,
|
|
||||||
unsigned short,
|
|
||||||
signed int,
|
|
||||||
unsigned int,
|
|
||||||
signed long,
|
|
||||||
unsigned long
|
|
||||||
>::type array_base_types;
|
|
||||||
|
|
||||||
public:
|
|
||||||
typedef BOOST_STRING_TYPENAME
|
|
||||||
::boost::mpl::fold<
|
|
||||||
array_base_types,
|
|
||||||
::boost::algorithm::detail::array_traits_void,
|
|
||||||
::boost::algorithm::detail::array_traits_select<T> >::type type;
|
|
||||||
};
|
|
||||||
|
|
||||||
template< typename T >
|
|
||||||
struct array_traits
|
|
||||||
{
|
|
||||||
typedef BOOST_STRING_TYPENAME
|
|
||||||
array_traits_selector<T>::type traits_type;
|
|
||||||
|
|
||||||
typedef BOOST_STRING_TYPENAME
|
|
||||||
traits_type::value_type value_type;
|
|
||||||
typedef BOOST_STRING_TYPENAME
|
|
||||||
traits_type::iterator iterator;
|
|
||||||
typedef BOOST_STRING_TYPENAME
|
|
||||||
traits_type::const_iterator const_iterator;
|
|
||||||
typedef BOOST_STRING_TYPENAME
|
|
||||||
traits_type::size_type size_type;
|
|
||||||
typedef BOOST_STRING_TYPENAME
|
|
||||||
traits_type::difference_type difference_type;
|
|
||||||
|
|
||||||
BOOST_STATIC_CONSTANT( size_type, array_size = traits_type::array_size );
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
|
||||||
|
|
||||||
// array lenght resolving
|
|
||||||
/*
|
|
||||||
Lenght of string contained in a static array could
|
|
||||||
be different from the size of the array.
|
|
||||||
For string processing we need the lenght without
|
|
||||||
terminating 0.
|
|
||||||
|
|
||||||
Therefore, the lenght is calulated for char and wchar_t
|
|
||||||
using char_traits, rather then simply returning
|
|
||||||
the array size.
|
|
||||||
*/
|
|
||||||
template< typename T >
|
|
||||||
struct array_length_selector
|
|
||||||
{
|
|
||||||
template< typename TraitsT >
|
|
||||||
struct array_length
|
|
||||||
{
|
|
||||||
typedef BOOST_STRING_TYPENAME
|
|
||||||
TraitsT::size_type size_type;
|
|
||||||
|
|
||||||
BOOST_STATIC_CONSTANT(
|
|
||||||
size_type,
|
|
||||||
array_size=TraitsT::array_size );
|
|
||||||
|
|
||||||
template< typename A >
|
|
||||||
static size_type length( const A& )
|
|
||||||
{
|
|
||||||
return array_size;
|
|
||||||
}
|
|
||||||
|
|
||||||
template< typename A >
|
|
||||||
static bool empty( const A& )
|
|
||||||
{
|
|
||||||
return array_size==0;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
// specialization for char
|
|
||||||
template<>
|
|
||||||
struct array_length_selector<char>
|
|
||||||
{
|
|
||||||
template< typename TraitsT >
|
|
||||||
struct array_length
|
|
||||||
{
|
|
||||||
typedef BOOST_STRING_TYPENAME
|
|
||||||
TraitsT::size_type size_type;
|
|
||||||
|
|
||||||
template< typename A >
|
|
||||||
static size_type length( const A& a )
|
|
||||||
{
|
|
||||||
if ( a==0 )
|
|
||||||
return 0;
|
|
||||||
else
|
|
||||||
return std::char_traits<char>::length(a);
|
|
||||||
}
|
|
||||||
|
|
||||||
template< typename A >
|
|
||||||
static bool empty( const A& a )
|
|
||||||
{
|
|
||||||
return a==0 || a[0]==0;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
// specialization for wchar_t
|
|
||||||
template<>
|
|
||||||
struct array_length_selector<wchar_t>
|
|
||||||
{
|
|
||||||
template< typename TraitsT >
|
|
||||||
struct array_length
|
|
||||||
{
|
|
||||||
typedef BOOST_STRING_TYPENAME
|
|
||||||
TraitsT::size_type size_type;
|
|
||||||
|
|
||||||
template< typename A >
|
|
||||||
static size_type length( const A& a )
|
|
||||||
{
|
|
||||||
if ( a==0 )
|
|
||||||
return 0;
|
|
||||||
else
|
|
||||||
return std::char_traits<wchar_t>::length(a);
|
|
||||||
}
|
|
||||||
|
|
||||||
template< typename A >
|
|
||||||
static bool empty( const A& a )
|
|
||||||
{
|
|
||||||
return a==0 || a[0]==0;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
template< typename T >
|
|
||||||
struct array_container_traits
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
// resolve array traits
|
|
||||||
typedef array_traits<T> traits_type;
|
|
||||||
|
|
||||||
public:
|
|
||||||
typedef BOOST_STRING_TYPENAME
|
|
||||||
traits_type::value_type value_type;
|
|
||||||
typedef BOOST_STRING_TYPENAME
|
|
||||||
traits_type::iterator iterator;
|
|
||||||
typedef BOOST_STRING_TYPENAME
|
|
||||||
traits_type::const_iterator const_iterator;
|
|
||||||
typedef BOOST_STRING_TYPENAME
|
|
||||||
traits_type::size_type size_type;
|
|
||||||
typedef BOOST_STRING_TYPENAME
|
|
||||||
traits_type::difference_type difference_type;
|
|
||||||
|
|
||||||
typedef BOOST_STRING_TYPENAME
|
|
||||||
::boost::mpl::if_< ::boost::is_const<T>,
|
|
||||||
const_iterator,
|
|
||||||
iterator
|
|
||||||
>::type result_iterator;
|
|
||||||
|
|
||||||
private:
|
|
||||||
// resolve array size
|
|
||||||
typedef BOOST_STRING_TYPENAME
|
|
||||||
::boost::remove_cv<value_type>::type char_type;
|
|
||||||
typedef BOOST_STRING_TYPENAME
|
|
||||||
array_length_selector<char_type>::
|
|
||||||
BOOST_NESTED_TEMPLATE array_length<traits_type> array_length_type;
|
|
||||||
|
|
||||||
public:
|
|
||||||
BOOST_STATIC_CONSTANT( size_type, array_size = traits_type::array_size );
|
|
||||||
|
|
||||||
// static operations
|
|
||||||
template< typename A >
|
|
||||||
static size_type size( const A& a )
|
|
||||||
{
|
|
||||||
return array_length_type::length(a);
|
|
||||||
}
|
|
||||||
|
|
||||||
template< typename A >
|
|
||||||
static bool empty( const A& a )
|
|
||||||
{
|
|
||||||
return array_length_type::empty(a);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
|
|
||||||
|
|
||||||
template< typename A >
|
|
||||||
static iterator begin( A& a )
|
|
||||||
{
|
|
||||||
return a;
|
|
||||||
}
|
|
||||||
|
|
||||||
template< typename A >
|
|
||||||
static const_iterator begin( const A& a )
|
|
||||||
{
|
|
||||||
return a;
|
|
||||||
}
|
|
||||||
|
|
||||||
template< typename A >
|
|
||||||
static iterator end( A& a )
|
|
||||||
{
|
|
||||||
return a+array_length_type::length(a);
|
|
||||||
}
|
|
||||||
|
|
||||||
template< typename A >
|
|
||||||
static const_iterator end( const A& a )
|
|
||||||
{
|
|
||||||
return a+array_length_type::length(a);
|
|
||||||
}
|
|
||||||
|
|
||||||
#else // BOOST_NO_FUNCTION_TEMPLATE_ORDERING
|
|
||||||
|
|
||||||
template< typename A >
|
|
||||||
static result_iterator begin( A& a )
|
|
||||||
{
|
|
||||||
return a;
|
|
||||||
}
|
|
||||||
|
|
||||||
template< typename A >
|
|
||||||
static result_iterator end( A& a )
|
|
||||||
{
|
|
||||||
return a+array_length_type::length(a);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // BOOST_NO_FUNCTION_TEMPLATE_ORDERING
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
struct array_container_traits_selector
|
|
||||||
{
|
|
||||||
typedef array_container_traits<T> type;
|
|
||||||
};
|
|
||||||
|
|
||||||
// Pointer container traits ---------------------------------------------------------------
|
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
struct pointer_container_traits
|
|
||||||
{
|
|
||||||
typedef BOOST_STRING_TYPENAME
|
|
||||||
::boost::remove_pointer<T>::type value_type;
|
|
||||||
|
|
||||||
typedef BOOST_STRING_TYPENAME
|
|
||||||
::boost::remove_cv<value_type>::type char_type;
|
|
||||||
typedef ::std::char_traits<char_type> char_traits;
|
|
||||||
|
|
||||||
typedef value_type* iterator;
|
|
||||||
typedef const value_type* const_iterator;
|
|
||||||
typedef std::ptrdiff_t difference_type;
|
|
||||||
typedef std::size_t size_type;
|
|
||||||
|
|
||||||
typedef BOOST_STRING_TYPENAME
|
|
||||||
::boost::mpl::if_< ::boost::is_const<T>,
|
|
||||||
const_iterator,
|
|
||||||
iterator
|
|
||||||
>::type result_iterator;
|
|
||||||
|
|
||||||
// static operations
|
|
||||||
template< typename P >
|
|
||||||
static size_type size( const P& p )
|
|
||||||
{
|
|
||||||
if ( p==0 )
|
|
||||||
return 0;
|
|
||||||
else
|
|
||||||
return char_traits::length(p);
|
|
||||||
}
|
|
||||||
|
|
||||||
template< typename P >
|
|
||||||
static bool empty( const P& p )
|
|
||||||
{
|
|
||||||
return p==0 || p[0]==0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
|
|
||||||
|
|
||||||
template< typename P >
|
|
||||||
static iterator begin( P& p )
|
|
||||||
{
|
|
||||||
return p;
|
|
||||||
}
|
|
||||||
|
|
||||||
template< typename P >
|
|
||||||
static const_iterator begin( const P& p )
|
|
||||||
{
|
|
||||||
return p;
|
|
||||||
}
|
|
||||||
|
|
||||||
template< typename P >
|
|
||||||
static iterator end( P& p )
|
|
||||||
{
|
|
||||||
if ( p==0 )
|
|
||||||
return p;
|
|
||||||
else
|
|
||||||
return p+char_traits::length(p);
|
|
||||||
}
|
|
||||||
|
|
||||||
template< typename P >
|
|
||||||
static const_iterator end( const P& p )
|
|
||||||
{
|
|
||||||
if ( p==0 )
|
|
||||||
return p;
|
|
||||||
else
|
|
||||||
return p+char_traits::length(p);
|
|
||||||
}
|
|
||||||
|
|
||||||
#else // BOOST_NO_FUNCTION_TEMPLATE_ORDERING
|
|
||||||
|
|
||||||
template< typename P >
|
|
||||||
static result_iterator begin( P& p )
|
|
||||||
{
|
|
||||||
return p;
|
|
||||||
}
|
|
||||||
|
|
||||||
template< typename P >
|
|
||||||
static result_iterator end( P& p )
|
|
||||||
{
|
|
||||||
if ( p==0 )
|
|
||||||
return p;
|
|
||||||
else
|
|
||||||
return p+char_traits::length(p);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // BOOST_NO_FUNCTION_TEMPLATE_ORDERING
|
|
||||||
};
|
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
struct pointer_container_traits_selector
|
|
||||||
{
|
|
||||||
typedef pointer_container_traits<T> type;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace detail
|
|
||||||
} // namespace algorithm
|
|
||||||
} // namespace boost
|
|
||||||
|
|
||||||
|
|
||||||
#endif // BOOST_STRING_DETAIL_COLLECTION_HPP
|
|
@ -11,7 +11,9 @@
|
|||||||
#define BOOST_STRING_FIND_FORMAT_DETAIL_HPP
|
#define BOOST_STRING_FIND_FORMAT_DETAIL_HPP
|
||||||
|
|
||||||
#include <boost/algorithm/string/config.hpp>
|
#include <boost/algorithm/string/config.hpp>
|
||||||
#include <boost/algorithm/string/iterator_range.hpp>
|
#include <boost/range/iterator_range.hpp>
|
||||||
|
#include <boost/range/const_iterator.hpp>
|
||||||
|
#include <boost/range/iterator.hpp>
|
||||||
#include <boost/algorithm/string/detail/find_format_store.hpp>
|
#include <boost/algorithm/string/detail/find_format_store.hpp>
|
||||||
#include <boost/algorithm/string/detail/replace_storage.hpp>
|
#include <boost/algorithm/string/detail/replace_storage.hpp>
|
||||||
|
|
||||||
@ -60,7 +62,7 @@ namespace boost {
|
|||||||
{
|
{
|
||||||
typedef find_format_store<
|
typedef find_format_store<
|
||||||
BOOST_STRING_TYPENAME
|
BOOST_STRING_TYPENAME
|
||||||
const_iterator_of<InputT>::type,
|
range_const_iterator<InputT>::type,
|
||||||
FormatterT,
|
FormatterT,
|
||||||
FormatResultT > store_type;
|
FormatResultT > store_type;
|
||||||
|
|
||||||
@ -121,7 +123,7 @@ namespace boost {
|
|||||||
{
|
{
|
||||||
typedef find_format_store<
|
typedef find_format_store<
|
||||||
BOOST_STRING_TYPENAME
|
BOOST_STRING_TYPENAME
|
||||||
const_iterator_of<InputT>::type,
|
range_const_iterator<InputT>::type,
|
||||||
FormatterT,
|
FormatterT,
|
||||||
FormatResultT > store_type;
|
FormatResultT > store_type;
|
||||||
|
|
||||||
@ -181,7 +183,7 @@ namespace boost {
|
|||||||
{
|
{
|
||||||
typedef find_format_store<
|
typedef find_format_store<
|
||||||
BOOST_STRING_TYPENAME
|
BOOST_STRING_TYPENAME
|
||||||
iterator_of<InputT>::type,
|
range_iterator<InputT>::type,
|
||||||
FormatterT,
|
FormatterT,
|
||||||
FormatResultT > store_type;
|
FormatResultT > store_type;
|
||||||
|
|
||||||
|
@ -11,7 +11,9 @@
|
|||||||
#define BOOST_STRING_FIND_FORMAT_ALL_DETAIL_HPP
|
#define BOOST_STRING_FIND_FORMAT_ALL_DETAIL_HPP
|
||||||
|
|
||||||
#include <boost/algorithm/string/config.hpp>
|
#include <boost/algorithm/string/config.hpp>
|
||||||
#include <boost/algorithm/string/iterator_range.hpp>
|
#include <boost/range/iterator_range.hpp>
|
||||||
|
#include <boost/range/const_iterator.hpp>
|
||||||
|
#include <boost/range/value_type.hpp>
|
||||||
#include <boost/algorithm/string/detail/find_format_store.hpp>
|
#include <boost/algorithm/string/detail/find_format_store.hpp>
|
||||||
#include <boost/algorithm/string/detail/replace_storage.hpp>
|
#include <boost/algorithm/string/detail/replace_storage.hpp>
|
||||||
|
|
||||||
@ -59,7 +61,7 @@ namespace boost {
|
|||||||
const FormatResultT& FormatResult )
|
const FormatResultT& FormatResult )
|
||||||
{
|
{
|
||||||
typedef BOOST_STRING_TYPENAME
|
typedef BOOST_STRING_TYPENAME
|
||||||
const_iterator_of<InputT>::type input_iterator_type;
|
range_const_iterator<InputT>::type input_iterator_type;
|
||||||
|
|
||||||
typedef find_format_store<
|
typedef find_format_store<
|
||||||
input_iterator_type,
|
input_iterator_type,
|
||||||
@ -72,7 +74,7 @@ namespace boost {
|
|||||||
// Initialize last match
|
// Initialize last match
|
||||||
input_iterator_type LastMatch=begin(Input);
|
input_iterator_type LastMatch=begin(Input);
|
||||||
|
|
||||||
// Iterate throug all matches
|
// Iterate through all matches
|
||||||
while( M )
|
while( M )
|
||||||
{
|
{
|
||||||
// Copy the beginning of the sequence
|
// Copy the beginning of the sequence
|
||||||
@ -126,7 +128,7 @@ namespace boost {
|
|||||||
const FormatResultT& FormatResult)
|
const FormatResultT& FormatResult)
|
||||||
{
|
{
|
||||||
typedef BOOST_STRING_TYPENAME
|
typedef BOOST_STRING_TYPENAME
|
||||||
const_iterator_of<InputT>::type input_iterator_type;
|
range_const_iterator<InputT>::type input_iterator_type;
|
||||||
|
|
||||||
typedef find_format_store<
|
typedef find_format_store<
|
||||||
input_iterator_type,
|
input_iterator_type,
|
||||||
@ -142,7 +144,7 @@ namespace boost {
|
|||||||
// Output temporary
|
// Output temporary
|
||||||
InputT Output;
|
InputT Output;
|
||||||
|
|
||||||
// Iterate throug all matches
|
// Iterate through all matches
|
||||||
while( M )
|
while( M )
|
||||||
{
|
{
|
||||||
// Copy the beginning of the sequence
|
// Copy the beginning of the sequence
|
||||||
@ -196,7 +198,7 @@ namespace boost {
|
|||||||
FormatResultT FormatResult)
|
FormatResultT FormatResult)
|
||||||
{
|
{
|
||||||
typedef BOOST_STRING_TYPENAME
|
typedef BOOST_STRING_TYPENAME
|
||||||
iterator_of<InputT>::type input_iterator_type;
|
range_iterator<InputT>::type input_iterator_type;
|
||||||
typedef find_format_store<
|
typedef find_format_store<
|
||||||
input_iterator_type,
|
input_iterator_type,
|
||||||
FormatterT,
|
FormatterT,
|
||||||
@ -207,7 +209,7 @@ namespace boost {
|
|||||||
|
|
||||||
// Instantiate replacement storage
|
// Instantiate replacement storage
|
||||||
std::deque<
|
std::deque<
|
||||||
BOOST_STRING_TYPENAME value_type_of<InputT>::type> Storage;
|
BOOST_STRING_TYPENAME range_value<InputT>::type> Storage;
|
||||||
|
|
||||||
// Initialize replacement iterators
|
// Initialize replacement iterators
|
||||||
input_iterator_type InsertIt=begin(Input);
|
input_iterator_type InsertIt=begin(Input);
|
||||||
|
@ -11,8 +11,7 @@
|
|||||||
#define BOOST_STRING_FIND_FORMAT_STORE_DETAIL_HPP
|
#define BOOST_STRING_FIND_FORMAT_STORE_DETAIL_HPP
|
||||||
|
|
||||||
#include <boost/algorithm/string/config.hpp>
|
#include <boost/algorithm/string/config.hpp>
|
||||||
#include <boost/algorithm/string/collection_traits.hpp>
|
#include <boost/range/iterator_range.hpp>
|
||||||
#include <boost/algorithm/string/iterator_range.hpp>
|
|
||||||
|
|
||||||
namespace boost {
|
namespace boost {
|
||||||
namespace algorithm {
|
namespace algorithm {
|
||||||
@ -36,7 +35,7 @@ namespace boost {
|
|||||||
public:
|
public:
|
||||||
// Construction
|
// Construction
|
||||||
find_format_store(
|
find_format_store(
|
||||||
const base_type FindResult,
|
const base_type& FindResult,
|
||||||
const format_result_type& FormatResult,
|
const format_result_type& FormatResult,
|
||||||
const formatter_type& Formatter ) :
|
const formatter_type& Formatter ) :
|
||||||
base_type(FindResult),
|
base_type(FindResult),
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
#define BOOST_STRING_FIND_ITERATOR_DETAIL_HPP
|
#define BOOST_STRING_FIND_ITERATOR_DETAIL_HPP
|
||||||
|
|
||||||
#include <boost/algorithm/string/config.hpp>
|
#include <boost/algorithm/string/config.hpp>
|
||||||
#include <boost/algorithm/string/iterator_range.hpp>
|
#include <boost/range/iterator_range.hpp>
|
||||||
#include <boost/iterator/iterator_facade.hpp>
|
#include <boost/iterator/iterator_facade.hpp>
|
||||||
#include <boost/iterator/iterator_categories.hpp>
|
#include <boost/iterator/iterator_categories.hpp>
|
||||||
#include <boost/function.hpp>
|
#include <boost/function.hpp>
|
||||||
|
@ -13,8 +13,11 @@
|
|||||||
#include <boost/algorithm/string/config.hpp>
|
#include <boost/algorithm/string/config.hpp>
|
||||||
#include <boost/algorithm/string/constants.hpp>
|
#include <boost/algorithm/string/constants.hpp>
|
||||||
#include <boost/detail/iterator.hpp>
|
#include <boost/detail/iterator.hpp>
|
||||||
#include <boost/algorithm/string/collection_traits.hpp>
|
|
||||||
#include <boost/algorithm/string/iterator_range.hpp>
|
#include <boost/range/iterator_range.hpp>
|
||||||
|
#include <boost/range/begin.hpp>
|
||||||
|
#include <boost/range/end.hpp>
|
||||||
|
#include <boost/range/empty.hpp>
|
||||||
|
|
||||||
namespace boost {
|
namespace boost {
|
||||||
namespace algorithm {
|
namespace algorithm {
|
||||||
@ -59,7 +62,7 @@ namespace boost {
|
|||||||
++OuterIt)
|
++OuterIt)
|
||||||
{
|
{
|
||||||
// Sanity check
|
// Sanity check
|
||||||
if( empty(m_Search) )
|
if( boost::empty(m_Search) )
|
||||||
return result_type( End, End );
|
return result_type( End, End );
|
||||||
|
|
||||||
input_iterator_type InnerIt=OuterIt;
|
input_iterator_type InnerIt=OuterIt;
|
||||||
@ -119,7 +122,7 @@ namespace boost {
|
|||||||
{
|
{
|
||||||
typedef iterator_range<ForwardIteratorT> result_type;
|
typedef iterator_range<ForwardIteratorT> result_type;
|
||||||
|
|
||||||
if( empty(m_Search) )
|
if( boost::empty(m_Search) )
|
||||||
return result_type( End, End );
|
return result_type( End, End );
|
||||||
|
|
||||||
typedef BOOST_STRING_TYPENAME boost::detail::
|
typedef BOOST_STRING_TYPENAME boost::detail::
|
||||||
@ -239,7 +242,7 @@ namespace boost {
|
|||||||
typedef iterator_range<ForwardIteratorT> result_type;
|
typedef iterator_range<ForwardIteratorT> result_type;
|
||||||
|
|
||||||
// Sanity check
|
// Sanity check
|
||||||
if( empty(m_Search) )
|
if( boost::empty(m_Search) )
|
||||||
return result_type( End, End );
|
return result_type( End, End );
|
||||||
|
|
||||||
// Instantiate find funtor
|
// Instantiate find funtor
|
||||||
@ -468,7 +471,7 @@ namespace boost {
|
|||||||
if( m_eCompress==token_compress_on )
|
if( m_eCompress==token_compress_on )
|
||||||
{
|
{
|
||||||
// Find first non-matching character
|
// Find first non-matching character
|
||||||
while( m_Pred(*It2) && It2!=End ) ++It2;
|
while( It2!=End && m_Pred(*It2) ) ++It2;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -513,7 +516,13 @@ namespace boost {
|
|||||||
ForwardIterator2T,
|
ForwardIterator2T,
|
||||||
ForwardIterator2T ) const
|
ForwardIterator2T ) const
|
||||||
{
|
{
|
||||||
|
#if BOOST_WORKAROUND( __MWERKS__, <= 0x3003 )
|
||||||
|
return iterator_range<const ForwardIterator2T>(this->m_Range);
|
||||||
|
#elif BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
|
||||||
|
return iterator_range<ForwardIterator2T>(m_Range.begin(), m_Range.end());
|
||||||
|
#else
|
||||||
return m_Range;
|
return m_Range;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -12,8 +12,10 @@
|
|||||||
|
|
||||||
#include <boost/algorithm/string/config.hpp>
|
#include <boost/algorithm/string/config.hpp>
|
||||||
#include <boost/regex.hpp>
|
#include <boost/regex.hpp>
|
||||||
#include <boost/algorithm/string/iterator_range.hpp>
|
|
||||||
#include <boost/algorithm/string/collection_traits.hpp>
|
#include <boost/range/iterator_range.hpp>
|
||||||
|
#include <boost/range/begin.hpp>
|
||||||
|
#include <boost/range/end.hpp>
|
||||||
|
|
||||||
namespace boost {
|
namespace boost {
|
||||||
namespace algorithm {
|
namespace algorithm {
|
||||||
@ -29,7 +31,6 @@ namespace boost {
|
|||||||
typedef regex_search_result<IteratorT> type;
|
typedef regex_search_result<IteratorT> type;
|
||||||
typedef iterator_range<IteratorT> base_type;
|
typedef iterator_range<IteratorT> base_type;
|
||||||
typedef BOOST_STRING_TYPENAME base_type::value_type value_type;
|
typedef BOOST_STRING_TYPENAME base_type::value_type value_type;
|
||||||
typedef BOOST_STRING_TYPENAME base_type::reference reference;
|
|
||||||
typedef BOOST_STRING_TYPENAME base_type::difference_type difference_type;
|
typedef BOOST_STRING_TYPENAME base_type::difference_type difference_type;
|
||||||
typedef BOOST_STRING_TYPENAME base_type::const_iterator const_iterator;
|
typedef BOOST_STRING_TYPENAME base_type::const_iterator const_iterator;
|
||||||
typedef BOOST_STRING_TYPENAME base_type::iterator iterator;
|
typedef BOOST_STRING_TYPENAME base_type::iterator iterator;
|
||||||
|
@ -10,8 +10,12 @@
|
|||||||
#ifndef BOOST_STRING_FORMATTER_DETAIL_HPP
|
#ifndef BOOST_STRING_FORMATTER_DETAIL_HPP
|
||||||
#define BOOST_STRING_FORMATTER_DETAIL_HPP
|
#define BOOST_STRING_FORMATTER_DETAIL_HPP
|
||||||
|
|
||||||
#include <boost/algorithm/string/collection_traits.hpp>
|
|
||||||
#include <boost/algorithm/string/iterator_range.hpp>
|
#include <boost/range/iterator_range.hpp>
|
||||||
|
#include <boost/range/begin.hpp>
|
||||||
|
#include <boost/range/end.hpp>
|
||||||
|
#include <boost/range/const_iterator.hpp>
|
||||||
|
|
||||||
#include <boost/algorithm/string/detail/util.hpp>
|
#include <boost/algorithm/string/detail/util.hpp>
|
||||||
|
|
||||||
// generic replace functors -----------------------------------------------//
|
// generic replace functors -----------------------------------------------//
|
||||||
@ -23,22 +27,30 @@ namespace boost {
|
|||||||
// const format functor ----------------------------------------------------//
|
// const format functor ----------------------------------------------------//
|
||||||
|
|
||||||
// constant format functor
|
// constant format functor
|
||||||
template<typename CollectionT>
|
template<typename RangeT>
|
||||||
struct const_formatF
|
struct const_formatF
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
typedef BOOST_STRING_TYPENAME
|
typedef BOOST_STRING_TYPENAME
|
||||||
const_iterator_of<CollectionT>::type format_iterator;
|
range_const_iterator<RangeT>::type format_iterator;
|
||||||
typedef iterator_range<format_iterator> result_type;
|
typedef iterator_range<format_iterator> result_type;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Construction
|
// Construction
|
||||||
const_formatF(const CollectionT& Format) :
|
const_formatF(const RangeT& Format) :
|
||||||
m_Format(begin(Format), end(Format)) {}
|
m_Format(begin(Format), end(Format)) {}
|
||||||
|
|
||||||
// Operation
|
// Operation
|
||||||
template<typename Collection2T>
|
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
|
||||||
const result_type& operator()(const Collection2T&) const
|
template<typename Range2T>
|
||||||
|
result_type& operator()(const Range2T&)
|
||||||
|
{
|
||||||
|
return m_Format;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
template<typename Range2T>
|
||||||
|
const result_type& operator()(const Range2T&) const
|
||||||
{
|
{
|
||||||
return m_Format;
|
return m_Format;
|
||||||
}
|
}
|
||||||
@ -50,14 +62,14 @@ namespace boost {
|
|||||||
// identity format functor ----------------------------------------------------//
|
// identity format functor ----------------------------------------------------//
|
||||||
|
|
||||||
// identity format functor
|
// identity format functor
|
||||||
template<typename CollectionT>
|
template<typename RangeT>
|
||||||
struct identity_formatF
|
struct identity_formatF
|
||||||
{
|
{
|
||||||
// Operation
|
// Operation
|
||||||
template< typename Collection2T >
|
template< typename Range2T >
|
||||||
const CollectionT& operator()(const Collection2T& Replace) const
|
const RangeT& operator()(const Range2T& Replace) const
|
||||||
{
|
{
|
||||||
return CollectionT(begin(Replace), end(Replace));
|
return RangeT(begin(Replace), end(Replace));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -13,9 +13,7 @@
|
|||||||
#include <boost/algorithm/string/config.hpp>
|
#include <boost/algorithm/string/config.hpp>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <boost/mpl/bool.hpp>
|
#include <boost/mpl/bool.hpp>
|
||||||
#include <boost/algorithm/string/collection_traits.hpp>
|
|
||||||
#include <boost/algorithm/string/sequence_traits.hpp>
|
#include <boost/algorithm/string/sequence_traits.hpp>
|
||||||
#include <boost/algorithm/string/iterator_range.hpp>
|
|
||||||
#include <boost/algorithm/string/detail/sequence.hpp>
|
#include <boost/algorithm/string/detail/sequence.hpp>
|
||||||
|
|
||||||
namespace boost {
|
namespace boost {
|
||||||
|
@ -13,7 +13,9 @@
|
|||||||
#include <boost/algorithm/string/config.hpp>
|
#include <boost/algorithm/string/config.hpp>
|
||||||
#include <boost/mpl/bool.hpp>
|
#include <boost/mpl/bool.hpp>
|
||||||
#include <boost/mpl/logical.hpp>
|
#include <boost/mpl/logical.hpp>
|
||||||
#include <boost/algorithm/string/collection_traits.hpp>
|
#include <boost/range/begin.hpp>
|
||||||
|
#include <boost/range/end.hpp>
|
||||||
|
|
||||||
#include <boost/algorithm/string/sequence_traits.hpp>
|
#include <boost/algorithm/string/sequence_traits.hpp>
|
||||||
|
|
||||||
namespace boost {
|
namespace boost {
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
|
|
||||||
#include <boost/algorithm/string/config.hpp>
|
#include <boost/algorithm/string/config.hpp>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
#include <boost/range/iterator_range.hpp>
|
||||||
|
|
||||||
namespace boost {
|
namespace boost {
|
||||||
namespace algorithm {
|
namespace algorithm {
|
||||||
@ -22,7 +23,7 @@ namespace boost {
|
|||||||
// empty_container
|
// empty_container
|
||||||
/*
|
/*
|
||||||
This class represents always empty container,
|
This class represents always empty container,
|
||||||
containing elemets of type CharT.
|
containing elements of type CharT.
|
||||||
|
|
||||||
It is supposed to be used in a const version only
|
It is supposed to be used in a const version only
|
||||||
*/
|
*/
|
||||||
@ -92,7 +93,7 @@ namespace boost {
|
|||||||
{
|
{
|
||||||
SeqT operator()( const iterator_range<IteratorT>& Range ) const
|
SeqT operator()( const iterator_range<IteratorT>& Range ) const
|
||||||
{
|
{
|
||||||
return copy_iterator_range<SeqT>(Range);
|
return copy_range<SeqT>(Range);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -11,8 +11,13 @@
|
|||||||
#define BOOST_STRING_ERASE_HPP
|
#define BOOST_STRING_ERASE_HPP
|
||||||
|
|
||||||
#include <boost/algorithm/string/config.hpp>
|
#include <boost/algorithm/string/config.hpp>
|
||||||
#include <boost/algorithm/string/collection_traits.hpp>
|
|
||||||
#include <boost/algorithm/string/iterator_range.hpp>
|
#include <boost/range/iterator_range.hpp>
|
||||||
|
#include <boost/range/begin.hpp>
|
||||||
|
#include <boost/range/end.hpp>
|
||||||
|
#include <boost/range/iterator.hpp>
|
||||||
|
#include <boost/range/const_iterator.hpp>
|
||||||
|
|
||||||
#include <boost/algorithm/string/find_format.hpp>
|
#include <boost/algorithm/string/find_format.hpp>
|
||||||
#include <boost/algorithm/string/finder.hpp>
|
#include <boost/algorithm/string/finder.hpp>
|
||||||
#include <boost/algorithm/string/formatter.hpp>
|
#include <boost/algorithm/string/formatter.hpp>
|
||||||
@ -40,13 +45,13 @@ namespace boost {
|
|||||||
|
|
||||||
\note The second variant of this function provides the strong exception-safety guarantee
|
\note The second variant of this function provides the strong exception-safety guarantee
|
||||||
*/
|
*/
|
||||||
template<typename OutputIteratorT, typename CollectionT>
|
template<typename OutputIteratorT, typename RangeT>
|
||||||
inline OutputIteratorT erase_range_copy(
|
inline OutputIteratorT erase_range_copy(
|
||||||
OutputIteratorT Output,
|
OutputIteratorT Output,
|
||||||
const CollectionT& Input,
|
const RangeT& Input,
|
||||||
const iterator_range<
|
const iterator_range<
|
||||||
BOOST_STRING_TYPENAME
|
BOOST_STRING_TYPENAME
|
||||||
const_iterator_of<CollectionT>::type>& SearchRange )
|
range_const_iterator<RangeT>::type>& SearchRange )
|
||||||
{
|
{
|
||||||
return find_format_copy(
|
return find_format_copy(
|
||||||
Output,
|
Output,
|
||||||
@ -64,7 +69,7 @@ namespace boost {
|
|||||||
const SequenceT& Input,
|
const SequenceT& Input,
|
||||||
const iterator_range<
|
const iterator_range<
|
||||||
BOOST_STRING_TYPENAME
|
BOOST_STRING_TYPENAME
|
||||||
const_iterator_of<SequenceT>::type>& SearchRange )
|
range_const_iterator<SequenceT>::type>& SearchRange )
|
||||||
{
|
{
|
||||||
return find_format_copy(
|
return find_format_copy(
|
||||||
Input,
|
Input,
|
||||||
@ -85,7 +90,7 @@ namespace boost {
|
|||||||
SequenceT& Input,
|
SequenceT& Input,
|
||||||
const iterator_range<
|
const iterator_range<
|
||||||
BOOST_STRING_TYPENAME
|
BOOST_STRING_TYPENAME
|
||||||
iterator_of<SequenceT>::type>& SearchRange )
|
range_iterator<SequenceT>::type>& SearchRange )
|
||||||
{
|
{
|
||||||
find_format(
|
find_format(
|
||||||
Input,
|
Input,
|
||||||
@ -97,7 +102,7 @@ namespace boost {
|
|||||||
|
|
||||||
//! Erase first algorithm
|
//! Erase first algorithm
|
||||||
/*!
|
/*!
|
||||||
Remove the first occurence of the substring from the input.
|
Remove the first occurrence of the substring from the input.
|
||||||
The result is a modified copy of the input. It is returned as a sequence
|
The result is a modified copy of the input. It is returned as a sequence
|
||||||
or copied to the output iterator.
|
or copied to the output iterator.
|
||||||
|
|
||||||
@ -111,12 +116,12 @@ namespace boost {
|
|||||||
*/
|
*/
|
||||||
template<
|
template<
|
||||||
typename OutputIteratorT,
|
typename OutputIteratorT,
|
||||||
typename Collection1T,
|
typename Range1T,
|
||||||
typename Collection2T>
|
typename Range2T>
|
||||||
inline OutputIteratorT erase_first_copy(
|
inline OutputIteratorT erase_first_copy(
|
||||||
OutputIteratorT Output,
|
OutputIteratorT Output,
|
||||||
const Collection1T& Input,
|
const Range1T& Input,
|
||||||
const Collection2T& Search )
|
const Range2T& Search )
|
||||||
{
|
{
|
||||||
return find_format_copy(
|
return find_format_copy(
|
||||||
Output,
|
Output,
|
||||||
@ -129,10 +134,10 @@ namespace boost {
|
|||||||
/*!
|
/*!
|
||||||
\overload
|
\overload
|
||||||
*/
|
*/
|
||||||
template<typename SequenceT, typename CollectionT>
|
template<typename SequenceT, typename RangeT>
|
||||||
inline SequenceT erase_first_copy(
|
inline SequenceT erase_first_copy(
|
||||||
const SequenceT& Input,
|
const SequenceT& Input,
|
||||||
const CollectionT& Search )
|
const RangeT& Search )
|
||||||
{
|
{
|
||||||
return find_format_copy(
|
return find_format_copy(
|
||||||
Input,
|
Input,
|
||||||
@ -142,16 +147,16 @@ namespace boost {
|
|||||||
|
|
||||||
//! Erase first algorithm
|
//! Erase first algorithm
|
||||||
/*!
|
/*!
|
||||||
Remove the first occurence of the substring from the input.
|
Remove the first occurrence of the substring from the input.
|
||||||
The input sequence is modified in-place.
|
The input sequence is modified in-place.
|
||||||
|
|
||||||
\param Input An input string
|
\param Input An input string
|
||||||
\param Search A substring to be searched for.
|
\param Search A substring to be searched for.
|
||||||
*/
|
*/
|
||||||
template<typename SequenceT, typename CollectionT>
|
template<typename SequenceT, typename RangeT>
|
||||||
inline void erase_first(
|
inline void erase_first(
|
||||||
SequenceT& Input,
|
SequenceT& Input,
|
||||||
const CollectionT& Search )
|
const RangeT& Search )
|
||||||
{
|
{
|
||||||
find_format(
|
find_format(
|
||||||
Input,
|
Input,
|
||||||
@ -163,7 +168,7 @@ namespace boost {
|
|||||||
|
|
||||||
//! Erase first algorithm ( case insensitive )
|
//! Erase first algorithm ( case insensitive )
|
||||||
/*!
|
/*!
|
||||||
Remove the first occurence of the substring from the input.
|
Remove the first occurrence of the substring from the input.
|
||||||
The result is a modified copy of the input. It is returned as a sequence
|
The result is a modified copy of the input. It is returned as a sequence
|
||||||
or copied to the output iterator.
|
or copied to the output iterator.
|
||||||
Searching is case insensitive.
|
Searching is case insensitive.
|
||||||
@ -179,12 +184,12 @@ namespace boost {
|
|||||||
*/
|
*/
|
||||||
template<
|
template<
|
||||||
typename OutputIteratorT,
|
typename OutputIteratorT,
|
||||||
typename Collection1T,
|
typename Range1T,
|
||||||
typename Collection2T>
|
typename Range2T>
|
||||||
inline OutputIteratorT ierase_first_copy(
|
inline OutputIteratorT ierase_first_copy(
|
||||||
OutputIteratorT Output,
|
OutputIteratorT Output,
|
||||||
const Collection1T& Input,
|
const Range1T& Input,
|
||||||
const Collection2T& Search,
|
const Range2T& Search,
|
||||||
const std::locale& Loc=std::locale() )
|
const std::locale& Loc=std::locale() )
|
||||||
{
|
{
|
||||||
return find_format_copy(
|
return find_format_copy(
|
||||||
@ -198,10 +203,10 @@ namespace boost {
|
|||||||
/*!
|
/*!
|
||||||
\overload
|
\overload
|
||||||
*/
|
*/
|
||||||
template<typename SequenceT, typename CollectionT>
|
template<typename SequenceT, typename RangeT>
|
||||||
inline SequenceT ierase_first_copy(
|
inline SequenceT ierase_first_copy(
|
||||||
const SequenceT& Input,
|
const SequenceT& Input,
|
||||||
const CollectionT& Search,
|
const RangeT& Search,
|
||||||
const std::locale& Loc=std::locale() )
|
const std::locale& Loc=std::locale() )
|
||||||
{
|
{
|
||||||
return find_format_copy(
|
return find_format_copy(
|
||||||
@ -212,17 +217,17 @@ namespace boost {
|
|||||||
|
|
||||||
//! Erase first algorithm ( case insensitive )
|
//! Erase first algorithm ( case insensitive )
|
||||||
/*!
|
/*!
|
||||||
Remove the first occurence of the substring from the input.
|
Remove the first occurrence of the substring from the input.
|
||||||
The input sequence is modified in-place. Searching is case insensitive.
|
The input sequence is modified in-place. Searching is case insensitive.
|
||||||
|
|
||||||
\param Input An input string
|
\param Input An input string
|
||||||
\param Search A substring to be searched for
|
\param Search A substring to be searched for
|
||||||
\param Loc A locale used for case insensitive comparison
|
\param Loc A locale used for case insensitive comparison
|
||||||
*/
|
*/
|
||||||
template<typename SequenceT, typename CollectionT>
|
template<typename SequenceT, typename RangeT>
|
||||||
inline void ierase_first(
|
inline void ierase_first(
|
||||||
SequenceT& Input,
|
SequenceT& Input,
|
||||||
const CollectionT& Search,
|
const RangeT& Search,
|
||||||
const std::locale& Loc=std::locale() )
|
const std::locale& Loc=std::locale() )
|
||||||
{
|
{
|
||||||
find_format(
|
find_format(
|
||||||
@ -235,7 +240,7 @@ namespace boost {
|
|||||||
|
|
||||||
//! Erase last algorithm
|
//! Erase last algorithm
|
||||||
/*!
|
/*!
|
||||||
Remove the last occurence of the substring from the input.
|
Remove the last occurrence of the substring from the input.
|
||||||
The result is a modified copy of the input. It is returned as a sequence
|
The result is a modified copy of the input. It is returned as a sequence
|
||||||
or copied to the output iterator.
|
or copied to the output iterator.
|
||||||
|
|
||||||
@ -249,12 +254,12 @@ namespace boost {
|
|||||||
*/
|
*/
|
||||||
template<
|
template<
|
||||||
typename OutputIteratorT,
|
typename OutputIteratorT,
|
||||||
typename Collection1T,
|
typename Range1T,
|
||||||
typename Collection2T>
|
typename Range2T>
|
||||||
inline OutputIteratorT erase_last_copy(
|
inline OutputIteratorT erase_last_copy(
|
||||||
OutputIteratorT Output,
|
OutputIteratorT Output,
|
||||||
const Collection1T& Input,
|
const Range1T& Input,
|
||||||
const Collection2T& Search )
|
const Range2T& Search )
|
||||||
{
|
{
|
||||||
return find_format_copy(
|
return find_format_copy(
|
||||||
Output,
|
Output,
|
||||||
@ -267,10 +272,10 @@ namespace boost {
|
|||||||
/*!
|
/*!
|
||||||
\overload
|
\overload
|
||||||
*/
|
*/
|
||||||
template<typename SequenceT, typename CollectionT>
|
template<typename SequenceT, typename RangeT>
|
||||||
inline SequenceT erase_last_copy(
|
inline SequenceT erase_last_copy(
|
||||||
const SequenceT& Input,
|
const SequenceT& Input,
|
||||||
const CollectionT& Search )
|
const RangeT& Search )
|
||||||
{
|
{
|
||||||
return find_format_copy(
|
return find_format_copy(
|
||||||
Input,
|
Input,
|
||||||
@ -280,16 +285,16 @@ namespace boost {
|
|||||||
|
|
||||||
//! Erase last algorithm
|
//! Erase last algorithm
|
||||||
/*!
|
/*!
|
||||||
Remove the last occurence of the substring from the input.
|
Remove the last occurrence of the substring from the input.
|
||||||
The input sequence is modified in-place.
|
The input sequence is modified in-place.
|
||||||
|
|
||||||
\param Input An input string
|
\param Input An input string
|
||||||
\param Search A substring to be searched for
|
\param Search A substring to be searched for
|
||||||
*/
|
*/
|
||||||
template<typename SequenceT, typename CollectionT>
|
template<typename SequenceT, typename RangeT>
|
||||||
inline void erase_last(
|
inline void erase_last(
|
||||||
SequenceT& Input,
|
SequenceT& Input,
|
||||||
const CollectionT& Search )
|
const RangeT& Search )
|
||||||
{
|
{
|
||||||
find_format(
|
find_format(
|
||||||
Input,
|
Input,
|
||||||
@ -301,7 +306,7 @@ namespace boost {
|
|||||||
|
|
||||||
//! Erase last algorithm ( case insensitive )
|
//! Erase last algorithm ( case insensitive )
|
||||||
/*!
|
/*!
|
||||||
Remove the last occurence of the substring from the input.
|
Remove the last occurrence of the substring from the input.
|
||||||
The result is a modified copy of the input. It is returned as a sequence
|
The result is a modified copy of the input. It is returned as a sequence
|
||||||
or copied to the output iterator.
|
or copied to the output iterator.
|
||||||
Searching is case insensitive.
|
Searching is case insensitive.
|
||||||
@ -317,12 +322,12 @@ namespace boost {
|
|||||||
*/
|
*/
|
||||||
template<
|
template<
|
||||||
typename OutputIteratorT,
|
typename OutputIteratorT,
|
||||||
typename Collection1T,
|
typename Range1T,
|
||||||
typename Collection2T>
|
typename Range2T>
|
||||||
inline OutputIteratorT ierase_last_copy(
|
inline OutputIteratorT ierase_last_copy(
|
||||||
OutputIteratorT Output,
|
OutputIteratorT Output,
|
||||||
const Collection1T& Input,
|
const Range1T& Input,
|
||||||
const Collection2T& Search,
|
const Range2T& Search,
|
||||||
const std::locale& Loc=std::locale() )
|
const std::locale& Loc=std::locale() )
|
||||||
{
|
{
|
||||||
return find_format_copy(
|
return find_format_copy(
|
||||||
@ -336,10 +341,10 @@ namespace boost {
|
|||||||
/*!
|
/*!
|
||||||
\overload
|
\overload
|
||||||
*/
|
*/
|
||||||
template<typename SequenceT, typename CollectionT>
|
template<typename SequenceT, typename RangeT>
|
||||||
inline SequenceT ierase_last_copy(
|
inline SequenceT ierase_last_copy(
|
||||||
const SequenceT& Input,
|
const SequenceT& Input,
|
||||||
const CollectionT& Search,
|
const RangeT& Search,
|
||||||
const std::locale& Loc=std::locale() )
|
const std::locale& Loc=std::locale() )
|
||||||
{
|
{
|
||||||
return find_format_copy(
|
return find_format_copy(
|
||||||
@ -350,17 +355,17 @@ namespace boost {
|
|||||||
|
|
||||||
//! Erase last algorithm ( case insensitive )
|
//! Erase last algorithm ( case insensitive )
|
||||||
/*!
|
/*!
|
||||||
Remove the last occurence of the substring from the input.
|
Remove the last occurrence of the substring from the input.
|
||||||
The input sequence is modified in-place. Searching is case insensitive.
|
The input sequence is modified in-place. Searching is case insensitive.
|
||||||
|
|
||||||
\param Input An input string
|
\param Input An input string
|
||||||
\param Search A substring to be searched for
|
\param Search A substring to be searched for
|
||||||
\param Loc A locale used for case insensitive comparison
|
\param Loc A locale used for case insensitive comparison
|
||||||
*/
|
*/
|
||||||
template<typename SequenceT, typename CollectionT>
|
template<typename SequenceT, typename RangeT>
|
||||||
inline void ierase_last(
|
inline void ierase_last(
|
||||||
SequenceT& Input,
|
SequenceT& Input,
|
||||||
const CollectionT& Search,
|
const RangeT& Search,
|
||||||
const std::locale& Loc=std::locale() )
|
const std::locale& Loc=std::locale() )
|
||||||
{
|
{
|
||||||
find_format(
|
find_format(
|
||||||
@ -373,7 +378,7 @@ namespace boost {
|
|||||||
|
|
||||||
//! Erase nth algorithm
|
//! Erase nth algorithm
|
||||||
/*!
|
/*!
|
||||||
Remove the Nth occurence of the substring in the input.
|
Remove the Nth occurrence of the substring in the input.
|
||||||
The result is a modified copy of the input. It is returned as a sequence
|
The result is a modified copy of the input. It is returned as a sequence
|
||||||
or copied to the output iterator.
|
or copied to the output iterator.
|
||||||
|
|
||||||
@ -389,12 +394,12 @@ namespace boost {
|
|||||||
*/
|
*/
|
||||||
template<
|
template<
|
||||||
typename OutputIteratorT,
|
typename OutputIteratorT,
|
||||||
typename Collection1T,
|
typename Range1T,
|
||||||
typename Collection2T>
|
typename Range2T>
|
||||||
inline OutputIteratorT erase_nth_copy(
|
inline OutputIteratorT erase_nth_copy(
|
||||||
OutputIteratorT Output,
|
OutputIteratorT Output,
|
||||||
const Collection1T& Input,
|
const Range1T& Input,
|
||||||
const Collection2T& Search,
|
const Range2T& Search,
|
||||||
unsigned int Nth )
|
unsigned int Nth )
|
||||||
{
|
{
|
||||||
return find_format_copy(
|
return find_format_copy(
|
||||||
@ -408,10 +413,10 @@ namespace boost {
|
|||||||
/*!
|
/*!
|
||||||
\overload
|
\overload
|
||||||
*/
|
*/
|
||||||
template<typename SequenceT, typename CollectionT>
|
template<typename SequenceT, typename RangeT>
|
||||||
inline SequenceT erase_nth_copy(
|
inline SequenceT erase_nth_copy(
|
||||||
const SequenceT& Input,
|
const SequenceT& Input,
|
||||||
const CollectionT& Search,
|
const RangeT& Search,
|
||||||
unsigned int Nth )
|
unsigned int Nth )
|
||||||
{
|
{
|
||||||
return find_format_copy(
|
return find_format_copy(
|
||||||
@ -422,17 +427,17 @@ namespace boost {
|
|||||||
|
|
||||||
//! Erase nth algorithm
|
//! Erase nth algorithm
|
||||||
/*!
|
/*!
|
||||||
Remove the Nth occurence of the substring in the input.
|
Remove the Nth occurrence of the substring in the input.
|
||||||
The input sequence is modified in-place.
|
The input sequence is modified in-place.
|
||||||
|
|
||||||
\param Input An input string
|
\param Input An input string
|
||||||
\param Search A substring to be searched for.
|
\param Search A substring to be searched for.
|
||||||
\param Nth An index of the match to be replaced. The index is 0-based.
|
\param Nth An index of the match to be replaced. The index is 0-based.
|
||||||
*/
|
*/
|
||||||
template<typename SequenceT, typename CollectionT>
|
template<typename SequenceT, typename RangeT>
|
||||||
inline void erase_nth(
|
inline void erase_nth(
|
||||||
SequenceT& Input,
|
SequenceT& Input,
|
||||||
const CollectionT& Search,
|
const RangeT& Search,
|
||||||
unsigned int Nth )
|
unsigned int Nth )
|
||||||
{
|
{
|
||||||
find_format(
|
find_format(
|
||||||
@ -445,7 +450,7 @@ namespace boost {
|
|||||||
|
|
||||||
//! Erase nth algorithm ( case insensitive )
|
//! Erase nth algorithm ( case insensitive )
|
||||||
/*!
|
/*!
|
||||||
Remove the Nth occurence of the substring in the input.
|
Remove the Nth occurrence of the substring in the input.
|
||||||
The result is a modified copy of the input. It is returned as a sequence
|
The result is a modified copy of the input. It is returned as a sequence
|
||||||
or copied to the output iterator.
|
or copied to the output iterator.
|
||||||
Searching is case insensitive.
|
Searching is case insensitive.
|
||||||
@ -462,12 +467,12 @@ namespace boost {
|
|||||||
*/
|
*/
|
||||||
template<
|
template<
|
||||||
typename OutputIteratorT,
|
typename OutputIteratorT,
|
||||||
typename Collection1T,
|
typename Range1T,
|
||||||
typename Collection2T>
|
typename Range2T>
|
||||||
inline OutputIteratorT ierase_nth_copy(
|
inline OutputIteratorT ierase_nth_copy(
|
||||||
OutputIteratorT Output,
|
OutputIteratorT Output,
|
||||||
const Collection1T& Input,
|
const Range1T& Input,
|
||||||
const Collection2T& Search,
|
const Range2T& Search,
|
||||||
unsigned int Nth,
|
unsigned int Nth,
|
||||||
const std::locale& Loc=std::locale() )
|
const std::locale& Loc=std::locale() )
|
||||||
{
|
{
|
||||||
@ -482,10 +487,10 @@ namespace boost {
|
|||||||
/*!
|
/*!
|
||||||
\overload
|
\overload
|
||||||
*/
|
*/
|
||||||
template<typename SequenceT, typename CollectionT>
|
template<typename SequenceT, typename RangeT>
|
||||||
inline SequenceT ierase_nth_copy(
|
inline SequenceT ierase_nth_copy(
|
||||||
const SequenceT& Input,
|
const SequenceT& Input,
|
||||||
const CollectionT& Search,
|
const RangeT& Search,
|
||||||
unsigned int Nth,
|
unsigned int Nth,
|
||||||
const std::locale& Loc=std::locale() )
|
const std::locale& Loc=std::locale() )
|
||||||
{
|
{
|
||||||
@ -497,7 +502,7 @@ namespace boost {
|
|||||||
|
|
||||||
//! Erase nth algorithm
|
//! Erase nth algorithm
|
||||||
/*!
|
/*!
|
||||||
Remove the Nth occurence of the substring in the input.
|
Remove the Nth occurrence of the substring in the input.
|
||||||
The input sequence is modified in-place. Searching is case insensitive.
|
The input sequence is modified in-place. Searching is case insensitive.
|
||||||
|
|
||||||
\param Input An input string
|
\param Input An input string
|
||||||
@ -505,10 +510,10 @@ namespace boost {
|
|||||||
\param Nth An index of the match to be replaced. The index is 0-based.
|
\param Nth An index of the match to be replaced. The index is 0-based.
|
||||||
\param Loc A locale used for case insensitive comparison
|
\param Loc A locale used for case insensitive comparison
|
||||||
*/
|
*/
|
||||||
template<typename SequenceT, typename CollectionT>
|
template<typename SequenceT, typename RangeT>
|
||||||
inline void ierase_nth(
|
inline void ierase_nth(
|
||||||
SequenceT& Input,
|
SequenceT& Input,
|
||||||
const CollectionT& Search,
|
const RangeT& Search,
|
||||||
unsigned int Nth,
|
unsigned int Nth,
|
||||||
const std::locale& Loc=std::locale() )
|
const std::locale& Loc=std::locale() )
|
||||||
{
|
{
|
||||||
@ -538,12 +543,12 @@ namespace boost {
|
|||||||
*/
|
*/
|
||||||
template<
|
template<
|
||||||
typename OutputIteratorT,
|
typename OutputIteratorT,
|
||||||
typename Collection1T,
|
typename Range1T,
|
||||||
typename Collection2T>
|
typename Range2T>
|
||||||
inline OutputIteratorT erase_all_copy(
|
inline OutputIteratorT erase_all_copy(
|
||||||
OutputIteratorT Output,
|
OutputIteratorT Output,
|
||||||
const Collection1T& Input,
|
const Range1T& Input,
|
||||||
const Collection2T& Search )
|
const Range2T& Search )
|
||||||
{
|
{
|
||||||
return find_format_all_copy(
|
return find_format_all_copy(
|
||||||
Output,
|
Output,
|
||||||
@ -556,10 +561,10 @@ namespace boost {
|
|||||||
/*!
|
/*!
|
||||||
\overload
|
\overload
|
||||||
*/
|
*/
|
||||||
template<typename SequenceT, typename CollectionT>
|
template<typename SequenceT, typename RangeT>
|
||||||
inline SequenceT erase_all_copy(
|
inline SequenceT erase_all_copy(
|
||||||
const SequenceT& Input,
|
const SequenceT& Input,
|
||||||
const CollectionT& Search )
|
const RangeT& Search )
|
||||||
{
|
{
|
||||||
return find_format_all_copy(
|
return find_format_all_copy(
|
||||||
Input,
|
Input,
|
||||||
@ -575,10 +580,10 @@ namespace boost {
|
|||||||
\param Input An input string
|
\param Input An input string
|
||||||
\param Search A substring to be searched for.
|
\param Search A substring to be searched for.
|
||||||
*/
|
*/
|
||||||
template<typename SequenceT, typename CollectionT>
|
template<typename SequenceT, typename RangeT>
|
||||||
inline void erase_all(
|
inline void erase_all(
|
||||||
SequenceT& Input,
|
SequenceT& Input,
|
||||||
const CollectionT& Search )
|
const RangeT& Search )
|
||||||
{
|
{
|
||||||
find_format_all(
|
find_format_all(
|
||||||
Input,
|
Input,
|
||||||
@ -606,12 +611,12 @@ namespace boost {
|
|||||||
*/
|
*/
|
||||||
template<
|
template<
|
||||||
typename OutputIteratorT,
|
typename OutputIteratorT,
|
||||||
typename Collection1T,
|
typename Range1T,
|
||||||
typename Collection2T>
|
typename Range2T>
|
||||||
inline OutputIteratorT ierase_all_copy(
|
inline OutputIteratorT ierase_all_copy(
|
||||||
OutputIteratorT Output,
|
OutputIteratorT Output,
|
||||||
const Collection1T& Input,
|
const Range1T& Input,
|
||||||
const Collection2T& Search,
|
const Range2T& Search,
|
||||||
const std::locale& Loc=std::locale() )
|
const std::locale& Loc=std::locale() )
|
||||||
{
|
{
|
||||||
return find_format_all_copy(
|
return find_format_all_copy(
|
||||||
@ -625,10 +630,10 @@ namespace boost {
|
|||||||
/*!
|
/*!
|
||||||
\overload
|
\overload
|
||||||
*/
|
*/
|
||||||
template<typename SequenceT, typename CollectionT>
|
template<typename SequenceT, typename RangeT>
|
||||||
inline SequenceT ierase_all_copy(
|
inline SequenceT ierase_all_copy(
|
||||||
const SequenceT& Input,
|
const SequenceT& Input,
|
||||||
const CollectionT& Search,
|
const RangeT& Search,
|
||||||
const std::locale& Loc=std::locale() )
|
const std::locale& Loc=std::locale() )
|
||||||
{
|
{
|
||||||
return find_format_all_copy(
|
return find_format_all_copy(
|
||||||
@ -646,10 +651,10 @@ namespace boost {
|
|||||||
\param Search A substring to be searched for.
|
\param Search A substring to be searched for.
|
||||||
\param Loc A locale used for case insensitive comparison
|
\param Loc A locale used for case insensitive comparison
|
||||||
*/
|
*/
|
||||||
template<typename SequenceT, typename CollectionT>
|
template<typename SequenceT, typename RangeT>
|
||||||
inline void ierase_all(
|
inline void ierase_all(
|
||||||
SequenceT& Input,
|
SequenceT& Input,
|
||||||
const CollectionT& Search,
|
const RangeT& Search,
|
||||||
const std::locale& Loc=std::locale() )
|
const std::locale& Loc=std::locale() )
|
||||||
{
|
{
|
||||||
find_format_all(
|
find_format_all(
|
||||||
@ -662,7 +667,7 @@ namespace boost {
|
|||||||
|
|
||||||
//! Erase head algorithm
|
//! Erase head algorithm
|
||||||
/*!
|
/*!
|
||||||
Remove the head from the input. The head is a prefix of a seqence of given size.
|
Remove the head from the input. The head is a prefix of a sequence of given size.
|
||||||
If the sequence is shorter then required, the whole string is
|
If the sequence is shorter then required, the whole string is
|
||||||
considered to be the head. The result is a modified copy of the input.
|
considered to be the head. The result is a modified copy of the input.
|
||||||
It is returned as a sequence or copied to the output iterator.
|
It is returned as a sequence or copied to the output iterator.
|
||||||
@ -678,10 +683,10 @@ namespace boost {
|
|||||||
*/
|
*/
|
||||||
template<
|
template<
|
||||||
typename OutputIteratorT,
|
typename OutputIteratorT,
|
||||||
typename CollectionT>
|
typename RangeT>
|
||||||
inline OutputIteratorT erase_head_copy(
|
inline OutputIteratorT erase_head_copy(
|
||||||
OutputIteratorT Output,
|
OutputIteratorT Output,
|
||||||
const CollectionT& Input,
|
const RangeT& Input,
|
||||||
unsigned int N )
|
unsigned int N )
|
||||||
{
|
{
|
||||||
return find_format_copy(
|
return find_format_copy(
|
||||||
@ -708,7 +713,7 @@ namespace boost {
|
|||||||
|
|
||||||
//! Erase head algorithm
|
//! Erase head algorithm
|
||||||
/*!
|
/*!
|
||||||
Remove the head from the input. The head is a prefix of a seqence of given size.
|
Remove the head from the input. The head is a prefix of a sequence of given size.
|
||||||
If the sequence is shorter then required, the whole string is
|
If the sequence is shorter then required, the whole string is
|
||||||
considered to be the head. The input sequence is modified in-place.
|
considered to be the head. The input sequence is modified in-place.
|
||||||
|
|
||||||
@ -730,7 +735,7 @@ namespace boost {
|
|||||||
|
|
||||||
//! Erase tail algorithm
|
//! Erase tail algorithm
|
||||||
/*!
|
/*!
|
||||||
Remove the tail from the input. The tail is a suffix of a seqence of given size.
|
Remove the tail from the input. The tail is a suffix of a sequence of given size.
|
||||||
If the sequence is shorter then required, the whole string is
|
If the sequence is shorter then required, the whole string is
|
||||||
considered to be the tail.
|
considered to be the tail.
|
||||||
The result is a modified copy of the input. It is returned as a sequence
|
The result is a modified copy of the input. It is returned as a sequence
|
||||||
@ -746,10 +751,10 @@ namespace boost {
|
|||||||
*/
|
*/
|
||||||
template<
|
template<
|
||||||
typename OutputIteratorT,
|
typename OutputIteratorT,
|
||||||
typename CollectionT>
|
typename RangeT>
|
||||||
inline OutputIteratorT erase_tail_copy(
|
inline OutputIteratorT erase_tail_copy(
|
||||||
OutputIteratorT Output,
|
OutputIteratorT Output,
|
||||||
const CollectionT& Input,
|
const RangeT& Input,
|
||||||
unsigned int N )
|
unsigned int N )
|
||||||
{
|
{
|
||||||
return find_format_copy(
|
return find_format_copy(
|
||||||
@ -776,7 +781,7 @@ namespace boost {
|
|||||||
|
|
||||||
//! Erase tail algorithm
|
//! Erase tail algorithm
|
||||||
/*!
|
/*!
|
||||||
Remove the tail from the input. The tail is a suffix of a seqence of given size.
|
Remove the tail from the input. The tail is a suffix of a sequence of given size.
|
||||||
If the sequence is shorter then required, the whole string is
|
If the sequence is shorter then required, the whole string is
|
||||||
considered to be the tail. The input sequence is modified in-place.
|
considered to be the tail. The input sequence is modified in-place.
|
||||||
|
|
||||||
|
@ -11,8 +11,14 @@
|
|||||||
#define BOOST_STRING_FIND_HPP
|
#define BOOST_STRING_FIND_HPP
|
||||||
|
|
||||||
#include <boost/algorithm/string/config.hpp>
|
#include <boost/algorithm/string/config.hpp>
|
||||||
#include <boost/algorithm/string/collection_traits.hpp>
|
|
||||||
#include <boost/algorithm/string/iterator_range.hpp>
|
#include <boost/range/iterator_range.hpp>
|
||||||
|
#include <boost/range/begin.hpp>
|
||||||
|
#include <boost/range/end.hpp>
|
||||||
|
#include <boost/range/iterator.hpp>
|
||||||
|
#include <boost/range/const_iterator.hpp>
|
||||||
|
#include <boost/range/result_iterator.hpp>
|
||||||
|
|
||||||
#include <boost/algorithm/string/finder.hpp>
|
#include <boost/algorithm/string/finder.hpp>
|
||||||
#include <boost/algorithm/string/compare.hpp>
|
#include <boost/algorithm/string/compare.hpp>
|
||||||
#include <boost/algorithm/string/constants.hpp>
|
#include <boost/algorithm/string/constants.hpp>
|
||||||
@ -36,15 +42,15 @@ namespace boost {
|
|||||||
\param Finder Finder object used for searching.
|
\param Finder Finder object used for searching.
|
||||||
\return
|
\return
|
||||||
An \c iterator_range delimiting the match.
|
An \c iterator_range delimiting the match.
|
||||||
Returned iterator is either \c CollectionT::iterator or
|
Returned iterator is either \c RangeT::iterator or
|
||||||
\c CollectionT::const_iterator, depending on the constness of
|
\c RangeT::const_iterator, depending on the constness of
|
||||||
the input parameter.
|
the input parameter.
|
||||||
*/
|
*/
|
||||||
template<typename CollectionT, typename FinderT>
|
template<typename RangeT, typename FinderT>
|
||||||
inline iterator_range<
|
inline iterator_range<
|
||||||
BOOST_STRING_TYPENAME result_iterator_of<CollectionT>::type>
|
BOOST_STRING_TYPENAME range_result_iterator<RangeT>::type>
|
||||||
find(
|
find(
|
||||||
CollectionT& Input,
|
RangeT& Input,
|
||||||
FinderT Finder)
|
FinderT Finder)
|
||||||
{
|
{
|
||||||
return Finder(begin(Input),end(Input));
|
return Finder(begin(Input),end(Input));
|
||||||
@ -60,18 +66,18 @@ namespace boost {
|
|||||||
\param Search A substring to be searched for.
|
\param Search A substring to be searched for.
|
||||||
\return
|
\return
|
||||||
An \c iterator_range delimiting the match.
|
An \c iterator_range delimiting the match.
|
||||||
Returned iterator is either \c CollectionT::iterator or
|
Returned iterator is either \c RangeT::iterator or
|
||||||
\c CollectionT::const_iterator, depending on the constness of
|
\c RangeT::const_iterator, depending on the constness of
|
||||||
the input parameter.
|
the input parameter.
|
||||||
|
|
||||||
\note This function provides the strong exception-safety guarantee
|
\note This function provides the strong exception-safety guarantee
|
||||||
*/
|
*/
|
||||||
template<typename Collection1T, typename Collection2T>
|
template<typename Range1T, typename Range2T>
|
||||||
inline iterator_range<
|
inline iterator_range<
|
||||||
BOOST_STRING_TYPENAME result_iterator_of<Collection1T>::type>
|
BOOST_STRING_TYPENAME range_result_iterator<Range1T>::type>
|
||||||
find_first(
|
find_first(
|
||||||
Collection1T& Input,
|
Range1T& Input,
|
||||||
const Collection2T& Search)
|
const Range2T& Search)
|
||||||
{
|
{
|
||||||
return first_finder(Search)(
|
return first_finder(Search)(
|
||||||
begin(Input),end(Input));
|
begin(Input),end(Input));
|
||||||
@ -87,18 +93,18 @@ namespace boost {
|
|||||||
\param Loc A locale used for case insensitive comparison
|
\param Loc A locale used for case insensitive comparison
|
||||||
\return
|
\return
|
||||||
An \c iterator_range delimiting the match.
|
An \c iterator_range delimiting the match.
|
||||||
Returned iterator is either \c Collection1T::iterator or
|
Returned iterator is either \c Range1T::iterator or
|
||||||
\c Collection1T::const_iterator, depending on the constness of
|
\c Range1T::const_iterator, depending on the constness of
|
||||||
the input parameter.
|
the input parameter.
|
||||||
|
|
||||||
\note This function provides the strong exception-safety guarantee
|
\note This function provides the strong exception-safety guarantee
|
||||||
*/
|
*/
|
||||||
template<typename Collection1T, typename Collection2T>
|
template<typename Range1T, typename Range2T>
|
||||||
inline iterator_range<
|
inline iterator_range<
|
||||||
BOOST_STRING_TYPENAME result_iterator_of<Collection1T>::type>
|
BOOST_STRING_TYPENAME range_result_iterator<Range1T>::type>
|
||||||
ifind_first(
|
ifind_first(
|
||||||
Collection1T& Input,
|
Range1T& Input,
|
||||||
const Collection2T& Search,
|
const Range2T& Search,
|
||||||
const std::locale& Loc=std::locale())
|
const std::locale& Loc=std::locale())
|
||||||
{
|
{
|
||||||
return first_finder(Search,is_iequal(Loc))(
|
return first_finder(Search,is_iequal(Loc))(
|
||||||
@ -115,18 +121,18 @@ namespace boost {
|
|||||||
\param Search A substring to be searched for.
|
\param Search A substring to be searched for.
|
||||||
\return
|
\return
|
||||||
An \c iterator_range delimiting the match.
|
An \c iterator_range delimiting the match.
|
||||||
Returned iterator is either \c Collection1T::iterator or
|
Returned iterator is either \c Range1T::iterator or
|
||||||
\c Collection1T::const_iterator, depending on the constness of
|
\c Range1T::const_iterator, depending on the constness of
|
||||||
the input parameter.
|
the input parameter.
|
||||||
|
|
||||||
\note This function provides the strong exception-safety guarantee
|
\note This function provides the strong exception-safety guarantee
|
||||||
*/
|
*/
|
||||||
template<typename Collection1T, typename Collection2T>
|
template<typename Range1T, typename Range2T>
|
||||||
inline iterator_range<
|
inline iterator_range<
|
||||||
BOOST_STRING_TYPENAME result_iterator_of<Collection1T>::type>
|
BOOST_STRING_TYPENAME range_result_iterator<Range1T>::type>
|
||||||
find_last(
|
find_last(
|
||||||
Collection1T& Input,
|
Range1T& Input,
|
||||||
const Collection2T& Search)
|
const Range2T& Search)
|
||||||
{
|
{
|
||||||
return last_finder(Search)(
|
return last_finder(Search)(
|
||||||
begin(Input),end(Input));
|
begin(Input),end(Input));
|
||||||
@ -142,18 +148,18 @@ namespace boost {
|
|||||||
\param Loc A locale used for case insensitive comparison
|
\param Loc A locale used for case insensitive comparison
|
||||||
\return
|
\return
|
||||||
An \c iterator_range delimiting the match.
|
An \c iterator_range delimiting the match.
|
||||||
Returned iterator is either \c Collection1T::iterator or
|
Returned iterator is either \c Range1T::iterator or
|
||||||
\c Collection1T::const_iterator, depending on the constness of
|
\c Range1T::const_iterator, depending on the constness of
|
||||||
the input parameter.
|
the input parameter.
|
||||||
|
|
||||||
\note This function provides the strong exception-safety guarantee
|
\note This function provides the strong exception-safety guarantee
|
||||||
*/
|
*/
|
||||||
template<typename Collection1T, typename Collection2T>
|
template<typename Range1T, typename Range2T>
|
||||||
inline iterator_range<
|
inline iterator_range<
|
||||||
BOOST_STRING_TYPENAME result_iterator_of<Collection1T>::type>
|
BOOST_STRING_TYPENAME range_result_iterator<Range1T>::type>
|
||||||
ifind_last(
|
ifind_last(
|
||||||
Collection1T& Input,
|
Range1T& Input,
|
||||||
const Collection2T& Search,
|
const Range2T& Search,
|
||||||
const std::locale& Loc=std::locale())
|
const std::locale& Loc=std::locale())
|
||||||
{
|
{
|
||||||
return last_finder(Search, is_iequal(Loc))(
|
return last_finder(Search, is_iequal(Loc))(
|
||||||
@ -172,16 +178,16 @@ namespace boost {
|
|||||||
\param Nth An index (zero-indexed) of the match to be found.
|
\param Nth An index (zero-indexed) of the match to be found.
|
||||||
\return
|
\return
|
||||||
An \c iterator_range delimiting the match.
|
An \c iterator_range delimiting the match.
|
||||||
Returned iterator is either \c Collection1T::iterator or
|
Returned iterator is either \c Range1T::iterator or
|
||||||
\c Collection1T::const_iterator, depending on the constness of
|
\c Range1T::const_iterator, depending on the constness of
|
||||||
the input parameter.
|
the input parameter.
|
||||||
*/
|
*/
|
||||||
template<typename Collection1T, typename Collection2T>
|
template<typename Range1T, typename Range2T>
|
||||||
inline iterator_range<
|
inline iterator_range<
|
||||||
BOOST_STRING_TYPENAME result_iterator_of<Collection1T>::type>
|
BOOST_STRING_TYPENAME range_result_iterator<Range1T>::type>
|
||||||
find_nth(
|
find_nth(
|
||||||
Collection1T& Input,
|
Range1T& Input,
|
||||||
const Collection2T& Search,
|
const Range2T& Search,
|
||||||
unsigned int Nth)
|
unsigned int Nth)
|
||||||
{
|
{
|
||||||
return nth_finder(Search,Nth)(
|
return nth_finder(Search,Nth)(
|
||||||
@ -199,19 +205,19 @@ namespace boost {
|
|||||||
\param Loc A locale used for case insensitive comparison
|
\param Loc A locale used for case insensitive comparison
|
||||||
\return
|
\return
|
||||||
An \c iterator_range delimiting the match.
|
An \c iterator_range delimiting the match.
|
||||||
Returned iterator is either \c Collection1T::iterator or
|
Returned iterator is either \c Range1T::iterator or
|
||||||
\c Collection1T::const_iterator, depending on the constness of
|
\c Range1T::const_iterator, depending on the constness of
|
||||||
the input parameter.
|
the input parameter.
|
||||||
|
|
||||||
|
|
||||||
\note This function provides the strong exception-safety guarantee
|
\note This function provides the strong exception-safety guarantee
|
||||||
*/
|
*/
|
||||||
template<typename Collection1T, typename Collection2T>
|
template<typename Range1T, typename Range2T>
|
||||||
inline iterator_range<
|
inline iterator_range<
|
||||||
BOOST_STRING_TYPENAME result_iterator_of<Collection1T>::type>
|
BOOST_STRING_TYPENAME range_result_iterator<Range1T>::type>
|
||||||
ifind_nth(
|
ifind_nth(
|
||||||
Collection1T& Input,
|
Range1T& Input,
|
||||||
const Collection2T& Search,
|
const Range2T& Search,
|
||||||
unsigned int Nth,
|
unsigned int Nth,
|
||||||
const std::locale& Loc=std::locale())
|
const std::locale& Loc=std::locale())
|
||||||
{
|
{
|
||||||
@ -231,17 +237,17 @@ namespace boost {
|
|||||||
\param N Length of the head
|
\param N Length of the head
|
||||||
\return
|
\return
|
||||||
An \c iterator_range delimiting the match.
|
An \c iterator_range delimiting the match.
|
||||||
Returned iterator is either \c Collection1T::iterator or
|
Returned iterator is either \c Range1T::iterator or
|
||||||
\c Collection1T::const_iterator, depending on the constness of
|
\c Range1T::const_iterator, depending on the constness of
|
||||||
the input parameter.
|
the input parameter.
|
||||||
|
|
||||||
\note This function provides the strong exception-safety guarantee
|
\note This function provides the strong exception-safety guarantee
|
||||||
*/
|
*/
|
||||||
template<typename CollectionT>
|
template<typename RangeT>
|
||||||
inline iterator_range<
|
inline iterator_range<
|
||||||
BOOST_STRING_TYPENAME result_iterator_of<CollectionT>::type>
|
BOOST_STRING_TYPENAME range_result_iterator<RangeT>::type>
|
||||||
find_head(
|
find_head(
|
||||||
CollectionT& Input,
|
RangeT& Input,
|
||||||
unsigned int N)
|
unsigned int N)
|
||||||
{
|
{
|
||||||
return head_finder(N)(
|
return head_finder(N)(
|
||||||
@ -260,18 +266,18 @@ namespace boost {
|
|||||||
\param N Length of the tail
|
\param N Length of the tail
|
||||||
\return
|
\return
|
||||||
An \c iterator_range delimiting the match.
|
An \c iterator_range delimiting the match.
|
||||||
Returned iterator is either \c CollectionT::iterator or
|
Returned iterator is either \c RangeT::iterator or
|
||||||
\c CollectionT::const_iterator, depending on the constness of
|
\c RangeT::const_iterator, depending on the constness of
|
||||||
the input parameter.
|
the input parameter.
|
||||||
|
|
||||||
|
|
||||||
\note This function provides the strong exception-safety guarantee
|
\note This function provides the strong exception-safety guarantee
|
||||||
*/
|
*/
|
||||||
template<typename CollectionT>
|
template<typename RangeT>
|
||||||
inline iterator_range<
|
inline iterator_range<
|
||||||
BOOST_STRING_TYPENAME result_iterator_of<CollectionT>::type>
|
BOOST_STRING_TYPENAME range_result_iterator<RangeT>::type>
|
||||||
find_tail(
|
find_tail(
|
||||||
CollectionT& Input,
|
RangeT& Input,
|
||||||
unsigned int N)
|
unsigned int N)
|
||||||
{
|
{
|
||||||
return tail_finder(N)(
|
return tail_finder(N)(
|
||||||
@ -291,17 +297,17 @@ namespace boost {
|
|||||||
\param eCompress Enable/Disable compressing of adjacent tokens
|
\param eCompress Enable/Disable compressing of adjacent tokens
|
||||||
\return
|
\return
|
||||||
An \c iterator_range delimiting the match.
|
An \c iterator_range delimiting the match.
|
||||||
Returned iterator is either \c CollectionT::iterator or
|
Returned iterator is either \c RangeT::iterator or
|
||||||
\c CollectionT::const_iterator, depending on the constness of
|
\c RangeT::const_iterator, depending on the constness of
|
||||||
the input parameter.
|
the input parameter.
|
||||||
|
|
||||||
\note This function provides the strong exception-safety guarantee
|
\note This function provides the strong exception-safety guarantee
|
||||||
*/
|
*/
|
||||||
template<typename CollectionT, typename PredicateT>
|
template<typename RangeT, typename PredicateT>
|
||||||
inline iterator_range<
|
inline iterator_range<
|
||||||
BOOST_STRING_TYPENAME result_iterator_of<CollectionT>::type>
|
BOOST_STRING_TYPENAME range_result_iterator<RangeT>::type>
|
||||||
find_token(
|
find_token(
|
||||||
CollectionT& Input,
|
RangeT& Input,
|
||||||
PredicateT Pred,
|
PredicateT Pred,
|
||||||
token_compress_mode_type eCompress=token_compress_off)
|
token_compress_mode_type eCompress=token_compress_off)
|
||||||
{
|
{
|
||||||
|
@ -12,8 +12,11 @@
|
|||||||
|
|
||||||
#include <deque>
|
#include <deque>
|
||||||
#include <boost/detail/iterator.hpp>
|
#include <boost/detail/iterator.hpp>
|
||||||
#include <boost/algorithm/string/collection_traits.hpp>
|
#include <boost/range/iterator_range.hpp>
|
||||||
#include <boost/algorithm/string/iterator_range.hpp>
|
#include <boost/range/begin.hpp>
|
||||||
|
#include <boost/range/end.hpp>
|
||||||
|
#include <boost/range/const_iterator.hpp>
|
||||||
|
|
||||||
#include <boost/algorithm/string/concept.hpp>
|
#include <boost/algorithm/string/concept.hpp>
|
||||||
#include <boost/algorithm/string/detail/find_format.hpp>
|
#include <boost/algorithm/string/detail/find_format.hpp>
|
||||||
#include <boost/algorithm/string/detail/find_format_all.hpp>
|
#include <boost/algorithm/string/detail/find_format_all.hpp>
|
||||||
@ -47,23 +50,23 @@ namespace boost {
|
|||||||
*/
|
*/
|
||||||
template<
|
template<
|
||||||
typename OutputIteratorT,
|
typename OutputIteratorT,
|
||||||
typename CollectionT,
|
typename RangeT,
|
||||||
typename FinderT,
|
typename FinderT,
|
||||||
typename FormatterT>
|
typename FormatterT>
|
||||||
inline OutputIteratorT find_format_copy(
|
inline OutputIteratorT find_format_copy(
|
||||||
OutputIteratorT Output,
|
OutputIteratorT Output,
|
||||||
const CollectionT& Input,
|
const RangeT& Input,
|
||||||
FinderT Finder,
|
FinderT Finder,
|
||||||
FormatterT Formatter )
|
FormatterT Formatter )
|
||||||
{
|
{
|
||||||
// Concept check
|
// Concept check
|
||||||
function_requires<
|
function_requires<
|
||||||
FinderConcept<FinderT,
|
FinderConcept<FinderT,
|
||||||
BOOST_STRING_TYPENAME const_iterator_of<CollectionT>::type> >();
|
BOOST_STRING_TYPENAME range_const_iterator<RangeT>::type> >();
|
||||||
function_requires<
|
function_requires<
|
||||||
FormatterConcept<
|
FormatterConcept<
|
||||||
FormatterT,
|
FormatterT,
|
||||||
FinderT,BOOST_STRING_TYPENAME const_iterator_of<CollectionT>::type> >();
|
FinderT,BOOST_STRING_TYPENAME range_const_iterator<RangeT>::type> >();
|
||||||
|
|
||||||
return detail::find_format_copy_impl(
|
return detail::find_format_copy_impl(
|
||||||
Output,
|
Output,
|
||||||
@ -89,11 +92,11 @@ namespace boost {
|
|||||||
// Concept check
|
// Concept check
|
||||||
function_requires<
|
function_requires<
|
||||||
FinderConcept<FinderT,
|
FinderConcept<FinderT,
|
||||||
BOOST_STRING_TYPENAME const_iterator_of<SequenceT>::type> >();
|
BOOST_STRING_TYPENAME range_const_iterator<SequenceT>::type> >();
|
||||||
function_requires<
|
function_requires<
|
||||||
FormatterConcept<
|
FormatterConcept<
|
||||||
FormatterT,
|
FormatterT,
|
||||||
FinderT,BOOST_STRING_TYPENAME const_iterator_of<SequenceT>::type> >();
|
FinderT,BOOST_STRING_TYPENAME range_const_iterator<SequenceT>::type> >();
|
||||||
|
|
||||||
return detail::find_format_copy_impl(
|
return detail::find_format_copy_impl(
|
||||||
Input,
|
Input,
|
||||||
@ -123,11 +126,11 @@ namespace boost {
|
|||||||
// Concept check
|
// Concept check
|
||||||
function_requires<
|
function_requires<
|
||||||
FinderConcept<FinderT,
|
FinderConcept<FinderT,
|
||||||
BOOST_STRING_TYPENAME const_iterator_of<SequenceT>::type> >();
|
BOOST_STRING_TYPENAME range_const_iterator<SequenceT>::type> >();
|
||||||
function_requires<
|
function_requires<
|
||||||
FormatterConcept<
|
FormatterConcept<
|
||||||
FormatterT,
|
FormatterT,
|
||||||
FinderT,BOOST_STRING_TYPENAME const_iterator_of<SequenceT>::type> >();
|
FinderT,BOOST_STRING_TYPENAME range_const_iterator<SequenceT>::type> >();
|
||||||
|
|
||||||
detail::find_format_impl(
|
detail::find_format_impl(
|
||||||
Input,
|
Input,
|
||||||
@ -158,23 +161,23 @@ namespace boost {
|
|||||||
*/
|
*/
|
||||||
template<
|
template<
|
||||||
typename OutputIteratorT,
|
typename OutputIteratorT,
|
||||||
typename CollectionT,
|
typename RangeT,
|
||||||
typename FinderT,
|
typename FinderT,
|
||||||
typename FormatterT>
|
typename FormatterT>
|
||||||
inline OutputIteratorT find_format_all_copy(
|
inline OutputIteratorT find_format_all_copy(
|
||||||
OutputIteratorT Output,
|
OutputIteratorT Output,
|
||||||
const CollectionT& Input,
|
const RangeT& Input,
|
||||||
FinderT Finder,
|
FinderT Finder,
|
||||||
FormatterT Formatter)
|
FormatterT Formatter)
|
||||||
{
|
{
|
||||||
// Concept check
|
// Concept check
|
||||||
function_requires<
|
function_requires<
|
||||||
FinderConcept<FinderT,
|
FinderConcept<FinderT,
|
||||||
BOOST_STRING_TYPENAME const_iterator_of<CollectionT>::type> >();
|
BOOST_STRING_TYPENAME range_const_iterator<RangeT>::type> >();
|
||||||
function_requires<
|
function_requires<
|
||||||
FormatterConcept<
|
FormatterConcept<
|
||||||
FormatterT,
|
FormatterT,
|
||||||
FinderT,BOOST_STRING_TYPENAME const_iterator_of<CollectionT>::type> >();
|
FinderT,BOOST_STRING_TYPENAME range_const_iterator<RangeT>::type> >();
|
||||||
|
|
||||||
return detail::find_format_all_copy_impl(
|
return detail::find_format_all_copy_impl(
|
||||||
Output,
|
Output,
|
||||||
@ -200,11 +203,11 @@ namespace boost {
|
|||||||
// Concept check
|
// Concept check
|
||||||
function_requires<
|
function_requires<
|
||||||
FinderConcept<FinderT,
|
FinderConcept<FinderT,
|
||||||
BOOST_STRING_TYPENAME const_iterator_of<SequenceT>::type> >();
|
BOOST_STRING_TYPENAME range_const_iterator<SequenceT>::type> >();
|
||||||
function_requires<
|
function_requires<
|
||||||
FormatterConcept<
|
FormatterConcept<
|
||||||
FormatterT,
|
FormatterT,
|
||||||
FinderT,BOOST_STRING_TYPENAME const_iterator_of<SequenceT>::type> >();
|
FinderT,BOOST_STRING_TYPENAME range_const_iterator<SequenceT>::type> >();
|
||||||
|
|
||||||
return detail::find_format_all_copy_impl(
|
return detail::find_format_all_copy_impl(
|
||||||
Input,
|
Input,
|
||||||
@ -235,11 +238,11 @@ namespace boost {
|
|||||||
// Concept check
|
// Concept check
|
||||||
function_requires<
|
function_requires<
|
||||||
FinderConcept<FinderT,
|
FinderConcept<FinderT,
|
||||||
BOOST_STRING_TYPENAME const_iterator_of<SequenceT>::type> >();
|
BOOST_STRING_TYPENAME range_const_iterator<SequenceT>::type> >();
|
||||||
function_requires<
|
function_requires<
|
||||||
FormatterConcept<
|
FormatterConcept<
|
||||||
FormatterT,
|
FormatterT,
|
||||||
FinderT,BOOST_STRING_TYPENAME const_iterator_of<SequenceT>::type> >();
|
FinderT,BOOST_STRING_TYPENAME range_const_iterator<SequenceT>::type> >();
|
||||||
|
|
||||||
detail::find_format_all_impl(
|
detail::find_format_all_impl(
|
||||||
Input,
|
Input,
|
||||||
|
@ -9,14 +9,17 @@
|
|||||||
#ifndef BOOST_STRING_FIND_ITERATOR_HPP
|
#ifndef BOOST_STRING_FIND_ITERATOR_HPP
|
||||||
#define BOOST_STRING_FIND_ITERATOR_HPP
|
#define BOOST_STRING_FIND_ITERATOR_HPP
|
||||||
|
|
||||||
|
|
||||||
#include <boost/algorithm/string/config.hpp>
|
#include <boost/algorithm/string/config.hpp>
|
||||||
#include <boost/algorithm/string/collection_traits.hpp>
|
|
||||||
#include <boost/algorithm/string/iterator_range.hpp>
|
|
||||||
#include <boost/algorithm/string/detail/find_iterator.hpp>
|
|
||||||
#include <boost/iterator/iterator_facade.hpp>
|
#include <boost/iterator/iterator_facade.hpp>
|
||||||
#include <boost/iterator/iterator_categories.hpp>
|
#include <boost/iterator/iterator_categories.hpp>
|
||||||
|
|
||||||
|
#include <boost/range/iterator_range.hpp>
|
||||||
|
#include <boost/range/begin.hpp>
|
||||||
|
#include <boost/range/end.hpp>
|
||||||
|
#include <boost/range/result_iterator.hpp>
|
||||||
|
|
||||||
|
#include <boost/algorithm/string/detail/find_iterator.hpp>
|
||||||
|
|
||||||
/*! \file
|
/*! \file
|
||||||
Defines find iterator classes. Find iterator repeatly applies a Finder
|
Defines find iterator classes. Find iterator repeatly applies a Finder
|
||||||
to the specified input string to search for matches. Dereferencing
|
to the specified input string to search for matches. Dereferencing
|
||||||
@ -105,11 +108,11 @@ namespace boost {
|
|||||||
//! Constructor
|
//! Constructor
|
||||||
/*!
|
/*!
|
||||||
Construct new find_iterator for a given finder
|
Construct new find_iterator for a given finder
|
||||||
and a collection.
|
and a range.
|
||||||
*/
|
*/
|
||||||
template<typename FinderT, typename CollectionT>
|
template<typename FinderT, typename RangeT>
|
||||||
find_iterator(
|
find_iterator(
|
||||||
CollectionT& Col,
|
RangeT& Col,
|
||||||
FinderT Finder ) :
|
FinderT Finder ) :
|
||||||
detail::find_iterator_base<IteratorT>(Finder,0),
|
detail::find_iterator_base<IteratorT>(Finder,0),
|
||||||
m_Match(begin(Col),begin(Col)),
|
m_Match(begin(Col),begin(Col)),
|
||||||
@ -175,14 +178,14 @@ namespace boost {
|
|||||||
/*!
|
/*!
|
||||||
* Construct a find iterator to iterate through the specified string
|
* Construct a find iterator to iterate through the specified string
|
||||||
*/
|
*/
|
||||||
template<typename CollectionT, typename FinderT>
|
template<typename RangeT, typename FinderT>
|
||||||
inline find_iterator<
|
inline find_iterator<
|
||||||
BOOST_STRING_TYPENAME result_iterator_of<CollectionT>::type>
|
BOOST_STRING_TYPENAME range_result_iterator<RangeT>::type>
|
||||||
make_find_iterator(
|
make_find_iterator(
|
||||||
CollectionT& Collection,
|
RangeT& Collection,
|
||||||
FinderT Finder)
|
FinderT Finder)
|
||||||
{
|
{
|
||||||
return find_iterator<BOOST_STRING_TYPENAME result_iterator_of<CollectionT>::type>(
|
return find_iterator<BOOST_STRING_TYPENAME range_result_iterator<RangeT>::type>(
|
||||||
begin(Collection), end(Collection), Finder);
|
begin(Collection), end(Collection), Finder);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -243,7 +246,9 @@ namespace boost {
|
|||||||
base_type(Other),
|
base_type(Other),
|
||||||
m_Match(Other.m_Match),
|
m_Match(Other.m_Match),
|
||||||
m_Next(Other.m_Next),
|
m_Next(Other.m_Next),
|
||||||
m_End(Other.m_End) {}
|
m_End(Other.m_End),
|
||||||
|
m_bEof(false)
|
||||||
|
{}
|
||||||
|
|
||||||
//! Constructor
|
//! Constructor
|
||||||
/*!
|
/*!
|
||||||
@ -258,7 +263,8 @@ namespace boost {
|
|||||||
detail::find_iterator_base<IteratorT>(Finder,0),
|
detail::find_iterator_base<IteratorT>(Finder,0),
|
||||||
m_Match(Begin,Begin),
|
m_Match(Begin,Begin),
|
||||||
m_Next(Begin),
|
m_Next(Begin),
|
||||||
m_End(End)
|
m_End(End),
|
||||||
|
m_bEof(false)
|
||||||
{
|
{
|
||||||
increment();
|
increment();
|
||||||
}
|
}
|
||||||
@ -267,14 +273,15 @@ namespace boost {
|
|||||||
Construct new split_iterator for a given finder
|
Construct new split_iterator for a given finder
|
||||||
and a collection.
|
and a collection.
|
||||||
*/
|
*/
|
||||||
template<typename FinderT, typename CollectionT>
|
template<typename FinderT, typename RangeT>
|
||||||
split_iterator(
|
split_iterator(
|
||||||
CollectionT& Col,
|
RangeT& Col,
|
||||||
FinderT Finder ) :
|
FinderT Finder ) :
|
||||||
detail::find_iterator_base<IteratorT>(Finder,0),
|
detail::find_iterator_base<IteratorT>(Finder,0),
|
||||||
m_Match(begin(Col),begin(Col)),
|
m_Match(begin(Col),begin(Col)),
|
||||||
m_Next(begin(Col)),
|
m_Next(begin(Col)),
|
||||||
m_End(end(Col))
|
m_End(end(Col)),
|
||||||
|
m_bEof(false)
|
||||||
{
|
{
|
||||||
increment();
|
increment();
|
||||||
}
|
}
|
||||||
@ -293,6 +300,16 @@ namespace boost {
|
|||||||
void increment()
|
void increment()
|
||||||
{
|
{
|
||||||
match_type FindMatch=this->do_find( m_Next, m_End );
|
match_type FindMatch=this->do_find( m_Next, m_End );
|
||||||
|
|
||||||
|
if(FindMatch.begin()==m_End && FindMatch.end()==m_End)
|
||||||
|
{
|
||||||
|
if(m_Match.end()==m_End)
|
||||||
|
{
|
||||||
|
// Mark iterator as eof
|
||||||
|
m_bEof=true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
m_Match=match_type( m_Next, FindMatch.begin() );
|
m_Match=match_type( m_Next, FindMatch.begin() );
|
||||||
m_Next=FindMatch.end();
|
m_Next=FindMatch.end();
|
||||||
}
|
}
|
||||||
@ -322,12 +339,7 @@ namespace boost {
|
|||||||
*/
|
*/
|
||||||
bool eof() const
|
bool eof() const
|
||||||
{
|
{
|
||||||
return
|
return this->is_null() || m_bEof;
|
||||||
this->is_null() ||
|
|
||||||
(
|
|
||||||
m_Match.begin() == m_End &&
|
|
||||||
m_Match.end() == m_End
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -335,20 +347,21 @@ namespace boost {
|
|||||||
match_type m_Match;
|
match_type m_Match;
|
||||||
input_iterator_type m_Next;
|
input_iterator_type m_Next;
|
||||||
input_iterator_type m_End;
|
input_iterator_type m_End;
|
||||||
|
bool m_bEof;
|
||||||
};
|
};
|
||||||
|
|
||||||
//! split iterator construction helper
|
//! split iterator construction helper
|
||||||
/*!
|
/*!
|
||||||
* Construct a split iterator to iterate through the specified collection
|
* Construct a split iterator to iterate through the specified collection
|
||||||
*/
|
*/
|
||||||
template<typename CollectionT, typename FinderT>
|
template<typename RangeT, typename FinderT>
|
||||||
inline split_iterator<
|
inline split_iterator<
|
||||||
BOOST_STRING_TYPENAME result_iterator_of<CollectionT>::type>
|
BOOST_STRING_TYPENAME range_result_iterator<RangeT>::type>
|
||||||
make_split_iterator(
|
make_split_iterator(
|
||||||
CollectionT& Collection,
|
RangeT& Collection,
|
||||||
FinderT Finder)
|
FinderT Finder)
|
||||||
{
|
{
|
||||||
return split_iterator<BOOST_STRING_TYPENAME result_iterator_of<CollectionT>::type>(
|
return split_iterator<BOOST_STRING_TYPENAME range_result_iterator<RangeT>::type>(
|
||||||
begin(Collection), end(Collection), Finder);
|
begin(Collection), end(Collection), Finder);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,9 +11,14 @@
|
|||||||
#define BOOST_STRING_FINDER_HPP
|
#define BOOST_STRING_FINDER_HPP
|
||||||
|
|
||||||
#include <boost/algorithm/string/config.hpp>
|
#include <boost/algorithm/string/config.hpp>
|
||||||
|
|
||||||
|
#include <boost/range/iterator_range.hpp>
|
||||||
|
#include <boost/range/begin.hpp>
|
||||||
|
#include <boost/range/end.hpp>
|
||||||
|
#include <boost/range/iterator.hpp>
|
||||||
|
#include <boost/range/const_iterator.hpp>
|
||||||
|
|
||||||
#include <boost/algorithm/string/constants.hpp>
|
#include <boost/algorithm/string/constants.hpp>
|
||||||
#include <boost/algorithm/string/collection_traits.hpp>
|
|
||||||
#include <boost/algorithm/string/iterator_range.hpp>
|
|
||||||
#include <boost/algorithm/string/detail/finder.hpp>
|
#include <boost/algorithm/string/detail/finder.hpp>
|
||||||
#include <boost/algorithm/string/compare.hpp>
|
#include <boost/algorithm/string/compare.hpp>
|
||||||
|
|
||||||
@ -42,14 +47,14 @@ namespace boost {
|
|||||||
*/
|
*/
|
||||||
template<typename ContainerT>
|
template<typename ContainerT>
|
||||||
inline detail::first_finderF<
|
inline detail::first_finderF<
|
||||||
BOOST_STRING_TYPENAME const_iterator_of<ContainerT>::type,
|
BOOST_STRING_TYPENAME range_const_iterator<ContainerT>::type,
|
||||||
is_equal>
|
is_equal>
|
||||||
first_finder( const ContainerT& Search )
|
first_finder( const ContainerT& Search )
|
||||||
{
|
{
|
||||||
return
|
return
|
||||||
detail::first_finderF<
|
detail::first_finderF<
|
||||||
BOOST_STRING_TYPENAME
|
BOOST_STRING_TYPENAME
|
||||||
const_iterator_of<ContainerT>::type,
|
range_const_iterator<ContainerT>::type,
|
||||||
is_equal>( Search, is_equal() ) ;
|
is_equal>( Search, is_equal() ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -59,7 +64,7 @@ namespace boost {
|
|||||||
*/
|
*/
|
||||||
template<typename ContainerT,typename PredicateT>
|
template<typename ContainerT,typename PredicateT>
|
||||||
inline detail::first_finderF<
|
inline detail::first_finderF<
|
||||||
BOOST_STRING_TYPENAME const_iterator_of<ContainerT>::type,
|
BOOST_STRING_TYPENAME range_const_iterator<ContainerT>::type,
|
||||||
PredicateT>
|
PredicateT>
|
||||||
first_finder(
|
first_finder(
|
||||||
const ContainerT& Search, PredicateT Comp )
|
const ContainerT& Search, PredicateT Comp )
|
||||||
@ -67,7 +72,7 @@ namespace boost {
|
|||||||
return
|
return
|
||||||
detail::first_finderF<
|
detail::first_finderF<
|
||||||
BOOST_STRING_TYPENAME
|
BOOST_STRING_TYPENAME
|
||||||
const_iterator_of<ContainerT>::type,
|
range_const_iterator<ContainerT>::type,
|
||||||
PredicateT>( Search, Comp );
|
PredicateT>( Search, Comp );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,14 +88,14 @@ namespace boost {
|
|||||||
*/
|
*/
|
||||||
template<typename ContainerT>
|
template<typename ContainerT>
|
||||||
inline detail::last_finderF<
|
inline detail::last_finderF<
|
||||||
BOOST_STRING_TYPENAME const_iterator_of<ContainerT>::type,
|
BOOST_STRING_TYPENAME range_const_iterator<ContainerT>::type,
|
||||||
is_equal>
|
is_equal>
|
||||||
last_finder( const ContainerT& Search )
|
last_finder( const ContainerT& Search )
|
||||||
{
|
{
|
||||||
return
|
return
|
||||||
detail::last_finderF<
|
detail::last_finderF<
|
||||||
BOOST_STRING_TYPENAME
|
BOOST_STRING_TYPENAME
|
||||||
const_iterator_of<ContainerT>::type,
|
range_const_iterator<ContainerT>::type,
|
||||||
is_equal>( Search, is_equal() );
|
is_equal>( Search, is_equal() );
|
||||||
}
|
}
|
||||||
//! "Last" finder
|
//! "Last" finder
|
||||||
@ -99,14 +104,14 @@ namespace boost {
|
|||||||
*/
|
*/
|
||||||
template<typename ContainerT, typename PredicateT>
|
template<typename ContainerT, typename PredicateT>
|
||||||
inline detail::last_finderF<
|
inline detail::last_finderF<
|
||||||
BOOST_STRING_TYPENAME const_iterator_of<ContainerT>::type,
|
BOOST_STRING_TYPENAME range_const_iterator<ContainerT>::type,
|
||||||
PredicateT>
|
PredicateT>
|
||||||
last_finder( const ContainerT& Search, PredicateT Comp )
|
last_finder( const ContainerT& Search, PredicateT Comp )
|
||||||
{
|
{
|
||||||
return
|
return
|
||||||
detail::last_finderF<
|
detail::last_finderF<
|
||||||
BOOST_STRING_TYPENAME
|
BOOST_STRING_TYPENAME
|
||||||
const_iterator_of<ContainerT>::type,
|
range_const_iterator<ContainerT>::type,
|
||||||
PredicateT>( Search, Comp ) ;
|
PredicateT>( Search, Comp ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -123,7 +128,7 @@ namespace boost {
|
|||||||
*/
|
*/
|
||||||
template<typename ContainerT>
|
template<typename ContainerT>
|
||||||
inline detail::nth_finderF<
|
inline detail::nth_finderF<
|
||||||
BOOST_STRING_TYPENAME const_iterator_of<ContainerT>::type,
|
BOOST_STRING_TYPENAME range_const_iterator<ContainerT>::type,
|
||||||
is_equal>
|
is_equal>
|
||||||
nth_finder(
|
nth_finder(
|
||||||
const ContainerT& Search,
|
const ContainerT& Search,
|
||||||
@ -132,7 +137,7 @@ namespace boost {
|
|||||||
return
|
return
|
||||||
detail::nth_finderF<
|
detail::nth_finderF<
|
||||||
BOOST_STRING_TYPENAME
|
BOOST_STRING_TYPENAME
|
||||||
const_iterator_of<ContainerT>::type,
|
range_const_iterator<ContainerT>::type,
|
||||||
is_equal>( Search, Nth, is_equal() ) ;
|
is_equal>( Search, Nth, is_equal() ) ;
|
||||||
}
|
}
|
||||||
//! "Nth" finder
|
//! "Nth" finder
|
||||||
@ -141,7 +146,7 @@ namespace boost {
|
|||||||
*/
|
*/
|
||||||
template<typename ContainerT, typename PredicateT>
|
template<typename ContainerT, typename PredicateT>
|
||||||
inline detail::nth_finderF<
|
inline detail::nth_finderF<
|
||||||
BOOST_STRING_TYPENAME const_iterator_of<ContainerT>::type,
|
BOOST_STRING_TYPENAME range_const_iterator<ContainerT>::type,
|
||||||
PredicateT>
|
PredicateT>
|
||||||
nth_finder(
|
nth_finder(
|
||||||
const ContainerT& Search,
|
const ContainerT& Search,
|
||||||
@ -151,7 +156,7 @@ namespace boost {
|
|||||||
return
|
return
|
||||||
detail::nth_finderF<
|
detail::nth_finderF<
|
||||||
BOOST_STRING_TYPENAME
|
BOOST_STRING_TYPENAME
|
||||||
const_iterator_of<ContainerT>::type,
|
range_const_iterator<ContainerT>::type,
|
||||||
PredicateT>( Search, Nth, Comp );
|
PredicateT>( Search, Nth, Comp );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,8 +11,9 @@
|
|||||||
#define BOOST_STRING_FORMATTER_HPP
|
#define BOOST_STRING_FORMATTER_HPP
|
||||||
|
|
||||||
#include <boost/detail/iterator.hpp>
|
#include <boost/detail/iterator.hpp>
|
||||||
#include <boost/algorithm/string/collection_traits.hpp>
|
#include <boost/range/value_type.hpp>
|
||||||
#include <boost/algorithm/string/iterator_range.hpp>
|
#include <boost/range/iterator_range.hpp>
|
||||||
|
|
||||||
#include <boost/algorithm/string/detail/formatter.hpp>
|
#include <boost/algorithm/string/detail/formatter.hpp>
|
||||||
|
|
||||||
/*! \file
|
/*! \file
|
||||||
@ -29,7 +30,7 @@
|
|||||||
namespace boost {
|
namespace boost {
|
||||||
namespace algorithm {
|
namespace algorithm {
|
||||||
|
|
||||||
// generic formaters ---------------------------------------------------------------//
|
// generic formatters ---------------------------------------------------------------//
|
||||||
|
|
||||||
//! Constant formatter
|
//! Constant formatter
|
||||||
/*!
|
/*!
|
||||||
@ -39,11 +40,11 @@ namespace boost {
|
|||||||
\param Format A predefined value used as a result for formating
|
\param Format A predefined value used as a result for formating
|
||||||
\return An instance of the \c const_formatter object.
|
\return An instance of the \c const_formatter object.
|
||||||
*/
|
*/
|
||||||
template<typename CollectionT>
|
template<typename RangeT>
|
||||||
inline detail::const_formatF<CollectionT>
|
inline detail::const_formatF<RangeT>
|
||||||
const_formatter(const CollectionT& Format)
|
const_formatter(const RangeT& Format)
|
||||||
{
|
{
|
||||||
return detail::const_formatF<CollectionT>(Format);
|
return detail::const_formatF<RangeT>(Format);
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Identity formatter
|
//! Identity formatter
|
||||||
@ -53,29 +54,29 @@ namespace boost {
|
|||||||
|
|
||||||
\return An instance of the \c identity_formatter object.
|
\return An instance of the \c identity_formatter object.
|
||||||
*/
|
*/
|
||||||
template<typename CollectionT>
|
template<typename RangeT>
|
||||||
inline detail::identity_formatF<CollectionT>
|
inline detail::identity_formatF<RangeT>
|
||||||
identity_formatter()
|
identity_formatter()
|
||||||
{
|
{
|
||||||
return detail::identity_formatF<CollectionT>();
|
return detail::identity_formatF<RangeT>();
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Empty formatter
|
//! Empty formatter
|
||||||
/*!
|
/*!
|
||||||
Construct the \c empty_formatter. Empty formater always returns an empty
|
Construct the \c empty_formatter. Empty formatter always returns an empty
|
||||||
sequence.
|
sequence.
|
||||||
|
|
||||||
\param Input container used to select a correct value_type for the
|
\param Input container used to select a correct value_type for the
|
||||||
resulting empty_container<>.
|
resulting empty_container<>.
|
||||||
\return An instance of the \c empty_formatter object.
|
\return An instance of the \c empty_formatter object.
|
||||||
*/
|
*/
|
||||||
template<typename CollectionT>
|
template<typename RangeT>
|
||||||
inline detail::empty_formatF<
|
inline detail::empty_formatF<
|
||||||
BOOST_STRING_TYPENAME value_type_of<CollectionT>::type>
|
BOOST_STRING_TYPENAME range_value<RangeT>::type>
|
||||||
empty_formatter(const CollectionT&)
|
empty_formatter(const RangeT&)
|
||||||
{
|
{
|
||||||
return detail::empty_formatF<
|
return detail::empty_formatF<
|
||||||
BOOST_STRING_TYPENAME value_type_of<CollectionT>::type>();
|
BOOST_STRING_TYPENAME range_value<RangeT>::type>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -14,8 +14,13 @@
|
|||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
#include <boost/iterator/transform_iterator.hpp>
|
#include <boost/iterator/transform_iterator.hpp>
|
||||||
#include <boost/algorithm/string/collection_traits.hpp>
|
|
||||||
#include <boost/algorithm/string/iterator_range.hpp>
|
#include <boost/range/iterator_range.hpp>
|
||||||
|
#include <boost/range/begin.hpp>
|
||||||
|
#include <boost/range/end.hpp>
|
||||||
|
#include <boost/range/result_iterator.hpp>
|
||||||
|
#include <boost/range/value_type.hpp>
|
||||||
|
|
||||||
#include <boost/algorithm/string/concept.hpp>
|
#include <boost/algorithm/string/concept.hpp>
|
||||||
#include <boost/algorithm/string/find_iterator.hpp>
|
#include <boost/algorithm/string/find_iterator.hpp>
|
||||||
#include <boost/algorithm/string/detail/util.hpp>
|
#include <boost/algorithm/string/detail/util.hpp>
|
||||||
@ -59,24 +64,24 @@ namespace boost {
|
|||||||
*/
|
*/
|
||||||
template<
|
template<
|
||||||
typename SequenceSequenceT,
|
typename SequenceSequenceT,
|
||||||
typename CollectionT,
|
typename RangeT,
|
||||||
typename FinderT >
|
typename FinderT >
|
||||||
inline SequenceSequenceT&
|
inline SequenceSequenceT&
|
||||||
iter_find(
|
iter_find(
|
||||||
SequenceSequenceT& Result,
|
SequenceSequenceT& Result,
|
||||||
CollectionT& Input,
|
RangeT& Input,
|
||||||
FinderT Finder )
|
FinderT Finder )
|
||||||
{
|
{
|
||||||
function_requires<
|
function_requires<
|
||||||
FinderConcept<FinderT,
|
FinderConcept<FinderT,
|
||||||
BOOST_STRING_TYPENAME result_iterator_of<CollectionT>::type> >();
|
BOOST_STRING_TYPENAME range_result_iterator<RangeT>::type> >();
|
||||||
|
|
||||||
typedef BOOST_STRING_TYPENAME
|
typedef BOOST_STRING_TYPENAME
|
||||||
result_iterator_of<CollectionT>::type input_iterator_type;
|
range_result_iterator<RangeT>::type input_iterator_type;
|
||||||
typedef find_iterator<input_iterator_type> find_iterator_type;
|
typedef find_iterator<input_iterator_type> find_iterator_type;
|
||||||
typedef detail::copy_iterator_rangeF<
|
typedef detail::copy_iterator_rangeF<
|
||||||
BOOST_STRING_TYPENAME
|
BOOST_STRING_TYPENAME
|
||||||
value_type_of<SequenceSequenceT>::type,
|
range_value<SequenceSequenceT>::type,
|
||||||
input_iterator_type> copy_range_type;
|
input_iterator_type> copy_range_type;
|
||||||
|
|
||||||
input_iterator_type InputEnd=end(Input);
|
input_iterator_type InputEnd=end(Input);
|
||||||
@ -126,24 +131,24 @@ namespace boost {
|
|||||||
*/
|
*/
|
||||||
template<
|
template<
|
||||||
typename SequenceSequenceT,
|
typename SequenceSequenceT,
|
||||||
typename CollectionT,
|
typename RangeT,
|
||||||
typename FinderT >
|
typename FinderT >
|
||||||
inline SequenceSequenceT&
|
inline SequenceSequenceT&
|
||||||
iter_split(
|
iter_split(
|
||||||
SequenceSequenceT& Result,
|
SequenceSequenceT& Result,
|
||||||
CollectionT& Input,
|
RangeT& Input,
|
||||||
FinderT Finder )
|
FinderT Finder )
|
||||||
{
|
{
|
||||||
function_requires<
|
function_requires<
|
||||||
FinderConcept<FinderT,
|
FinderConcept<FinderT,
|
||||||
BOOST_STRING_TYPENAME result_iterator_of<CollectionT>::type> >();
|
BOOST_STRING_TYPENAME range_result_iterator<RangeT>::type> >();
|
||||||
|
|
||||||
typedef BOOST_STRING_TYPENAME
|
typedef BOOST_STRING_TYPENAME
|
||||||
result_iterator_of<CollectionT>::type input_iterator_type;
|
range_result_iterator<RangeT>::type input_iterator_type;
|
||||||
typedef split_iterator<input_iterator_type> find_iterator_type;
|
typedef split_iterator<input_iterator_type> find_iterator_type;
|
||||||
typedef detail::copy_iterator_rangeF<
|
typedef detail::copy_iterator_rangeF<
|
||||||
BOOST_STRING_TYPENAME
|
BOOST_STRING_TYPENAME
|
||||||
value_type_of<SequenceSequenceT>::type,
|
range_value<SequenceSequenceT>::type,
|
||||||
input_iterator_type> copy_range_type;
|
input_iterator_type> copy_range_type;
|
||||||
|
|
||||||
input_iterator_type InputEnd=end(Input);
|
input_iterator_type InputEnd=end(Input);
|
||||||
|
@ -1,296 +0,0 @@
|
|||||||
// Boost string_algo library iterator_range.hpp header file ---------------------------//
|
|
||||||
|
|
||||||
// Copyright Pavol Droba 2002-2003. Use, modification and
|
|
||||||
// distribution is subject to the Boost Software License, Version
|
|
||||||
// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
|
||||||
// http://www.boost.org/LICENSE_1_0.txt)
|
|
||||||
|
|
||||||
// See http://www.boost.org for updates, documentation, and revision history.
|
|
||||||
|
|
||||||
#ifndef BOOST_STRING_ITERATOR_RANGE_HPP
|
|
||||||
#define BOOST_STRING_ITERATOR_RANGE_HPP
|
|
||||||
|
|
||||||
#include <boost/algorithm/string/config.hpp>
|
|
||||||
#include <utility>
|
|
||||||
#include <iterator>
|
|
||||||
#include <algorithm>
|
|
||||||
#include <ostream>
|
|
||||||
#include <boost/detail/iterator.hpp>
|
|
||||||
|
|
||||||
/*! \file
|
|
||||||
Defines the \c iterator_class and related functions.
|
|
||||||
\c iterator_range is a simple wrapper of the iterator pair idiom. It provides
|
|
||||||
a rich subset of the Container interface.
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace boost {
|
|
||||||
namespace algorithm {
|
|
||||||
|
|
||||||
// iterator range template class -----------------------------------------//
|
|
||||||
|
|
||||||
//! iterator_range class
|
|
||||||
/*!
|
|
||||||
An \c iterator_range delimits a range in a sequence by beginning and ending iterators.
|
|
||||||
An iterator_range can be passed to an algorithm which requires a sequence as an input.
|
|
||||||
For example, the \c toupper() function may most frequently be used on strings,
|
|
||||||
but can also be used on iterator_ranges:
|
|
||||||
|
|
||||||
\code
|
|
||||||
boost::tolower( find( s, "UPPERCASE STRING" ) );
|
|
||||||
\endcode
|
|
||||||
|
|
||||||
Many algorithms working with sequences take a pair of iterators,
|
|
||||||
delimiting a working range, as arguments. The \c iterator_range class is an
|
|
||||||
encapsulation of a range identified by a pair of iterators.
|
|
||||||
It provides a collection interface,
|
|
||||||
so it is possible to pass an instance to an algorithm requiring a collection as an input.
|
|
||||||
*/
|
|
||||||
template<typename IteratorT>
|
|
||||||
class iterator_range
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
//! this type
|
|
||||||
typedef iterator_range<IteratorT> type;
|
|
||||||
//! Encapsulated value type
|
|
||||||
typedef BOOST_STRING_TYPENAME boost::detail::
|
|
||||||
iterator_traits<IteratorT>::value_type value_type;
|
|
||||||
//! Reference type
|
|
||||||
typedef BOOST_STRING_TYPENAME boost::detail::
|
|
||||||
iterator_traits<IteratorT>::reference reference;
|
|
||||||
//! Difference type
|
|
||||||
typedef BOOST_STRING_TYPENAME boost::detail::
|
|
||||||
iterator_traits<IteratorT>::difference_type difference_type;
|
|
||||||
//! Size type
|
|
||||||
typedef BOOST_STRING_TYPENAME boost::detail::
|
|
||||||
iterator_traits<IteratorT>::difference_type size_type;
|
|
||||||
|
|
||||||
//! const_iterator type
|
|
||||||
/*!
|
|
||||||
There is no distinction between const_iterator and iterator.
|
|
||||||
These typedefs are provides to fulfill container interface
|
|
||||||
*/
|
|
||||||
typedef IteratorT const_iterator;
|
|
||||||
//! iterator type
|
|
||||||
typedef IteratorT iterator;
|
|
||||||
|
|
||||||
//! Empty constructor
|
|
||||||
iterator_range() :
|
|
||||||
m_Begin(), m_End() {}
|
|
||||||
|
|
||||||
//! Constructor from a pair of iterators
|
|
||||||
iterator_range( iterator Begin, iterator End ) :
|
|
||||||
m_Begin(Begin), m_End(End) {}
|
|
||||||
|
|
||||||
//! Constructor from a std::pair
|
|
||||||
iterator_range( const std::pair<IteratorT,IteratorT>& Range ) :
|
|
||||||
m_Begin(Range.first), m_End(Range.second) {}
|
|
||||||
|
|
||||||
//! Copy constructor
|
|
||||||
iterator_range( const iterator_range& Other ) :
|
|
||||||
m_Begin(Other.begin()), m_End(Other.end()) {}
|
|
||||||
|
|
||||||
//! Templated copy constructor
|
|
||||||
/*!
|
|
||||||
This constructor is provided to allow conversion between
|
|
||||||
const and mutable iterator instances of this class template
|
|
||||||
*/
|
|
||||||
template< typename OtherItT >
|
|
||||||
iterator_range( const iterator_range<OtherItT>& Other ) :
|
|
||||||
m_Begin(Other.begin()), m_End(Other.end()) {}
|
|
||||||
|
|
||||||
//! Assignment operator
|
|
||||||
iterator_range& operator=( const iterator_range& Other )
|
|
||||||
{
|
|
||||||
m_Begin=Other.begin(); m_End=Other.end();
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
//! Assignment operator ( templated version )
|
|
||||||
template< typename OtherItT >
|
|
||||||
iterator_range& operator=( const iterator_range<OtherItT>& Other )
|
|
||||||
{
|
|
||||||
m_Begin=Other.begin(); m_End=Other.end();
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
//! Comparison operator ( equal )
|
|
||||||
/*!
|
|
||||||
Compare operands for equality
|
|
||||||
*/
|
|
||||||
template< typename OtherItT >
|
|
||||||
bool operator==( const iterator_range<OtherItT>& Other ) const
|
|
||||||
{
|
|
||||||
return m_Begin==Other.begin() && m_End==Other.end();
|
|
||||||
}
|
|
||||||
|
|
||||||
//! Comparison operator ( not-equal )
|
|
||||||
/*!
|
|
||||||
Compare operands for non-equality
|
|
||||||
*/
|
|
||||||
template< typename OtherItT >
|
|
||||||
bool operator!=( const iterator_range<OtherItT>& Other ) const
|
|
||||||
{
|
|
||||||
return m_Begin!=Other.begin() || m_End!=Other.end();
|
|
||||||
}
|
|
||||||
|
|
||||||
//! begin access
|
|
||||||
/*!
|
|
||||||
Retrieve the begin iterator
|
|
||||||
*/
|
|
||||||
IteratorT begin() const
|
|
||||||
{
|
|
||||||
return m_Begin;
|
|
||||||
}
|
|
||||||
|
|
||||||
//! end access
|
|
||||||
/*!
|
|
||||||
Retrieve the end iterator
|
|
||||||
*/
|
|
||||||
IteratorT end() const
|
|
||||||
{
|
|
||||||
return m_End;
|
|
||||||
}
|
|
||||||
|
|
||||||
//! Empty container test
|
|
||||||
/*!
|
|
||||||
Test whether the range is empty
|
|
||||||
*/
|
|
||||||
bool empty() const
|
|
||||||
{
|
|
||||||
return m_Begin==m_End;
|
|
||||||
}
|
|
||||||
|
|
||||||
//! Size of the range
|
|
||||||
/*!
|
|
||||||
Retrieve the size of the range
|
|
||||||
*/
|
|
||||||
difference_type size() const
|
|
||||||
{
|
|
||||||
return std::distance( m_Begin, m_End );
|
|
||||||
}
|
|
||||||
|
|
||||||
//! Swap
|
|
||||||
/*!
|
|
||||||
Swap two ranges
|
|
||||||
*/
|
|
||||||
void swap( iterator_range& Other )
|
|
||||||
{
|
|
||||||
std::swap( m_Begin, Other.begin() );
|
|
||||||
std::swap( m_End, Other.end() );
|
|
||||||
}
|
|
||||||
|
|
||||||
//! Safe bool conversion
|
|
||||||
/*!
|
|
||||||
Check whether the range is empty.
|
|
||||||
Allows to use construction like this:
|
|
||||||
\code
|
|
||||||
iterator_range r;
|
|
||||||
if (!r)
|
|
||||||
{
|
|
||||||
...
|
|
||||||
}
|
|
||||||
\endcode
|
|
||||||
*/
|
|
||||||
typedef iterator (iterator_range::*unspecified_bool_type) () const;
|
|
||||||
operator unspecified_bool_type() const
|
|
||||||
{
|
|
||||||
return empty()? 0: &iterator_range::end;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
// begin and end iterators
|
|
||||||
IteratorT m_Begin;
|
|
||||||
IteratorT m_End;
|
|
||||||
};
|
|
||||||
|
|
||||||
// iterator range free-standing operators ---------------------------//
|
|
||||||
|
|
||||||
//! iterator_range output operator
|
|
||||||
/*!
|
|
||||||
Output the range to an ostream. Elements are outputed
|
|
||||||
in a sequence without separators.
|
|
||||||
*/
|
|
||||||
template< typename IteratorT, typename Elem, typename Traits >
|
|
||||||
std::basic_ostream<Elem,Traits>& operator<<(
|
|
||||||
std::basic_ostream<Elem, Traits>& Os,
|
|
||||||
const iterator_range<IteratorT>& Range )
|
|
||||||
{
|
|
||||||
std::copy(Range.begin(), Range.end(), std::ostream_iterator<Elem>(Os));
|
|
||||||
|
|
||||||
return Os;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// iterator range utilities -----------------------------------------//
|
|
||||||
|
|
||||||
//! iterator_range construct helper
|
|
||||||
/*!
|
|
||||||
Construct an \c iterator_range from a pair of iterators
|
|
||||||
|
|
||||||
\param Begin A begin iterator
|
|
||||||
\param End An end iterator
|
|
||||||
\return iterator_range object
|
|
||||||
*/
|
|
||||||
template< typename IteratorT >
|
|
||||||
inline iterator_range< IteratorT > make_iterator_range( IteratorT Begin, IteratorT End )
|
|
||||||
{
|
|
||||||
return iterator_range<IteratorT>( Begin, End );
|
|
||||||
}
|
|
||||||
|
|
||||||
//! iterator_range construct helper
|
|
||||||
/*!
|
|
||||||
Construct an \c iterator_range from a \c std::pair<> containing the begin
|
|
||||||
and end iterators.
|
|
||||||
|
|
||||||
\param Pair A \c std::pair<> with begin and end iterators
|
|
||||||
\return \c iterator_range object
|
|
||||||
*/
|
|
||||||
template< typename IteratorT >
|
|
||||||
inline iterator_range< IteratorT > make_iterator_range( const std::pair<IteratorT,IteratorT>& Pair )
|
|
||||||
{
|
|
||||||
return iterator_range<IteratorT>( Pair.first, Pair.second );
|
|
||||||
}
|
|
||||||
|
|
||||||
//! copy a range into a sequence
|
|
||||||
/*!
|
|
||||||
Construct a new sequence of the specified type from the elements
|
|
||||||
in the given range
|
|
||||||
|
|
||||||
\param Range An input range
|
|
||||||
\return New sequence
|
|
||||||
*/
|
|
||||||
template< typename SeqT, typename IteratorT >
|
|
||||||
inline SeqT copy_iterator_range( const iterator_range<IteratorT>& Range )
|
|
||||||
{
|
|
||||||
return SeqT( Range.begin(), Range.end() );
|
|
||||||
}
|
|
||||||
|
|
||||||
//! transform a range into a sequence
|
|
||||||
/*!
|
|
||||||
Create a new sequence from the elements in the range, transformed
|
|
||||||
by a function
|
|
||||||
|
|
||||||
\param Range An input range
|
|
||||||
\param Func Transformation function
|
|
||||||
\return New sequence
|
|
||||||
*/
|
|
||||||
template< typename SeqT, typename IteratorT, typename FuncT >
|
|
||||||
inline SeqT transform_iterator_range( const iterator_range<IteratorT>& Range, FuncT Func )
|
|
||||||
{
|
|
||||||
SeqT Seq;
|
|
||||||
std::transform( Range.begin(), Range.end(), std::back_inserter(Seq), Func );
|
|
||||||
return Seq;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace algorithm
|
|
||||||
|
|
||||||
// pull names to the namespace boost
|
|
||||||
using algorithm::iterator_range;
|
|
||||||
using algorithm::make_iterator_range;
|
|
||||||
using algorithm::copy_iterator_range;
|
|
||||||
using algorithm::transform_iterator_range;
|
|
||||||
|
|
||||||
} // namespace boost
|
|
||||||
|
|
||||||
|
|
||||||
#endif // BOOST_STRING_ITERATOR_RANGE_HPP
|
|
@ -11,8 +11,12 @@
|
|||||||
#define BOOST_STRING_PREDICATE_HPP
|
#define BOOST_STRING_PREDICATE_HPP
|
||||||
|
|
||||||
#include <boost/algorithm/string/config.hpp>
|
#include <boost/algorithm/string/config.hpp>
|
||||||
|
#include <boost/range/begin.hpp>
|
||||||
|
#include <boost/range/end.hpp>
|
||||||
|
#include <boost/range/iterator.hpp>
|
||||||
|
#include <boost/range/const_iterator.hpp>
|
||||||
|
|
||||||
#include <boost/algorithm/string/compare.hpp>
|
#include <boost/algorithm/string/compare.hpp>
|
||||||
#include <boost/algorithm/string/collection_traits.hpp>
|
|
||||||
#include <boost/algorithm/string/find.hpp>
|
#include <boost/algorithm/string/find.hpp>
|
||||||
#include <boost/algorithm/string/detail/predicate.hpp>
|
#include <boost/algorithm/string/detail/predicate.hpp>
|
||||||
|
|
||||||
@ -34,7 +38,7 @@ namespace boost {
|
|||||||
|
|
||||||
//! 'Starts with' predicate
|
//! 'Starts with' predicate
|
||||||
/*!
|
/*!
|
||||||
This predicate holds when the test collection is a prefix of the Input.
|
This predicate holds when the test string is a prefix of the Input.
|
||||||
In other words, if the input starts with the test.
|
In other words, if the input starts with the test.
|
||||||
When the optional predicate is specified, it is used for character-wise
|
When the optional predicate is specified, it is used for character-wise
|
||||||
comparison.
|
comparison.
|
||||||
@ -46,16 +50,16 @@ namespace boost {
|
|||||||
|
|
||||||
\note This function provides the strong exception-safety guarantee
|
\note This function provides the strong exception-safety guarantee
|
||||||
*/
|
*/
|
||||||
template<typename Collection1T, typename Collection2T, typename PredicateT>
|
template<typename Range1T, typename Range2T, typename PredicateT>
|
||||||
inline bool starts_with(
|
inline bool starts_with(
|
||||||
const Collection1T& Input,
|
const Range1T& Input,
|
||||||
const Collection2T& Test,
|
const Range2T& Test,
|
||||||
PredicateT Comp)
|
PredicateT Comp)
|
||||||
{
|
{
|
||||||
typedef BOOST_STRING_TYPENAME
|
typedef BOOST_STRING_TYPENAME
|
||||||
const_iterator_of<Collection1T>::type Iterator1T;
|
range_const_iterator<Range1T>::type Iterator1T;
|
||||||
typedef BOOST_STRING_TYPENAME
|
typedef BOOST_STRING_TYPENAME
|
||||||
const_iterator_of<Collection2T>::type Iterator2T;
|
range_const_iterator<Range2T>::type Iterator2T;
|
||||||
|
|
||||||
Iterator1T InputEnd=end(Input);
|
Iterator1T InputEnd=end(Input);
|
||||||
Iterator2T TestEnd=end(Test);
|
Iterator2T TestEnd=end(Test);
|
||||||
@ -77,17 +81,17 @@ namespace boost {
|
|||||||
/*!
|
/*!
|
||||||
\overload
|
\overload
|
||||||
*/
|
*/
|
||||||
template<typename Collection1T, typename Collection2T>
|
template<typename Range1T, typename Range2T>
|
||||||
inline bool starts_with(
|
inline bool starts_with(
|
||||||
const Collection1T& Input,
|
const Range1T& Input,
|
||||||
const Collection2T& Test)
|
const Range2T& Test)
|
||||||
{
|
{
|
||||||
return starts_with(Input, Test, is_equal());
|
return starts_with(Input, Test, is_equal());
|
||||||
}
|
}
|
||||||
|
|
||||||
//! 'Starts with' predicate ( case insensitive )
|
//! 'Starts with' predicate ( case insensitive )
|
||||||
/*!
|
/*!
|
||||||
This predicate holds when the test container is a prefix of the Input.
|
This predicate holds when the test string is a prefix of the Input.
|
||||||
In other words, if the input starts with the test.
|
In other words, if the input starts with the test.
|
||||||
Elements are compared case insensitively.
|
Elements are compared case insensitively.
|
||||||
|
|
||||||
@ -98,10 +102,10 @@ namespace boost {
|
|||||||
|
|
||||||
\note This function provides the strong exception-safety guarantee
|
\note This function provides the strong exception-safety guarantee
|
||||||
*/
|
*/
|
||||||
template<typename Collection1T, typename Collection2T>
|
template<typename Range1T, typename Range2T>
|
||||||
inline bool istarts_with(
|
inline bool istarts_with(
|
||||||
const Collection1T& Input,
|
const Range1T& Input,
|
||||||
const Collection2T& Test,
|
const Range2T& Test,
|
||||||
const std::locale& Loc=std::locale())
|
const std::locale& Loc=std::locale())
|
||||||
{
|
{
|
||||||
return starts_with(Input, Test, is_iequal(Loc));
|
return starts_with(Input, Test, is_iequal(Loc));
|
||||||
@ -112,7 +116,7 @@ namespace boost {
|
|||||||
|
|
||||||
//! 'Ends with' predicate
|
//! 'Ends with' predicate
|
||||||
/*!
|
/*!
|
||||||
This predicate holds when the test container is a suffix of the Input.
|
This predicate holds when the test string is a suffix of the Input.
|
||||||
In other words, if the input ends with the test.
|
In other words, if the input ends with the test.
|
||||||
When the optional predicate is specified, it is used for character-wise
|
When the optional predicate is specified, it is used for character-wise
|
||||||
comparison.
|
comparison.
|
||||||
@ -125,14 +129,14 @@ namespace boost {
|
|||||||
|
|
||||||
\note This function provides the strong exception-safety guarantee
|
\note This function provides the strong exception-safety guarantee
|
||||||
*/
|
*/
|
||||||
template<typename Collection1T, typename Collection2T, typename PredicateT>
|
template<typename Range1T, typename Range2T, typename PredicateT>
|
||||||
inline bool ends_with(
|
inline bool ends_with(
|
||||||
const Collection1T& Input,
|
const Range1T& Input,
|
||||||
const Collection2T& Test,
|
const Range2T& Test,
|
||||||
PredicateT Comp)
|
PredicateT Comp)
|
||||||
{
|
{
|
||||||
typedef BOOST_STRING_TYPENAME
|
typedef BOOST_STRING_TYPENAME
|
||||||
const_iterator_of<Collection1T>::type Iterator1T;
|
range_const_iterator<Range1T>::type Iterator1T;
|
||||||
typedef BOOST_STRING_TYPENAME boost::detail::
|
typedef BOOST_STRING_TYPENAME boost::detail::
|
||||||
iterator_traits<Iterator1T>::iterator_category category;
|
iterator_traits<Iterator1T>::iterator_category category;
|
||||||
|
|
||||||
@ -151,10 +155,10 @@ namespace boost {
|
|||||||
/*!
|
/*!
|
||||||
\overload
|
\overload
|
||||||
*/
|
*/
|
||||||
template<typename Collection1T, typename Collection2T>
|
template<typename Range1T, typename Range2T>
|
||||||
inline bool ends_with(
|
inline bool ends_with(
|
||||||
const Collection1T& Input,
|
const Range1T& Input,
|
||||||
const Collection2T& Test)
|
const Range2T& Test)
|
||||||
{
|
{
|
||||||
return ends_with(Input, Test, is_equal());
|
return ends_with(Input, Test, is_equal());
|
||||||
}
|
}
|
||||||
@ -172,10 +176,10 @@ namespace boost {
|
|||||||
|
|
||||||
\note This function provides the strong exception-safety guarantee
|
\note This function provides the strong exception-safety guarantee
|
||||||
*/
|
*/
|
||||||
template<typename Collection1T, typename Collection2T>
|
template<typename Range1T, typename Range2T>
|
||||||
inline bool iends_with(
|
inline bool iends_with(
|
||||||
const Collection1T& Input,
|
const Range1T& Input,
|
||||||
const Collection2T& Test,
|
const Range2T& Test,
|
||||||
const std::locale& Loc=std::locale())
|
const std::locale& Loc=std::locale())
|
||||||
{
|
{
|
||||||
return ends_with(Input, Test, is_iequal(Loc));
|
return ends_with(Input, Test, is_iequal(Loc));
|
||||||
@ -196,10 +200,10 @@ namespace boost {
|
|||||||
|
|
||||||
\note This function provides the strong exception-safety guarantee
|
\note This function provides the strong exception-safety guarantee
|
||||||
*/
|
*/
|
||||||
template<typename Collection1T, typename Collection2T, typename PredicateT>
|
template<typename Range1T, typename Range2T, typename PredicateT>
|
||||||
inline bool contains(
|
inline bool contains(
|
||||||
const Collection1T& Input,
|
const Range1T& Input,
|
||||||
const Collection2T& Test,
|
const Range2T& Test,
|
||||||
PredicateT Comp)
|
PredicateT Comp)
|
||||||
{
|
{
|
||||||
if (empty(Test))
|
if (empty(Test))
|
||||||
@ -217,10 +221,10 @@ namespace boost {
|
|||||||
/*!
|
/*!
|
||||||
\overload
|
\overload
|
||||||
*/
|
*/
|
||||||
template<typename Collection1T, typename Collection2T>
|
template<typename Range1T, typename Range2T>
|
||||||
inline bool contains(
|
inline bool contains(
|
||||||
const Collection1T& Input,
|
const Range1T& Input,
|
||||||
const Collection2T& Test)
|
const Range2T& Test)
|
||||||
{
|
{
|
||||||
return contains(Input, Test, is_equal());
|
return contains(Input, Test, is_equal());
|
||||||
}
|
}
|
||||||
@ -237,10 +241,10 @@ namespace boost {
|
|||||||
|
|
||||||
\note This function provides the strong exception-safety guarantee
|
\note This function provides the strong exception-safety guarantee
|
||||||
*/
|
*/
|
||||||
template<typename Collection1T, typename Collection2T>
|
template<typename Range1T, typename Range2T>
|
||||||
inline bool icontains(
|
inline bool icontains(
|
||||||
const Collection1T& Input,
|
const Range1T& Input,
|
||||||
const Collection2T& Test,
|
const Range2T& Test,
|
||||||
const std::locale& Loc=std::locale())
|
const std::locale& Loc=std::locale())
|
||||||
{
|
{
|
||||||
return contains(Input, Test, is_iequal(Loc));
|
return contains(Input, Test, is_iequal(Loc));
|
||||||
@ -264,16 +268,16 @@ namespace boost {
|
|||||||
|
|
||||||
\note This function provides the strong exception-safety guarantee
|
\note This function provides the strong exception-safety guarantee
|
||||||
*/
|
*/
|
||||||
template<typename Collection1T, typename Collection2T, typename PredicateT>
|
template<typename Range1T, typename Range2T, typename PredicateT>
|
||||||
inline bool equals(
|
inline bool equals(
|
||||||
const Collection1T& Input,
|
const Range1T& Input,
|
||||||
const Collection2T& Test,
|
const Range2T& Test,
|
||||||
PredicateT Comp)
|
PredicateT Comp)
|
||||||
{
|
{
|
||||||
typedef BOOST_STRING_TYPENAME
|
typedef BOOST_STRING_TYPENAME
|
||||||
const_iterator_of<Collection1T>::type Iterator1T;
|
range_const_iterator<Range1T>::type Iterator1T;
|
||||||
typedef BOOST_STRING_TYPENAME
|
typedef BOOST_STRING_TYPENAME
|
||||||
const_iterator_of<Collection2T>::type Iterator2T;
|
range_const_iterator<Range2T>::type Iterator2T;
|
||||||
|
|
||||||
Iterator1T InputEnd=end(Input);
|
Iterator1T InputEnd=end(Input);
|
||||||
Iterator2T TestEnd=end(Test);
|
Iterator2T TestEnd=end(Test);
|
||||||
@ -295,10 +299,10 @@ namespace boost {
|
|||||||
/*!
|
/*!
|
||||||
\overload
|
\overload
|
||||||
*/
|
*/
|
||||||
template<typename Collection1T, typename Collection2T>
|
template<typename Range1T, typename Range2T>
|
||||||
inline bool equals(
|
inline bool equals(
|
||||||
const Collection1T& Input,
|
const Range1T& Input,
|
||||||
const Collection2T& Test)
|
const Range2T& Test)
|
||||||
{
|
{
|
||||||
return equals(Input, Test, is_equal());
|
return equals(Input, Test, is_equal());
|
||||||
}
|
}
|
||||||
@ -318,10 +322,10 @@ namespace boost {
|
|||||||
|
|
||||||
\note This function provides the strong exception-safety guarantee
|
\note This function provides the strong exception-safety guarantee
|
||||||
*/
|
*/
|
||||||
template<typename Collection1T, typename Collection2T>
|
template<typename Range1T, typename Range2T>
|
||||||
inline bool iequals(
|
inline bool iequals(
|
||||||
const Collection1T& Input,
|
const Range1T& Input,
|
||||||
const Collection2T& Test,
|
const Range2T& Test,
|
||||||
const std::locale& Loc=std::locale())
|
const std::locale& Loc=std::locale())
|
||||||
{
|
{
|
||||||
return equals(Input, Test, is_iequal(Loc));
|
return equals(Input, Test, is_iequal(Loc));
|
||||||
@ -340,13 +344,13 @@ namespace boost {
|
|||||||
|
|
||||||
\note This function provides the strong exception-safety guarantee
|
\note This function provides the strong exception-safety guarantee
|
||||||
*/
|
*/
|
||||||
template<typename CollectionT, typename PredicateT>
|
template<typename RangeT, typename PredicateT>
|
||||||
inline bool all(
|
inline bool all(
|
||||||
const CollectionT& Input,
|
const RangeT& Input,
|
||||||
PredicateT Pred)
|
PredicateT Pred)
|
||||||
{
|
{
|
||||||
typedef BOOST_STRING_TYPENAME
|
typedef BOOST_STRING_TYPENAME
|
||||||
const_iterator_of<CollectionT>::type Iterator1T;
|
range_const_iterator<RangeT>::type Iterator1T;
|
||||||
|
|
||||||
Iterator1T InputEnd=end(Input);
|
Iterator1T InputEnd=end(Input);
|
||||||
for( Iterator1T It=begin(Input); It!=InputEnd; ++It)
|
for( Iterator1T It=begin(Input); It!=InputEnd; ++It)
|
||||||
|
@ -12,8 +12,12 @@
|
|||||||
|
|
||||||
#include <boost/algorithm/string/config.hpp>
|
#include <boost/algorithm/string/config.hpp>
|
||||||
#include <boost/regex.hpp>
|
#include <boost/regex.hpp>
|
||||||
#include <boost/algorithm/string/collection_traits.hpp>
|
|
||||||
#include <boost/algorithm/string/iterator_range.hpp>
|
#include <boost/range/iterator_range.hpp>
|
||||||
|
#include <boost/range/begin.hpp>
|
||||||
|
#include <boost/range/end.hpp>
|
||||||
|
#include <boost/range/result_iterator.hpp>
|
||||||
|
|
||||||
#include <boost/algorithm/string/find_format.hpp>
|
#include <boost/algorithm/string/find_format.hpp>
|
||||||
#include <boost/algorithm/string/regex_find_format.hpp>
|
#include <boost/algorithm/string/regex_find_format.hpp>
|
||||||
#include <boost/algorithm/string/formatter.hpp>
|
#include <boost/algorithm/string/formatter.hpp>
|
||||||
@ -37,21 +41,21 @@ namespace boost {
|
|||||||
\param Flags Regex options
|
\param Flags Regex options
|
||||||
\return
|
\return
|
||||||
An \c iterator_range delimiting the match.
|
An \c iterator_range delimiting the match.
|
||||||
Returned iterator is either \c InputContainerT::iterator or
|
Returned iterator is either \c RangeT::iterator or
|
||||||
\c InputContainerT::const_iterator, depending on the constness of
|
\c RangeT::const_iterator, depending on the constness of
|
||||||
the input parameter.
|
the input parameter.
|
||||||
|
|
||||||
\note This function provides the strong exception-safety guarantee
|
\note This function provides the strong exception-safety guarantee
|
||||||
*/
|
*/
|
||||||
template<
|
template<
|
||||||
typename CollectionT,
|
typename RangeT,
|
||||||
typename CharT,
|
typename CharT,
|
||||||
typename RegexTraitsT, typename RegexAllocatorT>
|
typename RegexTraitsT>
|
||||||
inline iterator_range<
|
inline iterator_range<
|
||||||
BOOST_STRING_TYPENAME result_iterator_of<CollectionT>::type >
|
BOOST_STRING_TYPENAME range_result_iterator<RangeT>::type >
|
||||||
find_regex(
|
find_regex(
|
||||||
CollectionT& Input,
|
RangeT& Input,
|
||||||
const reg_expression<CharT, RegexTraitsT, RegexAllocatorT>& Rx,
|
const basic_regex<CharT, RegexTraitsT>& Rx,
|
||||||
match_flag_type Flags=match_default )
|
match_flag_type Flags=match_default )
|
||||||
{
|
{
|
||||||
return regex_finder(Rx,Flags)(
|
return regex_finder(Rx,Flags)(
|
||||||
@ -79,14 +83,14 @@ namespace boost {
|
|||||||
*/
|
*/
|
||||||
template<
|
template<
|
||||||
typename OutputIteratorT,
|
typename OutputIteratorT,
|
||||||
typename CollectionT,
|
typename RangeT,
|
||||||
typename CharT,
|
typename CharT,
|
||||||
typename RegexTraitsT, typename RegexAllocatorT,
|
typename RegexTraitsT,
|
||||||
typename FormatStringTraitsT, typename FormatStringAllocatorT >
|
typename FormatStringTraitsT, typename FormatStringAllocatorT >
|
||||||
inline OutputIteratorT replace_regex_copy(
|
inline OutputIteratorT replace_regex_copy(
|
||||||
OutputIteratorT Output,
|
OutputIteratorT Output,
|
||||||
const CollectionT& Input,
|
const RangeT& Input,
|
||||||
const reg_expression<CharT, RegexTraitsT, RegexAllocatorT>& Rx,
|
const basic_regex<CharT, RegexTraitsT>& Rx,
|
||||||
const std::basic_string<CharT, FormatStringTraitsT, FormatStringAllocatorT>& Format,
|
const std::basic_string<CharT, FormatStringTraitsT, FormatStringAllocatorT>& Format,
|
||||||
match_flag_type Flags=match_default | format_default )
|
match_flag_type Flags=match_default | format_default )
|
||||||
{
|
{
|
||||||
@ -104,11 +108,11 @@ namespace boost {
|
|||||||
template<
|
template<
|
||||||
typename SequenceT,
|
typename SequenceT,
|
||||||
typename CharT,
|
typename CharT,
|
||||||
typename RegexTraitsT, typename RegexAllocatorT,
|
typename RegexTraitsT,
|
||||||
typename FormatStringTraitsT, typename FormatStringAllocatorT >
|
typename FormatStringTraitsT, typename FormatStringAllocatorT >
|
||||||
inline SequenceT replace_regex_copy(
|
inline SequenceT replace_regex_copy(
|
||||||
const SequenceT& Input,
|
const SequenceT& Input,
|
||||||
const reg_expression<CharT, RegexTraitsT, RegexAllocatorT>& Rx,
|
const basic_regex<CharT, RegexTraitsT>& Rx,
|
||||||
const std::basic_string<CharT, FormatStringTraitsT, FormatStringAllocatorT>& Format,
|
const std::basic_string<CharT, FormatStringTraitsT, FormatStringAllocatorT>& Format,
|
||||||
match_flag_type Flags=match_default | format_default )
|
match_flag_type Flags=match_default | format_default )
|
||||||
{
|
{
|
||||||
@ -131,11 +135,11 @@ namespace boost {
|
|||||||
template<
|
template<
|
||||||
typename SequenceT,
|
typename SequenceT,
|
||||||
typename CharT,
|
typename CharT,
|
||||||
typename RegexTraitsT, typename RegexAllocatorT,
|
typename RegexTraitsT,
|
||||||
typename FormatStringTraitsT, typename FormatStringAllocatorT >
|
typename FormatStringTraitsT, typename FormatStringAllocatorT >
|
||||||
inline void replace_regex(
|
inline void replace_regex(
|
||||||
SequenceT& Input,
|
SequenceT& Input,
|
||||||
const reg_expression<CharT, RegexTraitsT, RegexAllocatorT>& Rx,
|
const basic_regex<CharT, RegexTraitsT>& Rx,
|
||||||
const std::basic_string<CharT, FormatStringTraitsT, FormatStringAllocatorT>& Format,
|
const std::basic_string<CharT, FormatStringTraitsT, FormatStringAllocatorT>& Format,
|
||||||
match_flag_type Flags=match_default | format_default )
|
match_flag_type Flags=match_default | format_default )
|
||||||
{
|
{
|
||||||
@ -165,14 +169,14 @@ namespace boost {
|
|||||||
*/
|
*/
|
||||||
template<
|
template<
|
||||||
typename OutputIteratorT,
|
typename OutputIteratorT,
|
||||||
typename CollectionT,
|
typename RangeT,
|
||||||
typename CharT,
|
typename CharT,
|
||||||
typename RegexTraitsT, typename RegexAllocatorT,
|
typename RegexTraitsT,
|
||||||
typename FormatStringTraitsT, typename FormatStringAllocatorT >
|
typename FormatStringTraitsT, typename FormatStringAllocatorT >
|
||||||
inline OutputIteratorT replace_all_regex_copy(
|
inline OutputIteratorT replace_all_regex_copy(
|
||||||
OutputIteratorT Output,
|
OutputIteratorT Output,
|
||||||
const CollectionT& Input,
|
const RangeT& Input,
|
||||||
const reg_expression<CharT, RegexTraitsT, RegexAllocatorT>& Rx,
|
const basic_regex<CharT, RegexTraitsT>& Rx,
|
||||||
const std::basic_string<CharT, FormatStringTraitsT, FormatStringAllocatorT>& Format,
|
const std::basic_string<CharT, FormatStringTraitsT, FormatStringAllocatorT>& Format,
|
||||||
match_flag_type Flags=match_default | format_default )
|
match_flag_type Flags=match_default | format_default )
|
||||||
{
|
{
|
||||||
@ -190,11 +194,11 @@ namespace boost {
|
|||||||
template<
|
template<
|
||||||
typename SequenceT,
|
typename SequenceT,
|
||||||
typename CharT,
|
typename CharT,
|
||||||
typename RegexTraitsT, typename RegexAllocatorT,
|
typename RegexTraitsT,
|
||||||
typename FormatStringTraitsT, typename FormatStringAllocatorT >
|
typename FormatStringTraitsT, typename FormatStringAllocatorT >
|
||||||
inline SequenceT replace_all_regex_copy(
|
inline SequenceT replace_all_regex_copy(
|
||||||
const SequenceT& Input,
|
const SequenceT& Input,
|
||||||
const reg_expression<CharT, RegexTraitsT, RegexAllocatorT>& Rx,
|
const basic_regex<CharT, RegexTraitsT>& Rx,
|
||||||
const std::basic_string<CharT, FormatStringTraitsT, FormatStringAllocatorT>& Format,
|
const std::basic_string<CharT, FormatStringTraitsT, FormatStringAllocatorT>& Format,
|
||||||
match_flag_type Flags=match_default | format_default )
|
match_flag_type Flags=match_default | format_default )
|
||||||
{
|
{
|
||||||
@ -217,11 +221,11 @@ namespace boost {
|
|||||||
template<
|
template<
|
||||||
typename SequenceT,
|
typename SequenceT,
|
||||||
typename CharT,
|
typename CharT,
|
||||||
typename RegexTraitsT, typename RegexAllocatorT,
|
typename RegexTraitsT,
|
||||||
typename FormatStringTraitsT, typename FormatStringAllocatorT >
|
typename FormatStringTraitsT, typename FormatStringAllocatorT >
|
||||||
inline void replace_all_regex(
|
inline void replace_all_regex(
|
||||||
SequenceT& Input,
|
SequenceT& Input,
|
||||||
const reg_expression<CharT, RegexTraitsT, RegexAllocatorT>& Rx,
|
const basic_regex<CharT, RegexTraitsT>& Rx,
|
||||||
const std::basic_string<CharT, FormatStringTraitsT, FormatStringAllocatorT>& Format,
|
const std::basic_string<CharT, FormatStringTraitsT, FormatStringAllocatorT>& Format,
|
||||||
match_flag_type Flags=match_default | format_default )
|
match_flag_type Flags=match_default | format_default )
|
||||||
{
|
{
|
||||||
@ -250,13 +254,13 @@ namespace boost {
|
|||||||
*/
|
*/
|
||||||
template<
|
template<
|
||||||
typename OutputIteratorT,
|
typename OutputIteratorT,
|
||||||
typename CollectionT,
|
typename RangeT,
|
||||||
typename CharT,
|
typename CharT,
|
||||||
typename RegexTraitsT, typename RegexAllocatorT >
|
typename RegexTraitsT >
|
||||||
inline OutputIteratorT erase_regex_copy(
|
inline OutputIteratorT erase_regex_copy(
|
||||||
OutputIteratorT Output,
|
OutputIteratorT Output,
|
||||||
const CollectionT& Input,
|
const RangeT& Input,
|
||||||
const reg_expression<CharT, RegexTraitsT, RegexAllocatorT>& Rx,
|
const basic_regex<CharT, RegexTraitsT>& Rx,
|
||||||
match_flag_type Flags=match_default )
|
match_flag_type Flags=match_default )
|
||||||
{
|
{
|
||||||
return find_format_copy(
|
return find_format_copy(
|
||||||
@ -273,10 +277,10 @@ namespace boost {
|
|||||||
template<
|
template<
|
||||||
typename SequenceT,
|
typename SequenceT,
|
||||||
typename CharT,
|
typename CharT,
|
||||||
typename RegexTraitsT, typename RegexAllocatorT >
|
typename RegexTraitsT >
|
||||||
inline SequenceT erase_regex_copy(
|
inline SequenceT erase_regex_copy(
|
||||||
const SequenceT& Input,
|
const SequenceT& Input,
|
||||||
const reg_expression<CharT, RegexTraitsT, RegexAllocatorT>& Rx,
|
const basic_regex<CharT, RegexTraitsT>& Rx,
|
||||||
match_flag_type Flags=match_default )
|
match_flag_type Flags=match_default )
|
||||||
{
|
{
|
||||||
return find_format_copy(
|
return find_format_copy(
|
||||||
@ -297,10 +301,10 @@ namespace boost {
|
|||||||
template<
|
template<
|
||||||
typename SequenceT,
|
typename SequenceT,
|
||||||
typename CharT,
|
typename CharT,
|
||||||
typename RegexTraitsT, typename RegexAllocatorT >
|
typename RegexTraitsT >
|
||||||
inline void erase_regex(
|
inline void erase_regex(
|
||||||
SequenceT& Input,
|
SequenceT& Input,
|
||||||
const reg_expression<CharT, RegexTraitsT, RegexAllocatorT>& Rx,
|
const basic_regex<CharT, RegexTraitsT>& Rx,
|
||||||
match_flag_type Flags=match_default )
|
match_flag_type Flags=match_default )
|
||||||
{
|
{
|
||||||
find_format(
|
find_format(
|
||||||
@ -329,13 +333,13 @@ namespace boost {
|
|||||||
*/
|
*/
|
||||||
template<
|
template<
|
||||||
typename OutputIteratorT,
|
typename OutputIteratorT,
|
||||||
typename CollectionT,
|
typename RangeT,
|
||||||
typename CharT,
|
typename CharT,
|
||||||
typename RegexTraitsT, typename RegexAllocatorT >
|
typename RegexTraitsT >
|
||||||
inline OutputIteratorT erase_all_regex_copy(
|
inline OutputIteratorT erase_all_regex_copy(
|
||||||
OutputIteratorT Output,
|
OutputIteratorT Output,
|
||||||
const CollectionT& Input,
|
const RangeT& Input,
|
||||||
const reg_expression<CharT, RegexTraitsT, RegexAllocatorT>& Rx,
|
const basic_regex<CharT, RegexTraitsT>& Rx,
|
||||||
match_flag_type Flags=match_default )
|
match_flag_type Flags=match_default )
|
||||||
{
|
{
|
||||||
return find_format_all_copy(
|
return find_format_all_copy(
|
||||||
@ -352,10 +356,10 @@ namespace boost {
|
|||||||
template<
|
template<
|
||||||
typename SequenceT,
|
typename SequenceT,
|
||||||
typename CharT,
|
typename CharT,
|
||||||
typename RegexTraitsT, typename RegexAllocatorT >
|
typename RegexTraitsT >
|
||||||
inline SequenceT erase_all_regex_copy(
|
inline SequenceT erase_all_regex_copy(
|
||||||
const SequenceT& Input,
|
const SequenceT& Input,
|
||||||
const reg_expression<CharT, RegexTraitsT, RegexAllocatorT>& Rx,
|
const basic_regex<CharT, RegexTraitsT>& Rx,
|
||||||
match_flag_type Flags=match_default )
|
match_flag_type Flags=match_default )
|
||||||
{
|
{
|
||||||
return find_format_all_copy(
|
return find_format_all_copy(
|
||||||
@ -376,10 +380,10 @@ namespace boost {
|
|||||||
template<
|
template<
|
||||||
typename SequenceT,
|
typename SequenceT,
|
||||||
typename CharT,
|
typename CharT,
|
||||||
typename RegexTraitsT, typename RegexAllocatorT>
|
typename RegexTraitsT>
|
||||||
inline void erase_all_regex(
|
inline void erase_all_regex(
|
||||||
SequenceT& Input,
|
SequenceT& Input,
|
||||||
const reg_expression<CharT, RegexTraitsT, RegexAllocatorT>& Rx,
|
const basic_regex<CharT, RegexTraitsT>& Rx,
|
||||||
match_flag_type Flags=match_default )
|
match_flag_type Flags=match_default )
|
||||||
{
|
{
|
||||||
find_format_all(
|
find_format_all(
|
||||||
@ -414,13 +418,13 @@ namespace boost {
|
|||||||
*/
|
*/
|
||||||
template<
|
template<
|
||||||
typename SequenceSequenceT,
|
typename SequenceSequenceT,
|
||||||
typename CollectionT,
|
typename RangeT,
|
||||||
typename CharT,
|
typename CharT,
|
||||||
typename RegexTraitsT, typename RegexAllocatorT >
|
typename RegexTraitsT >
|
||||||
inline SequenceSequenceT& find_all_regex(
|
inline SequenceSequenceT& find_all_regex(
|
||||||
SequenceSequenceT& Result,
|
SequenceSequenceT& Result,
|
||||||
const CollectionT& Input,
|
const RangeT& Input,
|
||||||
const reg_expression<CharT, RegexTraitsT, RegexAllocatorT>& Rx,
|
const basic_regex<CharT, RegexTraitsT>& Rx,
|
||||||
match_flag_type Flags=match_default )
|
match_flag_type Flags=match_default )
|
||||||
{
|
{
|
||||||
return iter_find(
|
return iter_find(
|
||||||
@ -455,13 +459,13 @@ namespace boost {
|
|||||||
*/
|
*/
|
||||||
template<
|
template<
|
||||||
typename SequenceSequenceT,
|
typename SequenceSequenceT,
|
||||||
typename CollectionT,
|
typename RangeT,
|
||||||
typename CharT,
|
typename CharT,
|
||||||
typename RegexTraitsT, typename RegexAllocatorT >
|
typename RegexTraitsT >
|
||||||
inline SequenceSequenceT& split_regex(
|
inline SequenceSequenceT& split_regex(
|
||||||
SequenceSequenceT& Result,
|
SequenceSequenceT& Result,
|
||||||
const CollectionT& Input,
|
const RangeT& Input,
|
||||||
const reg_expression<CharT, RegexTraitsT, RegexAllocatorT>& Rx,
|
const basic_regex<CharT, RegexTraitsT>& Rx,
|
||||||
match_flag_type Flags=match_default )
|
match_flag_type Flags=match_default )
|
||||||
{
|
{
|
||||||
return iter_split(
|
return iter_split(
|
||||||
|
@ -40,15 +40,15 @@ namespace boost {
|
|||||||
*/
|
*/
|
||||||
template<
|
template<
|
||||||
typename CharT,
|
typename CharT,
|
||||||
typename RegexTraitsT, typename RegexAllocatorT>
|
typename RegexTraitsT>
|
||||||
inline detail::find_regexF< reg_expression<CharT, RegexTraitsT, RegexAllocatorT> >
|
inline detail::find_regexF< basic_regex<CharT, RegexTraitsT> >
|
||||||
regex_finder(
|
regex_finder(
|
||||||
const reg_expression<CharT, RegexTraitsT, RegexAllocatorT>& Rx,
|
const basic_regex<CharT, RegexTraitsT>& Rx,
|
||||||
match_flag_type MatchFlags=match_default )
|
match_flag_type MatchFlags=match_default )
|
||||||
{
|
{
|
||||||
return detail::
|
return detail::
|
||||||
find_regexF<
|
find_regexF<
|
||||||
reg_expression<CharT, RegexTraitsT, RegexAllocatorT> >( Rx, MatchFlags );
|
basic_regex<CharT, RegexTraitsT> >( Rx, MatchFlags );
|
||||||
}
|
}
|
||||||
|
|
||||||
// regex_formater ---------------------------------------------//
|
// regex_formater ---------------------------------------------//
|
||||||
@ -78,6 +78,11 @@ namespace boost {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} // namespace algorithm
|
} // namespace algorithm
|
||||||
|
|
||||||
|
// pull the names to the boost namespace
|
||||||
|
using algorithm::regex_finder;
|
||||||
|
using algorithm::regex_formatter;
|
||||||
|
|
||||||
} // namespace boost
|
} // namespace boost
|
||||||
|
|
||||||
|
|
||||||
|
@ -11,8 +11,13 @@
|
|||||||
#define BOOST_STRING_REPLACE_HPP
|
#define BOOST_STRING_REPLACE_HPP
|
||||||
|
|
||||||
#include <boost/algorithm/string/config.hpp>
|
#include <boost/algorithm/string/config.hpp>
|
||||||
#include <boost/algorithm/string/collection_traits.hpp>
|
|
||||||
#include <boost/algorithm/string/iterator_range.hpp>
|
#include <boost/range/iterator_range.hpp>
|
||||||
|
#include <boost/range/begin.hpp>
|
||||||
|
#include <boost/range/end.hpp>
|
||||||
|
#include <boost/range/iterator.hpp>
|
||||||
|
#include <boost/range/const_iterator.hpp>
|
||||||
|
|
||||||
#include <boost/algorithm/string/find_format.hpp>
|
#include <boost/algorithm/string/find_format.hpp>
|
||||||
#include <boost/algorithm/string/finder.hpp>
|
#include <boost/algorithm/string/finder.hpp>
|
||||||
#include <boost/algorithm/string/formatter.hpp>
|
#include <boost/algorithm/string/formatter.hpp>
|
||||||
@ -45,15 +50,15 @@ namespace boost {
|
|||||||
*/
|
*/
|
||||||
template<
|
template<
|
||||||
typename OutputIteratorT,
|
typename OutputIteratorT,
|
||||||
typename Collection1T,
|
typename Range1T,
|
||||||
typename Collection2T>
|
typename Range2T>
|
||||||
inline OutputIteratorT replace_range_copy(
|
inline OutputIteratorT replace_range_copy(
|
||||||
OutputIteratorT Output,
|
OutputIteratorT Output,
|
||||||
const Collection1T& Input,
|
const Range1T& Input,
|
||||||
const iterator_range<
|
const iterator_range<
|
||||||
BOOST_STRING_TYPENAME
|
BOOST_STRING_TYPENAME
|
||||||
const_iterator_of<Collection1T>::type>& SearchRange,
|
range_const_iterator<Range1T>::type>& SearchRange,
|
||||||
const Collection2T& Format)
|
const Range2T& Format)
|
||||||
{
|
{
|
||||||
return find_format_copy(
|
return find_format_copy(
|
||||||
Output,
|
Output,
|
||||||
@ -66,13 +71,13 @@ namespace boost {
|
|||||||
/*!
|
/*!
|
||||||
\overload
|
\overload
|
||||||
*/
|
*/
|
||||||
template<typename SequenceT, typename CollectionT>
|
template<typename SequenceT, typename RangeT>
|
||||||
inline SequenceT replace_range_copy(
|
inline SequenceT replace_range_copy(
|
||||||
const SequenceT& Input,
|
const SequenceT& Input,
|
||||||
const iterator_range<
|
const iterator_range<
|
||||||
BOOST_STRING_TYPENAME
|
BOOST_STRING_TYPENAME
|
||||||
const_iterator_of<SequenceT>::type>& SearchRange,
|
range_const_iterator<SequenceT>::type>& SearchRange,
|
||||||
const CollectionT& Format)
|
const RangeT& Format)
|
||||||
{
|
{
|
||||||
return find_format_copy(
|
return find_format_copy(
|
||||||
Input,
|
Input,
|
||||||
@ -89,13 +94,13 @@ namespace boost {
|
|||||||
\param SearchRange A range in the input to be substituted
|
\param SearchRange A range in the input to be substituted
|
||||||
\param Format A substitute string
|
\param Format A substitute string
|
||||||
*/
|
*/
|
||||||
template<typename SequenceT, typename CollectionT>
|
template<typename SequenceT, typename RangeT>
|
||||||
inline void replace_range(
|
inline void replace_range(
|
||||||
SequenceT& Input,
|
SequenceT& Input,
|
||||||
const iterator_range<
|
const iterator_range<
|
||||||
BOOST_STRING_TYPENAME
|
BOOST_STRING_TYPENAME
|
||||||
iterator_of<SequenceT>::type>& SearchRange,
|
range_iterator<SequenceT>::type>& SearchRange,
|
||||||
const CollectionT& Format)
|
const RangeT& Format)
|
||||||
{
|
{
|
||||||
find_format(
|
find_format(
|
||||||
Input,
|
Input,
|
||||||
@ -123,14 +128,14 @@ namespace boost {
|
|||||||
*/
|
*/
|
||||||
template<
|
template<
|
||||||
typename OutputIteratorT,
|
typename OutputIteratorT,
|
||||||
typename Collection1T,
|
typename Range1T,
|
||||||
typename Collection2T,
|
typename Range2T,
|
||||||
typename Collection3T>
|
typename Range3T>
|
||||||
inline OutputIteratorT replace_first_copy(
|
inline OutputIteratorT replace_first_copy(
|
||||||
OutputIteratorT Output,
|
OutputIteratorT Output,
|
||||||
const Collection1T& Input,
|
const Range1T& Input,
|
||||||
const Collection2T& Search,
|
const Range2T& Search,
|
||||||
const Collection3T& Format)
|
const Range3T& Format)
|
||||||
{
|
{
|
||||||
return find_format_copy(
|
return find_format_copy(
|
||||||
Output,
|
Output,
|
||||||
@ -143,11 +148,11 @@ namespace boost {
|
|||||||
/*!
|
/*!
|
||||||
\overload
|
\overload
|
||||||
*/
|
*/
|
||||||
template<typename SequenceT, typename Collection1T, typename Collection2T>
|
template<typename SequenceT, typename Range1T, typename Range2T>
|
||||||
inline SequenceT replace_first_copy(
|
inline SequenceT replace_first_copy(
|
||||||
const SequenceT& Input,
|
const SequenceT& Input,
|
||||||
const Collection1T& Search,
|
const Range1T& Search,
|
||||||
const Collection2T& Format )
|
const Range2T& Format )
|
||||||
{
|
{
|
||||||
return find_format_copy(
|
return find_format_copy(
|
||||||
Input,
|
Input,
|
||||||
@ -164,11 +169,11 @@ namespace boost {
|
|||||||
\param Search A substring to be searched for
|
\param Search A substring to be searched for
|
||||||
\param Format A substitute string
|
\param Format A substitute string
|
||||||
*/
|
*/
|
||||||
template<typename SequenceT, typename Collection1T, typename Collection2T>
|
template<typename SequenceT, typename Range1T, typename Range2T>
|
||||||
inline void replace_first(
|
inline void replace_first(
|
||||||
SequenceT& Input,
|
SequenceT& Input,
|
||||||
const Collection1T& Search,
|
const Range1T& Search,
|
||||||
const Collection2T& Format )
|
const Range2T& Format )
|
||||||
{
|
{
|
||||||
find_format(
|
find_format(
|
||||||
Input,
|
Input,
|
||||||
@ -198,14 +203,14 @@ namespace boost {
|
|||||||
*/
|
*/
|
||||||
template<
|
template<
|
||||||
typename OutputIteratorT,
|
typename OutputIteratorT,
|
||||||
typename Collection1T,
|
typename Range1T,
|
||||||
typename Collection2T,
|
typename Range2T,
|
||||||
typename Collection3T>
|
typename Range3T>
|
||||||
inline OutputIteratorT ireplace_first_copy(
|
inline OutputIteratorT ireplace_first_copy(
|
||||||
OutputIteratorT Output,
|
OutputIteratorT Output,
|
||||||
const Collection1T& Input,
|
const Range1T& Input,
|
||||||
const Collection2T& Search,
|
const Range2T& Search,
|
||||||
const Collection3T& Format,
|
const Range3T& Format,
|
||||||
const std::locale& Loc=std::locale() )
|
const std::locale& Loc=std::locale() )
|
||||||
{
|
{
|
||||||
return find_format_copy(
|
return find_format_copy(
|
||||||
@ -219,11 +224,11 @@ namespace boost {
|
|||||||
/*!
|
/*!
|
||||||
\overload
|
\overload
|
||||||
*/
|
*/
|
||||||
template<typename SequenceT, typename Collection2T, typename Collection1T>
|
template<typename SequenceT, typename Range2T, typename Range1T>
|
||||||
inline SequenceT ireplace_first_copy(
|
inline SequenceT ireplace_first_copy(
|
||||||
const SequenceT& Input,
|
const SequenceT& Input,
|
||||||
const Collection2T& Search,
|
const Range2T& Search,
|
||||||
const Collection1T& Format,
|
const Range1T& Format,
|
||||||
const std::locale& Loc=std::locale() )
|
const std::locale& Loc=std::locale() )
|
||||||
{
|
{
|
||||||
return find_format_copy(
|
return find_format_copy(
|
||||||
@ -243,11 +248,11 @@ namespace boost {
|
|||||||
\param Format A substitute string
|
\param Format A substitute string
|
||||||
\param Loc A locale used for case insensitive comparison
|
\param Loc A locale used for case insensitive comparison
|
||||||
*/
|
*/
|
||||||
template<typename SequenceT, typename Collection1T, typename Collection2T>
|
template<typename SequenceT, typename Range1T, typename Range2T>
|
||||||
inline void ireplace_first(
|
inline void ireplace_first(
|
||||||
SequenceT& Input,
|
SequenceT& Input,
|
||||||
const Collection1T& Search,
|
const Range1T& Search,
|
||||||
const Collection2T& Format,
|
const Range2T& Format,
|
||||||
const std::locale& Loc=std::locale() )
|
const std::locale& Loc=std::locale() )
|
||||||
{
|
{
|
||||||
find_format(
|
find_format(
|
||||||
@ -276,14 +281,14 @@ namespace boost {
|
|||||||
*/
|
*/
|
||||||
template<
|
template<
|
||||||
typename OutputIteratorT,
|
typename OutputIteratorT,
|
||||||
typename Collection1T,
|
typename Range1T,
|
||||||
typename Collection2T,
|
typename Range2T,
|
||||||
typename Collection3T>
|
typename Range3T>
|
||||||
inline OutputIteratorT replace_last_copy(
|
inline OutputIteratorT replace_last_copy(
|
||||||
OutputIteratorT Output,
|
OutputIteratorT Output,
|
||||||
const Collection1T& Input,
|
const Range1T& Input,
|
||||||
const Collection2T& Search,
|
const Range2T& Search,
|
||||||
const Collection3T& Format )
|
const Range3T& Format )
|
||||||
{
|
{
|
||||||
return find_format_copy(
|
return find_format_copy(
|
||||||
Output,
|
Output,
|
||||||
@ -296,11 +301,11 @@ namespace boost {
|
|||||||
/*!
|
/*!
|
||||||
\overload
|
\overload
|
||||||
*/
|
*/
|
||||||
template<typename SequenceT, typename Collection1T, typename Collection2T>
|
template<typename SequenceT, typename Range1T, typename Range2T>
|
||||||
inline SequenceT replace_last_copy(
|
inline SequenceT replace_last_copy(
|
||||||
const SequenceT& Input,
|
const SequenceT& Input,
|
||||||
const Collection1T& Search,
|
const Range1T& Search,
|
||||||
const Collection2T& Format )
|
const Range2T& Format )
|
||||||
{
|
{
|
||||||
return find_format_copy(
|
return find_format_copy(
|
||||||
Input,
|
Input,
|
||||||
@ -317,11 +322,11 @@ namespace boost {
|
|||||||
\param Search A substring to be searched for
|
\param Search A substring to be searched for
|
||||||
\param Format A substitute string
|
\param Format A substitute string
|
||||||
*/
|
*/
|
||||||
template<typename SequenceT, typename Collection1T, typename Collection2T>
|
template<typename SequenceT, typename Range1T, typename Range2T>
|
||||||
inline void replace_last(
|
inline void replace_last(
|
||||||
SequenceT& Input,
|
SequenceT& Input,
|
||||||
const Collection1T& Search,
|
const Range1T& Search,
|
||||||
const Collection2T& Format )
|
const Range2T& Format )
|
||||||
{
|
{
|
||||||
find_format(
|
find_format(
|
||||||
Input,
|
Input,
|
||||||
@ -351,14 +356,14 @@ namespace boost {
|
|||||||
*/
|
*/
|
||||||
template<
|
template<
|
||||||
typename OutputIteratorT,
|
typename OutputIteratorT,
|
||||||
typename Collection1T,
|
typename Range1T,
|
||||||
typename Collection2T,
|
typename Range2T,
|
||||||
typename Collection3T>
|
typename Range3T>
|
||||||
inline OutputIteratorT ireplace_last_copy(
|
inline OutputIteratorT ireplace_last_copy(
|
||||||
OutputIteratorT Output,
|
OutputIteratorT Output,
|
||||||
const Collection1T& Input,
|
const Range1T& Input,
|
||||||
const Collection2T& Search,
|
const Range2T& Search,
|
||||||
const Collection3T& Format,
|
const Range3T& Format,
|
||||||
const std::locale& Loc=std::locale() )
|
const std::locale& Loc=std::locale() )
|
||||||
{
|
{
|
||||||
return find_format_copy(
|
return find_format_copy(
|
||||||
@ -372,11 +377,11 @@ namespace boost {
|
|||||||
/*!
|
/*!
|
||||||
\overload
|
\overload
|
||||||
*/
|
*/
|
||||||
template<typename SequenceT, typename Collection1T, typename Collection2T>
|
template<typename SequenceT, typename Range1T, typename Range2T>
|
||||||
inline SequenceT ireplace_last_copy(
|
inline SequenceT ireplace_last_copy(
|
||||||
const SequenceT& Input,
|
const SequenceT& Input,
|
||||||
const Collection1T& Search,
|
const Range1T& Search,
|
||||||
const Collection2T& Format,
|
const Range2T& Format,
|
||||||
const std::locale& Loc=std::locale() )
|
const std::locale& Loc=std::locale() )
|
||||||
{
|
{
|
||||||
return find_format_copy(
|
return find_format_copy(
|
||||||
@ -397,11 +402,11 @@ namespace boost {
|
|||||||
\param Loc A locale used for case insensitive comparison
|
\param Loc A locale used for case insensitive comparison
|
||||||
\return A reference to the modified input
|
\return A reference to the modified input
|
||||||
*/
|
*/
|
||||||
template<typename SequenceT, typename Collection1T, typename Collection2T>
|
template<typename SequenceT, typename Range1T, typename Range2T>
|
||||||
inline void ireplace_last(
|
inline void ireplace_last(
|
||||||
SequenceT& Input,
|
SequenceT& Input,
|
||||||
const Collection1T& Search,
|
const Range1T& Search,
|
||||||
const Collection2T& Format,
|
const Range2T& Format,
|
||||||
const std::locale& Loc=std::locale() )
|
const std::locale& Loc=std::locale() )
|
||||||
{
|
{
|
||||||
find_format(
|
find_format(
|
||||||
@ -431,15 +436,15 @@ namespace boost {
|
|||||||
*/
|
*/
|
||||||
template<
|
template<
|
||||||
typename OutputIteratorT,
|
typename OutputIteratorT,
|
||||||
typename Collection1T,
|
typename Range1T,
|
||||||
typename Collection2T,
|
typename Range2T,
|
||||||
typename Collection3T>
|
typename Range3T>
|
||||||
inline OutputIteratorT replace_nth_copy(
|
inline OutputIteratorT replace_nth_copy(
|
||||||
OutputIteratorT Output,
|
OutputIteratorT Output,
|
||||||
const Collection1T& Input,
|
const Range1T& Input,
|
||||||
const Collection2T& Search,
|
const Range2T& Search,
|
||||||
unsigned int Nth,
|
unsigned int Nth,
|
||||||
const Collection3T& Format )
|
const Range3T& Format )
|
||||||
{
|
{
|
||||||
return find_format_copy(
|
return find_format_copy(
|
||||||
Output,
|
Output,
|
||||||
@ -452,12 +457,12 @@ namespace boost {
|
|||||||
/*!
|
/*!
|
||||||
\overload
|
\overload
|
||||||
*/
|
*/
|
||||||
template<typename SequenceT, typename Collection1T, typename Collection2T>
|
template<typename SequenceT, typename Range1T, typename Range2T>
|
||||||
inline SequenceT replace_nth_copy(
|
inline SequenceT replace_nth_copy(
|
||||||
const SequenceT& Input,
|
const SequenceT& Input,
|
||||||
const Collection1T& Search,
|
const Range1T& Search,
|
||||||
unsigned int Nth,
|
unsigned int Nth,
|
||||||
const Collection2T& Format )
|
const Range2T& Format )
|
||||||
{
|
{
|
||||||
return find_format_copy(
|
return find_format_copy(
|
||||||
Input,
|
Input,
|
||||||
@ -475,12 +480,12 @@ namespace boost {
|
|||||||
\param Nth An index of the match to be replaced. The index is 0-based.
|
\param Nth An index of the match to be replaced. The index is 0-based.
|
||||||
\param Format A substitute string
|
\param Format A substitute string
|
||||||
*/
|
*/
|
||||||
template<typename SequenceT, typename Collection1T, typename Collection2T>
|
template<typename SequenceT, typename Range1T, typename Range2T>
|
||||||
inline void replace_nth(
|
inline void replace_nth(
|
||||||
SequenceT& Input,
|
SequenceT& Input,
|
||||||
const Collection1T& Search,
|
const Range1T& Search,
|
||||||
unsigned int Nth,
|
unsigned int Nth,
|
||||||
const Collection2T& Format )
|
const Range2T& Format )
|
||||||
{
|
{
|
||||||
find_format(
|
find_format(
|
||||||
Input,
|
Input,
|
||||||
@ -511,15 +516,15 @@ namespace boost {
|
|||||||
*/
|
*/
|
||||||
template<
|
template<
|
||||||
typename OutputIteratorT,
|
typename OutputIteratorT,
|
||||||
typename Collection1T,
|
typename Range1T,
|
||||||
typename Collection2T,
|
typename Range2T,
|
||||||
typename Collection3T>
|
typename Range3T>
|
||||||
inline OutputIteratorT ireplace_nth_copy(
|
inline OutputIteratorT ireplace_nth_copy(
|
||||||
OutputIteratorT Output,
|
OutputIteratorT Output,
|
||||||
const Collection1T& Input,
|
const Range1T& Input,
|
||||||
const Collection2T& Search,
|
const Range2T& Search,
|
||||||
unsigned int Nth,
|
unsigned int Nth,
|
||||||
const Collection3T& Format,
|
const Range3T& Format,
|
||||||
const std::locale& Loc=std::locale() )
|
const std::locale& Loc=std::locale() )
|
||||||
{
|
{
|
||||||
return find_format_copy(
|
return find_format_copy(
|
||||||
@ -533,12 +538,12 @@ namespace boost {
|
|||||||
/*!
|
/*!
|
||||||
\overload
|
\overload
|
||||||
*/
|
*/
|
||||||
template<typename SequenceT, typename Collection1T, typename Collection2T>
|
template<typename SequenceT, typename Range1T, typename Range2T>
|
||||||
inline SequenceT ireplace_nth_copy(
|
inline SequenceT ireplace_nth_copy(
|
||||||
const SequenceT& Input,
|
const SequenceT& Input,
|
||||||
const Collection1T& Search,
|
const Range1T& Search,
|
||||||
unsigned int Nth,
|
unsigned int Nth,
|
||||||
const Collection2T& Format,
|
const Range2T& Format,
|
||||||
const std::locale& Loc=std::locale() )
|
const std::locale& Loc=std::locale() )
|
||||||
{
|
{
|
||||||
return find_format_copy(
|
return find_format_copy(
|
||||||
@ -559,12 +564,12 @@ namespace boost {
|
|||||||
\param Format A substitute string
|
\param Format A substitute string
|
||||||
\param Loc A locale used for case insensitive comparison
|
\param Loc A locale used for case insensitive comparison
|
||||||
*/
|
*/
|
||||||
template<typename SequenceT, typename Collection1T, typename Collection2T>
|
template<typename SequenceT, typename Range1T, typename Range2T>
|
||||||
inline void ireplace_nth(
|
inline void ireplace_nth(
|
||||||
SequenceT& Input,
|
SequenceT& Input,
|
||||||
const Collection1T& Search,
|
const Range1T& Search,
|
||||||
unsigned int Nth,
|
unsigned int Nth,
|
||||||
const Collection2T& Format,
|
const Range2T& Format,
|
||||||
const std::locale& Loc=std::locale() )
|
const std::locale& Loc=std::locale() )
|
||||||
{
|
{
|
||||||
find_format(
|
find_format(
|
||||||
@ -593,14 +598,14 @@ namespace boost {
|
|||||||
*/
|
*/
|
||||||
template<
|
template<
|
||||||
typename OutputIteratorT,
|
typename OutputIteratorT,
|
||||||
typename Collection1T,
|
typename Range1T,
|
||||||
typename Collection2T,
|
typename Range2T,
|
||||||
typename Collection3T>
|
typename Range3T>
|
||||||
inline OutputIteratorT replace_all_copy(
|
inline OutputIteratorT replace_all_copy(
|
||||||
OutputIteratorT Output,
|
OutputIteratorT Output,
|
||||||
const Collection1T& Input,
|
const Range1T& Input,
|
||||||
const Collection2T& Search,
|
const Range2T& Search,
|
||||||
const Collection3T& Format )
|
const Range3T& Format )
|
||||||
{
|
{
|
||||||
return find_format_all_copy(
|
return find_format_all_copy(
|
||||||
Output,
|
Output,
|
||||||
@ -613,11 +618,11 @@ namespace boost {
|
|||||||
/*!
|
/*!
|
||||||
\overload
|
\overload
|
||||||
*/
|
*/
|
||||||
template<typename SequenceT, typename Collection1T, typename Collection2T>
|
template<typename SequenceT, typename Range1T, typename Range2T>
|
||||||
inline SequenceT replace_all_copy(
|
inline SequenceT replace_all_copy(
|
||||||
const SequenceT& Input,
|
const SequenceT& Input,
|
||||||
const Collection1T& Search,
|
const Range1T& Search,
|
||||||
const Collection2T& Format )
|
const Range2T& Format )
|
||||||
{
|
{
|
||||||
return find_format_all_copy(
|
return find_format_all_copy(
|
||||||
Input,
|
Input,
|
||||||
@ -635,11 +640,11 @@ namespace boost {
|
|||||||
\param Format A substitute string
|
\param Format A substitute string
|
||||||
\return A reference to the modified input
|
\return A reference to the modified input
|
||||||
*/
|
*/
|
||||||
template<typename SequenceT, typename Collection1T, typename Collection2T>
|
template<typename SequenceT, typename Range1T, typename Range2T>
|
||||||
inline void replace_all(
|
inline void replace_all(
|
||||||
SequenceT& Input,
|
SequenceT& Input,
|
||||||
const Collection1T& Search,
|
const Range1T& Search,
|
||||||
const Collection2T& Format )
|
const Range2T& Format )
|
||||||
{
|
{
|
||||||
find_format_all(
|
find_format_all(
|
||||||
Input,
|
Input,
|
||||||
@ -669,14 +674,14 @@ namespace boost {
|
|||||||
*/
|
*/
|
||||||
template<
|
template<
|
||||||
typename OutputIteratorT,
|
typename OutputIteratorT,
|
||||||
typename Collection1T,
|
typename Range1T,
|
||||||
typename Collection2T,
|
typename Range2T,
|
||||||
typename Collection3T>
|
typename Range3T>
|
||||||
inline OutputIteratorT ireplace_all_copy(
|
inline OutputIteratorT ireplace_all_copy(
|
||||||
OutputIteratorT Output,
|
OutputIteratorT Output,
|
||||||
const Collection1T& Input,
|
const Range1T& Input,
|
||||||
const Collection2T& Search,
|
const Range2T& Search,
|
||||||
const Collection3T& Format,
|
const Range3T& Format,
|
||||||
const std::locale& Loc=std::locale() )
|
const std::locale& Loc=std::locale() )
|
||||||
{
|
{
|
||||||
return find_format_all_copy(
|
return find_format_all_copy(
|
||||||
@ -690,11 +695,11 @@ namespace boost {
|
|||||||
/*!
|
/*!
|
||||||
\overload
|
\overload
|
||||||
*/
|
*/
|
||||||
template<typename SequenceT, typename Collection1T, typename Collection2T>
|
template<typename SequenceT, typename Range1T, typename Range2T>
|
||||||
inline SequenceT ireplace_all_copy(
|
inline SequenceT ireplace_all_copy(
|
||||||
const SequenceT& Input,
|
const SequenceT& Input,
|
||||||
const Collection1T& Search,
|
const Range1T& Search,
|
||||||
const Collection2T& Format,
|
const Range2T& Format,
|
||||||
const std::locale& Loc=std::locale() )
|
const std::locale& Loc=std::locale() )
|
||||||
{
|
{
|
||||||
return find_format_all_copy(
|
return find_format_all_copy(
|
||||||
@ -714,11 +719,11 @@ namespace boost {
|
|||||||
\param Format A substitute string
|
\param Format A substitute string
|
||||||
\param Loc A locale used for case insensitive comparison
|
\param Loc A locale used for case insensitive comparison
|
||||||
*/
|
*/
|
||||||
template<typename SequenceT, typename Collection1T, typename Collection2T>
|
template<typename SequenceT, typename Range1T, typename Range2T>
|
||||||
inline void ireplace_all(
|
inline void ireplace_all(
|
||||||
SequenceT& Input,
|
SequenceT& Input,
|
||||||
const Collection1T& Search,
|
const Range1T& Search,
|
||||||
const Collection2T& Format,
|
const Range2T& Format,
|
||||||
const std::locale& Loc=std::locale() )
|
const std::locale& Loc=std::locale() )
|
||||||
{
|
{
|
||||||
find_format_all(
|
find_format_all(
|
||||||
@ -749,13 +754,13 @@ namespace boost {
|
|||||||
*/
|
*/
|
||||||
template<
|
template<
|
||||||
typename OutputIteratorT,
|
typename OutputIteratorT,
|
||||||
typename Collection1T,
|
typename Range1T,
|
||||||
typename Collection2T>
|
typename Range2T>
|
||||||
inline OutputIteratorT replace_head_copy(
|
inline OutputIteratorT replace_head_copy(
|
||||||
OutputIteratorT Output,
|
OutputIteratorT Output,
|
||||||
const Collection1T& Input,
|
const Range1T& Input,
|
||||||
unsigned int N,
|
unsigned int N,
|
||||||
const Collection2T& Format )
|
const Range2T& Format )
|
||||||
{
|
{
|
||||||
return find_format_copy(
|
return find_format_copy(
|
||||||
Output,
|
Output,
|
||||||
@ -768,11 +773,11 @@ namespace boost {
|
|||||||
/*!
|
/*!
|
||||||
\overload
|
\overload
|
||||||
*/
|
*/
|
||||||
template<typename SequenceT, typename CollectionT>
|
template<typename SequenceT, typename RangeT>
|
||||||
inline SequenceT replace_head_copy(
|
inline SequenceT replace_head_copy(
|
||||||
const SequenceT& Input,
|
const SequenceT& Input,
|
||||||
unsigned int N,
|
unsigned int N,
|
||||||
const CollectionT& Format )
|
const RangeT& Format )
|
||||||
{
|
{
|
||||||
return find_format_copy(
|
return find_format_copy(
|
||||||
Input,
|
Input,
|
||||||
@ -791,11 +796,11 @@ namespace boost {
|
|||||||
\param N Length of the head
|
\param N Length of the head
|
||||||
\param Format A substitute string
|
\param Format A substitute string
|
||||||
*/
|
*/
|
||||||
template<typename SequenceT, typename CollectionT>
|
template<typename SequenceT, typename RangeT>
|
||||||
inline void replace_head(
|
inline void replace_head(
|
||||||
SequenceT& Input,
|
SequenceT& Input,
|
||||||
unsigned int N,
|
unsigned int N,
|
||||||
const CollectionT& Format )
|
const RangeT& Format )
|
||||||
{
|
{
|
||||||
find_format(
|
find_format(
|
||||||
Input,
|
Input,
|
||||||
@ -825,13 +830,13 @@ namespace boost {
|
|||||||
*/
|
*/
|
||||||
template<
|
template<
|
||||||
typename OutputIteratorT,
|
typename OutputIteratorT,
|
||||||
typename Collection1T,
|
typename Range1T,
|
||||||
typename Collection2T>
|
typename Range2T>
|
||||||
inline OutputIteratorT replace_tail_copy(
|
inline OutputIteratorT replace_tail_copy(
|
||||||
OutputIteratorT Output,
|
OutputIteratorT Output,
|
||||||
const Collection1T& Input,
|
const Range1T& Input,
|
||||||
unsigned int N,
|
unsigned int N,
|
||||||
const Collection2T& Format )
|
const Range2T& Format )
|
||||||
{
|
{
|
||||||
return find_format_copy(
|
return find_format_copy(
|
||||||
Output,
|
Output,
|
||||||
@ -844,11 +849,11 @@ namespace boost {
|
|||||||
/*!
|
/*!
|
||||||
\overload
|
\overload
|
||||||
*/
|
*/
|
||||||
template<typename SequenceT, typename CollectionT>
|
template<typename SequenceT, typename RangeT>
|
||||||
inline SequenceT replace_tail_copy(
|
inline SequenceT replace_tail_copy(
|
||||||
const SequenceT& Input,
|
const SequenceT& Input,
|
||||||
unsigned int N,
|
unsigned int N,
|
||||||
const CollectionT& Format )
|
const RangeT& Format )
|
||||||
{
|
{
|
||||||
return find_format_copy(
|
return find_format_copy(
|
||||||
Input,
|
Input,
|
||||||
@ -867,11 +872,11 @@ namespace boost {
|
|||||||
\param N Length of the tail
|
\param N Length of the tail
|
||||||
\param Format A substitute string
|
\param Format A substitute string
|
||||||
*/
|
*/
|
||||||
template<typename SequenceT, typename CollectionT>
|
template<typename SequenceT, typename RangeT>
|
||||||
inline void replace_tail(
|
inline void replace_tail(
|
||||||
SequenceT& Input,
|
SequenceT& Input,
|
||||||
unsigned int N,
|
unsigned int N,
|
||||||
const CollectionT& Format )
|
const RangeT& Format )
|
||||||
{
|
{
|
||||||
find_format(
|
find_format(
|
||||||
Input,
|
Input,
|
||||||
|
@ -101,7 +101,7 @@ namespace boost {
|
|||||||
#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||||
|
|
||||||
|
|
||||||
typedef mpl::bool_<value> type;
|
typedef mpl::bool_<has_native_replace<T>::value> type;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -128,7 +128,7 @@ namespace boost {
|
|||||||
# endif // BOOST_WORKAROUND( __IBMCPP__, <= 600 )
|
# endif // BOOST_WORKAROUND( __IBMCPP__, <= 600 )
|
||||||
#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||||
|
|
||||||
typedef mpl::bool_<value> type;
|
typedef mpl::bool_<has_stable_iterators<T>::value> type;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -155,7 +155,7 @@ namespace boost {
|
|||||||
# endif // BOOST_WORKAROUND( __IBMCPP__, <= 600 )
|
# endif // BOOST_WORKAROUND( __IBMCPP__, <= 600 )
|
||||||
#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||||
|
|
||||||
typedef mpl::bool_<value> type;
|
typedef mpl::bool_<has_const_time_insert<T>::value> type;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -182,7 +182,7 @@ namespace boost {
|
|||||||
# endif // BOOST_WORKAROUND( __IBMCPP__, <= 600 )
|
# endif // BOOST_WORKAROUND( __IBMCPP__, <= 600 )
|
||||||
#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||||
|
|
||||||
typedef mpl::bool_<value> type;
|
typedef mpl::bool_<has_const_time_erase<T>::value> type;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace algorithm
|
} // namespace algorithm
|
||||||
|
@ -11,8 +11,7 @@
|
|||||||
#define BOOST_STRING_SPLIT_HPP
|
#define BOOST_STRING_SPLIT_HPP
|
||||||
|
|
||||||
#include <boost/algorithm/string/config.hpp>
|
#include <boost/algorithm/string/config.hpp>
|
||||||
#include <boost/algorithm/string/collection_traits.hpp>
|
|
||||||
#include <boost/algorithm/string/iterator_range.hpp>
|
|
||||||
#include <boost/algorithm/string/iter_find.hpp>
|
#include <boost/algorithm/string/iter_find.hpp>
|
||||||
#include <boost/algorithm/string/finder.hpp>
|
#include <boost/algorithm/string/finder.hpp>
|
||||||
#include <boost/algorithm/string/compare.hpp>
|
#include <boost/algorithm/string/compare.hpp>
|
||||||
@ -58,11 +57,11 @@ namespace boost {
|
|||||||
|
|
||||||
\note This function provides the strong exception-safety guarantee
|
\note This function provides the strong exception-safety guarantee
|
||||||
*/
|
*/
|
||||||
template< typename SequenceSequenceT, typename Collection1T, typename Collection2T >
|
template< typename SequenceSequenceT, typename Range1T, typename Range2T >
|
||||||
inline SequenceSequenceT& find_all(
|
inline SequenceSequenceT& find_all(
|
||||||
SequenceSequenceT& Result,
|
SequenceSequenceT& Result,
|
||||||
Collection1T& Input,
|
Range1T& Input,
|
||||||
const Collection2T& Search)
|
const Range2T& Search)
|
||||||
{
|
{
|
||||||
return iter_find(
|
return iter_find(
|
||||||
Result,
|
Result,
|
||||||
@ -93,11 +92,11 @@ namespace boost {
|
|||||||
|
|
||||||
\note This function provides the strong exception-safety guarantee
|
\note This function provides the strong exception-safety guarantee
|
||||||
*/
|
*/
|
||||||
template< typename SequenceSequenceT, typename Collection1T, typename Collection2T >
|
template< typename SequenceSequenceT, typename Range1T, typename Range2T >
|
||||||
inline SequenceSequenceT& ifind_all(
|
inline SequenceSequenceT& ifind_all(
|
||||||
SequenceSequenceT& Result,
|
SequenceSequenceT& Result,
|
||||||
Collection1T& Input,
|
Range1T& Input,
|
||||||
const Collection2T& Search,
|
const Range2T& Search,
|
||||||
const std::locale& Loc=std::locale() )
|
const std::locale& Loc=std::locale() )
|
||||||
{
|
{
|
||||||
return iter_find(
|
return iter_find(
|
||||||
@ -136,10 +135,10 @@ namespace boost {
|
|||||||
|
|
||||||
\note This function provides the strong exception-safety guarantee
|
\note This function provides the strong exception-safety guarantee
|
||||||
*/
|
*/
|
||||||
template< typename SequenceSequenceT, typename CollectionT, typename PredicateT >
|
template< typename SequenceSequenceT, typename RangeT, typename PredicateT >
|
||||||
inline SequenceSequenceT& split(
|
inline SequenceSequenceT& split(
|
||||||
SequenceSequenceT& Result,
|
SequenceSequenceT& Result,
|
||||||
CollectionT& Input,
|
RangeT& Input,
|
||||||
PredicateT Pred,
|
PredicateT Pred,
|
||||||
token_compress_mode_type eCompress=token_compress_off )
|
token_compress_mode_type eCompress=token_compress_off )
|
||||||
{
|
{
|
||||||
|
@ -46,7 +46,7 @@ namespace boost {
|
|||||||
#else
|
#else
|
||||||
BOOST_STATIC_CONSTANT(bool, value=true);
|
BOOST_STATIC_CONSTANT(bool, value=true);
|
||||||
#endif // BOOST_WORKAROUND( __IBMCPP__, <= 600 )
|
#endif // BOOST_WORKAROUND( __IBMCPP__, <= 600 )
|
||||||
typedef mpl::bool_<value> type;
|
typedef mpl::bool_<has_stable_iterators<T>::value> type;
|
||||||
};
|
};
|
||||||
|
|
||||||
// const time insert trait
|
// const time insert trait
|
||||||
@ -59,7 +59,7 @@ namespace boost {
|
|||||||
#else
|
#else
|
||||||
BOOST_STATIC_CONSTANT(bool, value=true);
|
BOOST_STATIC_CONSTANT(bool, value=true);
|
||||||
#endif // BOOST_WORKAROUND( __IBMCPP__, <= 600 )
|
#endif // BOOST_WORKAROUND( __IBMCPP__, <= 600 )
|
||||||
typedef mpl::bool_<value> type;
|
typedef mpl::bool_<has_const_time_insert<T>::value> type;
|
||||||
};
|
};
|
||||||
|
|
||||||
// const time erase trait
|
// const time erase trait
|
||||||
@ -72,7 +72,7 @@ namespace boost {
|
|||||||
#else
|
#else
|
||||||
BOOST_STATIC_CONSTANT(bool, value=true);
|
BOOST_STATIC_CONSTANT(bool, value=true);
|
||||||
#endif // BOOST_WORKAROUND( __IBMCPP__, <= 600 )
|
#endif // BOOST_WORKAROUND( __IBMCPP__, <= 600 )
|
||||||
typedef mpl::bool_<value> type;
|
typedef mpl::bool_<has_const_time_erase<T>::value> type;
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
#ifndef BOOST_STRING_STD_SLIST_TRAITS_HPP
|
#ifndef BOOST_STRING_STD_SLIST_TRAITS_HPP
|
||||||
#define BOOST_STRING_STD_SLIST_TRAITS_HPP
|
#define BOOST_STRING_STD_SLIST_TRAITS_HPP
|
||||||
|
|
||||||
|
#include <boost/algorithm/string/config.hpp>
|
||||||
#include <boost/algorithm/string/yes_no_type.hpp>
|
#include <boost/algorithm/string/yes_no_type.hpp>
|
||||||
#include <slist>
|
#include <slist>
|
||||||
#include <boost/algorithm/string/sequence_traits.hpp>
|
#include <boost/algorithm/string/sequence_traits.hpp>
|
||||||
@ -23,21 +24,21 @@ namespace boost {
|
|||||||
|
|
||||||
// stable iterators tester
|
// stable iterators tester
|
||||||
template<typename T, typename AllocT>
|
template<typename T, typename AllocT>
|
||||||
yes_type has_stable_iterators_tester( const std::slist<T,AllocT>* );
|
yes_type has_stable_iterators_tester( const BOOST_STD_EXTENSION_NAMESPACE::slist<T,AllocT>* );
|
||||||
|
|
||||||
// const time insert tester
|
// const time insert tester
|
||||||
template<typename T, typename AllocT>
|
template<typename T, typename AllocT>
|
||||||
yes_type has_const_time_insert_tester( const std::slist<T,AllocT>* );
|
yes_type has_const_time_insert_tester( const BOOST_STD_EXTENSION_NAMESPACE::slist<T,AllocT>* );
|
||||||
|
|
||||||
// const time erase tester
|
// const time erase tester
|
||||||
template<typename T, typename AllocT>
|
template<typename T, typename AllocT>
|
||||||
yes_type has_const_time_erase_tester( const std::slist<T,AllocT>* );
|
yes_type has_const_time_erase_tester( const BOOST_STD_EXTENSION_NAMESPACE::slist<T,AllocT>* );
|
||||||
|
|
||||||
#else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
#else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||||
|
|
||||||
// stable iterators trait
|
// stable iterators trait
|
||||||
template<typename T, typename AllocT>
|
template<typename T, typename AllocT>
|
||||||
class has_stable_iterators< std::slist<T,AllocT> >
|
class has_stable_iterators< BOOST_STD_EXTENSION_NAMESPACE::slist<T,AllocT> >
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
#if BOOST_WORKAROUND( __IBMCPP__, <= 600 )
|
#if BOOST_WORKAROUND( __IBMCPP__, <= 600 )
|
||||||
@ -45,12 +46,12 @@ namespace boost {
|
|||||||
#else
|
#else
|
||||||
BOOST_STATIC_CONSTANT(bool, value=true);
|
BOOST_STATIC_CONSTANT(bool, value=true);
|
||||||
#endif // BOOST_WORKAROUND( __IBMCPP__, <= 600 )
|
#endif // BOOST_WORKAROUND( __IBMCPP__, <= 600 )
|
||||||
typedef mpl::bool_<value> type;
|
typedef mpl::bool_<has_stable_iterators<T>::value> type;
|
||||||
};
|
};
|
||||||
|
|
||||||
// const time insert trait
|
// const time insert trait
|
||||||
template<typename T, typename AllocT>
|
template<typename T, typename AllocT>
|
||||||
class has_const_time_insert< std::slist<T,AllocT> >
|
class has_const_time_insert< BOOST_STD_EXTENSION_NAMESPACE::slist<T,AllocT> >
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
#if BOOST_WORKAROUND( __IBMCPP__, <= 600 )
|
#if BOOST_WORKAROUND( __IBMCPP__, <= 600 )
|
||||||
@ -58,12 +59,12 @@ namespace boost {
|
|||||||
#else
|
#else
|
||||||
BOOST_STATIC_CONSTANT(bool, value=true);
|
BOOST_STATIC_CONSTANT(bool, value=true);
|
||||||
#endif // BOOST_WORKAROUND( __IBMCPP__, <= 600 )
|
#endif // BOOST_WORKAROUND( __IBMCPP__, <= 600 )
|
||||||
typedef mpl::bool_<value> type;
|
typedef mpl::bool_<has_const_time_insert<T>::value> type;
|
||||||
};
|
};
|
||||||
|
|
||||||
// const time erase trait
|
// const time erase trait
|
||||||
template<typename T, typename AllocT>
|
template<typename T, typename AllocT>
|
||||||
class has_const_time_erase< std::slist<T,AllocT> >
|
class has_const_time_erase< BOOST_STD_EXTENSION_NAMESPACE::slist<T,AllocT> >
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
#if BOOST_WORKAROUND( __IBMCPP__, <= 600 )
|
#if BOOST_WORKAROUND( __IBMCPP__, <= 600 )
|
||||||
@ -71,7 +72,7 @@ namespace boost {
|
|||||||
#else
|
#else
|
||||||
BOOST_STATIC_CONSTANT(bool, value=true);
|
BOOST_STATIC_CONSTANT(bool, value=true);
|
||||||
#endif // BOOST_WORKAROUND( __IBMCPP__, <= 600 )
|
#endif // BOOST_WORKAROUND( __IBMCPP__, <= 600 )
|
||||||
typedef mpl::bool_<value> type;
|
typedef mpl::bool_<has_const_time_erase<T>::value> type;
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ namespace boost {
|
|||||||
BOOST_STATIC_CONSTANT(bool, value=true);
|
BOOST_STATIC_CONSTANT(bool, value=true);
|
||||||
#endif // BOOST_WORKAROUND( __IBMCPP__, <= 600 )
|
#endif // BOOST_WORKAROUND( __IBMCPP__, <= 600 )
|
||||||
|
|
||||||
typedef mpl::bool_<value> type;
|
typedef mpl::bool_<has_native_replace<T>::value> type;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -11,7 +11,11 @@
|
|||||||
#define BOOST_STRING_TRIM_HPP
|
#define BOOST_STRING_TRIM_HPP
|
||||||
|
|
||||||
#include <boost/algorithm/string/config.hpp>
|
#include <boost/algorithm/string/config.hpp>
|
||||||
#include <boost/algorithm/string/collection_traits.hpp>
|
|
||||||
|
#include <boost/range/begin.hpp>
|
||||||
|
#include <boost/range/end.hpp>
|
||||||
|
#include <boost/range/const_iterator.hpp>
|
||||||
|
|
||||||
#include <boost/algorithm/string/detail/trim.hpp>
|
#include <boost/algorithm/string/detail/trim.hpp>
|
||||||
#include <boost/algorithm/string/classification.hpp>
|
#include <boost/algorithm/string/classification.hpp>
|
||||||
#include <locale>
|
#include <locale>
|
||||||
@ -42,7 +46,7 @@ namespace boost {
|
|||||||
or copied to the output iterator
|
or copied to the output iterator
|
||||||
|
|
||||||
\param Output An output iterator to which the result will be copied
|
\param Output An output iterator to which the result will be copied
|
||||||
\param Input An input collection
|
\param Input An input range
|
||||||
\param IsSpace An unary predicate identifying spaces
|
\param IsSpace An unary predicate identifying spaces
|
||||||
\return
|
\return
|
||||||
An output iterator pointing just after the last inserted character or
|
An output iterator pointing just after the last inserted character or
|
||||||
@ -50,14 +54,14 @@ namespace boost {
|
|||||||
|
|
||||||
\note The second variant of this function provides the strong exception-safety guarantee
|
\note The second variant of this function provides the strong exception-safety guarantee
|
||||||
*/
|
*/
|
||||||
template<typename OutputIteratorT, typename CollectionT, typename PredicateT>
|
template<typename OutputIteratorT, typename RangeT, typename PredicateT>
|
||||||
inline OutputIteratorT trim_left_copy_if(
|
inline OutputIteratorT trim_left_copy_if(
|
||||||
OutputIteratorT Output,
|
OutputIteratorT Output,
|
||||||
const CollectionT& Input,
|
const RangeT& Input,
|
||||||
PredicateT IsSpace)
|
PredicateT IsSpace)
|
||||||
{
|
{
|
||||||
std::copy(
|
std::copy(
|
||||||
detail::trim_begin(
|
::boost::algorithm::detail::trim_begin(
|
||||||
begin(Input),
|
begin(Input),
|
||||||
end(Input),
|
end(Input),
|
||||||
IsSpace ),
|
IsSpace ),
|
||||||
@ -75,7 +79,7 @@ namespace boost {
|
|||||||
inline SequenceT trim_left_copy_if(const SequenceT& Input, PredicateT IsSpace)
|
inline SequenceT trim_left_copy_if(const SequenceT& Input, PredicateT IsSpace)
|
||||||
{
|
{
|
||||||
return SequenceT(
|
return SequenceT(
|
||||||
detail::trim_begin(
|
::boost::algorithm::detail::trim_begin(
|
||||||
begin(Input),
|
begin(Input),
|
||||||
end(Input),
|
end(Input),
|
||||||
IsSpace ),
|
IsSpace ),
|
||||||
@ -116,7 +120,7 @@ namespace boost {
|
|||||||
{
|
{
|
||||||
Input.erase(
|
Input.erase(
|
||||||
begin(Input),
|
begin(Input),
|
||||||
detail::trim_begin(
|
::boost::algorithm::detail::trim_begin(
|
||||||
begin(Input),
|
begin(Input),
|
||||||
end(Input),
|
end(Input),
|
||||||
IsSpace));
|
IsSpace));
|
||||||
@ -148,7 +152,7 @@ namespace boost {
|
|||||||
or copied to the output iterator
|
or copied to the output iterator
|
||||||
|
|
||||||
\param Output An output iterator to which the result will be copied
|
\param Output An output iterator to which the result will be copied
|
||||||
\param Input An input collection
|
\param Input An input range
|
||||||
\param IsSpace An unary predicate identifying spaces
|
\param IsSpace An unary predicate identifying spaces
|
||||||
\return
|
\return
|
||||||
An output iterator pointing just after the last inserted character or
|
An output iterator pointing just after the last inserted character or
|
||||||
@ -156,15 +160,15 @@ namespace boost {
|
|||||||
|
|
||||||
\note The second variant of this function provides the strong exception-safety guarantee
|
\note The second variant of this function provides the strong exception-safety guarantee
|
||||||
*/
|
*/
|
||||||
template<typename OutputIteratorT, typename CollectionT, typename PredicateT>
|
template<typename OutputIteratorT, typename RangeT, typename PredicateT>
|
||||||
inline OutputIteratorT trim_right_copy_if(
|
inline OutputIteratorT trim_right_copy_if(
|
||||||
OutputIteratorT Output,
|
OutputIteratorT Output,
|
||||||
const CollectionT& Input,
|
const RangeT& Input,
|
||||||
PredicateT IsSpace )
|
PredicateT IsSpace )
|
||||||
{
|
{
|
||||||
std::copy(
|
std::copy(
|
||||||
begin(Input),
|
begin(Input),
|
||||||
detail::trim_end(
|
::boost::algorithm::detail::trim_end(
|
||||||
begin(Input),
|
begin(Input),
|
||||||
end(Input),
|
end(Input),
|
||||||
IsSpace ),
|
IsSpace ),
|
||||||
@ -182,7 +186,7 @@ namespace boost {
|
|||||||
{
|
{
|
||||||
return SequenceT(
|
return SequenceT(
|
||||||
begin(Input),
|
begin(Input),
|
||||||
detail::trim_end(
|
::boost::algorithm::detail::trim_end(
|
||||||
begin(Input),
|
begin(Input),
|
||||||
end(Input),
|
end(Input),
|
||||||
IsSpace)
|
IsSpace)
|
||||||
@ -223,7 +227,7 @@ namespace boost {
|
|||||||
inline void trim_right_if(SequenceT& Input, PredicateT IsSpace)
|
inline void trim_right_if(SequenceT& Input, PredicateT IsSpace)
|
||||||
{
|
{
|
||||||
Input.erase(
|
Input.erase(
|
||||||
detail::trim_end(
|
::boost::algorithm::detail::trim_end(
|
||||||
begin(Input),
|
begin(Input),
|
||||||
end(Input),
|
end(Input),
|
||||||
IsSpace ),
|
IsSpace ),
|
||||||
@ -258,7 +262,7 @@ namespace boost {
|
|||||||
or copied to the output iterator
|
or copied to the output iterator
|
||||||
|
|
||||||
\param Output An output iterator to which the result will be copied
|
\param Output An output iterator to which the result will be copied
|
||||||
\param Input An input collection
|
\param Input An input range
|
||||||
\param IsSpace An unary predicate identifying spaces
|
\param IsSpace An unary predicate identifying spaces
|
||||||
\return
|
\return
|
||||||
An output iterator pointing just after the last inserted character or
|
An output iterator pointing just after the last inserted character or
|
||||||
@ -266,15 +270,15 @@ namespace boost {
|
|||||||
|
|
||||||
\note The second variant of this function provides the strong exception-safety guarantee
|
\note The second variant of this function provides the strong exception-safety guarantee
|
||||||
*/
|
*/
|
||||||
template<typename OutputIteratorT, typename CollectionT, typename PredicateT>
|
template<typename OutputIteratorT, typename RangeT, typename PredicateT>
|
||||||
inline OutputIteratorT trim_copy_if(
|
inline OutputIteratorT trim_copy_if(
|
||||||
OutputIteratorT Output,
|
OutputIteratorT Output,
|
||||||
const CollectionT& Input,
|
const RangeT& Input,
|
||||||
PredicateT IsSpace)
|
PredicateT IsSpace)
|
||||||
{
|
{
|
||||||
BOOST_STRING_TYPENAME
|
BOOST_STRING_TYPENAME
|
||||||
const_iterator_of<CollectionT>::type TrimEnd=
|
range_const_iterator<RangeT>::type TrimEnd=
|
||||||
detail::trim_end(
|
::boost::algorithm::detail::trim_end(
|
||||||
begin(Input),
|
begin(Input),
|
||||||
end(Input),
|
end(Input),
|
||||||
IsSpace);
|
IsSpace);
|
||||||
@ -297,8 +301,8 @@ namespace boost {
|
|||||||
inline SequenceT trim_copy_if(const SequenceT& Input, PredicateT IsSpace)
|
inline SequenceT trim_copy_if(const SequenceT& Input, PredicateT IsSpace)
|
||||||
{
|
{
|
||||||
BOOST_STRING_TYPENAME
|
BOOST_STRING_TYPENAME
|
||||||
const_iterator_of<SequenceT>::type TrimEnd=
|
range_const_iterator<SequenceT>::type TrimEnd=
|
||||||
detail::trim_end(
|
::boost::algorithm::detail::trim_end(
|
||||||
begin(Input),
|
begin(Input),
|
||||||
end(Input),
|
end(Input),
|
||||||
IsSpace);
|
IsSpace);
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
<body text="#000000" bgcolor="#FFFFFF" link="#0000EE" vlink="#551A8B" alink="#FF0000">
|
<body text="#000000" bgcolor="#FFFFFF" link="#0000EE" vlink="#551A8B" alink="#FF0000">
|
||||||
|
|
||||||
<h2><img src="../../../boost.png" WIDTH="276" HEIGHT="86">Header <<A
|
<h2><img src="../../../boost.png" WIDTH="276" HEIGHT="86">Header <<A
|
||||||
HREF="../../../../boost/minmax.hpp">boost/algorithm/minmax.hpp</A>> </H2>
|
HREF="../../../boost/algorithm/minmax.hpp">boost/algorithm/minmax.hpp</A>> </H2>
|
||||||
|
|
||||||
<quote>
|
<quote>
|
||||||
<b>
|
<b>
|
||||||
@ -19,7 +19,7 @@ HREF="../../../../boost/minmax.hpp">boost/algorithm/minmax.hpp</A>> </H2>
|
|||||||
<a href="#synopsis">Synopsis</a><br>
|
<a href="#synopsis">Synopsis</a><br>
|
||||||
<a href="#description">Function templates description</a><br>
|
<a href="#description">Function templates description</a><br>
|
||||||
<a href="#definition">Definition</a><br>
|
<a href="#definition">Definition</a><br>
|
||||||
<a href="#reqs">Requirements on type</a>s<br>
|
<a href="#reqs">Requirements on types</a><br>
|
||||||
<a href="#precond">Preconditions</a><br>
|
<a href="#precond">Preconditions</a><br>
|
||||||
<a href="#postcond">Postconditions</a><br>
|
<a href="#postcond">Postconditions</a><br>
|
||||||
<a href="#complexity">Complexity</a><br>
|
<a href="#complexity">Complexity</a><br>
|
||||||
@ -71,7 +71,7 @@ but I ruled against that (see <a href="#no-policy">rationale</a>).
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>If you are interested about
|
<p>If you are interested about
|
||||||
<a href="minmax_benchs.html">performance</a>,
|
<a href="doc/minmax_benchs.html">performance</a>,
|
||||||
you will see that <tt>minmax_element</tt> is just slightly less efficient
|
you will see that <tt>minmax_element</tt> is just slightly less efficient
|
||||||
than a single <tt>min_element</tt> or <tt>max_element</tt>, and thus
|
than a single <tt>min_element</tt> or <tt>max_element</tt>, and thus
|
||||||
twice as efficient as two separate calls to <tt>min_element</tt> and
|
twice as efficient as two separate calls to <tt>min_element</tt> and
|
||||||
@ -95,7 +95,7 @@ namespace boost {
|
|||||||
tuple<T const&, T const&> >
|
tuple<T const&, T const&> >
|
||||||
minmax(const T& a, const T& b);
|
minmax(const T& a, const T& b);
|
||||||
|
|
||||||
template <class T, class <a href="http://www.sgi.com/tech/stl/ BinaryPredicate.html">BinaryPredicate</a>>
|
template <class T, class <a href="http://www.sgi.com/tech/stl/BinaryPredicate.html">BinaryPredicate</a>>
|
||||||
tuple<T const&, T const&> >
|
tuple<T const&, T const&> >
|
||||||
minmax(const T& a, const T& b, BinaryPredicate comp);
|
minmax(const T& a, const T& b, BinaryPredicate comp);
|
||||||
|
|
||||||
@ -301,8 +301,8 @@ the library under
|
|||||||
<a name="notes">
|
<a name="notes">
|
||||||
<h3>
|
<h3>
|
||||||
Notes</h3>
|
Notes</h3>
|
||||||
<a NAME="Note1"></a><a href="#Note1">[1]</a>We do not support
|
<a NAME="Note1"></a><a href="#Note1">[1]</a> We do not support
|
||||||
idioms such as <tt><a href="http://www.boost.org/libs/tuple/doc/tuple_users_guide.html#tiers">tie</a>(a,b)=minmax(a,b)</tt>
|
idioms such as <tt><a href="../../tuple/doc/tuple_users_guide.html#tiers">tie</a>(a,b)=minmax(a,b)</tt>
|
||||||
to order two elements <tt>a</tt>, <tt>b</tt>, although this would have
|
to order two elements <tt>a</tt>, <tt>b</tt>, although this would have
|
||||||
the desired effect if we returned a reference instead of a constant
|
the desired effect if we returned a reference instead of a constant
|
||||||
reference. The reason is that two unnecessary assignments are
|
reference. The reason is that two unnecessary assignments are
|
||||||
|
@ -11,7 +11,10 @@ import testing ;
|
|||||||
|
|
||||||
{
|
{
|
||||||
test-suite algorithm/minmax:
|
test-suite algorithm/minmax:
|
||||||
[ run minmax_element_test.cpp ]
|
: [ run minmax_element_test.cpp
|
||||||
|
: : : : minmax_element ]
|
||||||
|
[ run minmax_test.cpp
|
||||||
|
: : : : minmax ]
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <set>
|
#include <set>
|
||||||
|
#include <cstdlib>
|
||||||
|
|
||||||
#include <boost/config.hpp> /* prevents some nasty warns in MSVC */
|
#include <boost/config.hpp> /* prevents some nasty warns in MSVC */
|
||||||
#include <boost/algorithm/minmax_element.hpp>
|
#include <boost/algorithm/minmax_element.hpp>
|
||||||
@ -226,6 +227,10 @@ void test(int n BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(Value))
|
|||||||
|
|
||||||
int test_main( int argc, char* argv[] )
|
int test_main( int argc, char* argv[] )
|
||||||
{
|
{
|
||||||
|
#ifndef BOOST_NO_STDC_NAMESPACE
|
||||||
|
using std::atoi;
|
||||||
|
#endif
|
||||||
|
|
||||||
int n = 100;
|
int n = 100;
|
||||||
if (argc > 1) n = atoi(argv[1]);
|
if (argc > 1) n = atoi(argv[1]);
|
||||||
|
|
||||||
|
@ -21,7 +21,6 @@ doxygen autodoc
|
|||||||
[ glob ../../../../boost/algorithm/string/iterator_range.hpp ]
|
[ glob ../../../../boost/algorithm/string/iterator_range.hpp ]
|
||||||
[ glob ../../../../boost/algorithm/string/sequence_traits.hpp ]
|
[ glob ../../../../boost/algorithm/string/sequence_traits.hpp ]
|
||||||
[ glob ../../../../boost/algorithm/string/std_containers_traits.hpp ]
|
[ glob ../../../../boost/algorithm/string/std_containers_traits.hpp ]
|
||||||
[ glob ../../../../boost/algorithm/string/collection_traits.hpp ]
|
|
||||||
[ glob ../../../../boost/algorithm/string/concept.hpp ]
|
[ glob ../../../../boost/algorithm/string/concept.hpp ]
|
||||||
[ glob ../../../../boost/algorithm/string/compare.hpp ]
|
[ glob ../../../../boost/algorithm/string/compare.hpp ]
|
||||||
[ glob ../../../../boost/algorithm/string/constants.hpp ]
|
[ glob ../../../../boost/algorithm/string/constants.hpp ]
|
||||||
|
@ -18,15 +18,13 @@
|
|||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
<emphasis role="bold">Definition:</emphasis> A string is a
|
<emphasis role="bold">Definition:</emphasis> A string is a
|
||||||
<ulink url="../../libs/utility/Collection.html">collection</ulink> of characters accessible in sequential
|
<ulink url="../../libs/range/doc/range.html">range</ulink> of characters accessible in sequential
|
||||||
ordered fashion. Character is any value type with "cheap" copying and assignment.
|
ordered fashion. Character is any value type with "cheap" copying and assignment.
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
First requirement of string-type is that it must accessible using
|
First requirement of string-type is that it must accessible using
|
||||||
<link linkend="string_algo.collection_traits">collection traits</link>. This facility allows to access
|
<ulink url="../../libs/range/index.html">Boost.Range</ulink>. This facility allows to access
|
||||||
the elements inside the string in a uniform iterator-based fashion.
|
the elements inside the string in a uniform iterator-based fashion.
|
||||||
This requirement is actually less stringent than that of collection concept. It implements
|
|
||||||
an <ulink url="../../libs/algorithm/string/doc/external_concepts.html">external</ulink> collection interface.
|
|
||||||
This is sufficient for our library
|
This is sufficient for our library
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
@ -42,166 +40,11 @@
|
|||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
In the reference and also in the code, requirement on the string type is designated by the name of
|
In the reference and also in the code, requirement on the string type is designated by the name of
|
||||||
template argument. <code>CollectionT</code> means that the basic collection requirements must hold.
|
template argument. <code>RangeT</code> means that the basic range requirements must hold.
|
||||||
<code>SequenceT</code> designates extended sequence requirements.
|
<code>SequenceT</code> designates extended sequence requirements.
|
||||||
</para>
|
</para>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
|
||||||
<section id="string_algo.iterator_range">
|
|
||||||
<title><code>iterator_range</code> class</title>
|
|
||||||
|
|
||||||
<para>
|
|
||||||
An <classname>iterator_range</classname> is an encapsulation of a pair of iterators that
|
|
||||||
delimit a sequence (or, a range). This concept is widely used by
|
|
||||||
sequence manipulating algorithms. Although being so useful, there no direct support
|
|
||||||
for it in the standard library (The closest thing is that some algorithms return a pair of iterators).
|
|
||||||
Instead all STL algorithms have two distinct parameters for beginning and end of a range. This design
|
|
||||||
is natural for implementation of generic algorithms, but it forbids to work with a range as a single value.
|
|
||||||
</para>
|
|
||||||
<para>
|
|
||||||
It is possible to encapsulate a range in <code>std::pair<></code>, but
|
|
||||||
<code>std::pair<></code> is an overly generic encapsulation, so it is not best match for a range.
|
|
||||||
For instance, it does not enforce that begin and end iterators be of the same type.
|
|
||||||
</para>
|
|
||||||
<para>
|
|
||||||
Naturally the range concept is heavily used also in this library. During the development of
|
|
||||||
the library, it was discovered, that there is a need for a reasonable encapsulation for it, since
|
|
||||||
core part of the library deals with substring searching algorithms and any such algorithm
|
|
||||||
returns a range delimiting the result of the search. <code>std::pair<></code> was deemed as
|
|
||||||
unsuitable. Therefore the <code>iterator_range</code> was defined.
|
|
||||||
</para>
|
|
||||||
<para>
|
|
||||||
The intention of the <code>iterator_range</code> class is to manage a range as a single value and provide
|
|
||||||
a basic interface for common operations. Its interface is similar to that of a collection.
|
|
||||||
In addition to <code>begin()</code>
|
|
||||||
and <code>end()</code> accessors, it has member functions for checking whether the range is empty,
|
|
||||||
or to determine the size of the range. It also has a set of member typedefs that extract
|
|
||||||
type information from the encapsulated iterators. As such, the interface is compatible with
|
|
||||||
the <link linkend="string_algo.collection_traits">collection traits</link> requirements so
|
|
||||||
it is possible to use this class as a parameter to many algorithms in this library.
|
|
||||||
</para>
|
|
||||||
<para>
|
|
||||||
<classname>iterator_range</classname> will be moved to Boost.Range library in the future
|
|
||||||
releases. The internal version will be deprecated then.
|
|
||||||
</para>
|
|
||||||
</section>
|
|
||||||
|
|
||||||
<section id="string_algo.collection_traits">
|
|
||||||
<title>Collection Traits</title>
|
|
||||||
|
|
||||||
<para>
|
|
||||||
Collection traits provide uniform access to different types of
|
|
||||||
<ulink url="../../libs/utility/Collection.html">collections</ulink> .
|
|
||||||
This functionality allows to write generic algorithms which work with several
|
|
||||||
different kinds of collections. For this library it means, that, for instance,
|
|
||||||
many algorithms work with <code>std::string</code> as well as with <code>char[]</code>.
|
|
||||||
This facility implements the
|
|
||||||
<ulink url="../../libs/algorithm/string/doc/external_concepts.html">external</ulink> collection
|
|
||||||
concept.
|
|
||||||
</para>
|
|
||||||
<para>
|
|
||||||
The following collection types are supported:
|
|
||||||
<itemizedlist>
|
|
||||||
<listitem>
|
|
||||||
Standard containers
|
|
||||||
</listitem>
|
|
||||||
<listitem>
|
|
||||||
Built-in arrays (like int[])
|
|
||||||
</listitem>
|
|
||||||
<listitem>
|
|
||||||
Null terminated strings (this includes char[],wchar_t[],char*, and wchar_t*)
|
|
||||||
</listitem>
|
|
||||||
<listitem>
|
|
||||||
std::pair<iterator,iterator>
|
|
||||||
</listitem>
|
|
||||||
</itemizedlist>
|
|
||||||
</para>
|
|
||||||
<para>
|
|
||||||
Collection traits support a subset of the container concept (Std §23.1). This subset
|
|
||||||
can be described as an input container concept, e.g. a container with immutable content.
|
|
||||||
Its definition can be found in the header <headername>boost/algorithm/string/collection_traits.hpp</headername>.
|
|
||||||
</para>
|
|
||||||
<para>
|
|
||||||
In the table C denotes a container and c is an object of C.
|
|
||||||
</para>
|
|
||||||
<table>
|
|
||||||
<title>Collection Traits</title>
|
|
||||||
<tgroup cols="3" align="left">
|
|
||||||
<thead>
|
|
||||||
<row>
|
|
||||||
<entry>Name</entry>
|
|
||||||
<entry>Standard collection equivalent</entry>
|
|
||||||
<entry>Description</entry>
|
|
||||||
</row>Maeterlinck
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<row>
|
|
||||||
<entry><classname>value_type_of<C></classname>::type</entry>
|
|
||||||
<entry><code>C::value_type</code></entry>
|
|
||||||
<entry>Type of contained values</entry>
|
|
||||||
</row>
|
|
||||||
<row>
|
|
||||||
<entry><classname>difference_type_of<C></classname>::type</entry>
|
|
||||||
<entry><code>C::difference_type</code></entry>
|
|
||||||
<entry>difference type of the collection</entry>
|
|
||||||
</row>
|
|
||||||
<row>
|
|
||||||
<entry><classname>iterator_of<C></classname>::type</entry>
|
|
||||||
<entry><code>C::iterator</code></entry>
|
|
||||||
<entry>iterator type of the collection</entry>
|
|
||||||
</row>
|
|
||||||
<row>
|
|
||||||
<entry><classname>const_iterator_of<C></classname>::type</entry>
|
|
||||||
<entry><code>C::const_iterator</code></entry>
|
|
||||||
<entry>const_iterator type of the collection</entry>
|
|
||||||
</row>
|
|
||||||
<row>
|
|
||||||
<entry><classname>result_iterator_of<C></classname>::type</entry>
|
|
||||||
<entry></entry>
|
|
||||||
<entry>
|
|
||||||
result_iterator type of the collection. This type maps to <code>C::iterator</code>
|
|
||||||
for mutable collection and <code>C::const_iterator</code> for const collection.
|
|
||||||
</entry>
|
|
||||||
</row>
|
|
||||||
<row>
|
|
||||||
<entry><functionname>begin(c)</functionname></entry>
|
|
||||||
<entry><code>c.begin()</code></entry>
|
|
||||||
<entry>
|
|
||||||
Gets the iterator pointing to the start of the collection.
|
|
||||||
</entry>
|
|
||||||
</row>
|
|
||||||
<row>
|
|
||||||
<entry><functionname>end(c)</functionname></entry>
|
|
||||||
<entry><code>c.end()</code></entry>
|
|
||||||
<entry>
|
|
||||||
Gets the iterator pointing to the end of the collection.
|
|
||||||
</entry>
|
|
||||||
</row>
|
|
||||||
<row>
|
|
||||||
<entry><functionname>size(c)</functionname></entry>
|
|
||||||
<entry><code>c.size()</code></entry>
|
|
||||||
<entry>
|
|
||||||
Gets the size of the collection.
|
|
||||||
</entry>
|
|
||||||
</row>
|
|
||||||
<row>
|
|
||||||
<entry><functionname>empty(c)</functionname></entry>
|
|
||||||
<entry><code>c.empty()</code></entry>
|
|
||||||
<entry>
|
|
||||||
Checks if the collection is empty.
|
|
||||||
</entry>
|
|
||||||
</row>
|
|
||||||
</tbody>
|
|
||||||
</tgroup>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<para>
|
|
||||||
The collection traits are only a temporary part of this library. They will be replaced in the future
|
|
||||||
releases by Boost.Range library. Use of the internal implementation will be deprecated then.
|
|
||||||
</para>
|
|
||||||
|
|
||||||
</section>
|
|
||||||
<section id="string_algo.sequence_traits">
|
<section id="string_algo.sequence_traits">
|
||||||
<title>Sequence Traits</title>
|
<title>Sequence Traits</title>
|
||||||
|
|
||||||
|
17
string/doc/release_notes.xml
Normal file
17
string/doc/release_notes.xml
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!DOCTYPE library PUBLIC "-//Boost//DTD BoostBook XML V1.0//EN"
|
||||||
|
"http://www.boost.org/tools/boostbook/dtd/boostbook.dtd">
|
||||||
|
<section id="string_algo.release_notes" last-revision="$Date$">
|
||||||
|
<title>Release Notes</title>
|
||||||
|
|
||||||
|
<itemizedlist>
|
||||||
|
<listitem>
|
||||||
|
<para><emphasis role="bold">1.32</emphasis></para>
|
||||||
|
<para>Initial release in Boost</para>
|
||||||
|
</listitem>
|
||||||
|
<listitem>
|
||||||
|
<para><emphasis role="bold">1.33</emphasis></para>
|
||||||
|
<para>Internal version of collection traits removed, library adapted to Boost.Range</para>
|
||||||
|
</listitem>
|
||||||
|
</itemizedlist>
|
||||||
|
</section>
|
@ -33,6 +33,7 @@
|
|||||||
|
|
||||||
<title>Boost String Algorithms Library</title>
|
<title>Boost String Algorithms Library</title>
|
||||||
<xi:include href="intro.xml"/>
|
<xi:include href="intro.xml"/>
|
||||||
|
<xi:include href="release_notes.xml"/>
|
||||||
<xi:include href="usage.xml"/>
|
<xi:include href="usage.xml"/>
|
||||||
<xi:include href="quickref.xml"/>
|
<xi:include href="quickref.xml"/>
|
||||||
<xi:include href="design.xml"/>
|
<xi:include href="design.xml"/>
|
||||||
|
@ -46,10 +46,10 @@
|
|||||||
<code>to_lower(str1)</code>, than <code>to_lower(str1.begin(), str1.end())</code>.
|
<code>to_lower(str1)</code>, than <code>to_lower(str1.begin(), str1.end())</code>.
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
The magic of <link linkend="string_algo.collection_traits">collection_traits</link>
|
The magic of <ulink url="../../libs/range/index.html">Boost.Range</ulink>
|
||||||
provides a uniform way of handling different string types.
|
provides a uniform way of handling different string types.
|
||||||
If there is a need to pass a pair of iterators,
|
If there is a need to pass a pair of iterators,
|
||||||
<link linkend="string_algo.iterator_range"><code>iterator_range</code></link>
|
<ulink url="../../libs/range/doc/utility_class.html"><code>boost::iterator_range</code></ulink>
|
||||||
can be used to package iterators into a structure with a compatible interface.
|
can be used to package iterators into a structure with a compatible interface.
|
||||||
</para>
|
</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
@ -200,16 +200,16 @@
|
|||||||
</programlisting>
|
</programlisting>
|
||||||
<para>
|
<para>
|
||||||
We have used <functionname>find_last()</functionname> to search the <code>text</code> for "ll".
|
We have used <functionname>find_last()</functionname> to search the <code>text</code> for "ll".
|
||||||
The result is given in the <link linkend="string_algo.iterator_range"><code>iterator_range</code></link>.
|
The result is given in the <ulink url="../../libs/range/doc/utility_class.html"><code>boost::iterator_range</code></ulink>.
|
||||||
This range delimits the
|
This range delimits the
|
||||||
part of the input which satisfies the find criteria. In our example it is the last occurrence of "ll".
|
part of the input which satisfies the find criteria. In our example it is the last occurrence of "ll".
|
||||||
|
|
||||||
As we can see, input of the <functionname>find_last()</functionname> algorithm can be also
|
As we can see, input of the <functionname>find_last()</functionname> algorithm can be also
|
||||||
char[] because this type is supported by
|
char[] because this type is supported by
|
||||||
<link linkend="string_algo.collection_traits">collection_traits</link>.
|
<ulink linkend="../../libs/range/doc/index.html">Boost.Range</ulink>.
|
||||||
|
|
||||||
The following lines transform the result. Notice that
|
The following lines transform the result. Notice that
|
||||||
<link linkend="string_algo.iterator_range"><code>iterator_range</code></link> has familiar
|
<ulink url="../../libs/range/doc/utility_class.html"><code>boost::iterator_range</code></ulink> has familiar
|
||||||
<code>begin()</code> and <code>end()</code> methods, so it can be used like any other STL container.
|
<code>begin()</code> and <code>end()</code> methods, so it can be used like any other STL container.
|
||||||
Also it is convertible to bool therefore it is easy to use find algorithms for a simple containment checking.
|
Also it is convertible to bool therefore it is easy to use find algorithms for a simple containment checking.
|
||||||
</para>
|
</para>
|
||||||
@ -256,7 +256,7 @@
|
|||||||
the find iterator allows us to iterate over the substrings matching the specified criteria.
|
the find iterator allows us to iterate over the substrings matching the specified criteria.
|
||||||
This facility is using the <link linkend="string_algo.finder_concept">Finder</link> to incrementally
|
This facility is using the <link linkend="string_algo.finder_concept">Finder</link> to incrementally
|
||||||
search the string.
|
search the string.
|
||||||
Dereferencing a find iterator yields an <link linkend="string_algo.iterator_range"><code>iterator_range</code></link>
|
Dereferencing a find iterator yields an <ulink url="../../libs/range/doc/utility_class.html"><code>boost::iterator_range</code></ulink>
|
||||||
object, that delimits the current match.
|
object, that delimits the current match.
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
@ -274,7 +274,7 @@
|
|||||||
It!=string_find_iterator();
|
It!=string_find_iterator();
|
||||||
++It)
|
++It)
|
||||||
{
|
{
|
||||||
cout << copy_iterator_range<std::string>(*It) << endl;
|
cout << copy_range<std::string>(*It) << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Output will be:
|
// Output will be:
|
||||||
@ -288,7 +288,7 @@
|
|||||||
It!=string_find_iterator();
|
It!=string_find_iterator();
|
||||||
++It)
|
++It)
|
||||||
{
|
{
|
||||||
cout << copy_iterator_range<std::string>(*It) << endl;
|
cout << copy_range<std::string>(*It) << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Output will be:
|
// Output will be:
|
||||||
@ -300,7 +300,7 @@
|
|||||||
Note that the find iterators have only one template parameter. It is the base iterator type.
|
Note that the find iterators have only one template parameter. It is the base iterator type.
|
||||||
The Finder is specified at runtime. This allows us to typedef a find iterator for
|
The Finder is specified at runtime. This allows us to typedef a find iterator for
|
||||||
common string types and reuse it. Additionally make_*_iterator functions help
|
common string types and reuse it. Additionally make_*_iterator functions help
|
||||||
to construct a find iterator for a particular collection.
|
to construct a find iterator for a particular range.
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
See the reference in <headername>boost/algorithm/string/find_iterator.hpp</headername>.
|
See the reference in <headername>boost/algorithm/string/find_iterator.hpp</headername>.
|
||||||
|
@ -10,9 +10,10 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
#include <boost/algorithm/string/replace.hpp>
|
//#include <boost/algorithm/string/replace.hpp>
|
||||||
#include <boost/algorithm/string/erase.hpp>
|
//#include <boost/algorithm/string/erase.hpp>
|
||||||
#include <boost/algorithm/string/case_conv.hpp>
|
//#include <boost/algorithm/string/case_conv.hpp>
|
||||||
|
#include <boost/algorithm/string.hpp>
|
||||||
|
|
||||||
//Following two includes contain second-layer function.
|
//Following two includes contain second-layer function.
|
||||||
//They are already included by first-layer header
|
//They are already included by first-layer header
|
||||||
|
@ -24,7 +24,7 @@ using namespace std;
|
|||||||
using namespace boost;
|
using namespace boost;
|
||||||
|
|
||||||
// replace mark specification, specialize for a specific element type
|
// replace mark specification, specialize for a specific element type
|
||||||
template< typename T > T repeat_mark() { return std::numeric_limits<T>::max(); };
|
template< typename T > T repeat_mark() { return (std::numeric_limits<T>::max)(); };
|
||||||
|
|
||||||
// Compression -----------------------------------------------------------------------
|
// Compression -----------------------------------------------------------------------
|
||||||
|
|
||||||
@ -59,7 +59,7 @@ struct find_compressF
|
|||||||
{
|
{
|
||||||
input_iterator_type It2=It++;
|
input_iterator_type It2=It++;
|
||||||
|
|
||||||
if ( It==End || Cnt>=std::numeric_limits<value_type>::max() )
|
if ( It==End || Cnt>=(std::numeric_limits<value_type>::max)() )
|
||||||
{
|
{
|
||||||
return result_type( MStart, It );
|
return result_type( MStart, It );
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,6 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <boost/algorithm/string/iterator_range.hpp>
|
|
||||||
#include <boost/algorithm/string/classification.hpp>
|
#include <boost/algorithm/string/classification.hpp>
|
||||||
#include <boost/algorithm/string/split.hpp>
|
#include <boost/algorithm/string/split.hpp>
|
||||||
#include <boost/algorithm/string/find_iterator.hpp>
|
#include <boost/algorithm/string/find_iterator.hpp>
|
||||||
@ -36,7 +35,7 @@ int main()
|
|||||||
It!=string_find_iterator();
|
It!=string_find_iterator();
|
||||||
++It)
|
++It)
|
||||||
{
|
{
|
||||||
cout << copy_iterator_range<std::string>(*It) << endl;
|
cout << copy_range<std::string>(*It) << endl;
|
||||||
// shift all chars in the match by one
|
// shift all chars in the match by one
|
||||||
transform(
|
transform(
|
||||||
It->begin(), It->end(),
|
It->begin(), It->end(),
|
||||||
|
@ -18,14 +18,6 @@ DEPENDS all : test ;
|
|||||||
{
|
{
|
||||||
test-suite algorithm/string
|
test-suite algorithm/string
|
||||||
: [ run
|
: [ run
|
||||||
container_test.cpp
|
|
||||||
: :
|
|
||||||
:
|
|
||||||
std::locale-support
|
|
||||||
std::facet-support
|
|
||||||
: container
|
|
||||||
]
|
|
||||||
[ run
|
|
||||||
trim_test.cpp
|
trim_test.cpp
|
||||||
: :
|
: :
|
||||||
:
|
:
|
||||||
|
@ -11,12 +11,6 @@ import testing ;
|
|||||||
|
|
||||||
test-suite algorithm/string
|
test-suite algorithm/string
|
||||||
: [ run
|
: [ run
|
||||||
container_test.cpp
|
|
||||||
: :
|
|
||||||
:
|
|
||||||
: container
|
|
||||||
]
|
|
||||||
[ run
|
|
||||||
trim_test.cpp
|
trim_test.cpp
|
||||||
: :
|
: :
|
||||||
:
|
:
|
||||||
|
@ -1,127 +0,0 @@
|
|||||||
// Boost string_algo library substr_test.cpp file ------------------//
|
|
||||||
|
|
||||||
// Copyright Pavol Droba 2002-2003. Use, modification and
|
|
||||||
// distribution is subject to the Boost Software License, Version
|
|
||||||
// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
|
||||||
// http://www.boost.org/LICENSE_1_0.txt)
|
|
||||||
|
|
||||||
// See http://www.boost.org for updates, documentation, and revision history.
|
|
||||||
|
|
||||||
#include <boost/algorithm/string/collection_traits.hpp>
|
|
||||||
// equals predicate is used for result comparison
|
|
||||||
#include <boost/algorithm/string/predicate.hpp>
|
|
||||||
|
|
||||||
// Include unit test framework
|
|
||||||
#include <boost/test/included/test_exec_monitor.hpp>
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
#include <utility>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
#include <boost/type_traits.hpp>
|
|
||||||
|
|
||||||
// test tools
|
|
||||||
#include <boost/test/test_tools.hpp>
|
|
||||||
|
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
using namespace boost;
|
|
||||||
|
|
||||||
namespace algo = ::boost::algorithm;
|
|
||||||
|
|
||||||
template< typename T >
|
|
||||||
void argument_cv_test( const T& C, const string& strResult )
|
|
||||||
{
|
|
||||||
BOOST_CHECK( equals( make_iterator_range(algo::begin(C),algo::end(C)), strResult ) );
|
|
||||||
BOOST_CHECK( algo::size(C)==strResult.size() );
|
|
||||||
BOOST_CHECK( algo::empty(C)==strResult.empty() );
|
|
||||||
}
|
|
||||||
|
|
||||||
template< typename T >
|
|
||||||
void argument_test( T& C, const string& strResult )
|
|
||||||
{
|
|
||||||
BOOST_CHECK( equals( make_iterator_range(algo::begin(C),algo::end(C)), strResult ) );
|
|
||||||
BOOST_CHECK( algo::size(C)==strResult.size() );
|
|
||||||
BOOST_CHECK( algo::empty(C)==strResult.empty() );
|
|
||||||
}
|
|
||||||
|
|
||||||
void container_test()
|
|
||||||
{
|
|
||||||
BOOST_CHECKPOINT( "type test" );
|
|
||||||
|
|
||||||
// types test
|
|
||||||
BOOST_REQUIRE( (is_same<
|
|
||||||
algo::result_iterator_of<string>::type,
|
|
||||||
string::iterator>::value) );
|
|
||||||
BOOST_REQUIRE( (is_same<
|
|
||||||
algo::result_iterator_of<const string>::type,
|
|
||||||
string::const_iterator>::value) );
|
|
||||||
BOOST_REQUIRE( (is_same<
|
|
||||||
algo::result_iterator_of<char[4]>::type, char*>::value) );
|
|
||||||
BOOST_REQUIRE( (is_same<
|
|
||||||
algo::result_iterator_of<const char[4]>::type,
|
|
||||||
const char*>::value) );
|
|
||||||
BOOST_REQUIRE( (is_same<
|
|
||||||
algo::result_iterator_of<char*>::type, char*>::value) );
|
|
||||||
BOOST_REQUIRE( (is_same<
|
|
||||||
algo::result_iterator_of<const char*>::type,
|
|
||||||
const char*>::value) );
|
|
||||||
BOOST_REQUIRE( (is_same<
|
|
||||||
algo::result_iterator_of<
|
|
||||||
pair<string::iterator, string::iterator> >::type, string::iterator>::value) );
|
|
||||||
BOOST_REQUIRE( (is_same<
|
|
||||||
algo::result_iterator_of<
|
|
||||||
const pair<string::iterator, string::iterator> >::type,
|
|
||||||
string::iterator>::value) );
|
|
||||||
|
|
||||||
BOOST_CHECKPOINT( "non-empty sequence test" );
|
|
||||||
|
|
||||||
string str1("abc");
|
|
||||||
vector<char> vec1( str1.begin(), str1.end() );
|
|
||||||
pair<string::iterator, string::iterator> pair1=
|
|
||||||
make_pair( str1.begin(), str1.end() );
|
|
||||||
char ach1[]="abc";
|
|
||||||
char *pch1="abc";
|
|
||||||
|
|
||||||
// begin/end tests
|
|
||||||
argument_cv_test( str1, "abc" );
|
|
||||||
argument_test( str1, "abc" );
|
|
||||||
argument_cv_test( vec1, "abc" );
|
|
||||||
argument_test( vec1, "abc" );
|
|
||||||
argument_cv_test( pair1, "abc" );
|
|
||||||
argument_test( pair1, "abc" );
|
|
||||||
argument_cv_test( ach1, "abc" );
|
|
||||||
argument_test( ach1, "abc" );
|
|
||||||
argument_cv_test( pch1, "abc" );
|
|
||||||
argument_test( pch1, "abc" );
|
|
||||||
|
|
||||||
BOOST_CHECKPOINT( "empty sequence test" );
|
|
||||||
|
|
||||||
string str2;
|
|
||||||
vector<char> vec2( str2.begin(), str2.end() );
|
|
||||||
pair<string::iterator, string::iterator> pair2=
|
|
||||||
make_pair( str2.begin(), str2.end() );
|
|
||||||
char ach2[]="";
|
|
||||||
char *pch2=0;
|
|
||||||
|
|
||||||
// begin/end tests
|
|
||||||
argument_cv_test( str2, "" );
|
|
||||||
argument_test( str2, "" );
|
|
||||||
argument_cv_test( vec2, "" );
|
|
||||||
argument_test( vec2, "" );
|
|
||||||
argument_cv_test( pair2, "" );
|
|
||||||
argument_test( pair2, "" );
|
|
||||||
argument_cv_test( ach2, "" );
|
|
||||||
argument_test( ach2, "" );
|
|
||||||
argument_cv_test( pch2, "" );
|
|
||||||
argument_test( pch2, "" );
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
// test main
|
|
||||||
int test_main( int, char*[] )
|
|
||||||
{
|
|
||||||
container_test();
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
@ -82,8 +82,8 @@ void conv_test()
|
|||||||
to_upper( str3 );
|
to_upper( str3 );
|
||||||
BOOST_CHECK( str3=="" );
|
BOOST_CHECK( str3=="" );
|
||||||
|
|
||||||
free(pch1);
|
delete[] pch1;
|
||||||
free(pch2);
|
delete[] pch2;
|
||||||
}
|
}
|
||||||
|
|
||||||
// test main
|
// test main
|
||||||
|
@ -28,7 +28,7 @@ void find_test()
|
|||||||
string str1("123abcxXxabcXxXabc321");
|
string str1("123abcxXxabcXxXabc321");
|
||||||
string str2("abc");
|
string str2("abc");
|
||||||
string str3("");
|
string str3("");
|
||||||
char* pch1="123abcxxxabcXXXabc321";
|
const char* pch1="123abcxxxabcXXXabc321";
|
||||||
vector<int> vec1( str1.begin(), str1.end() );
|
vector<int> vec1( str1.begin(), str1.end() );
|
||||||
|
|
||||||
// find results ------------------------------------------------------------//
|
// find results ------------------------------------------------------------//
|
||||||
|
@ -25,7 +25,7 @@ using namespace boost;
|
|||||||
static void find_test()
|
static void find_test()
|
||||||
{
|
{
|
||||||
string str1("123a1cxxxa23cXXXa456c321");
|
string str1("123a1cxxxa23cXXXa456c321");
|
||||||
char* pch1="123a1cxxxa23cXXXa456c321";
|
const char* pch1="123a1cxxxa23cXXXa456c321";
|
||||||
regex rx("a[0-9]+c");
|
regex rx("a[0-9]+c");
|
||||||
vector<int> vec1( str1.begin(), str1.end() );
|
vector<int> vec1( str1.begin(), str1.end() );
|
||||||
vector<string> tokens;
|
vector<string> tokens;
|
||||||
|
@ -38,9 +38,9 @@ void deep_compare( const T1& X, const T2& Y )
|
|||||||
void iterator_test()
|
void iterator_test()
|
||||||
{
|
{
|
||||||
string str1("xx-abc--xx-abb");
|
string str1("xx-abc--xx-abb");
|
||||||
string str2("Xx-abc--xX-abb");
|
string str2("Xx-abc--xX-abb-xx");
|
||||||
string str3("xx");
|
string str3("xx");
|
||||||
char* pch1="xx-abc--xx-abb";
|
const char* pch1="xx-abc--xx-abb";
|
||||||
vector<string> tokens;
|
vector<string> tokens;
|
||||||
vector< vector<int> > vtokens;
|
vector< vector<int> > vtokens;
|
||||||
|
|
||||||
@ -59,9 +59,10 @@ void iterator_test()
|
|||||||
str2,
|
str2,
|
||||||
"xx" );
|
"xx" );
|
||||||
|
|
||||||
BOOST_REQUIRE( tokens.size()==2 );
|
BOOST_REQUIRE( tokens.size()==3 );
|
||||||
BOOST_CHECK( tokens[0]==string("Xx") );
|
BOOST_CHECK( tokens[0]==string("Xx") );
|
||||||
BOOST_CHECK( tokens[1]==string("xX") );
|
BOOST_CHECK( tokens[1]==string("xX") );
|
||||||
|
BOOST_CHECK( tokens[2]==string("xx") );
|
||||||
|
|
||||||
find_all(
|
find_all(
|
||||||
tokens,
|
tokens,
|
||||||
@ -81,14 +82,15 @@ void iterator_test()
|
|||||||
// split tests
|
// split tests
|
||||||
split(
|
split(
|
||||||
tokens,
|
tokens,
|
||||||
str1,
|
str2,
|
||||||
is_any_of("x"),
|
is_any_of("xX"),
|
||||||
token_compress_on );
|
token_compress_on );
|
||||||
|
|
||||||
BOOST_REQUIRE( tokens.size()==3 );
|
BOOST_REQUIRE( tokens.size()==4 );
|
||||||
BOOST_CHECK( tokens[0]==string("") );
|
BOOST_CHECK( tokens[0]==string("") );
|
||||||
BOOST_CHECK( tokens[1]==string("-abc--") );
|
BOOST_CHECK( tokens[1]==string("-abc--") );
|
||||||
BOOST_CHECK( tokens[2]==string("-abb") );
|
BOOST_CHECK( tokens[2]==string("-abb-") );
|
||||||
|
BOOST_CHECK( tokens[3]==string("") );
|
||||||
|
|
||||||
split(
|
split(
|
||||||
tokens,
|
tokens,
|
||||||
|
Reference in New Issue
Block a user