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::boundary_point_index< BaseIterator > Class Template Reference

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

#include <index.hpp>

Public Types

typedef BaseIterator base_iterator
 The type of the iterator used to iterate over the original text. More...
 
typedef
details::boundary_point_index_iterator
< base_iterator
iterator
 
typedef
details::boundary_point_index_iterator
< base_iterator
const_iterator
 
typedef boundary_point
< base_iterator
value_type
 The type dereferenced by the iterator and const_iterator. More...
 

Public Member Functions

 boundary_point_index ()
 Default constructor. More...
 
 boundary_point_index (boundary_type type, base_iterator begin, base_iterator end, rule_type mask, std::locale const &loc=std::locale())
 Create a segment_index for boundary analysis type of the text in range [begin,end) using a rule mask for locale loc. More...
 
 boundary_point_index (boundary_type type, base_iterator begin, base_iterator end, std::locale const &loc=std::locale())
 Create a segment_index for boundary analysis type of the text in range [begin,end) selecting all possible boundary points (full mask) for locale loc. More...
 
 boundary_point_index (segment_index< base_iterator > const &other)
 Create a boundary_point_index from a segment_index. More...
 
boundary_point_index const & operator= (segment_index< base_iterator > const &other)
 Copy a boundary_point_index from a segment_index. More...
 
void map (boundary_type type, base_iterator begin, base_iterator end, std::locale const &loc=std::locale())
 Create a new index for boundary analysis type of the text in range [begin,end) for locale loc. More...
 
iterator begin () const
 Get the iterator on the beginning of the boundary points range. More...
 
iterator end () const
 Get the iterator on the ending of the boundary points range. More...
 
iterator find (base_iterator p) const
 Find a first valid boundary point on a position p or following it. More...
 
rule_type rule () const
 Get the mask of rules that are used. More...
 
void rule (rule_type v)
 Set the mask of rules that are used. More...
 

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: