123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377 |
- // Boost.Range library
- //
- // Copyright Thorsten Ottosen 2003-2004. 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)
- //
- // For more information, see http://www.boost.org/libs/range/
- //
- #ifndef BOOST_RANGE_DETAIL_DETAIL_STR_HPP
- #define BOOST_RANGE_DETAIL_DETAIL_STR_HPP
- #include <boost/config.hpp> // BOOST_MSVC
- #include <boost/range/iterator.hpp>
- namespace boost
- {
-
- namespace range_detail
- {
- //
- // iterator
- //
-
- template<>
- struct range_iterator_<char_array_>
- {
- template< typename T >
- struct pts
- {
- typedef BOOST_RANGE_DEDUCED_TYPENAME
- remove_extent<T>::type* type;
- };
- };
- template<>
- struct range_iterator_<char_ptr_>
- {
- template< typename S >
- struct pts
- {
- typedef char* type;
- };
- };
- template<>
- struct range_iterator_<const_char_ptr_>
- {
- template< typename S >
- struct pts
- {
- typedef const char* type;
- };
- };
- template<>
- struct range_iterator_<wchar_t_ptr_>
- {
- template< typename S >
- struct pts
- {
- typedef wchar_t* type;
- };
- };
- template<>
- struct range_iterator_<const_wchar_t_ptr_>
- {
- template< typename S >
- struct pts
- {
- typedef const wchar_t* type;
- };
- };
- //
- // const iterator
- //
- template<>
- struct range_const_iterator_<char_array_>
- {
- template< typename T >
- struct pts
- {
- typedef const BOOST_RANGE_DEDUCED_TYPENAME
- remove_extent<T>::type* type;
- };
- };
- template<>
- struct range_const_iterator_<char_ptr_>
- {
- template< typename S >
- struct pts
- {
- typedef const char* type;
- };
- };
- template<>
- struct range_const_iterator_<const_char_ptr_>
- {
- template< typename S >
- struct pts
- {
- typedef const char* type;
- };
- };
- template<>
- struct range_const_iterator_<wchar_t_ptr_>
- {
- template< typename S >
- struct pts
- {
- typedef const wchar_t* type;
- };
- };
- template<>
- struct range_const_iterator_<const_wchar_t_ptr_>
- {
- template< typename S >
- struct pts
- {
- typedef const wchar_t* type;
- };
- };
- }
- }
- #include <boost/range/detail/begin.hpp>
- #include <boost/range/detail/end.hpp>
- #include <boost/range/detail/size_type.hpp>
- #include <boost/range/detail/value_type.hpp>
- #include <boost/range/detail/common.hpp>
- namespace boost
- {
-
- namespace range_detail
- {
- //
- // str_begin()
- //
- template<>
- struct range_begin<char_ptr_>
- {
- static char* fun( char* s )
- {
- return s;
- }
- };
- template<>
- struct range_begin<const_char_ptr_>
- {
- static const char* fun( const char* s )
- {
- return s;
- }
- };
-
- template<>
- struct range_begin<wchar_t_ptr_>
- {
-
- static wchar_t* fun( wchar_t* s )
- {
- return s;
- }
- };
- template<>
- struct range_begin<const_wchar_t_ptr_>
- {
- static const wchar_t* fun( const wchar_t* s )
- {
- return s;
- }
- };
-
- template< typename C >
- inline BOOST_RANGE_DEDUCED_TYPENAME range_iterator<C>::type
- str_begin( C& c )
- {
- return range_detail::range_begin< BOOST_RANGE_DEDUCED_TYPENAME
- range_detail::range<C>::type >::fun( c );
- }
- //
- // str_end()
- //
- template<>
- struct range_end<char_array_>
- {
- template< typename T, std::size_t sz >
- static T* fun( T BOOST_RANGE_ARRAY_REF()[sz] )
- {
- return boost::range_detail::array_end( boost_range_array );
- }
- };
-
- template<>
- struct range_end<wchar_t_array_>
- {
- template< typename T, std::size_t sz >
- static T* fun( T BOOST_RANGE_ARRAY_REF()[sz] )
- {
- return boost::range_detail::array_end( boost_range_array );
- }
- };
-
- template<>
- struct range_end<char_ptr_>
- {
- static char* fun( char* s )
- {
- return boost::range_detail::str_end( s );
- }
- };
- template<>
- struct range_end<const_char_ptr_>
- {
- static const char* fun( const char* s )
- {
- return boost::range_detail::str_end( s );
- }
- };
- template<>
- struct range_end<wchar_t_ptr_>
- {
- static wchar_t* fun( wchar_t* s )
- {
- return boost::range_detail::str_end( s );
- }
- };
- template<>
- struct range_end<const_wchar_t_ptr_>
- {
- static const wchar_t* fun( const wchar_t* s )
- {
- return boost::range_detail::str_end( s );
- }
- };
- template< typename C >
- inline BOOST_RANGE_DEDUCED_TYPENAME range_iterator<C>::type
- str_end( C& c )
- {
- return range_detail::range_end< BOOST_RANGE_DEDUCED_TYPENAME
- range_detail::range<C>::type >::fun( c );
- }
- //
- // size_type
- //
- template<>
- struct range_size_type_<char_array_>
- {
- template< typename A >
- struct pts
- {
- typedef std::size_t type;
- };
- };
- template<>
- struct range_size_type_<char_ptr_>
- {
- template< typename S >
- struct pts
- {
- typedef std::size_t type;
- };
- };
-
- template<>
- struct range_size_type_<const_char_ptr_>
- {
- template< typename S >
- struct pts
- {
- typedef std::size_t type;
- };
- };
-
- template<>
- struct range_size_type_<wchar_t_ptr_>
- {
- template< typename S >
- struct pts
- {
- typedef std::size_t type;
- };
- };
-
- template<>
- struct range_size_type_<const_wchar_t_ptr_>
- {
- template< typename S >
- struct pts
- {
- typedef std::size_t type;
- };
- };
- //
- // value_type
- //
-
- template<>
- struct range_value_type_<char_array_>
- {
- template< typename T >
- struct pts
- {
- typedef char type;
- };
- };
- template<>
- struct range_value_type_<char_ptr_>
- {
- template< typename S >
- struct pts
- {
- typedef char type;
- };
- };
-
- template<>
- struct range_value_type_<const_char_ptr_>
- {
- template< typename S >
- struct pts
- {
- typedef const char type;
- };
- };
-
- template<>
- struct range_value_type_<wchar_t_ptr_>
- {
- template< typename S >
- struct pts
- {
- typedef wchar_t type;
- };
- };
-
- template<>
- struct range_value_type_<const_wchar_t_ptr_>
- {
- template< typename S >
- struct pts
- {
- typedef const wchar_t type;
- };
- };
- } // namespace 'range_detail'
- } // namespace 'boost'
- #endif
|