boost::locale::boundary::segment< IteratorType > Class Template Reference
Boundary Analysis

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 <boost/locale/boundary/segment.hpp>`

Inheritance diagram for boost::locale::boundary::segment< IteratorType >:

## Public Types

typedef std::iterator_traits< IteratorType >::value_type | char_type
| The type of the underlying character.
typedef std::basic_string< char_type > | string_type
| The type of the string it is converted to.
typedef char_type | value_type
| The value that iterators return - the character itself.
typedef IteratorType | iterator
| The iterator that allows to iterate the range.
typedef IteratorType | const_iterator
| The iterator that allows to iterate the range.
typedef std::iterator_traits< IteratorType >::difference_type | difference_type
| The type that represent a difference between two iterators.

## Public Member Functions

| segment ()
| Default constructor.
| segment (iterator b, iterator e, rule_type r)
| Create a segment using two iterators and a rule that represents this point.
void | begin (const iterator &v)
| Set the start of the range.
void | end (const iterator &v)
| Set the end of the range.
IteratorType | begin () const
| Get the start of the range.
IteratorType | end () const
| Set the end of the range.
template<class T , class A >
| operator std::basic_string< char_type, T, A > () const
| Convert the range to a string automatically.
string_type | str () const
| Create a string from the range explicitly.
size_t | length () const
| Get the length of the text chunk.
bool | empty () const
| Check if the segment is empty.
rule_type | rule () const
| Get the rule that is used for selection of this segment.
void | rule (rule_type r)
| Set a rule that is used for segment selection.
bool | operator== (const segment &other) const
| Compare two segments.
bool | operator!= (const segment &other) const
| Compare two segments.

## Detailed Description

template<typename IteratorType>
class boost::locale::boundary::segment< IteratorType >

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.

See also

- segment_index
- boundary_point
- boundary_point_index

Examples
  boundary.cpp, and wboundary.cpp.

The documentation for this class was generated from the following file:

- boost/locale/boundary/segment.hpp

- © Copyright 2009-2012 Artyom Beilis, Distributed under the Boost Software License, Version 1.0.