Boost.Locale
boost/locale/boundary/boundary_point.hpp
```00001 //
00002 //  Copyright (c) 2009-2011 Artyom Beilis (Tonkikh)
00003 //
00005 //  accompanying file LICENSE_1_0.txt or copy at
00007 //
00008 #ifndef BOOST_LOCALE_BOUNDARY_BOUNDARY_POINT_HPP_INCLUDED
00009 #define BOOST_LOCALE_BOUNDARY_BOUNDARY_POINT_HPP_INCLUDED
00010
00011 #include <boost/locale/boundary/types.hpp>
00012
00013 namespace boost {
00014 namespace locale {
00015 namespace boundary {
00016
00020
00047     template<typename IteratorType>
00048     class boundary_point  {
00049     public:
00053         typedef IteratorType iterator_type;
00054
00058         boundary_point() : rule_(0) {}
00059
00063         boundary_point(iterator_type p,rule_type r) :
00064             iterator_(p),
00065             rule_(r)
00066         {
00067         }
00071         void iterator(iterator_type i)
00072         {
00073             iterator_ = i;
00074         }
00078         void rule(rule_type r)
00079         {
00080             rule_ = r;
00081         }
00085         iterator_type iterator() const
00086         {
00087             return iterator_;
00088         }
00092         rule_type rule() const
00093         {
00094             return rule_;
00095         }
00099         bool operator==(boundary_point const &other) const
00100         {
00101             return iterator_ == other.iterator_ && rule_ = other.rule_;
00102         }
00106         bool operator!=(boundary_point const &other) const
00107         {
00108             return !(*this==other);
00109         }
00113         bool operator==(iterator_type const &other) const
00114         {
00115             return iterator_ == other;
00116         }
00120         bool operator!=(iterator_type const &other) const
00121         {
00122             return iterator_ != other;
00123         }
00124
00128         operator iterator_type ()const
00129         {
00130             return iterator_;
00131         }
00132
00133     private:
00134         iterator_type iterator_;
00135         rule_type rule_;
00136
00137     };
00141     template<typename BaseIterator>
00142     bool operator==(BaseIterator const &l,boundary_point<BaseIterator> const &r)
00143     {
00144         return r==l;
00145     }
00149     template<typename BaseIterator>
00150     bool operator!=(BaseIterator const &l,boundary_point<BaseIterator> const &r)
00151     {
00152         return r!=l;
00153     }
00154
00156
00157     typedef boundary_point<std::string::const_iterator> sboundary_point;
00158     typedef boundary_point<std::wstring::const_iterator> wsboundary_point;
00159     #ifdef BOOST_HAS_CHAR16_T
00160     typedef boundary_point<std::u16string::const_iterator> u16sboundary_point;
00161     #endif
00162     #ifdef BOOST_HAS_CHAR32_T
00163     typedef boundary_point<std::u32string::const_iterator> u32sboundary_point;
00164     #endif
00165
00166     typedef boundary_point<char const *> cboundary_point;
00167     typedef boundary_point<wchar_t const *> wcboundary_point;
00168     #ifdef BOOST_HAS_CHAR16_T
00169     typedef boundary_point<char16_t const *> u16cboundary_point;
00170     #endif
00171     #ifdef BOOST_HAS_CHAR32_T
00172     typedef boundary_point<char32_t const *> u32cboundary_point;
00173     #endif
00174
00175
00176 } // boundary
00177 } // locale
00178 } // boost
00179
00180
00181 #endif
00182
00183 // vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
```