mirror of
https://github.com/boostorg/algorithm.git
synced 2025-06-25 12:01:39 +02:00
Compare commits
30 Commits
svn-branch
...
boost-1.33
Author | SHA1 | Date | |
---|---|---|---|
c1850cfe6e | |||
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 |
@ -15,7 +15,6 @@
|
||||
*/
|
||||
|
||||
#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/case_conv.hpp>
|
||||
#include <boost/algorithm/string/predicate.hpp>
|
||||
|
@ -14,7 +14,11 @@
|
||||
#include <algorithm>
|
||||
#include <locale>
|
||||
#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>
|
||||
|
||||
/*! \file
|
||||
@ -35,7 +39,7 @@ namespace boost {
|
||||
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 Input An input collection
|
||||
\param Input An input range
|
||||
\param Loc A locale used for conversion
|
||||
\return
|
||||
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
|
||||
|
||||
*/
|
||||
template<typename OutputIteratorT, typename CollectionT>
|
||||
template<typename OutputIteratorT, typename RangeT>
|
||||
inline OutputIteratorT
|
||||
to_lower_copy(
|
||||
OutputIteratorT Output,
|
||||
const CollectionT& Input,
|
||||
const RangeT& Input,
|
||||
const std::locale& Loc=std::locale())
|
||||
{
|
||||
return std::transform(
|
||||
begin(Input),
|
||||
end(Input),
|
||||
Output,
|
||||
detail::to_lowerF<
|
||||
typename value_type_of<CollectionT>::type >(Loc));
|
||||
::boost::algorithm::detail::to_lowerF<
|
||||
typename range_value<RangeT>::type >(Loc));
|
||||
}
|
||||
|
||||
//! Convert to lower case
|
||||
@ -71,12 +75,12 @@ namespace boost {
|
||||
return SequenceT(
|
||||
make_transform_iterator(
|
||||
begin(Input),
|
||||
detail::to_lowerF<
|
||||
typename value_type_of<SequenceT>::type >(Loc)),
|
||||
::boost::algorithm::detail::to_lowerF<
|
||||
typename range_value<SequenceT>::type >(Loc)),
|
||||
make_transform_iterator(
|
||||
end(Input),
|
||||
detail::to_lowerF<
|
||||
typename value_type_of<SequenceT>::type >(Loc)));
|
||||
::boost::algorithm::detail::to_lowerF<
|
||||
typename range_value<SequenceT>::type >(Loc)));
|
||||
}
|
||||
|
||||
//! Convert to lower case
|
||||
@ -84,20 +88,20 @@ namespace boost {
|
||||
Each element of the input sequence is converted to lower
|
||||
case. The input sequence is modified in-place.
|
||||
|
||||
\param Input A collection
|
||||
\param Input A range
|
||||
\param Loc a locale used for conversion
|
||||
*/
|
||||
template<typename MutableCollectionT>
|
||||
template<typename WritableRangeT>
|
||||
inline void to_lower(
|
||||
MutableCollectionT& Input,
|
||||
WritableRangeT& Input,
|
||||
const std::locale& Loc=std::locale())
|
||||
{
|
||||
std::transform(
|
||||
begin(Input),
|
||||
end(Input),
|
||||
begin(Input),
|
||||
detail::to_lowerF<
|
||||
typename value_type_of<MutableCollectionT>::type >(Loc));
|
||||
::boost::algorithm::detail::to_lowerF<
|
||||
typename range_value<WritableRangeT>::type >(Loc));
|
||||
}
|
||||
|
||||
// to_upper -----------------------------------------------//
|
||||
@ -109,7 +113,7 @@ namespace boost {
|
||||
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 Input An input collection
|
||||
\param Input An input range
|
||||
\param Loc A locale used for conversion
|
||||
\return
|
||||
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
|
||||
*/
|
||||
template<typename OutputIteratorT, typename CollectionT>
|
||||
template<typename OutputIteratorT, typename RangeT>
|
||||
inline OutputIteratorT
|
||||
to_upper_copy(
|
||||
OutputIteratorT Output,
|
||||
const CollectionT& Input,
|
||||
const RangeT& Input,
|
||||
const std::locale& Loc=std::locale())
|
||||
{
|
||||
return std::transform(
|
||||
begin(Input),
|
||||
end(Input),
|
||||
Output,
|
||||
detail::to_upperF<
|
||||
typename value_type_of<CollectionT>::type >(Loc));
|
||||
::boost::algorithm::detail::to_upperF<
|
||||
typename range_value<RangeT>::type >(Loc));
|
||||
}
|
||||
|
||||
//! Convert to upper case
|
||||
@ -144,12 +148,12 @@ namespace boost {
|
||||
return SequenceT(
|
||||
make_transform_iterator(
|
||||
begin(Input),
|
||||
detail::to_upperF<
|
||||
typename value_type_of<SequenceT>::type >(Loc)),
|
||||
::boost::algorithm::detail::to_upperF<
|
||||
typename range_value<SequenceT>::type >(Loc)),
|
||||
make_transform_iterator(
|
||||
end(Input),
|
||||
detail::to_upperF<
|
||||
typename value_type_of<SequenceT>::type >(Loc)));
|
||||
::boost::algorithm::detail::to_upperF<
|
||||
typename range_value<SequenceT>::type >(Loc)));
|
||||
|
||||
}
|
||||
|
||||
@ -158,20 +162,20 @@ namespace boost {
|
||||
Each element of the input sequence is converted to upper
|
||||
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
|
||||
*/
|
||||
template<typename MutableCollectionT>
|
||||
template<typename WritableRangeT>
|
||||
inline void to_upper(
|
||||
MutableCollectionT& Input,
|
||||
WritableRangeT& Input,
|
||||
const std::locale& Loc=std::locale())
|
||||
{
|
||||
std::transform(
|
||||
begin(Input),
|
||||
end(Input),
|
||||
begin(Input),
|
||||
detail::to_upperF<
|
||||
typename value_type_of<MutableCollectionT>::type >(Loc));
|
||||
::boost::algorithm::detail::to_upperF<
|
||||
typename range_value<WritableRangeT>::type >(Loc));
|
||||
}
|
||||
|
||||
} // namespace algorithm
|
||||
|
@ -12,6 +12,7 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include <locale>
|
||||
#include <boost/range/value_type.hpp>
|
||||
#include <boost/algorithm/string/detail/classification.hpp>
|
||||
#include <boost/algorithm/string/predicate_facade.hpp>
|
||||
|
||||
@ -193,13 +194,13 @@ namespace boost {
|
||||
\param Set A set of characters to be recognized
|
||||
\return An instance of the \c is_any_of predicate
|
||||
*/
|
||||
template<typename ContainerT>
|
||||
template<typename RangeT>
|
||||
inline detail::is_any_ofF<
|
||||
BOOST_STRING_TYPENAME value_type_of<ContainerT>::type>
|
||||
is_any_of( const ContainerT& Set )
|
||||
BOOST_STRING_TYPENAME range_value<RangeT>::type>
|
||||
is_any_of( const RangeT& Set )
|
||||
{
|
||||
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
|
||||
|
@ -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
|
@ -14,7 +14,7 @@
|
||||
#include <locale>
|
||||
|
||||
/*! \file
|
||||
Defines element comparison predicates. Many algorithms in this library can
|
||||
Defines element comparison predicates. Many algorithms in this library can
|
||||
take an additional argument with a predicate used to compare elements.
|
||||
This makes it possible, for instance, to have case insensitive versions
|
||||
of the algorithms.
|
||||
@ -22,7 +22,7 @@
|
||||
|
||||
namespace boost {
|
||||
namespace algorithm {
|
||||
|
||||
|
||||
// is_equal functor -----------------------------------------------//
|
||||
|
||||
//! is_equal functor
|
||||
@ -54,24 +54,28 @@ namespace boost {
|
||||
/*!
|
||||
\param Loc locales used for comparison
|
||||
*/
|
||||
is_iequal( const std::locale& Loc=std::locale() ) :
|
||||
is_iequal( const std::locale& Loc=std::locale() ) :
|
||||
m_Loc( Loc ) {}
|
||||
|
||||
//! Function operator
|
||||
//! Function operator
|
||||
/*!
|
||||
Compare two operands. Case is ignored.
|
||||
*/
|
||||
template< typename T1, typename T2 >
|
||||
bool operator ()( const T1& Arg1, const T2& Arg2 ) const
|
||||
{
|
||||
return std::toupper(Arg1,m_Loc)==std::toupper(Arg2,m_Loc);
|
||||
#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);
|
||||
#endif
|
||||
}
|
||||
|
||||
private:
|
||||
std::locale m_Loc;
|
||||
};
|
||||
|
||||
} // namespace algorithm
|
||||
} // namespace algorithm
|
||||
|
||||
// pull names to the boost namespace
|
||||
using algorithm::is_equal;
|
||||
|
@ -11,8 +11,9 @@
|
||||
#define BOOST_STRING_CONCEPT_HPP
|
||||
|
||||
#include <boost/concept_check.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>
|
||||
|
||||
/*! \file
|
||||
Defines concepts used in string_algo library
|
||||
|
@ -17,11 +17,7 @@
|
||||
# error "macro already defined!"
|
||||
#endif
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#define BOOST_STRING_TYPENAME
|
||||
#else
|
||||
#define BOOST_STRING_TYPENAME BOOST_DEDUCED_TYPENAME
|
||||
#endif
|
||||
|
||||
// Metrowerks workaround
|
||||
#if BOOST_WORKAROUND(__MWERKS__, <= 0x3003) // 8.x
|
||||
|
@ -20,7 +20,7 @@ namespace boost {
|
||||
|
||||
// case conversion functors -----------------------------------------------//
|
||||
|
||||
// a tolower functor
|
||||
// a tolower functor
|
||||
template<typename CharT>
|
||||
struct to_lowerF : public std::unary_function<CharT, CharT>
|
||||
{
|
||||
@ -30,13 +30,17 @@ namespace boost {
|
||||
// Operation
|
||||
CharT operator ()( CharT Ch ) const
|
||||
{
|
||||
return std::tolower( Ch, m_Loc );
|
||||
#if defined(__BORLANDC__) && (__BORLANDC__ >= 0x560) && (__BORLANDC__ <= 0x564) && !defined(_USE_OLD_RW_STL)
|
||||
return std::tolower( Ch);
|
||||
#else
|
||||
return std::tolower( Ch, m_Loc );
|
||||
#endif
|
||||
}
|
||||
private:
|
||||
const std::locale& m_Loc;
|
||||
};
|
||||
|
||||
// a toupper functor
|
||||
// a toupper functor
|
||||
template<typename CharT>
|
||||
struct to_upperF : public std::unary_function<CharT, CharT>
|
||||
{
|
||||
@ -46,7 +50,11 @@ namespace boost {
|
||||
// Operation
|
||||
CharT operator ()( CharT Ch ) const
|
||||
{
|
||||
return std::toupper( Ch, m_Loc );
|
||||
#if defined(__BORLANDC__) && (__BORLANDC__ >= 0x560) && (__BORLANDC__ <= 0x564) && !defined(_USE_OLD_RW_STL)
|
||||
return std::toupper( Ch);
|
||||
#else
|
||||
return std::toupper( Ch, m_Loc );
|
||||
#endif
|
||||
}
|
||||
private:
|
||||
const std::locale& m_Loc;
|
||||
|
@ -15,16 +15,19 @@
|
||||
#include <functional>
|
||||
#include <locale>
|
||||
#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/type_traits/remove_const.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace algorithm {
|
||||
namespace detail {
|
||||
|
||||
|
||||
// classification functors -----------------------------------------------//
|
||||
|
||||
|
||||
// is_classified functor
|
||||
struct is_classifiedF :
|
||||
public predicate_facade<is_classifiedF>
|
||||
@ -32,7 +35,7 @@ namespace boost {
|
||||
// Boost.Lambda support
|
||||
template <class Args> struct sig { typedef bool type; };
|
||||
|
||||
// Constructor from a locale
|
||||
// Constructor from a locale
|
||||
is_classifiedF(std::ctype_base::mask Type, std::locale const & Loc = std::locale()) :
|
||||
m_Type(Type), m_Locale(Loc) {}
|
||||
|
||||
@ -43,13 +46,21 @@ namespace boost {
|
||||
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:
|
||||
const std::ctype_base::mask m_Type;
|
||||
const std::locale m_Locale;
|
||||
};
|
||||
|
||||
// is_any_of functor
|
||||
/*
|
||||
// is_any_of functor
|
||||
/*
|
||||
returns true if the value is from the specified set
|
||||
*/
|
||||
template<typename CharT>
|
||||
@ -59,26 +70,26 @@ namespace boost {
|
||||
// Boost.Lambda support
|
||||
template <class Args> struct sig { typedef bool type; };
|
||||
|
||||
// Constructor
|
||||
template< typename SeqT >
|
||||
is_any_ofF( const SeqT& Seq ) :
|
||||
m_Set( begin(Seq), end(Seq) ) {}
|
||||
|
||||
// Constructor
|
||||
template<typename RangeT>
|
||||
is_any_ofF( const RangeT& Range ) :
|
||||
m_Set( begin(Range), end(Range) ) {}
|
||||
|
||||
// Operation
|
||||
template<typename Char2T>
|
||||
bool operator()( Char2T Ch ) const
|
||||
{
|
||||
return m_Set.find(Ch)!=m_Set.end();
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
// set cannot operate on const value-type
|
||||
typedef typename remove_const<CharT>::type set_value_type;
|
||||
std::set<set_value_type> m_Set;
|
||||
std::set<set_value_type> m_Set;
|
||||
};
|
||||
|
||||
// is_from_range functor
|
||||
/*
|
||||
// is_from_range functor
|
||||
/*
|
||||
returns true if the value is from the specified range.
|
||||
(i.e. x>=From && x>=To)
|
||||
*/
|
||||
@ -89,16 +100,16 @@ namespace boost {
|
||||
// Boost.Lambda support
|
||||
template <class Args> struct sig { typedef bool type; };
|
||||
|
||||
// Constructor
|
||||
// Constructor
|
||||
is_from_rangeF( CharT From, CharT To ) : m_From(From), m_To(To) {}
|
||||
|
||||
|
||||
// Operation
|
||||
template<typename Char2T>
|
||||
bool operator()( Char2T Ch ) const
|
||||
{
|
||||
return ( m_From <= Ch ) && ( Ch <= m_To );
|
||||
return ( m_From <= Ch ) && ( Ch <= m_To );
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
CharT m_From;
|
||||
CharT m_To;
|
||||
@ -120,11 +131,11 @@ namespace boost {
|
||||
|
||||
// Operation
|
||||
template<typename CharT>
|
||||
bool operator()( CharT Ch ) const
|
||||
bool operator()( CharT Ch ) const
|
||||
{
|
||||
return m_Pred1(Ch) && m_Pred2(Ch);
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
Pred1T m_Pred1;
|
||||
Pred2T m_Pred2;
|
||||
@ -145,11 +156,11 @@ namespace boost {
|
||||
|
||||
// Operation
|
||||
template<typename CharT>
|
||||
bool operator()( CharT Ch ) const
|
||||
bool operator()( CharT Ch ) const
|
||||
{
|
||||
return m_Pred1(Ch) || m_Pred2(Ch);
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
Pred1T m_Pred1;
|
||||
Pred2T m_Pred2;
|
||||
@ -169,11 +180,11 @@ namespace boost {
|
||||
|
||||
// Operation
|
||||
template<typename CharT>
|
||||
bool operator()( CharT Ch ) const
|
||||
bool operator()( CharT Ch ) const
|
||||
{
|
||||
return !m_Pred(Ch);
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
PredT m_Pred;
|
||||
};
|
||||
|
@ -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
|
||||
|
||||
#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/replace_storage.hpp>
|
||||
|
||||
@ -60,7 +62,7 @@ namespace boost {
|
||||
{
|
||||
typedef find_format_store<
|
||||
BOOST_STRING_TYPENAME
|
||||
const_iterator_of<InputT>::type,
|
||||
range_const_iterator<InputT>::type,
|
||||
FormatterT,
|
||||
FormatResultT > store_type;
|
||||
|
||||
@ -121,7 +123,7 @@ namespace boost {
|
||||
{
|
||||
typedef find_format_store<
|
||||
BOOST_STRING_TYPENAME
|
||||
const_iterator_of<InputT>::type,
|
||||
range_const_iterator<InputT>::type,
|
||||
FormatterT,
|
||||
FormatResultT > store_type;
|
||||
|
||||
@ -181,7 +183,7 @@ namespace boost {
|
||||
{
|
||||
typedef find_format_store<
|
||||
BOOST_STRING_TYPENAME
|
||||
iterator_of<InputT>::type,
|
||||
range_iterator<InputT>::type,
|
||||
FormatterT,
|
||||
FormatResultT > store_type;
|
||||
|
||||
|
@ -11,7 +11,9 @@
|
||||
#define BOOST_STRING_FIND_FORMAT_ALL_DETAIL_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/replace_storage.hpp>
|
||||
|
||||
@ -59,7 +61,7 @@ namespace boost {
|
||||
const FormatResultT& FormatResult )
|
||||
{
|
||||
typedef BOOST_STRING_TYPENAME
|
||||
const_iterator_of<InputT>::type input_iterator_type;
|
||||
range_const_iterator<InputT>::type input_iterator_type;
|
||||
|
||||
typedef find_format_store<
|
||||
input_iterator_type,
|
||||
@ -72,7 +74,7 @@ namespace boost {
|
||||
// Initialize last match
|
||||
input_iterator_type LastMatch=begin(Input);
|
||||
|
||||
// Iterate throug all matches
|
||||
// Iterate through all matches
|
||||
while( M )
|
||||
{
|
||||
// Copy the beginning of the sequence
|
||||
@ -126,7 +128,7 @@ namespace boost {
|
||||
const FormatResultT& FormatResult)
|
||||
{
|
||||
typedef BOOST_STRING_TYPENAME
|
||||
const_iterator_of<InputT>::type input_iterator_type;
|
||||
range_const_iterator<InputT>::type input_iterator_type;
|
||||
|
||||
typedef find_format_store<
|
||||
input_iterator_type,
|
||||
@ -142,7 +144,7 @@ namespace boost {
|
||||
// Output temporary
|
||||
InputT Output;
|
||||
|
||||
// Iterate throug all matches
|
||||
// Iterate through all matches
|
||||
while( M )
|
||||
{
|
||||
// Copy the beginning of the sequence
|
||||
@ -196,7 +198,7 @@ namespace boost {
|
||||
FormatResultT FormatResult)
|
||||
{
|
||||
typedef BOOST_STRING_TYPENAME
|
||||
iterator_of<InputT>::type input_iterator_type;
|
||||
range_iterator<InputT>::type input_iterator_type;
|
||||
typedef find_format_store<
|
||||
input_iterator_type,
|
||||
FormatterT,
|
||||
@ -207,7 +209,7 @@ namespace boost {
|
||||
|
||||
// Instantiate replacement storage
|
||||
std::deque<
|
||||
BOOST_STRING_TYPENAME value_type_of<InputT>::type> Storage;
|
||||
BOOST_STRING_TYPENAME range_value<InputT>::type> Storage;
|
||||
|
||||
// Initialize replacement iterators
|
||||
input_iterator_type InsertIt=begin(Input);
|
||||
|
@ -11,8 +11,7 @@
|
||||
#define BOOST_STRING_FIND_FORMAT_STORE_DETAIL_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>
|
||||
|
||||
namespace boost {
|
||||
namespace algorithm {
|
||||
@ -36,7 +35,7 @@ namespace boost {
|
||||
public:
|
||||
// Construction
|
||||
find_format_store(
|
||||
const base_type FindResult,
|
||||
const base_type& FindResult,
|
||||
const format_result_type& FormatResult,
|
||||
const formatter_type& Formatter ) :
|
||||
base_type(FindResult),
|
||||
|
@ -11,7 +11,7 @@
|
||||
#define BOOST_STRING_FIND_ITERATOR_DETAIL_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_categories.hpp>
|
||||
#include <boost/function.hpp>
|
||||
|
@ -13,8 +13,11 @@
|
||||
#include <boost/algorithm/string/config.hpp>
|
||||
#include <boost/algorithm/string/constants.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 algorithm {
|
||||
@ -25,7 +28,7 @@ namespace boost {
|
||||
|
||||
// find a subsequence in the sequence ( functor )
|
||||
/*
|
||||
Returns a pair <begin,end> marking the subsequence in the sequence.
|
||||
Returns a pair <begin,end> marking the subsequence in the sequence.
|
||||
If the find fails, functor returns <End,End>
|
||||
*/
|
||||
template<typename SearchIteratorT,typename PredicateT>
|
||||
@ -35,9 +38,9 @@ namespace boost {
|
||||
|
||||
// Construction
|
||||
template< typename SearchT >
|
||||
first_finderF( const SearchT& Search, PredicateT Comp ) :
|
||||
first_finderF( const SearchT& Search, PredicateT Comp ) :
|
||||
m_Search(begin(Search), end(Search)), m_Comp(Comp) {}
|
||||
first_finderF(
|
||||
first_finderF(
|
||||
search_iterator_type SearchBegin,
|
||||
search_iterator_type SearchEnd,
|
||||
PredicateT Comp ) :
|
||||
@ -46,8 +49,8 @@ namespace boost {
|
||||
// Operation
|
||||
template< typename ForwardIteratorT >
|
||||
iterator_range<ForwardIteratorT>
|
||||
operator()(
|
||||
ForwardIteratorT Begin,
|
||||
operator()(
|
||||
ForwardIteratorT Begin,
|
||||
ForwardIteratorT End ) const
|
||||
{
|
||||
typedef iterator_range<ForwardIteratorT> result_type;
|
||||
@ -58,8 +61,8 @@ namespace boost {
|
||||
OuterIt!=End;
|
||||
++OuterIt)
|
||||
{
|
||||
// Sanity check
|
||||
if( empty(m_Search) )
|
||||
// Sanity check
|
||||
if( boost::empty(m_Search) )
|
||||
return result_type( End, End );
|
||||
|
||||
input_iterator_type InnerIt=OuterIt;
|
||||
@ -68,7 +71,7 @@ namespace boost {
|
||||
InnerIt!=End && SubstrIt!=m_Search.end();
|
||||
++InnerIt,++SubstrIt)
|
||||
{
|
||||
if( !( m_Comp(*InnerIt,*SubstrIt) ) )
|
||||
if( !( m_Comp(*InnerIt,*SubstrIt) ) )
|
||||
break;
|
||||
}
|
||||
|
||||
@ -89,7 +92,7 @@ namespace boost {
|
||||
|
||||
// find the last match a subsequnce in the sequence ( functor )
|
||||
/*
|
||||
Returns a pair <begin,end> marking the subsequence in the sequence.
|
||||
Returns a pair <begin,end> marking the subsequence in the sequence.
|
||||
If the find fails, returns <End,End>
|
||||
*/
|
||||
template<typename SearchIteratorT, typename PredicateT>
|
||||
@ -102,9 +105,9 @@ namespace boost {
|
||||
|
||||
// Construction
|
||||
template< typename SearchT >
|
||||
last_finderF( const SearchT& Search, PredicateT Comp ) :
|
||||
last_finderF( const SearchT& Search, PredicateT Comp ) :
|
||||
m_Search(begin(Search), end(Search)), m_Comp(Comp) {}
|
||||
last_finderF(
|
||||
last_finderF(
|
||||
search_iterator_type SearchBegin,
|
||||
search_iterator_type SearchEnd,
|
||||
PredicateT Comp ) :
|
||||
@ -113,34 +116,34 @@ namespace boost {
|
||||
// Operation
|
||||
template< typename ForwardIteratorT >
|
||||
iterator_range<ForwardIteratorT>
|
||||
operator()(
|
||||
ForwardIteratorT Begin,
|
||||
operator()(
|
||||
ForwardIteratorT Begin,
|
||||
ForwardIteratorT End ) const
|
||||
{
|
||||
typedef iterator_range<ForwardIteratorT> result_type;
|
||||
|
||||
if( empty(m_Search) )
|
||||
if( boost::empty(m_Search) )
|
||||
return result_type( End, End );
|
||||
|
||||
typedef BOOST_STRING_TYPENAME boost::detail::
|
||||
iterator_traits<ForwardIteratorT>::iterator_category category;
|
||||
|
||||
return findit( Begin, End, category() );
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
// forward iterator
|
||||
template< typename ForwardIteratorT >
|
||||
iterator_range<ForwardIteratorT>
|
||||
findit(
|
||||
ForwardIteratorT Begin,
|
||||
ForwardIteratorT End,
|
||||
findit(
|
||||
ForwardIteratorT Begin,
|
||||
ForwardIteratorT End,
|
||||
std::forward_iterator_tag ) const
|
||||
{
|
||||
typedef ForwardIteratorT input_iterator_type;
|
||||
typedef iterator_range<ForwardIteratorT> result_type;
|
||||
|
||||
first_finder_type first_finder(
|
||||
first_finder_type first_finder(
|
||||
m_Search.begin(), m_Search.end(), m_Comp );
|
||||
|
||||
result_type M=first_finder( Begin, End );
|
||||
@ -158,9 +161,9 @@ namespace boost {
|
||||
// bidirectional iterator
|
||||
template< typename ForwardIteratorT >
|
||||
iterator_range<ForwardIteratorT>
|
||||
findit(
|
||||
ForwardIteratorT Begin,
|
||||
ForwardIteratorT End,
|
||||
findit(
|
||||
ForwardIteratorT Begin,
|
||||
ForwardIteratorT End,
|
||||
std::bidirectional_iterator_tag ) const
|
||||
{
|
||||
typedef iterator_range<ForwardIteratorT> result_type;
|
||||
@ -178,7 +181,7 @@ namespace boost {
|
||||
InnerIt!=End && SubstrIt!=m_Search.end();
|
||||
++InnerIt,++SubstrIt)
|
||||
{
|
||||
if( !( m_Comp(*InnerIt,*SubstrIt) ) )
|
||||
if( !( m_Comp(*InnerIt,*SubstrIt) ) )
|
||||
break;
|
||||
}
|
||||
|
||||
@ -194,12 +197,12 @@ namespace boost {
|
||||
iterator_range<search_iterator_type> m_Search;
|
||||
PredicateT m_Comp;
|
||||
};
|
||||
|
||||
|
||||
// find n-th functor -----------------------------------------------//
|
||||
|
||||
// find the n-th match of a subsequnce in the sequence ( functor )
|
||||
/*
|
||||
Returns a pair <begin,end> marking the subsequence in the sequence.
|
||||
Returns a pair <begin,end> marking the subsequence in the sequence.
|
||||
If the find fails, returns <End,End>
|
||||
*/
|
||||
template<typename SearchIteratorT, typename PredicateT>
|
||||
@ -212,50 +215,50 @@ namespace boost {
|
||||
|
||||
// Construction
|
||||
template< typename SearchT >
|
||||
nth_finderF(
|
||||
const SearchT& Search,
|
||||
nth_finderF(
|
||||
const SearchT& Search,
|
||||
unsigned int Nth,
|
||||
PredicateT Comp) :
|
||||
m_Search(begin(Search), end(Search)),
|
||||
PredicateT Comp) :
|
||||
m_Search(begin(Search), end(Search)),
|
||||
m_Nth(Nth),
|
||||
m_Comp(Comp) {}
|
||||
nth_finderF(
|
||||
nth_finderF(
|
||||
search_iterator_type SearchBegin,
|
||||
search_iterator_type SearchEnd,
|
||||
unsigned int Nth,
|
||||
PredicateT Comp) :
|
||||
m_Search(SearchBegin, SearchEnd),
|
||||
m_Search(SearchBegin, SearchEnd),
|
||||
m_Nth(Nth),
|
||||
m_Comp(Comp) {}
|
||||
|
||||
// Operation
|
||||
template< typename ForwardIteratorT >
|
||||
iterator_range<ForwardIteratorT>
|
||||
operator()(
|
||||
ForwardIteratorT Begin,
|
||||
operator()(
|
||||
ForwardIteratorT Begin,
|
||||
ForwardIteratorT End ) const
|
||||
{
|
||||
typedef ForwardIteratorT input_iterator_type;
|
||||
typedef iterator_range<ForwardIteratorT> result_type;
|
||||
|
||||
// Sanity check
|
||||
if( empty(m_Search) )
|
||||
// Sanity check
|
||||
if( boost::empty(m_Search) )
|
||||
return result_type( End, End );
|
||||
|
||||
// Instantiate find funtor
|
||||
first_finder_type first_finder(
|
||||
// Instantiate find funtor
|
||||
first_finder_type first_finder(
|
||||
m_Search.begin(), m_Search.end(), m_Comp );
|
||||
|
||||
result_type M( Begin, Begin );
|
||||
|
||||
for( unsigned int n=0; n<=m_Nth; ++n )
|
||||
{
|
||||
// find next match
|
||||
// find next match
|
||||
M=first_finder( end(M), End );
|
||||
|
||||
if ( !M )
|
||||
{
|
||||
// Subsequence not found, return
|
||||
// Subsequence not found, return
|
||||
return M;
|
||||
}
|
||||
}
|
||||
@ -273,8 +276,8 @@ namespace boost {
|
||||
|
||||
// find a head in the sequence ( functor )
|
||||
/*
|
||||
This functor find a head of the specified range. For
|
||||
a specified N, the head is a subsequence of N starting
|
||||
This functor find a head of the specified range. For
|
||||
a specified N, the head is a subsequence of N starting
|
||||
elements of the range.
|
||||
*/
|
||||
struct head_finderF
|
||||
@ -285,8 +288,8 @@ namespace boost {
|
||||
// Operation
|
||||
template< typename ForwardIteratorT >
|
||||
iterator_range<ForwardIteratorT>
|
||||
operator()(
|
||||
ForwardIteratorT Begin,
|
||||
operator()(
|
||||
ForwardIteratorT Begin,
|
||||
ForwardIteratorT End ) const
|
||||
{
|
||||
typedef BOOST_STRING_TYPENAME boost::detail::
|
||||
@ -299,7 +302,7 @@ namespace boost {
|
||||
// Find operation implementation
|
||||
template< typename ForwardIteratorT >
|
||||
iterator_range<ForwardIteratorT>
|
||||
findit(
|
||||
findit(
|
||||
ForwardIteratorT Begin,
|
||||
ForwardIteratorT End,
|
||||
std::forward_iterator_tag ) const
|
||||
@ -309,15 +312,15 @@ namespace boost {
|
||||
|
||||
input_iterator_type It=Begin;
|
||||
for(
|
||||
unsigned int Index=0;
|
||||
unsigned int Index=0;
|
||||
Index<m_N && It!=End; ++Index,++It ) {};
|
||||
|
||||
|
||||
return result_type( Begin, It );
|
||||
}
|
||||
|
||||
template< typename ForwardIteratorT >
|
||||
iterator_range<ForwardIteratorT>
|
||||
findit(
|
||||
findit(
|
||||
ForwardIteratorT Begin,
|
||||
ForwardIteratorT End,
|
||||
std::random_access_iterator_tag ) const
|
||||
@ -339,8 +342,8 @@ namespace boost {
|
||||
|
||||
// find a tail in the sequence ( functor )
|
||||
/*
|
||||
This functor find a tail of the specified range. For
|
||||
a specified N, the head is a subsequence of N starting
|
||||
This functor find a tail of the specified range. For
|
||||
a specified N, the head is a subsequence of N starting
|
||||
elements of the range.
|
||||
*/
|
||||
struct tail_finderF
|
||||
@ -351,8 +354,8 @@ namespace boost {
|
||||
// Operation
|
||||
template< typename ForwardIteratorT >
|
||||
iterator_range<ForwardIteratorT>
|
||||
operator()(
|
||||
ForwardIteratorT Begin,
|
||||
operator()(
|
||||
ForwardIteratorT Begin,
|
||||
ForwardIteratorT End ) const
|
||||
{
|
||||
typedef BOOST_STRING_TYPENAME boost::detail::
|
||||
@ -365,7 +368,7 @@ namespace boost {
|
||||
// Find operation implementation
|
||||
template< typename ForwardIteratorT >
|
||||
iterator_range<ForwardIteratorT>
|
||||
findit(
|
||||
findit(
|
||||
ForwardIteratorT Begin,
|
||||
ForwardIteratorT End,
|
||||
std::forward_iterator_tag ) const
|
||||
@ -373,10 +376,10 @@ namespace boost {
|
||||
typedef ForwardIteratorT input_iterator_type;
|
||||
typedef iterator_range<ForwardIteratorT> result_type;
|
||||
|
||||
unsigned int Index=0;
|
||||
unsigned int Index=0;
|
||||
input_iterator_type It=Begin;
|
||||
input_iterator_type It2=Begin;
|
||||
|
||||
|
||||
// Advance It2 by N incremets
|
||||
for( Index=0; Index<m_N && It2!=End; ++Index,++It2 ) {};
|
||||
|
||||
@ -388,7 +391,7 @@ namespace boost {
|
||||
|
||||
template< typename ForwardIteratorT >
|
||||
iterator_range<ForwardIteratorT>
|
||||
findit(
|
||||
findit(
|
||||
ForwardIteratorT Begin,
|
||||
ForwardIteratorT End,
|
||||
std::bidirectional_iterator_tag ) const
|
||||
@ -398,15 +401,15 @@ namespace boost {
|
||||
|
||||
input_iterator_type It=End;
|
||||
for(
|
||||
unsigned int Index=0;
|
||||
unsigned int Index=0;
|
||||
Index<m_N && It!=Begin; ++Index,--It ) {};
|
||||
|
||||
|
||||
return result_type( It, End );
|
||||
}
|
||||
|
||||
template< typename ForwardIteratorT >
|
||||
iterator_range<ForwardIteratorT>
|
||||
findit(
|
||||
findit(
|
||||
ForwardIteratorT Begin,
|
||||
ForwardIteratorT End,
|
||||
std::random_access_iterator_tag ) const
|
||||
@ -414,7 +417,7 @@ namespace boost {
|
||||
typedef ForwardIteratorT input_iterator_type;
|
||||
typedef iterator_range<ForwardIteratorT> result_type;
|
||||
|
||||
if ( (End<=Begin) || ( static_cast<unsigned int>(End-Begin) < m_N ) )
|
||||
if ( (End<=Begin) || ( static_cast<unsigned int>(End-Begin) < m_N ) )
|
||||
return result_type( Begin, End );
|
||||
|
||||
return result_type( End-m_N, End );
|
||||
@ -434,29 +437,29 @@ namespace boost {
|
||||
with an exception that it return range instead of a single
|
||||
iterator.
|
||||
|
||||
If bCompress is set to true, adjacent matching tokens are
|
||||
If bCompress is set to true, adjacent matching tokens are
|
||||
concatenated into one match.
|
||||
*/
|
||||
template< typename PredicateT >
|
||||
struct token_finderF
|
||||
{
|
||||
// Construction
|
||||
token_finderF(
|
||||
PredicateT Pred,
|
||||
token_compress_mode_type eCompress=token_compress_off ) :
|
||||
token_finderF(
|
||||
PredicateT Pred,
|
||||
token_compress_mode_type eCompress=token_compress_off ) :
|
||||
m_Pred(Pred), m_eCompress(eCompress) {}
|
||||
|
||||
// Operation
|
||||
template< typename ForwardIteratorT >
|
||||
iterator_range<ForwardIteratorT>
|
||||
operator()(
|
||||
ForwardIteratorT Begin,
|
||||
operator()(
|
||||
ForwardIteratorT Begin,
|
||||
ForwardIteratorT End ) const
|
||||
{
|
||||
typedef iterator_range<ForwardIteratorT> result_type;
|
||||
|
||||
ForwardIteratorT It=std::find_if( Begin, End, m_Pred );
|
||||
|
||||
|
||||
if( It==End )
|
||||
{
|
||||
return result_type( End, End );
|
||||
@ -468,11 +471,11 @@ namespace boost {
|
||||
if( m_eCompress==token_compress_on )
|
||||
{
|
||||
// Find first non-matching character
|
||||
while( m_Pred(*It2) && It2!=End ) ++It2;
|
||||
while( It2!=End && m_Pred(*It2) ) ++It2;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Advance by one possition
|
||||
// Advance by one possition
|
||||
++It2;
|
||||
}
|
||||
|
||||
@ -499,21 +502,27 @@ namespace boost {
|
||||
typedef iterator_range<input_iterator_type> result_type;
|
||||
|
||||
// Construction
|
||||
range_finderF(
|
||||
input_iterator_type Begin,
|
||||
range_finderF(
|
||||
input_iterator_type Begin,
|
||||
input_iterator_type End ) : m_Range(Begin, End) {}
|
||||
|
||||
range_finderF(const iterator_range<input_iterator_type>& Range) :
|
||||
range_finderF(const iterator_range<input_iterator_type>& Range) :
|
||||
m_Range(Range) {}
|
||||
|
||||
// Operation
|
||||
template< typename ForwardIterator2T >
|
||||
iterator_range<ForwardIterator2T>
|
||||
operator()(
|
||||
ForwardIterator2T,
|
||||
iterator_range<ForwardIterator2T>
|
||||
operator()(
|
||||
ForwardIterator2T,
|
||||
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;
|
||||
#endif
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -12,8 +12,10 @@
|
||||
|
||||
#include <boost/algorithm/string/config.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 algorithm {
|
||||
@ -29,7 +31,6 @@ namespace boost {
|
||||
typedef regex_search_result<IteratorT> type;
|
||||
typedef iterator_range<IteratorT> base_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::const_iterator const_iterator;
|
||||
typedef BOOST_STRING_TYPENAME base_type::iterator iterator;
|
||||
|
@ -10,8 +10,12 @@
|
||||
#ifndef 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>
|
||||
|
||||
// generic replace functors -----------------------------------------------//
|
||||
@ -23,22 +27,30 @@ namespace boost {
|
||||
// const format functor ----------------------------------------------------//
|
||||
|
||||
// constant format functor
|
||||
template<typename CollectionT>
|
||||
template<typename RangeT>
|
||||
struct const_formatF
|
||||
{
|
||||
private:
|
||||
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;
|
||||
|
||||
public:
|
||||
// Construction
|
||||
const_formatF(const CollectionT& Format) :
|
||||
const_formatF(const RangeT& Format) :
|
||||
m_Format(begin(Format), end(Format)) {}
|
||||
|
||||
// Operation
|
||||
template<typename Collection2T>
|
||||
const result_type& operator()(const Collection2T&) const
|
||||
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
|
||||
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;
|
||||
}
|
||||
@ -50,14 +62,14 @@ namespace boost {
|
||||
// identity format functor ----------------------------------------------------//
|
||||
|
||||
// identity format functor
|
||||
template<typename CollectionT>
|
||||
template<typename RangeT>
|
||||
struct identity_formatF
|
||||
{
|
||||
// Operation
|
||||
template< typename Collection2T >
|
||||
const CollectionT& operator()(const Collection2T& Replace) const
|
||||
template< typename Range2T >
|
||||
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 <algorithm>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/algorithm/string/collection_traits.hpp>
|
||||
#include <boost/algorithm/string/sequence_traits.hpp>
|
||||
#include <boost/algorithm/string/iterator_range.hpp>
|
||||
#include <boost/algorithm/string/detail/sequence.hpp>
|
||||
|
||||
namespace boost {
|
||||
|
@ -13,7 +13,9 @@
|
||||
#include <boost/algorithm/string/config.hpp>
|
||||
#include <boost/mpl/bool.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>
|
||||
|
||||
namespace boost {
|
||||
|
@ -12,6 +12,7 @@
|
||||
|
||||
#include <boost/algorithm/string/config.hpp>
|
||||
#include <functional>
|
||||
#include <boost/range/iterator_range.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace algorithm {
|
||||
@ -22,7 +23,7 @@ namespace boost {
|
||||
// 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
|
||||
*/
|
||||
@ -92,7 +93,7 @@ namespace boost {
|
||||
{
|
||||
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
|
||||
|
||||
#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/finder.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
|
||||
*/
|
||||
template<typename OutputIteratorT, typename CollectionT>
|
||||
template<typename OutputIteratorT, typename RangeT>
|
||||
inline OutputIteratorT erase_range_copy(
|
||||
OutputIteratorT Output,
|
||||
const CollectionT& Input,
|
||||
const RangeT& Input,
|
||||
const iterator_range<
|
||||
BOOST_STRING_TYPENAME
|
||||
const_iterator_of<CollectionT>::type>& SearchRange )
|
||||
range_const_iterator<RangeT>::type>& SearchRange )
|
||||
{
|
||||
return find_format_copy(
|
||||
Output,
|
||||
@ -64,7 +69,7 @@ namespace boost {
|
||||
const SequenceT& Input,
|
||||
const iterator_range<
|
||||
BOOST_STRING_TYPENAME
|
||||
const_iterator_of<SequenceT>::type>& SearchRange )
|
||||
range_const_iterator<SequenceT>::type>& SearchRange )
|
||||
{
|
||||
return find_format_copy(
|
||||
Input,
|
||||
@ -85,7 +90,7 @@ namespace boost {
|
||||
SequenceT& Input,
|
||||
const iterator_range<
|
||||
BOOST_STRING_TYPENAME
|
||||
iterator_of<SequenceT>::type>& SearchRange )
|
||||
range_iterator<SequenceT>::type>& SearchRange )
|
||||
{
|
||||
find_format(
|
||||
Input,
|
||||
@ -97,7 +102,7 @@ namespace boost {
|
||||
|
||||
//! 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
|
||||
or copied to the output iterator.
|
||||
|
||||
@ -111,12 +116,12 @@ namespace boost {
|
||||
*/
|
||||
template<
|
||||
typename OutputIteratorT,
|
||||
typename Collection1T,
|
||||
typename Collection2T>
|
||||
typename Range1T,
|
||||
typename Range2T>
|
||||
inline OutputIteratorT erase_first_copy(
|
||||
OutputIteratorT Output,
|
||||
const Collection1T& Input,
|
||||
const Collection2T& Search )
|
||||
const Range1T& Input,
|
||||
const Range2T& Search )
|
||||
{
|
||||
return find_format_copy(
|
||||
Output,
|
||||
@ -129,10 +134,10 @@ namespace boost {
|
||||
/*!
|
||||
\overload
|
||||
*/
|
||||
template<typename SequenceT, typename CollectionT>
|
||||
template<typename SequenceT, typename RangeT>
|
||||
inline SequenceT erase_first_copy(
|
||||
const SequenceT& Input,
|
||||
const CollectionT& Search )
|
||||
const RangeT& Search )
|
||||
{
|
||||
return find_format_copy(
|
||||
Input,
|
||||
@ -142,16 +147,16 @@ namespace boost {
|
||||
|
||||
//! 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.
|
||||
|
||||
\param Input An input string
|
||||
\param Search A substring to be searched for.
|
||||
*/
|
||||
template<typename SequenceT, typename CollectionT>
|
||||
template<typename SequenceT, typename RangeT>
|
||||
inline void erase_first(
|
||||
SequenceT& Input,
|
||||
const CollectionT& Search )
|
||||
const RangeT& Search )
|
||||
{
|
||||
find_format(
|
||||
Input,
|
||||
@ -163,7 +168,7 @@ namespace boost {
|
||||
|
||||
//! 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
|
||||
or copied to the output iterator.
|
||||
Searching is case insensitive.
|
||||
@ -179,12 +184,12 @@ namespace boost {
|
||||
*/
|
||||
template<
|
||||
typename OutputIteratorT,
|
||||
typename Collection1T,
|
||||
typename Collection2T>
|
||||
typename Range1T,
|
||||
typename Range2T>
|
||||
inline OutputIteratorT ierase_first_copy(
|
||||
OutputIteratorT Output,
|
||||
const Collection1T& Input,
|
||||
const Collection2T& Search,
|
||||
const Range1T& Input,
|
||||
const Range2T& Search,
|
||||
const std::locale& Loc=std::locale() )
|
||||
{
|
||||
return find_format_copy(
|
||||
@ -198,10 +203,10 @@ namespace boost {
|
||||
/*!
|
||||
\overload
|
||||
*/
|
||||
template<typename SequenceT, typename CollectionT>
|
||||
template<typename SequenceT, typename RangeT>
|
||||
inline SequenceT ierase_first_copy(
|
||||
const SequenceT& Input,
|
||||
const CollectionT& Search,
|
||||
const RangeT& Search,
|
||||
const std::locale& Loc=std::locale() )
|
||||
{
|
||||
return find_format_copy(
|
||||
@ -212,17 +217,17 @@ namespace boost {
|
||||
|
||||
//! 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.
|
||||
|
||||
\param Input An input string
|
||||
\param Search A substring to be searched for
|
||||
\param Loc A locale used for case insensitive comparison
|
||||
*/
|
||||
template<typename SequenceT, typename CollectionT>
|
||||
template<typename SequenceT, typename RangeT>
|
||||
inline void ierase_first(
|
||||
SequenceT& Input,
|
||||
const CollectionT& Search,
|
||||
const RangeT& Search,
|
||||
const std::locale& Loc=std::locale() )
|
||||
{
|
||||
find_format(
|
||||
@ -235,7 +240,7 @@ namespace boost {
|
||||
|
||||
//! 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
|
||||
or copied to the output iterator.
|
||||
|
||||
@ -249,12 +254,12 @@ namespace boost {
|
||||
*/
|
||||
template<
|
||||
typename OutputIteratorT,
|
||||
typename Collection1T,
|
||||
typename Collection2T>
|
||||
typename Range1T,
|
||||
typename Range2T>
|
||||
inline OutputIteratorT erase_last_copy(
|
||||
OutputIteratorT Output,
|
||||
const Collection1T& Input,
|
||||
const Collection2T& Search )
|
||||
const Range1T& Input,
|
||||
const Range2T& Search )
|
||||
{
|
||||
return find_format_copy(
|
||||
Output,
|
||||
@ -267,10 +272,10 @@ namespace boost {
|
||||
/*!
|
||||
\overload
|
||||
*/
|
||||
template<typename SequenceT, typename CollectionT>
|
||||
template<typename SequenceT, typename RangeT>
|
||||
inline SequenceT erase_last_copy(
|
||||
const SequenceT& Input,
|
||||
const CollectionT& Search )
|
||||
const RangeT& Search )
|
||||
{
|
||||
return find_format_copy(
|
||||
Input,
|
||||
@ -280,16 +285,16 @@ namespace boost {
|
||||
|
||||
//! 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.
|
||||
|
||||
\param Input An input string
|
||||
\param Search A substring to be searched for
|
||||
*/
|
||||
template<typename SequenceT, typename CollectionT>
|
||||
template<typename SequenceT, typename RangeT>
|
||||
inline void erase_last(
|
||||
SequenceT& Input,
|
||||
const CollectionT& Search )
|
||||
const RangeT& Search )
|
||||
{
|
||||
find_format(
|
||||
Input,
|
||||
@ -301,7 +306,7 @@ namespace boost {
|
||||
|
||||
//! 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
|
||||
or copied to the output iterator.
|
||||
Searching is case insensitive.
|
||||
@ -317,12 +322,12 @@ namespace boost {
|
||||
*/
|
||||
template<
|
||||
typename OutputIteratorT,
|
||||
typename Collection1T,
|
||||
typename Collection2T>
|
||||
typename Range1T,
|
||||
typename Range2T>
|
||||
inline OutputIteratorT ierase_last_copy(
|
||||
OutputIteratorT Output,
|
||||
const Collection1T& Input,
|
||||
const Collection2T& Search,
|
||||
const Range1T& Input,
|
||||
const Range2T& Search,
|
||||
const std::locale& Loc=std::locale() )
|
||||
{
|
||||
return find_format_copy(
|
||||
@ -336,10 +341,10 @@ namespace boost {
|
||||
/*!
|
||||
\overload
|
||||
*/
|
||||
template<typename SequenceT, typename CollectionT>
|
||||
template<typename SequenceT, typename RangeT>
|
||||
inline SequenceT ierase_last_copy(
|
||||
const SequenceT& Input,
|
||||
const CollectionT& Search,
|
||||
const RangeT& Search,
|
||||
const std::locale& Loc=std::locale() )
|
||||
{
|
||||
return find_format_copy(
|
||||
@ -350,17 +355,17 @@ namespace boost {
|
||||
|
||||
//! 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.
|
||||
|
||||
\param Input An input string
|
||||
\param Search A substring to be searched for
|
||||
\param Loc A locale used for case insensitive comparison
|
||||
*/
|
||||
template<typename SequenceT, typename CollectionT>
|
||||
template<typename SequenceT, typename RangeT>
|
||||
inline void ierase_last(
|
||||
SequenceT& Input,
|
||||
const CollectionT& Search,
|
||||
const RangeT& Search,
|
||||
const std::locale& Loc=std::locale() )
|
||||
{
|
||||
find_format(
|
||||
@ -373,7 +378,7 @@ namespace boost {
|
||||
|
||||
//! 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
|
||||
or copied to the output iterator.
|
||||
|
||||
@ -389,12 +394,12 @@ namespace boost {
|
||||
*/
|
||||
template<
|
||||
typename OutputIteratorT,
|
||||
typename Collection1T,
|
||||
typename Collection2T>
|
||||
typename Range1T,
|
||||
typename Range2T>
|
||||
inline OutputIteratorT erase_nth_copy(
|
||||
OutputIteratorT Output,
|
||||
const Collection1T& Input,
|
||||
const Collection2T& Search,
|
||||
const Range1T& Input,
|
||||
const Range2T& Search,
|
||||
unsigned int Nth )
|
||||
{
|
||||
return find_format_copy(
|
||||
@ -408,10 +413,10 @@ namespace boost {
|
||||
/*!
|
||||
\overload
|
||||
*/
|
||||
template<typename SequenceT, typename CollectionT>
|
||||
template<typename SequenceT, typename RangeT>
|
||||
inline SequenceT erase_nth_copy(
|
||||
const SequenceT& Input,
|
||||
const CollectionT& Search,
|
||||
const RangeT& Search,
|
||||
unsigned int Nth )
|
||||
{
|
||||
return find_format_copy(
|
||||
@ -422,17 +427,17 @@ namespace boost {
|
||||
|
||||
//! 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.
|
||||
|
||||
\param Input An input string
|
||||
\param Search A substring to be searched for.
|
||||
\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(
|
||||
SequenceT& Input,
|
||||
const CollectionT& Search,
|
||||
const RangeT& Search,
|
||||
unsigned int Nth )
|
||||
{
|
||||
find_format(
|
||||
@ -445,7 +450,7 @@ namespace boost {
|
||||
|
||||
//! 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
|
||||
or copied to the output iterator.
|
||||
Searching is case insensitive.
|
||||
@ -462,12 +467,12 @@ namespace boost {
|
||||
*/
|
||||
template<
|
||||
typename OutputIteratorT,
|
||||
typename Collection1T,
|
||||
typename Collection2T>
|
||||
typename Range1T,
|
||||
typename Range2T>
|
||||
inline OutputIteratorT ierase_nth_copy(
|
||||
OutputIteratorT Output,
|
||||
const Collection1T& Input,
|
||||
const Collection2T& Search,
|
||||
const Range1T& Input,
|
||||
const Range2T& Search,
|
||||
unsigned int Nth,
|
||||
const std::locale& Loc=std::locale() )
|
||||
{
|
||||
@ -482,10 +487,10 @@ namespace boost {
|
||||
/*!
|
||||
\overload
|
||||
*/
|
||||
template<typename SequenceT, typename CollectionT>
|
||||
template<typename SequenceT, typename RangeT>
|
||||
inline SequenceT ierase_nth_copy(
|
||||
const SequenceT& Input,
|
||||
const CollectionT& Search,
|
||||
const RangeT& Search,
|
||||
unsigned int Nth,
|
||||
const std::locale& Loc=std::locale() )
|
||||
{
|
||||
@ -497,7 +502,7 @@ namespace boost {
|
||||
|
||||
//! 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.
|
||||
|
||||
\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 Loc A locale used for case insensitive comparison
|
||||
*/
|
||||
template<typename SequenceT, typename CollectionT>
|
||||
template<typename SequenceT, typename RangeT>
|
||||
inline void ierase_nth(
|
||||
SequenceT& Input,
|
||||
const CollectionT& Search,
|
||||
const RangeT& Search,
|
||||
unsigned int Nth,
|
||||
const std::locale& Loc=std::locale() )
|
||||
{
|
||||
@ -538,12 +543,12 @@ namespace boost {
|
||||
*/
|
||||
template<
|
||||
typename OutputIteratorT,
|
||||
typename Collection1T,
|
||||
typename Collection2T>
|
||||
typename Range1T,
|
||||
typename Range2T>
|
||||
inline OutputIteratorT erase_all_copy(
|
||||
OutputIteratorT Output,
|
||||
const Collection1T& Input,
|
||||
const Collection2T& Search )
|
||||
const Range1T& Input,
|
||||
const Range2T& Search )
|
||||
{
|
||||
return find_format_all_copy(
|
||||
Output,
|
||||
@ -556,10 +561,10 @@ namespace boost {
|
||||
/*!
|
||||
\overload
|
||||
*/
|
||||
template<typename SequenceT, typename CollectionT>
|
||||
template<typename SequenceT, typename RangeT>
|
||||
inline SequenceT erase_all_copy(
|
||||
const SequenceT& Input,
|
||||
const CollectionT& Search )
|
||||
const RangeT& Search )
|
||||
{
|
||||
return find_format_all_copy(
|
||||
Input,
|
||||
@ -575,10 +580,10 @@ namespace boost {
|
||||
\param Input An input string
|
||||
\param Search A substring to be searched for.
|
||||
*/
|
||||
template<typename SequenceT, typename CollectionT>
|
||||
template<typename SequenceT, typename RangeT>
|
||||
inline void erase_all(
|
||||
SequenceT& Input,
|
||||
const CollectionT& Search )
|
||||
const RangeT& Search )
|
||||
{
|
||||
find_format_all(
|
||||
Input,
|
||||
@ -606,12 +611,12 @@ namespace boost {
|
||||
*/
|
||||
template<
|
||||
typename OutputIteratorT,
|
||||
typename Collection1T,
|
||||
typename Collection2T>
|
||||
typename Range1T,
|
||||
typename Range2T>
|
||||
inline OutputIteratorT ierase_all_copy(
|
||||
OutputIteratorT Output,
|
||||
const Collection1T& Input,
|
||||
const Collection2T& Search,
|
||||
const Range1T& Input,
|
||||
const Range2T& Search,
|
||||
const std::locale& Loc=std::locale() )
|
||||
{
|
||||
return find_format_all_copy(
|
||||
@ -625,10 +630,10 @@ namespace boost {
|
||||
/*!
|
||||
\overload
|
||||
*/
|
||||
template<typename SequenceT, typename CollectionT>
|
||||
template<typename SequenceT, typename RangeT>
|
||||
inline SequenceT ierase_all_copy(
|
||||
const SequenceT& Input,
|
||||
const CollectionT& Search,
|
||||
const RangeT& Search,
|
||||
const std::locale& Loc=std::locale() )
|
||||
{
|
||||
return find_format_all_copy(
|
||||
@ -646,10 +651,10 @@ namespace boost {
|
||||
\param Search A substring to be searched for.
|
||||
\param Loc A locale used for case insensitive comparison
|
||||
*/
|
||||
template<typename SequenceT, typename CollectionT>
|
||||
template<typename SequenceT, typename RangeT>
|
||||
inline void ierase_all(
|
||||
SequenceT& Input,
|
||||
const CollectionT& Search,
|
||||
const RangeT& Search,
|
||||
const std::locale& Loc=std::locale() )
|
||||
{
|
||||
find_format_all(
|
||||
@ -662,7 +667,7 @@ namespace boost {
|
||||
|
||||
//! 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
|
||||
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.
|
||||
@ -678,10 +683,10 @@ namespace boost {
|
||||
*/
|
||||
template<
|
||||
typename OutputIteratorT,
|
||||
typename CollectionT>
|
||||
typename RangeT>
|
||||
inline OutputIteratorT erase_head_copy(
|
||||
OutputIteratorT Output,
|
||||
const CollectionT& Input,
|
||||
const RangeT& Input,
|
||||
unsigned int N )
|
||||
{
|
||||
return find_format_copy(
|
||||
@ -708,7 +713,7 @@ namespace boost {
|
||||
|
||||
//! 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
|
||||
considered to be the head. The input sequence is modified in-place.
|
||||
|
||||
@ -730,7 +735,7 @@ namespace boost {
|
||||
|
||||
//! 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
|
||||
considered to be the tail.
|
||||
The result is a modified copy of the input. It is returned as a sequence
|
||||
@ -746,10 +751,10 @@ namespace boost {
|
||||
*/
|
||||
template<
|
||||
typename OutputIteratorT,
|
||||
typename CollectionT>
|
||||
typename RangeT>
|
||||
inline OutputIteratorT erase_tail_copy(
|
||||
OutputIteratorT Output,
|
||||
const CollectionT& Input,
|
||||
const RangeT& Input,
|
||||
unsigned int N )
|
||||
{
|
||||
return find_format_copy(
|
||||
@ -776,7 +781,7 @@ namespace boost {
|
||||
|
||||
//! 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
|
||||
considered to be the tail. The input sequence is modified in-place.
|
||||
|
||||
|
@ -11,8 +11,14 @@
|
||||
#define BOOST_STRING_FIND_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/compare.hpp>
|
||||
#include <boost/algorithm/string/constants.hpp>
|
||||
@ -36,15 +42,15 @@ namespace boost {
|
||||
\param Finder Finder object used for searching.
|
||||
\return
|
||||
An \c iterator_range delimiting the match.
|
||||
Returned iterator is either \c CollectionT::iterator or
|
||||
\c CollectionT::const_iterator, depending on the constness of
|
||||
Returned iterator is either \c RangeT::iterator or
|
||||
\c RangeT::const_iterator, depending on the constness of
|
||||
the input parameter.
|
||||
*/
|
||||
template<typename CollectionT, typename FinderT>
|
||||
template<typename RangeT, typename FinderT>
|
||||
inline iterator_range<
|
||||
BOOST_STRING_TYPENAME result_iterator_of<CollectionT>::type>
|
||||
BOOST_STRING_TYPENAME range_result_iterator<RangeT>::type>
|
||||
find(
|
||||
CollectionT& Input,
|
||||
RangeT& Input,
|
||||
FinderT Finder)
|
||||
{
|
||||
return Finder(begin(Input),end(Input));
|
||||
@ -60,18 +66,18 @@ namespace boost {
|
||||
\param Search A substring to be searched for.
|
||||
\return
|
||||
An \c iterator_range delimiting the match.
|
||||
Returned iterator is either \c CollectionT::iterator or
|
||||
\c CollectionT::const_iterator, depending on the constness of
|
||||
Returned iterator is either \c RangeT::iterator or
|
||||
\c RangeT::const_iterator, depending on the constness of
|
||||
the input parameter.
|
||||
|
||||
\note This function provides the strong exception-safety guarantee
|
||||
*/
|
||||
template<typename Collection1T, typename Collection2T>
|
||||
template<typename Range1T, typename Range2T>
|
||||
inline iterator_range<
|
||||
BOOST_STRING_TYPENAME result_iterator_of<Collection1T>::type>
|
||||
BOOST_STRING_TYPENAME range_result_iterator<Range1T>::type>
|
||||
find_first(
|
||||
Collection1T& Input,
|
||||
const Collection2T& Search)
|
||||
Range1T& Input,
|
||||
const Range2T& Search)
|
||||
{
|
||||
return first_finder(Search)(
|
||||
begin(Input),end(Input));
|
||||
@ -87,18 +93,18 @@ namespace boost {
|
||||
\param Loc A locale used for case insensitive comparison
|
||||
\return
|
||||
An \c iterator_range delimiting the match.
|
||||
Returned iterator is either \c Collection1T::iterator or
|
||||
\c Collection1T::const_iterator, depending on the constness of
|
||||
Returned iterator is either \c Range1T::iterator or
|
||||
\c Range1T::const_iterator, depending on the constness of
|
||||
the input parameter.
|
||||
|
||||
\note This function provides the strong exception-safety guarantee
|
||||
*/
|
||||
template<typename Collection1T, typename Collection2T>
|
||||
template<typename Range1T, typename Range2T>
|
||||
inline iterator_range<
|
||||
BOOST_STRING_TYPENAME result_iterator_of<Collection1T>::type>
|
||||
BOOST_STRING_TYPENAME range_result_iterator<Range1T>::type>
|
||||
ifind_first(
|
||||
Collection1T& Input,
|
||||
const Collection2T& Search,
|
||||
Range1T& Input,
|
||||
const Range2T& Search,
|
||||
const std::locale& Loc=std::locale())
|
||||
{
|
||||
return first_finder(Search,is_iequal(Loc))(
|
||||
@ -115,18 +121,18 @@ namespace boost {
|
||||
\param Search A substring to be searched for.
|
||||
\return
|
||||
An \c iterator_range delimiting the match.
|
||||
Returned iterator is either \c Collection1T::iterator or
|
||||
\c Collection1T::const_iterator, depending on the constness of
|
||||
Returned iterator is either \c Range1T::iterator or
|
||||
\c Range1T::const_iterator, depending on the constness of
|
||||
the input parameter.
|
||||
|
||||
\note This function provides the strong exception-safety guarantee
|
||||
*/
|
||||
template<typename Collection1T, typename Collection2T>
|
||||
template<typename Range1T, typename Range2T>
|
||||
inline iterator_range<
|
||||
BOOST_STRING_TYPENAME result_iterator_of<Collection1T>::type>
|
||||
BOOST_STRING_TYPENAME range_result_iterator<Range1T>::type>
|
||||
find_last(
|
||||
Collection1T& Input,
|
||||
const Collection2T& Search)
|
||||
Range1T& Input,
|
||||
const Range2T& Search)
|
||||
{
|
||||
return last_finder(Search)(
|
||||
begin(Input),end(Input));
|
||||
@ -142,18 +148,18 @@ namespace boost {
|
||||
\param Loc A locale used for case insensitive comparison
|
||||
\return
|
||||
An \c iterator_range delimiting the match.
|
||||
Returned iterator is either \c Collection1T::iterator or
|
||||
\c Collection1T::const_iterator, depending on the constness of
|
||||
Returned iterator is either \c Range1T::iterator or
|
||||
\c Range1T::const_iterator, depending on the constness of
|
||||
the input parameter.
|
||||
|
||||
\note This function provides the strong exception-safety guarantee
|
||||
*/
|
||||
template<typename Collection1T, typename Collection2T>
|
||||
template<typename Range1T, typename Range2T>
|
||||
inline iterator_range<
|
||||
BOOST_STRING_TYPENAME result_iterator_of<Collection1T>::type>
|
||||
BOOST_STRING_TYPENAME range_result_iterator<Range1T>::type>
|
||||
ifind_last(
|
||||
Collection1T& Input,
|
||||
const Collection2T& Search,
|
||||
Range1T& Input,
|
||||
const Range2T& Search,
|
||||
const std::locale& Loc=std::locale())
|
||||
{
|
||||
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.
|
||||
\return
|
||||
An \c iterator_range delimiting the match.
|
||||
Returned iterator is either \c Collection1T::iterator or
|
||||
\c Collection1T::const_iterator, depending on the constness of
|
||||
Returned iterator is either \c Range1T::iterator or
|
||||
\c Range1T::const_iterator, depending on the constness of
|
||||
the input parameter.
|
||||
*/
|
||||
template<typename Collection1T, typename Collection2T>
|
||||
template<typename Range1T, typename Range2T>
|
||||
inline iterator_range<
|
||||
BOOST_STRING_TYPENAME result_iterator_of<Collection1T>::type>
|
||||
BOOST_STRING_TYPENAME range_result_iterator<Range1T>::type>
|
||||
find_nth(
|
||||
Collection1T& Input,
|
||||
const Collection2T& Search,
|
||||
Range1T& Input,
|
||||
const Range2T& Search,
|
||||
unsigned int Nth)
|
||||
{
|
||||
return nth_finder(Search,Nth)(
|
||||
@ -199,19 +205,19 @@ namespace boost {
|
||||
\param Loc A locale used for case insensitive comparison
|
||||
\return
|
||||
An \c iterator_range delimiting the match.
|
||||
Returned iterator is either \c Collection1T::iterator or
|
||||
\c Collection1T::const_iterator, depending on the constness of
|
||||
Returned iterator is either \c Range1T::iterator or
|
||||
\c Range1T::const_iterator, depending on the constness of
|
||||
the input parameter.
|
||||
|
||||
|
||||
\note This function provides the strong exception-safety guarantee
|
||||
*/
|
||||
template<typename Collection1T, typename Collection2T>
|
||||
template<typename Range1T, typename Range2T>
|
||||
inline iterator_range<
|
||||
BOOST_STRING_TYPENAME result_iterator_of<Collection1T>::type>
|
||||
BOOST_STRING_TYPENAME range_result_iterator<Range1T>::type>
|
||||
ifind_nth(
|
||||
Collection1T& Input,
|
||||
const Collection2T& Search,
|
||||
Range1T& Input,
|
||||
const Range2T& Search,
|
||||
unsigned int Nth,
|
||||
const std::locale& Loc=std::locale())
|
||||
{
|
||||
@ -231,17 +237,17 @@ namespace boost {
|
||||
\param N Length of the head
|
||||
\return
|
||||
An \c iterator_range delimiting the match.
|
||||
Returned iterator is either \c Collection1T::iterator or
|
||||
\c Collection1T::const_iterator, depending on the constness of
|
||||
Returned iterator is either \c Range1T::iterator or
|
||||
\c Range1T::const_iterator, depending on the constness of
|
||||
the input parameter.
|
||||
|
||||
\note This function provides the strong exception-safety guarantee
|
||||
*/
|
||||
template<typename CollectionT>
|
||||
template<typename RangeT>
|
||||
inline iterator_range<
|
||||
BOOST_STRING_TYPENAME result_iterator_of<CollectionT>::type>
|
||||
BOOST_STRING_TYPENAME range_result_iterator<RangeT>::type>
|
||||
find_head(
|
||||
CollectionT& Input,
|
||||
RangeT& Input,
|
||||
unsigned int N)
|
||||
{
|
||||
return head_finder(N)(
|
||||
@ -260,18 +266,18 @@ namespace boost {
|
||||
\param N Length of the tail
|
||||
\return
|
||||
An \c iterator_range delimiting the match.
|
||||
Returned iterator is either \c CollectionT::iterator or
|
||||
\c CollectionT::const_iterator, depending on the constness of
|
||||
Returned iterator is either \c RangeT::iterator or
|
||||
\c RangeT::const_iterator, depending on the constness of
|
||||
the input parameter.
|
||||
|
||||
|
||||
\note This function provides the strong exception-safety guarantee
|
||||
*/
|
||||
template<typename CollectionT>
|
||||
template<typename RangeT>
|
||||
inline iterator_range<
|
||||
BOOST_STRING_TYPENAME result_iterator_of<CollectionT>::type>
|
||||
BOOST_STRING_TYPENAME range_result_iterator<RangeT>::type>
|
||||
find_tail(
|
||||
CollectionT& Input,
|
||||
RangeT& Input,
|
||||
unsigned int N)
|
||||
{
|
||||
return tail_finder(N)(
|
||||
@ -291,17 +297,17 @@ namespace boost {
|
||||
\param eCompress Enable/Disable compressing of adjacent tokens
|
||||
\return
|
||||
An \c iterator_range delimiting the match.
|
||||
Returned iterator is either \c CollectionT::iterator or
|
||||
\c CollectionT::const_iterator, depending on the constness of
|
||||
Returned iterator is either \c RangeT::iterator or
|
||||
\c RangeT::const_iterator, depending on the constness of
|
||||
the input parameter.
|
||||
|
||||
\note This function provides the strong exception-safety guarantee
|
||||
*/
|
||||
template<typename CollectionT, typename PredicateT>
|
||||
template<typename RangeT, typename PredicateT>
|
||||
inline iterator_range<
|
||||
BOOST_STRING_TYPENAME result_iterator_of<CollectionT>::type>
|
||||
BOOST_STRING_TYPENAME range_result_iterator<RangeT>::type>
|
||||
find_token(
|
||||
CollectionT& Input,
|
||||
RangeT& Input,
|
||||
PredicateT Pred,
|
||||
token_compress_mode_type eCompress=token_compress_off)
|
||||
{
|
||||
|
@ -12,8 +12,11 @@
|
||||
|
||||
#include <deque>
|
||||
#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/const_iterator.hpp>
|
||||
|
||||
#include <boost/algorithm/string/concept.hpp>
|
||||
#include <boost/algorithm/string/detail/find_format.hpp>
|
||||
#include <boost/algorithm/string/detail/find_format_all.hpp>
|
||||
@ -47,23 +50,23 @@ namespace boost {
|
||||
*/
|
||||
template<
|
||||
typename OutputIteratorT,
|
||||
typename CollectionT,
|
||||
typename RangeT,
|
||||
typename FinderT,
|
||||
typename FormatterT>
|
||||
inline OutputIteratorT find_format_copy(
|
||||
OutputIteratorT Output,
|
||||
const CollectionT& Input,
|
||||
const RangeT& Input,
|
||||
FinderT Finder,
|
||||
FormatterT Formatter )
|
||||
{
|
||||
// Concept check
|
||||
function_requires<
|
||||
FinderConcept<FinderT,
|
||||
BOOST_STRING_TYPENAME const_iterator_of<CollectionT>::type> >();
|
||||
BOOST_STRING_TYPENAME range_const_iterator<RangeT>::type> >();
|
||||
function_requires<
|
||||
FormatterConcept<
|
||||
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(
|
||||
Output,
|
||||
@ -89,11 +92,11 @@ namespace boost {
|
||||
// Concept check
|
||||
function_requires<
|
||||
FinderConcept<FinderT,
|
||||
BOOST_STRING_TYPENAME const_iterator_of<SequenceT>::type> >();
|
||||
BOOST_STRING_TYPENAME range_const_iterator<SequenceT>::type> >();
|
||||
function_requires<
|
||||
FormatterConcept<
|
||||
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(
|
||||
Input,
|
||||
@ -123,11 +126,11 @@ namespace boost {
|
||||
// Concept check
|
||||
function_requires<
|
||||
FinderConcept<FinderT,
|
||||
BOOST_STRING_TYPENAME const_iterator_of<SequenceT>::type> >();
|
||||
BOOST_STRING_TYPENAME range_const_iterator<SequenceT>::type> >();
|
||||
function_requires<
|
||||
FormatterConcept<
|
||||
FormatterT,
|
||||
FinderT,BOOST_STRING_TYPENAME const_iterator_of<SequenceT>::type> >();
|
||||
FinderT,BOOST_STRING_TYPENAME range_const_iterator<SequenceT>::type> >();
|
||||
|
||||
detail::find_format_impl(
|
||||
Input,
|
||||
@ -158,23 +161,23 @@ namespace boost {
|
||||
*/
|
||||
template<
|
||||
typename OutputIteratorT,
|
||||
typename CollectionT,
|
||||
typename RangeT,
|
||||
typename FinderT,
|
||||
typename FormatterT>
|
||||
inline OutputIteratorT find_format_all_copy(
|
||||
OutputIteratorT Output,
|
||||
const CollectionT& Input,
|
||||
const RangeT& Input,
|
||||
FinderT Finder,
|
||||
FormatterT Formatter)
|
||||
{
|
||||
// Concept check
|
||||
function_requires<
|
||||
FinderConcept<FinderT,
|
||||
BOOST_STRING_TYPENAME const_iterator_of<CollectionT>::type> >();
|
||||
BOOST_STRING_TYPENAME range_const_iterator<RangeT>::type> >();
|
||||
function_requires<
|
||||
FormatterConcept<
|
||||
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(
|
||||
Output,
|
||||
@ -200,11 +203,11 @@ namespace boost {
|
||||
// Concept check
|
||||
function_requires<
|
||||
FinderConcept<FinderT,
|
||||
BOOST_STRING_TYPENAME const_iterator_of<SequenceT>::type> >();
|
||||
BOOST_STRING_TYPENAME range_const_iterator<SequenceT>::type> >();
|
||||
function_requires<
|
||||
FormatterConcept<
|
||||
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(
|
||||
Input,
|
||||
@ -235,11 +238,11 @@ namespace boost {
|
||||
// Concept check
|
||||
function_requires<
|
||||
FinderConcept<FinderT,
|
||||
BOOST_STRING_TYPENAME const_iterator_of<SequenceT>::type> >();
|
||||
BOOST_STRING_TYPENAME range_const_iterator<SequenceT>::type> >();
|
||||
function_requires<
|
||||
FormatterConcept<
|
||||
FormatterT,
|
||||
FinderT,BOOST_STRING_TYPENAME const_iterator_of<SequenceT>::type> >();
|
||||
FinderT,BOOST_STRING_TYPENAME range_const_iterator<SequenceT>::type> >();
|
||||
|
||||
detail::find_format_all_impl(
|
||||
Input,
|
||||
|
@ -9,14 +9,17 @@
|
||||
#ifndef BOOST_STRING_FIND_ITERATOR_HPP
|
||||
#define BOOST_STRING_FIND_ITERATOR_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_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
|
||||
Defines find iterator classes. Find iterator repeatly applies a Finder
|
||||
to the specified input string to search for matches. Dereferencing
|
||||
@ -105,11 +108,11 @@ namespace boost {
|
||||
//! Constructor
|
||||
/*!
|
||||
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(
|
||||
CollectionT& Col,
|
||||
RangeT& Col,
|
||||
FinderT Finder ) :
|
||||
detail::find_iterator_base<IteratorT>(Finder,0),
|
||||
m_Match(begin(Col),begin(Col)),
|
||||
@ -175,14 +178,14 @@ namespace boost {
|
||||
/*!
|
||||
* Construct a find iterator to iterate through the specified string
|
||||
*/
|
||||
template<typename CollectionT, typename FinderT>
|
||||
template<typename RangeT, typename FinderT>
|
||||
inline find_iterator<
|
||||
BOOST_STRING_TYPENAME result_iterator_of<CollectionT>::type>
|
||||
BOOST_STRING_TYPENAME range_result_iterator<RangeT>::type>
|
||||
make_find_iterator(
|
||||
CollectionT& Collection,
|
||||
RangeT& Collection,
|
||||
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);
|
||||
}
|
||||
|
||||
@ -243,7 +246,9 @@ namespace boost {
|
||||
base_type(Other),
|
||||
m_Match(Other.m_Match),
|
||||
m_Next(Other.m_Next),
|
||||
m_End(Other.m_End) {}
|
||||
m_End(Other.m_End),
|
||||
m_bEof(false)
|
||||
{}
|
||||
|
||||
//! Constructor
|
||||
/*!
|
||||
@ -258,7 +263,8 @@ namespace boost {
|
||||
detail::find_iterator_base<IteratorT>(Finder,0),
|
||||
m_Match(Begin,Begin),
|
||||
m_Next(Begin),
|
||||
m_End(End)
|
||||
m_End(End),
|
||||
m_bEof(false)
|
||||
{
|
||||
increment();
|
||||
}
|
||||
@ -267,14 +273,15 @@ namespace boost {
|
||||
Construct new split_iterator for a given finder
|
||||
and a collection.
|
||||
*/
|
||||
template<typename FinderT, typename CollectionT>
|
||||
template<typename FinderT, typename RangeT>
|
||||
split_iterator(
|
||||
CollectionT& Col,
|
||||
RangeT& Col,
|
||||
FinderT Finder ) :
|
||||
detail::find_iterator_base<IteratorT>(Finder,0),
|
||||
m_Match(begin(Col),begin(Col)),
|
||||
m_Next(begin(Col)),
|
||||
m_End(end(Col))
|
||||
m_End(end(Col)),
|
||||
m_bEof(false)
|
||||
{
|
||||
increment();
|
||||
}
|
||||
@ -293,6 +300,16 @@ namespace boost {
|
||||
void increment()
|
||||
{
|
||||
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_Next=FindMatch.end();
|
||||
}
|
||||
@ -307,7 +324,7 @@ namespace boost {
|
||||
(
|
||||
m_Match==Other.m_Match &&
|
||||
m_Next==Other.m_Next &&
|
||||
m_End==Other.m_End
|
||||
m_End==Other.m_End
|
||||
);
|
||||
}
|
||||
|
||||
@ -322,12 +339,7 @@ namespace boost {
|
||||
*/
|
||||
bool eof() const
|
||||
{
|
||||
return
|
||||
this->is_null() ||
|
||||
(
|
||||
m_Match.begin() == m_End &&
|
||||
m_Match.end() == m_End
|
||||
);
|
||||
return this->is_null() || m_bEof;
|
||||
}
|
||||
|
||||
private:
|
||||
@ -335,20 +347,21 @@ namespace boost {
|
||||
match_type m_Match;
|
||||
input_iterator_type m_Next;
|
||||
input_iterator_type m_End;
|
||||
bool m_bEof;
|
||||
};
|
||||
|
||||
//! split iterator construction helper
|
||||
/*!
|
||||
* Construct a split iterator to iterate through the specified collection
|
||||
*/
|
||||
template<typename CollectionT, typename FinderT>
|
||||
template<typename RangeT, typename FinderT>
|
||||
inline split_iterator<
|
||||
BOOST_STRING_TYPENAME result_iterator_of<CollectionT>::type>
|
||||
BOOST_STRING_TYPENAME range_result_iterator<RangeT>::type>
|
||||
make_split_iterator(
|
||||
CollectionT& Collection,
|
||||
RangeT& Collection,
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -11,9 +11,14 @@
|
||||
#define BOOST_STRING_FINDER_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/collection_traits.hpp>
|
||||
#include <boost/algorithm/string/iterator_range.hpp>
|
||||
#include <boost/algorithm/string/detail/finder.hpp>
|
||||
#include <boost/algorithm/string/compare.hpp>
|
||||
|
||||
@ -42,14 +47,14 @@ namespace boost {
|
||||
*/
|
||||
template<typename ContainerT>
|
||||
inline detail::first_finderF<
|
||||
BOOST_STRING_TYPENAME const_iterator_of<ContainerT>::type,
|
||||
BOOST_STRING_TYPENAME range_const_iterator<ContainerT>::type,
|
||||
is_equal>
|
||||
first_finder( const ContainerT& Search )
|
||||
{
|
||||
return
|
||||
detail::first_finderF<
|
||||
BOOST_STRING_TYPENAME
|
||||
const_iterator_of<ContainerT>::type,
|
||||
range_const_iterator<ContainerT>::type,
|
||||
is_equal>( Search, is_equal() ) ;
|
||||
}
|
||||
|
||||
@ -59,7 +64,7 @@ namespace boost {
|
||||
*/
|
||||
template<typename ContainerT,typename PredicateT>
|
||||
inline detail::first_finderF<
|
||||
BOOST_STRING_TYPENAME const_iterator_of<ContainerT>::type,
|
||||
BOOST_STRING_TYPENAME range_const_iterator<ContainerT>::type,
|
||||
PredicateT>
|
||||
first_finder(
|
||||
const ContainerT& Search, PredicateT Comp )
|
||||
@ -67,7 +72,7 @@ namespace boost {
|
||||
return
|
||||
detail::first_finderF<
|
||||
BOOST_STRING_TYPENAME
|
||||
const_iterator_of<ContainerT>::type,
|
||||
range_const_iterator<ContainerT>::type,
|
||||
PredicateT>( Search, Comp );
|
||||
}
|
||||
|
||||
@ -83,14 +88,14 @@ namespace boost {
|
||||
*/
|
||||
template<typename ContainerT>
|
||||
inline detail::last_finderF<
|
||||
BOOST_STRING_TYPENAME const_iterator_of<ContainerT>::type,
|
||||
BOOST_STRING_TYPENAME range_const_iterator<ContainerT>::type,
|
||||
is_equal>
|
||||
last_finder( const ContainerT& Search )
|
||||
{
|
||||
return
|
||||
detail::last_finderF<
|
||||
BOOST_STRING_TYPENAME
|
||||
const_iterator_of<ContainerT>::type,
|
||||
range_const_iterator<ContainerT>::type,
|
||||
is_equal>( Search, is_equal() );
|
||||
}
|
||||
//! "Last" finder
|
||||
@ -99,14 +104,14 @@ namespace boost {
|
||||
*/
|
||||
template<typename ContainerT, typename PredicateT>
|
||||
inline detail::last_finderF<
|
||||
BOOST_STRING_TYPENAME const_iterator_of<ContainerT>::type,
|
||||
BOOST_STRING_TYPENAME range_const_iterator<ContainerT>::type,
|
||||
PredicateT>
|
||||
last_finder( const ContainerT& Search, PredicateT Comp )
|
||||
{
|
||||
return
|
||||
detail::last_finderF<
|
||||
BOOST_STRING_TYPENAME
|
||||
const_iterator_of<ContainerT>::type,
|
||||
range_const_iterator<ContainerT>::type,
|
||||
PredicateT>( Search, Comp ) ;
|
||||
}
|
||||
|
||||
@ -123,7 +128,7 @@ namespace boost {
|
||||
*/
|
||||
template<typename ContainerT>
|
||||
inline detail::nth_finderF<
|
||||
BOOST_STRING_TYPENAME const_iterator_of<ContainerT>::type,
|
||||
BOOST_STRING_TYPENAME range_const_iterator<ContainerT>::type,
|
||||
is_equal>
|
||||
nth_finder(
|
||||
const ContainerT& Search,
|
||||
@ -132,7 +137,7 @@ namespace boost {
|
||||
return
|
||||
detail::nth_finderF<
|
||||
BOOST_STRING_TYPENAME
|
||||
const_iterator_of<ContainerT>::type,
|
||||
range_const_iterator<ContainerT>::type,
|
||||
is_equal>( Search, Nth, is_equal() ) ;
|
||||
}
|
||||
//! "Nth" finder
|
||||
@ -141,7 +146,7 @@ namespace boost {
|
||||
*/
|
||||
template<typename ContainerT, typename PredicateT>
|
||||
inline detail::nth_finderF<
|
||||
BOOST_STRING_TYPENAME const_iterator_of<ContainerT>::type,
|
||||
BOOST_STRING_TYPENAME range_const_iterator<ContainerT>::type,
|
||||
PredicateT>
|
||||
nth_finder(
|
||||
const ContainerT& Search,
|
||||
@ -151,7 +156,7 @@ namespace boost {
|
||||
return
|
||||
detail::nth_finderF<
|
||||
BOOST_STRING_TYPENAME
|
||||
const_iterator_of<ContainerT>::type,
|
||||
range_const_iterator<ContainerT>::type,
|
||||
PredicateT>( Search, Nth, Comp );
|
||||
}
|
||||
|
||||
|
@ -11,8 +11,9 @@
|
||||
#define BOOST_STRING_FORMATTER_HPP
|
||||
|
||||
#include <boost/detail/iterator.hpp>
|
||||
#include <boost/algorithm/string/collection_traits.hpp>
|
||||
#include <boost/algorithm/string/iterator_range.hpp>
|
||||
#include <boost/range/value_type.hpp>
|
||||
#include <boost/range/iterator_range.hpp>
|
||||
|
||||
#include <boost/algorithm/string/detail/formatter.hpp>
|
||||
|
||||
/*! \file
|
||||
@ -29,7 +30,7 @@
|
||||
namespace boost {
|
||||
namespace algorithm {
|
||||
|
||||
// generic formaters ---------------------------------------------------------------//
|
||||
// generic formatters ---------------------------------------------------------------//
|
||||
|
||||
//! Constant formatter
|
||||
/*!
|
||||
@ -39,11 +40,11 @@ namespace boost {
|
||||
\param Format A predefined value used as a result for formating
|
||||
\return An instance of the \c const_formatter object.
|
||||
*/
|
||||
template<typename CollectionT>
|
||||
inline detail::const_formatF<CollectionT>
|
||||
const_formatter(const CollectionT& Format)
|
||||
template<typename RangeT>
|
||||
inline detail::const_formatF<RangeT>
|
||||
const_formatter(const RangeT& Format)
|
||||
{
|
||||
return detail::const_formatF<CollectionT>(Format);
|
||||
return detail::const_formatF<RangeT>(Format);
|
||||
}
|
||||
|
||||
//! Identity formatter
|
||||
@ -53,29 +54,29 @@ namespace boost {
|
||||
|
||||
\return An instance of the \c identity_formatter object.
|
||||
*/
|
||||
template<typename CollectionT>
|
||||
inline detail::identity_formatF<CollectionT>
|
||||
template<typename RangeT>
|
||||
inline detail::identity_formatF<RangeT>
|
||||
identity_formatter()
|
||||
{
|
||||
return detail::identity_formatF<CollectionT>();
|
||||
return detail::identity_formatF<RangeT>();
|
||||
}
|
||||
|
||||
//! 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.
|
||||
|
||||
\param Input container used to select a correct value_type for the
|
||||
resulting empty_container<>.
|
||||
\return An instance of the \c empty_formatter object.
|
||||
*/
|
||||
template<typename CollectionT>
|
||||
template<typename RangeT>
|
||||
inline detail::empty_formatF<
|
||||
BOOST_STRING_TYPENAME value_type_of<CollectionT>::type>
|
||||
empty_formatter(const CollectionT&)
|
||||
BOOST_STRING_TYPENAME range_value<RangeT>::type>
|
||||
empty_formatter(const RangeT&)
|
||||
{
|
||||
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 <iterator>
|
||||
#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/find_iterator.hpp>
|
||||
#include <boost/algorithm/string/detail/util.hpp>
|
||||
@ -59,24 +64,24 @@ namespace boost {
|
||||
*/
|
||||
template<
|
||||
typename SequenceSequenceT,
|
||||
typename CollectionT,
|
||||
typename RangeT,
|
||||
typename FinderT >
|
||||
inline SequenceSequenceT&
|
||||
iter_find(
|
||||
SequenceSequenceT& Result,
|
||||
CollectionT& Input,
|
||||
RangeT& Input,
|
||||
FinderT Finder )
|
||||
{
|
||||
function_requires<
|
||||
FinderConcept<FinderT,
|
||||
BOOST_STRING_TYPENAME result_iterator_of<CollectionT>::type> >();
|
||||
BOOST_STRING_TYPENAME range_result_iterator<RangeT>::type> >();
|
||||
|
||||
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 detail::copy_iterator_rangeF<
|
||||
BOOST_STRING_TYPENAME
|
||||
value_type_of<SequenceSequenceT>::type,
|
||||
range_value<SequenceSequenceT>::type,
|
||||
input_iterator_type> copy_range_type;
|
||||
|
||||
input_iterator_type InputEnd=end(Input);
|
||||
@ -126,24 +131,24 @@ namespace boost {
|
||||
*/
|
||||
template<
|
||||
typename SequenceSequenceT,
|
||||
typename CollectionT,
|
||||
typename RangeT,
|
||||
typename FinderT >
|
||||
inline SequenceSequenceT&
|
||||
iter_split(
|
||||
SequenceSequenceT& Result,
|
||||
CollectionT& Input,
|
||||
RangeT& Input,
|
||||
FinderT Finder )
|
||||
{
|
||||
function_requires<
|
||||
FinderConcept<FinderT,
|
||||
BOOST_STRING_TYPENAME result_iterator_of<CollectionT>::type> >();
|
||||
BOOST_STRING_TYPENAME range_result_iterator<RangeT>::type> >();
|
||||
|
||||
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 detail::copy_iterator_rangeF<
|
||||
BOOST_STRING_TYPENAME
|
||||
value_type_of<SequenceSequenceT>::type,
|
||||
range_value<SequenceSequenceT>::type,
|
||||
input_iterator_type> copy_range_type;
|
||||
|
||||
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
|
||||
|
||||
#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/collection_traits.hpp>
|
||||
#include <boost/algorithm/string/find.hpp>
|
||||
#include <boost/algorithm/string/detail/predicate.hpp>
|
||||
|
||||
@ -34,7 +38,7 @@ namespace boost {
|
||||
|
||||
//! '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.
|
||||
When the optional predicate is specified, it is used for character-wise
|
||||
comparison.
|
||||
@ -46,16 +50,16 @@ namespace boost {
|
||||
|
||||
\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(
|
||||
const Collection1T& Input,
|
||||
const Collection2T& Test,
|
||||
const Range1T& Input,
|
||||
const Range2T& Test,
|
||||
PredicateT Comp)
|
||||
{
|
||||
typedef BOOST_STRING_TYPENAME
|
||||
const_iterator_of<Collection1T>::type Iterator1T;
|
||||
range_const_iterator<Range1T>::type Iterator1T;
|
||||
typedef BOOST_STRING_TYPENAME
|
||||
const_iterator_of<Collection2T>::type Iterator2T;
|
||||
range_const_iterator<Range2T>::type Iterator2T;
|
||||
|
||||
Iterator1T InputEnd=end(Input);
|
||||
Iterator2T TestEnd=end(Test);
|
||||
@ -77,17 +81,17 @@ namespace boost {
|
||||
/*!
|
||||
\overload
|
||||
*/
|
||||
template<typename Collection1T, typename Collection2T>
|
||||
template<typename Range1T, typename Range2T>
|
||||
inline bool starts_with(
|
||||
const Collection1T& Input,
|
||||
const Collection2T& Test)
|
||||
const Range1T& Input,
|
||||
const Range2T& Test)
|
||||
{
|
||||
return starts_with(Input, Test, is_equal());
|
||||
}
|
||||
|
||||
//! '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.
|
||||
Elements are compared case insensitively.
|
||||
|
||||
@ -98,10 +102,10 @@ namespace boost {
|
||||
|
||||
\note This function provides the strong exception-safety guarantee
|
||||
*/
|
||||
template<typename Collection1T, typename Collection2T>
|
||||
template<typename Range1T, typename Range2T>
|
||||
inline bool istarts_with(
|
||||
const Collection1T& Input,
|
||||
const Collection2T& Test,
|
||||
const Range1T& Input,
|
||||
const Range2T& Test,
|
||||
const std::locale& Loc=std::locale())
|
||||
{
|
||||
return starts_with(Input, Test, is_iequal(Loc));
|
||||
@ -112,7 +116,7 @@ namespace boost {
|
||||
|
||||
//! '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.
|
||||
When the optional predicate is specified, it is used for character-wise
|
||||
comparison.
|
||||
@ -125,14 +129,14 @@ namespace boost {
|
||||
|
||||
\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(
|
||||
const Collection1T& Input,
|
||||
const Collection2T& Test,
|
||||
const Range1T& Input,
|
||||
const Range2T& Test,
|
||||
PredicateT Comp)
|
||||
{
|
||||
typedef BOOST_STRING_TYPENAME
|
||||
const_iterator_of<Collection1T>::type Iterator1T;
|
||||
range_const_iterator<Range1T>::type Iterator1T;
|
||||
typedef BOOST_STRING_TYPENAME boost::detail::
|
||||
iterator_traits<Iterator1T>::iterator_category category;
|
||||
|
||||
@ -151,10 +155,10 @@ namespace boost {
|
||||
/*!
|
||||
\overload
|
||||
*/
|
||||
template<typename Collection1T, typename Collection2T>
|
||||
template<typename Range1T, typename Range2T>
|
||||
inline bool ends_with(
|
||||
const Collection1T& Input,
|
||||
const Collection2T& Test)
|
||||
const Range1T& Input,
|
||||
const Range2T& Test)
|
||||
{
|
||||
return ends_with(Input, Test, is_equal());
|
||||
}
|
||||
@ -172,10 +176,10 @@ namespace boost {
|
||||
|
||||
\note This function provides the strong exception-safety guarantee
|
||||
*/
|
||||
template<typename Collection1T, typename Collection2T>
|
||||
template<typename Range1T, typename Range2T>
|
||||
inline bool iends_with(
|
||||
const Collection1T& Input,
|
||||
const Collection2T& Test,
|
||||
const Range1T& Input,
|
||||
const Range2T& Test,
|
||||
const std::locale& Loc=std::locale())
|
||||
{
|
||||
return ends_with(Input, Test, is_iequal(Loc));
|
||||
@ -196,10 +200,10 @@ namespace boost {
|
||||
|
||||
\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(
|
||||
const Collection1T& Input,
|
||||
const Collection2T& Test,
|
||||
const Range1T& Input,
|
||||
const Range2T& Test,
|
||||
PredicateT Comp)
|
||||
{
|
||||
if (empty(Test))
|
||||
@ -217,10 +221,10 @@ namespace boost {
|
||||
/*!
|
||||
\overload
|
||||
*/
|
||||
template<typename Collection1T, typename Collection2T>
|
||||
template<typename Range1T, typename Range2T>
|
||||
inline bool contains(
|
||||
const Collection1T& Input,
|
||||
const Collection2T& Test)
|
||||
const Range1T& Input,
|
||||
const Range2T& Test)
|
||||
{
|
||||
return contains(Input, Test, is_equal());
|
||||
}
|
||||
@ -237,10 +241,10 @@ namespace boost {
|
||||
|
||||
\note This function provides the strong exception-safety guarantee
|
||||
*/
|
||||
template<typename Collection1T, typename Collection2T>
|
||||
template<typename Range1T, typename Range2T>
|
||||
inline bool icontains(
|
||||
const Collection1T& Input,
|
||||
const Collection2T& Test,
|
||||
const Range1T& Input,
|
||||
const Range2T& Test,
|
||||
const std::locale& Loc=std::locale())
|
||||
{
|
||||
return contains(Input, Test, is_iequal(Loc));
|
||||
@ -264,16 +268,16 @@ namespace boost {
|
||||
|
||||
\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(
|
||||
const Collection1T& Input,
|
||||
const Collection2T& Test,
|
||||
const Range1T& Input,
|
||||
const Range2T& Test,
|
||||
PredicateT Comp)
|
||||
{
|
||||
typedef BOOST_STRING_TYPENAME
|
||||
const_iterator_of<Collection1T>::type Iterator1T;
|
||||
range_const_iterator<Range1T>::type Iterator1T;
|
||||
typedef BOOST_STRING_TYPENAME
|
||||
const_iterator_of<Collection2T>::type Iterator2T;
|
||||
range_const_iterator<Range2T>::type Iterator2T;
|
||||
|
||||
Iterator1T InputEnd=end(Input);
|
||||
Iterator2T TestEnd=end(Test);
|
||||
@ -295,10 +299,10 @@ namespace boost {
|
||||
/*!
|
||||
\overload
|
||||
*/
|
||||
template<typename Collection1T, typename Collection2T>
|
||||
template<typename Range1T, typename Range2T>
|
||||
inline bool equals(
|
||||
const Collection1T& Input,
|
||||
const Collection2T& Test)
|
||||
const Range1T& Input,
|
||||
const Range2T& Test)
|
||||
{
|
||||
return equals(Input, Test, is_equal());
|
||||
}
|
||||
@ -318,10 +322,10 @@ namespace boost {
|
||||
|
||||
\note This function provides the strong exception-safety guarantee
|
||||
*/
|
||||
template<typename Collection1T, typename Collection2T>
|
||||
template<typename Range1T, typename Range2T>
|
||||
inline bool iequals(
|
||||
const Collection1T& Input,
|
||||
const Collection2T& Test,
|
||||
const Range1T& Input,
|
||||
const Range2T& Test,
|
||||
const std::locale& Loc=std::locale())
|
||||
{
|
||||
return equals(Input, Test, is_iequal(Loc));
|
||||
@ -340,13 +344,13 @@ namespace boost {
|
||||
|
||||
\note This function provides the strong exception-safety guarantee
|
||||
*/
|
||||
template<typename CollectionT, typename PredicateT>
|
||||
template<typename RangeT, typename PredicateT>
|
||||
inline bool all(
|
||||
const CollectionT& Input,
|
||||
const RangeT& Input,
|
||||
PredicateT Pred)
|
||||
{
|
||||
typedef BOOST_STRING_TYPENAME
|
||||
const_iterator_of<CollectionT>::type Iterator1T;
|
||||
range_const_iterator<RangeT>::type Iterator1T;
|
||||
|
||||
Iterator1T InputEnd=end(Input);
|
||||
for( Iterator1T It=begin(Input); It!=InputEnd; ++It)
|
||||
|
@ -12,8 +12,12 @@
|
||||
|
||||
#include <boost/algorithm/string/config.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/regex_find_format.hpp>
|
||||
#include <boost/algorithm/string/formatter.hpp>
|
||||
@ -37,21 +41,21 @@ namespace boost {
|
||||
\param Flags Regex options
|
||||
\return
|
||||
An \c iterator_range delimiting the match.
|
||||
Returned iterator is either \c InputContainerT::iterator or
|
||||
\c InputContainerT::const_iterator, depending on the constness of
|
||||
Returned iterator is either \c RangeT::iterator or
|
||||
\c RangeT::const_iterator, depending on the constness of
|
||||
the input parameter.
|
||||
|
||||
\note This function provides the strong exception-safety guarantee
|
||||
*/
|
||||
template<
|
||||
typename CollectionT,
|
||||
typename RangeT,
|
||||
typename CharT,
|
||||
typename RegexTraitsT, typename RegexAllocatorT>
|
||||
typename RegexTraitsT>
|
||||
inline iterator_range<
|
||||
BOOST_STRING_TYPENAME result_iterator_of<CollectionT>::type >
|
||||
BOOST_STRING_TYPENAME range_result_iterator<RangeT>::type >
|
||||
find_regex(
|
||||
CollectionT& Input,
|
||||
const reg_expression<CharT, RegexTraitsT, RegexAllocatorT>& Rx,
|
||||
RangeT& Input,
|
||||
const basic_regex<CharT, RegexTraitsT>& Rx,
|
||||
match_flag_type Flags=match_default )
|
||||
{
|
||||
return regex_finder(Rx,Flags)(
|
||||
@ -79,14 +83,14 @@ namespace boost {
|
||||
*/
|
||||
template<
|
||||
typename OutputIteratorT,
|
||||
typename CollectionT,
|
||||
typename RangeT,
|
||||
typename CharT,
|
||||
typename RegexTraitsT, typename RegexAllocatorT,
|
||||
typename RegexTraitsT,
|
||||
typename FormatStringTraitsT, typename FormatStringAllocatorT >
|
||||
inline OutputIteratorT replace_regex_copy(
|
||||
OutputIteratorT Output,
|
||||
const CollectionT& Input,
|
||||
const reg_expression<CharT, RegexTraitsT, RegexAllocatorT>& Rx,
|
||||
const RangeT& Input,
|
||||
const basic_regex<CharT, RegexTraitsT>& Rx,
|
||||
const std::basic_string<CharT, FormatStringTraitsT, FormatStringAllocatorT>& Format,
|
||||
match_flag_type Flags=match_default | format_default )
|
||||
{
|
||||
@ -104,11 +108,11 @@ namespace boost {
|
||||
template<
|
||||
typename SequenceT,
|
||||
typename CharT,
|
||||
typename RegexTraitsT, typename RegexAllocatorT,
|
||||
typename RegexTraitsT,
|
||||
typename FormatStringTraitsT, typename FormatStringAllocatorT >
|
||||
inline SequenceT replace_regex_copy(
|
||||
const SequenceT& Input,
|
||||
const reg_expression<CharT, RegexTraitsT, RegexAllocatorT>& Rx,
|
||||
const basic_regex<CharT, RegexTraitsT>& Rx,
|
||||
const std::basic_string<CharT, FormatStringTraitsT, FormatStringAllocatorT>& Format,
|
||||
match_flag_type Flags=match_default | format_default )
|
||||
{
|
||||
@ -131,11 +135,11 @@ namespace boost {
|
||||
template<
|
||||
typename SequenceT,
|
||||
typename CharT,
|
||||
typename RegexTraitsT, typename RegexAllocatorT,
|
||||
typename RegexTraitsT,
|
||||
typename FormatStringTraitsT, typename FormatStringAllocatorT >
|
||||
inline void replace_regex(
|
||||
SequenceT& Input,
|
||||
const reg_expression<CharT, RegexTraitsT, RegexAllocatorT>& Rx,
|
||||
const basic_regex<CharT, RegexTraitsT>& Rx,
|
||||
const std::basic_string<CharT, FormatStringTraitsT, FormatStringAllocatorT>& Format,
|
||||
match_flag_type Flags=match_default | format_default )
|
||||
{
|
||||
@ -165,14 +169,14 @@ namespace boost {
|
||||
*/
|
||||
template<
|
||||
typename OutputIteratorT,
|
||||
typename CollectionT,
|
||||
typename RangeT,
|
||||
typename CharT,
|
||||
typename RegexTraitsT, typename RegexAllocatorT,
|
||||
typename RegexTraitsT,
|
||||
typename FormatStringTraitsT, typename FormatStringAllocatorT >
|
||||
inline OutputIteratorT replace_all_regex_copy(
|
||||
OutputIteratorT Output,
|
||||
const CollectionT& Input,
|
||||
const reg_expression<CharT, RegexTraitsT, RegexAllocatorT>& Rx,
|
||||
const RangeT& Input,
|
||||
const basic_regex<CharT, RegexTraitsT>& Rx,
|
||||
const std::basic_string<CharT, FormatStringTraitsT, FormatStringAllocatorT>& Format,
|
||||
match_flag_type Flags=match_default | format_default )
|
||||
{
|
||||
@ -190,11 +194,11 @@ namespace boost {
|
||||
template<
|
||||
typename SequenceT,
|
||||
typename CharT,
|
||||
typename RegexTraitsT, typename RegexAllocatorT,
|
||||
typename RegexTraitsT,
|
||||
typename FormatStringTraitsT, typename FormatStringAllocatorT >
|
||||
inline SequenceT replace_all_regex_copy(
|
||||
const SequenceT& Input,
|
||||
const reg_expression<CharT, RegexTraitsT, RegexAllocatorT>& Rx,
|
||||
const basic_regex<CharT, RegexTraitsT>& Rx,
|
||||
const std::basic_string<CharT, FormatStringTraitsT, FormatStringAllocatorT>& Format,
|
||||
match_flag_type Flags=match_default | format_default )
|
||||
{
|
||||
@ -217,11 +221,11 @@ namespace boost {
|
||||
template<
|
||||
typename SequenceT,
|
||||
typename CharT,
|
||||
typename RegexTraitsT, typename RegexAllocatorT,
|
||||
typename RegexTraitsT,
|
||||
typename FormatStringTraitsT, typename FormatStringAllocatorT >
|
||||
inline void replace_all_regex(
|
||||
SequenceT& Input,
|
||||
const reg_expression<CharT, RegexTraitsT, RegexAllocatorT>& Rx,
|
||||
const basic_regex<CharT, RegexTraitsT>& Rx,
|
||||
const std::basic_string<CharT, FormatStringTraitsT, FormatStringAllocatorT>& Format,
|
||||
match_flag_type Flags=match_default | format_default )
|
||||
{
|
||||
@ -250,13 +254,13 @@ namespace boost {
|
||||
*/
|
||||
template<
|
||||
typename OutputIteratorT,
|
||||
typename CollectionT,
|
||||
typename RangeT,
|
||||
typename CharT,
|
||||
typename RegexTraitsT, typename RegexAllocatorT >
|
||||
typename RegexTraitsT >
|
||||
inline OutputIteratorT erase_regex_copy(
|
||||
OutputIteratorT Output,
|
||||
const CollectionT& Input,
|
||||
const reg_expression<CharT, RegexTraitsT, RegexAllocatorT>& Rx,
|
||||
const RangeT& Input,
|
||||
const basic_regex<CharT, RegexTraitsT>& Rx,
|
||||
match_flag_type Flags=match_default )
|
||||
{
|
||||
return find_format_copy(
|
||||
@ -273,10 +277,10 @@ namespace boost {
|
||||
template<
|
||||
typename SequenceT,
|
||||
typename CharT,
|
||||
typename RegexTraitsT, typename RegexAllocatorT >
|
||||
typename RegexTraitsT >
|
||||
inline SequenceT erase_regex_copy(
|
||||
const SequenceT& Input,
|
||||
const reg_expression<CharT, RegexTraitsT, RegexAllocatorT>& Rx,
|
||||
const basic_regex<CharT, RegexTraitsT>& Rx,
|
||||
match_flag_type Flags=match_default )
|
||||
{
|
||||
return find_format_copy(
|
||||
@ -297,10 +301,10 @@ namespace boost {
|
||||
template<
|
||||
typename SequenceT,
|
||||
typename CharT,
|
||||
typename RegexTraitsT, typename RegexAllocatorT >
|
||||
typename RegexTraitsT >
|
||||
inline void erase_regex(
|
||||
SequenceT& Input,
|
||||
const reg_expression<CharT, RegexTraitsT, RegexAllocatorT>& Rx,
|
||||
const basic_regex<CharT, RegexTraitsT>& Rx,
|
||||
match_flag_type Flags=match_default )
|
||||
{
|
||||
find_format(
|
||||
@ -329,13 +333,13 @@ namespace boost {
|
||||
*/
|
||||
template<
|
||||
typename OutputIteratorT,
|
||||
typename CollectionT,
|
||||
typename RangeT,
|
||||
typename CharT,
|
||||
typename RegexTraitsT, typename RegexAllocatorT >
|
||||
typename RegexTraitsT >
|
||||
inline OutputIteratorT erase_all_regex_copy(
|
||||
OutputIteratorT Output,
|
||||
const CollectionT& Input,
|
||||
const reg_expression<CharT, RegexTraitsT, RegexAllocatorT>& Rx,
|
||||
const RangeT& Input,
|
||||
const basic_regex<CharT, RegexTraitsT>& Rx,
|
||||
match_flag_type Flags=match_default )
|
||||
{
|
||||
return find_format_all_copy(
|
||||
@ -352,10 +356,10 @@ namespace boost {
|
||||
template<
|
||||
typename SequenceT,
|
||||
typename CharT,
|
||||
typename RegexTraitsT, typename RegexAllocatorT >
|
||||
typename RegexTraitsT >
|
||||
inline SequenceT erase_all_regex_copy(
|
||||
const SequenceT& Input,
|
||||
const reg_expression<CharT, RegexTraitsT, RegexAllocatorT>& Rx,
|
||||
const basic_regex<CharT, RegexTraitsT>& Rx,
|
||||
match_flag_type Flags=match_default )
|
||||
{
|
||||
return find_format_all_copy(
|
||||
@ -376,10 +380,10 @@ namespace boost {
|
||||
template<
|
||||
typename SequenceT,
|
||||
typename CharT,
|
||||
typename RegexTraitsT, typename RegexAllocatorT>
|
||||
typename RegexTraitsT>
|
||||
inline void erase_all_regex(
|
||||
SequenceT& Input,
|
||||
const reg_expression<CharT, RegexTraitsT, RegexAllocatorT>& Rx,
|
||||
const basic_regex<CharT, RegexTraitsT>& Rx,
|
||||
match_flag_type Flags=match_default )
|
||||
{
|
||||
find_format_all(
|
||||
@ -414,13 +418,13 @@ namespace boost {
|
||||
*/
|
||||
template<
|
||||
typename SequenceSequenceT,
|
||||
typename CollectionT,
|
||||
typename RangeT,
|
||||
typename CharT,
|
||||
typename RegexTraitsT, typename RegexAllocatorT >
|
||||
typename RegexTraitsT >
|
||||
inline SequenceSequenceT& find_all_regex(
|
||||
SequenceSequenceT& Result,
|
||||
const CollectionT& Input,
|
||||
const reg_expression<CharT, RegexTraitsT, RegexAllocatorT>& Rx,
|
||||
const RangeT& Input,
|
||||
const basic_regex<CharT, RegexTraitsT>& Rx,
|
||||
match_flag_type Flags=match_default )
|
||||
{
|
||||
return iter_find(
|
||||
@ -455,13 +459,13 @@ namespace boost {
|
||||
*/
|
||||
template<
|
||||
typename SequenceSequenceT,
|
||||
typename CollectionT,
|
||||
typename RangeT,
|
||||
typename CharT,
|
||||
typename RegexTraitsT, typename RegexAllocatorT >
|
||||
typename RegexTraitsT >
|
||||
inline SequenceSequenceT& split_regex(
|
||||
SequenceSequenceT& Result,
|
||||
const CollectionT& Input,
|
||||
const reg_expression<CharT, RegexTraitsT, RegexAllocatorT>& Rx,
|
||||
const RangeT& Input,
|
||||
const basic_regex<CharT, RegexTraitsT>& Rx,
|
||||
match_flag_type Flags=match_default )
|
||||
{
|
||||
return iter_split(
|
||||
|
@ -40,15 +40,15 @@ namespace boost {
|
||||
*/
|
||||
template<
|
||||
typename CharT,
|
||||
typename RegexTraitsT, typename RegexAllocatorT>
|
||||
inline detail::find_regexF< reg_expression<CharT, RegexTraitsT, RegexAllocatorT> >
|
||||
typename RegexTraitsT>
|
||||
inline detail::find_regexF< basic_regex<CharT, RegexTraitsT> >
|
||||
regex_finder(
|
||||
const reg_expression<CharT, RegexTraitsT, RegexAllocatorT>& Rx,
|
||||
const basic_regex<CharT, RegexTraitsT>& Rx,
|
||||
match_flag_type MatchFlags=match_default )
|
||||
{
|
||||
return detail::
|
||||
find_regexF<
|
||||
reg_expression<CharT, RegexTraitsT, RegexAllocatorT> >( Rx, MatchFlags );
|
||||
basic_regex<CharT, RegexTraitsT> >( Rx, MatchFlags );
|
||||
}
|
||||
|
||||
// regex_formater ---------------------------------------------//
|
||||
|
@ -11,8 +11,13 @@
|
||||
#define BOOST_STRING_REPLACE_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/finder.hpp>
|
||||
#include <boost/algorithm/string/formatter.hpp>
|
||||
@ -45,15 +50,15 @@ namespace boost {
|
||||
*/
|
||||
template<
|
||||
typename OutputIteratorT,
|
||||
typename Collection1T,
|
||||
typename Collection2T>
|
||||
typename Range1T,
|
||||
typename Range2T>
|
||||
inline OutputIteratorT replace_range_copy(
|
||||
OutputIteratorT Output,
|
||||
const Collection1T& Input,
|
||||
const Range1T& Input,
|
||||
const iterator_range<
|
||||
BOOST_STRING_TYPENAME
|
||||
const_iterator_of<Collection1T>::type>& SearchRange,
|
||||
const Collection2T& Format)
|
||||
range_const_iterator<Range1T>::type>& SearchRange,
|
||||
const Range2T& Format)
|
||||
{
|
||||
return find_format_copy(
|
||||
Output,
|
||||
@ -66,13 +71,13 @@ namespace boost {
|
||||
/*!
|
||||
\overload
|
||||
*/
|
||||
template<typename SequenceT, typename CollectionT>
|
||||
template<typename SequenceT, typename RangeT>
|
||||
inline SequenceT replace_range_copy(
|
||||
const SequenceT& Input,
|
||||
const iterator_range<
|
||||
BOOST_STRING_TYPENAME
|
||||
const_iterator_of<SequenceT>::type>& SearchRange,
|
||||
const CollectionT& Format)
|
||||
range_const_iterator<SequenceT>::type>& SearchRange,
|
||||
const RangeT& Format)
|
||||
{
|
||||
return find_format_copy(
|
||||
Input,
|
||||
@ -89,13 +94,13 @@ namespace boost {
|
||||
\param SearchRange A range in the input to be substituted
|
||||
\param Format A substitute string
|
||||
*/
|
||||
template<typename SequenceT, typename CollectionT>
|
||||
template<typename SequenceT, typename RangeT>
|
||||
inline void replace_range(
|
||||
SequenceT& Input,
|
||||
const iterator_range<
|
||||
BOOST_STRING_TYPENAME
|
||||
iterator_of<SequenceT>::type>& SearchRange,
|
||||
const CollectionT& Format)
|
||||
range_iterator<SequenceT>::type>& SearchRange,
|
||||
const RangeT& Format)
|
||||
{
|
||||
find_format(
|
||||
Input,
|
||||
@ -123,14 +128,14 @@ namespace boost {
|
||||
*/
|
||||
template<
|
||||
typename OutputIteratorT,
|
||||
typename Collection1T,
|
||||
typename Collection2T,
|
||||
typename Collection3T>
|
||||
typename Range1T,
|
||||
typename Range2T,
|
||||
typename Range3T>
|
||||
inline OutputIteratorT replace_first_copy(
|
||||
OutputIteratorT Output,
|
||||
const Collection1T& Input,
|
||||
const Collection2T& Search,
|
||||
const Collection3T& Format)
|
||||
const Range1T& Input,
|
||||
const Range2T& Search,
|
||||
const Range3T& Format)
|
||||
{
|
||||
return find_format_copy(
|
||||
Output,
|
||||
@ -143,11 +148,11 @@ namespace boost {
|
||||
/*!
|
||||
\overload
|
||||
*/
|
||||
template<typename SequenceT, typename Collection1T, typename Collection2T>
|
||||
template<typename SequenceT, typename Range1T, typename Range2T>
|
||||
inline SequenceT replace_first_copy(
|
||||
const SequenceT& Input,
|
||||
const Collection1T& Search,
|
||||
const Collection2T& Format )
|
||||
const Range1T& Search,
|
||||
const Range2T& Format )
|
||||
{
|
||||
return find_format_copy(
|
||||
Input,
|
||||
@ -164,11 +169,11 @@ namespace boost {
|
||||
\param Search A substring to be searched for
|
||||
\param Format A substitute string
|
||||
*/
|
||||
template<typename SequenceT, typename Collection1T, typename Collection2T>
|
||||
template<typename SequenceT, typename Range1T, typename Range2T>
|
||||
inline void replace_first(
|
||||
SequenceT& Input,
|
||||
const Collection1T& Search,
|
||||
const Collection2T& Format )
|
||||
const Range1T& Search,
|
||||
const Range2T& Format )
|
||||
{
|
||||
find_format(
|
||||
Input,
|
||||
@ -198,14 +203,14 @@ namespace boost {
|
||||
*/
|
||||
template<
|
||||
typename OutputIteratorT,
|
||||
typename Collection1T,
|
||||
typename Collection2T,
|
||||
typename Collection3T>
|
||||
typename Range1T,
|
||||
typename Range2T,
|
||||
typename Range3T>
|
||||
inline OutputIteratorT ireplace_first_copy(
|
||||
OutputIteratorT Output,
|
||||
const Collection1T& Input,
|
||||
const Collection2T& Search,
|
||||
const Collection3T& Format,
|
||||
const Range1T& Input,
|
||||
const Range2T& Search,
|
||||
const Range3T& Format,
|
||||
const std::locale& Loc=std::locale() )
|
||||
{
|
||||
return find_format_copy(
|
||||
@ -219,11 +224,11 @@ namespace boost {
|
||||
/*!
|
||||
\overload
|
||||
*/
|
||||
template<typename SequenceT, typename Collection2T, typename Collection1T>
|
||||
template<typename SequenceT, typename Range2T, typename Range1T>
|
||||
inline SequenceT ireplace_first_copy(
|
||||
const SequenceT& Input,
|
||||
const Collection2T& Search,
|
||||
const Collection1T& Format,
|
||||
const Range2T& Search,
|
||||
const Range1T& Format,
|
||||
const std::locale& Loc=std::locale() )
|
||||
{
|
||||
return find_format_copy(
|
||||
@ -243,11 +248,11 @@ namespace boost {
|
||||
\param Format A substitute string
|
||||
\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(
|
||||
SequenceT& Input,
|
||||
const Collection1T& Search,
|
||||
const Collection2T& Format,
|
||||
const Range1T& Search,
|
||||
const Range2T& Format,
|
||||
const std::locale& Loc=std::locale() )
|
||||
{
|
||||
find_format(
|
||||
@ -276,14 +281,14 @@ namespace boost {
|
||||
*/
|
||||
template<
|
||||
typename OutputIteratorT,
|
||||
typename Collection1T,
|
||||
typename Collection2T,
|
||||
typename Collection3T>
|
||||
typename Range1T,
|
||||
typename Range2T,
|
||||
typename Range3T>
|
||||
inline OutputIteratorT replace_last_copy(
|
||||
OutputIteratorT Output,
|
||||
const Collection1T& Input,
|
||||
const Collection2T& Search,
|
||||
const Collection3T& Format )
|
||||
const Range1T& Input,
|
||||
const Range2T& Search,
|
||||
const Range3T& Format )
|
||||
{
|
||||
return find_format_copy(
|
||||
Output,
|
||||
@ -296,11 +301,11 @@ namespace boost {
|
||||
/*!
|
||||
\overload
|
||||
*/
|
||||
template<typename SequenceT, typename Collection1T, typename Collection2T>
|
||||
template<typename SequenceT, typename Range1T, typename Range2T>
|
||||
inline SequenceT replace_last_copy(
|
||||
const SequenceT& Input,
|
||||
const Collection1T& Search,
|
||||
const Collection2T& Format )
|
||||
const Range1T& Search,
|
||||
const Range2T& Format )
|
||||
{
|
||||
return find_format_copy(
|
||||
Input,
|
||||
@ -317,11 +322,11 @@ namespace boost {
|
||||
\param Search A substring to be searched for
|
||||
\param Format A substitute string
|
||||
*/
|
||||
template<typename SequenceT, typename Collection1T, typename Collection2T>
|
||||
template<typename SequenceT, typename Range1T, typename Range2T>
|
||||
inline void replace_last(
|
||||
SequenceT& Input,
|
||||
const Collection1T& Search,
|
||||
const Collection2T& Format )
|
||||
const Range1T& Search,
|
||||
const Range2T& Format )
|
||||
{
|
||||
find_format(
|
||||
Input,
|
||||
@ -351,14 +356,14 @@ namespace boost {
|
||||
*/
|
||||
template<
|
||||
typename OutputIteratorT,
|
||||
typename Collection1T,
|
||||
typename Collection2T,
|
||||
typename Collection3T>
|
||||
typename Range1T,
|
||||
typename Range2T,
|
||||
typename Range3T>
|
||||
inline OutputIteratorT ireplace_last_copy(
|
||||
OutputIteratorT Output,
|
||||
const Collection1T& Input,
|
||||
const Collection2T& Search,
|
||||
const Collection3T& Format,
|
||||
const Range1T& Input,
|
||||
const Range2T& Search,
|
||||
const Range3T& Format,
|
||||
const std::locale& Loc=std::locale() )
|
||||
{
|
||||
return find_format_copy(
|
||||
@ -372,11 +377,11 @@ namespace boost {
|
||||
/*!
|
||||
\overload
|
||||
*/
|
||||
template<typename SequenceT, typename Collection1T, typename Collection2T>
|
||||
template<typename SequenceT, typename Range1T, typename Range2T>
|
||||
inline SequenceT ireplace_last_copy(
|
||||
const SequenceT& Input,
|
||||
const Collection1T& Search,
|
||||
const Collection2T& Format,
|
||||
const Range1T& Search,
|
||||
const Range2T& Format,
|
||||
const std::locale& Loc=std::locale() )
|
||||
{
|
||||
return find_format_copy(
|
||||
@ -397,11 +402,11 @@ namespace boost {
|
||||
\param Loc A locale used for case insensitive comparison
|
||||
\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(
|
||||
SequenceT& Input,
|
||||
const Collection1T& Search,
|
||||
const Collection2T& Format,
|
||||
const Range1T& Search,
|
||||
const Range2T& Format,
|
||||
const std::locale& Loc=std::locale() )
|
||||
{
|
||||
find_format(
|
||||
@ -431,15 +436,15 @@ namespace boost {
|
||||
*/
|
||||
template<
|
||||
typename OutputIteratorT,
|
||||
typename Collection1T,
|
||||
typename Collection2T,
|
||||
typename Collection3T>
|
||||
typename Range1T,
|
||||
typename Range2T,
|
||||
typename Range3T>
|
||||
inline OutputIteratorT replace_nth_copy(
|
||||
OutputIteratorT Output,
|
||||
const Collection1T& Input,
|
||||
const Collection2T& Search,
|
||||
const Range1T& Input,
|
||||
const Range2T& Search,
|
||||
unsigned int Nth,
|
||||
const Collection3T& Format )
|
||||
const Range3T& Format )
|
||||
{
|
||||
return find_format_copy(
|
||||
Output,
|
||||
@ -452,12 +457,12 @@ namespace boost {
|
||||
/*!
|
||||
\overload
|
||||
*/
|
||||
template<typename SequenceT, typename Collection1T, typename Collection2T>
|
||||
template<typename SequenceT, typename Range1T, typename Range2T>
|
||||
inline SequenceT replace_nth_copy(
|
||||
const SequenceT& Input,
|
||||
const Collection1T& Search,
|
||||
const Range1T& Search,
|
||||
unsigned int Nth,
|
||||
const Collection2T& Format )
|
||||
const Range2T& Format )
|
||||
{
|
||||
return find_format_copy(
|
||||
Input,
|
||||
@ -475,12 +480,12 @@ namespace boost {
|
||||
\param Nth An index of the match to be replaced. The index is 0-based.
|
||||
\param Format A substitute string
|
||||
*/
|
||||
template<typename SequenceT, typename Collection1T, typename Collection2T>
|
||||
template<typename SequenceT, typename Range1T, typename Range2T>
|
||||
inline void replace_nth(
|
||||
SequenceT& Input,
|
||||
const Collection1T& Search,
|
||||
const Range1T& Search,
|
||||
unsigned int Nth,
|
||||
const Collection2T& Format )
|
||||
const Range2T& Format )
|
||||
{
|
||||
find_format(
|
||||
Input,
|
||||
@ -511,15 +516,15 @@ namespace boost {
|
||||
*/
|
||||
template<
|
||||
typename OutputIteratorT,
|
||||
typename Collection1T,
|
||||
typename Collection2T,
|
||||
typename Collection3T>
|
||||
typename Range1T,
|
||||
typename Range2T,
|
||||
typename Range3T>
|
||||
inline OutputIteratorT ireplace_nth_copy(
|
||||
OutputIteratorT Output,
|
||||
const Collection1T& Input,
|
||||
const Collection2T& Search,
|
||||
const Range1T& Input,
|
||||
const Range2T& Search,
|
||||
unsigned int Nth,
|
||||
const Collection3T& Format,
|
||||
const Range3T& Format,
|
||||
const std::locale& Loc=std::locale() )
|
||||
{
|
||||
return find_format_copy(
|
||||
@ -533,12 +538,12 @@ namespace boost {
|
||||
/*!
|
||||
\overload
|
||||
*/
|
||||
template<typename SequenceT, typename Collection1T, typename Collection2T>
|
||||
template<typename SequenceT, typename Range1T, typename Range2T>
|
||||
inline SequenceT ireplace_nth_copy(
|
||||
const SequenceT& Input,
|
||||
const Collection1T& Search,
|
||||
const Range1T& Search,
|
||||
unsigned int Nth,
|
||||
const Collection2T& Format,
|
||||
const Range2T& Format,
|
||||
const std::locale& Loc=std::locale() )
|
||||
{
|
||||
return find_format_copy(
|
||||
@ -559,12 +564,12 @@ namespace boost {
|
||||
\param Format A substitute string
|
||||
\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(
|
||||
SequenceT& Input,
|
||||
const Collection1T& Search,
|
||||
const Range1T& Search,
|
||||
unsigned int Nth,
|
||||
const Collection2T& Format,
|
||||
const Range2T& Format,
|
||||
const std::locale& Loc=std::locale() )
|
||||
{
|
||||
find_format(
|
||||
@ -593,14 +598,14 @@ namespace boost {
|
||||
*/
|
||||
template<
|
||||
typename OutputIteratorT,
|
||||
typename Collection1T,
|
||||
typename Collection2T,
|
||||
typename Collection3T>
|
||||
typename Range1T,
|
||||
typename Range2T,
|
||||
typename Range3T>
|
||||
inline OutputIteratorT replace_all_copy(
|
||||
OutputIteratorT Output,
|
||||
const Collection1T& Input,
|
||||
const Collection2T& Search,
|
||||
const Collection3T& Format )
|
||||
const Range1T& Input,
|
||||
const Range2T& Search,
|
||||
const Range3T& Format )
|
||||
{
|
||||
return find_format_all_copy(
|
||||
Output,
|
||||
@ -613,11 +618,11 @@ namespace boost {
|
||||
/*!
|
||||
\overload
|
||||
*/
|
||||
template<typename SequenceT, typename Collection1T, typename Collection2T>
|
||||
template<typename SequenceT, typename Range1T, typename Range2T>
|
||||
inline SequenceT replace_all_copy(
|
||||
const SequenceT& Input,
|
||||
const Collection1T& Search,
|
||||
const Collection2T& Format )
|
||||
const Range1T& Search,
|
||||
const Range2T& Format )
|
||||
{
|
||||
return find_format_all_copy(
|
||||
Input,
|
||||
@ -635,11 +640,11 @@ namespace boost {
|
||||
\param Format A substitute string
|
||||
\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(
|
||||
SequenceT& Input,
|
||||
const Collection1T& Search,
|
||||
const Collection2T& Format )
|
||||
const Range1T& Search,
|
||||
const Range2T& Format )
|
||||
{
|
||||
find_format_all(
|
||||
Input,
|
||||
@ -669,14 +674,14 @@ namespace boost {
|
||||
*/
|
||||
template<
|
||||
typename OutputIteratorT,
|
||||
typename Collection1T,
|
||||
typename Collection2T,
|
||||
typename Collection3T>
|
||||
typename Range1T,
|
||||
typename Range2T,
|
||||
typename Range3T>
|
||||
inline OutputIteratorT ireplace_all_copy(
|
||||
OutputIteratorT Output,
|
||||
const Collection1T& Input,
|
||||
const Collection2T& Search,
|
||||
const Collection3T& Format,
|
||||
const Range1T& Input,
|
||||
const Range2T& Search,
|
||||
const Range3T& Format,
|
||||
const std::locale& Loc=std::locale() )
|
||||
{
|
||||
return find_format_all_copy(
|
||||
@ -690,11 +695,11 @@ namespace boost {
|
||||
/*!
|
||||
\overload
|
||||
*/
|
||||
template<typename SequenceT, typename Collection1T, typename Collection2T>
|
||||
template<typename SequenceT, typename Range1T, typename Range2T>
|
||||
inline SequenceT ireplace_all_copy(
|
||||
const SequenceT& Input,
|
||||
const Collection1T& Search,
|
||||
const Collection2T& Format,
|
||||
const Range1T& Search,
|
||||
const Range2T& Format,
|
||||
const std::locale& Loc=std::locale() )
|
||||
{
|
||||
return find_format_all_copy(
|
||||
@ -714,11 +719,11 @@ namespace boost {
|
||||
\param Format A substitute string
|
||||
\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(
|
||||
SequenceT& Input,
|
||||
const Collection1T& Search,
|
||||
const Collection2T& Format,
|
||||
const Range1T& Search,
|
||||
const Range2T& Format,
|
||||
const std::locale& Loc=std::locale() )
|
||||
{
|
||||
find_format_all(
|
||||
@ -749,13 +754,13 @@ namespace boost {
|
||||
*/
|
||||
template<
|
||||
typename OutputIteratorT,
|
||||
typename Collection1T,
|
||||
typename Collection2T>
|
||||
typename Range1T,
|
||||
typename Range2T>
|
||||
inline OutputIteratorT replace_head_copy(
|
||||
OutputIteratorT Output,
|
||||
const Collection1T& Input,
|
||||
const Range1T& Input,
|
||||
unsigned int N,
|
||||
const Collection2T& Format )
|
||||
const Range2T& Format )
|
||||
{
|
||||
return find_format_copy(
|
||||
Output,
|
||||
@ -768,11 +773,11 @@ namespace boost {
|
||||
/*!
|
||||
\overload
|
||||
*/
|
||||
template<typename SequenceT, typename CollectionT>
|
||||
template<typename SequenceT, typename RangeT>
|
||||
inline SequenceT replace_head_copy(
|
||||
const SequenceT& Input,
|
||||
unsigned int N,
|
||||
const CollectionT& Format )
|
||||
const RangeT& Format )
|
||||
{
|
||||
return find_format_copy(
|
||||
Input,
|
||||
@ -791,11 +796,11 @@ namespace boost {
|
||||
\param N Length of the head
|
||||
\param Format A substitute string
|
||||
*/
|
||||
template<typename SequenceT, typename CollectionT>
|
||||
template<typename SequenceT, typename RangeT>
|
||||
inline void replace_head(
|
||||
SequenceT& Input,
|
||||
unsigned int N,
|
||||
const CollectionT& Format )
|
||||
const RangeT& Format )
|
||||
{
|
||||
find_format(
|
||||
Input,
|
||||
@ -825,13 +830,13 @@ namespace boost {
|
||||
*/
|
||||
template<
|
||||
typename OutputIteratorT,
|
||||
typename Collection1T,
|
||||
typename Collection2T>
|
||||
typename Range1T,
|
||||
typename Range2T>
|
||||
inline OutputIteratorT replace_tail_copy(
|
||||
OutputIteratorT Output,
|
||||
const Collection1T& Input,
|
||||
const Range1T& Input,
|
||||
unsigned int N,
|
||||
const Collection2T& Format )
|
||||
const Range2T& Format )
|
||||
{
|
||||
return find_format_copy(
|
||||
Output,
|
||||
@ -844,11 +849,11 @@ namespace boost {
|
||||
/*!
|
||||
\overload
|
||||
*/
|
||||
template<typename SequenceT, typename CollectionT>
|
||||
template<typename SequenceT, typename RangeT>
|
||||
inline SequenceT replace_tail_copy(
|
||||
const SequenceT& Input,
|
||||
unsigned int N,
|
||||
const CollectionT& Format )
|
||||
const RangeT& Format )
|
||||
{
|
||||
return find_format_copy(
|
||||
Input,
|
||||
@ -867,11 +872,11 @@ namespace boost {
|
||||
\param N Length of the tail
|
||||
\param Format A substitute string
|
||||
*/
|
||||
template<typename SequenceT, typename CollectionT>
|
||||
template<typename SequenceT, typename RangeT>
|
||||
inline void replace_tail(
|
||||
SequenceT& Input,
|
||||
unsigned int N,
|
||||
const CollectionT& Format )
|
||||
const RangeT& Format )
|
||||
{
|
||||
find_format(
|
||||
Input,
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
Due to a language restriction, it is not currently possible to define specializations for
|
||||
stl containers without including the corresponding header. To decrease the overhead
|
||||
needed by this inclusion, user can selectively include a specialization
|
||||
needed by this inclusion, user can selectively include a specialization
|
||||
header for a specific container. They are located in boost/algorithm/string/stl
|
||||
directory. Alternatively she can include boost/algorithm/string/std_collection_traits.hpp
|
||||
header which contains specializations for all stl containers.
|
||||
@ -39,7 +39,7 @@ namespace boost {
|
||||
|
||||
//! Native replace tester
|
||||
/*!
|
||||
Declare an override of this tester function with return
|
||||
Declare an override of this tester function with return
|
||||
type boost::string_algo::yes_type for a sequence with this property.
|
||||
|
||||
\return yes_type if the container has basic_string like native replace
|
||||
@ -49,31 +49,31 @@ namespace boost {
|
||||
|
||||
//! Stable iterators tester
|
||||
/*!
|
||||
Declare an override of this tester function with return
|
||||
Declare an override of this tester function with return
|
||||
type boost::string_algo::yes_type for a sequence with this property.
|
||||
|
||||
\return yes_type if the sequence's insert/replace/erase methods do not invalidate
|
||||
existing iterators.
|
||||
*/
|
||||
no_type has_stable_iterators_tester(...);
|
||||
no_type has_stable_iterators_tester(...);
|
||||
|
||||
//! const time insert tester
|
||||
/*!
|
||||
Declare an override of this tester function with return
|
||||
Declare an override of this tester function with return
|
||||
type boost::string_algo::yes_type for a sequence with this property.
|
||||
|
||||
\return yes_type if the sequence's insert method is working in constant time
|
||||
*/
|
||||
no_type has_const_time_insert_tester(...);
|
||||
no_type has_const_time_insert_tester(...);
|
||||
|
||||
//! const time erase tester
|
||||
/*!
|
||||
Declare an override of this tester function with return
|
||||
Declare an override of this tester function with return
|
||||
type boost::string_algo::yes_type for a sequence with this property.
|
||||
|
||||
\return yes_type if the sequence's erase method is working in constant time
|
||||
*/
|
||||
no_type has_const_time_erase_tester(...);
|
||||
no_type has_const_time_erase_tester(...);
|
||||
|
||||
#endif //BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
|
||||
@ -89,7 +89,7 @@ namespace boost {
|
||||
private:
|
||||
static T* t;
|
||||
public:
|
||||
BOOST_STATIC_CONSTANT(bool, value=(
|
||||
BOOST_STATIC_CONSTANT(bool, value=(
|
||||
sizeof(has_native_replace_tester(t))==sizeof(yes_type) ) );
|
||||
#else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
public:
|
||||
@ -99,9 +99,9 @@ namespace boost {
|
||||
BOOST_STATIC_CONSTANT(bool, value=false);
|
||||
# endif // BOOST_WORKAROUND( __IBMCPP__, <= 600 )
|
||||
#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
|
||||
|
||||
typedef mpl::bool_<value> type;
|
||||
|
||||
typedef mpl::bool_<has_native_replace<T>::value> type;
|
||||
};
|
||||
|
||||
|
||||
@ -117,7 +117,7 @@ namespace boost {
|
||||
private:
|
||||
static T* t;
|
||||
public:
|
||||
BOOST_STATIC_CONSTANT(bool, value=(
|
||||
BOOST_STATIC_CONSTANT(bool, value=(
|
||||
sizeof(has_stable_iterators_tester(t))==sizeof(yes_type) ) );
|
||||
#else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
public:
|
||||
@ -128,13 +128,13 @@ namespace boost {
|
||||
# endif // BOOST_WORKAROUND( __IBMCPP__, <= 600 )
|
||||
#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
|
||||
typedef mpl::bool_<value> type;
|
||||
typedef mpl::bool_<has_stable_iterators<T>::value> type;
|
||||
};
|
||||
|
||||
|
||||
//! Const time insert trait
|
||||
/*!
|
||||
This trait specifies that the sequence's insert method has
|
||||
This trait specifies that the sequence's insert method has
|
||||
constant time complexity.
|
||||
*/
|
||||
template< typename T >
|
||||
@ -144,7 +144,7 @@ namespace boost {
|
||||
private:
|
||||
static T* t;
|
||||
public:
|
||||
BOOST_STATIC_CONSTANT(bool, value=(
|
||||
BOOST_STATIC_CONSTANT(bool, value=(
|
||||
sizeof(has_const_time_insert_tester(t))==sizeof(yes_type) ) );
|
||||
#else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
public:
|
||||
@ -155,13 +155,13 @@ namespace boost {
|
||||
# endif // BOOST_WORKAROUND( __IBMCPP__, <= 600 )
|
||||
#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
|
||||
typedef mpl::bool_<value> type;
|
||||
typedef mpl::bool_<has_const_time_insert<T>::value> type;
|
||||
};
|
||||
|
||||
|
||||
//! Const time erase trait
|
||||
/*!
|
||||
This trait specifies that the sequence's erase method has
|
||||
This trait specifies that the sequence's erase method has
|
||||
constant time complexity.
|
||||
*/
|
||||
template< typename T >
|
||||
@ -171,7 +171,7 @@ namespace boost {
|
||||
private:
|
||||
static T* t;
|
||||
public:
|
||||
BOOST_STATIC_CONSTANT(bool, value=(
|
||||
BOOST_STATIC_CONSTANT(bool, value=(
|
||||
sizeof(has_const_time_erase_tester(t))==sizeof(yes_type) ) );
|
||||
#else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
public:
|
||||
@ -182,7 +182,7 @@ namespace boost {
|
||||
# endif // BOOST_WORKAROUND( __IBMCPP__, <= 600 )
|
||||
#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
|
||||
typedef mpl::bool_<value> type;
|
||||
typedef mpl::bool_<has_const_time_erase<T>::value> type;
|
||||
};
|
||||
|
||||
} // namespace algorithm
|
||||
|
@ -11,8 +11,7 @@
|
||||
#define BOOST_STRING_SPLIT_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/finder.hpp>
|
||||
#include <boost/algorithm/string/compare.hpp>
|
||||
@ -58,11 +57,11 @@ namespace boost {
|
||||
|
||||
\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(
|
||||
SequenceSequenceT& Result,
|
||||
Collection1T& Input,
|
||||
const Collection2T& Search)
|
||||
Range1T& Input,
|
||||
const Range2T& Search)
|
||||
{
|
||||
return iter_find(
|
||||
Result,
|
||||
@ -93,11 +92,11 @@ namespace boost {
|
||||
|
||||
\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(
|
||||
SequenceSequenceT& Result,
|
||||
Collection1T& Input,
|
||||
const Collection2T& Search,
|
||||
Range1T& Input,
|
||||
const Range2T& Search,
|
||||
const std::locale& Loc=std::locale() )
|
||||
{
|
||||
return iter_find(
|
||||
@ -136,10 +135,10 @@ namespace boost {
|
||||
|
||||
\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(
|
||||
SequenceSequenceT& Result,
|
||||
CollectionT& Input,
|
||||
RangeT& Input,
|
||||
PredicateT Pred,
|
||||
token_compress_mode_type eCompress=token_compress_off )
|
||||
{
|
||||
|
@ -33,9 +33,9 @@ namespace boost {
|
||||
template<typename T, typename AllocT>
|
||||
yes_type has_const_time_erase_tester( const ::std::list<T,AllocT>* );
|
||||
|
||||
|
||||
|
||||
#else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
|
||||
|
||||
// stable iterators trait
|
||||
template<typename T, typename AllocT>
|
||||
class has_stable_iterators< ::std::list<T,AllocT> >
|
||||
@ -46,7 +46,7 @@ namespace boost {
|
||||
#else
|
||||
BOOST_STATIC_CONSTANT(bool, value=true);
|
||||
#endif // BOOST_WORKAROUND( __IBMCPP__, <= 600 )
|
||||
typedef mpl::bool_<value> type;
|
||||
typedef mpl::bool_<has_stable_iterators<T>::value> type;
|
||||
};
|
||||
|
||||
// const time insert trait
|
||||
@ -59,7 +59,7 @@ namespace boost {
|
||||
#else
|
||||
BOOST_STATIC_CONSTANT(bool, value=true);
|
||||
#endif // BOOST_WORKAROUND( __IBMCPP__, <= 600 )
|
||||
typedef mpl::bool_<value> type;
|
||||
typedef mpl::bool_<has_const_time_insert<T>::value> type;
|
||||
};
|
||||
|
||||
// const time erase trait
|
||||
@ -72,11 +72,11 @@ namespace boost {
|
||||
#else
|
||||
BOOST_STATIC_CONSTANT(bool, value=true);
|
||||
#endif // BOOST_WORKAROUND( __IBMCPP__, <= 600 )
|
||||
typedef mpl::bool_<value> type;
|
||||
typedef mpl::bool_<has_const_time_erase<T>::value> type;
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
} // namespace algorithm
|
||||
} // namespace boost
|
||||
|
||||
|
@ -10,6 +10,7 @@
|
||||
#ifndef 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 <slist>
|
||||
#include <boost/algorithm/string/sequence_traits.hpp>
|
||||
@ -23,21 +24,21 @@ namespace boost {
|
||||
|
||||
// stable iterators tester
|
||||
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
|
||||
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
|
||||
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
|
||||
|
||||
|
||||
// stable iterators trait
|
||||
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:
|
||||
#if BOOST_WORKAROUND( __IBMCPP__, <= 600 )
|
||||
@ -45,12 +46,12 @@ namespace boost {
|
||||
#else
|
||||
BOOST_STATIC_CONSTANT(bool, value=true);
|
||||
#endif // BOOST_WORKAROUND( __IBMCPP__, <= 600 )
|
||||
typedef mpl::bool_<value> type;
|
||||
typedef mpl::bool_<has_stable_iterators<T>::value> type;
|
||||
};
|
||||
|
||||
// const time insert trait
|
||||
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:
|
||||
#if BOOST_WORKAROUND( __IBMCPP__, <= 600 )
|
||||
@ -58,12 +59,12 @@ namespace boost {
|
||||
#else
|
||||
BOOST_STATIC_CONSTANT(bool, value=true);
|
||||
#endif // BOOST_WORKAROUND( __IBMCPP__, <= 600 )
|
||||
typedef mpl::bool_<value> type;
|
||||
typedef mpl::bool_<has_const_time_insert<T>::value> type;
|
||||
};
|
||||
|
||||
// const time erase trait
|
||||
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:
|
||||
#if BOOST_WORKAROUND( __IBMCPP__, <= 600 )
|
||||
@ -71,7 +72,7 @@ namespace boost {
|
||||
#else
|
||||
BOOST_STATIC_CONSTANT(bool, value=true);
|
||||
#endif // BOOST_WORKAROUND( __IBMCPP__, <= 600 )
|
||||
typedef mpl::bool_<value> type;
|
||||
typedef mpl::bool_<has_const_time_erase<T>::value> type;
|
||||
};
|
||||
#endif
|
||||
|
||||
|
@ -38,7 +38,7 @@ namespace boost {
|
||||
BOOST_STATIC_CONSTANT(bool, value=true);
|
||||
#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
|
||||
|
||||
#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/classification.hpp>
|
||||
#include <locale>
|
||||
@ -42,7 +46,7 @@ namespace boost {
|
||||
or copied to the output iterator
|
||||
|
||||
\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
|
||||
\return
|
||||
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
|
||||
*/
|
||||
template<typename OutputIteratorT, typename CollectionT, typename PredicateT>
|
||||
template<typename OutputIteratorT, typename RangeT, typename PredicateT>
|
||||
inline OutputIteratorT trim_left_copy_if(
|
||||
OutputIteratorT Output,
|
||||
const CollectionT& Input,
|
||||
const RangeT& Input,
|
||||
PredicateT IsSpace)
|
||||
{
|
||||
std::copy(
|
||||
detail::trim_begin(
|
||||
::boost::algorithm::detail::trim_begin(
|
||||
begin(Input),
|
||||
end(Input),
|
||||
IsSpace ),
|
||||
@ -75,7 +79,7 @@ namespace boost {
|
||||
inline SequenceT trim_left_copy_if(const SequenceT& Input, PredicateT IsSpace)
|
||||
{
|
||||
return SequenceT(
|
||||
detail::trim_begin(
|
||||
::boost::algorithm::detail::trim_begin(
|
||||
begin(Input),
|
||||
end(Input),
|
||||
IsSpace ),
|
||||
@ -116,7 +120,7 @@ namespace boost {
|
||||
{
|
||||
Input.erase(
|
||||
begin(Input),
|
||||
detail::trim_begin(
|
||||
::boost::algorithm::detail::trim_begin(
|
||||
begin(Input),
|
||||
end(Input),
|
||||
IsSpace));
|
||||
@ -148,7 +152,7 @@ namespace boost {
|
||||
or copied to the output iterator
|
||||
|
||||
\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
|
||||
\return
|
||||
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
|
||||
*/
|
||||
template<typename OutputIteratorT, typename CollectionT, typename PredicateT>
|
||||
template<typename OutputIteratorT, typename RangeT, typename PredicateT>
|
||||
inline OutputIteratorT trim_right_copy_if(
|
||||
OutputIteratorT Output,
|
||||
const CollectionT& Input,
|
||||
const RangeT& Input,
|
||||
PredicateT IsSpace )
|
||||
{
|
||||
std::copy(
|
||||
begin(Input),
|
||||
detail::trim_end(
|
||||
::boost::algorithm::detail::trim_end(
|
||||
begin(Input),
|
||||
end(Input),
|
||||
IsSpace ),
|
||||
@ -182,7 +186,7 @@ namespace boost {
|
||||
{
|
||||
return SequenceT(
|
||||
begin(Input),
|
||||
detail::trim_end(
|
||||
::boost::algorithm::detail::trim_end(
|
||||
begin(Input),
|
||||
end(Input),
|
||||
IsSpace)
|
||||
@ -223,7 +227,7 @@ namespace boost {
|
||||
inline void trim_right_if(SequenceT& Input, PredicateT IsSpace)
|
||||
{
|
||||
Input.erase(
|
||||
detail::trim_end(
|
||||
::boost::algorithm::detail::trim_end(
|
||||
begin(Input),
|
||||
end(Input),
|
||||
IsSpace ),
|
||||
@ -258,7 +262,7 @@ namespace boost {
|
||||
or copied to the output iterator
|
||||
|
||||
\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
|
||||
\return
|
||||
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
|
||||
*/
|
||||
template<typename OutputIteratorT, typename CollectionT, typename PredicateT>
|
||||
template<typename OutputIteratorT, typename RangeT, typename PredicateT>
|
||||
inline OutputIteratorT trim_copy_if(
|
||||
OutputIteratorT Output,
|
||||
const CollectionT& Input,
|
||||
const RangeT& Input,
|
||||
PredicateT IsSpace)
|
||||
{
|
||||
BOOST_STRING_TYPENAME
|
||||
const_iterator_of<CollectionT>::type TrimEnd=
|
||||
detail::trim_end(
|
||||
range_const_iterator<RangeT>::type TrimEnd=
|
||||
::boost::algorithm::detail::trim_end(
|
||||
begin(Input),
|
||||
end(Input),
|
||||
IsSpace);
|
||||
@ -297,8 +301,8 @@ namespace boost {
|
||||
inline SequenceT trim_copy_if(const SequenceT& Input, PredicateT IsSpace)
|
||||
{
|
||||
BOOST_STRING_TYPENAME
|
||||
const_iterator_of<SequenceT>::type TrimEnd=
|
||||
detail::trim_end(
|
||||
range_const_iterator<SequenceT>::type TrimEnd=
|
||||
::boost::algorithm::detail::trim_end(
|
||||
begin(Input),
|
||||
end(Input),
|
||||
IsSpace);
|
||||
|
@ -19,7 +19,7 @@ HREF="../../../boost/algorithm/minmax.hpp">boost/algorithm/minmax.hpp</A>> </
|
||||
<a href="#synopsis">Synopsis</a><br>
|
||||
<a href="#description">Function templates description</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="#postcond">Postconditions</a><br>
|
||||
<a href="#complexity">Complexity</a><br>
|
||||
@ -95,7 +95,7 @@ namespace boost {
|
||||
tuple<T const&, T const&> >
|
||||
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&> >
|
||||
minmax(const T& a, const T& b, BinaryPredicate comp);
|
||||
|
||||
|
@ -11,7 +11,10 @@ import testing ;
|
||||
|
||||
{
|
||||
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 <list>
|
||||
#include <set>
|
||||
#include <cstdlib>
|
||||
|
||||
#include <boost/config.hpp> /* prevents some nasty warns in MSVC */
|
||||
#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[] )
|
||||
{
|
||||
#ifndef BOOST_NO_STDC_NAMESPACE
|
||||
using std::atoi;
|
||||
#endif
|
||||
|
||||
int n = 100;
|
||||
if (argc > 1) n = atoi(argv[1]);
|
||||
|
||||
|
@ -21,7 +21,6 @@ doxygen autodoc
|
||||
[ glob ../../../../boost/algorithm/string/iterator_range.hpp ]
|
||||
[ glob ../../../../boost/algorithm/string/sequence_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/compare.hpp ]
|
||||
[ glob ../../../../boost/algorithm/string/constants.hpp ]
|
||||
|
@ -18,15 +18,13 @@
|
||||
</para>
|
||||
<para>
|
||||
<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.
|
||||
</para>
|
||||
<para>
|
||||
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.
|
||||
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
|
||||
</para>
|
||||
<para>
|
||||
@ -42,166 +40,11 @@
|
||||
</para>
|
||||
<para>
|
||||
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.
|
||||
</para>
|
||||
</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">
|
||||
<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>
|
||||
<xi:include href="intro.xml"/>
|
||||
<xi:include href="release_notes.xml"/>
|
||||
<xi:include href="usage.xml"/>
|
||||
<xi:include href="quickref.xml"/>
|
||||
<xi:include href="design.xml"/>
|
||||
|
@ -46,10 +46,10 @@
|
||||
<code>to_lower(str1)</code>, than <code>to_lower(str1.begin(), str1.end())</code>.
|
||||
</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.
|
||||
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.
|
||||
</para>
|
||||
</listitem>
|
||||
@ -200,16 +200,16 @@
|
||||
</programlisting>
|
||||
<para>
|
||||
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
|
||||
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
|
||||
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
|
||||
<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.
|
||||
Also it is convertible to bool therefore it is easy to use find algorithms for a simple containment checking.
|
||||
</para>
|
||||
@ -256,7 +256,7 @@
|
||||
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
|
||||
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.
|
||||
</para>
|
||||
<para>
|
||||
@ -274,7 +274,7 @@
|
||||
It!=string_find_iterator();
|
||||
++It)
|
||||
{
|
||||
cout << copy_iterator_range<std::string>(*It) << endl;
|
||||
cout << copy_range<std::string>(*It) << endl;
|
||||
}
|
||||
|
||||
// Output will be:
|
||||
@ -288,7 +288,7 @@
|
||||
It!=string_find_iterator();
|
||||
++It)
|
||||
{
|
||||
cout << copy_iterator_range<std::string>(*It) << endl;
|
||||
cout << copy_range<std::string>(*It) << endl;
|
||||
}
|
||||
|
||||
// Output will be:
|
||||
@ -300,7 +300,7 @@
|
||||
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
|
||||
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>
|
||||
See the reference in <headername>boost/algorithm/string/find_iterator.hpp</headername>.
|
||||
|
@ -10,9 +10,10 @@
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
#include <iterator>
|
||||
#include <boost/algorithm/string/replace.hpp>
|
||||
#include <boost/algorithm/string/erase.hpp>
|
||||
#include <boost/algorithm/string/case_conv.hpp>
|
||||
//#include <boost/algorithm/string/replace.hpp>
|
||||
//#include <boost/algorithm/string/erase.hpp>
|
||||
//#include <boost/algorithm/string/case_conv.hpp>
|
||||
#include <boost/algorithm/string.hpp>
|
||||
|
||||
//Following two includes contain second-layer function.
|
||||
//They are already included by first-layer header
|
||||
|
@ -24,7 +24,7 @@ using namespace std;
|
||||
using namespace boost;
|
||||
|
||||
// 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 -----------------------------------------------------------------------
|
||||
|
||||
@ -59,7 +59,7 @@ struct find_compressF
|
||||
{
|
||||
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 );
|
||||
}
|
||||
|
@ -12,7 +12,6 @@
|
||||
#include <iostream>
|
||||
#include <iterator>
|
||||
#include <functional>
|
||||
#include <boost/algorithm/string/iterator_range.hpp>
|
||||
#include <boost/algorithm/string/classification.hpp>
|
||||
#include <boost/algorithm/string/split.hpp>
|
||||
#include <boost/algorithm/string/find_iterator.hpp>
|
||||
@ -36,7 +35,7 @@ int main()
|
||||
It!=string_find_iterator();
|
||||
++It)
|
||||
{
|
||||
cout << copy_iterator_range<std::string>(*It) << endl;
|
||||
cout << copy_range<std::string>(*It) << endl;
|
||||
// shift all chars in the match by one
|
||||
transform(
|
||||
It->begin(), It->end(),
|
||||
|
@ -17,15 +17,7 @@ DEPENDS all : test ;
|
||||
|
||||
{
|
||||
test-suite algorithm/string
|
||||
: [ run
|
||||
container_test.cpp
|
||||
: :
|
||||
:
|
||||
std::locale-support
|
||||
std::facet-support
|
||||
: container
|
||||
]
|
||||
[ run
|
||||
: [ run
|
||||
trim_test.cpp
|
||||
: :
|
||||
:
|
||||
|
@ -10,13 +10,7 @@
|
||||
import testing ;
|
||||
|
||||
test-suite algorithm/string
|
||||
: [ run
|
||||
container_test.cpp
|
||||
: :
|
||||
:
|
||||
: container
|
||||
]
|
||||
[ run
|
||||
: [ run
|
||||
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 );
|
||||
BOOST_CHECK( str3=="" );
|
||||
|
||||
free(pch1);
|
||||
free(pch2);
|
||||
delete[] pch1;
|
||||
delete[] pch2;
|
||||
}
|
||||
|
||||
// test main
|
||||
|
@ -28,7 +28,7 @@ void find_test()
|
||||
string str1("123abcxXxabcXxXabc321");
|
||||
string str2("abc");
|
||||
string str3("");
|
||||
char* pch1="123abcxxxabcXXXabc321";
|
||||
const char* pch1="123abcxxxabcXXXabc321";
|
||||
vector<int> vec1( str1.begin(), str1.end() );
|
||||
|
||||
// find results ------------------------------------------------------------//
|
||||
|
@ -25,7 +25,7 @@ using namespace boost;
|
||||
static void find_test()
|
||||
{
|
||||
string str1("123a1cxxxa23cXXXa456c321");
|
||||
char* pch1="123a1cxxxa23cXXXa456c321";
|
||||
const char* pch1="123a1cxxxa23cXXXa456c321";
|
||||
regex rx("a[0-9]+c");
|
||||
vector<int> vec1( str1.begin(), str1.end() );
|
||||
vector<string> tokens;
|
||||
|
@ -38,9 +38,9 @@ void deep_compare( const T1& X, const T2& Y )
|
||||
void iterator_test()
|
||||
{
|
||||
string str1("xx-abc--xx-abb");
|
||||
string str2("Xx-abc--xX-abb");
|
||||
string str2("Xx-abc--xX-abb-xx");
|
||||
string str3("xx");
|
||||
char* pch1="xx-abc--xx-abb";
|
||||
const char* pch1="xx-abc--xx-abb";
|
||||
vector<string> tokens;
|
||||
vector< vector<int> > vtokens;
|
||||
|
||||
@ -59,9 +59,10 @@ void iterator_test()
|
||||
str2,
|
||||
"xx" );
|
||||
|
||||
BOOST_REQUIRE( tokens.size()==2 );
|
||||
BOOST_REQUIRE( tokens.size()==3 );
|
||||
BOOST_CHECK( tokens[0]==string("Xx") );
|
||||
BOOST_CHECK( tokens[1]==string("xX") );
|
||||
BOOST_CHECK( tokens[2]==string("xx") );
|
||||
|
||||
find_all(
|
||||
tokens,
|
||||
@ -81,14 +82,15 @@ void iterator_test()
|
||||
// split tests
|
||||
split(
|
||||
tokens,
|
||||
str1,
|
||||
is_any_of("x"),
|
||||
str2,
|
||||
is_any_of("xX"),
|
||||
token_compress_on );
|
||||
|
||||
BOOST_REQUIRE( tokens.size()==3 );
|
||||
BOOST_REQUIRE( tokens.size()==4 );
|
||||
BOOST_CHECK( tokens[0]==string("") );
|
||||
BOOST_CHECK( tokens[1]==string("-abc--") );
|
||||
BOOST_CHECK( tokens[2]==string("-abb") );
|
||||
BOOST_CHECK( tokens[2]==string("-abb-") );
|
||||
BOOST_CHECK( tokens[3]==string("") );
|
||||
|
||||
split(
|
||||
tokens,
|
||||
|
Reference in New Issue
Block a user