Library adapted to use official Boost.Range instead of the internal version

Internal version removed


[SVN r26787]
This commit is contained in:
Pavol Droba
2005-01-21 16:45:29 +00:00
parent 54092d7934
commit aea6f39c11
30 changed files with 212 additions and 1331 deletions

View File

@ -14,7 +14,11 @@
#include <algorithm>
#include <locale>
#include <boost/iterator/transform_iterator.hpp>
#include <boost/algorithm/string/collection_traits.hpp>
#include <boost/range/begin.hpp>
#include <boost/range/end.hpp>
#include <boost/range/value_type.hpp>
#include <boost/algorithm/string/detail/case_conv.hpp>
/*! \file
@ -56,7 +60,7 @@ namespace boost {
end(Input),
Output,
detail::to_lowerF<
typename value_type_of<CollectionT>::type >(Loc));
typename range_value<CollectionT>::type >(Loc));
}
//! Convert to lower case
@ -72,11 +76,11 @@ namespace boost {
make_transform_iterator(
begin(Input),
detail::to_lowerF<
typename value_type_of<SequenceT>::type >(Loc)),
typename range_value<SequenceT>::type >(Loc)),
make_transform_iterator(
end(Input),
detail::to_lowerF<
typename value_type_of<SequenceT>::type >(Loc)));
typename range_value<SequenceT>::type >(Loc)));
}
//! Convert to lower case
@ -97,7 +101,7 @@ namespace boost {
end(Input),
begin(Input),
detail::to_lowerF<
typename value_type_of<MutableCollectionT>::type >(Loc));
typename range_value<MutableCollectionT>::type >(Loc));
}
// to_upper -----------------------------------------------//
@ -129,7 +133,7 @@ namespace boost {
end(Input),
Output,
detail::to_upperF<
typename value_type_of<CollectionT>::type >(Loc));
typename range_value<CollectionT>::type >(Loc));
}
//! Convert to upper case
@ -145,11 +149,11 @@ namespace boost {
make_transform_iterator(
begin(Input),
detail::to_upperF<
typename value_type_of<SequenceT>::type >(Loc)),
typename range_value<SequenceT>::type >(Loc)),
make_transform_iterator(
end(Input),
detail::to_upperF<
typename value_type_of<SequenceT>::type >(Loc)));
typename range_value<SequenceT>::type >(Loc)));
}
@ -171,7 +175,7 @@ namespace boost {
end(Input),
begin(Input),
detail::to_upperF<
typename value_type_of<MutableCollectionT>::type >(Loc));
typename range_value<MutableCollectionT>::type >(Loc));
}
} // namespace algorithm

View File

@ -12,6 +12,7 @@
#include <algorithm>
#include <locale>
#include <boost/range/value_type.hpp>
#include <boost/algorithm/string/detail/classification.hpp>
#include <boost/algorithm/string/predicate_facade.hpp>
@ -195,11 +196,11 @@ namespace boost {
*/
template<typename ContainerT>
inline detail::is_any_ofF<
BOOST_STRING_TYPENAME value_type_of<ContainerT>::type>
BOOST_STRING_TYPENAME range_value<ContainerT>::type>
is_any_of( const ContainerT& Set )
{
return detail::is_any_ofF<
BOOST_STRING_TYPENAME value_type_of<ContainerT>::type>(Set);
BOOST_STRING_TYPENAME range_value<ContainerT>::type>(Set);
}
//! is_from_range predicate

View File

@ -1,266 +0,0 @@
// Boost string_algo library collection_traits.hpp header file -------------//
// Copyright Pavol Droba 2002-2003. Use, modification and
// distribution is subject to the Boost Software License, Version
// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// (C) Copyright Thorsten Ottosen 2002-2003. Use, modification and
// distribution is subject to the Boost Software License, Version
// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// (C) Copyright Jeremy Siek 2001. Use, modification and
// distribution is subject to the Boost Software License, Version
// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// Original idea of container traits was proposed by Jeremy Siek and
// Thorsten Ottosen. This implementation is lightweighted version
// of container_traits adapter for usage with string_algo library
#ifndef BOOST_STRING_COLLECTION_TRAITS_HPP
#define BOOST_STRING_COLLECTION_TRAITS_HPP
#include <boost/algorithm/string/config.hpp>
#include <boost/type_traits/is_array.hpp>
#include <boost/type_traits/is_pointer.hpp>
#include <boost/mpl/eval_if.hpp>
// Implementation
#include <boost/algorithm/string/detail/collection_traits.hpp>
/*! \file
Defines collection_traits class and related free-standing functions.
This facility is used to unify the access to different types of collections.
It allows the algorithms in the library to work with STL collections, c-style
array, null-terminated c-strings (and more) using the same interface.
*/
namespace boost {
namespace algorithm {
// collection_traits template class -----------------------------------------//
//! collection_traits class
/*!
Collection traits provide uniform access to different types of
collections. This functionality allows to write generic algorithms
which work with several different kinds of collections.
Currently following collection types are supported:
- containers with STL compatible container interface ( see ContainerConcept )
( i.e. \c std::vector<>, \c std::list<>, \c std::string<> ... )
- c-style array
( \c char[10], \c int[15] ... )
- null-terminated c-strings
( \c char*, \c wchar_T* )
- std::pair of iterators
( i.e \c std::pair<vector<int>::iterator,vector<int>::iterator> )
Collection traits provide an external collection interface operations.
All are accessible using free-standing functions.
The following operations are supported:
- \c size()
- \c empty()
- \c begin()
- \c end()
Container traits have somewhat limited functionality on compilers not
supporting partial template specialization and partial template ordering.
*/
template< typename T >
struct collection_traits
{
private:
typedef BOOST_STRING_TYPENAME ::boost::mpl::eval_if<
::boost::algorithm::detail::is_pair<T>,
detail::pair_container_traits_selector<T>,
BOOST_STRING_TYPENAME ::boost::mpl::eval_if<
::boost::is_array<T>,
detail::array_container_traits_selector<T>,
BOOST_STRING_TYPENAME ::boost::mpl::eval_if<
::boost::is_pointer<T>,
detail::pointer_container_traits_selector<T>,
detail::default_container_traits_selector<T>
>
>
>::type container_helper_type;
public:
//! Function type
typedef container_helper_type function_type;
//! Value type
typedef BOOST_STRING_TYPENAME
container_helper_type::value_type value_type;
//! Size type
typedef BOOST_STRING_TYPENAME
container_helper_type::size_type size_type;
//! Iterator type
typedef BOOST_STRING_TYPENAME
container_helper_type::iterator iterator;
//! Const iterator type
typedef BOOST_STRING_TYPENAME
container_helper_type::const_iterator const_iterator;
//! Result iterator type ( iterator of const_iterator, depending on the constness of the container )
typedef BOOST_STRING_TYPENAME
container_helper_type::result_iterator result_iterator;
//! Difference type
typedef BOOST_STRING_TYPENAME
container_helper_type::difference_type difference_type;
}; // 'collection_traits'
// collection_traits metafunctions -----------------------------------------//
//! Container value_type trait
/*!
Extract the type of elements contained in a container
*/
template< typename C >
struct value_type_of
{
typedef BOOST_STRING_TYPENAME collection_traits<C>::value_type type;
};
//! Container difference trait
/*!
Extract the container's difference type
*/
template< typename C >
struct difference_type_of
{
typedef BOOST_STRING_TYPENAME collection_traits<C>::difference_type type;
};
//! Container iterator trait
/*!
Extract the container's iterator type
*/
template< typename C >
struct iterator_of
{
typedef BOOST_STRING_TYPENAME collection_traits<C>::iterator type;
};
//! Container const_iterator trait
/*!
Extract the container's const_iterator type
*/
template< typename C >
struct const_iterator_of
{
typedef BOOST_STRING_TYPENAME collection_traits<C>::const_iterator type;
};
//! Container result_iterator
/*!
Extract the container's result_iterator type. This type maps to \c C::iterator
for mutable container and \c C::const_iterator for const containers.
*/
template< typename C >
struct result_iterator_of
{
typedef BOOST_STRING_TYPENAME collection_traits<C>::result_iterator type;
};
// collection_traits related functions -----------------------------------------//
//! Free-standing size() function
/*!
Get the size of the container. Uses collection_traits.
*/
template< typename C >
inline BOOST_STRING_TYPENAME collection_traits<C>::size_type
size( const C& c )
{
return collection_traits<C>::function_type::size( c );
}
//! Free-standing empty() function
/*!
Check whether the container is empty. Uses container traits.
*/
template< typename C >
inline bool empty( const C& c )
{
return collection_traits<C>::function_type::empty( c );
}
#ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
//! Free-standing begin() function
/*!
Get the begin iterator of the container. Uses collection_traits.
*/
template< typename C >
inline BOOST_STRING_TYPENAME collection_traits<C>::iterator
begin( C& c )
{
return collection_traits<C>::function_type::begin( c );
}
//! Free-standing begin() function
/*!
\overload
*/
template< typename C >
inline BOOST_STRING_TYPENAME collection_traits<C>::const_iterator
begin( const C& c )
{
return collection_traits<C>::function_type::begin( c );
}
//! Free-standing end() function
/*!
Get the begin iterator of the container. Uses collection_traits.
*/
template< typename C >
inline BOOST_STRING_TYPENAME collection_traits<C>::iterator
end( C& c )
{
return collection_traits<C>::function_type::end( c );
}
//! Free-standing end() function
/*!
\overload
*/
template< typename C >
inline BOOST_STRING_TYPENAME collection_traits<C>::const_iterator
end( const C& c )
{
return collection_traits<C>::function_type::end( c );
}
#else // BOOST_NO_FUNCTION_TEMPLATE_ORDERING
//! Free-standing begin() function
/*!
\overload
*/
template< typename C >
inline BOOST_STRING_TYPENAME collection_traits<C>::result_iterator
begin( C& c )
{
return collection_traits<C>::function_type::begin( c );
}
//! Free-standing end() function
/*!
\overload
*/
template< typename C >
inline BOOST_STRING_TYPENAME collection_traits<C>::result_iterator
end( C& c )
{
return collection_traits<C>::function_type::end( c );
}
#endif // BOOST_NO_FUNCTION_TEMPLATE_ORDERING
} // namespace algorithm
} // namespace boost
#endif // BOOST_STRING_COLLECTION_TRAITS_HPP

