Boost  v1.57.0
doxygen for www.boost.org
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
boost::locale::boundary::segment< IteratorType > Class Template Reference

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>

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

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...
 

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

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.

References boost::xpressive::first.

Referenced by boost::locale::boundary::operator<<().

template<typename IteratorType>
IteratorType boost::locale::boundary::segment< IteratorType >::begin ( void  ) const
inline
template<typename IteratorType>
bool boost::locale::boundary::segment< IteratorType >::empty ( void  ) const
inline
template<typename IteratorType>
void boost::locale::boundary::segment< IteratorType >::end ( iterator const &  v)
inline

Set the end of the range.

References boost::locale::period::marks::second.

Referenced by boost::locale::boundary::operator<<().

template<typename IteratorType>
size_t boost::locale::boundary::segment< IteratorType >::length ( ) const
inline
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.

References boost::xpressive::first, and boost::locale::period::marks::second.

template<typename IteratorType>
bool boost::locale::boundary::segment< IteratorType >::operator!= ( segment< IteratorType > const &  other)
inline

Compare two segments.

template<typename IteratorType>
bool boost::locale::boundary::segment< IteratorType >::operator== ( segment< IteratorType > const &  other)
inline

Compare two segments.

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

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