File indexing completed on 2025-01-30 09:44:55
0001
0002
0003
0004
0005
0006
0007 #ifndef BOOST_LOCALE_BOUNDARY_BOUNDARY_POINT_HPP_INCLUDED
0008 #define BOOST_LOCALE_BOUNDARY_BOUNDARY_POINT_HPP_INCLUDED
0009
0010 #include <boost/locale/boundary/types.hpp>
0011 #include <string>
0012
0013 namespace boost { namespace locale { namespace boundary {
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043 template<typename IteratorType>
0044 class boundary_point {
0045 public:
0046
0047 typedef IteratorType iterator_type;
0048
0049
0050 boundary_point() : rule_(0) {}
0051
0052
0053 boundary_point(iterator_type p, rule_type r) : iterator_(p), rule_(r) {}
0054
0055
0056 void iterator(iterator_type i) { iterator_ = i; }
0057
0058 iterator_type iterator() const { return iterator_; }
0059
0060
0061 void rule(rule_type r) { rule_ = r; }
0062
0063 rule_type rule() const { return rule_; }
0064
0065
0066 bool operator==(const boundary_point& other) const
0067 {
0068 return iterator_ == other.iterator_ && rule_ = other.rule_;
0069 }
0070
0071 bool operator!=(const boundary_point& other) const { return !(*this == other); }
0072
0073
0074 bool operator==(const iterator_type& other) const { return iterator_ == other; }
0075
0076 bool operator!=(const iterator_type& other) const { return iterator_ != other; }
0077
0078
0079 operator iterator_type() const { return iterator_; }
0080
0081 private:
0082 iterator_type iterator_;
0083 rule_type rule_;
0084 };
0085
0086
0087 template<typename BaseIterator>
0088 bool operator==(const BaseIterator& l, const boundary_point<BaseIterator>& r)
0089 {
0090 return r == l;
0091 }
0092
0093 template<typename BaseIterator>
0094 bool operator!=(const BaseIterator& l, const boundary_point<BaseIterator>& r)
0095 {
0096 return r != l;
0097 }
0098
0099
0100
0101 typedef boundary_point<std::string::const_iterator> sboundary_point;
0102 typedef boundary_point<std::wstring::const_iterator> wsboundary_point;
0103 #ifndef BOOST_LOCALE_NO_CXX20_STRING8
0104 typedef boundary_point<std::u8string::const_iterator> u8sboundary_point;
0105 #endif
0106 #ifdef BOOST_LOCALE_ENABLE_CHAR16_T
0107 typedef boundary_point<std::u16string::const_iterator> u16sboundary_point;
0108 #endif
0109 #ifdef BOOST_LOCALE_ENABLE_CHAR32_T
0110 typedef boundary_point<std::u32string::const_iterator> u32sboundary_point;
0111 #endif
0112
0113 typedef boundary_point<const char*> cboundary_point;
0114 typedef boundary_point<const wchar_t*> wcboundary_point;
0115 #ifdef __cpp_char8_t
0116 typedef boundary_point<const char8_t*> u8cboundary_point;
0117 #endif
0118 #ifdef BOOST_LOCALE_ENABLE_CHAR16_T
0119 typedef boundary_point<const char16_t*> u16cboundary_point;
0120 #endif
0121 #ifdef BOOST_LOCALE_ENABLE_CHAR32_T
0122 typedef boundary_point<const char32_t*> u32cboundary_point;
0123 #endif
0124
0125 }}}
0126
0127 #endif