mirror of
https://github.com/boostorg/algorithm.git
synced 2025-06-25 20:11:50 +02:00
Compare commits
4 Commits
boost-1.33
...
svn-branch
Author | SHA1 | Date | |
---|---|---|---|
eaa5a47847 | |||
af2d4c487d | |||
f2fa1d3b7a | |||
322c1f2900 |
@ -15,6 +15,7 @@
|
||||
*/
|
||||
|
||||
#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,11 +14,7 @@
|
||||
#include <algorithm>
|
||||
#include <locale>
|
||||
#include <boost/iterator/transform_iterator.hpp>
|
||||
|
||||
#include <boost/range/begin.hpp>
|
||||
#include <boost/range/end.hpp>
|
||||
#include <boost/range/value_type.hpp>
|
||||
|
||||
#include <boost/algorithm/string/collection_traits.hpp>
|
||||
#include <boost/algorithm/string/detail/case_conv.hpp>
|
||||
|
||||
/*! \file
|
||||
@ -39,7 +35,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 range
|
||||
\param Input An input collection
|
||||
\param Loc A locale used for conversion
|
||||
\return
|
||||
An output iterator pointing just after the last inserted character or
|
||||
@ -48,19 +44,19 @@ namespace boost {
|
||||
\note The second variant of this function provides the strong exception-safety guarantee
|
||||
|
||||
*/
|
||||
template<typename OutputIteratorT, typename RangeT>
|
||||
template<typename OutputIteratorT, typename CollectionT>
|
||||
inline OutputIteratorT
|
||||
to_lower_copy(
|
||||
OutputIteratorT Output,
|
||||
const RangeT& Input,
|
||||
const CollectionT& Input,
|
||||
const std::locale& Loc=std::locale())
|
||||
{
|
||||
return std::transform(
|
||||
begin(Input),
|
||||
end(Input),
|
||||
Output,
|
||||
::boost::algorithm::detail::to_lowerF<
|
||||
typename range_value<RangeT>::type >(Loc));
|
||||
detail::to_lowerF<
|
||||
typename value_type_of<CollectionT>::type >(Loc));
|
||||
}
|
||||
|
||||
//! Convert to lower case
|
||||
@ -75,12 +71,12 @@ namespace boost {
|
||||
return SequenceT(
|
||||
make_transform_iterator(
|
||||
begin(Input),
|
||||
::boost::algorithm::detail::to_lowerF<
|
||||
typename range_value<SequenceT>::type >(Loc)),
|
||||
detail::to_lowerF<
|
||||
typename value_type_of<SequenceT>::type >(Loc)),
|
||||
make_transform_iterator(
|
||||
end(Input),
|
||||
::boost::algorithm::detail::to_lowerF<
|
||||
typename range_value<SequenceT>::type >(Loc)));
|
||||
detail::to_lowerF<
|
||||
typename value_type_of<SequenceT>::type >(Loc)));
|
||||
}
|
||||
|
||||
//! Convert to lower case
|
||||
@ -88,20 +84,20 @@ namespace boost {
|
||||
Each element of the input sequence is converted to lower
|
||||
case. The input sequence is modified in-place.
|
||||
|
||||
\param Input A range
|
||||
\param Input A collection
|
||||
\param Loc a locale used for conversion
|
||||
*/
|
||||
template<typename WritableRangeT>
|
||||
template<typename MutableCollectionT>
|
||||
inline void to_lower(
|
||||
WritableRangeT& Input,
|
||||
MutableCollectionT& Input,
|
||||
const std::locale& Loc=std::locale())
|
||||
{
|
||||
std::transform(
|
||||
begin(Input),
|
||||
end(Input),
|
||||
begin(Input),
|
||||
::boost::algorithm::detail::to_lowerF<
|
||||
typename range_value<WritableRangeT>::type >(Loc));
|
||||
detail::to_lowerF<
|
||||
typename value_type_of<MutableCollectionT>::type >(Loc));
|
||||
}
|
||||
|
||||
// to_upper -----------------------------------------------//
|
||||
@ -113,7 +109,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 range
|
||||
\param Input An input collection
|
||||
\param Loc A locale used for conversion
|
||||
\return
|
||||
An output iterator pointing just after the last inserted character or
|
||||
@ -121,19 +117,19 @@ namespace boost {
|
||||
|
||||
\note The second variant of this function provides the strong exception-safety guarantee
|
||||
*/
|
||||
template<typename OutputIteratorT, typename RangeT>
|
||||
template<typename OutputIteratorT, typename CollectionT>
|
||||
inline OutputIteratorT
|
||||
to_upper_copy(
|
||||
OutputIteratorT Output,
|
||||
const RangeT& Input,
|
||||
const CollectionT& Input,
|
||||
const std::locale& Loc=std::locale())
|
||||
{
|
||||
return std::transform(
|
||||
begin(Input),
|
||||
end(Input),
|
||||
Output,
|
||||
::boost::algorithm::detail::to_upperF<
|
||||
typename range_value<RangeT>::type >(Loc));
|
||||
detail::to_upperF<
|
||||
typename value_type_of<CollectionT>::type >(Loc));
|
||||
}
|
||||
|
||||
//! Convert to upper case
|
||||
@ -148,12 +144,12 @@ namespace boost {
|
||||
return SequenceT(
|
||||
make_transform_iterator(
|
||||
begin(Input),
|
||||
::boost::algorithm::detail::to_upperF<
|
||||
typename range_value<SequenceT>::type >(Loc)),
|
||||
detail::to_upperF<
|
||||
typename value_type_of<SequenceT>::type >(Loc)),
|
||||
make_transform_iterator(
|
||||
end(Input),
|
||||
::boost::algorithm::detail::to_upperF<
|
||||
typename range_value<SequenceT>::type >(Loc)));
|
||||
detail::to_upperF<
|
||||
typename value_type_of<SequenceT>::type >(Loc)));
|
||||
|
||||
}
|
||||
|
||||
@ -162,20 +158,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 range
|
||||
\param Input An input collection
|
||||
\param Loc a locale used for conversion
|
||||
*/
|
||||
template<typename WritableRangeT>
|
||||
template<typename MutableCollectionT>
|
||||
inline void to_upper(
|
||||
WritableRangeT& Input,
|
||||
MutableCollectionT& Input,
|
||||
const std::locale& Loc=std::locale())
|
||||
{
|
||||
std::transform(
|
||||
begin(Input),
|
||||
end(Input),
|
||||
begin(Input),
|
||||
::boost::algorithm::detail::to_upperF<
|
||||
typename range_value<WritableRangeT>::type >(Loc));
|
||||
detail::to_upperF<
|
||||
typename value_type_of<MutableCollectionT>::type >(Loc));
|
||||
}
|
||||
|
||||
} // namespace algorithm
|
||||
|
@ -12,7 +12,6 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include <locale>
|
||||
#include <boost/range/value_type.hpp>
|
||||
#include <boost/algorithm/string/detail/classification.hpp>
|
||||
#include <boost/algorithm/string/predicate_facade.hpp>
|
||||
|
||||
@ -194,13 +193,13 @@ namespace boost {
|
||||
\param Set A set of characters to be recognized
|
||||
\return An instance of the \c is_any_of predicate
|
||||
*/
|
||||
template<typename RangeT>
|
||||
template<typename ContainerT>
|
||||
inline detail::is_any_ofF<
|
||||
BOOST_STRING_TYPENAME range_value<RangeT>::type>
|
||||
is_any_of( const RangeT& Set )
|
||||
BOOST_STRING_TYPENAME value_type_of<ContainerT>::type>
|
||||
is_any_of( const ContainerT& Set )
|
||||
{
|
||||
return detail::is_any_ofF<
|
||||
BOOST_STRING_TYPENAME range_value<RangeT>::type>(Set);
|
||||
BOOST_STRING_TYPENAME value_type_of<ContainerT>::type>(Set);
|
||||
}
|
||||
|
||||
//! is_from_range predicate
|
||||
|
266
include/boost/algorithm/string/collection_traits.hpp
Normal file
266
include/boost/algorithm/string/collection_traits.hpp
Normal file
@ -0,0 +1,266 @@
|
||||
// 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,28 +54,24 @@ 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
|
||||
{
|
||||
#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
|
||||
return std::toupper(Arg1,m_Loc)==std::toupper(Arg2,m_Loc);
|
||||
}
|
||||
|
||||
private:
|
||||
std::locale m_Loc;
|
||||
};
|
||||
|
||||
} // namespace algorithm
|
||||
} // namespace algorithm
|
||||
|
||||
// pull names to the boost namespace
|
||||
using algorithm::is_equal;
|
||||
|
@ -11,9 +11,8 @@
|
||||
#define BOOST_STRING_CONCEPT_HPP
|
||||
|
||||
#include <boost/concept_check.hpp>
|
||||
#include <boost/range/iterator_range.hpp>
|
||||
#include <boost/range/begin.hpp>
|
||||
#include <boost/range/end.hpp>
|
||||
#include <boost/algorithm/string/iterator_range.hpp>
|
||||
#include <boost/algorithm/string/collection_traits.hpp>
|
||||
|
||||
/*! \file
|
||||
Defines concepts used in string_algo library
|
||||
|
@ -17,7 +17,11 @@
|
||||
# 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,17 +30,13 @@ namespace boost {
|
||||
// Operation
|
||||
CharT operator ()( CharT Ch ) const
|
||||
{
|
||||
#if defined(__BORLANDC__) && (__BORLANDC__ >= 0x560) && (__BORLANDC__ <= 0x564) && !defined(_USE_OLD_RW_STL)
|
||||
return std::tolower( Ch);
|
||||
#else
|
||||
return std::tolower( Ch, m_Loc );
|
||||
#endif
|
||||
return std::tolower( Ch, m_Loc );
|
||||
}
|
||||
private:
|
||||
const std::locale& m_Loc;
|
||||
};
|
||||
|
||||
// a toupper functor
|
||||
// a toupper functor
|
||||
template<typename CharT>
|
||||
struct to_upperF : public std::unary_function<CharT, CharT>
|
||||
{
|
||||
@ -50,11 +46,7 @@ namespace boost {
|
||||
// Operation
|
||||
CharT operator ()( CharT Ch ) const
|
||||
{
|
||||
#if defined(__BORLANDC__) && (__BORLANDC__ >= 0x560) && (__BORLANDC__ <= 0x564) && !defined(_USE_OLD_RW_STL)
|
||||
return std::toupper( Ch);
|
||||
#else
|
||||
return std::toupper( Ch, m_Loc );
|
||||
#endif
|
||||
return std::toupper( Ch, m_Loc );
|
||||
}
|
||||
private:
|
||||
const std::locale& m_Loc;
|
||||
|
@ -15,19 +15,16 @@
|
||||
#include <functional>
|
||||
#include <locale>
|
||||
#include <set>
|
||||
|
||||
#include <boost/range/begin.hpp>
|
||||
#include <boost/range/end.hpp>
|
||||
|
||||
#include <boost/algorithm/string/collection_traits.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>
|
||||
@ -35,7 +32,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) {}
|
||||
|
||||
@ -46,21 +43,13 @@ 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>
|
||||
@ -70,26 +59,26 @@ namespace boost {
|
||||
// Boost.Lambda support
|
||||
template <class Args> struct sig { typedef bool type; };
|
||||
|
||||
// Constructor
|
||||
template<typename RangeT>
|
||||
is_any_ofF( const RangeT& Range ) :
|
||||
m_Set( begin(Range), end(Range) ) {}
|
||||
|
||||
// Constructor
|
||||
template< typename SeqT >
|
||||
is_any_ofF( const SeqT& Seq ) :
|
||||
m_Set( begin(Seq), end(Seq) ) {}
|
||||
|
||||
// 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)
|
||||
*/
|
||||
@ -100,16 +89,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;
|
||||
@ -131,11 +120,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;
|
||||
@ -156,11 +145,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;
|
||||
@ -180,11 +169,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;
|
||||
};
|
||||
|
621
include/boost/algorithm/string/detail/collection_traits.hpp
Normal file
621
include/boost/algorithm/string/detail/collection_traits.hpp
Normal file
@ -0,0 +1,621 @@
|
||||
// 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,9 +11,7 @@
|
||||
#define BOOST_STRING_FIND_FORMAT_DETAIL_HPP
|
||||
|
||||
#include <boost/algorithm/string/config.hpp>
|
||||
#include <boost/range/iterator_range.hpp>
|
||||
#include <boost/range/const_iterator.hpp>
|
||||
#include <boost/range/iterator.hpp>
|
||||
#include <boost/algorithm/string/iterator_range.hpp>
|
||||
#include <boost/algorithm/string/detail/find_format_store.hpp>
|
||||
#include <boost/algorithm/string/detail/replace_storage.hpp>
|
||||
|
||||
@ -62,7 +60,7 @@ namespace boost {
|
||||
{
|
||||
typedef find_format_store<
|
||||
BOOST_STRING_TYPENAME
|
||||
range_const_iterator<InputT>::type,
|
||||
const_iterator_of<InputT>::type,
|
||||
FormatterT,
|
||||
FormatResultT > store_type;
|
||||
|
||||
@ -123,7 +121,7 @@ namespace boost {
|
||||
{
|
||||
typedef find_format_store<
|
||||
BOOST_STRING_TYPENAME
|
||||
range_const_iterator<InputT>::type,
|
||||
const_iterator_of<InputT>::type,
|
||||
FormatterT,
|
||||
FormatResultT > store_type;
|
||||
|
||||
@ -183,7 +181,7 @@ namespace boost {
|
||||
{
|
||||
typedef find_format_store<
|
||||
BOOST_STRING_TYPENAME
|
||||
range_iterator<InputT>::type,
|
||||
iterator_of<InputT>::type,
|
||||
FormatterT,
|
||||
FormatResultT > store_type;
|
||||
|
||||
|
@ -11,9 +11,7 @@
|
||||
#define BOOST_STRING_FIND_FORMAT_ALL_DETAIL_HPP
|
||||
|
||||
#include <boost/algorithm/string/config.hpp>
|
||||
#include <boost/range/iterator_range.hpp>
|
||||
#include <boost/range/const_iterator.hpp>
|
||||
#include <boost/range/value_type.hpp>
|
||||
#include <boost/algorithm/string/iterator_range.hpp>
|
||||
#include <boost/algorithm/string/detail/find_format_store.hpp>
|
||||
#include <boost/algorithm/string/detail/replace_storage.hpp>
|
||||
|
||||
@ -61,7 +59,7 @@ namespace boost {
|
||||
const FormatResultT& FormatResult )
|
||||
{
|
||||
typedef BOOST_STRING_TYPENAME
|
||||
range_const_iterator<InputT>::type input_iterator_type;
|
||||
const_iterator_of<InputT>::type input_iterator_type;
|
||||
|
||||
typedef find_format_store<
|
||||
input_iterator_type,
|
||||
@ -74,7 +72,7 @@ namespace boost {
|
||||
// Initialize last match
|
||||
input_iterator_type LastMatch=begin(Input);
|
||||
|
||||
// Iterate through all matches
|
||||
// Iterate throug all matches
|
||||
while( M )
|
||||
{
|
||||
// Copy the beginning of the sequence
|
||||
@ -128,7 +126,7 @@ namespace boost {
|
||||
const FormatResultT& FormatResult)
|
||||
{
|
||||
typedef BOOST_STRING_TYPENAME
|
||||
range_const_iterator<InputT>::type input_iterator_type;
|
||||
const_iterator_of<InputT>::type input_iterator_type;
|
||||
|
||||
typedef find_format_store<
|
||||
input_iterator_type,
|
||||
@ -144,7 +142,7 @@ namespace boost {
|
||||
// Output temporary
|
||||
InputT Output;
|
||||
|
||||
// Iterate through all matches
|
||||
// Iterate throug all matches
|
||||
while( M )
|
||||
{
|
||||
// Copy the beginning of the sequence
|
||||
@ -198,7 +196,7 @@ namespace boost {
|
||||
FormatResultT FormatResult)
|
||||
{
|
||||
typedef BOOST_STRING_TYPENAME
|
||||
range_iterator<InputT>::type input_iterator_type;
|
||||
iterator_of<InputT>::type input_iterator_type;
|
||||
typedef find_format_store<
|
||||
input_iterator_type,
|
||||
FormatterT,
|
||||
@ -209,7 +207,7 @@ namespace boost {
|
||||
|
||||
// Instantiate replacement storage
|
||||
std::deque<
|
||||
BOOST_STRING_TYPENAME range_value<InputT>::type> Storage;
|
||||
BOOST_STRING_TYPENAME value_type_of<InputT>::type> Storage;
|
||||
|
||||
// Initialize replacement iterators
|
||||
input_iterator_type InsertIt=begin(Input);
|
||||
|
@ -11,7 +11,8 @@
|
||||
#define BOOST_STRING_FIND_FORMAT_STORE_DETAIL_HPP
|
||||
|
||||
#include <boost/algorithm/string/config.hpp>
|
||||
#include <boost/range/iterator_range.hpp>
|
||||
#include <boost/algorithm/string/collection_traits.hpp>
|
||||
#include <boost/algorithm/string/iterator_range.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace algorithm {
|
||||
@ -35,7 +36,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/range/iterator_range.hpp>
|
||||
#include <boost/algorithm/string/iterator_range.hpp>
|
||||
#include <boost/iterator/iterator_facade.hpp>
|
||||
#include <boost/iterator/iterator_categories.hpp>
|
||||
#include <boost/function.hpp>
|
||||
|
@ -13,11 +13,8 @@
|
||||
#include <boost/algorithm/string/config.hpp>
|
||||
#include <boost/algorithm/string/constants.hpp>
|
||||
#include <boost/detail/iterator.hpp>
|
||||
|
||||
#include <boost/range/iterator_range.hpp>
|
||||
#include <boost/range/begin.hpp>
|
||||
#include <boost/range/end.hpp>
|
||||
#include <boost/range/empty.hpp>
|
||||
#include <boost/algorithm/string/collection_traits.hpp>
|
||||
#include <boost/algorithm/string/iterator_range.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace algorithm {
|
||||
@ -28,7 +25,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>
|
||||
@ -38,9 +35,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 ) :
|
||||
@ -49,8 +46,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;
|
||||
@ -61,8 +58,8 @@ namespace boost {
|
||||
OuterIt!=End;
|
||||
++OuterIt)
|
||||
{
|
||||
// Sanity check
|
||||
if( boost::empty(m_Search) )
|
||||
// Sanity check
|
||||
if( empty(m_Search) )
|
||||
return result_type( End, End );
|
||||
|
||||
input_iterator_type InnerIt=OuterIt;
|
||||
@ -71,7 +68,7 @@ namespace boost {
|
||||
InnerIt!=End && SubstrIt!=m_Search.end();
|
||||
++InnerIt,++SubstrIt)
|
||||
{
|
||||
if( !( m_Comp(*InnerIt,*SubstrIt) ) )
|
||||
if( !( m_Comp(*InnerIt,*SubstrIt) ) )
|
||||
break;
|
||||
}
|
||||
|
||||
@ -92,7 +89,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>
|
||||
@ -105,9 +102,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 ) :
|
||||
@ -116,34 +113,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( boost::empty(m_Search) )
|
||||
if( 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 );
|
||||
@ -161,9 +158,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;
|
||||
@ -181,7 +178,7 @@ namespace boost {
|
||||
InnerIt!=End && SubstrIt!=m_Search.end();
|
||||
++InnerIt,++SubstrIt)
|
||||
{
|
||||
if( !( m_Comp(*InnerIt,*SubstrIt) ) )
|
||||
if( !( m_Comp(*InnerIt,*SubstrIt) ) )
|
||||
break;
|
||||
}
|
||||
|
||||
@ -197,12 +194,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>
|
||||
@ -215,50 +212,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( boost::empty(m_Search) )
|
||||
// Sanity check
|
||||
if( 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;
|
||||
}
|
||||
}
|
||||
@ -276,8 +273,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
|
||||
@ -288,8 +285,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::
|
||||
@ -302,7 +299,7 @@ namespace boost {
|
||||
// Find operation implementation
|
||||
template< typename ForwardIteratorT >
|
||||
iterator_range<ForwardIteratorT>
|
||||
findit(
|
||||
findit(
|
||||
ForwardIteratorT Begin,
|
||||
ForwardIteratorT End,
|
||||
std::forward_iterator_tag ) const
|
||||
@ -312,15 +309,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
|
||||
@ -342,8 +339,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
|
||||
@ -354,8 +351,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::
|
||||
@ -368,7 +365,7 @@ namespace boost {
|
||||
// Find operation implementation
|
||||
template< typename ForwardIteratorT >
|
||||
iterator_range<ForwardIteratorT>
|
||||
findit(
|
||||
findit(
|
||||
ForwardIteratorT Begin,
|
||||
ForwardIteratorT End,
|
||||
std::forward_iterator_tag ) const
|
||||
@ -376,10 +373,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 ) {};
|
||||
|
||||
@ -391,7 +388,7 @@ namespace boost {
|
||||
|
||||
template< typename ForwardIteratorT >
|
||||
iterator_range<ForwardIteratorT>
|
||||
findit(
|
||||
findit(
|
||||
ForwardIteratorT Begin,
|
||||
ForwardIteratorT End,
|
||||
std::bidirectional_iterator_tag ) const
|
||||
@ -401,15 +398,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
|
||||
@ -417,7 +414,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 );
|
||||
@ -437,29 +434,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 );
|
||||
@ -471,11 +468,11 @@ namespace boost {
|
||||
if( m_eCompress==token_compress_on )
|
||||
{
|
||||
// Find first non-matching character
|
||||
while( It2!=End && m_Pred(*It2) ) ++It2;
|
||||
while( m_Pred(*It2) && It2!=End ) ++It2;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Advance by one possition
|
||||
// Advance by one possition
|
||||
++It2;
|
||||
}
|
||||
|
||||
@ -502,27 +499,21 @@ 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,10 +12,8 @@
|
||||
|
||||
#include <boost/algorithm/string/config.hpp>
|
||||
#include <boost/regex.hpp>
|
||||
|
||||
#include <boost/range/iterator_range.hpp>
|
||||
#include <boost/range/begin.hpp>
|
||||
#include <boost/range/end.hpp>
|
||||
#include <boost/algorithm/string/iterator_range.hpp>
|
||||
#include <boost/algorithm/string/collection_traits.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace algorithm {
|
||||
@ -31,6 +29,7 @@ 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,12 +10,8 @@
|
||||
#ifndef BOOST_STRING_FORMATTER_DETAIL_HPP
|
||||
#define BOOST_STRING_FORMATTER_DETAIL_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/collection_traits.hpp>
|
||||
#include <boost/algorithm/string/iterator_range.hpp>
|
||||
#include <boost/algorithm/string/detail/util.hpp>
|
||||
|
||||
// generic replace functors -----------------------------------------------//
|
||||
@ -27,30 +23,22 @@ namespace boost {
|
||||
// const format functor ----------------------------------------------------//
|
||||
|
||||
// constant format functor
|
||||
template<typename RangeT>
|
||||
template<typename CollectionT>
|
||||
struct const_formatF
|
||||
{
|
||||
private:
|
||||
typedef BOOST_STRING_TYPENAME
|
||||
range_const_iterator<RangeT>::type format_iterator;
|
||||
const_iterator_of<CollectionT>::type format_iterator;
|
||||
typedef iterator_range<format_iterator> result_type;
|
||||
|
||||
public:
|
||||
// Construction
|
||||
const_formatF(const RangeT& Format) :
|
||||
const_formatF(const CollectionT& Format) :
|
||||
m_Format(begin(Format), end(Format)) {}
|
||||
|
||||
// Operation
|
||||
#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
|
||||
template<typename Collection2T>
|
||||
const result_type& operator()(const Collection2T&) const
|
||||
{
|
||||
return m_Format;
|
||||
}
|
||||
@ -62,14 +50,14 @@ namespace boost {
|
||||
// identity format functor ----------------------------------------------------//
|
||||
|
||||
// identity format functor
|
||||
template<typename RangeT>
|
||||
template<typename CollectionT>
|
||||
struct identity_formatF
|
||||
{
|
||||
// Operation
|
||||
template< typename Range2T >
|
||||
const RangeT& operator()(const Range2T& Replace) const
|
||||
template< typename Collection2T >
|
||||
const CollectionT& operator()(const Collection2T& Replace) const
|
||||
{
|
||||
return RangeT(begin(Replace), end(Replace));
|
||||
return CollectionT(begin(Replace), end(Replace));
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -13,7 +13,9 @@
|
||||
#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,9 +13,7 @@
|
||||
#include <boost/algorithm/string/config.hpp>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/mpl/logical.hpp>
|
||||
#include <boost/range/begin.hpp>
|
||||
#include <boost/range/end.hpp>
|
||||
|
||||
#include <boost/algorithm/string/collection_traits.hpp>
|
||||
#include <boost/algorithm/string/sequence_traits.hpp>
|
||||
|
||||
namespace boost {
|
||||
|
@ -12,7 +12,6 @@
|
||||
|
||||
#include <boost/algorithm/string/config.hpp>
|
||||
#include <functional>
|
||||
#include <boost/range/iterator_range.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace algorithm {
|
||||
@ -23,7 +22,7 @@ namespace boost {
|
||||
// empty_container
|
||||
/*
|
||||
This class represents always empty container,
|
||||
containing elements of type CharT.
|
||||
containing elemets of type CharT.
|
||||
|
||||
It is supposed to be used in a const version only
|
||||
*/
|
||||
@ -93,7 +92,7 @@ namespace boost {
|
||||
{
|
||||
SeqT operator()( const iterator_range<IteratorT>& Range ) const
|
||||
{
|
||||
return copy_range<SeqT>(Range);
|
||||
return copy_iterator_range<SeqT>(Range);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -11,13 +11,8 @@
|
||||
#define BOOST_STRING_ERASE_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/collection_traits.hpp>
|
||||
#include <boost/algorithm/string/iterator_range.hpp>
|
||||
#include <boost/algorithm/string/find_format.hpp>
|
||||
#include <boost/algorithm/string/finder.hpp>
|
||||
#include <boost/algorithm/string/formatter.hpp>
|
||||
@ -45,13 +40,13 @@ namespace boost {
|
||||
|
||||
\note The second variant of this function provides the strong exception-safety guarantee
|
||||
*/
|
||||
template<typename OutputIteratorT, typename RangeT>
|
||||
template<typename OutputIteratorT, typename CollectionT>
|
||||
inline OutputIteratorT erase_range_copy(
|
||||
OutputIteratorT Output,
|
||||
const RangeT& Input,
|
||||
const CollectionT& Input,
|
||||
const iterator_range<
|
||||
BOOST_STRING_TYPENAME
|
||||
range_const_iterator<RangeT>::type>& SearchRange )
|
||||
const_iterator_of<CollectionT>::type>& SearchRange )
|
||||
{
|
||||
return find_format_copy(
|
||||
Output,
|
||||
@ -69,7 +64,7 @@ namespace boost {
|
||||
const SequenceT& Input,
|
||||
const iterator_range<
|
||||
BOOST_STRING_TYPENAME
|
||||
range_const_iterator<SequenceT>::type>& SearchRange )
|
||||
const_iterator_of<SequenceT>::type>& SearchRange )
|
||||
{
|
||||
return find_format_copy(
|
||||
Input,
|
||||
@ -90,7 +85,7 @@ namespace boost {
|
||||
SequenceT& Input,
|
||||
const iterator_range<
|
||||
BOOST_STRING_TYPENAME
|
||||
range_iterator<SequenceT>::type>& SearchRange )
|
||||
iterator_of<SequenceT>::type>& SearchRange )
|
||||
{
|
||||
find_format(
|
||||
Input,
|
||||
@ -102,7 +97,7 @@ namespace boost {
|
||||
|
||||
//! Erase first algorithm
|
||||
/*!
|
||||
Remove the first occurrence of the substring from the input.
|
||||
Remove the first occurence 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.
|
||||
|
||||
@ -116,12 +111,12 @@ namespace boost {
|
||||
*/
|
||||
template<
|
||||
typename OutputIteratorT,
|
||||
typename Range1T,
|
||||
typename Range2T>
|
||||
typename Collection1T,
|
||||
typename Collection2T>
|
||||
inline OutputIteratorT erase_first_copy(
|
||||
OutputIteratorT Output,
|
||||
const Range1T& Input,
|
||||
const Range2T& Search )
|
||||
const Collection1T& Input,
|
||||
const Collection2T& Search )
|
||||
{
|
||||
return find_format_copy(
|
||||
Output,
|
||||
@ -134,10 +129,10 @@ namespace boost {
|
||||
/*!
|
||||
\overload
|
||||
*/
|
||||
template<typename SequenceT, typename RangeT>
|
||||
template<typename SequenceT, typename CollectionT>
|
||||
inline SequenceT erase_first_copy(
|
||||
const SequenceT& Input,
|
||||
const RangeT& Search )
|
||||
const CollectionT& Search )
|
||||
{
|
||||
return find_format_copy(
|
||||
Input,
|
||||
@ -147,16 +142,16 @@ namespace boost {
|
||||
|
||||
//! Erase first algorithm
|
||||
/*!
|
||||
Remove the first occurrence of the substring from the input.
|
||||
Remove the first occurence 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 RangeT>
|
||||
template<typename SequenceT, typename CollectionT>
|
||||
inline void erase_first(
|
||||
SequenceT& Input,
|
||||
const RangeT& Search )
|
||||
const CollectionT& Search )
|
||||
{
|
||||
find_format(
|
||||
Input,
|
||||
@ -168,7 +163,7 @@ namespace boost {
|
||||
|
||||
//! Erase first algorithm ( case insensitive )
|
||||
/*!
|
||||
Remove the first occurrence of the substring from the input.
|
||||
Remove the first occurence 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.
|
||||
@ -184,12 +179,12 @@ namespace boost {
|
||||
*/
|
||||
template<
|
||||
typename OutputIteratorT,
|
||||
typename Range1T,
|
||||
typename Range2T>
|
||||
typename Collection1T,
|
||||
typename Collection2T>
|
||||
inline OutputIteratorT ierase_first_copy(
|
||||
OutputIteratorT Output,
|
||||
const Range1T& Input,
|
||||
const Range2T& Search,
|
||||
const Collection1T& Input,
|
||||
const Collection2T& Search,
|
||||
const std::locale& Loc=std::locale() )
|
||||
{
|
||||
return find_format_copy(
|
||||
@ -203,10 +198,10 @@ namespace boost {
|
||||
/*!
|
||||
\overload
|
||||
*/
|
||||
template<typename SequenceT, typename RangeT>
|
||||
template<typename SequenceT, typename CollectionT>
|
||||
inline SequenceT ierase_first_copy(
|
||||
const SequenceT& Input,
|
||||
const RangeT& Search,
|
||||
const CollectionT& Search,
|
||||
const std::locale& Loc=std::locale() )
|
||||
{
|
||||
return find_format_copy(
|
||||
@ -217,17 +212,17 @@ namespace boost {
|
||||
|
||||
//! Erase first algorithm ( case insensitive )
|
||||
/*!
|
||||
Remove the first occurrence of the substring from the input.
|
||||
Remove the first occurence 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 RangeT>
|
||||
template<typename SequenceT, typename CollectionT>
|
||||
inline void ierase_first(
|
||||
SequenceT& Input,
|
||||
const RangeT& Search,
|
||||
const CollectionT& Search,
|
||||
const std::locale& Loc=std::locale() )
|
||||
{
|
||||
find_format(
|
||||
@ -240,7 +235,7 @@ namespace boost {
|
||||
|
||||
//! Erase last algorithm
|
||||
/*!
|
||||
Remove the last occurrence of the substring from the input.
|
||||
Remove the last occurence 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.
|
||||
|
||||
@ -254,12 +249,12 @@ namespace boost {
|
||||
*/
|
||||
template<
|
||||
typename OutputIteratorT,
|
||||
typename Range1T,
|
||||
typename Range2T>
|
||||
typename Collection1T,
|
||||
typename Collection2T>
|
||||
inline OutputIteratorT erase_last_copy(
|
||||
OutputIteratorT Output,
|
||||
const Range1T& Input,
|
||||
const Range2T& Search )
|
||||
const Collection1T& Input,
|
||||
const Collection2T& Search )
|
||||
{
|
||||
return find_format_copy(
|
||||
Output,
|
||||
@ -272,10 +267,10 @@ namespace boost {
|
||||
/*!
|
||||
\overload
|
||||
*/
|
||||
template<typename SequenceT, typename RangeT>
|
||||
template<typename SequenceT, typename CollectionT>
|
||||
inline SequenceT erase_last_copy(
|
||||
const SequenceT& Input,
|
||||
const RangeT& Search )
|
||||
const CollectionT& Search )
|
||||
{
|
||||
return find_format_copy(
|
||||
Input,
|
||||
@ -285,16 +280,16 @@ namespace boost {
|
||||
|
||||
//! Erase last algorithm
|
||||
/*!
|
||||
Remove the last occurrence of the substring from the input.
|
||||
Remove the last occurence 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 RangeT>
|
||||
template<typename SequenceT, typename CollectionT>
|
||||
inline void erase_last(
|
||||
SequenceT& Input,
|
||||
const RangeT& Search )
|
||||
const CollectionT& Search )
|
||||
{
|
||||
find_format(
|
||||
Input,
|
||||
@ -306,7 +301,7 @@ namespace boost {
|
||||
|
||||
//! Erase last algorithm ( case insensitive )
|
||||
/*!
|
||||
Remove the last occurrence of the substring from the input.
|
||||
Remove the last occurence 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.
|
||||
@ -322,12 +317,12 @@ namespace boost {
|
||||
*/
|
||||
template<
|
||||
typename OutputIteratorT,
|
||||
typename Range1T,
|
||||
typename Range2T>
|
||||
typename Collection1T,
|
||||
typename Collection2T>
|
||||
inline OutputIteratorT ierase_last_copy(
|
||||
OutputIteratorT Output,
|
||||
const Range1T& Input,
|
||||
const Range2T& Search,
|
||||
const Collection1T& Input,
|
||||
const Collection2T& Search,
|
||||
const std::locale& Loc=std::locale() )
|
||||
{
|
||||
return find_format_copy(
|
||||
@ -341,10 +336,10 @@ namespace boost {
|
||||
/*!
|
||||
\overload
|
||||
*/
|
||||
template<typename SequenceT, typename RangeT>
|
||||
template<typename SequenceT, typename CollectionT>
|
||||
inline SequenceT ierase_last_copy(
|
||||
const SequenceT& Input,
|
||||
const RangeT& Search,
|
||||
const CollectionT& Search,
|
||||
const std::locale& Loc=std::locale() )
|
||||
{
|
||||
return find_format_copy(
|
||||
@ -355,17 +350,17 @@ namespace boost {
|
||||
|
||||
//! Erase last algorithm ( case insensitive )
|
||||
/*!
|
||||
Remove the last occurrence of the substring from the input.
|
||||
Remove the last occurence 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 RangeT>
|
||||
template<typename SequenceT, typename CollectionT>
|
||||
inline void ierase_last(
|
||||
SequenceT& Input,
|
||||
const RangeT& Search,
|
||||
const CollectionT& Search,
|
||||
const std::locale& Loc=std::locale() )
|
||||
{
|
||||
find_format(
|
||||
@ -378,7 +373,7 @@ namespace boost {
|
||||
|
||||
//! Erase nth algorithm
|
||||
/*!
|
||||
Remove the Nth occurrence of the substring in the input.
|
||||
Remove the Nth occurence 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.
|
||||
|
||||
@ -394,12 +389,12 @@ namespace boost {
|
||||
*/
|
||||
template<
|
||||
typename OutputIteratorT,
|
||||
typename Range1T,
|
||||
typename Range2T>
|
||||
typename Collection1T,
|
||||
typename Collection2T>
|
||||
inline OutputIteratorT erase_nth_copy(
|
||||
OutputIteratorT Output,
|
||||
const Range1T& Input,
|
||||
const Range2T& Search,
|
||||
const Collection1T& Input,
|
||||
const Collection2T& Search,
|
||||
unsigned int Nth )
|
||||
{
|
||||
return find_format_copy(
|
||||
@ -413,10 +408,10 @@ namespace boost {
|
||||
/*!
|
||||
\overload
|
||||
*/
|
||||
template<typename SequenceT, typename RangeT>
|
||||
template<typename SequenceT, typename CollectionT>
|
||||
inline SequenceT erase_nth_copy(
|
||||
const SequenceT& Input,
|
||||
const RangeT& Search,
|
||||
const CollectionT& Search,
|
||||
unsigned int Nth )
|
||||
{
|
||||
return find_format_copy(
|
||||
@ -427,17 +422,17 @@ namespace boost {
|
||||
|
||||
//! Erase nth algorithm
|
||||
/*!
|
||||
Remove the Nth occurrence of the substring in the input.
|
||||
Remove the Nth occurence 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 RangeT>
|
||||
template<typename SequenceT, typename CollectionT>
|
||||
inline void erase_nth(
|
||||
SequenceT& Input,
|
||||
const RangeT& Search,
|
||||
const CollectionT& Search,
|
||||
unsigned int Nth )
|
||||
{
|
||||
find_format(
|
||||
@ -450,7 +445,7 @@ namespace boost {
|
||||
|
||||
//! Erase nth algorithm ( case insensitive )
|
||||
/*!
|
||||
Remove the Nth occurrence of the substring in the input.
|
||||
Remove the Nth occurence 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.
|
||||
@ -467,12 +462,12 @@ namespace boost {
|
||||
*/
|
||||
template<
|
||||
typename OutputIteratorT,
|
||||
typename Range1T,
|
||||
typename Range2T>
|
||||
typename Collection1T,
|
||||
typename Collection2T>
|
||||
inline OutputIteratorT ierase_nth_copy(
|
||||
OutputIteratorT Output,
|
||||
const Range1T& Input,
|
||||
const Range2T& Search,
|
||||
const Collection1T& Input,
|
||||
const Collection2T& Search,
|
||||
unsigned int Nth,
|
||||
const std::locale& Loc=std::locale() )
|
||||
{
|
||||
@ -487,10 +482,10 @@ namespace boost {
|
||||
/*!
|
||||
\overload
|
||||
*/
|
||||
template<typename SequenceT, typename RangeT>
|
||||
template<typename SequenceT, typename CollectionT>
|
||||
inline SequenceT ierase_nth_copy(
|
||||
const SequenceT& Input,
|
||||
const RangeT& Search,
|
||||
const CollectionT& Search,
|
||||
unsigned int Nth,
|
||||
const std::locale& Loc=std::locale() )
|
||||
{
|
||||
@ -502,7 +497,7 @@ namespace boost {
|
||||
|
||||
//! Erase nth algorithm
|
||||
/*!
|
||||
Remove the Nth occurrence of the substring in the input.
|
||||
Remove the Nth occurence of the substring in the input.
|
||||
The input sequence is modified in-place. Searching is case insensitive.
|
||||
|
||||
\param Input An input string
|
||||
@ -510,10 +505,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 RangeT>
|
||||
template<typename SequenceT, typename CollectionT>
|
||||
inline void ierase_nth(
|
||||
SequenceT& Input,
|
||||
const RangeT& Search,
|
||||
const CollectionT& Search,
|
||||
unsigned int Nth,
|
||||
const std::locale& Loc=std::locale() )
|
||||
{
|
||||
@ -543,12 +538,12 @@ namespace boost {
|
||||
*/
|
||||
template<
|
||||
typename OutputIteratorT,
|
||||
typename Range1T,
|
||||
typename Range2T>
|
||||
typename Collection1T,
|
||||
typename Collection2T>
|
||||
inline OutputIteratorT erase_all_copy(
|
||||
OutputIteratorT Output,
|
||||
const Range1T& Input,
|
||||
const Range2T& Search )
|
||||
const Collection1T& Input,
|
||||
const Collection2T& Search )
|
||||
{
|
||||
return find_format_all_copy(
|
||||
Output,
|
||||
@ -561,10 +556,10 @@ namespace boost {
|
||||
/*!
|
||||
\overload
|
||||
*/
|
||||
template<typename SequenceT, typename RangeT>
|
||||
template<typename SequenceT, typename CollectionT>
|
||||
inline SequenceT erase_all_copy(
|
||||
const SequenceT& Input,
|
||||
const RangeT& Search )
|
||||
const CollectionT& Search )
|
||||
{
|
||||
return find_format_all_copy(
|
||||
Input,
|
||||
@ -580,10 +575,10 @@ namespace boost {
|
||||
\param Input An input string
|
||||
\param Search A substring to be searched for.
|
||||
*/
|
||||
template<typename SequenceT, typename RangeT>
|
||||
template<typename SequenceT, typename CollectionT>
|
||||
inline void erase_all(
|
||||
SequenceT& Input,
|
||||
const RangeT& Search )
|
||||
const CollectionT& Search )
|
||||
{
|
||||
find_format_all(
|
||||
Input,
|
||||
@ -611,12 +606,12 @@ namespace boost {
|
||||
*/
|
||||
template<
|
||||
typename OutputIteratorT,
|
||||
typename Range1T,
|
||||
typename Range2T>
|
||||
typename Collection1T,
|
||||
typename Collection2T>
|
||||
inline OutputIteratorT ierase_all_copy(
|
||||
OutputIteratorT Output,
|
||||
const Range1T& Input,
|
||||
const Range2T& Search,
|
||||
const Collection1T& Input,
|
||||
const Collection2T& Search,
|
||||
const std::locale& Loc=std::locale() )
|
||||
{
|
||||
return find_format_all_copy(
|
||||
@ -630,10 +625,10 @@ namespace boost {
|
||||
/*!
|
||||
\overload
|
||||
*/
|
||||
template<typename SequenceT, typename RangeT>
|
||||
template<typename SequenceT, typename CollectionT>
|
||||
inline SequenceT ierase_all_copy(
|
||||
const SequenceT& Input,
|
||||
const RangeT& Search,
|
||||
const CollectionT& Search,
|
||||
const std::locale& Loc=std::locale() )
|
||||
{
|
||||
return find_format_all_copy(
|
||||
@ -651,10 +646,10 @@ namespace boost {
|
||||
\param Search A substring to be searched for.
|
||||
\param Loc A locale used for case insensitive comparison
|
||||
*/
|
||||
template<typename SequenceT, typename RangeT>
|
||||
template<typename SequenceT, typename CollectionT>
|
||||
inline void ierase_all(
|
||||
SequenceT& Input,
|
||||
const RangeT& Search,
|
||||
const CollectionT& Search,
|
||||
const std::locale& Loc=std::locale() )
|
||||
{
|
||||
find_format_all(
|
||||
@ -667,7 +662,7 @@ namespace boost {
|
||||
|
||||
//! Erase head algorithm
|
||||
/*!
|
||||
Remove the head from the input. The head is a prefix of a sequence of given size.
|
||||
Remove the head from the input. The head is a prefix of a seqence 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.
|
||||
@ -683,10 +678,10 @@ namespace boost {
|
||||
*/
|
||||
template<
|
||||
typename OutputIteratorT,
|
||||
typename RangeT>
|
||||
typename CollectionT>
|
||||
inline OutputIteratorT erase_head_copy(
|
||||
OutputIteratorT Output,
|
||||
const RangeT& Input,
|
||||
const CollectionT& Input,
|
||||
unsigned int N )
|
||||
{
|
||||
return find_format_copy(
|
||||
@ -713,7 +708,7 @@ namespace boost {
|
||||
|
||||
//! Erase head algorithm
|
||||
/*!
|
||||
Remove the head from the input. The head is a prefix of a sequence of given size.
|
||||
Remove the head from the input. The head is a prefix of a seqence 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.
|
||||
|
||||
@ -735,7 +730,7 @@ namespace boost {
|
||||
|
||||
//! Erase tail algorithm
|
||||
/*!
|
||||
Remove the tail from the input. The tail is a suffix of a sequence of given size.
|
||||
Remove the tail from the input. The tail is a suffix of a seqence 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
|
||||
@ -751,10 +746,10 @@ namespace boost {
|
||||
*/
|
||||
template<
|
||||
typename OutputIteratorT,
|
||||
typename RangeT>
|
||||
typename CollectionT>
|
||||
inline OutputIteratorT erase_tail_copy(
|
||||
OutputIteratorT Output,
|
||||
const RangeT& Input,
|
||||
const CollectionT& Input,
|
||||
unsigned int N )
|
||||
{
|
||||
return find_format_copy(
|
||||
@ -781,7 +776,7 @@ namespace boost {
|
||||
|
||||
//! Erase tail algorithm
|
||||
/*!
|
||||
Remove the tail from the input. The tail is a suffix of a sequence of given size.
|
||||
Remove the tail from the input. The tail is a suffix of a seqence 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,14 +11,8 @@
|
||||
#define BOOST_STRING_FIND_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/range/result_iterator.hpp>
|
||||
|
||||
#include <boost/algorithm/string/collection_traits.hpp>
|
||||
#include <boost/algorithm/string/iterator_range.hpp>
|
||||
#include <boost/algorithm/string/finder.hpp>
|
||||
#include <boost/algorithm/string/compare.hpp>
|
||||
#include <boost/algorithm/string/constants.hpp>
|
||||
@ -42,15 +36,15 @@ namespace boost {
|
||||
\param Finder Finder object used for searching.
|
||||
\return
|
||||
An \c iterator_range delimiting the match.
|
||||
Returned iterator is either \c RangeT::iterator or
|
||||
\c RangeT::const_iterator, depending on the constness of
|
||||
Returned iterator is either \c CollectionT::iterator or
|
||||
\c CollectionT::const_iterator, depending on the constness of
|
||||
the input parameter.
|
||||
*/
|
||||
template<typename RangeT, typename FinderT>
|
||||
template<typename CollectionT, typename FinderT>
|
||||
inline iterator_range<
|
||||
BOOST_STRING_TYPENAME range_result_iterator<RangeT>::type>
|
||||
BOOST_STRING_TYPENAME result_iterator_of<CollectionT>::type>
|
||||
find(
|
||||
RangeT& Input,
|
||||
CollectionT& Input,
|
||||
FinderT Finder)
|
||||
{
|
||||
return Finder(begin(Input),end(Input));
|
||||
@ -66,18 +60,18 @@ namespace boost {
|
||||
\param Search A substring to be searched for.
|
||||
\return
|
||||
An \c iterator_range delimiting the match.
|
||||
Returned iterator is either \c RangeT::iterator or
|
||||
\c RangeT::const_iterator, depending on the constness of
|
||||
Returned iterator is either \c CollectionT::iterator or
|
||||
\c CollectionT::const_iterator, depending on the constness of
|
||||
the input parameter.
|
||||
|
||||
\note This function provides the strong exception-safety guarantee
|
||||
*/
|
||||
template<typename Range1T, typename Range2T>
|
||||
template<typename Collection1T, typename Collection2T>
|
||||
inline iterator_range<
|
||||
BOOST_STRING_TYPENAME range_result_iterator<Range1T>::type>
|
||||
BOOST_STRING_TYPENAME result_iterator_of<Collection1T>::type>
|
||||
find_first(
|
||||
Range1T& Input,
|
||||
const Range2T& Search)
|
||||
Collection1T& Input,
|
||||
const Collection2T& Search)
|
||||
{
|
||||
return first_finder(Search)(
|
||||
begin(Input),end(Input));
|
||||
@ -93,18 +87,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 Range1T::iterator or
|
||||
\c Range1T::const_iterator, depending on the constness of
|
||||
Returned iterator is either \c Collection1T::iterator or
|
||||
\c Collection1T::const_iterator, depending on the constness of
|
||||
the input parameter.
|
||||
|
||||
\note This function provides the strong exception-safety guarantee
|
||||
*/
|
||||
template<typename Range1T, typename Range2T>
|
||||
template<typename Collection1T, typename Collection2T>
|
||||
inline iterator_range<
|
||||
BOOST_STRING_TYPENAME range_result_iterator<Range1T>::type>
|
||||
BOOST_STRING_TYPENAME result_iterator_of<Collection1T>::type>
|
||||
ifind_first(
|
||||
Range1T& Input,
|
||||
const Range2T& Search,
|
||||
Collection1T& Input,
|
||||
const Collection2T& Search,
|
||||
const std::locale& Loc=std::locale())
|
||||
{
|
||||
return first_finder(Search,is_iequal(Loc))(
|
||||
@ -121,18 +115,18 @@ namespace boost {
|
||||
\param Search A substring to be searched for.
|
||||
\return
|
||||
An \c iterator_range delimiting the match.
|
||||
Returned iterator is either \c Range1T::iterator or
|
||||
\c Range1T::const_iterator, depending on the constness of
|
||||
Returned iterator is either \c Collection1T::iterator or
|
||||
\c Collection1T::const_iterator, depending on the constness of
|
||||
the input parameter.
|
||||
|
||||
\note This function provides the strong exception-safety guarantee
|
||||
*/
|
||||
template<typename Range1T, typename Range2T>
|
||||
template<typename Collection1T, typename Collection2T>
|
||||
inline iterator_range<
|
||||
BOOST_STRING_TYPENAME range_result_iterator<Range1T>::type>
|
||||
BOOST_STRING_TYPENAME result_iterator_of<Collection1T>::type>
|
||||
find_last(
|
||||
Range1T& Input,
|
||||
const Range2T& Search)
|
||||
Collection1T& Input,
|
||||
const Collection2T& Search)
|
||||
{
|
||||
return last_finder(Search)(
|
||||
begin(Input),end(Input));
|
||||
@ -148,18 +142,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 Range1T::iterator or
|
||||
\c Range1T::const_iterator, depending on the constness of
|
||||
Returned iterator is either \c Collection1T::iterator or
|
||||
\c Collection1T::const_iterator, depending on the constness of
|
||||
the input parameter.
|
||||
|
||||
\note This function provides the strong exception-safety guarantee
|
||||
*/
|
||||
template<typename Range1T, typename Range2T>
|
||||
template<typename Collection1T, typename Collection2T>
|
||||
inline iterator_range<
|
||||
BOOST_STRING_TYPENAME range_result_iterator<Range1T>::type>
|
||||
BOOST_STRING_TYPENAME result_iterator_of<Collection1T>::type>
|
||||
ifind_last(
|
||||
Range1T& Input,
|
||||
const Range2T& Search,
|
||||
Collection1T& Input,
|
||||
const Collection2T& Search,
|
||||
const std::locale& Loc=std::locale())
|
||||
{
|
||||
return last_finder(Search, is_iequal(Loc))(
|
||||
@ -178,16 +172,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 Range1T::iterator or
|
||||
\c Range1T::const_iterator, depending on the constness of
|
||||
Returned iterator is either \c Collection1T::iterator or
|
||||
\c Collection1T::const_iterator, depending on the constness of
|
||||
the input parameter.
|
||||
*/
|
||||
template<typename Range1T, typename Range2T>
|
||||
template<typename Collection1T, typename Collection2T>
|
||||
inline iterator_range<
|
||||
BOOST_STRING_TYPENAME range_result_iterator<Range1T>::type>
|
||||
BOOST_STRING_TYPENAME result_iterator_of<Collection1T>::type>
|
||||
find_nth(
|
||||
Range1T& Input,
|
||||
const Range2T& Search,
|
||||
Collection1T& Input,
|
||||
const Collection2T& Search,
|
||||
unsigned int Nth)
|
||||
{
|
||||
return nth_finder(Search,Nth)(
|
||||
@ -205,19 +199,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 Range1T::iterator or
|
||||
\c Range1T::const_iterator, depending on the constness of
|
||||
Returned iterator is either \c Collection1T::iterator or
|
||||
\c Collection1T::const_iterator, depending on the constness of
|
||||
the input parameter.
|
||||
|
||||
|
||||
\note This function provides the strong exception-safety guarantee
|
||||
*/
|
||||
template<typename Range1T, typename Range2T>
|
||||
template<typename Collection1T, typename Collection2T>
|
||||
inline iterator_range<
|
||||
BOOST_STRING_TYPENAME range_result_iterator<Range1T>::type>
|
||||
BOOST_STRING_TYPENAME result_iterator_of<Collection1T>::type>
|
||||
ifind_nth(
|
||||
Range1T& Input,
|
||||
const Range2T& Search,
|
||||
Collection1T& Input,
|
||||
const Collection2T& Search,
|
||||
unsigned int Nth,
|
||||
const std::locale& Loc=std::locale())
|
||||
{
|
||||
@ -237,17 +231,17 @@ namespace boost {
|
||||
\param N Length of the head
|
||||
\return
|
||||
An \c iterator_range delimiting the match.
|
||||
Returned iterator is either \c Range1T::iterator or
|
||||
\c Range1T::const_iterator, depending on the constness of
|
||||
Returned iterator is either \c Collection1T::iterator or
|
||||
\c Collection1T::const_iterator, depending on the constness of
|
||||
the input parameter.
|
||||
|
||||
\note This function provides the strong exception-safety guarantee
|
||||
*/
|
||||
template<typename RangeT>
|
||||
template<typename CollectionT>
|
||||
inline iterator_range<
|
||||
BOOST_STRING_TYPENAME range_result_iterator<RangeT>::type>
|
||||
BOOST_STRING_TYPENAME result_iterator_of<CollectionT>::type>
|
||||
find_head(
|
||||
RangeT& Input,
|
||||
CollectionT& Input,
|
||||
unsigned int N)
|
||||
{
|
||||
return head_finder(N)(
|
||||
@ -266,18 +260,18 @@ namespace boost {
|
||||
\param N Length of the tail
|
||||
\return
|
||||
An \c iterator_range delimiting the match.
|
||||
Returned iterator is either \c RangeT::iterator or
|
||||
\c RangeT::const_iterator, depending on the constness of
|
||||
Returned iterator is either \c CollectionT::iterator or
|
||||
\c CollectionT::const_iterator, depending on the constness of
|
||||
the input parameter.
|
||||
|
||||
|
||||
\note This function provides the strong exception-safety guarantee
|
||||
*/
|
||||
template<typename RangeT>
|
||||
template<typename CollectionT>
|
||||
inline iterator_range<
|
||||
BOOST_STRING_TYPENAME range_result_iterator<RangeT>::type>
|
||||
BOOST_STRING_TYPENAME result_iterator_of<CollectionT>::type>
|
||||
find_tail(
|
||||
RangeT& Input,
|
||||
CollectionT& Input,
|
||||
unsigned int N)
|
||||
{
|
||||
return tail_finder(N)(
|
||||
@ -297,17 +291,17 @@ namespace boost {
|
||||
\param eCompress Enable/Disable compressing of adjacent tokens
|
||||
\return
|
||||
An \c iterator_range delimiting the match.
|
||||
Returned iterator is either \c RangeT::iterator or
|
||||
\c RangeT::const_iterator, depending on the constness of
|
||||
Returned iterator is either \c CollectionT::iterator or
|
||||
\c CollectionT::const_iterator, depending on the constness of
|
||||
the input parameter.
|
||||
|
||||
\note This function provides the strong exception-safety guarantee
|
||||
*/
|
||||
template<typename RangeT, typename PredicateT>
|
||||
template<typename CollectionT, typename PredicateT>
|
||||
inline iterator_range<
|
||||
BOOST_STRING_TYPENAME range_result_iterator<RangeT>::type>
|
||||
BOOST_STRING_TYPENAME result_iterator_of<CollectionT>::type>
|
||||
find_token(
|
||||
RangeT& Input,
|
||||
CollectionT& Input,
|
||||
PredicateT Pred,
|
||||
token_compress_mode_type eCompress=token_compress_off)
|
||||
{
|
||||
|
@ -12,11 +12,8 @@
|
||||
|
||||
#include <deque>
|
||||
#include <boost/detail/iterator.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/collection_traits.hpp>
|
||||
#include <boost/algorithm/string/iterator_range.hpp>
|
||||
#include <boost/algorithm/string/concept.hpp>
|
||||
#include <boost/algorithm/string/detail/find_format.hpp>
|
||||
#include <boost/algorithm/string/detail/find_format_all.hpp>
|
||||
@ -50,23 +47,23 @@ namespace boost {
|
||||
*/
|
||||
template<
|
||||
typename OutputIteratorT,
|
||||
typename RangeT,
|
||||
typename CollectionT,
|
||||
typename FinderT,
|
||||
typename FormatterT>
|
||||
inline OutputIteratorT find_format_copy(
|
||||
OutputIteratorT Output,
|
||||
const RangeT& Input,
|
||||
const CollectionT& Input,
|
||||
FinderT Finder,
|
||||
FormatterT Formatter )
|
||||
{
|
||||
// Concept check
|
||||
function_requires<
|
||||
FinderConcept<FinderT,
|
||||
BOOST_STRING_TYPENAME range_const_iterator<RangeT>::type> >();
|
||||
BOOST_STRING_TYPENAME const_iterator_of<CollectionT>::type> >();
|
||||
function_requires<
|
||||
FormatterConcept<
|
||||
FormatterT,
|
||||
FinderT,BOOST_STRING_TYPENAME range_const_iterator<RangeT>::type> >();
|
||||
FinderT,BOOST_STRING_TYPENAME const_iterator_of<CollectionT>::type> >();
|
||||
|
||||
return detail::find_format_copy_impl(
|
||||
Output,
|
||||
@ -92,11 +89,11 @@ namespace boost {
|
||||
// Concept check
|
||||
function_requires<
|
||||
FinderConcept<FinderT,
|
||||
BOOST_STRING_TYPENAME range_const_iterator<SequenceT>::type> >();
|
||||
BOOST_STRING_TYPENAME const_iterator_of<SequenceT>::type> >();
|
||||
function_requires<
|
||||
FormatterConcept<
|
||||
FormatterT,
|
||||
FinderT,BOOST_STRING_TYPENAME range_const_iterator<SequenceT>::type> >();
|
||||
FinderT,BOOST_STRING_TYPENAME const_iterator_of<SequenceT>::type> >();
|
||||
|
||||
return detail::find_format_copy_impl(
|
||||
Input,
|
||||
@ -126,11 +123,11 @@ namespace boost {
|
||||
// Concept check
|
||||
function_requires<
|
||||
FinderConcept<FinderT,
|
||||
BOOST_STRING_TYPENAME range_const_iterator<SequenceT>::type> >();
|
||||
BOOST_STRING_TYPENAME const_iterator_of<SequenceT>::type> >();
|
||||
function_requires<
|
||||
FormatterConcept<
|
||||
FormatterT,
|
||||
FinderT,BOOST_STRING_TYPENAME range_const_iterator<SequenceT>::type> >();
|
||||
FinderT,BOOST_STRING_TYPENAME const_iterator_of<SequenceT>::type> >();
|
||||
|
||||
detail::find_format_impl(
|
||||
Input,
|
||||
@ -161,23 +158,23 @@ namespace boost {
|
||||
*/
|
||||
template<
|
||||
typename OutputIteratorT,
|
||||
typename RangeT,
|
||||
typename CollectionT,
|
||||
typename FinderT,
|
||||
typename FormatterT>
|
||||
inline OutputIteratorT find_format_all_copy(
|
||||
OutputIteratorT Output,
|
||||
const RangeT& Input,
|
||||
const CollectionT& Input,
|
||||
FinderT Finder,
|
||||
FormatterT Formatter)
|
||||
{
|
||||
// Concept check
|
||||
function_requires<
|
||||
FinderConcept<FinderT,
|
||||
BOOST_STRING_TYPENAME range_const_iterator<RangeT>::type> >();
|
||||
BOOST_STRING_TYPENAME const_iterator_of<CollectionT>::type> >();
|
||||
function_requires<
|
||||
FormatterConcept<
|
||||
FormatterT,
|
||||
FinderT,BOOST_STRING_TYPENAME range_const_iterator<RangeT>::type> >();
|
||||
FinderT,BOOST_STRING_TYPENAME const_iterator_of<CollectionT>::type> >();
|
||||
|
||||
return detail::find_format_all_copy_impl(
|
||||
Output,
|
||||
@ -203,11 +200,11 @@ namespace boost {
|
||||
// Concept check
|
||||
function_requires<
|
||||
FinderConcept<FinderT,
|
||||
BOOST_STRING_TYPENAME range_const_iterator<SequenceT>::type> >();
|
||||
BOOST_STRING_TYPENAME const_iterator_of<SequenceT>::type> >();
|
||||
function_requires<
|
||||
FormatterConcept<
|
||||
FormatterT,
|
||||
FinderT,BOOST_STRING_TYPENAME range_const_iterator<SequenceT>::type> >();
|
||||
FinderT,BOOST_STRING_TYPENAME const_iterator_of<SequenceT>::type> >();
|
||||
|
||||
return detail::find_format_all_copy_impl(
|
||||
Input,
|
||||
@ -238,11 +235,11 @@ namespace boost {
|
||||
// Concept check
|
||||
function_requires<
|
||||
FinderConcept<FinderT,
|
||||
BOOST_STRING_TYPENAME range_const_iterator<SequenceT>::type> >();
|
||||
BOOST_STRING_TYPENAME const_iterator_of<SequenceT>::type> >();
|
||||
function_requires<
|
||||
FormatterConcept<
|
||||
FormatterT,
|
||||
FinderT,BOOST_STRING_TYPENAME range_const_iterator<SequenceT>::type> >();
|
||||
FinderT,BOOST_STRING_TYPENAME const_iterator_of<SequenceT>::type> >();
|
||||
|
||||
detail::find_format_all_impl(
|
||||
Input,
|
||||
|
@ -9,17 +9,14 @@
|
||||
#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
|
||||
@ -108,11 +105,11 @@ namespace boost {
|
||||
//! Constructor
|
||||
/*!
|
||||
Construct new find_iterator for a given finder
|
||||
and a range.
|
||||
and a collection.
|
||||
*/
|
||||
template<typename FinderT, typename RangeT>
|
||||
template<typename FinderT, typename CollectionT>
|
||||
find_iterator(
|
||||
RangeT& Col,
|
||||
CollectionT& Col,
|
||||
FinderT Finder ) :
|
||||
detail::find_iterator_base<IteratorT>(Finder,0),
|
||||
m_Match(begin(Col),begin(Col)),
|
||||
@ -178,14 +175,14 @@ namespace boost {
|
||||
/*!
|
||||
* Construct a find iterator to iterate through the specified string
|
||||
*/
|
||||
template<typename RangeT, typename FinderT>
|
||||
template<typename CollectionT, typename FinderT>
|
||||
inline find_iterator<
|
||||
BOOST_STRING_TYPENAME range_result_iterator<RangeT>::type>
|
||||
BOOST_STRING_TYPENAME result_iterator_of<CollectionT>::type>
|
||||
make_find_iterator(
|
||||
RangeT& Collection,
|
||||
CollectionT& Collection,
|
||||
FinderT Finder)
|
||||
{
|
||||
return find_iterator<BOOST_STRING_TYPENAME range_result_iterator<RangeT>::type>(
|
||||
return find_iterator<BOOST_STRING_TYPENAME result_iterator_of<CollectionT>::type>(
|
||||
begin(Collection), end(Collection), Finder);
|
||||
}
|
||||
|
||||
@ -246,9 +243,7 @@ namespace boost {
|
||||
base_type(Other),
|
||||
m_Match(Other.m_Match),
|
||||
m_Next(Other.m_Next),
|
||||
m_End(Other.m_End),
|
||||
m_bEof(false)
|
||||
{}
|
||||
m_End(Other.m_End) {}
|
||||
|
||||
//! Constructor
|
||||
/*!
|
||||
@ -263,8 +258,7 @@ namespace boost {
|
||||
detail::find_iterator_base<IteratorT>(Finder,0),
|
||||
m_Match(Begin,Begin),
|
||||
m_Next(Begin),
|
||||
m_End(End),
|
||||
m_bEof(false)
|
||||
m_End(End)
|
||||
{
|
||||
increment();
|
||||
}
|
||||
@ -273,15 +267,14 @@ namespace boost {
|
||||
Construct new split_iterator for a given finder
|
||||
and a collection.
|
||||
*/
|
||||
template<typename FinderT, typename RangeT>
|
||||
template<typename FinderT, typename CollectionT>
|
||||
split_iterator(
|
||||
RangeT& Col,
|
||||
CollectionT& 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_bEof(false)
|
||||
m_End(end(Col))
|
||||
{
|
||||
increment();
|
||||
}
|
||||
@ -300,16 +293,6 @@ 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();
|
||||
}
|
||||
@ -324,7 +307,7 @@ namespace boost {
|
||||
(
|
||||
m_Match==Other.m_Match &&
|
||||
m_Next==Other.m_Next &&
|
||||
m_End==Other.m_End
|
||||
m_End==Other.m_End
|
||||
);
|
||||
}
|
||||
|
||||
@ -339,7 +322,12 @@ namespace boost {
|
||||
*/
|
||||
bool eof() const
|
||||
{
|
||||
return this->is_null() || m_bEof;
|
||||
return
|
||||
this->is_null() ||
|
||||
(
|
||||
m_Match.begin() == m_End &&
|
||||
m_Match.end() == m_End
|
||||
);
|
||||
}
|
||||
|
||||
private:
|
||||
@ -347,21 +335,20 @@ 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 RangeT, typename FinderT>
|
||||
template<typename CollectionT, typename FinderT>
|
||||
inline split_iterator<
|
||||
BOOST_STRING_TYPENAME range_result_iterator<RangeT>::type>
|
||||
BOOST_STRING_TYPENAME result_iterator_of<CollectionT>::type>
|
||||
make_split_iterator(
|
||||
RangeT& Collection,
|
||||
CollectionT& Collection,
|
||||
FinderT Finder)
|
||||
{
|
||||
return split_iterator<BOOST_STRING_TYPENAME range_result_iterator<RangeT>::type>(
|
||||
return split_iterator<BOOST_STRING_TYPENAME result_iterator_of<CollectionT>::type>(
|
||||
begin(Collection), end(Collection), Finder);
|
||||
}
|
||||
|
||||
|
@ -11,14 +11,9 @@
|
||||
#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>
|
||||
|
||||
@ -47,14 +42,14 @@ namespace boost {
|
||||
*/
|
||||
template<typename ContainerT>
|
||||
inline detail::first_finderF<
|
||||
BOOST_STRING_TYPENAME range_const_iterator<ContainerT>::type,
|
||||
BOOST_STRING_TYPENAME const_iterator_of<ContainerT>::type,
|
||||
is_equal>
|
||||
first_finder( const ContainerT& Search )
|
||||
{
|
||||
return
|
||||
detail::first_finderF<
|
||||
BOOST_STRING_TYPENAME
|
||||
range_const_iterator<ContainerT>::type,
|
||||
const_iterator_of<ContainerT>::type,
|
||||
is_equal>( Search, is_equal() ) ;
|
||||
}
|
||||
|
||||
@ -64,7 +59,7 @@ namespace boost {
|
||||
*/
|
||||
template<typename ContainerT,typename PredicateT>
|
||||
inline detail::first_finderF<
|
||||
BOOST_STRING_TYPENAME range_const_iterator<ContainerT>::type,
|
||||
BOOST_STRING_TYPENAME const_iterator_of<ContainerT>::type,
|
||||
PredicateT>
|
||||
first_finder(
|
||||
const ContainerT& Search, PredicateT Comp )
|
||||
@ -72,7 +67,7 @@ namespace boost {
|
||||
return
|
||||
detail::first_finderF<
|
||||
BOOST_STRING_TYPENAME
|
||||
range_const_iterator<ContainerT>::type,
|
||||
const_iterator_of<ContainerT>::type,
|
||||
PredicateT>( Search, Comp );
|
||||
}
|
||||
|
||||
@ -88,14 +83,14 @@ namespace boost {
|
||||
*/
|
||||
template<typename ContainerT>
|
||||
inline detail::last_finderF<
|
||||
BOOST_STRING_TYPENAME range_const_iterator<ContainerT>::type,
|
||||
BOOST_STRING_TYPENAME const_iterator_of<ContainerT>::type,
|
||||
is_equal>
|
||||
last_finder( const ContainerT& Search )
|
||||
{
|
||||
return
|
||||
detail::last_finderF<
|
||||
BOOST_STRING_TYPENAME
|
||||
range_const_iterator<ContainerT>::type,
|
||||
const_iterator_of<ContainerT>::type,
|
||||
is_equal>( Search, is_equal() );
|
||||
}
|
||||
//! "Last" finder
|
||||
@ -104,14 +99,14 @@ namespace boost {
|
||||
*/
|
||||
template<typename ContainerT, typename PredicateT>
|
||||
inline detail::last_finderF<
|
||||
BOOST_STRING_TYPENAME range_const_iterator<ContainerT>::type,
|
||||
BOOST_STRING_TYPENAME const_iterator_of<ContainerT>::type,
|
||||
PredicateT>
|
||||
last_finder( const ContainerT& Search, PredicateT Comp )
|
||||
{
|
||||
return
|
||||
detail::last_finderF<
|
||||
BOOST_STRING_TYPENAME
|
||||
range_const_iterator<ContainerT>::type,
|
||||
const_iterator_of<ContainerT>::type,
|
||||
PredicateT>( Search, Comp ) ;
|
||||
}
|
||||
|
||||
@ -128,7 +123,7 @@ namespace boost {
|
||||
*/
|
||||
template<typename ContainerT>
|
||||
inline detail::nth_finderF<
|
||||
BOOST_STRING_TYPENAME range_const_iterator<ContainerT>::type,
|
||||
BOOST_STRING_TYPENAME const_iterator_of<ContainerT>::type,
|
||||
is_equal>
|
||||
nth_finder(
|
||||
const ContainerT& Search,
|
||||
@ -137,7 +132,7 @@ namespace boost {
|
||||
return
|
||||
detail::nth_finderF<
|
||||
BOOST_STRING_TYPENAME
|
||||
range_const_iterator<ContainerT>::type,
|
||||
const_iterator_of<ContainerT>::type,
|
||||
is_equal>( Search, Nth, is_equal() ) ;
|
||||
}
|
||||
//! "Nth" finder
|
||||
@ -146,7 +141,7 @@ namespace boost {
|
||||
*/
|
||||
template<typename ContainerT, typename PredicateT>
|
||||
inline detail::nth_finderF<
|
||||
BOOST_STRING_TYPENAME range_const_iterator<ContainerT>::type,
|
||||
BOOST_STRING_TYPENAME const_iterator_of<ContainerT>::type,
|
||||
PredicateT>
|
||||
nth_finder(
|
||||
const ContainerT& Search,
|
||||
@ -156,7 +151,7 @@ namespace boost {
|
||||
return
|
||||
detail::nth_finderF<
|
||||
BOOST_STRING_TYPENAME
|
||||
range_const_iterator<ContainerT>::type,
|
||||
const_iterator_of<ContainerT>::type,
|
||||
PredicateT>( Search, Nth, Comp );
|
||||
}
|
||||
|
||||
|
@ -11,9 +11,8 @@
|
||||
#define BOOST_STRING_FORMATTER_HPP
|
||||
|
||||
#include <boost/detail/iterator.hpp>
|
||||
#include <boost/range/value_type.hpp>
|
||||
#include <boost/range/iterator_range.hpp>
|
||||
|
||||
#include <boost/algorithm/string/collection_traits.hpp>
|
||||
#include <boost/algorithm/string/iterator_range.hpp>
|
||||
#include <boost/algorithm/string/detail/formatter.hpp>
|
||||
|
||||
/*! \file
|
||||
@ -30,7 +29,7 @@
|
||||
namespace boost {
|
||||
namespace algorithm {
|
||||
|
||||
// generic formatters ---------------------------------------------------------------//
|
||||
// generic formaters ---------------------------------------------------------------//
|
||||
|
||||
//! Constant formatter
|
||||
/*!
|
||||
@ -40,11 +39,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 RangeT>
|
||||
inline detail::const_formatF<RangeT>
|
||||
const_formatter(const RangeT& Format)
|
||||
template<typename CollectionT>
|
||||
inline detail::const_formatF<CollectionT>
|
||||
const_formatter(const CollectionT& Format)
|
||||
{
|
||||
return detail::const_formatF<RangeT>(Format);
|
||||
return detail::const_formatF<CollectionT>(Format);
|
||||
}
|
||||
|
||||
//! Identity formatter
|
||||
@ -54,29 +53,29 @@ namespace boost {
|
||||
|
||||
\return An instance of the \c identity_formatter object.
|
||||
*/
|
||||
template<typename RangeT>
|
||||
inline detail::identity_formatF<RangeT>
|
||||
template<typename CollectionT>
|
||||
inline detail::identity_formatF<CollectionT>
|
||||
identity_formatter()
|
||||
{
|
||||
return detail::identity_formatF<RangeT>();
|
||||
return detail::identity_formatF<CollectionT>();
|
||||
}
|
||||
|
||||
//! Empty formatter
|
||||
/*!
|
||||
Construct the \c empty_formatter. Empty formatter always returns an empty
|
||||
Construct the \c empty_formatter. Empty formater 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 RangeT>
|
||||
template<typename CollectionT>
|
||||
inline detail::empty_formatF<
|
||||
BOOST_STRING_TYPENAME range_value<RangeT>::type>
|
||||
empty_formatter(const RangeT&)
|
||||
BOOST_STRING_TYPENAME value_type_of<CollectionT>::type>
|
||||
empty_formatter(const CollectionT&)
|
||||
{
|
||||
return detail::empty_formatF<
|
||||
BOOST_STRING_TYPENAME range_value<RangeT>::type>();
|
||||
BOOST_STRING_TYPENAME value_type_of<CollectionT>::type>();
|
||||
}
|
||||
|
||||
|
||||
|
@ -14,13 +14,8 @@
|
||||
#include <algorithm>
|
||||
#include <iterator>
|
||||
#include <boost/iterator/transform_iterator.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/collection_traits.hpp>
|
||||
#include <boost/algorithm/string/iterator_range.hpp>
|
||||
#include <boost/algorithm/string/concept.hpp>
|
||||
#include <boost/algorithm/string/find_iterator.hpp>
|
||||
#include <boost/algorithm/string/detail/util.hpp>
|
||||
@ -64,24 +59,24 @@ namespace boost {
|
||||
*/
|
||||
template<
|
||||
typename SequenceSequenceT,
|
||||
typename RangeT,
|
||||
typename CollectionT,
|
||||
typename FinderT >
|
||||
inline SequenceSequenceT&
|
||||
iter_find(
|
||||
SequenceSequenceT& Result,
|
||||
RangeT& Input,
|
||||
CollectionT& Input,
|
||||
FinderT Finder )
|
||||
{
|
||||
function_requires<
|
||||
FinderConcept<FinderT,
|
||||
BOOST_STRING_TYPENAME range_result_iterator<RangeT>::type> >();
|
||||
BOOST_STRING_TYPENAME result_iterator_of<CollectionT>::type> >();
|
||||
|
||||
typedef BOOST_STRING_TYPENAME
|
||||
range_result_iterator<RangeT>::type input_iterator_type;
|
||||
result_iterator_of<CollectionT>::type input_iterator_type;
|
||||
typedef find_iterator<input_iterator_type> find_iterator_type;
|
||||
typedef detail::copy_iterator_rangeF<
|
||||
BOOST_STRING_TYPENAME
|
||||
range_value<SequenceSequenceT>::type,
|
||||
value_type_of<SequenceSequenceT>::type,
|
||||
input_iterator_type> copy_range_type;
|
||||
|
||||
input_iterator_type InputEnd=end(Input);
|
||||
@ -131,24 +126,24 @@ namespace boost {
|
||||
*/
|
||||
template<
|
||||
typename SequenceSequenceT,
|
||||
typename RangeT,
|
||||
typename CollectionT,
|
||||
typename FinderT >
|
||||
inline SequenceSequenceT&
|
||||
iter_split(
|
||||
SequenceSequenceT& Result,
|
||||
RangeT& Input,
|
||||
CollectionT& Input,
|
||||
FinderT Finder )
|
||||
{
|
||||
function_requires<
|
||||
FinderConcept<FinderT,
|
||||
BOOST_STRING_TYPENAME range_result_iterator<RangeT>::type> >();
|
||||
BOOST_STRING_TYPENAME result_iterator_of<CollectionT>::type> >();
|
||||
|
||||
typedef BOOST_STRING_TYPENAME
|
||||
range_result_iterator<RangeT>::type input_iterator_type;
|
||||
result_iterator_of<CollectionT>::type input_iterator_type;
|
||||
typedef split_iterator<input_iterator_type> find_iterator_type;
|
||||
typedef detail::copy_iterator_rangeF<
|
||||
BOOST_STRING_TYPENAME
|
||||
range_value<SequenceSequenceT>::type,
|
||||
value_type_of<SequenceSequenceT>::type,
|
||||
input_iterator_type> copy_range_type;
|
||||
|
||||
input_iterator_type InputEnd=end(Input);
|
||||
|
296
include/boost/algorithm/string/iterator_range.hpp
Normal file
296
include/boost/algorithm/string/iterator_range.hpp
Normal file
@ -0,0 +1,296 @@
|
||||
// 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,12 +11,8 @@
|
||||
#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>
|
||||
|
||||
@ -38,7 +34,7 @@ namespace boost {
|
||||
|
||||
//! 'Starts with' predicate
|
||||
/*!
|
||||
This predicate holds when the test string is a prefix of the Input.
|
||||
This predicate holds when the test collection 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.
|
||||
@ -50,16 +46,16 @@ namespace boost {
|
||||
|
||||
\note This function provides the strong exception-safety guarantee
|
||||
*/
|
||||
template<typename Range1T, typename Range2T, typename PredicateT>
|
||||
template<typename Collection1T, typename Collection2T, typename PredicateT>
|
||||
inline bool starts_with(
|
||||
const Range1T& Input,
|
||||
const Range2T& Test,
|
||||
const Collection1T& Input,
|
||||
const Collection2T& Test,
|
||||
PredicateT Comp)
|
||||
{
|
||||
typedef BOOST_STRING_TYPENAME
|
||||
range_const_iterator<Range1T>::type Iterator1T;
|
||||
const_iterator_of<Collection1T>::type Iterator1T;
|
||||
typedef BOOST_STRING_TYPENAME
|
||||
range_const_iterator<Range2T>::type Iterator2T;
|
||||
const_iterator_of<Collection2T>::type Iterator2T;
|
||||
|
||||
Iterator1T InputEnd=end(Input);
|
||||
Iterator2T TestEnd=end(Test);
|
||||
@ -81,17 +77,17 @@ namespace boost {
|
||||
/*!
|
||||
\overload
|
||||
*/
|
||||
template<typename Range1T, typename Range2T>
|
||||
template<typename Collection1T, typename Collection2T>
|
||||
inline bool starts_with(
|
||||
const Range1T& Input,
|
||||
const Range2T& Test)
|
||||
const Collection1T& Input,
|
||||
const Collection2T& Test)
|
||||
{
|
||||
return starts_with(Input, Test, is_equal());
|
||||
}
|
||||
|
||||
//! 'Starts with' predicate ( case insensitive )
|
||||
/*!
|
||||
This predicate holds when the test string is a prefix of the Input.
|
||||
This predicate holds when the test container is a prefix of the Input.
|
||||
In other words, if the input starts with the test.
|
||||
Elements are compared case insensitively.
|
||||
|
||||
@ -102,10 +98,10 @@ namespace boost {
|
||||
|
||||
\note This function provides the strong exception-safety guarantee
|
||||
*/
|
||||
template<typename Range1T, typename Range2T>
|
||||
template<typename Collection1T, typename Collection2T>
|
||||
inline bool istarts_with(
|
||||
const Range1T& Input,
|
||||
const Range2T& Test,
|
||||
const Collection1T& Input,
|
||||
const Collection2T& Test,
|
||||
const std::locale& Loc=std::locale())
|
||||
{
|
||||
return starts_with(Input, Test, is_iequal(Loc));
|
||||
@ -116,7 +112,7 @@ namespace boost {
|
||||
|
||||
//! 'Ends with' predicate
|
||||
/*!
|
||||
This predicate holds when the test string is a suffix of the Input.
|
||||
This predicate holds when the test container 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.
|
||||
@ -129,14 +125,14 @@ namespace boost {
|
||||
|
||||
\note This function provides the strong exception-safety guarantee
|
||||
*/
|
||||
template<typename Range1T, typename Range2T, typename PredicateT>
|
||||
template<typename Collection1T, typename Collection2T, typename PredicateT>
|
||||
inline bool ends_with(
|
||||
const Range1T& Input,
|
||||
const Range2T& Test,
|
||||
const Collection1T& Input,
|
||||
const Collection2T& Test,
|
||||
PredicateT Comp)
|
||||
{
|
||||
typedef BOOST_STRING_TYPENAME
|
||||
range_const_iterator<Range1T>::type Iterator1T;
|
||||
const_iterator_of<Collection1T>::type Iterator1T;
|
||||
typedef BOOST_STRING_TYPENAME boost::detail::
|
||||
iterator_traits<Iterator1T>::iterator_category category;
|
||||
|
||||
@ -155,10 +151,10 @@ namespace boost {
|
||||
/*!
|
||||
\overload
|
||||
*/
|
||||
template<typename Range1T, typename Range2T>
|
||||
template<typename Collection1T, typename Collection2T>
|
||||
inline bool ends_with(
|
||||
const Range1T& Input,
|
||||
const Range2T& Test)
|
||||
const Collection1T& Input,
|
||||
const Collection2T& Test)
|
||||
{
|
||||
return ends_with(Input, Test, is_equal());
|
||||
}
|
||||
@ -176,10 +172,10 @@ namespace boost {
|
||||
|
||||
\note This function provides the strong exception-safety guarantee
|
||||
*/
|
||||
template<typename Range1T, typename Range2T>
|
||||
template<typename Collection1T, typename Collection2T>
|
||||
inline bool iends_with(
|
||||
const Range1T& Input,
|
||||
const Range2T& Test,
|
||||
const Collection1T& Input,
|
||||
const Collection2T& Test,
|
||||
const std::locale& Loc=std::locale())
|
||||
{
|
||||
return ends_with(Input, Test, is_iequal(Loc));
|
||||
@ -200,10 +196,10 @@ namespace boost {
|
||||
|
||||
\note This function provides the strong exception-safety guarantee
|
||||
*/
|
||||
template<typename Range1T, typename Range2T, typename PredicateT>
|
||||
template<typename Collection1T, typename Collection2T, typename PredicateT>
|
||||
inline bool contains(
|
||||
const Range1T& Input,
|
||||
const Range2T& Test,
|
||||
const Collection1T& Input,
|
||||
const Collection2T& Test,
|
||||
PredicateT Comp)
|
||||
{
|
||||
if (empty(Test))
|
||||
@ -221,10 +217,10 @@ namespace boost {
|
||||
/*!
|
||||
\overload
|
||||
*/
|
||||
template<typename Range1T, typename Range2T>
|
||||
template<typename Collection1T, typename Collection2T>
|
||||
inline bool contains(
|
||||
const Range1T& Input,
|
||||
const Range2T& Test)
|
||||
const Collection1T& Input,
|
||||
const Collection2T& Test)
|
||||
{
|
||||
return contains(Input, Test, is_equal());
|
||||
}
|
||||
@ -241,10 +237,10 @@ namespace boost {
|
||||
|
||||
\note This function provides the strong exception-safety guarantee
|
||||
*/
|
||||
template<typename Range1T, typename Range2T>
|
||||
template<typename Collection1T, typename Collection2T>
|
||||
inline bool icontains(
|
||||
const Range1T& Input,
|
||||
const Range2T& Test,
|
||||
const Collection1T& Input,
|
||||
const Collection2T& Test,
|
||||
const std::locale& Loc=std::locale())
|
||||
{
|
||||
return contains(Input, Test, is_iequal(Loc));
|
||||
@ -268,16 +264,16 @@ namespace boost {
|
||||
|
||||
\note This function provides the strong exception-safety guarantee
|
||||
*/
|
||||
template<typename Range1T, typename Range2T, typename PredicateT>
|
||||
template<typename Collection1T, typename Collection2T, typename PredicateT>
|
||||
inline bool equals(
|
||||
const Range1T& Input,
|
||||
const Range2T& Test,
|
||||
const Collection1T& Input,
|
||||
const Collection2T& Test,
|
||||
PredicateT Comp)
|
||||
{
|
||||
typedef BOOST_STRING_TYPENAME
|
||||
range_const_iterator<Range1T>::type Iterator1T;
|
||||
const_iterator_of<Collection1T>::type Iterator1T;
|
||||
typedef BOOST_STRING_TYPENAME
|
||||
range_const_iterator<Range2T>::type Iterator2T;
|
||||
const_iterator_of<Collection2T>::type Iterator2T;
|
||||
|
||||
Iterator1T InputEnd=end(Input);
|
||||
Iterator2T TestEnd=end(Test);
|
||||
@ -299,10 +295,10 @@ namespace boost {
|
||||
/*!
|
||||
\overload
|
||||
*/
|
||||
template<typename Range1T, typename Range2T>
|
||||
template<typename Collection1T, typename Collection2T>
|
||||
inline bool equals(
|
||||
const Range1T& Input,
|
||||
const Range2T& Test)
|
||||
const Collection1T& Input,
|
||||
const Collection2T& Test)
|
||||
{
|
||||
return equals(Input, Test, is_equal());
|
||||
}
|
||||
@ -322,10 +318,10 @@ namespace boost {
|
||||
|
||||
\note This function provides the strong exception-safety guarantee
|
||||
*/
|
||||
template<typename Range1T, typename Range2T>
|
||||
template<typename Collection1T, typename Collection2T>
|
||||
inline bool iequals(
|
||||
const Range1T& Input,
|
||||
const Range2T& Test,
|
||||
const Collection1T& Input,
|
||||
const Collection2T& Test,
|
||||
const std::locale& Loc=std::locale())
|
||||
{
|
||||
return equals(Input, Test, is_iequal(Loc));
|
||||
@ -344,13 +340,13 @@ namespace boost {
|
||||
|
||||
\note This function provides the strong exception-safety guarantee
|
||||
*/
|
||||
template<typename RangeT, typename PredicateT>
|
||||
template<typename CollectionT, typename PredicateT>
|
||||
inline bool all(
|
||||
const RangeT& Input,
|
||||
const CollectionT& Input,
|
||||
PredicateT Pred)
|
||||
{
|
||||
typedef BOOST_STRING_TYPENAME
|
||||
range_const_iterator<RangeT>::type Iterator1T;
|
||||
const_iterator_of<CollectionT>::type Iterator1T;
|
||||
|
||||
Iterator1T InputEnd=end(Input);
|
||||
for( Iterator1T It=begin(Input); It!=InputEnd; ++It)
|
||||
|
@ -12,12 +12,8 @@
|
||||
|
||||
#include <boost/algorithm/string/config.hpp>
|
||||
#include <boost/regex.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/collection_traits.hpp>
|
||||
#include <boost/algorithm/string/iterator_range.hpp>
|
||||
#include <boost/algorithm/string/find_format.hpp>
|
||||
#include <boost/algorithm/string/regex_find_format.hpp>
|
||||
#include <boost/algorithm/string/formatter.hpp>
|
||||
@ -41,21 +37,21 @@ namespace boost {
|
||||
\param Flags Regex options
|
||||
\return
|
||||
An \c iterator_range delimiting the match.
|
||||
Returned iterator is either \c RangeT::iterator or
|
||||
\c RangeT::const_iterator, depending on the constness of
|
||||
Returned iterator is either \c InputContainerT::iterator or
|
||||
\c InputContainerT::const_iterator, depending on the constness of
|
||||
the input parameter.
|
||||
|
||||
\note This function provides the strong exception-safety guarantee
|
||||
*/
|
||||
template<
|
||||
typename RangeT,
|
||||
typename CollectionT,
|
||||
typename CharT,
|
||||
typename RegexTraitsT>
|
||||
typename RegexTraitsT, typename RegexAllocatorT>
|
||||
inline iterator_range<
|
||||
BOOST_STRING_TYPENAME range_result_iterator<RangeT>::type >
|
||||
BOOST_STRING_TYPENAME result_iterator_of<CollectionT>::type >
|
||||
find_regex(
|
||||
RangeT& Input,
|
||||
const basic_regex<CharT, RegexTraitsT>& Rx,
|
||||
CollectionT& Input,
|
||||
const reg_expression<CharT, RegexTraitsT, RegexAllocatorT>& Rx,
|
||||
match_flag_type Flags=match_default )
|
||||
{
|
||||
return regex_finder(Rx,Flags)(
|
||||
@ -83,14 +79,14 @@ namespace boost {
|
||||
*/
|
||||
template<
|
||||
typename OutputIteratorT,
|
||||
typename RangeT,
|
||||
typename CollectionT,
|
||||
typename CharT,
|
||||
typename RegexTraitsT,
|
||||
typename RegexTraitsT, typename RegexAllocatorT,
|
||||
typename FormatStringTraitsT, typename FormatStringAllocatorT >
|
||||
inline OutputIteratorT replace_regex_copy(
|
||||
OutputIteratorT Output,
|
||||
const RangeT& Input,
|
||||
const basic_regex<CharT, RegexTraitsT>& Rx,
|
||||
const CollectionT& Input,
|
||||
const reg_expression<CharT, RegexTraitsT, RegexAllocatorT>& Rx,
|
||||
const std::basic_string<CharT, FormatStringTraitsT, FormatStringAllocatorT>& Format,
|
||||
match_flag_type Flags=match_default | format_default )
|
||||
{
|
||||
@ -108,11 +104,11 @@ namespace boost {
|
||||
template<
|
||||
typename SequenceT,
|
||||
typename CharT,
|
||||
typename RegexTraitsT,
|
||||
typename RegexTraitsT, typename RegexAllocatorT,
|
||||
typename FormatStringTraitsT, typename FormatStringAllocatorT >
|
||||
inline SequenceT replace_regex_copy(
|
||||
const SequenceT& Input,
|
||||
const basic_regex<CharT, RegexTraitsT>& Rx,
|
||||
const reg_expression<CharT, RegexTraitsT, RegexAllocatorT>& Rx,
|
||||
const std::basic_string<CharT, FormatStringTraitsT, FormatStringAllocatorT>& Format,
|
||||
match_flag_type Flags=match_default | format_default )
|
||||
{
|
||||
@ -135,11 +131,11 @@ namespace boost {
|
||||
template<
|
||||
typename SequenceT,
|
||||
typename CharT,
|
||||
typename RegexTraitsT,
|
||||
typename RegexTraitsT, typename RegexAllocatorT,
|
||||
typename FormatStringTraitsT, typename FormatStringAllocatorT >
|
||||
inline void replace_regex(
|
||||
SequenceT& Input,
|
||||
const basic_regex<CharT, RegexTraitsT>& Rx,
|
||||
const reg_expression<CharT, RegexTraitsT, RegexAllocatorT>& Rx,
|
||||
const std::basic_string<CharT, FormatStringTraitsT, FormatStringAllocatorT>& Format,
|
||||
match_flag_type Flags=match_default | format_default )
|
||||
{
|
||||
@ -169,14 +165,14 @@ namespace boost {
|
||||
*/
|
||||
template<
|
||||
typename OutputIteratorT,
|
||||
typename RangeT,
|
||||
typename CollectionT,
|
||||
typename CharT,
|
||||
typename RegexTraitsT,
|
||||
typename RegexTraitsT, typename RegexAllocatorT,
|
||||
typename FormatStringTraitsT, typename FormatStringAllocatorT >
|
||||
inline OutputIteratorT replace_all_regex_copy(
|
||||
OutputIteratorT Output,
|
||||
const RangeT& Input,
|
||||
const basic_regex<CharT, RegexTraitsT>& Rx,
|
||||
const CollectionT& Input,
|
||||
const reg_expression<CharT, RegexTraitsT, RegexAllocatorT>& Rx,
|
||||
const std::basic_string<CharT, FormatStringTraitsT, FormatStringAllocatorT>& Format,
|
||||
match_flag_type Flags=match_default | format_default )
|
||||
{
|
||||
@ -194,11 +190,11 @@ namespace boost {
|
||||
template<
|
||||
typename SequenceT,
|
||||
typename CharT,
|
||||
typename RegexTraitsT,
|
||||
typename RegexTraitsT, typename RegexAllocatorT,
|
||||
typename FormatStringTraitsT, typename FormatStringAllocatorT >
|
||||
inline SequenceT replace_all_regex_copy(
|
||||
const SequenceT& Input,
|
||||
const basic_regex<CharT, RegexTraitsT>& Rx,
|
||||
const reg_expression<CharT, RegexTraitsT, RegexAllocatorT>& Rx,
|
||||
const std::basic_string<CharT, FormatStringTraitsT, FormatStringAllocatorT>& Format,
|
||||
match_flag_type Flags=match_default | format_default )
|
||||
{
|
||||
@ -221,11 +217,11 @@ namespace boost {
|
||||
template<
|
||||
typename SequenceT,
|
||||
typename CharT,
|
||||
typename RegexTraitsT,
|
||||
typename RegexTraitsT, typename RegexAllocatorT,
|
||||
typename FormatStringTraitsT, typename FormatStringAllocatorT >
|
||||
inline void replace_all_regex(
|
||||
SequenceT& Input,
|
||||
const basic_regex<CharT, RegexTraitsT>& Rx,
|
||||
const reg_expression<CharT, RegexTraitsT, RegexAllocatorT>& Rx,
|
||||
const std::basic_string<CharT, FormatStringTraitsT, FormatStringAllocatorT>& Format,
|
||||
match_flag_type Flags=match_default | format_default )
|
||||
{
|
||||
@ -254,13 +250,13 @@ namespace boost {
|
||||
*/
|
||||
template<
|
||||
typename OutputIteratorT,
|
||||
typename RangeT,
|
||||
typename CollectionT,
|
||||
typename CharT,
|
||||
typename RegexTraitsT >
|
||||
typename RegexTraitsT, typename RegexAllocatorT >
|
||||
inline OutputIteratorT erase_regex_copy(
|
||||
OutputIteratorT Output,
|
||||
const RangeT& Input,
|
||||
const basic_regex<CharT, RegexTraitsT>& Rx,
|
||||
const CollectionT& Input,
|
||||
const reg_expression<CharT, RegexTraitsT, RegexAllocatorT>& Rx,
|
||||
match_flag_type Flags=match_default )
|
||||
{
|
||||
return find_format_copy(
|
||||
@ -277,10 +273,10 @@ namespace boost {
|
||||
template<
|
||||
typename SequenceT,
|
||||
typename CharT,
|
||||
typename RegexTraitsT >
|
||||
typename RegexTraitsT, typename RegexAllocatorT >
|
||||
inline SequenceT erase_regex_copy(
|
||||
const SequenceT& Input,
|
||||
const basic_regex<CharT, RegexTraitsT>& Rx,
|
||||
const reg_expression<CharT, RegexTraitsT, RegexAllocatorT>& Rx,
|
||||
match_flag_type Flags=match_default )
|
||||
{
|
||||
return find_format_copy(
|
||||
@ -301,10 +297,10 @@ namespace boost {
|
||||
template<
|
||||
typename SequenceT,
|
||||
typename CharT,
|
||||
typename RegexTraitsT >
|
||||
typename RegexTraitsT, typename RegexAllocatorT >
|
||||
inline void erase_regex(
|
||||
SequenceT& Input,
|
||||
const basic_regex<CharT, RegexTraitsT>& Rx,
|
||||
const reg_expression<CharT, RegexTraitsT, RegexAllocatorT>& Rx,
|
||||
match_flag_type Flags=match_default )
|
||||
{
|
||||
find_format(
|
||||
@ -333,13 +329,13 @@ namespace boost {
|
||||
*/
|
||||
template<
|
||||
typename OutputIteratorT,
|
||||
typename RangeT,
|
||||
typename CollectionT,
|
||||
typename CharT,
|
||||
typename RegexTraitsT >
|
||||
typename RegexTraitsT, typename RegexAllocatorT >
|
||||
inline OutputIteratorT erase_all_regex_copy(
|
||||
OutputIteratorT Output,
|
||||
const RangeT& Input,
|
||||
const basic_regex<CharT, RegexTraitsT>& Rx,
|
||||
const CollectionT& Input,
|
||||
const reg_expression<CharT, RegexTraitsT, RegexAllocatorT>& Rx,
|
||||
match_flag_type Flags=match_default )
|
||||
{
|
||||
return find_format_all_copy(
|
||||
@ -356,10 +352,10 @@ namespace boost {
|
||||
template<
|
||||
typename SequenceT,
|
||||
typename CharT,
|
||||
typename RegexTraitsT >
|
||||
typename RegexTraitsT, typename RegexAllocatorT >
|
||||
inline SequenceT erase_all_regex_copy(
|
||||
const SequenceT& Input,
|
||||
const basic_regex<CharT, RegexTraitsT>& Rx,
|
||||
const reg_expression<CharT, RegexTraitsT, RegexAllocatorT>& Rx,
|
||||
match_flag_type Flags=match_default )
|
||||
{
|
||||
return find_format_all_copy(
|
||||
@ -380,10 +376,10 @@ namespace boost {
|
||||
template<
|
||||
typename SequenceT,
|
||||
typename CharT,
|
||||
typename RegexTraitsT>
|
||||
typename RegexTraitsT, typename RegexAllocatorT>
|
||||
inline void erase_all_regex(
|
||||
SequenceT& Input,
|
||||
const basic_regex<CharT, RegexTraitsT>& Rx,
|
||||
const reg_expression<CharT, RegexTraitsT, RegexAllocatorT>& Rx,
|
||||
match_flag_type Flags=match_default )
|
||||
{
|
||||
find_format_all(
|
||||
@ -418,13 +414,13 @@ namespace boost {
|
||||
*/
|
||||
template<
|
||||
typename SequenceSequenceT,
|
||||
typename RangeT,
|
||||
typename CollectionT,
|
||||
typename CharT,
|
||||
typename RegexTraitsT >
|
||||
typename RegexTraitsT, typename RegexAllocatorT >
|
||||
inline SequenceSequenceT& find_all_regex(
|
||||
SequenceSequenceT& Result,
|
||||
const RangeT& Input,
|
||||
const basic_regex<CharT, RegexTraitsT>& Rx,
|
||||
const CollectionT& Input,
|
||||
const reg_expression<CharT, RegexTraitsT, RegexAllocatorT>& Rx,
|
||||
match_flag_type Flags=match_default )
|
||||
{
|
||||
return iter_find(
|
||||
@ -459,13 +455,13 @@ namespace boost {
|
||||
*/
|
||||
template<
|
||||
typename SequenceSequenceT,
|
||||
typename RangeT,
|
||||
typename CollectionT,
|
||||
typename CharT,
|
||||
typename RegexTraitsT >
|
||||
typename RegexTraitsT, typename RegexAllocatorT >
|
||||
inline SequenceSequenceT& split_regex(
|
||||
SequenceSequenceT& Result,
|
||||
const RangeT& Input,
|
||||
const basic_regex<CharT, RegexTraitsT>& Rx,
|
||||
const CollectionT& Input,
|
||||
const reg_expression<CharT, RegexTraitsT, RegexAllocatorT>& Rx,
|
||||
match_flag_type Flags=match_default )
|
||||
{
|
||||
return iter_split(
|
||||
|
@ -40,15 +40,15 @@ namespace boost {
|
||||
*/
|
||||
template<
|
||||
typename CharT,
|
||||
typename RegexTraitsT>
|
||||
inline detail::find_regexF< basic_regex<CharT, RegexTraitsT> >
|
||||
typename RegexTraitsT, typename RegexAllocatorT>
|
||||
inline detail::find_regexF< reg_expression<CharT, RegexTraitsT, RegexAllocatorT> >
|
||||
regex_finder(
|
||||
const basic_regex<CharT, RegexTraitsT>& Rx,
|
||||
const reg_expression<CharT, RegexTraitsT, RegexAllocatorT>& Rx,
|
||||
match_flag_type MatchFlags=match_default )
|
||||
{
|
||||
return detail::
|
||||
find_regexF<
|
||||
basic_regex<CharT, RegexTraitsT> >( Rx, MatchFlags );
|
||||
reg_expression<CharT, RegexTraitsT, RegexAllocatorT> >( Rx, MatchFlags );
|
||||
}
|
||||
|
||||
// regex_formater ---------------------------------------------//
|
||||
|
@ -11,13 +11,8 @@
|
||||
#define BOOST_STRING_REPLACE_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/collection_traits.hpp>
|
||||
#include <boost/algorithm/string/iterator_range.hpp>
|
||||
#include <boost/algorithm/string/find_format.hpp>
|
||||
#include <boost/algorithm/string/finder.hpp>
|
||||
#include <boost/algorithm/string/formatter.hpp>
|
||||
@ -50,15 +45,15 @@ namespace boost {
|
||||
*/
|
||||
template<
|
||||
typename OutputIteratorT,
|
||||
typename Range1T,
|
||||
typename Range2T>
|
||||
typename Collection1T,
|
||||
typename Collection2T>
|
||||
inline OutputIteratorT replace_range_copy(
|
||||
OutputIteratorT Output,
|
||||
const Range1T& Input,
|
||||
const Collection1T& Input,
|
||||
const iterator_range<
|
||||
BOOST_STRING_TYPENAME
|
||||
range_const_iterator<Range1T>::type>& SearchRange,
|
||||
const Range2T& Format)
|
||||
const_iterator_of<Collection1T>::type>& SearchRange,
|
||||
const Collection2T& Format)
|
||||
{
|
||||
return find_format_copy(
|
||||
Output,
|
||||
@ -71,13 +66,13 @@ namespace boost {
|
||||
/*!
|
||||
\overload
|
||||
*/
|
||||
template<typename SequenceT, typename RangeT>
|
||||
template<typename SequenceT, typename CollectionT>
|
||||
inline SequenceT replace_range_copy(
|
||||
const SequenceT& Input,
|
||||
const iterator_range<
|
||||
BOOST_STRING_TYPENAME
|
||||
range_const_iterator<SequenceT>::type>& SearchRange,
|
||||
const RangeT& Format)
|
||||
const_iterator_of<SequenceT>::type>& SearchRange,
|
||||
const CollectionT& Format)
|
||||
{
|
||||
return find_format_copy(
|
||||
Input,
|
||||
@ -94,13 +89,13 @@ namespace boost {
|
||||
\param SearchRange A range in the input to be substituted
|
||||
\param Format A substitute string
|
||||
*/
|
||||
template<typename SequenceT, typename RangeT>
|
||||
template<typename SequenceT, typename CollectionT>
|
||||
inline void replace_range(
|
||||
SequenceT& Input,
|
||||
const iterator_range<
|
||||
BOOST_STRING_TYPENAME
|
||||
range_iterator<SequenceT>::type>& SearchRange,
|
||||
const RangeT& Format)
|
||||
iterator_of<SequenceT>::type>& SearchRange,
|
||||
const CollectionT& Format)
|
||||
{
|
||||
find_format(
|
||||
Input,
|
||||
@ -128,14 +123,14 @@ namespace boost {
|
||||
*/
|
||||
template<
|
||||
typename OutputIteratorT,
|
||||
typename Range1T,
|
||||
typename Range2T,
|
||||
typename Range3T>
|
||||
typename Collection1T,
|
||||
typename Collection2T,
|
||||
typename Collection3T>
|
||||
inline OutputIteratorT replace_first_copy(
|
||||
OutputIteratorT Output,
|
||||
const Range1T& Input,
|
||||
const Range2T& Search,
|
||||
const Range3T& Format)
|
||||
const Collection1T& Input,
|
||||
const Collection2T& Search,
|
||||
const Collection3T& Format)
|
||||
{
|
||||
return find_format_copy(
|
||||
Output,
|
||||
@ -148,11 +143,11 @@ namespace boost {
|
||||
/*!
|
||||
\overload
|
||||
*/
|
||||
template<typename SequenceT, typename Range1T, typename Range2T>
|
||||
template<typename SequenceT, typename Collection1T, typename Collection2T>
|
||||
inline SequenceT replace_first_copy(
|
||||
const SequenceT& Input,
|
||||
const Range1T& Search,
|
||||
const Range2T& Format )
|
||||
const Collection1T& Search,
|
||||
const Collection2T& Format )
|
||||
{
|
||||
return find_format_copy(
|
||||
Input,
|
||||
@ -169,11 +164,11 @@ namespace boost {
|
||||
\param Search A substring to be searched for
|
||||
\param Format A substitute string
|
||||
*/
|
||||
template<typename SequenceT, typename Range1T, typename Range2T>
|
||||
template<typename SequenceT, typename Collection1T, typename Collection2T>
|
||||
inline void replace_first(
|
||||
SequenceT& Input,
|
||||
const Range1T& Search,
|
||||
const Range2T& Format )
|
||||
const Collection1T& Search,
|
||||
const Collection2T& Format )
|
||||
{
|
||||
find_format(
|
||||
Input,
|
||||
@ -203,14 +198,14 @@ namespace boost {
|
||||
*/
|
||||
template<
|
||||
typename OutputIteratorT,
|
||||
typename Range1T,
|
||||
typename Range2T,
|
||||
typename Range3T>
|
||||
typename Collection1T,
|
||||
typename Collection2T,
|
||||
typename Collection3T>
|
||||
inline OutputIteratorT ireplace_first_copy(
|
||||
OutputIteratorT Output,
|
||||
const Range1T& Input,
|
||||
const Range2T& Search,
|
||||
const Range3T& Format,
|
||||
const Collection1T& Input,
|
||||
const Collection2T& Search,
|
||||
const Collection3T& Format,
|
||||
const std::locale& Loc=std::locale() )
|
||||
{
|
||||
return find_format_copy(
|
||||
@ -224,11 +219,11 @@ namespace boost {
|
||||
/*!
|
||||
\overload
|
||||
*/
|
||||
template<typename SequenceT, typename Range2T, typename Range1T>
|
||||
template<typename SequenceT, typename Collection2T, typename Collection1T>
|
||||
inline SequenceT ireplace_first_copy(
|
||||
const SequenceT& Input,
|
||||
const Range2T& Search,
|
||||
const Range1T& Format,
|
||||
const Collection2T& Search,
|
||||
const Collection1T& Format,
|
||||
const std::locale& Loc=std::locale() )
|
||||
{
|
||||
return find_format_copy(
|
||||
@ -248,11 +243,11 @@ namespace boost {
|
||||
\param Format A substitute string
|
||||
\param Loc A locale used for case insensitive comparison
|
||||
*/
|
||||
template<typename SequenceT, typename Range1T, typename Range2T>
|
||||
template<typename SequenceT, typename Collection1T, typename Collection2T>
|
||||
inline void ireplace_first(
|
||||
SequenceT& Input,
|
||||
const Range1T& Search,
|
||||
const Range2T& Format,
|
||||
const Collection1T& Search,
|
||||
const Collection2T& Format,
|
||||
const std::locale& Loc=std::locale() )
|
||||
{
|
||||
find_format(
|
||||
@ -281,14 +276,14 @@ namespace boost {
|
||||
*/
|
||||
template<
|
||||
typename OutputIteratorT,
|
||||
typename Range1T,
|
||||
typename Range2T,
|
||||
typename Range3T>
|
||||
typename Collection1T,
|
||||
typename Collection2T,
|
||||
typename Collection3T>
|
||||
inline OutputIteratorT replace_last_copy(
|
||||
OutputIteratorT Output,
|
||||
const Range1T& Input,
|
||||
const Range2T& Search,
|
||||
const Range3T& Format )
|
||||
const Collection1T& Input,
|
||||
const Collection2T& Search,
|
||||
const Collection3T& Format )
|
||||
{
|
||||
return find_format_copy(
|
||||
Output,
|
||||
@ -301,11 +296,11 @@ namespace boost {
|
||||
/*!
|
||||
\overload
|
||||
*/
|
||||
template<typename SequenceT, typename Range1T, typename Range2T>
|
||||
template<typename SequenceT, typename Collection1T, typename Collection2T>
|
||||
inline SequenceT replace_last_copy(
|
||||
const SequenceT& Input,
|
||||
const Range1T& Search,
|
||||
const Range2T& Format )
|
||||
const Collection1T& Search,
|
||||
const Collection2T& Format )
|
||||
{
|
||||
return find_format_copy(
|
||||
Input,
|
||||
@ -322,11 +317,11 @@ namespace boost {
|
||||
\param Search A substring to be searched for
|
||||
\param Format A substitute string
|
||||
*/
|
||||
template<typename SequenceT, typename Range1T, typename Range2T>
|
||||
template<typename SequenceT, typename Collection1T, typename Collection2T>
|
||||
inline void replace_last(
|
||||
SequenceT& Input,
|
||||
const Range1T& Search,
|
||||
const Range2T& Format )
|
||||
const Collection1T& Search,
|
||||
const Collection2T& Format )
|
||||
{
|
||||
find_format(
|
||||
Input,
|
||||
@ -356,14 +351,14 @@ namespace boost {
|
||||
*/
|
||||
template<
|
||||
typename OutputIteratorT,
|
||||
typename Range1T,
|
||||
typename Range2T,
|
||||
typename Range3T>
|
||||
typename Collection1T,
|
||||
typename Collection2T,
|
||||
typename Collection3T>
|
||||
inline OutputIteratorT ireplace_last_copy(
|
||||
OutputIteratorT Output,
|
||||
const Range1T& Input,
|
||||
const Range2T& Search,
|
||||
const Range3T& Format,
|
||||
const Collection1T& Input,
|
||||
const Collection2T& Search,
|
||||
const Collection3T& Format,
|
||||
const std::locale& Loc=std::locale() )
|
||||
{
|
||||
return find_format_copy(
|
||||
@ -377,11 +372,11 @@ namespace boost {
|
||||
/*!
|
||||
\overload
|
||||
*/
|
||||
template<typename SequenceT, typename Range1T, typename Range2T>
|
||||
template<typename SequenceT, typename Collection1T, typename Collection2T>
|
||||
inline SequenceT ireplace_last_copy(
|
||||
const SequenceT& Input,
|
||||
const Range1T& Search,
|
||||
const Range2T& Format,
|
||||
const Collection1T& Search,
|
||||
const Collection2T& Format,
|
||||
const std::locale& Loc=std::locale() )
|
||||
{
|
||||
return find_format_copy(
|
||||
@ -402,11 +397,11 @@ namespace boost {
|
||||
\param Loc A locale used for case insensitive comparison
|
||||
\return A reference to the modified input
|
||||
*/
|
||||
template<typename SequenceT, typename Range1T, typename Range2T>
|
||||
template<typename SequenceT, typename Collection1T, typename Collection2T>
|
||||
inline void ireplace_last(
|
||||
SequenceT& Input,
|
||||
const Range1T& Search,
|
||||
const Range2T& Format,
|
||||
const Collection1T& Search,
|
||||
const Collection2T& Format,
|
||||
const std::locale& Loc=std::locale() )
|
||||
{
|
||||
find_format(
|
||||
@ -436,15 +431,15 @@ namespace boost {
|
||||
*/
|
||||
template<
|
||||
typename OutputIteratorT,
|
||||
typename Range1T,
|
||||
typename Range2T,
|
||||
typename Range3T>
|
||||
typename Collection1T,
|
||||
typename Collection2T,
|
||||
typename Collection3T>
|
||||
inline OutputIteratorT replace_nth_copy(
|
||||
OutputIteratorT Output,
|
||||
const Range1T& Input,
|
||||
const Range2T& Search,
|
||||
const Collection1T& Input,
|
||||
const Collection2T& Search,
|
||||
unsigned int Nth,
|
||||
const Range3T& Format )
|
||||
const Collection3T& Format )
|
||||
{
|
||||
return find_format_copy(
|
||||
Output,
|
||||
@ -457,12 +452,12 @@ namespace boost {
|
||||
/*!
|
||||
\overload
|
||||
*/
|
||||
template<typename SequenceT, typename Range1T, typename Range2T>
|
||||
template<typename SequenceT, typename Collection1T, typename Collection2T>
|
||||
inline SequenceT replace_nth_copy(
|
||||
const SequenceT& Input,
|
||||
const Range1T& Search,
|
||||
const Collection1T& Search,
|
||||
unsigned int Nth,
|
||||
const Range2T& Format )
|
||||
const Collection2T& Format )
|
||||
{
|
||||
return find_format_copy(
|
||||
Input,
|
||||
@ -480,12 +475,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 Range1T, typename Range2T>
|
||||
template<typename SequenceT, typename Collection1T, typename Collection2T>
|
||||
inline void replace_nth(
|
||||
SequenceT& Input,
|
||||
const Range1T& Search,
|
||||
const Collection1T& Search,
|
||||
unsigned int Nth,
|
||||
const Range2T& Format )
|
||||
const Collection2T& Format )
|
||||
{
|
||||
find_format(
|
||||
Input,
|
||||
@ -516,15 +511,15 @@ namespace boost {
|
||||
*/
|
||||
template<
|
||||
typename OutputIteratorT,
|
||||
typename Range1T,
|
||||
typename Range2T,
|
||||
typename Range3T>
|
||||
typename Collection1T,
|
||||
typename Collection2T,
|
||||
typename Collection3T>
|
||||
inline OutputIteratorT ireplace_nth_copy(
|
||||
OutputIteratorT Output,
|
||||
const Range1T& Input,
|
||||
const Range2T& Search,
|
||||
const Collection1T& Input,
|
||||
const Collection2T& Search,
|
||||
unsigned int Nth,
|
||||
const Range3T& Format,
|
||||
const Collection3T& Format,
|
||||
const std::locale& Loc=std::locale() )
|
||||
{
|
||||
return find_format_copy(
|
||||
@ -538,12 +533,12 @@ namespace boost {
|
||||
/*!
|
||||
\overload
|
||||
*/
|
||||
template<typename SequenceT, typename Range1T, typename Range2T>
|
||||
template<typename SequenceT, typename Collection1T, typename Collection2T>
|
||||
inline SequenceT ireplace_nth_copy(
|
||||
const SequenceT& Input,
|
||||
const Range1T& Search,
|
||||
const Collection1T& Search,
|
||||
unsigned int Nth,
|
||||
const Range2T& Format,
|
||||
const Collection2T& Format,
|
||||
const std::locale& Loc=std::locale() )
|
||||
{
|
||||
return find_format_copy(
|
||||
@ -564,12 +559,12 @@ namespace boost {
|
||||
\param Format A substitute string
|
||||
\param Loc A locale used for case insensitive comparison
|
||||
*/
|
||||
template<typename SequenceT, typename Range1T, typename Range2T>
|
||||
template<typename SequenceT, typename Collection1T, typename Collection2T>
|
||||
inline void ireplace_nth(
|
||||
SequenceT& Input,
|
||||
const Range1T& Search,
|
||||
const Collection1T& Search,
|
||||
unsigned int Nth,
|
||||
const Range2T& Format,
|
||||
const Collection2T& Format,
|
||||
const std::locale& Loc=std::locale() )
|
||||
{
|
||||
find_format(
|
||||
@ -598,14 +593,14 @@ namespace boost {
|
||||
*/
|
||||
template<
|
||||
typename OutputIteratorT,
|
||||
typename Range1T,
|
||||
typename Range2T,
|
||||
typename Range3T>
|
||||
typename Collection1T,
|
||||
typename Collection2T,
|
||||
typename Collection3T>
|
||||
inline OutputIteratorT replace_all_copy(
|
||||
OutputIteratorT Output,
|
||||
const Range1T& Input,
|
||||
const Range2T& Search,
|
||||
const Range3T& Format )
|
||||
const Collection1T& Input,
|
||||
const Collection2T& Search,
|
||||
const Collection3T& Format )
|
||||
{
|
||||
return find_format_all_copy(
|
||||
Output,
|
||||
@ -618,11 +613,11 @@ namespace boost {
|
||||
/*!
|
||||
\overload
|
||||
*/
|
||||
template<typename SequenceT, typename Range1T, typename Range2T>
|
||||
template<typename SequenceT, typename Collection1T, typename Collection2T>
|
||||
inline SequenceT replace_all_copy(
|
||||
const SequenceT& Input,
|
||||
const Range1T& Search,
|
||||
const Range2T& Format )
|
||||
const Collection1T& Search,
|
||||
const Collection2T& Format )
|
||||
{
|
||||
return find_format_all_copy(
|
||||
Input,
|
||||
@ -640,11 +635,11 @@ namespace boost {
|
||||
\param Format A substitute string
|
||||
\return A reference to the modified input
|
||||
*/
|
||||
template<typename SequenceT, typename Range1T, typename Range2T>
|
||||
template<typename SequenceT, typename Collection1T, typename Collection2T>
|
||||
inline void replace_all(
|
||||
SequenceT& Input,
|
||||
const Range1T& Search,
|
||||
const Range2T& Format )
|
||||
const Collection1T& Search,
|
||||
const Collection2T& Format )
|
||||
{
|
||||
find_format_all(
|
||||
Input,
|
||||
@ -674,14 +669,14 @@ namespace boost {
|
||||
*/
|
||||
template<
|
||||
typename OutputIteratorT,
|
||||
typename Range1T,
|
||||
typename Range2T,
|
||||
typename Range3T>
|
||||
typename Collection1T,
|
||||
typename Collection2T,
|
||||
typename Collection3T>
|
||||
inline OutputIteratorT ireplace_all_copy(
|
||||
OutputIteratorT Output,
|
||||
const Range1T& Input,
|
||||
const Range2T& Search,
|
||||
const Range3T& Format,
|
||||
const Collection1T& Input,
|
||||
const Collection2T& Search,
|
||||
const Collection3T& Format,
|
||||
const std::locale& Loc=std::locale() )
|
||||
{
|
||||
return find_format_all_copy(
|
||||
@ -695,11 +690,11 @@ namespace boost {
|
||||
/*!
|
||||
\overload
|
||||
*/
|
||||
template<typename SequenceT, typename Range1T, typename Range2T>
|
||||
template<typename SequenceT, typename Collection1T, typename Collection2T>
|
||||
inline SequenceT ireplace_all_copy(
|
||||
const SequenceT& Input,
|
||||
const Range1T& Search,
|
||||
const Range2T& Format,
|
||||
const Collection1T& Search,
|
||||
const Collection2T& Format,
|
||||
const std::locale& Loc=std::locale() )
|
||||
{
|
||||
return find_format_all_copy(
|
||||
@ -719,11 +714,11 @@ namespace boost {
|
||||
\param Format A substitute string
|
||||
\param Loc A locale used for case insensitive comparison
|
||||
*/
|
||||
template<typename SequenceT, typename Range1T, typename Range2T>
|
||||
template<typename SequenceT, typename Collection1T, typename Collection2T>
|
||||
inline void ireplace_all(
|
||||
SequenceT& Input,
|
||||
const Range1T& Search,
|
||||
const Range2T& Format,
|
||||
const Collection1T& Search,
|
||||
const Collection2T& Format,
|
||||
const std::locale& Loc=std::locale() )
|
||||
{
|
||||
find_format_all(
|
||||
@ -754,13 +749,13 @@ namespace boost {
|
||||
*/
|
||||
template<
|
||||
typename OutputIteratorT,
|
||||
typename Range1T,
|
||||
typename Range2T>
|
||||
typename Collection1T,
|
||||
typename Collection2T>
|
||||
inline OutputIteratorT replace_head_copy(
|
||||
OutputIteratorT Output,
|
||||
const Range1T& Input,
|
||||
const Collection1T& Input,
|
||||
unsigned int N,
|
||||
const Range2T& Format )
|
||||
const Collection2T& Format )
|
||||
{
|
||||
return find_format_copy(
|
||||
Output,
|
||||
@ -773,11 +768,11 @@ namespace boost {
|
||||
/*!
|
||||
\overload
|
||||
*/
|
||||
template<typename SequenceT, typename RangeT>
|
||||
template<typename SequenceT, typename CollectionT>
|
||||
inline SequenceT replace_head_copy(
|
||||
const SequenceT& Input,
|
||||
unsigned int N,
|
||||
const RangeT& Format )
|
||||
const CollectionT& Format )
|
||||
{
|
||||
return find_format_copy(
|
||||
Input,
|
||||
@ -796,11 +791,11 @@ namespace boost {
|
||||
\param N Length of the head
|
||||
\param Format A substitute string
|
||||
*/
|
||||
template<typename SequenceT, typename RangeT>
|
||||
template<typename SequenceT, typename CollectionT>
|
||||
inline void replace_head(
|
||||
SequenceT& Input,
|
||||
unsigned int N,
|
||||
const RangeT& Format )
|
||||
const CollectionT& Format )
|
||||
{
|
||||
find_format(
|
||||
Input,
|
||||
@ -830,13 +825,13 @@ namespace boost {
|
||||
*/
|
||||
template<
|
||||
typename OutputIteratorT,
|
||||
typename Range1T,
|
||||
typename Range2T>
|
||||
typename Collection1T,
|
||||
typename Collection2T>
|
||||
inline OutputIteratorT replace_tail_copy(
|
||||
OutputIteratorT Output,
|
||||
const Range1T& Input,
|
||||
const Collection1T& Input,
|
||||
unsigned int N,
|
||||
const Range2T& Format )
|
||||
const Collection2T& Format )
|
||||
{
|
||||
return find_format_copy(
|
||||
Output,
|
||||
@ -849,11 +844,11 @@ namespace boost {
|
||||
/*!
|
||||
\overload
|
||||
*/
|
||||
template<typename SequenceT, typename RangeT>
|
||||
template<typename SequenceT, typename CollectionT>
|
||||
inline SequenceT replace_tail_copy(
|
||||
const SequenceT& Input,
|
||||
unsigned int N,
|
||||
const RangeT& Format )
|
||||
const CollectionT& Format )
|
||||
{
|
||||
return find_format_copy(
|
||||
Input,
|
||||
@ -872,11 +867,11 @@ namespace boost {
|
||||
\param N Length of the tail
|
||||
\param Format A substitute string
|
||||
*/
|
||||
template<typename SequenceT, typename RangeT>
|
||||
template<typename SequenceT, typename CollectionT>
|
||||
inline void replace_tail(
|
||||
SequenceT& Input,
|
||||
unsigned int N,
|
||||
const RangeT& Format )
|
||||
const CollectionT& 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_<has_native_replace<T>::value> type;
|
||||
typedef mpl::bool_<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_<has_stable_iterators<T>::value> type;
|
||||
typedef mpl::bool_<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_<has_const_time_insert<T>::value> type;
|
||||
typedef mpl::bool_<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_<has_const_time_erase<T>::value> type;
|
||||
typedef mpl::bool_<value> type;
|
||||
};
|
||||
|
||||
} // namespace algorithm
|
||||
|
@ -11,7 +11,8 @@
|
||||
#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>
|
||||
@ -57,11 +58,11 @@ namespace boost {
|
||||
|
||||
\note This function provides the strong exception-safety guarantee
|
||||
*/
|
||||
template< typename SequenceSequenceT, typename Range1T, typename Range2T >
|
||||
template< typename SequenceSequenceT, typename Collection1T, typename Collection2T >
|
||||
inline SequenceSequenceT& find_all(
|
||||
SequenceSequenceT& Result,
|
||||
Range1T& Input,
|
||||
const Range2T& Search)
|
||||
Collection1T& Input,
|
||||
const Collection2T& Search)
|
||||
{
|
||||
return iter_find(
|
||||
Result,
|
||||
@ -92,11 +93,11 @@ namespace boost {
|
||||
|
||||
\note This function provides the strong exception-safety guarantee
|
||||
*/
|
||||
template< typename SequenceSequenceT, typename Range1T, typename Range2T >
|
||||
template< typename SequenceSequenceT, typename Collection1T, typename Collection2T >
|
||||
inline SequenceSequenceT& ifind_all(
|
||||
SequenceSequenceT& Result,
|
||||
Range1T& Input,
|
||||
const Range2T& Search,
|
||||
Collection1T& Input,
|
||||
const Collection2T& Search,
|
||||
const std::locale& Loc=std::locale() )
|
||||
{
|
||||
return iter_find(
|
||||
@ -135,10 +136,10 @@ namespace boost {
|
||||
|
||||
\note This function provides the strong exception-safety guarantee
|
||||
*/
|
||||
template< typename SequenceSequenceT, typename RangeT, typename PredicateT >
|
||||
template< typename SequenceSequenceT, typename CollectionT, typename PredicateT >
|
||||
inline SequenceSequenceT& split(
|
||||
SequenceSequenceT& Result,
|
||||
RangeT& Input,
|
||||
CollectionT& 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_<has_stable_iterators<T>::value> type;
|
||||
typedef mpl::bool_<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_<has_const_time_insert<T>::value> type;
|
||||
typedef mpl::bool_<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_<has_const_time_erase<T>::value> type;
|
||||
typedef mpl::bool_<value> type;
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
} // namespace algorithm
|
||||
} // namespace boost
|
||||
|
||||
|
@ -10,7 +10,6 @@
|
||||
#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>
|
||||
@ -24,21 +23,21 @@ namespace boost {
|
||||
|
||||
// stable iterators tester
|
||||
template<typename T, typename AllocT>
|
||||
yes_type has_stable_iterators_tester( const BOOST_STD_EXTENSION_NAMESPACE::slist<T,AllocT>* );
|
||||
yes_type has_stable_iterators_tester( const std::slist<T,AllocT>* );
|
||||
|
||||
// const time insert tester
|
||||
template<typename T, typename AllocT>
|
||||
yes_type has_const_time_insert_tester( const BOOST_STD_EXTENSION_NAMESPACE::slist<T,AllocT>* );
|
||||
yes_type has_const_time_insert_tester( const std::slist<T,AllocT>* );
|
||||
|
||||
// const time erase tester
|
||||
template<typename T, typename AllocT>
|
||||
yes_type has_const_time_erase_tester( const BOOST_STD_EXTENSION_NAMESPACE::slist<T,AllocT>* );
|
||||
yes_type has_const_time_erase_tester( const std::slist<T,AllocT>* );
|
||||
|
||||
#else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
|
||||
|
||||
// stable iterators trait
|
||||
template<typename T, typename AllocT>
|
||||
class has_stable_iterators< BOOST_STD_EXTENSION_NAMESPACE::slist<T,AllocT> >
|
||||
class has_stable_iterators< std::slist<T,AllocT> >
|
||||
{
|
||||
public:
|
||||
#if BOOST_WORKAROUND( __IBMCPP__, <= 600 )
|
||||
@ -46,12 +45,12 @@ namespace boost {
|
||||
#else
|
||||
BOOST_STATIC_CONSTANT(bool, value=true);
|
||||
#endif // BOOST_WORKAROUND( __IBMCPP__, <= 600 )
|
||||
typedef mpl::bool_<has_stable_iterators<T>::value> type;
|
||||
typedef mpl::bool_<value> type;
|
||||
};
|
||||
|
||||
// const time insert trait
|
||||
template<typename T, typename AllocT>
|
||||
class has_const_time_insert< BOOST_STD_EXTENSION_NAMESPACE::slist<T,AllocT> >
|
||||
class has_const_time_insert< std::slist<T,AllocT> >
|
||||
{
|
||||
public:
|
||||
#if BOOST_WORKAROUND( __IBMCPP__, <= 600 )
|
||||
@ -59,12 +58,12 @@ namespace boost {
|
||||
#else
|
||||
BOOST_STATIC_CONSTANT(bool, value=true);
|
||||
#endif // BOOST_WORKAROUND( __IBMCPP__, <= 600 )
|
||||
typedef mpl::bool_<has_const_time_insert<T>::value> type;
|
||||
typedef mpl::bool_<value> type;
|
||||
};
|
||||
|
||||
// const time erase trait
|
||||
template<typename T, typename AllocT>
|
||||
class has_const_time_erase< BOOST_STD_EXTENSION_NAMESPACE::slist<T,AllocT> >
|
||||
class has_const_time_erase< std::slist<T,AllocT> >
|
||||
{
|
||||
public:
|
||||
#if BOOST_WORKAROUND( __IBMCPP__, <= 600 )
|
||||
@ -72,7 +71,7 @@ namespace boost {
|
||||
#else
|
||||
BOOST_STATIC_CONSTANT(bool, value=true);
|
||||
#endif // BOOST_WORKAROUND( __IBMCPP__, <= 600 )
|
||||
typedef mpl::bool_<has_const_time_erase<T>::value> type;
|
||||
typedef mpl::bool_<value> type;
|
||||
};
|
||||
#endif
|
||||
|
||||
|
@ -38,7 +38,7 @@ namespace boost {
|
||||
BOOST_STATIC_CONSTANT(bool, value=true);
|
||||
#endif // BOOST_WORKAROUND( __IBMCPP__, <= 600 )
|
||||
|
||||
typedef mpl::bool_<has_native_replace<T>::value> type;
|
||||
typedef mpl::bool_<value> type;
|
||||
};
|
||||
|
||||
|
||||
|
@ -11,11 +11,7 @@
|
||||
#define BOOST_STRING_TRIM_HPP
|
||||
|
||||
#include <boost/algorithm/string/config.hpp>
|
||||
|
||||
#include <boost/range/begin.hpp>
|
||||
#include <boost/range/end.hpp>
|
||||
#include <boost/range/const_iterator.hpp>
|
||||
|
||||
#include <boost/algorithm/string/collection_traits.hpp>
|
||||
#include <boost/algorithm/string/detail/trim.hpp>
|
||||
#include <boost/algorithm/string/classification.hpp>
|
||||
#include <locale>
|
||||
@ -46,7 +42,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 range
|
||||
\param Input An input collection
|
||||
\param IsSpace An unary predicate identifying spaces
|
||||
\return
|
||||
An output iterator pointing just after the last inserted character or
|
||||
@ -54,14 +50,14 @@ namespace boost {
|
||||
|
||||
\note The second variant of this function provides the strong exception-safety guarantee
|
||||
*/
|
||||
template<typename OutputIteratorT, typename RangeT, typename PredicateT>
|
||||
template<typename OutputIteratorT, typename CollectionT, typename PredicateT>
|
||||
inline OutputIteratorT trim_left_copy_if(
|
||||
OutputIteratorT Output,
|
||||
const RangeT& Input,
|
||||
const CollectionT& Input,
|
||||
PredicateT IsSpace)
|
||||
{
|
||||
std::copy(
|
||||
::boost::algorithm::detail::trim_begin(
|
||||
detail::trim_begin(
|
||||
begin(Input),
|
||||
end(Input),
|
||||
IsSpace ),
|
||||
@ -79,7 +75,7 @@ namespace boost {
|
||||
inline SequenceT trim_left_copy_if(const SequenceT& Input, PredicateT IsSpace)
|
||||
{
|
||||
return SequenceT(
|
||||
::boost::algorithm::detail::trim_begin(
|
||||
detail::trim_begin(
|
||||
begin(Input),
|
||||
end(Input),
|
||||
IsSpace ),
|
||||
@ -120,7 +116,7 @@ namespace boost {
|
||||
{
|
||||
Input.erase(
|
||||
begin(Input),
|
||||
::boost::algorithm::detail::trim_begin(
|
||||
detail::trim_begin(
|
||||
begin(Input),
|
||||
end(Input),
|
||||
IsSpace));
|
||||
@ -152,7 +148,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 range
|
||||
\param Input An input collection
|
||||
\param IsSpace An unary predicate identifying spaces
|
||||
\return
|
||||
An output iterator pointing just after the last inserted character or
|
||||
@ -160,15 +156,15 @@ namespace boost {
|
||||
|
||||
\note The second variant of this function provides the strong exception-safety guarantee
|
||||
*/
|
||||
template<typename OutputIteratorT, typename RangeT, typename PredicateT>
|
||||
template<typename OutputIteratorT, typename CollectionT, typename PredicateT>
|
||||
inline OutputIteratorT trim_right_copy_if(
|
||||
OutputIteratorT Output,
|
||||
const RangeT& Input,
|
||||
const CollectionT& Input,
|
||||
PredicateT IsSpace )
|
||||
{
|
||||
std::copy(
|
||||
begin(Input),
|
||||
::boost::algorithm::detail::trim_end(
|
||||
detail::trim_end(
|
||||
begin(Input),
|
||||
end(Input),
|
||||
IsSpace ),
|
||||
@ -186,7 +182,7 @@ namespace boost {
|
||||
{
|
||||
return SequenceT(
|
||||
begin(Input),
|
||||
::boost::algorithm::detail::trim_end(
|
||||
detail::trim_end(
|
||||
begin(Input),
|
||||
end(Input),
|
||||
IsSpace)
|
||||
@ -227,7 +223,7 @@ namespace boost {
|
||||
inline void trim_right_if(SequenceT& Input, PredicateT IsSpace)
|
||||
{
|
||||
Input.erase(
|
||||
::boost::algorithm::detail::trim_end(
|
||||
detail::trim_end(
|
||||
begin(Input),
|
||||
end(Input),
|
||||
IsSpace ),
|
||||
@ -262,7 +258,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 range
|
||||
\param Input An input collection
|
||||
\param IsSpace An unary predicate identifying spaces
|
||||
\return
|
||||
An output iterator pointing just after the last inserted character or
|
||||
@ -270,15 +266,15 @@ namespace boost {
|
||||
|
||||
\note The second variant of this function provides the strong exception-safety guarantee
|
||||
*/
|
||||
template<typename OutputIteratorT, typename RangeT, typename PredicateT>
|
||||
template<typename OutputIteratorT, typename CollectionT, typename PredicateT>
|
||||
inline OutputIteratorT trim_copy_if(
|
||||
OutputIteratorT Output,
|
||||
const RangeT& Input,
|
||||
const CollectionT& Input,
|
||||
PredicateT IsSpace)
|
||||
{
|
||||
BOOST_STRING_TYPENAME
|
||||
range_const_iterator<RangeT>::type TrimEnd=
|
||||
::boost::algorithm::detail::trim_end(
|
||||
const_iterator_of<CollectionT>::type TrimEnd=
|
||||
detail::trim_end(
|
||||
begin(Input),
|
||||
end(Input),
|
||||
IsSpace);
|
||||
@ -301,8 +297,8 @@ namespace boost {
|
||||
inline SequenceT trim_copy_if(const SequenceT& Input, PredicateT IsSpace)
|
||||
{
|
||||
BOOST_STRING_TYPENAME
|
||||
range_const_iterator<SequenceT>::type TrimEnd=
|
||||
::boost::algorithm::detail::trim_end(
|
||||
const_iterator_of<SequenceT>::type TrimEnd=
|
||||
detail::trim_end(
|
||||
begin(Input),
|
||||
end(Input),
|
||||
IsSpace);
|
||||
|
@ -35,7 +35,7 @@ means that all the elements are distinct and in increasing order, <i>decrea</i>s
|
||||
is the reverse, and <i>random</i> is produced by random_shuffle.
|
||||
<br>
|
||||
The program that created these tables is included in the distribution,
|
||||
under <a href="../example/minmax_timer.cpp">minmax_timer.cpp</a>
|
||||
under <a href=""../example/minmax_timer.cpp"">minmax_timer.cpp</a>
|
||||
<br>
|
||||
<center><table BORDER NOSAVE >
|
||||
<tr NOSAVE>
|
||||
|
@ -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 types</a><br>
|
||||
<a href="#reqs">Requirements on type</a>s<br>
|
||||
<a href="#precond">Preconditions</a><br>
|
||||
<a href="#postcond">Postconditions</a><br>
|
||||
<a href="#complexity">Complexity</a><br>
|
||||
@ -56,7 +56,7 @@ be enough. The present library solves both problems.</p>
|
||||
<tt>minmax</tt>
|
||||
as straightforward extensions of the C++
|
||||
standard. As it returns a pair of <tt>const&</tt>, we must use the <a
|
||||
href=:../../../../tuple/index.html>Boost.tuple</a> library to construct such
|
||||
href=:../../tuple/index.html>Boost.tuple</a> library to construct such
|
||||
pairs. (Please note: the intent is not to fix the known defaults of
|
||||
<tt>std::min</tt>
|
||||
and <tt>std::max</tt>, but to add one more algorithms that combines both; see the
|
||||
@ -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,10 +11,7 @@ import testing ;
|
||||
|
||||
{
|
||||
test-suite algorithm/minmax:
|
||||
: [ run minmax_element_test.cpp
|
||||
: : : : minmax_element ]
|
||||
[ run minmax_test.cpp
|
||||
: : : : minmax ]
|
||||
;
|
||||
[ run minmax_element_test.cpp ]
|
||||
;
|
||||
}
|
||||
|
||||
|
@ -11,7 +11,6 @@
|
||||
#include <vector>
|
||||
#include <list>
|
||||
#include <set>
|
||||
#include <cstdlib>
|
||||
|
||||
#include <boost/config.hpp> /* prevents some nasty warns in MSVC */
|
||||
#include <boost/algorithm/minmax_element.hpp>
|
||||
@ -227,10 +226,6 @@ 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,6 +21,7 @@ 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,13 +18,15 @@
|
||||
</para>
|
||||
<para>
|
||||
<emphasis role="bold">Definition:</emphasis> A string is a
|
||||
<ulink url="../../libs/range/doc/range.html">range</ulink> of characters accessible in sequential
|
||||
<ulink url="../../libs/utility/Collection.html">collection</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
|
||||
<ulink url="../../libs/range/index.html">Boost.Range</ulink>. This facility allows to access
|
||||
<link linkend="string_algo.collection_traits">collection traits</link>. 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>
|
||||
@ -40,11 +42,166 @@
|
||||
</para>
|
||||
<para>
|
||||
In the reference and also in the code, requirement on the string type is designated by the name of
|
||||
template argument. <code>RangeT</code> means that the basic range requirements must hold.
|
||||
template argument. <code>CollectionT</code> means that the basic collection 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>
|
||||
|
||||
|
@ -1,17 +0,0 @@
|
||||
<?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,7 +33,6 @@
|
||||
|
||||
<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 <ulink url="../../libs/range/index.html">Boost.Range</ulink>
|
||||
The magic of <link linkend="string_algo.collection_traits">collection_traits</link>
|
||||
provides a uniform way of handling different string types.
|
||||
If there is a need to pass a pair of iterators,
|
||||
<ulink url="../../libs/range/doc/utility_class.html"><code>boost::iterator_range</code></ulink>
|
||||
<link linkend="string_algo.iterator_range"><code>iterator_range</code></link>
|
||||
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 <ulink url="../../libs/range/doc/utility_class.html"><code>boost::iterator_range</code></ulink>.
|
||||
The result is given in the <link linkend="string_algo.iterator_range"><code>iterator_range</code></link>.
|
||||
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
|
||||
<ulink url="../../libs/range/index.html">Boost.Range</ulink>.
|
||||
<link linkend="string_algo.collection_traits">collection_traits</link>.
|
||||
|
||||
The following lines transform the result. Notice that
|
||||
<ulink url="../../libs/range/doc/utility_class.html"><code>boost::iterator_range</code></ulink> has familiar
|
||||
<link linkend="string_algo.iterator_range"><code>iterator_range</code></link> 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 <ulink url="../../libs/range/doc/utility_class.html"><code>boost::iterator_range</code></ulink>
|
||||
Dereferencing a find iterator yields an <link linkend="string_algo.iterator_range"><code>iterator_range</code></link>
|
||||
object, that delimits the current match.
|
||||
</para>
|
||||
<para>
|
||||
@ -274,7 +274,7 @@
|
||||
It!=string_find_iterator();
|
||||
++It)
|
||||
{
|
||||
cout << copy_range<std::string>(*It) << endl;
|
||||
cout << copy_iterator_range<std::string>(*It) << endl;
|
||||
}
|
||||
|
||||
// Output will be:
|
||||
@ -288,7 +288,7 @@
|
||||
It!=string_find_iterator();
|
||||
++It)
|
||||
{
|
||||
cout << copy_range<std::string>(*It) << endl;
|
||||
cout << copy_iterator_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 range.
|
||||
to construct a find iterator for a particular collection.
|
||||
</para>
|
||||
<para>
|
||||
See the reference in <headername>boost/algorithm/string/find_iterator.hpp</headername>.
|
||||
|
@ -10,10 +10,9 @@
|
||||
#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.hpp>
|
||||
#include <boost/algorithm/string/replace.hpp>
|
||||
#include <boost/algorithm/string/erase.hpp>
|
||||
#include <boost/algorithm/string/case_conv.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,6 +12,7 @@
|
||||
#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>
|
||||
@ -35,7 +36,7 @@ int main()
|
||||
It!=string_find_iterator();
|
||||
++It)
|
||||
{
|
||||
cout << copy_range<std::string>(*It) << endl;
|
||||
cout << copy_iterator_range<std::string>(*It) << endl;
|
||||
// shift all chars in the match by one
|
||||
transform(
|
||||
It->begin(), It->end(),
|
||||
|
@ -17,7 +17,15 @@ DEPENDS all : test ;
|
||||
|
||||
{
|
||||
test-suite algorithm/string
|
||||
: [ run
|
||||
: [ run
|
||||
container_test.cpp
|
||||
: :
|
||||
:
|
||||
std::locale-support
|
||||
std::facet-support
|
||||
: container
|
||||
]
|
||||
[ run
|
||||
trim_test.cpp
|
||||
: :
|
||||
:
|
||||
|
@ -10,7 +10,13 @@
|
||||
import testing ;
|
||||
|
||||
test-suite algorithm/string
|
||||
: [ run
|
||||
: [ run
|
||||
container_test.cpp
|
||||
: :
|
||||
:
|
||||
: container
|
||||
]
|
||||
[ run
|
||||
trim_test.cpp
|
||||
: :
|
||||
:
|
||||
|
127
string/test/container_test.cpp
Normal file
127
string/test/container_test.cpp
Normal file
@ -0,0 +1,127 @@
|
||||
// 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=="" );
|
||||
|
||||
delete[] pch1;
|
||||
delete[] pch2;
|
||||
free(pch1);
|
||||
free(pch2);
|
||||
}
|
||||
|
||||
// test main
|
||||
|
@ -28,7 +28,7 @@ void find_test()
|
||||
string str1("123abcxXxabcXxXabc321");
|
||||
string str2("abc");
|
||||
string str3("");
|
||||
const char* pch1="123abcxxxabcXXXabc321";
|
||||
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");
|
||||
const char* pch1="123a1cxxxa23cXXXa456c321";
|
||||
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-xx");
|
||||
string str2("Xx-abc--xX-abb");
|
||||
string str3("xx");
|
||||
const char* pch1="xx-abc--xx-abb";
|
||||
char* pch1="xx-abc--xx-abb";
|
||||
vector<string> tokens;
|
||||
vector< vector<int> > vtokens;
|
||||
|
||||
@ -59,10 +59,9 @@ void iterator_test()
|
||||
str2,
|
||||
"xx" );
|
||||
|
||||
BOOST_REQUIRE( tokens.size()==3 );
|
||||
BOOST_REQUIRE( tokens.size()==2 );
|
||||
BOOST_CHECK( tokens[0]==string("Xx") );
|
||||
BOOST_CHECK( tokens[1]==string("xX") );
|
||||
BOOST_CHECK( tokens[2]==string("xx") );
|
||||
|
||||
find_all(
|
||||
tokens,
|
||||
@ -82,15 +81,14 @@ void iterator_test()
|
||||
// split tests
|
||||
split(
|
||||
tokens,
|
||||
str2,
|
||||
is_any_of("xX"),
|
||||
str1,
|
||||
is_any_of("x"),
|
||||
token_compress_on );
|
||||
|
||||
BOOST_REQUIRE( tokens.size()==4 );
|
||||
BOOST_REQUIRE( tokens.size()==3 );
|
||||
BOOST_CHECK( tokens[0]==string("") );
|
||||
BOOST_CHECK( tokens[1]==string("-abc--") );
|
||||
BOOST_CHECK( tokens[2]==string("-abb-") );
|
||||
BOOST_CHECK( tokens[3]==string("") );
|
||||
BOOST_CHECK( tokens[2]==string("-abb") );
|
||||
|
||||
split(
|
||||
tokens,
|
||||
|
Reference in New Issue
Block a user