Boost.Locale
boost::locale::boundary::boundary_point_index< BaseIterator > Class Template Reference

This class holds an index of boundary points and allows iterating over them. More...

#include <boost/locale/boundary/index.hpp>

Public Types

typedef BaseIterator base_iterator
 The type of the iterator used to iterate over the original text.
 
typedef unspecified_iterator_type iterator
 
typedef unspecified_iterator_type const_iterator
 
typedef boundary_point< base_iteratorvalue_type
 

Public Member Functions

 boundary_point_index ()
 
 boundary_point_index (boundary_type type, base_iterator begin, base_iterator end, rule_type mask, const std::locale &loc=std::locale())
 
 boundary_point_index (boundary_type type, base_iterator begin, base_iterator end, const std::locale &loc=std::locale())
 
 boundary_point_index (const segment_index< base_iterator > &other)
 
boundary_point_indexoperator= (const segment_index< base_iterator > &other)
 
void map (boundary_type type, base_iterator begin, base_iterator end, const std::locale &loc=std::locale())
 
iterator begin () const
 
iterator end () const
 
iterator find (base_iterator p) const
 
rule_type rule () const
 Get the mask of rules that are used.
 
void rule (rule_type v)
 Set the mask of rules that are used.
 

Friends

class segment_index< base_iterator >
 

Detailed Description

template<typename BaseIterator>
class boost::locale::boundary::boundary_point_index< BaseIterator >

This class holds an index of boundary points and allows iterating over them.

This class is provides begin() and end() member functions that return bidirectional iterators to the boundary_point objects.

It provides an option that affects selecting boundary points according to different rules: using rule(rule_type mask) member function. It allows to set a mask that select only specific types of boundary points like sentence_term.

For example for a sentence boundary analysis of a text "Hello! How\nare you?" when the default rule is used the boundary points would be:

  • "|Hello! How\nare you?"
  • "Hello! |How\nare you?"
  • "Hello! How\n|are you?"
  • "Hello! How\nare you?|"

However if rule() is set to sentence_term then the selected boundary points would be:

  • "|Hello! How\nare you?"
  • "Hello! |How\nare you?"
  • "Hello! How\nare you?|"

Such that a boundary point defined by a line feed character would be ignored.

This class allows to find a boundary_point according to the given iterator in range using find() member function.

Note
  • Even an empty text range [x,x) considered to have a one boundary point x.
  • a and b points of the range [a,b) are always considered boundary points regardless the rules used.
  • Changing any of the option rule() or course re-indexing the text invalidates existing iterators and they can't be used any more.
  • boundary_point_index can be created from segment_index or other boundary_point_index that was created with same boundary_type. This is very fast operation as they shared same index and it does not require its regeneration.
See also

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