From aea6f39c11524b4074f8137ff75651aabc075531 Mon Sep 17 00:00:00 2001 From: Pavol Droba Date: Fri, 21 Jan 2005 16:45:29 +0000 Subject: [PATCH] Library adapted to use official Boost.Range instead of the internal version Internal version removed [SVN r26787] --- include/boost/algorithm/string.hpp | 1 - include/boost/algorithm/string/case_conv.hpp | 22 +- .../boost/algorithm/string/classification.hpp | 5 +- .../algorithm/string/collection_traits.hpp | 266 -------- include/boost/algorithm/string/concept.hpp | 5 +- .../string/detail/classification.hpp | 5 +- .../string/detail/collection_traits.hpp | 621 ------------------ .../algorithm/string/detail/find_format.hpp | 10 +- .../string/detail/find_format_all.hpp | 16 +- .../string/detail/find_format_store.hpp | 3 +- .../algorithm/string/detail/find_iterator.hpp | 2 +- .../boost/algorithm/string/detail/finder.hpp | 13 +- .../algorithm/string/detail/finder_regex.hpp | 7 +- .../algorithm/string/detail/formatter.hpp | 10 +- .../string/detail/replace_storage.hpp | 2 - .../algorithm/string/detail/sequence.hpp | 4 +- .../boost/algorithm/string/detail/util.hpp | 5 +- include/boost/algorithm/string/erase.hpp | 47 +- include/boost/algorithm/string/find.hpp | 30 +- .../boost/algorithm/string/find_format.hpp | 31 +- .../boost/algorithm/string/find_iterator.hpp | 19 +- include/boost/algorithm/string/finder.hpp | 33 +- include/boost/algorithm/string/formatter.hpp | 13 +- include/boost/algorithm/string/iter_find.hpp | 21 +- .../boost/algorithm/string/iterator_range.hpp | 296 --------- include/boost/algorithm/string/predicate.hpp | 18 +- include/boost/algorithm/string/regex.hpp | 10 +- include/boost/algorithm/string/replace.hpp | 15 +- include/boost/algorithm/string/split.hpp | 3 +- include/boost/algorithm/string/trim.hpp | 10 +- 30 files changed, 212 insertions(+), 1331 deletions(-) delete mode 100644 include/boost/algorithm/string/collection_traits.hpp delete mode 100644 include/boost/algorithm/string/detail/collection_traits.hpp delete mode 100644 include/boost/algorithm/string/iterator_range.hpp diff --git a/include/boost/algorithm/string.hpp b/include/boost/algorithm/string.hpp index c3fa794..9a5f624 100644 --- a/include/boost/algorithm/string.hpp +++ b/include/boost/algorithm/string.hpp @@ -15,7 +15,6 @@ */ #include -#include #include #include #include diff --git a/include/boost/algorithm/string/case_conv.hpp b/include/boost/algorithm/string/case_conv.hpp index d027637..ff7227e 100644 --- a/include/boost/algorithm/string/case_conv.hpp +++ b/include/boost/algorithm/string/case_conv.hpp @@ -14,7 +14,11 @@ #include #include #include -#include + +#include +#include +#include + #include /*! \file @@ -56,7 +60,7 @@ namespace boost { end(Input), Output, detail::to_lowerF< - typename value_type_of::type >(Loc)); + typename range_value::type >(Loc)); } //! Convert to lower case @@ -72,11 +76,11 @@ namespace boost { make_transform_iterator( begin(Input), detail::to_lowerF< - typename value_type_of::type >(Loc)), + typename range_value::type >(Loc)), make_transform_iterator( end(Input), detail::to_lowerF< - typename value_type_of::type >(Loc))); + typename range_value::type >(Loc))); } //! Convert to lower case @@ -97,7 +101,7 @@ namespace boost { end(Input), begin(Input), detail::to_lowerF< - typename value_type_of::type >(Loc)); + typename range_value::type >(Loc)); } // to_upper -----------------------------------------------// @@ -129,7 +133,7 @@ namespace boost { end(Input), Output, detail::to_upperF< - typename value_type_of::type >(Loc)); + typename range_value::type >(Loc)); } //! Convert to upper case @@ -145,11 +149,11 @@ namespace boost { make_transform_iterator( begin(Input), detail::to_upperF< - typename value_type_of::type >(Loc)), + typename range_value::type >(Loc)), make_transform_iterator( end(Input), detail::to_upperF< - typename value_type_of::type >(Loc))); + typename range_value::type >(Loc))); } @@ -171,7 +175,7 @@ namespace boost { end(Input), begin(Input), detail::to_upperF< - typename value_type_of::type >(Loc)); + typename range_value::type >(Loc)); } } // namespace algorithm diff --git a/include/boost/algorithm/string/classification.hpp b/include/boost/algorithm/string/classification.hpp index e2d7c39..7dd65d2 100644 --- a/include/boost/algorithm/string/classification.hpp +++ b/include/boost/algorithm/string/classification.hpp @@ -12,6 +12,7 @@ #include #include +#include #include #include @@ -195,11 +196,11 @@ namespace boost { */ template inline detail::is_any_ofF< - BOOST_STRING_TYPENAME value_type_of::type> + BOOST_STRING_TYPENAME range_value::type> is_any_of( const ContainerT& Set ) { return detail::is_any_ofF< - BOOST_STRING_TYPENAME value_type_of::type>(Set); + BOOST_STRING_TYPENAME range_value::type>(Set); } //! is_from_range predicate diff --git a/include/boost/algorithm/string/collection_traits.hpp b/include/boost/algorithm/string/collection_traits.hpp deleted file mode 100644 index b76e0f1..0000000 --- a/include/boost/algorithm/string/collection_traits.hpp +++ /dev/null @@ -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 -#include -#include -#include - -// Implementation -#include - -/*! \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::iterator,vector::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, - detail::pair_container_traits_selector, - BOOST_STRING_TYPENAME ::boost::mpl::eval_if< - ::boost::is_array, - detail::array_container_traits_selector, - BOOST_STRING_TYPENAME ::boost::mpl::eval_if< - ::boost::is_pointer, - detail::pointer_container_traits_selector, - detail::default_container_traits_selector - > - > - >::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::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::difference_type type; - }; - - //! Container iterator trait - /*! - Extract the container's iterator type - */ - template< typename C > - struct iterator_of - { - typedef BOOST_STRING_TYPENAME collection_traits::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::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::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::size_type - size( const C& c ) - { - return collection_traits::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::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::iterator - begin( C& c ) - { - return collection_traits::function_type::begin( c ); - } - - //! Free-standing begin() function - /*! - \overload - */ - template< typename C > - inline BOOST_STRING_TYPENAME collection_traits::const_iterator - begin( const C& c ) - { - return collection_traits::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::iterator - end( C& c ) - { - return collection_traits::function_type::end( c ); - } - - //! Free-standing end() function - /*! - \overload - */ - template< typename C > - inline BOOST_STRING_TYPENAME collection_traits::const_iterator - end( const C& c ) - { - return collection_traits::function_type::end( c ); - } - -#else // BOOST_NO_FUNCTION_TEMPLATE_ORDERING - - //! Free-standing begin() function - /*! - \overload - */ - template< typename C > - inline BOOST_STRING_TYPENAME collection_traits::result_iterator - begin( C& c ) - { - return collection_traits::function_type::begin( c ); - } - - //! Free-standing end() function - /*! - \overload - */ - template< typename C > - inline BOOST_STRING_TYPENAME collection_traits::result_iterator - end( C& c ) - { - return collection_traits::function_type::end( c ); - } - -#endif // BOOST_NO_FUNCTION_TEMPLATE_ORDERING - - } // namespace algorithm -} // namespace boost - -#endif // BOOST_STRING_COLLECTION_TRAITS_HPP diff --git a/include/boost/algorithm/string/concept.hpp b/include/boost/algorithm/string/concept.hpp index 395fe28..1efda27 100644 --- a/include/boost/algorithm/string/concept.hpp +++ b/include/boost/algorithm/string/concept.hpp @@ -11,8 +11,9 @@ #define BOOST_STRING_CONCEPT_HPP #include -#include -#include +#include +#include +#include /*! \file Defines concepts used in string_algo library diff --git a/include/boost/algorithm/string/detail/classification.hpp b/include/boost/algorithm/string/detail/classification.hpp index e05901e..2adfaae 100644 --- a/include/boost/algorithm/string/detail/classification.hpp +++ b/include/boost/algorithm/string/detail/classification.hpp @@ -15,7 +15,10 @@ #include #include #include -#include + +#include +#include + #include #include diff --git a/include/boost/algorithm/string/detail/collection_traits.hpp b/include/boost/algorithm/string/detail/collection_traits.hpp deleted file mode 100644 index fa4fdb0..0000000 --- a/include/boost/algorithm/string/detail/collection_traits.hpp +++ /dev/null @@ -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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// 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, - 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 - struct default_container_traits_selector - { - typedef default_container_traits type; - }; - -// Pair container traits --------------------------------------------------------------------- - - // pair selector - template< typename T, typename U > - yes_type is_pair_impl( const std::pair* ); - no_type is_pair_impl( ... ); - - template 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::value_type value_type; - typedef std::size_t size_type; - typedef BOOST_STRING_TYPENAME ::boost::detail:: - iterator_traits::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 - struct pair_container_traits_selector - { - typedef pair_container_traits 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 - { - // 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 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, - array_traits_impl_selector, - ::boost::mpl::eval_if< - ::boost::is_convertible, - array_traits_impl_selector, - ::boost::mpl::eval_if< - ::boost::is_convertible, - array_traits_impl_selector, - array_traits_impl_selector - > - > - >::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, - array_traits_cv_selector, - ::boost::mpl::identity >::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 >::type type; - }; - - template< typename T > - struct array_traits - { - typedef BOOST_STRING_TYPENAME - array_traits_selector::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 - { - 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::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 - { - 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::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 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, - const_iterator, - iterator - >::type result_iterator; - - private: - // resolve array size - typedef BOOST_STRING_TYPENAME - ::boost::remove_cv::type char_type; - typedef BOOST_STRING_TYPENAME - array_length_selector:: - BOOST_NESTED_TEMPLATE array_length 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 - struct array_container_traits_selector - { - typedef array_container_traits type; - }; - -// Pointer container traits --------------------------------------------------------------- - - template - struct pointer_container_traits - { - typedef BOOST_STRING_TYPENAME - ::boost::remove_pointer::type value_type; - - typedef BOOST_STRING_TYPENAME - ::boost::remove_cv::type char_type; - typedef ::std::char_traits 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, - 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 - struct pointer_container_traits_selector - { - typedef pointer_container_traits type; - }; - - } // namespace detail - } // namespace algorithm -} // namespace boost - - -#endif // BOOST_STRING_DETAIL_COLLECTION_HPP diff --git a/include/boost/algorithm/string/detail/find_format.hpp b/include/boost/algorithm/string/detail/find_format.hpp index ccac0d4..9382f0e 100644 --- a/include/boost/algorithm/string/detail/find_format.hpp +++ b/include/boost/algorithm/string/detail/find_format.hpp @@ -11,7 +11,9 @@ #define BOOST_STRING_FIND_FORMAT_DETAIL_HPP #include -#include +#include +#include +#include #include #include @@ -60,7 +62,7 @@ namespace boost { { typedef find_format_store< BOOST_STRING_TYPENAME - const_iterator_of::type, + range_const_iterator::type, FormatterT, FormatResultT > store_type; @@ -121,7 +123,7 @@ namespace boost { { typedef find_format_store< BOOST_STRING_TYPENAME - const_iterator_of::type, + range_const_iterator::type, FormatterT, FormatResultT > store_type; @@ -181,7 +183,7 @@ namespace boost { { typedef find_format_store< BOOST_STRING_TYPENAME - iterator_of::type, + range_iterator::type, FormatterT, FormatResultT > store_type; diff --git a/include/boost/algorithm/string/detail/find_format_all.hpp b/include/boost/algorithm/string/detail/find_format_all.hpp index 36a4847..a6be0b6 100644 --- a/include/boost/algorithm/string/detail/find_format_all.hpp +++ b/include/boost/algorithm/string/detail/find_format_all.hpp @@ -11,7 +11,9 @@ #define BOOST_STRING_FIND_FORMAT_ALL_DETAIL_HPP #include -#include +#include +#include +#include #include #include @@ -59,7 +61,7 @@ namespace boost { const FormatResultT& FormatResult ) { typedef BOOST_STRING_TYPENAME - const_iterator_of::type input_iterator_type; + range_const_iterator::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::type input_iterator_type; + range_const_iterator::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::type input_iterator_type; + range_iterator::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::type> Storage; + BOOST_STRING_TYPENAME range_value::type> Storage; // Initialize replacement iterators input_iterator_type InsertIt=begin(Input); diff --git a/include/boost/algorithm/string/detail/find_format_store.hpp b/include/boost/algorithm/string/detail/find_format_store.hpp index c67d395..d85be56 100644 --- a/include/boost/algorithm/string/detail/find_format_store.hpp +++ b/include/boost/algorithm/string/detail/find_format_store.hpp @@ -11,8 +11,7 @@ #define BOOST_STRING_FIND_FORMAT_STORE_DETAIL_HPP #include -#include -#include +#include namespace boost { namespace algorithm { diff --git a/include/boost/algorithm/string/detail/find_iterator.hpp b/include/boost/algorithm/string/detail/find_iterator.hpp index dfa90e3..ebfd59a 100644 --- a/include/boost/algorithm/string/detail/find_iterator.hpp +++ b/include/boost/algorithm/string/detail/find_iterator.hpp @@ -11,7 +11,7 @@ #define BOOST_STRING_FIND_ITERATOR_DETAIL_HPP #include -#include +#include #include #include #include diff --git a/include/boost/algorithm/string/detail/finder.hpp b/include/boost/algorithm/string/detail/finder.hpp index 9ea1980..fe86f12 100644 --- a/include/boost/algorithm/string/detail/finder.hpp +++ b/include/boost/algorithm/string/detail/finder.hpp @@ -13,8 +13,11 @@ #include #include #include -#include -#include + +#include +#include +#include +#include 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 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 result_type; // Sanity check - if( empty(m_Search) ) + if( boost::empty(m_Search) ) return result_type( End, End ); // Instantiate find funtor diff --git a/include/boost/algorithm/string/detail/finder_regex.hpp b/include/boost/algorithm/string/detail/finder_regex.hpp index 41d8d08..7f178da 100644 --- a/include/boost/algorithm/string/detail/finder_regex.hpp +++ b/include/boost/algorithm/string/detail/finder_regex.hpp @@ -12,8 +12,10 @@ #include #include -#include -#include + +#include +#include +#include namespace boost { namespace algorithm { @@ -29,7 +31,6 @@ namespace boost { typedef regex_search_result type; typedef iterator_range 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; diff --git a/include/boost/algorithm/string/detail/formatter.hpp b/include/boost/algorithm/string/detail/formatter.hpp index 18dd0fd..a40327c 100644 --- a/include/boost/algorithm/string/detail/formatter.hpp +++ b/include/boost/algorithm/string/detail/formatter.hpp @@ -10,8 +10,12 @@ #ifndef BOOST_STRING_FORMATTER_DETAIL_HPP #define BOOST_STRING_FORMATTER_DETAIL_HPP -#include -#include + +#include +#include +#include +#include + #include // generic replace functors -----------------------------------------------// @@ -28,7 +32,7 @@ namespace boost { { private: typedef BOOST_STRING_TYPENAME - const_iterator_of::type format_iterator; + range_const_iterator::type format_iterator; typedef iterator_range result_type; public: diff --git a/include/boost/algorithm/string/detail/replace_storage.hpp b/include/boost/algorithm/string/detail/replace_storage.hpp index bb97b87..248eb31 100644 --- a/include/boost/algorithm/string/detail/replace_storage.hpp +++ b/include/boost/algorithm/string/detail/replace_storage.hpp @@ -13,9 +13,7 @@ #include #include #include -#include #include -#include #include namespace boost { diff --git a/include/boost/algorithm/string/detail/sequence.hpp b/include/boost/algorithm/string/detail/sequence.hpp index edd5687..03c7fd0 100644 --- a/include/boost/algorithm/string/detail/sequence.hpp +++ b/include/boost/algorithm/string/detail/sequence.hpp @@ -13,7 +13,9 @@ #include #include #include -#include +#include +#include + #include namespace boost { diff --git a/include/boost/algorithm/string/detail/util.hpp b/include/boost/algorithm/string/detail/util.hpp index 7656fbe..09663bd 100644 --- a/include/boost/algorithm/string/detail/util.hpp +++ b/include/boost/algorithm/string/detail/util.hpp @@ -12,6 +12,7 @@ #include #include +#include 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& Range ) const { - return copy_iterator_range(Range); + return copy_range(Range); } }; diff --git a/include/boost/algorithm/string/erase.hpp b/include/boost/algorithm/string/erase.hpp index 32894ca..724bb9c 100644 --- a/include/boost/algorithm/string/erase.hpp +++ b/include/boost/algorithm/string/erase.hpp @@ -11,8 +11,13 @@ #define BOOST_STRING_ERASE_HPP #include -#include -#include + +#include +#include +#include +#include +#include + #include #include #include @@ -46,7 +51,7 @@ namespace boost { const CollectionT& Input, const iterator_range< BOOST_STRING_TYPENAME - const_iterator_of::type>& SearchRange ) + range_const_iterator::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::type>& SearchRange ) + range_const_iterator::type>& SearchRange ) { return find_format_copy( Input, @@ -85,7 +90,7 @@ namespace boost { SequenceT& Input, const iterator_range< BOOST_STRING_TYPENAME - iterator_of::type>& SearchRange ) + range_iterator::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. diff --git a/include/boost/algorithm/string/find.hpp b/include/boost/algorithm/string/find.hpp index 4bf92ea..263d2be 100644 --- a/include/boost/algorithm/string/find.hpp +++ b/include/boost/algorithm/string/find.hpp @@ -11,8 +11,14 @@ #define BOOST_STRING_FIND_HPP #include -#include -#include + +#include +#include +#include +#include +#include +#include + #include #include #include @@ -42,7 +48,7 @@ namespace boost { */ template inline iterator_range< - BOOST_STRING_TYPENAME result_iterator_of::type> + BOOST_STRING_TYPENAME range_result_iterator::type> find( CollectionT& Input, FinderT Finder) @@ -68,7 +74,7 @@ namespace boost { */ template inline iterator_range< - BOOST_STRING_TYPENAME result_iterator_of::type> + BOOST_STRING_TYPENAME range_result_iterator::type> find_first( Collection1T& Input, const Collection2T& Search) @@ -95,7 +101,7 @@ namespace boost { */ template inline iterator_range< - BOOST_STRING_TYPENAME result_iterator_of::type> + BOOST_STRING_TYPENAME range_result_iterator::type> ifind_first( Collection1T& Input, const Collection2T& Search, @@ -123,7 +129,7 @@ namespace boost { */ template inline iterator_range< - BOOST_STRING_TYPENAME result_iterator_of::type> + BOOST_STRING_TYPENAME range_result_iterator::type> find_last( Collection1T& Input, const Collection2T& Search) @@ -150,7 +156,7 @@ namespace boost { */ template inline iterator_range< - BOOST_STRING_TYPENAME result_iterator_of::type> + BOOST_STRING_TYPENAME range_result_iterator::type> ifind_last( Collection1T& Input, const Collection2T& Search, @@ -178,7 +184,7 @@ namespace boost { */ template inline iterator_range< - BOOST_STRING_TYPENAME result_iterator_of::type> + BOOST_STRING_TYPENAME range_result_iterator::type> find_nth( Collection1T& Input, const Collection2T& Search, @@ -208,7 +214,7 @@ namespace boost { */ template inline iterator_range< - BOOST_STRING_TYPENAME result_iterator_of::type> + BOOST_STRING_TYPENAME range_result_iterator::type> ifind_nth( Collection1T& Input, const Collection2T& Search, @@ -239,7 +245,7 @@ namespace boost { */ template inline iterator_range< - BOOST_STRING_TYPENAME result_iterator_of::type> + BOOST_STRING_TYPENAME range_result_iterator::type> find_head( CollectionT& Input, unsigned int N) @@ -269,7 +275,7 @@ namespace boost { */ template inline iterator_range< - BOOST_STRING_TYPENAME result_iterator_of::type> + BOOST_STRING_TYPENAME range_result_iterator::type> find_tail( CollectionT& Input, unsigned int N) @@ -299,7 +305,7 @@ namespace boost { */ template inline iterator_range< - BOOST_STRING_TYPENAME result_iterator_of::type> + BOOST_STRING_TYPENAME range_result_iterator::type> find_token( CollectionT& Input, PredicateT Pred, diff --git a/include/boost/algorithm/string/find_format.hpp b/include/boost/algorithm/string/find_format.hpp index 7f6c436..c3fbf2f 100644 --- a/include/boost/algorithm/string/find_format.hpp +++ b/include/boost/algorithm/string/find_format.hpp @@ -12,8 +12,11 @@ #include #include -#include -#include +#include +#include +#include +#include + #include #include #include @@ -59,11 +62,11 @@ namespace boost { // Concept check function_requires< FinderConcept::type> >(); + BOOST_STRING_TYPENAME range_const_iterator::type> >(); function_requires< FormatterConcept< FormatterT, - FinderT,BOOST_STRING_TYPENAME const_iterator_of::type> >(); + FinderT,BOOST_STRING_TYPENAME range_const_iterator::type> >(); return detail::find_format_copy_impl( Output, @@ -89,11 +92,11 @@ namespace boost { // Concept check function_requires< FinderConcept::type> >(); + BOOST_STRING_TYPENAME range_const_iterator::type> >(); function_requires< FormatterConcept< FormatterT, - FinderT,BOOST_STRING_TYPENAME const_iterator_of::type> >(); + FinderT,BOOST_STRING_TYPENAME range_const_iterator::type> >(); return detail::find_format_copy_impl( Input, @@ -123,11 +126,11 @@ namespace boost { // Concept check function_requires< FinderConcept::type> >(); + BOOST_STRING_TYPENAME range_const_iterator::type> >(); function_requires< FormatterConcept< FormatterT, - FinderT,BOOST_STRING_TYPENAME const_iterator_of::type> >(); + FinderT,BOOST_STRING_TYPENAME range_const_iterator::type> >(); detail::find_format_impl( Input, @@ -170,11 +173,11 @@ namespace boost { // Concept check function_requires< FinderConcept::type> >(); + BOOST_STRING_TYPENAME range_const_iterator::type> >(); function_requires< FormatterConcept< FormatterT, - FinderT,BOOST_STRING_TYPENAME const_iterator_of::type> >(); + FinderT,BOOST_STRING_TYPENAME range_const_iterator::type> >(); return detail::find_format_all_copy_impl( Output, @@ -200,11 +203,11 @@ namespace boost { // Concept check function_requires< FinderConcept::type> >(); + BOOST_STRING_TYPENAME range_const_iterator::type> >(); function_requires< FormatterConcept< FormatterT, - FinderT,BOOST_STRING_TYPENAME const_iterator_of::type> >(); + FinderT,BOOST_STRING_TYPENAME range_const_iterator::type> >(); return detail::find_format_all_copy_impl( Input, @@ -235,11 +238,11 @@ namespace boost { // Concept check function_requires< FinderConcept::type> >(); + BOOST_STRING_TYPENAME range_const_iterator::type> >(); function_requires< FormatterConcept< FormatterT, - FinderT,BOOST_STRING_TYPENAME const_iterator_of::type> >(); + FinderT,BOOST_STRING_TYPENAME range_const_iterator::type> >(); detail::find_format_all_impl( Input, diff --git a/include/boost/algorithm/string/find_iterator.hpp b/include/boost/algorithm/string/find_iterator.hpp index 26d08b6..de92184 100644 --- a/include/boost/algorithm/string/find_iterator.hpp +++ b/include/boost/algorithm/string/find_iterator.hpp @@ -9,14 +9,17 @@ #ifndef BOOST_STRING_FIND_ITERATOR_HPP #define BOOST_STRING_FIND_ITERATOR_HPP - #include -#include -#include -#include #include #include +#include +#include +#include +#include + +#include + /*! \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 inline find_iterator< - BOOST_STRING_TYPENAME result_iterator_of::type> + BOOST_STRING_TYPENAME range_result_iterator::type> make_find_iterator( CollectionT& Collection, FinderT Finder) { - return find_iterator::type>( + return find_iterator::type>( begin(Collection), end(Collection), Finder); } @@ -343,12 +346,12 @@ namespace boost { */ template inline split_iterator< - BOOST_STRING_TYPENAME result_iterator_of::type> + BOOST_STRING_TYPENAME range_result_iterator::type> make_split_iterator( CollectionT& Collection, FinderT Finder) { - return split_iterator::type>( + return split_iterator::type>( begin(Collection), end(Collection), Finder); } diff --git a/include/boost/algorithm/string/finder.hpp b/include/boost/algorithm/string/finder.hpp index 13d3e1f..8c4962e 100644 --- a/include/boost/algorithm/string/finder.hpp +++ b/include/boost/algorithm/string/finder.hpp @@ -11,9 +11,14 @@ #define BOOST_STRING_FINDER_HPP #include + +#include +#include +#include +#include +#include + #include -#include -#include #include #include @@ -42,14 +47,14 @@ namespace boost { */ template inline detail::first_finderF< - BOOST_STRING_TYPENAME const_iterator_of::type, + BOOST_STRING_TYPENAME range_const_iterator::type, is_equal> first_finder( const ContainerT& Search ) { return detail::first_finderF< BOOST_STRING_TYPENAME - const_iterator_of::type, + range_const_iterator::type, is_equal>( Search, is_equal() ) ; } @@ -59,7 +64,7 @@ namespace boost { */ template inline detail::first_finderF< - BOOST_STRING_TYPENAME const_iterator_of::type, + BOOST_STRING_TYPENAME range_const_iterator::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::type, + range_const_iterator::type, PredicateT>( Search, Comp ); } @@ -83,14 +88,14 @@ namespace boost { */ template inline detail::last_finderF< - BOOST_STRING_TYPENAME const_iterator_of::type, + BOOST_STRING_TYPENAME range_const_iterator::type, is_equal> last_finder( const ContainerT& Search ) { return detail::last_finderF< BOOST_STRING_TYPENAME - const_iterator_of::type, + range_const_iterator::type, is_equal>( Search, is_equal() ); } //! "Last" finder @@ -99,14 +104,14 @@ namespace boost { */ template inline detail::last_finderF< - BOOST_STRING_TYPENAME const_iterator_of::type, + BOOST_STRING_TYPENAME range_const_iterator::type, PredicateT> last_finder( const ContainerT& Search, PredicateT Comp ) { return detail::last_finderF< BOOST_STRING_TYPENAME - const_iterator_of::type, + range_const_iterator::type, PredicateT>( Search, Comp ) ; } @@ -123,7 +128,7 @@ namespace boost { */ template inline detail::nth_finderF< - BOOST_STRING_TYPENAME const_iterator_of::type, + BOOST_STRING_TYPENAME range_const_iterator::type, is_equal> nth_finder( const ContainerT& Search, @@ -132,7 +137,7 @@ namespace boost { return detail::nth_finderF< BOOST_STRING_TYPENAME - const_iterator_of::type, + range_const_iterator::type, is_equal>( Search, Nth, is_equal() ) ; } //! "Nth" finder @@ -141,7 +146,7 @@ namespace boost { */ template inline detail::nth_finderF< - BOOST_STRING_TYPENAME const_iterator_of::type, + BOOST_STRING_TYPENAME range_const_iterator::type, PredicateT> nth_finder( const ContainerT& Search, @@ -151,7 +156,7 @@ namespace boost { return detail::nth_finderF< BOOST_STRING_TYPENAME - const_iterator_of::type, + range_const_iterator::type, PredicateT>( Search, Nth, Comp ); } diff --git a/include/boost/algorithm/string/formatter.hpp b/include/boost/algorithm/string/formatter.hpp index daf8752..c95ea2b 100644 --- a/include/boost/algorithm/string/formatter.hpp +++ b/include/boost/algorithm/string/formatter.hpp @@ -11,8 +11,9 @@ #define BOOST_STRING_FORMATTER_HPP #include -#include -#include +#include +#include + #include /*! \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 inline detail::empty_formatF< - BOOST_STRING_TYPENAME value_type_of::type> + BOOST_STRING_TYPENAME range_value::type> empty_formatter(const CollectionT&) { return detail::empty_formatF< - BOOST_STRING_TYPENAME value_type_of::type>(); + BOOST_STRING_TYPENAME range_value::type>(); } diff --git a/include/boost/algorithm/string/iter_find.hpp b/include/boost/algorithm/string/iter_find.hpp index b4f89ea..f814747 100644 --- a/include/boost/algorithm/string/iter_find.hpp +++ b/include/boost/algorithm/string/iter_find.hpp @@ -14,8 +14,13 @@ #include #include #include -#include -#include + +#include +#include +#include +#include +#include + #include #include #include @@ -69,14 +74,14 @@ namespace boost { { function_requires< FinderConcept::type> >(); + BOOST_STRING_TYPENAME range_result_iterator::type> >(); typedef BOOST_STRING_TYPENAME - result_iterator_of::type input_iterator_type; + range_result_iterator::type input_iterator_type; typedef find_iterator find_iterator_type; typedef detail::copy_iterator_rangeF< BOOST_STRING_TYPENAME - value_type_of::type, + range_value::type, input_iterator_type> copy_range_type; input_iterator_type InputEnd=end(Input); @@ -136,14 +141,14 @@ namespace boost { { function_requires< FinderConcept::type> >(); + BOOST_STRING_TYPENAME range_result_iterator::type> >(); typedef BOOST_STRING_TYPENAME - result_iterator_of::type input_iterator_type; + range_result_iterator::type input_iterator_type; typedef split_iterator find_iterator_type; typedef detail::copy_iterator_rangeF< BOOST_STRING_TYPENAME - value_type_of::type, + range_value::type, input_iterator_type> copy_range_type; input_iterator_type InputEnd=end(Input); diff --git a/include/boost/algorithm/string/iterator_range.hpp b/include/boost/algorithm/string/iterator_range.hpp deleted file mode 100644 index e3d42d6..0000000 --- a/include/boost/algorithm/string/iterator_range.hpp +++ /dev/null @@ -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 -#include -#include -#include -#include -#include - -/*! \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 - class iterator_range - { - public: - //! this type - typedef iterator_range type; - //! Encapsulated value type - typedef BOOST_STRING_TYPENAME boost::detail:: - iterator_traits::value_type value_type; - //! Reference type - typedef BOOST_STRING_TYPENAME boost::detail:: - iterator_traits::reference reference; - //! Difference type - typedef BOOST_STRING_TYPENAME boost::detail:: - iterator_traits::difference_type difference_type; - //! Size type - typedef BOOST_STRING_TYPENAME boost::detail:: - iterator_traits::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& 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& 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& 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& 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& 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& operator<<( - std::basic_ostream& Os, - const iterator_range& Range ) - { - std::copy(Range.begin(), Range.end(), std::ostream_iterator(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( 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& Pair ) - { - return iterator_range( 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& 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& 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 diff --git a/include/boost/algorithm/string/predicate.hpp b/include/boost/algorithm/string/predicate.hpp index a6fea9b..257f974 100644 --- a/include/boost/algorithm/string/predicate.hpp +++ b/include/boost/algorithm/string/predicate.hpp @@ -11,8 +11,12 @@ #define BOOST_STRING_PREDICATE_HPP #include +#include +#include +#include +#include + #include -#include #include #include @@ -53,9 +57,9 @@ namespace boost { PredicateT Comp) { typedef BOOST_STRING_TYPENAME - const_iterator_of::type Iterator1T; + range_const_iterator::type Iterator1T; typedef BOOST_STRING_TYPENAME - const_iterator_of::type Iterator2T; + range_const_iterator::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::type Iterator1T; + range_const_iterator::type Iterator1T; typedef BOOST_STRING_TYPENAME boost::detail:: iterator_traits::iterator_category category; @@ -271,9 +275,9 @@ namespace boost { PredicateT Comp) { typedef BOOST_STRING_TYPENAME - const_iterator_of::type Iterator1T; + range_const_iterator::type Iterator1T; typedef BOOST_STRING_TYPENAME - const_iterator_of::type Iterator2T; + range_const_iterator::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::type Iterator1T; + range_const_iterator::type Iterator1T; Iterator1T InputEnd=end(Input); for( Iterator1T It=begin(Input); It!=InputEnd; ++It) diff --git a/include/boost/algorithm/string/regex.hpp b/include/boost/algorithm/string/regex.hpp index 1cc1c34..c71b4e7 100644 --- a/include/boost/algorithm/string/regex.hpp +++ b/include/boost/algorithm/string/regex.hpp @@ -12,8 +12,12 @@ #include #include -#include -#include + +#include +#include +#include +#include + #include #include #include @@ -48,7 +52,7 @@ namespace boost { typename CharT, typename RegexTraitsT> inline iterator_range< - BOOST_STRING_TYPENAME result_iterator_of::type > + BOOST_STRING_TYPENAME range_result_iterator::type > find_regex( CollectionT& Input, const basic_regex& Rx, diff --git a/include/boost/algorithm/string/replace.hpp b/include/boost/algorithm/string/replace.hpp index ebd0f08..d613686 100644 --- a/include/boost/algorithm/string/replace.hpp +++ b/include/boost/algorithm/string/replace.hpp @@ -11,8 +11,13 @@ #define BOOST_STRING_REPLACE_HPP #include -#include -#include + +#include +#include +#include +#include +#include + #include #include #include @@ -52,7 +57,7 @@ namespace boost { const Collection1T& Input, const iterator_range< BOOST_STRING_TYPENAME - const_iterator_of::type>& SearchRange, + range_const_iterator::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::type>& SearchRange, + range_const_iterator::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::type>& SearchRange, + range_iterator::type>& SearchRange, const CollectionT& Format) { find_format( diff --git a/include/boost/algorithm/string/split.hpp b/include/boost/algorithm/string/split.hpp index 6e15590..a701efc 100644 --- a/include/boost/algorithm/string/split.hpp +++ b/include/boost/algorithm/string/split.hpp @@ -11,8 +11,7 @@ #define BOOST_STRING_SPLIT_HPP #include -#include -#include + #include #include #include diff --git a/include/boost/algorithm/string/trim.hpp b/include/boost/algorithm/string/trim.hpp index 9aa597d..cc14c5d 100644 --- a/include/boost/algorithm/string/trim.hpp +++ b/include/boost/algorithm/string/trim.hpp @@ -11,7 +11,11 @@ #define BOOST_STRING_TRIM_HPP #include -#include + +#include +#include +#include + #include #include #include @@ -273,7 +277,7 @@ namespace boost { PredicateT IsSpace) { BOOST_STRING_TYPENAME - const_iterator_of::type TrimEnd= + range_const_iterator::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::type TrimEnd= + range_const_iterator::type TrimEnd= detail::trim_end( begin(Input), end(Input),