Boost.Locale: boost/locale/boundary/boundary_point.hpp Source File

| Boost.Locale

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files
- Examples

- File List

boundary_point.hpp
1 //
2 // Copyright (c) 2009-2011 Artyom Beilis (Tonkikh)
3 //
4 // Distributed under the Boost Software License, Version 1.0. (See
5 // accompanying file LICENSE_1_0.txt or copy at
6 // http://www.boost.org/LICENSE_1_0.txt)
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>
48 class boundary_point {
49 public:
53 typedef IteratorType iterator_type;
54
58 boundary_point() : rule_(0) {}
59
63 boundary_point(iterator_type p,rule_type r) :
64 iterator_(p),
65 rule_(r)
66 {
67 }
71 void iterator(iterator_type i)
72 {
73 iterator_ = i;
74 }
78 void rule(rule_type r)
79 {
80 rule_ = r;
81 }
85 iterator_type iterator() const
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
157 typedef boundary_point<std::string::const_iterator> sboundary_point;
158 typedef boundary_point<std::wstring::const_iterator> wsboundary_point;
159 #ifdef BOOST_LOCALE_ENABLE_CHAR16_T
160 typedef boundary_point<std::u16string::const_iterator> u16sboundary_point;
161 #endif
162 #ifdef BOOST_LOCALE_ENABLE_CHAR32_T
163 typedef boundary_point<std::u32string::const_iterator> u32sboundary_point;
164 #endif
165
166 typedef boundary_point<char const *> cboundary_point;
167 typedef boundary_point<wchar_t const *> wcboundary_point;
168 #ifdef BOOST_LOCALE_ENABLE_CHAR16_T
169 typedef boundary_point<char16_t const *> u16cboundary_point;
170 #endif
171 #ifdef BOOST_LOCALE_ENABLE_CHAR32_T
172 typedef boundary_point<char32_t const *> u32cboundary_point;
173 #endif
174
175
176 } // boundary
177 } // locale
178 } // boost
179
180
181 #endif
182
183 // vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
boost::locale::boundary::boundary_point::boundary_point
boundary_point(iterator_type p, rule_type r)
Definition: boundary_point.hpp:63
boost::locale::boundary::boundary_point::rule
void rule(rule_type r)
Definition: boundary_point.hpp:78
boost::locale::boundary::wcboundary_point
boundary_point< wchar_t const * > wcboundary_point
convenience typedef
Definition: boundary_point.hpp:167
boost::locale::boundary::boundary_point::rule
rule_type rule() const
Definition: boundary_point.hpp:92
boost::locale::boundary::u16cboundary_point
boundary_point< char16_t const * > u16cboundary_point
convenience typedef
Definition: boundary_point.hpp:169
boost::locale::boundary::rule_type
uint32_t rule_type
Flags used with word boundary analysis – the type of the word, line or sentence boundary found...
Definition: types.hpp:51
boost::locale::boundary::sboundary_point
boundary_point< std::string::const_iterator > sboundary_point
convenience typedef
Definition: boundary_point.hpp:157
boost::locale::boundary::boundary_point::operator==
bool operator==(iterator_type const &other) const
Definition: boundary_point.hpp:113
boost::locale::boundary::boundary_point::operator==
bool operator==(boundary_point const &other) const
Definition: boundary_point.hpp:99
boost::locale::boundary::operator==
bool operator==(BaseIterator const &l, boundary_point< BaseIterator > const &r)
Definition: boundary_point.hpp:142
boost::locale::boundary::u32sboundary_point
boundary_point< std::u32string::const_iterator > u32sboundary_point
convenience typedef
Definition: boundary_point.hpp:163
boost::locale::boundary::boundary_point::iterator
iterator_type iterator() const
Definition: boundary_point.hpp:85
boost::locale::boundary::wsboundary_point
boundary_point< std::wstring::const_iterator > wsboundary_point
convenience typedef
Definition: boundary_point.hpp:158
boost::locale::boundary::boundary_point::operator!=
bool operator!=(boundary_point const &other) const
Definition: boundary_point.hpp:106
boost::locale::boundary::boundary_point::boundary_point
boundary_point()
Definition: boundary_point.hpp:58
boost::locale::boundary::cboundary_point
boundary_point< char const * > cboundary_point
convenience typedef
Definition: boundary_point.hpp:166
boost::locale::boundary::boundary_point
This class represents a boundary point in the text.
Definition: boundary_point.hpp:48
boost::locale::boundary::boundary_point::iterator
void iterator(iterator_type i)
Definition: boundary_point.hpp:71
boost::locale::boundary::boundary_point::operator!=
bool operator!=(iterator_type const &other) const
Definition: boundary_point.hpp:120
boost::locale::boundary::u32cboundary_point
boundary_point< char32_t const * > u32cboundary_point
convenience typedef
Definition: boundary_point.hpp:172
boost::locale::boundary::boundary_point::iterator_type
IteratorType iterator_type
Definition: boundary_point.hpp:53
boost::locale::boundary::u16sboundary_point
boundary_point< std::u16string::const_iterator > u16sboundary_point
convenience typedef
Definition: boundary_point.hpp:160
boost::locale::boundary::operator!=
bool operator!=(BaseIterator const &l, boundary_point< BaseIterator > const &r)
Definition: boundary_point.hpp:150
- © Copyright 2009-2012 Artyom Beilis, Distributed under the Boost Software License, Version 1.0.