# Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. — Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

Public Types | Public Member Functions

# 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>`

List of all members.

## Public Types

typedef std::iterator_traits < IteratorType >::value_type | char_type
typedef std::basic_string < char_type > | string_type
typedef char_type | value_type
typedef IteratorType | iterator
typedef IteratorType | const_iterator
typedef std::iterator_traits < IteratorType > ::difference_type | difference_type

## Public Member Functions

| segment ()
| segment (iterator b, iterator e, rule_type r)
void | begin (iterator const &v)
void | end (iterator const &v)
IteratorType | begin () const
IteratorType | end () const
template<class T , class A >
| operator std::basic_string< char_type, T, A > () const
string_type | str () const
size_t | length () const
bool | empty () const
rule_type | rule () const
void | rule (rule_type r)
bool | operator== (segment const &other)
| Compare two segments.
bool | operator!= (segment const &other)
| 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

## Member Typedef Documentation

template<typename IteratorType>

typedef std::iterator_traits<IteratorType>::value_type boost::locale::boundary::segment< IteratorType >::char_type

The type of the underlying character

template<typename IteratorType>

typedef IteratorType boost::locale::boundary::segment< IteratorType >::const_iterator

The iterator that allows to iterate the range

template<typename IteratorType>

typedef std::iterator_traits<IteratorType>::difference_type boost::locale::boundary::segment< IteratorType >::difference_type

The type that represent a difference between two iterators

template<typename IteratorType>

typedef IteratorType boost::locale::boundary::segment< IteratorType >::iterator

The iterator that allows to iterate the range

template<typename IteratorType>

typedef std::basic_string<char_type> boost::locale::boundary::segment< IteratorType >::string_type

The type of the string it is converted to

template<typename IteratorType>

typedef char_type boost::locale::boundary::segment< IteratorType >::value_type

The value that iterators return - the character itself

## Constructor & Destructor Documentation

template<typename IteratorType>

boost::locale::boundary::segment< IteratorType >::segment | ( |  | ) | `[inline]`

Default constructor

template<typename IteratorType>

boost::locale::boundary::segment< IteratorType >::segment | ( | iterator | b,
|  | iterator | e,
|  | rule_type | r |
| ) |  |  | `[inline]`

Create a segment using two iterators and a rule that represents this point

## Member Function Documentation

template<typename IteratorType>

void boost::locale::boundary::segment< IteratorType >::begin | ( | iterator const & | v | ) | `[inline]`

Set the start of the range

template<typename IteratorType>

IteratorType boost::locale::boundary::segment< IteratorType >::begin | ( |  | ) | const`[inline]`

Get the start of the range

template<typename IteratorType>

bool boost::locale::boundary::segment< IteratorType >::empty | ( |  | ) | const`[inline]`

Check if the segment is empty

template<typename IteratorType>

void boost::locale::boundary::segment< IteratorType >::end | ( | iterator const & | v | ) | `[inline]`

Set the end of the range

template<typename IteratorType>

IteratorType boost::locale::boundary::segment< IteratorType >::end | ( |  | ) | const`[inline]`

Set the end of the range

template<typename IteratorType>

size_t boost::locale::boundary::segment< IteratorType >::length | ( |  | ) | const`[inline]`

Get the length of the text chunk

template<typename IteratorType>
template<class T , class A >

boost::locale::boundary::segment< IteratorType >::operator std::basic_string< char_type, T, A > | ( |  | ) | const`[inline]`

Convert the range to a string automatically

template<typename IteratorType>

rule_type boost::locale::boundary::segment< IteratorType >::rule | ( |  | ) | const`[inline]`

Get the rule that is used for selection of this segment.

template<typename IteratorType>

void boost::locale::boundary::segment< IteratorType >::rule | ( | rule_type | r | ) | `[inline]`

Set a rule that is used for segment selection

template<typename IteratorType>

string_type boost::locale::boundary::segment< IteratorType >::str | ( |  | ) | const`[inline]`

Create a string from the range explicitly

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

- boost/locale/boundary/segment.hpp