View File

@ -11,8 +11,9 @@
#define BOOST_STRING_CONCEPT_HPP
#include <boost/concept_check.hpp>
#include <boost/algorithm/string/iterator_range.hpp>
#include <boost/algorithm/string/collection_traits.hpp>
#include <boost/range/iterator_range.hpp>
#include <boost/range/begin.hpp>
#include <boost/range/end.hpp>
/*! \file
Defines concepts used in string_algo library

View File

@ -15,7 +15,10 @@
#include <functional>
#include <locale>
#include <set>
#include <boost/algorithm/string/collection_traits.hpp>
#include <boost/range/begin.hpp>
#include <boost/range/end.hpp>
#include <boost/algorithm/string/predicate_facade.hpp>
#include <boost/type_traits/remove_const.hpp>

View File

@ -1,621 +0,0 @@
// Boost string_algo library collection_traits.hpp header file -----------------------//
// Copyright Pavol Droba 2002-2003. Use, modification and
// distribution is subject to the Boost Software License, Version
// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org for updates, documentation, and revision history.
#ifndef BOOST_STRING_DETAIL_COLLECTION_TRAITS_HPP
#define BOOST_STRING_DETAIL_COLLECTION_TRAITS_HPP
#include <boost/algorithm/string/config.hpp>
#include <cstddef>
#include <string>
#include <boost/type_traits/is_array.hpp>
#include <boost/type_traits/is_pointer.hpp>
#include <boost/type_traits/is_const.hpp>
#include <boost/type_traits/is_convertible.hpp>
#include <boost/type_traits/remove_pointer.hpp>
#include <boost/type_traits/remove_cv.hpp>
#include <boost/mpl/eval_if.hpp>
#include <boost/mpl/identity.hpp>
#include <boost/mpl/vector.hpp>
#include <boost/mpl/fold.hpp>
#include <boost/detail/iterator.hpp>
#include <boost/algorithm/string/yes_no_type.hpp>
// Container traits implementation ---------------------------------------------------------
namespace boost {
namespace algorithm {
namespace detail {
// Default collection traits -----------------------------------------------------------------
// Default collection helper
/*
Wraps std::container compliant containers
*/
template< typename ContainerT >
struct default_container_traits
{
typedef BOOST_STRING_TYPENAME ContainerT::value_type value_type;
typedef BOOST_STRING_TYPENAME ContainerT::iterator iterator;
typedef BOOST_STRING_TYPENAME ContainerT::const_iterator const_iterator;
typedef BOOST_STRING_TYPENAME
::boost::mpl::if_< ::boost::is_const<ContainerT>,
const_iterator,
iterator
>::type result_iterator;
typedef BOOST_STRING_TYPENAME ContainerT::difference_type difference_type;
typedef BOOST_STRING_TYPENAME ContainerT::size_type size_type;
// static operations
template< typename C >
static size_type size( const C& c )
{
return c.size();
}
template< typename C >
static bool empty( const C& c )
{
return c.empty();
}
#ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
template< typename C >
static iterator begin( C& c )
{
return c.begin();
}
template< typename C >
static const_iterator begin( const C& c )
{
return c.begin();
}
template< typename C >
static iterator end( C& c )
{
return c.end();
}
template< typename C >
static const_iterator end( const C& c )
{
return c.end();
}
#else // BOOST_NO_FUNCTION_TEMPLATE_ORDERING
template< typename C >
static result_iterator begin( C& c )
{
return c.begin();
}
template< typename C >
static result_iterator end( C& c )
{
return c.end();
}
#endif // BOOST_NO_FUNCTION_TEMPLATE_ORDERING
};
template<typename T>
struct default_container_traits_selector
{
typedef default_container_traits<T> type;
};
// Pair container traits ---------------------------------------------------------------------
// pair selector
template< typename T, typename U >
yes_type is_pair_impl( const std::pair<T,U>* );
no_type is_pair_impl( ... );
template<typename T> struct is_pair
{
private:
static T* t;
public:
BOOST_STATIC_CONSTANT( bool, value=
sizeof(is_pair_impl(t))==sizeof(yes_type) );
};
// pair helper
template< typename PairT >
struct pair_container_traits
{
typedef BOOST_STRING_TYPENAME PairT::first_type element_type;
typedef BOOST_STRING_TYPENAME ::boost::detail::
iterator_traits<element_type>::value_type value_type;
typedef std::size_t size_type;
typedef BOOST_STRING_TYPENAME ::boost::detail::
iterator_traits<element_type>::difference_type difference_type;
typedef element_type iterator;
typedef element_type const_iterator;
typedef element_type result_iterator;
// static operations
template< typename P >
static size_type size( const P& p )
{
difference_type diff = std::distance( p.first, p.second );
if ( diff < 0 )
return 0;
else
return diff;
}
template< typename P >
static bool empty( const P& p )
{
return p.first==p.second;
}
template< typename P >
static const_iterator begin( const P& p )
{
return p.first;
}
template< typename P >
static const_iterator end( const P& p )
{
return p.second;
}
}; // 'pair_container_helper'
template<typename T>
struct pair_container_traits_selector
{
typedef pair_container_traits<T> type;
};
// Array container traits ---------------------------------------------------------------
#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
// array traits ( partial specialization )
template< typename T >
struct array_traits;
template< typename T, std::size_t sz >
struct array_traits<T[sz]>
{
// typedef
typedef T* iterator;
typedef const T* const_iterator;
typedef T value_type;
typedef std::size_t size_type;
typedef std::ptrdiff_t difference_type;
// size of the array ( static );
BOOST_STATIC_CONSTANT( size_type, array_size = sz );
};
#else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
// array traits ( no partial specialization )
/*
without parial specialization we are able to
provide support only for a limited number of
types. Currently the primitive numeric types
are supported
*/
template< typename T, typename BaseT >
struct array_traits_impl
{
typedef BaseT value_type;
typedef BaseT* iterator;
typedef const BaseT* const_iterator;
typedef std::size_t size_type;
typedef std::ptrdiff_t difference_type;
// size of the array
BOOST_STATIC_CONSTANT( size_type, array_size = sizeof(T)/sizeof(BaseT) );
};
template< typename T, typename BaseT >
struct array_traits_impl_selector
{
typedef array_traits_impl<T,BaseT> type;
};
struct array_traits_void
{
typedef void type;
};
template< typename T, typename BaseT >
struct array_traits_cv_selector
{
typedef BOOST_STRING_TYPENAME
::boost::mpl::eval_if<
::boost::is_convertible<T,BaseT*>,
array_traits_impl_selector<T,BaseT>,
::boost::mpl::eval_if<
::boost::is_convertible<T,const BaseT*>,
array_traits_impl_selector<T, const BaseT>,
::boost::mpl::eval_if<
::boost::is_convertible<T, volatile BaseT*>,
array_traits_impl_selector<T, volatile BaseT>,
array_traits_impl_selector<T, const volatile BaseT>
>
>
>::type type;
};
template< typename T >
struct array_traits_select
{
template< typename T1, typename T2 >
struct apply
{
typedef BOOST_STRING_TYPENAME
::boost::mpl::eval_if<
::boost::is_convertible<T,const volatile T2*>,
array_traits_cv_selector<T,T2>,
::boost::mpl::identity<T1> >::type type;
};
};
template< typename T >
struct array_traits_selector
{
private:
// supported array base types
#ifndef BOOST_NO_INTRINSIC_WCHAR_T
typedef BOOST_STRING_TYPENAME
::boost::mpl::vector10<
wchar_t,
#else // BOOST_NO_INTRINSIC_WCHAR_T
typedef BOOST_STRING_TYPENAME
::boost::mpl::vector9<
#endif // BOOST_NO_INTRINSIC_WCHAR_T
char,
signed char,
unsigned char,
signed short,
unsigned short,
signed int,
unsigned int,
signed long,
unsigned long
>::type array_base_types;
public:
typedef BOOST_STRING_TYPENAME
::boost::mpl::fold<
array_base_types,
::boost::algorithm::detail::array_traits_void,
::boost::algorithm::detail::array_traits_select<T> >::type type;
};
template< typename T >
struct array_traits
{
typedef BOOST_STRING_TYPENAME
array_traits_selector<T>::type traits_type;
typedef BOOST_STRING_TYPENAME
traits_type::value_type value_type;
typedef BOOST_STRING_TYPENAME
traits_type::iterator iterator;
typedef BOOST_STRING_TYPENAME
traits_type::const_iterator const_iterator;
typedef BOOST_STRING_TYPENAME
traits_type::size_type size_type;
typedef BOOST_STRING_TYPENAME
traits_type::difference_type difference_type;
BOOST_STATIC_CONSTANT( size_type, array_size = traits_type::array_size );
};
#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
// array lenght resolving
/*
Lenght of string contained in a static array could
be different from the size of the array.
For string processing we need the lenght without
terminating 0.
Therefore, the lenght is calulated for char and wchar_t
using char_traits, rather then simply returning
the array size.
*/
template< typename T >
struct array_length_selector
{
template< typename TraitsT >
struct array_length
{
typedef BOOST_STRING_TYPENAME
TraitsT::size_type size_type;
BOOST_STATIC_CONSTANT(
size_type,
array_size=TraitsT::array_size );
template< typename A >
static size_type length( const A& )
{
return array_size;
}
template< typename A >
static bool empty( const A& )
{
return array_size==0;
}
};
};
// specialization for char
template<>
struct array_length_selector<char>
{
template< typename TraitsT >
struct array_length
{
typedef BOOST_STRING_TYPENAME
TraitsT::size_type size_type;
template< typename A >
static size_type length( const A& a )
{
if ( a==0 )
return 0;
else
return std::char_traits<char>::length(a);
}
template< typename A >
static bool empty( const A& a )
{
return a==0 || a[0]==0;
}
};
};
// specialization for wchar_t
template<>
struct array_length_selector<wchar_t>
{
template< typename TraitsT >
struct array_length
{
typedef BOOST_STRING_TYPENAME
TraitsT::size_type size_type;
template< typename A >
static size_type length( const A& a )
{
if ( a==0 )
return 0;
else
return std::char_traits<wchar_t>::length(a);
}
template< typename A >
static bool empty( const A& a )
{
return a==0 || a[0]==0;
}
};
};
template< typename T >
struct array_container_traits
{
private:
// resolve array traits
typedef array_traits<T> traits_type;
public:
typedef BOOST_STRING_TYPENAME
traits_type::value_type value_type;
typedef BOOST_STRING_TYPENAME
traits_type::iterator iterator;
typedef BOOST_STRING_TYPENAME
traits_type::const_iterator const_iterator;
typedef BOOST_STRING_TYPENAME
traits_type::size_type size_type;
typedef BOOST_STRING_TYPENAME
traits_type::difference_type difference_type;
typedef BOOST_STRING_TYPENAME
::boost::mpl::if_< ::boost::is_const<T>,
const_iterator,
iterator
>::type result_iterator;
private:
// resolve array size
typedef BOOST_STRING_TYPENAME
::boost::remove_cv<value_type>::type char_type;
typedef BOOST_STRING_TYPENAME
array_length_selector<char_type>::
BOOST_NESTED_TEMPLATE array_length<traits_type> array_length_type;
public:
BOOST_STATIC_CONSTANT( size_type, array_size = traits_type::array_size );
// static operations
template< typename A >
static size_type size( const A& a )
{
return array_length_type::length(a);
}
template< typename A >
static bool empty( const A& a )
{
return array_length_type::empty(a);
}
#ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
template< typename A >
static iterator begin( A& a )
{
return a;
}
template< typename A >
static const_iterator begin( const A& a )
{
return a;
}
template< typename A >
static iterator end( A& a )
{
return a+array_length_type::length(a);
}
template< typename A >
static const_iterator end( const A& a )
{
return a+array_length_type::length(a);
}
#else // BOOST_NO_FUNCTION_TEMPLATE_ORDERING
template< typename A >
static result_iterator begin( A& a )
{
return a;
}
template< typename A >
static result_iterator end( A& a )
{
return a+array_length_type::length(a);
}
#endif // BOOST_NO_FUNCTION_TEMPLATE_ORDERING
};
template<typename T>
struct array_container_traits_selector
{
typedef array_container_traits<T> type;
};
// Pointer container traits ---------------------------------------------------------------
template<typename T>
struct pointer_container_traits
{
typedef BOOST_STRING_TYPENAME
::boost::remove_pointer<T>::type value_type;
typedef BOOST_STRING_TYPENAME
::boost::remove_cv<value_type>::type char_type;
typedef ::std::char_traits<char_type> char_traits;
typedef value_type* iterator;
typedef const value_type* const_iterator;
typedef std::ptrdiff_t difference_type;
typedef std::size_t size_type;
typedef BOOST_STRING_TYPENAME
::boost::mpl::if_< ::boost::is_const<T>,
const_iterator,
iterator
>::type result_iterator;
// static operations
template< typename P >
static size_type size( const P& p )
{
if ( p==0 )
return 0;
else
return char_traits::length(p);
}
template< typename P >
static bool empty( const P& p )
{
return p==0 || p[0]==0;
}
#ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
template< typename P >
static iterator begin( P& p )
{
return p;
}
template< typename P >
static const_iterator begin( const P& p )
{
return p;
}
template< typename P >
static iterator end( P& p )
{
if ( p==0 )
return p;
else
return p+char_traits::length(p);
}
template< typename P >
static const_iterator end( const P& p )
{
if ( p==0 )
return p;
else
return p+char_traits::length(p);
}
#else // BOOST_NO_FUNCTION_TEMPLATE_ORDERING
template< typename P >
static result_iterator begin( P& p )
{
return p;
}
template< typename P >
static result_iterator end( P& p )
{
if ( p==0 )
return p;
else
return p+char_traits::length(p);
}
#endif // BOOST_NO_FUNCTION_TEMPLATE_ORDERING
};
template<typename T>
struct pointer_container_traits_selector
{
typedef pointer_container_traits<T> type;
};
} // namespace detail
} // namespace algorithm
} // namespace boost
#endif // BOOST_STRING_DETAIL_COLLECTION_HPP

