a segment object that represents a pair of two iterators that define the range where this segment exits and a rule that defines it. More...
#include <segment.hpp>
Public Types | |
typedef std::iterator_traits < IteratorType >::value_type | char_type |
The type of the underlying character. More... | |
typedef std::basic_string < char_type > | string_type |
The type of the string it is converted to. More... | |
typedef char_type | value_type |
The value that iterators return - the character itself. More... | |
typedef IteratorType | iterator |
The iterator that allows to iterate the range. More... | |
typedef IteratorType | const_iterator |
The iterator that allows to iterate the range. More... | |
typedef std::iterator_traits < IteratorType > ::difference_type | difference_type |
The type that represent a difference between two iterators. More... | |
Public Member Functions | |
segment () | |
Default constructor. More... | |
segment (iterator b, iterator e, rule_type r) | |
Create a segment using two iterators and a rule that represents this point. More... | |
void | begin (iterator const &v) |
Set the start of the range. More... | |
void | end (iterator const &v) |
Set the end of the range. More... | |
IteratorType | begin () const |
Get the start of the range. More... | |
IteratorType | end () const |
Set the end of the range. More... | |
template<class T , class A > | |
operator std::basic_string< char_type, T, A > () const | |
Convert the range to a string automatically. More... | |
string_type | str () const |
Create a string from the range explicitly. More... | |
size_t | length () const |
Get the length of the text chunk. More... | |
bool | empty () const |
Check if the segment is empty. More... | |
rule_type | rule () const |
Get the rule that is used for selection of this segment. More... | |
void | rule (rule_type r) |
Set a rule that is used for segment selection. More... | |
bool | operator== (segment const &other) |
Compare two segments. More... | |
bool | operator!= (segment const &other) |
Compare two segments. More... | |
a segment object that represents a pair of two iterators that define the range where this segment exits and a rule that defines it.
This type of object is dereferenced by the iterators of segment_index. Using a rule() member function you can get a specific rule this segment was selected with. For example, when you use word boundary analysis, you can check if the specific word contains Kana letters by checking (rule() & word_kana)!=0 For a sentence analysis you can check if the sentence is selected because a sentence terminator is found (sentence_term) or there is a line break (sentence_sep).
This object can be automatically converted to std::basic_string with the same type of character. It is also valid range that has begin() and end() member functions returning iterators on the location of the segment.
typedef std::iterator_traits<IteratorType>::value_type boost::locale::boundary::segment< IteratorType >::char_type |
The type of the underlying character.
typedef IteratorType boost::locale::boundary::segment< IteratorType >::const_iterator |
The iterator that allows to iterate the range.
typedef std::iterator_traits<IteratorType>::difference_type boost::locale::boundary::segment< IteratorType >::difference_type |
The type that represent a difference between two iterators.
typedef IteratorType boost::locale::boundary::segment< IteratorType >::iterator |
The iterator that allows to iterate the range.
typedef std::basic_string<char_type> boost::locale::boundary::segment< IteratorType >::string_type |
The type of the string it is converted to.
typedef char_type boost::locale::boundary::segment< IteratorType >::value_type |
The value that iterators return - the character itself.
|
inline |
Default constructor.
|
inline |
Create a segment using two iterators and a rule that represents this point.
|
inline |
Set the start of the range.
References boost::xpressive::first.
Referenced by boost::locale::boundary::operator<<().
|
inline |
Get the start of the range.
References boost::xpressive::first.
Referenced by boost::locale::boundary::segment< IteratorType >::empty(), boost::locale::boundary::segment< IteratorType >::length(), and boost::locale::boundary::segment< IteratorType >::str().
|
inline |
Check if the segment is empty.
References boost::locale::boundary::segment< IteratorType >::begin(), and boost::locale::boundary::segment< IteratorType >::end().
|
inline |
Set the end of the range.
References boost::locale::period::marks::second.
Referenced by boost::locale::boundary::operator<<().
|
inline |
Set the end of the range.
References boost::locale::period::marks::second.
Referenced by boost::locale::boundary::segment< IteratorType >::empty(), boost::locale::boundary::segment< IteratorType >::length(), and boost::locale::boundary::segment< IteratorType >::str().
|
inline |
Get the length of the text chunk.
References boost::locale::boundary::segment< IteratorType >::begin(), boost::fusion::distance(), and boost::locale::boundary::segment< IteratorType >::end().
|
inline |
Convert the range to a string automatically.
References boost::xpressive::first, and boost::locale::period::marks::second.
|
inline |
Compare two segments.
|
inline |
Compare two segments.
|
inline |
Get the rule that is used for selection of this segment.
|
inline |
Set a rule that is used for segment selection.
|
inline |
Create a string from the range explicitly.
References boost::locale::boundary::segment< IteratorType >::begin(), and boost::locale::boundary::segment< IteratorType >::end().