Boost.Locale
boundary_point.hpp
1 //
2 // Copyright (c) 2009-2011 Artyom Beilis (Tonkikh)
3 //
5 // accompanying file LICENSE_1_0.txt or copy at
7 //
8 #ifndef BOOST_LOCALE_BOUNDARY_BOUNDARY_POINT_HPP_INCLUDED
9 #define BOOST_LOCALE_BOUNDARY_BOUNDARY_POINT_HPP_INCLUDED
10
11 #include <boost/locale/boundary/types.hpp>
12
13 namespace boost {
14 namespace locale {
15 namespace boundary {
16
20
47  template<typename IteratorType>
49  public:
53  typedef IteratorType iterator_type;
54
58  boundary_point() : rule_(0) {}
59
64  iterator_(p),
65  rule_(r)
66  {
67  }
72  {
73  iterator_ = i;
74  }
78  void rule(rule_type r)
79  {
80  rule_ = r;
81  }
86  {
87  return iterator_;
88  }
92  rule_type rule() const
93  {
94  return rule_;
95  }
99  bool operator==(boundary_point const &other) const
100  {
101  return iterator_ == other.iterator_ && rule_ = other.rule_;
102  }
106  bool operator!=(boundary_point const &other) const
107  {
108  return !(*this==other);
109  }
113  bool operator==(iterator_type const &other) const
114  {
115  return iterator_ == other;
116  }
120  bool operator!=(iterator_type const &other) const
121  {
122  return iterator_ != other;
123  }
124
128  operator iterator_type ()const
129  {
130  return iterator_;
131  }
132
133  private:
134  iterator_type iterator_;
135  rule_type rule_;
136
137  };
141  template<typename BaseIterator>
142  bool operator==(BaseIterator const &l,boundary_point<BaseIterator> const &r)
143  {
144  return r==l;
145  }
149  template<typename BaseIterator>
150  bool operator!=(BaseIterator const &l,boundary_point<BaseIterator> const &r)
151  {
152  return r!=l;
153  }
154
156
159  #ifdef BOOST_LOCALE_ENABLE_CHAR16_T
161  #endif
162  #ifdef BOOST_LOCALE_ENABLE_CHAR32_T
164  #endif
165
168  #ifdef BOOST_LOCALE_ENABLE_CHAR16_T
170  #endif
171  #ifdef BOOST_LOCALE_ENABLE_CHAR32_T
173  #endif
174
175
176 } // boundary
177 } // locale
178 } // boost
179
180
181 #endif
182
183 // vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
boundary_point(iterator_type p, rule_type r)
Definition: boundary_point.hpp:63
void rule(rule_type r)
Definition: boundary_point.hpp:78
boundary_point< wchar_t const * > wcboundary_point
convenience typedef
Definition: boundary_point.hpp:167
rule_type rule() const
Definition: boundary_point.hpp:92
boundary_point< char16_t const * > u16cboundary_point
convenience typedef
Definition: boundary_point.hpp:169
uint32_t rule_type
Flags used with word boundary analysis – the type of the word, line or sentence boundary found...
Definition: types.hpp:51
boundary_point< std::string::const_iterator > sboundary_point
convenience typedef
Definition: boundary_point.hpp:157
bool operator==(iterator_type const &other) const
Definition: boundary_point.hpp:113
bool operator==(boundary_point const &other) const
Definition: boundary_point.hpp:99
bool operator==(BaseIterator const &l, boundary_point< BaseIterator > const &r)
Definition: boundary_point.hpp:142
boundary_point< std::u32string::const_iterator > u32sboundary_point
convenience typedef
Definition: boundary_point.hpp:163
iterator_type iterator() const
Definition: boundary_point.hpp:85
boundary_point< std::wstring::const_iterator > wsboundary_point
convenience typedef
Definition: boundary_point.hpp:158
bool operator!=(boundary_point const &other) const
Definition: boundary_point.hpp:106
boundary_point()
Definition: boundary_point.hpp:58
boundary_point< char const * > cboundary_point
convenience typedef
Definition: boundary_point.hpp:166
This class represents a boundary point in the text.
Definition: boundary_point.hpp:48
void iterator(iterator_type i)
Definition: boundary_point.hpp:71
bool operator!=(iterator_type const &other) const
Definition: boundary_point.hpp:120
boundary_point< char32_t const * > u32cboundary_point
convenience typedef
Definition: boundary_point.hpp:172
IteratorType iterator_type
Definition: boundary_point.hpp:53
boundary_point< std::u16string::const_iterator > u16sboundary_point
convenience typedef
Definition: boundary_point.hpp:160
bool operator!=(BaseIterator const &l, boundary_point< BaseIterator > const &r)
Definition: boundary_point.hpp:150