View File

@ -11,7 +11,9 @@
#define BOOST_STRING_FIND_FORMAT_DETAIL_HPP
#include <boost/algorithm/string/config.hpp>
#include <boost/algorithm/string/iterator_range.hpp>
#include <boost/range/iterator_range.hpp>
#include <boost/range/const_iterator.hpp>
#include <boost/range/iterator.hpp>
#include <boost/algorithm/string/detail/find_format_store.hpp>
#include <boost/algorithm/string/detail/replace_storage.hpp>
@ -60,7 +62,7 @@ namespace boost {
{
typedef find_format_store<
BOOST_STRING_TYPENAME
const_iterator_of<InputT>::type,
range_const_iterator<InputT>::type,
FormatterT,
FormatResultT > store_type;
@ -121,7 +123,7 @@ namespace boost {
{
typedef find_format_store<
BOOST_STRING_TYPENAME
const_iterator_of<InputT>::type,
range_const_iterator<InputT>::type,
FormatterT,
FormatResultT > store_type;
@ -181,7 +183,7 @@ namespace boost {
{
typedef find_format_store<
BOOST_STRING_TYPENAME
iterator_of<InputT>::type,
range_iterator<InputT>::type,
FormatterT,
FormatResultT > store_type;

View File

@ -11,7 +11,9 @@
#define BOOST_STRING_FIND_FORMAT_ALL_DETAIL_HPP
#include <boost/algorithm/string/config.hpp>
#include <boost/algorithm/string/iterator_range.hpp>
#include <boost/range/iterator_range.hpp>
#include <boost/range/const_iterator.hpp>
#include <boost/range/value_type.hpp>
#include <boost/algorithm/string/detail/find_format_store.hpp>
#include <boost/algorithm/string/detail/replace_storage.hpp>
@ -59,7 +61,7 @@ namespace boost {
const FormatResultT& FormatResult )
{
typedef BOOST_STRING_TYPENAME
const_iterator_of<InputT>::type input_iterator_type;
range_const_iterator<InputT>::type input_iterator_type;
typedef find_format_store<
input_iterator_type,
@ -72,7 +74,7 @@ namespace boost {
// Initialize last match
input_iterator_type LastMatch=begin(Input);
// Iterate throug all matches
// Iterate through all matches
while( M )
{
// Copy the beginning of the sequence
@ -126,7 +128,7 @@ namespace boost {
const FormatResultT& FormatResult)
{
typedef BOOST_STRING_TYPENAME
const_iterator_of<InputT>::type input_iterator_type;
range_const_iterator<InputT>::type input_iterator_type;
typedef find_format_store<
input_iterator_type,
@ -142,7 +144,7 @@ namespace boost {
// Output temporary
InputT Output;
// Iterate throug all matches
// Iterate through all matches
while( M )
{
// Copy the beginning of the sequence
@ -196,7 +198,7 @@ namespace boost {
FormatResultT FormatResult)
{
typedef BOOST_STRING_TYPENAME
iterator_of<InputT>::type input_iterator_type;
range_iterator<InputT>::type input_iterator_type;
typedef find_format_store<
input_iterator_type,
FormatterT,
@ -207,7 +209,7 @@ namespace boost {
// Instantiate replacement storage
std::deque<
BOOST_STRING_TYPENAME value_type_of<InputT>::type> Storage;
BOOST_STRING_TYPENAME range_value<InputT>::type> Storage;
// Initialize replacement iterators
input_iterator_type InsertIt=begin(Input);

View File

@ -11,8 +11,7 @@
#define BOOST_STRING_FIND_FORMAT_STORE_DETAIL_HPP
#include <boost/algorithm/string/config.hpp>
#include <boost/algorithm/string/collection_traits.hpp>
#include <boost/algorithm/string/iterator_range.hpp>
#include <boost/range/iterator_range.hpp>
namespace boost {
namespace algorithm {

View File

@ -11,7 +11,7 @@
#define BOOST_STRING_FIND_ITERATOR_DETAIL_HPP
#include <boost/algorithm/string/config.hpp>
#include <boost/algorithm/string/iterator_range.hpp>
#include <boost/range/iterator_range.hpp>
#include <boost/iterator/iterator_facade.hpp>
#include <boost/iterator/iterator_categories.hpp>
#include <boost/function.hpp>

View File

@ -13,8 +13,11 @@
#include <boost/algorithm/string/config.hpp>
#include <boost/algorithm/string/constants.hpp>
#include <boost/detail/iterator.hpp>
#include <boost/algorithm/string/collection_traits.hpp>
#include <boost/algorithm/string/iterator_range.hpp>
#include <boost/range/iterator_range.hpp>
#include <boost/range/begin.hpp>
#include <boost/range/end.hpp>
#include <boost/range/empty.hpp>
namespace boost {
namespace algorithm {
@ -59,7 +62,7 @@ namespace boost {
++OuterIt)
{
// Sanity check
if( empty(m_Search) )
if( boost::empty(m_Search) )
return result_type( End, End );
input_iterator_type InnerIt=OuterIt;
@ -119,7 +122,7 @@ namespace boost {
{
typedef iterator_range<ForwardIteratorT> result_type;
if( empty(m_Search) )
if( boost::empty(m_Search) )
return result_type( End, End );
typedef BOOST_STRING_TYPENAME boost::detail::
@ -239,7 +242,7 @@ namespace boost {
typedef iterator_range<ForwardIteratorT> result_type;
// Sanity check
if( empty(m_Search) )
if( boost::empty(m_Search) )
return result_type( End, End );
// Instantiate find funtor

View File

@ -12,8 +12,10 @@
#include <boost/algorithm/string/config.hpp>
#include <boost/regex.hpp>
#include <boost/algorithm/string/iterator_range.hpp>
#include <boost/algorithm/string/collection_traits.hpp>
#include <boost/range/iterator_range.hpp>
#include <boost/range/begin.hpp>
#include <boost/range/end.hpp>
namespace boost {
namespace algorithm {
@ -29,7 +31,6 @@ namespace boost {
typedef regex_search_result<IteratorT> type;
typedef iterator_range<IteratorT> base_type;
typedef BOOST_STRING_TYPENAME base_type::value_type value_type;
typedef BOOST_STRING_TYPENAME base_type::reference reference;
typedef BOOST_STRING_TYPENAME base_type::difference_type difference_type;
typedef BOOST_STRING_TYPENAME base_type::const_iterator const_iterator;
typedef BOOST_STRING_TYPENAME base_type::iterator iterator;

View File

@ -10,8 +10,12 @@
#ifndef BOOST_STRING_FORMATTER_DETAIL_HPP
#define BOOST_STRING_FORMATTER_DETAIL_HPP
#include <boost/algorithm/string/collection_traits.hpp>
#include <boost/algorithm/string/iterator_range.hpp>
#include <boost/range/iterator_range.hpp>
#include <boost/range/begin.hpp>
#include <boost/range/end.hpp>
#include <boost/range/const_iterator.hpp>
#include <boost/algorithm/string/detail/util.hpp>
// generic replace functors -----------------------------------------------//
@ -28,7 +32,7 @@ namespace boost {
{
private:
typedef BOOST_STRING_TYPENAME
const_iterator_of<CollectionT>::type format_iterator;
range_const_iterator<CollectionT>::type format_iterator;
typedef iterator_range<format_iterator> result_type;
public:

View File

@ -13,9 +13,7 @@
#include <boost/algorithm/string/config.hpp>
#include <algorithm>
#include <boost/mpl/bool.hpp>
#include <boost/algorithm/string/collection_traits.hpp>
#include <boost/algorithm/string/sequence_traits.hpp>
#include <boost/algorithm/string/iterator_range.hpp>
#include <boost/algorithm/string/detail/sequence.hpp>
namespace boost {

View File

@ -13,7 +13,9 @@
#include <boost/algorithm/string/config.hpp>
#include <boost/mpl/bool.hpp>
#include <boost/mpl/logical.hpp>
#include <boost/algorithm/string/collection_traits.hpp>
#include <boost/range/begin.hpp>
#include <boost/range/end.hpp>
#include <boost/algorithm/string/sequence_traits.hpp>
namespace boost {

View File

@ -12,6 +12,7 @@
#include <boost/algorithm/string/config.hpp>
#include <functional>
#include <boost/range/iterator_range.hpp>
namespace boost {
namespace algorithm {
@ -22,7 +23,7 @@ namespace boost {
// empty_container
/*
This class represents always empty container,
containing elemets of type CharT.
containing elements of type CharT.
It is supposed to be used in a const version only
*/
@ -92,7 +93,7 @@ namespace boost {
{
SeqT operator()( const iterator_range<IteratorT>& Range ) const
{
return copy_iterator_range<SeqT>(Range);
return copy_range<SeqT>(Range);
}
};

View File

@ -11,8 +11,13 @@
#define BOOST_STRING_ERASE_HPP
#include <boost/algorithm/string/config.hpp>
#include <boost/algorithm/string/collection_traits.hpp>
#include <boost/algorithm/string/iterator_range.hpp>
#include <boost/range/iterator_range.hpp>
#include <boost/range/begin.hpp>
#include <boost/range/end.hpp>
#include <boost/range/iterator.hpp>
#include <boost/range/const_iterator.hpp>
#include <boost/algorithm/string/find_format.hpp>
#include <boost/algorithm/string/finder.hpp>
#include <boost/algorithm/string/formatter.hpp>
@ -46,7 +51,7 @@ namespace boost {
const CollectionT& Input,
const iterator_range<
BOOST_STRING_TYPENAME
const_iterator_of<CollectionT>::type>& SearchRange )
range_const_iterator<CollectionT>::type>& SearchRange )
{
return find_format_copy(
Output,
@ -64,7 +69,7 @@ namespace boost {
const SequenceT& Input,
const iterator_range<
BOOST_STRING_TYPENAME
const_iterator_of<SequenceT>::type>& SearchRange )
range_const_iterator<SequenceT>::type>& SearchRange )
{
return find_format_copy(
Input,
@ -85,7 +90,7 @@ namespace boost {
SequenceT& Input,
const iterator_range<
BOOST_STRING_TYPENAME
iterator_of<SequenceT>::type>& SearchRange )
range_iterator<SequenceT>::type>& SearchRange )
{
find_format(
Input,
@ -97,7 +102,7 @@ namespace boost {
//! Erase first algorithm
/*!
Remove the first occurence of the substring from the input.
Remove the first occurrence of the substring from the input.
The result is a modified copy of the input. It is returned as a sequence
or copied to the output iterator.
@ -142,7 +147,7 @@ namespace boost {
//! Erase first algorithm
/*!
Remove the first occurence of the substring from the input.
Remove the first occurrence of the substring from the input.
The input sequence is modified in-place.
\param Input An input string
@ -163,7 +168,7 @@ namespace boost {
//! Erase first algorithm ( case insensitive )
/*!
Remove the first occurence of the substring from the input.
Remove the first occurrence of the substring from the input.
The result is a modified copy of the input. It is returned as a sequence
or copied to the output iterator.
Searching is case insensitive.
@ -212,7 +217,7 @@ namespace boost {
//! Erase first algorithm ( case insensitive )
/*!
Remove the first occurence of the substring from the input.
Remove the first occurrence of the substring from the input.
The input sequence is modified in-place. Searching is case insensitive.
\param Input An input string
@ -235,7 +240,7 @@ namespace boost {
//! Erase last algorithm
/*!
Remove the last occurence of the substring from the input.
Remove the last occurrence of the substring from the input.
The result is a modified copy of the input. It is returned as a sequence
or copied to the output iterator.
@ -280,7 +285,7 @@ namespace boost {
//! Erase last algorithm
/*!
Remove the last occurence of the substring from the input.
Remove the last occurrence of the substring from the input.
The input sequence is modified in-place.
\param Input An input string
@ -301,7 +306,7 @@ namespace boost {
//! Erase last algorithm ( case insensitive )
/*!
Remove the last occurence of the substring from the input.
Remove the last occurrence of the substring from the input.
The result is a modified copy of the input. It is returned as a sequence
or copied to the output iterator.
Searching is case insensitive.
@ -350,7 +355,7 @@ namespace boost {
//! Erase last algorithm ( case insensitive )
/*!
Remove the last occurence of the substring from the input.
Remove the last occurrence of the substring from the input.
The input sequence is modified in-place. Searching is case insensitive.
\param Input An input string
@ -373,7 +378,7 @@ namespace boost {
//! Erase nth algorithm
/*!
Remove the Nth occurence of the substring in the input.
Remove the Nth occurrence of the substring in the input.
The result is a modified copy of the input. It is returned as a sequence
or copied to the output iterator.
@ -422,7 +427,7 @@ namespace boost {
//! Erase nth algorithm
/*!
Remove the Nth occurence of the substring in the input.
Remove the Nth occurrence of the substring in the input.
The input sequence is modified in-place.
\param Input An input string
@ -445,7 +450,7 @@ namespace boost {
//! Erase nth algorithm ( case insensitive )
/*!
Remove the Nth occurence of the substring in the input.
Remove the Nth occurrence of the substring in the input.
The result is a modified copy of the input. It is returned as a sequence
or copied to the output iterator.
Searching is case insensitive.
@ -497,7 +502,7 @@ namespace boost {
//! Erase nth algorithm
/*!
Remove the Nth occurence of the substring in the input.
Remove the Nth occurrence of the substring in the input.
The input sequence is modified in-place. Searching is case insensitive.
\param Input An input string
@ -662,7 +667,7 @@ namespace boost {
//! Erase head algorithm
/*!
Remove the head from the input. The head is a prefix of a seqence of given size.
Remove the head from the input. The head is a prefix of a sequence of given size.
If the sequence is shorter then required, the whole string is
considered to be the head. The result is a modified copy of the input.
It is returned as a sequence or copied to the output iterator.
@ -708,7 +713,7 @@ namespace boost {
//! Erase head algorithm
/*!
Remove the head from the input. The head is a prefix of a seqence of given size.
Remove the head from the input. The head is a prefix of a sequence of given size.
If the sequence is shorter then required, the whole string is
considered to be the head. The input sequence is modified in-place.
@ -730,7 +735,7 @@ namespace boost {
//! Erase tail algorithm
/*!
Remove the tail from the input. The tail is a suffix of a seqence of given size.
Remove the tail from the input. The tail is a suffix of a sequence of given size.
If the sequence is shorter then required, the whole string is
considered to be the tail.
The result is a modified copy of the input. It is returned as a sequence
@ -776,7 +781,7 @@ namespace boost {
//! Erase tail algorithm
/*!
Remove the tail from the input. The tail is a suffix of a seqence of given size.
Remove the tail from the input. The tail is a suffix of a sequence of given size.
If the sequence is shorter then required, the whole string is
considered to be the tail. The input sequence is modified in-place.

View File

@ -11,8 +11,14 @@
#define BOOST_STRING_FIND_HPP
#include <boost/algorithm/string/config.hpp>
#include <boost/algorithm/string/collection_traits.hpp>
#include <boost/algorithm/string/iterator_range.hpp>
#include <boost/range/iterator_range.hpp>
#include <boost/range/begin.hpp>
#include <boost/range/end.hpp>
#include <boost/range/iterator.hpp>
#include <boost/range/const_iterator.hpp>
#include <boost/range/result_iterator.hpp>
#include <boost/algorithm/string/finder.hpp>
#include <boost/algorithm/string/compare.hpp>
#include <boost/algorithm/string/constants.hpp>
@ -42,7 +48,7 @@ namespace boost {
*/
template<typename CollectionT, typename FinderT>
inline iterator_range<
BOOST_STRING_TYPENAME result_iterator_of<CollectionT>::type>
BOOST_STRING_TYPENAME range_result_iterator<CollectionT>::type>
find(
CollectionT& Input,
FinderT Finder)
@ -68,7 +74,7 @@ namespace boost {
*/
template<typename Collection1T, typename Collection2T>
inline iterator_range<
BOOST_STRING_TYPENAME result_iterator_of<Collection1T>::type>
BOOST_STRING_TYPENAME range_result_iterator<Collection1T>::type>
find_first(
Collection1T& Input,
const Collection2T& Search)
@ -95,7 +101,7 @@ namespace boost {
*/
template<typename Collection1T, typename Collection2T>
inline iterator_range<
BOOST_STRING_TYPENAME result_iterator_of<Collection1T>::type>
BOOST_STRING_TYPENAME range_result_iterator<Collection1T>::type>
ifind_first(
Collection1T& Input,
const Collection2T& Search,
@ -123,7 +129,7 @@ namespace boost {
*/
template<typename Collection1T, typename Collection2T>
inline iterator_range<
BOOST_STRING_TYPENAME result_iterator_of<Collection1T>::type>
BOOST_STRING_TYPENAME range_result_iterator<Collection1T>::type>
find_last(
Collection1T& Input,
const Collection2T& Search)
@ -150,7 +156,7 @@ namespace boost {
*/
template<typename Collection1T, typename Collection2T>
inline iterator_range<
BOOST_STRING_TYPENAME result_iterator_of<Collection1T>::type>
BOOST_STRING_TYPENAME range_result_iterator<Collection1T>::type>
ifind_last(
Collection1T& Input,
const Collection2T& Search,
@ -178,7 +184,7 @@ namespace boost {
*/
template<typename Collection1T, typename Collection2T>
inline iterator_range<
BOOST_STRING_TYPENAME result_iterator_of<Collection1T>::type>
BOOST_STRING_TYPENAME range_result_iterator<Collection1T>::type>
find_nth(
Collection1T& Input,
const Collection2T& Search,
@ -208,7 +214,7 @@ namespace boost {
*/
template<typename Collection1T, typename Collection2T>
inline iterator_range<
BOOST_STRING_TYPENAME result_iterator_of<Collection1T>::type>
BOOST_STRING_TYPENAME range_result_iterator<Collection1T>::type>
ifind_nth(
Collection1T& Input,
const Collection2T& Search,
@ -239,7 +245,7 @@ namespace boost {
*/
template<typename CollectionT>
inline iterator_range<
BOOST_STRING_TYPENAME result_iterator_of<CollectionT>::type>
BOOST_STRING_TYPENAME range_result_iterator<CollectionT>::type>
find_head(
CollectionT& Input,
unsigned int N)
@ -269,7 +275,7 @@ namespace boost {
*/
template<typename CollectionT>
inline iterator_range<
BOOST_STRING_TYPENAME result_iterator_of<CollectionT>::type>
BOOST_STRING_TYPENAME range_result_iterator<CollectionT>::type>
find_tail(
CollectionT& Input,
unsigned int N)
@ -299,7 +305,7 @@ namespace boost {
*/
template<typename CollectionT, typename PredicateT>
inline iterator_range<
BOOST_STRING_TYPENAME result_iterator_of<CollectionT>::type>
BOOST_STRING_TYPENAME range_result_iterator<CollectionT>::type>
find_token(
CollectionT& Input,
PredicateT Pred,

View File

@ -12,8 +12,11 @@
#include <deque>
#include <boost/detail/iterator.hpp>
#include <boost/algorithm/string/collection_traits.hpp>
#include <boost/algorithm/string/iterator_range.hpp>
#include <boost/range/iterator_range.hpp>
#include <boost/range/begin.hpp>
#include <boost/range/end.hpp>
#include <boost/range/const_iterator.hpp>
#include <boost/algorithm/string/concept.hpp>
#include <boost/algorithm/string/detail/find_format.hpp>
#include <boost/algorithm/string/detail/find_format_all.hpp>
@ -59,11 +62,11 @@ namespace boost {
// Concept check
function_requires<
FinderConcept<FinderT,
BOOST_STRING_TYPENAME const_iterator_of<CollectionT>::type> >();
BOOST_STRING_TYPENAME range_const_iterator<CollectionT>::type> >();
function_requires<
FormatterConcept<
FormatterT,
FinderT,BOOST_STRING_TYPENAME const_iterator_of<CollectionT>::type> >();
FinderT,BOOST_STRING_TYPENAME range_const_iterator<CollectionT>::type> >();
return detail::find_format_copy_impl(
Output,
@ -89,11 +92,11 @@ namespace boost {
// Concept check
function_requires<
FinderConcept<FinderT,
BOOST_STRING_TYPENAME const_iterator_of<SequenceT>::type> >();
BOOST_STRING_TYPENAME range_const_iterator<SequenceT>::type> >();
function_requires<
FormatterConcept<
FormatterT,
FinderT,BOOST_STRING_TYPENAME const_iterator_of<SequenceT>::type> >();
FinderT,BOOST_STRING_TYPENAME range_const_iterator<SequenceT>::type> >();
return detail::find_format_copy_impl(
Input,
@ -123,11 +126,11 @@ namespace boost {
// Concept check
function_requires<
FinderConcept<FinderT,
BOOST_STRING_TYPENAME const_iterator_of<SequenceT>::type> >();
BOOST_STRING_TYPENAME range_const_iterator<SequenceT>::type> >();
function_requires<
FormatterConcept<
FormatterT,
FinderT,BOOST_STRING_TYPENAME const_iterator_of<SequenceT>::type> >();
FinderT,BOOST_STRING_TYPENAME range_const_iterator<SequenceT>::type> >();
detail::find_format_impl(
Input,
@ -170,11 +173,11 @@ namespace boost {
// Concept check
function_requires<
FinderConcept<FinderT,
BOOST_STRING_TYPENAME const_iterator_of<CollectionT>::type> >();
BOOST_STRING_TYPENAME range_const_iterator<CollectionT>::type> >();
function_requires<
FormatterConcept<
FormatterT,
FinderT,BOOST_STRING_TYPENAME const_iterator_of<CollectionT>::type> >();
FinderT,BOOST_STRING_TYPENAME range_const_iterator<CollectionT>::type> >();
return detail::find_format_all_copy_impl(
Output,
@ -200,11 +203,11 @@ namespace boost {
// Concept check
function_requires<
FinderConcept<FinderT,
BOOST_STRING_TYPENAME const_iterator_of<SequenceT>::type> >();
BOOST_STRING_TYPENAME range_const_iterator<SequenceT>::type> >();
function_requires<
FormatterConcept<
FormatterT,
FinderT,BOOST_STRING_TYPENAME const_iterator_of<SequenceT>::type> >();
FinderT,BOOST_STRING_TYPENAME range_const_iterator<SequenceT>::type> >();
return detail::find_format_all_copy_impl(
Input,
@ -235,11 +238,11 @@ namespace boost {
// Concept check
function_requires<
FinderConcept<FinderT,
BOOST_STRING_TYPENAME const_iterator_of<SequenceT>::type> >();
BOOST_STRING_TYPENAME range_const_iterator<SequenceT>::type> >();
function_requires<
FormatterConcept<
FormatterT,
FinderT,BOOST_STRING_TYPENAME const_iterator_of<SequenceT>::type> >();
FinderT,BOOST_STRING_TYPENAME range_const_iterator<SequenceT>::type> >();
detail::find_format_all_impl(
Input,

View File

@ -9,14 +9,17 @@
#ifndef BOOST_STRING_FIND_ITERATOR_HPP
#define BOOST_STRING_FIND_ITERATOR_HPP
#include <boost/algorithm/string/config.hpp>
#include <boost/algorithm/string/collection_traits.hpp>
#include <boost/algorithm/string/iterator_range.hpp>
#include <boost/algorithm/string/detail/find_iterator.hpp>
#include <boost/iterator/iterator_facade.hpp>
#include <boost/iterator/iterator_categories.hpp>
#include <boost/range/iterator_range.hpp>
#include <boost/range/begin.hpp>
#include <boost/range/end.hpp>
#include <boost/range/result_iterator.hpp>
#include <boost/algorithm/string/detail/find_iterator.hpp>
/*! \file
Defines find iterator classes. Find iterator repeatly applies a Finder
to the specified input string to search for matches. Dereferencing
@ -177,12 +180,12 @@ namespace boost {
*/
template<typename CollectionT, typename FinderT>
inline find_iterator<
BOOST_STRING_TYPENAME result_iterator_of<CollectionT>::type>
BOOST_STRING_TYPENAME range_result_iterator<CollectionT>::type>
make_find_iterator(
CollectionT& Collection,
FinderT Finder)
{
return find_iterator<BOOST_STRING_TYPENAME result_iterator_of<CollectionT>::type>(
return find_iterator<BOOST_STRING_TYPENAME range_result_iterator<CollectionT>::type>(
begin(Collection), end(Collection), Finder);
}
@ -343,12 +346,12 @@ namespace boost {
*/
template<typename CollectionT, typename FinderT>
inline split_iterator<
BOOST_STRING_TYPENAME result_iterator_of<CollectionT>::type>
BOOST_STRING_TYPENAME range_result_iterator<CollectionT>::type>
make_split_iterator(
CollectionT& Collection,
FinderT Finder)
{
return split_iterator<BOOST_STRING_TYPENAME result_iterator_of<CollectionT>::type>(
return split_iterator<BOOST_STRING_TYPENAME range_result_iterator<CollectionT>::type>(
begin(Collection), end(Collection), Finder);
}

View File

@ -11,9 +11,14 @@
#define BOOST_STRING_FINDER_HPP
#include <boost/algorithm/string/config.hpp>
#include <boost/range/iterator_range.hpp>
#include <boost/range/begin.hpp>
#include <boost/range/end.hpp>
#include <boost/range/iterator.hpp>
#include <boost/range/const_iterator.hpp>
#include <boost/algorithm/string/constants.hpp>
#include <boost/algorithm/string/collection_traits.hpp>
#include <boost/algorithm/string/iterator_range.hpp>
#include <boost/algorithm/string/detail/finder.hpp>
#include <boost/algorithm/string/compare.hpp>
@ -42,14 +47,14 @@ namespace boost {
*/
template<typename ContainerT>
inline detail::first_finderF<
BOOST_STRING_TYPENAME const_iterator_of<ContainerT>::type,
BOOST_STRING_TYPENAME range_const_iterator<ContainerT>::type,
is_equal>
first_finder( const ContainerT& Search )
{
return
detail::first_finderF<
BOOST_STRING_TYPENAME
const_iterator_of<ContainerT>::type,
range_const_iterator<ContainerT>::type,
is_equal>( Search, is_equal() ) ;
}
@ -59,7 +64,7 @@ namespace boost {
*/
template<typename ContainerT,typename PredicateT>
inline detail::first_finderF<
BOOST_STRING_TYPENAME const_iterator_of<ContainerT>::type,
BOOST_STRING_TYPENAME range_const_iterator<ContainerT>::type,
PredicateT>
first_finder(
const ContainerT& Search, PredicateT Comp )
@ -67,7 +72,7 @@ namespace boost {
return
detail::first_finderF<
BOOST_STRING_TYPENAME
const_iterator_of<ContainerT>::type,
range_const_iterator<ContainerT>::type,
PredicateT>( Search, Comp );
}
@ -83,14 +88,14 @@ namespace boost {
*/
template<typename ContainerT>
inline detail::last_finderF<
BOOST_STRING_TYPENAME const_iterator_of<ContainerT>::type,
BOOST_STRING_TYPENAME range_const_iterator<ContainerT>::type,
is_equal>
last_finder( const ContainerT& Search )
{
return
detail::last_finderF<
BOOST_STRING_TYPENAME
const_iterator_of<ContainerT>::type,
range_const_iterator<ContainerT>::type,
is_equal>( Search, is_equal() );
}
//! "Last" finder
@ -99,14 +104,14 @@ namespace boost {
*/
template<typename ContainerT, typename PredicateT>
inline detail::last_finderF<
BOOST_STRING_TYPENAME const_iterator_of<ContainerT>::type,
BOOST_STRING_TYPENAME range_const_iterator<ContainerT>::type,
PredicateT>
last_finder( const ContainerT& Search, PredicateT Comp )
{
return
detail::last_finderF<
BOOST_STRING_TYPENAME
const_iterator_of<ContainerT>::type,
range_const_iterator<ContainerT>::type,
PredicateT>( Search, Comp ) ;
}
@ -123,7 +128,7 @@ namespace boost {
*/
template<typename ContainerT>
inline detail::nth_finderF<
BOOST_STRING_TYPENAME const_iterator_of<ContainerT>::type,
BOOST_STRING_TYPENAME range_const_iterator<ContainerT>::type,
is_equal>
nth_finder(
const ContainerT& Search,
@ -132,7 +137,7 @@ namespace boost {
return
detail::nth_finderF<
BOOST_STRING_TYPENAME
const_iterator_of<ContainerT>::type,
range_const_iterator<ContainerT>::type,
is_equal>( Search, Nth, is_equal() ) ;
}
//! "Nth" finder
@ -141,7 +146,7 @@ namespace boost {
*/
template<typename ContainerT, typename PredicateT>
inline detail::nth_finderF<
BOOST_STRING_TYPENAME const_iterator_of<ContainerT>::type,
BOOST_STRING_TYPENAME range_const_iterator<ContainerT>::type,
PredicateT>
nth_finder(
const ContainerT& Search,
@ -151,7 +156,7 @@ namespace boost {
return
detail::nth_finderF<
BOOST_STRING_TYPENAME
const_iterator_of<ContainerT>::type,
range_const_iterator<ContainerT>::type,
PredicateT>( Search, Nth, Comp );
}

View File

@ -11,8 +11,9 @@
#define BOOST_STRING_FORMATTER_HPP
#include <boost/detail/iterator.hpp>
#include <boost/algorithm/string/collection_traits.hpp>
#include <boost/algorithm/string/iterator_range.hpp>
#include <boost/range/value_type.hpp>
#include <boost/range/iterator_range.hpp>
#include <boost/algorithm/string/detail/formatter.hpp>
/*! \file
@ -29,7 +30,7 @@
namespace boost {
namespace algorithm {
// generic formaters ---------------------------------------------------------------//
// generic formatters ---------------------------------------------------------------//
//! Constant formatter
/*!
@ -62,7 +63,7 @@ namespace boost {
//! Empty formatter
/*!
Construct the \c empty_formatter. Empty formater always returns an empty
Construct the \c empty_formatter. Empty formatter always returns an empty
sequence.
\param Input container used to select a correct value_type for the
@ -71,11 +72,11 @@ namespace boost {
*/
template<typename CollectionT>
inline detail::empty_formatF<
BOOST_STRING_TYPENAME value_type_of<CollectionT>::type>
BOOST_STRING_TYPENAME range_value<CollectionT>::type>
empty_formatter(const CollectionT&)
{
return detail::empty_formatF<
BOOST_STRING_TYPENAME value_type_of<CollectionT>::type>();
BOOST_STRING_TYPENAME range_value<CollectionT>::type>();
}

View File

@ -14,8 +14,13 @@
#include <algorithm>
#include <iterator>
#include <boost/iterator/transform_iterator.hpp>
#include <boost/algorithm/string/collection_traits.hpp>
#include <boost/algorithm/string/iterator_range.hpp>
#include <boost/range/iterator_range.hpp>
#include <boost/range/begin.hpp>
#include <boost/range/end.hpp>
#include <boost/range/result_iterator.hpp>
#include <boost/range/value_type.hpp>
#include <boost/algorithm/string/concept.hpp>
#include <boost/algorithm/string/find_iterator.hpp>
#include <boost/algorithm/string/detail/util.hpp>
@ -69,14 +74,14 @@ namespace boost {
{
function_requires<
FinderConcept<FinderT,
BOOST_STRING_TYPENAME result_iterator_of<CollectionT>::type> >();
BOOST_STRING_TYPENAME range_result_iterator<CollectionT>::type> >();
typedef BOOST_STRING_TYPENAME
result_iterator_of<CollectionT>::type input_iterator_type;
range_result_iterator<CollectionT>::type input_iterator_type;
typedef find_iterator<input_iterator_type> find_iterator_type;
typedef detail::copy_iterator_rangeF<
BOOST_STRING_TYPENAME
value_type_of<SequenceSequenceT>::type,
range_value<SequenceSequenceT>::type,
input_iterator_type> copy_range_type;
input_iterator_type InputEnd=end(Input);
@ -136,14 +141,14 @@ namespace boost {
{
function_requires<
FinderConcept<FinderT,
BOOST_STRING_TYPENAME result_iterator_of<CollectionT>::type> >();
BOOST_STRING_TYPENAME range_result_iterator<CollectionT>::type> >();
typedef BOOST_STRING_TYPENAME
result_iterator_of<CollectionT>::type input_iterator_type;
range_result_iterator<CollectionT>::type input_iterator_type;
typedef split_iterator<input_iterator_type> find_iterator_type;
typedef detail::copy_iterator_rangeF<
BOOST_STRING_TYPENAME
value_type_of<SequenceSequenceT>::type,
range_value<SequenceSequenceT>::type,
input_iterator_type> copy_range_type;
input_iterator_type InputEnd=end(Input);

View File

@ -1,296 +0,0 @@
// Boost string_algo library iterator_range.hpp header file ---------------------------//
// Copyright Pavol Droba 2002-2003. Use, modification and
// distribution is subject to the Boost Software License, Version
// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org for updates, documentation, and revision history.
#ifndef BOOST_STRING_ITERATOR_RANGE_HPP
#define BOOST_STRING_ITERATOR_RANGE_HPP
#include <boost/algorithm/string/config.hpp>
#include <utility>
#include <iterator>
#include <algorithm>
#include <ostream>
#include <boost/detail/iterator.hpp>
/*! \file
Defines the \c iterator_class and related functions.
\c iterator_range is a simple wrapper of the iterator pair idiom. It provides
a rich subset of the Container interface.
*/
namespace boost {
namespace algorithm {
// iterator range template class -----------------------------------------//
//! iterator_range class
/*!
An \c iterator_range delimits a range in a sequence by beginning and ending iterators.
An iterator_range can be passed to an algorithm which requires a sequence as an input.
For example, the \c toupper() function may most frequently be used on strings,
but can also be used on iterator_ranges:
\code
boost::tolower( find( s, "UPPERCASE STRING" ) );
\endcode
Many algorithms working with sequences take a pair of iterators,
delimiting a working range, as arguments. The \c iterator_range class is an
encapsulation of a range identified by a pair of iterators.
It provides a collection interface,
so it is possible to pass an instance to an algorithm requiring a collection as an input.
*/
template<typename IteratorT>
class iterator_range
{
public:
//! this type
typedef iterator_range<IteratorT> type;
//! Encapsulated value type
typedef BOOST_STRING_TYPENAME boost::detail::
iterator_traits<IteratorT>::value_type value_type;
//! Reference type
typedef BOOST_STRING_TYPENAME boost::detail::
iterator_traits<IteratorT>::reference reference;
//! Difference type
typedef BOOST_STRING_TYPENAME boost::detail::
iterator_traits<IteratorT>::difference_type difference_type;
//! Size type
typedef BOOST_STRING_TYPENAME boost::detail::
iterator_traits<IteratorT>::difference_type size_type;
//! const_iterator type
/*!
There is no distinction between const_iterator and iterator.
These typedefs are provides to fulfill container interface
*/
typedef IteratorT const_iterator;
//! iterator type
typedef IteratorT iterator;
//! Empty constructor
iterator_range() :
m_Begin(), m_End() {}
//! Constructor from a pair of iterators
iterator_range( iterator Begin, iterator End ) :
m_Begin(Begin), m_End(End) {}
//! Constructor from a std::pair
iterator_range( const std::pair<IteratorT,IteratorT>& Range ) :
m_Begin(Range.first), m_End(Range.second) {}
//! Copy constructor
iterator_range( const iterator_range& Other ) :
m_Begin(Other.begin()), m_End(Other.end()) {}
//! Templated copy constructor
/*!
This constructor is provided to allow conversion between
const and mutable iterator instances of this class template
*/
template< typename OtherItT >
iterator_range( const iterator_range<OtherItT>& Other ) :
m_Begin(Other.begin()), m_End(Other.end()) {}
//! Assignment operator
iterator_range& operator=( const iterator_range& Other )
{
m_Begin=Other.begin(); m_End=Other.end();
return *this;
}
//! Assignment operator ( templated version )
template< typename OtherItT >
iterator_range& operator=( const iterator_range<OtherItT>& Other )
{
m_Begin=Other.begin(); m_End=Other.end();
return *this;
}
//! Comparison operator ( equal )
/*!
Compare operands for equality
*/
template< typename OtherItT >
bool operator==( const iterator_range<OtherItT>& Other ) const
{
return m_Begin==Other.begin() && m_End==Other.end();
}
//! Comparison operator ( not-equal )
/*!
Compare operands for non-equality
*/
template< typename OtherItT >
bool operator!=( const iterator_range<OtherItT>& Other ) const
{
return m_Begin!=Other.begin() || m_End!=Other.end();
}
//! begin access
/*!
Retrieve the begin iterator
*/
IteratorT begin() const
{
return m_Begin;
}
//! end access
/*!
Retrieve the end iterator
*/
IteratorT end() const
{
return m_End;
}
//! Empty container test
/*!
Test whether the range is empty
*/
bool empty() const
{
return m_Begin==m_End;
}
//! Size of the range
/*!
Retrieve the size of the range
*/
difference_type size() const
{
return std::distance( m_Begin, m_End );
}
//! Swap
/*!
Swap two ranges
*/
void swap( iterator_range& Other )
{
std::swap( m_Begin, Other.begin() );
std::swap( m_End, Other.end() );
}
//! Safe bool conversion
/*!
Check whether the range is empty.
Allows to use construction like this:
\code
iterator_range r;
if (!r)
{
...
}
\endcode
*/
typedef iterator (iterator_range::*unspecified_bool_type) () const;
operator unspecified_bool_type() const
{
return empty()? 0: &iterator_range::end;
}
private:
// begin and end iterators
IteratorT m_Begin;
IteratorT m_End;
};
// iterator range free-standing operators ---------------------------//
//! iterator_range output operator
/*!
Output the range to an ostream. Elements are outputed
in a sequence without separators.
*/
template< typename IteratorT, typename Elem, typename Traits >
std::basic_ostream<Elem,Traits>& operator<<(
std::basic_ostream<Elem, Traits>& Os,
const iterator_range<IteratorT>& Range )
{
std::copy(Range.begin(), Range.end(), std::ostream_iterator<Elem>(Os));
return Os;
}
// iterator range utilities -----------------------------------------//
//! iterator_range construct helper
/*!
Construct an \c iterator_range from a pair of iterators
\param Begin A begin iterator
\param End An end iterator
\return iterator_range object
*/
template< typename IteratorT >
inline iterator_range< IteratorT > make_iterator_range( IteratorT Begin, IteratorT End )
{
return iterator_range<IteratorT>( Begin, End );
}
//! iterator_range construct helper
/*!
Construct an \c iterator_range from a \c std::pair<> containing the begin
and end iterators.
\param Pair A \c std::pair<> with begin and end iterators
\return \c iterator_range object
*/
template< typename IteratorT >
inline iterator_range< IteratorT > make_iterator_range( const std::pair<IteratorT,IteratorT>& Pair )
{
return iterator_range<IteratorT>( Pair.first, Pair.second );
}
//! copy a range into a sequence
/*!
Construct a new sequence of the specified type from the elements
in the given range
\param Range An input range
\return New sequence
*/
template< typename SeqT, typename IteratorT >
inline SeqT copy_iterator_range( const iterator_range<IteratorT>& Range )
{
return SeqT( Range.begin(), Range.end() );
}
//! transform a range into a sequence
/*!
Create a new sequence from the elements in the range, transformed
by a function
\param Range An input range
\param Func Transformation function
\return New sequence
*/
template< typename SeqT, typename IteratorT, typename FuncT >
inline SeqT transform_iterator_range( const iterator_range<IteratorT>& Range, FuncT Func )
{
SeqT Seq;
std::transform( Range.begin(), Range.end(), std::back_inserter(Seq), Func );
return Seq;
}
} // namespace algorithm
// pull names to the namespace boost
using algorithm::iterator_range;
using algorithm::make_iterator_range;
using algorithm::copy_iterator_range;
using algorithm::transform_iterator_range;
} // namespace boost
#endif // BOOST_STRING_ITERATOR_RANGE_HPP

View File

@ -11,8 +11,12 @@
#define BOOST_STRING_PREDICATE_HPP
#include <boost/algorithm/string/config.hpp>
#include <boost/range/begin.hpp>
#include <boost/range/end.hpp>
#include <boost/range/iterator.hpp>
#include <boost/range/const_iterator.hpp>
#include <boost/algorithm/string/compare.hpp>
#include <boost/algorithm/string/collection_traits.hpp>
#include <boost/algorithm/string/find.hpp>
#include <boost/algorithm/string/detail/predicate.hpp>
@ -53,9 +57,9 @@ namespace boost {
PredicateT Comp)
{
typedef BOOST_STRING_TYPENAME
const_iterator_of<Collection1T>::type Iterator1T;
range_const_iterator<Collection1T>::type Iterator1T;
typedef BOOST_STRING_TYPENAME
const_iterator_of<Collection2T>::type Iterator2T;
range_const_iterator<Collection2T>::type Iterator2T;
Iterator1T InputEnd=end(Input);
Iterator2T TestEnd=end(Test);
@ -132,7 +136,7 @@ namespace boost {
PredicateT Comp)
{
typedef BOOST_STRING_TYPENAME
const_iterator_of<Collection1T>::type Iterator1T;
range_const_iterator<Collection1T>::type Iterator1T;
typedef BOOST_STRING_TYPENAME boost::detail::
iterator_traits<Iterator1T>::iterator_category category;
@ -271,9 +275,9 @@ namespace boost {
PredicateT Comp)
{
typedef BOOST_STRING_TYPENAME
const_iterator_of<Collection1T>::type Iterator1T;
range_const_iterator<Collection1T>::type Iterator1T;
typedef BOOST_STRING_TYPENAME
const_iterator_of<Collection2T>::type Iterator2T;
range_const_iterator<Collection2T>::type Iterator2T;
Iterator1T InputEnd=end(Input);
Iterator2T TestEnd=end(Test);
@ -346,7 +350,7 @@ namespace boost {
PredicateT Pred)
{
typedef BOOST_STRING_TYPENAME
const_iterator_of<CollectionT>::type Iterator1T;
range_const_iterator<CollectionT>::type Iterator1T;
Iterator1T InputEnd=end(Input);
for( Iterator1T It=begin(Input); It!=InputEnd; ++It)

View File

@ -12,8 +12,12 @@
#include <boost/algorithm/string/config.hpp>
#include <boost/regex.hpp>
#include <boost/algorithm/string/collection_traits.hpp>
#include <boost/algorithm/string/iterator_range.hpp>
#include <boost/range/iterator_range.hpp>
#include <boost/range/begin.hpp>
#include <boost/range/end.hpp>
#include <boost/range/result_iterator.hpp>
#include <boost/algorithm/string/find_format.hpp>
#include <boost/algorithm/string/regex_find_format.hpp>
#include <boost/algorithm/string/formatter.hpp>
@ -48,7 +52,7 @@ namespace boost {
typename CharT,
typename RegexTraitsT>
inline iterator_range<
BOOST_STRING_TYPENAME result_iterator_of<CollectionT>::type >
BOOST_STRING_TYPENAME range_result_iterator<CollectionT>::type >
find_regex(
CollectionT& Input,
const basic_regex<CharT, RegexTraitsT>& Rx,

View File

@ -11,8 +11,13 @@
#define BOOST_STRING_REPLACE_HPP
#include <boost/algorithm/string/config.hpp>
#include <boost/algorithm/string/collection_traits.hpp>
#include <boost/algorithm/string/iterator_range.hpp>
#include <boost/range/iterator_range.hpp>
#include <boost/range/begin.hpp>
#include <boost/range/end.hpp>
#include <boost/range/iterator.hpp>
#include <boost/range/const_iterator.hpp>
#include <boost/algorithm/string/find_format.hpp>
#include <boost/algorithm/string/finder.hpp>
#include <boost/algorithm/string/formatter.hpp>
@ -52,7 +57,7 @@ namespace boost {
const Collection1T& Input,
const iterator_range<
BOOST_STRING_TYPENAME
const_iterator_of<Collection1T>::type>& SearchRange,
range_const_iterator<Collection1T>::type>& SearchRange,
const Collection2T& Format)
{
return find_format_copy(
@ -71,7 +76,7 @@ namespace boost {
const SequenceT& Input,
const iterator_range<
BOOST_STRING_TYPENAME
const_iterator_of<SequenceT>::type>& SearchRange,
range_const_iterator<SequenceT>::type>& SearchRange,
const CollectionT& Format)
{
return find_format_copy(
@ -94,7 +99,7 @@ namespace boost {
SequenceT& Input,
const iterator_range<
BOOST_STRING_TYPENAME
iterator_of<SequenceT>::type>& SearchRange,
range_iterator<SequenceT>::type>& SearchRange,
const CollectionT& Format)
{
find_format(

View File

@ -11,8 +11,7 @@
#define BOOST_STRING_SPLIT_HPP
#include <boost/algorithm/string/config.hpp>
#include <boost/algorithm/string/collection_traits.hpp>
#include <boost/algorithm/string/iterator_range.hpp>
#include <boost/algorithm/string/iter_find.hpp>
#include <boost/algorithm/string/finder.hpp>
#include <boost/algorithm/string/compare.hpp>

View File

@ -11,7 +11,11 @@
#define BOOST_STRING_TRIM_HPP
#include <boost/algorithm/string/config.hpp>
#include <boost/algorithm/string/collection_traits.hpp>
#include <boost/range/begin.hpp>
#include <boost/range/end.hpp>
#include <boost/range/const_iterator.hpp>
#include <boost/algorithm/string/detail/trim.hpp>
#include <boost/algorithm/string/classification.hpp>
#include <locale>
@ -273,7 +277,7 @@ namespace boost {
PredicateT IsSpace)
{
BOOST_STRING_TYPENAME
const_iterator_of<CollectionT>::type TrimEnd=
range_const_iterator<CollectionT>::type TrimEnd=
detail::trim_end(
begin(Input),
end(Input),
@ -297,7 +301,7 @@ namespace boost {
inline SequenceT trim_copy_if(const SequenceT& Input, PredicateT IsSpace)
{
BOOST_STRING_TYPENAME
const_iterator_of<SequenceT>::type TrimEnd=
range_const_iterator<SequenceT>::type TrimEnd=
detail::trim_end(
begin(Input),
end(Input),