Boost.Locale
boundary_point.hpp
1 //
2 // Copyright (c) 2009-2011 Artyom Beilis (Tonkikh)
3 //
4 // Distributed under the Boost Software License, Version 1.0.
5 // https://www.boost.org/LICENSE_1_0.txt
6 
7 #ifndef BOOST_LOCALE_BOUNDARY_BOUNDARY_POINT_HPP_INCLUDED
8 #define BOOST_LOCALE_BOUNDARY_BOUNDARY_POINT_HPP_INCLUDED
9 
10 #include <boost/locale/boundary/types.hpp>
11 
12 namespace boost {
13 namespace locale {
14 namespace boundary {
15 
19 
46  template<typename IteratorType>
48  public:
52  typedef IteratorType iterator_type;
53 
57  boundary_point() : rule_(0) {}
58 
63  iterator_(p),
64  rule_(r)
65  {
66  }
71  {
72  iterator_ = i;
73  }
77  void rule(rule_type r)
78  {
79  rule_ = r;
80  }
85  {
86  return iterator_;
87  }
91  rule_type rule() const
92  {
93  return rule_;
94  }
98  bool operator==(boundary_point const &other) const
99  {
100  return iterator_ == other.iterator_ && rule_ = other.rule_;
101  }
105  bool operator!=(boundary_point const &other) const
106  {
107  return !(*this==other);
108  }
112  bool operator==(iterator_type const &other) const
113  {
114  return iterator_ == other;
115  }
119  bool operator!=(iterator_type const &other) const
120  {
121  return iterator_ != other;
122  }
123 
127  operator iterator_type ()const
128  {
129  return iterator_;
130  }
131 
132  private:
133  iterator_type iterator_;
134  rule_type rule_;
135 
136  };
140  template<typename BaseIterator>
141  bool operator==(BaseIterator const &l,boundary_point<BaseIterator> const &r)
142  {
143  return r==l;
144  }
148  template<typename BaseIterator>
149  bool operator!=(BaseIterator const &l,boundary_point<BaseIterator> const &r)
150  {
151  return r!=l;
152  }
153 
155 
158  #ifdef BOOST_LOCALE_ENABLE_CHAR16_T
160  #endif
161  #ifdef BOOST_LOCALE_ENABLE_CHAR32_T
163  #endif
164 
167  #ifdef BOOST_LOCALE_ENABLE_CHAR16_T
169  #endif
170  #ifdef BOOST_LOCALE_ENABLE_CHAR32_T
172  #endif
173 
174 
175 } // boundary
176 } // locale
177 } // boost
178 
179 
180 #endif
181 
boundary_point(iterator_type p, rule_type r)
Definition: boundary_point.hpp:62
void rule(rule_type r)
Definition: boundary_point.hpp:77
bool operator!=(boundary_point const &other) const
Definition: boundary_point.hpp:105
iterator_type iterator() const
Definition: boundary_point.hpp:84
rule_type rule() const
Definition: boundary_point.hpp:91
boundary_point< wchar_t const * > wcboundary_point
convenience typedef
Definition: boundary_point.hpp:166
boundary_point< char16_t const * > u16cboundary_point
convenience typedef
Definition: boundary_point.hpp:168
uint32_t rule_type
Flags used with word boundary analysis – the type of the word, line or sentence boundary found.
Definition: types.hpp:50
boundary_point< std::string::const_iterator > sboundary_point
convenience typedef
Definition: boundary_point.hpp:156
bool operator==(iterator_type const &other) const
Definition: boundary_point.hpp:112
bool operator==(BaseIterator const &l, boundary_point< BaseIterator > const &r)
Definition: boundary_point.hpp:141
bool operator!=(iterator_type const &other) const
Definition: boundary_point.hpp:119
bool operator==(boundary_point const &other) const
Definition: boundary_point.hpp:98
boundary_point< std::u32string::const_iterator > u32sboundary_point
convenience typedef
Definition: boundary_point.hpp:162
boundary_point< std::wstring::const_iterator > wsboundary_point
convenience typedef
Definition: boundary_point.hpp:157
boundary_point()
Definition: boundary_point.hpp:57
boundary_point< char const * > cboundary_point
convenience typedef
Definition: boundary_point.hpp:165
This class represents a boundary point in the text.
Definition: boundary_point.hpp:47
void iterator(iterator_type i)
Definition: boundary_point.hpp:70
boundary_point< char32_t const * > u32cboundary_point
convenience typedef
Definition: boundary_point.hpp:171
IteratorType iterator_type
Definition: boundary_point.hpp:52
boundary_point< std::u16string::const_iterator > u16sboundary_point
convenience typedef
Definition: boundary_point.hpp:159
bool operator!=(BaseIterator const &l, boundary_point< BaseIterator > const &r)
Definition: boundary_point.hpp:149