8 #ifndef BOOST_LOCALE_BOUNDARY_SEGMENT_HPP_INCLUDED 
    9 #define BOOST_LOCALE_BOUNDARY_SEGMENT_HPP_INCLUDED 
   10 #include <boost/locale/config.hpp> 
   12 #  pragma warning(push) 
   13 #  pragma warning(disable : 4275 4251 4231 4660) 
   26         template<
typename LeftIterator,
typename RightIterator>
 
   27         int compare_text(LeftIterator l_begin,LeftIterator l_end,RightIterator r_begin,RightIterator r_end)
 
   29             typedef LeftIterator left_iterator;
 
   30             typedef typename std::iterator_traits<left_iterator>::value_type char_type;
 
   31             typedef std::char_traits<char_type> traits;
 
   32             while(l_begin!=l_end && r_begin!=r_end) {
 
   33                 char_type lchar = *l_begin++;
 
   34                 char_type rchar = *r_begin++;
 
   35                 if(traits::eq(lchar,rchar))
 
   37                 if(traits::lt(lchar,rchar))
 
   42             if(l_begin==l_end && r_begin==r_end)
 
   51         template<
typename Left,
typename Right>
 
   52         int compare_text(Left 
const &l,Right 
const &r)
 
   54             return compare_text(l.begin(),l.end(),r.begin(),r.end());
 
   57         template<
typename Left,
typename Char>
 
   58         int compare_string(Left 
const &l,Char 
const *begin)
 
   60             Char 
const *end = begin;
 
   63             return compare_text(l.begin(),l.end(),begin,end);
 
   66         template<
typename Right,
typename Char>
 
   67         int compare_string(Char 
const *begin,Right 
const &r)
 
   69             Char 
const *end = begin;
 
   72             return compare_text(begin,end,r.begin(),r.end());
 
  101     template<
typename IteratorType>
 
  102     class segment : 
public std::pair<IteratorType,IteratorType> {
 
  107         typedef typename std::iterator_traits<IteratorType>::value_type 
char_type;
 
  137             std::pair<IteratorType,IteratorType>(b,e),
 
  174         template <
class T, 
class A>
 
  175         operator std::basic_string<char_type, T, A> ()
const 
  177             return std::basic_string<char_type, T, A>(this->first, this->second);
 
  194             return std::distance(
begin(),
end());
 
  225             return details::compare_text(*
this,other) == 0;
 
  231             return details::compare_text(*
this,other) != 0;
 
  241     template<
typename IteratorL,
typename IteratorR>
 
  244         return details::compare_text(l,r) == 0; 
 
  247     template<
typename IteratorL,
typename IteratorR>
 
  250         return details::compare_text(l,r) != 0; 
 
  254     template<
typename IteratorL,
typename IteratorR>
 
  257         return details::compare_text(l,r) < 0; 
 
  260     template<
typename IteratorL,
typename IteratorR>
 
  263         return details::compare_text(l,r) <= 0; 
 
  266     template<
typename IteratorL,
typename IteratorR>
 
  269         return details::compare_text(l,r) > 0; 
 
  272     template<
typename IteratorL,
typename IteratorR>
 
  275         return details::compare_text(l,r) >= 0; 
 
  279     template<
typename CharType,
typename Traits,
typename Alloc,
typename IteratorR>
 
  282         return details::compare_text(l,r) == 0; 
 
  285     template<
typename CharType,
typename Traits,
typename Alloc,
typename IteratorR>
 
  288         return details::compare_text(l,r) != 0; 
 
  292     template<
typename CharType,
typename Traits,
typename Alloc,
typename IteratorR>
 
  295         return details::compare_text(l,r) < 0; 
 
  298     template<
typename CharType,
typename Traits,
typename Alloc,
typename IteratorR>
 
  301         return details::compare_text(l,r) <= 0; 
 
  304     template<
typename CharType,
typename Traits,
typename Alloc,
typename IteratorR>
 
  307         return details::compare_text(l,r) > 0; 
 
  310     template<
typename CharType,
typename Traits,
typename Alloc,
typename IteratorR>
 
  313         return details::compare_text(l,r) >= 0; 
 
  317     template<
typename Iterator,
typename CharType,
typename Traits,
typename Alloc>
 
  320         return details::compare_text(l,r) == 0; 
 
  323     template<
typename Iterator,
typename CharType,
typename Traits,
typename Alloc>
 
  326         return details::compare_text(l,r) != 0; 
 
  330     template<
typename Iterator,
typename CharType,
typename Traits,
typename Alloc>
 
  331     bool operator<(segment<Iterator> 
const &l,std::basic_string<CharType,Traits,Alloc> 
const &r)
 
  333         return details::compare_text(l,r) < 0; 
 
  336     template<
typename Iterator,
typename CharType,
typename Traits,
typename Alloc>
 
  337     bool operator<=(segment<Iterator> 
const &l,std::basic_string<CharType,Traits,Alloc> 
const &r)
 
  339         return details::compare_text(l,r) <= 0; 
 
  342     template<
typename Iterator,
typename CharType,
typename Traits,
typename Alloc>
 
  345         return details::compare_text(l,r) > 0; 
 
  348     template<
typename Iterator,
typename CharType,
typename Traits,
typename Alloc>
 
  351         return details::compare_text(l,r) >= 0; 
 
  356     template<
typename CharType,
typename IteratorR>
 
  359         return details::compare_string(l,r) == 0; 
 
  362     template<
typename CharType,
typename IteratorR>
 
  365         return details::compare_string(l,r) != 0; 
 
  369     template<
typename CharType,
typename IteratorR>
 
  370     bool operator<(CharType const *l,segment<IteratorR> 
const &r)
 
  372         return details::compare_string(l,r) < 0; 
 
  375     template<
typename CharType,
typename IteratorR>
 
  376     bool operator<=(CharType const *l,segment<IteratorR> 
const &r)
 
  378         return details::compare_string(l,r) <= 0; 
 
  381     template<
typename CharType,
typename IteratorR>
 
  384         return details::compare_string(l,r) > 0; 
 
  387     template<
typename CharType,
typename IteratorR>
 
  390         return details::compare_string(l,r) >= 0; 
 
  394     template<
typename Iterator,
typename CharType>
 
  397         return details::compare_string(l,r) == 0; 
 
  400     template<
typename Iterator,
typename CharType>
 
  403         return details::compare_string(l,r) != 0; 
 
  407     template<
typename Iterator,
typename CharType>
 
  408     bool operator<(segment<Iterator> 
const &l,CharType 
const *r)
 
  410         return details::compare_string(l,r) < 0; 
 
  413     template<
typename Iterator,
typename CharType>
 
  414     bool operator<=(segment<Iterator> 
const &l,CharType 
const *r)
 
  416         return details::compare_string(l,r) <= 0; 
 
  419     template<
typename Iterator,
typename CharType>
 
  422         return details::compare_string(l,r) > 0; 
 
  425     template<
typename Iterator,
typename CharType>
 
  428         return details::compare_string(l,r) >= 0; 
 
  438     #ifdef BOOST_LOCALE_ENABLE_CHAR16_T 
  441     #ifdef BOOST_LOCALE_ENABLE_CHAR32_T 
  447     #ifdef BOOST_LOCALE_ENABLE_CHAR16_T 
  450     #ifdef BOOST_LOCALE_ENABLE_CHAR32_T 
  461     template<
typename CharType,
typename TraitsType,
typename Iterator>
 
  463             std::basic_ostream<CharType,TraitsType> &out,
 
  466         for(Iterator p=tok.
begin(),e=tok.
end();p!=e;++p)
 
segment< char const * > csegment
convenience typedef 
Definition: segment.hpp:445
std::iterator_traits< IteratorType >::value_type char_type
Definition: segment.hpp:107
segment(iterator b, iterator e, rule_type r)
Definition: segment.hpp:136
a segment object that represents a pair of two iterators that define the range where this segment exi...
Definition: segment.hpp:102
segment< wchar_t const * > wcsegment
convenience typedef 
Definition: segment.hpp:446
IteratorType end() const 
Definition: segment.hpp:166
bool operator==(segment const &other)
Compare two segments. 
Definition: segment.hpp:223
segment< char16_t const * > u16csegment
convenience typedef 
Definition: segment.hpp:448
segment< std::u16string::const_iterator > u16ssegment
convenience typedef 
Definition: segment.hpp:439
segment< std::string::const_iterator > ssegment
convenience typedef 
Definition: segment.hpp:436
std::basic_string< char_type > string_type
Definition: segment.hpp:111
string_type str() const 
Definition: segment.hpp:183
bool empty() const 
Definition: segment.hpp:200
bool operator!=(segment const &other)
Compare two segments. 
Definition: segment.hpp:229
uint32_t rule_type
Flags used with word boundary analysis – the type of the word, line or sentence boundary found...
Definition: types.hpp:51
void rule(rule_type r)
Definition: segment.hpp:215
bool operator>=(segment< IteratorL > const &l, segment< IteratorR > const &r)
Compare two segments. 
Definition: segment.hpp:273
char_type value_type
Definition: segment.hpp:115
rule_type rule() const 
Definition: segment.hpp:208
bool operator==(BaseIterator const &l, boundary_point< BaseIterator > const &r)
Definition: boundary_point.hpp:142
std::basic_ostream< CharType, TraitsType > & operator<<(std::basic_ostream< CharType, TraitsType > &out, segment< Iterator > const &tok)
Definition: segment.hpp:462
IteratorType begin() const 
Definition: segment.hpp:159
IteratorType const_iterator
Definition: segment.hpp:123
void begin(iterator const &v)
Definition: segment.hpp:144
segment()
Definition: segment.hpp:132
segment< std::wstring::const_iterator > wssegment
convenience typedef 
Definition: segment.hpp:437
segment< std::u32string::const_iterator > u32ssegment
convenience typedef 
Definition: segment.hpp:442
segment< char32_t const * > u32csegment
convenience typedef 
Definition: segment.hpp:451
void end(iterator const &v)
Definition: segment.hpp:151
IteratorType iterator
Definition: segment.hpp:119
size_t length() const 
Definition: segment.hpp:192
bool operator>(segment< IteratorL > const &l, segment< IteratorR > const &r)
Compare two segments. 
Definition: segment.hpp:267
std::iterator_traits< IteratorType >::difference_type difference_type
Definition: segment.hpp:127
bool operator!=(BaseIterator const &l, boundary_point< BaseIterator > const &r)
Definition: boundary_point.hpp:150