Boost.Locale
boost::locale::boundary Namespace Reference

This namespace contains all operations required for boundary analysis of text. More...

Classes

class  boundary_indexing
 This facet generates an index for boundary analysis of a given text. More...
 
class  boundary_point
 This class represents a boundary point in the text. More...
 
class  boundary_point_index
 This class holds an index of boundary points and allows iterating over them. More...
 
struct  break_info
 This structure is used for representing boundary points that follow the offset. More...
 
class  segment
 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...
 
class  segment_index
 This class holds an index of segments in the text range and allows to iterate over them. More...
 

Typedefs

typedef boundary_point< std::string::const_iterator > sboundary_point
 convenience typedef
 
typedef boundary_point< std::wstring::const_iterator > wsboundary_point
 convenience typedef
 
typedef boundary_point< std::u8string::const_iterator > u8sboundary_point
 convenience typedef
 
typedef boundary_point< std::u16string::const_iterator > u16sboundary_point
 convenience typedef
 
typedef boundary_point< std::u32string::const_iterator > u32sboundary_point
 convenience typedef
 
typedef boundary_point< const char * > cboundary_point
 convenience typedef
 
typedef boundary_point< const wchar_t * > wcboundary_point
 convenience typedef
 
typedef boundary_point< const char16_t * > u16cboundary_point
 convenience typedef
 
typedef boundary_point< const char32_t * > u32cboundary_point
 convenience typedef
 
typedef std::vector< break_infoindex_type
 
typedef segment_index< std::string::const_iterator > ssegment_index
 convenience typedef
 
typedef segment_index< std::wstring::const_iterator > wssegment_index
 convenience typedef
 
typedef segment_index< std::u8string::const_iterator > u8ssegment_index
 convenience typedef
 
typedef segment_index< std::u16string::const_iterator > u16ssegment_index
 convenience typedef
 
typedef segment_index< std::u32string::const_iterator > u32ssegment_index
 convenience typedef
 
typedef segment_index< const char * > csegment_index
 convenience typedef
 
typedef segment_index< const wchar_t * > wcsegment_index
 convenience typedef
 
typedef segment_index< const char16_t * > u16csegment_index
 convenience typedef
 
typedef segment_index< const char32_t * > u32csegment_index
 convenience typedef
 
typedef boundary_point_index< std::string::const_iterator > sboundary_point_index
 convenience typedef
 
typedef boundary_point_index< std::wstring::const_iterator > wsboundary_point_index
 convenience typedef
 
typedef boundary_point_index< std::u8string::const_iterator > u8sboundary_point_index
 convenience typedef
 
typedef boundary_point_index< std::u16string::const_iterator > u16sboundary_point_index
 convenience typedef
 
typedef boundary_point_index< std::u32string::const_iterator > u32sboundary_point_index
 convenience typedef
 
typedef boundary_point_index< const char * > cboundary_point_index
 convenience typedef
 
typedef boundary_point_index< const wchar_t * > wcboundary_point_index
 convenience typedef
 
typedef boundary_point_index< const char16_t * > u16cboundary_point_index
 convenience typedef
 
typedef boundary_point_index< const char32_t * > u32cboundary_point_index
 convenience typedef
 
typedef segment< std::string::const_iterator > ssegment
 convenience typedef
 
typedef segment< std::wstring::const_iterator > wssegment
 convenience typedef
 
typedef segment< std::u8string::const_iterator > u8ssegment
 convenience typedef
 
typedef segment< std::u16string::const_iterator > u16ssegment
 convenience typedef
 
typedef segment< std::u32string::const_iterator > u32ssegment
 convenience typedef
 
typedef segment< const char * > csegment
 convenience typedef
 
typedef segment< const wchar_t * > wcsegment
 convenience typedef
 
typedef segment< const char16_t * > u16csegment
 convenience typedef
 
typedef segment< const char32_t * > u32csegment
 convenience typedef
 
typedef uint32_t rule_type
 Flags used with word boundary analysis – the type of the word, line or sentence boundary found. More...
 

Enumerations

enum  boundary_type { character , word , sentence , line }
 This type describes a possible boundary analysis alternatives. More...
 

Functions

template<typename BaseIterator >
bool operator== (const BaseIterator &l, const boundary_point< BaseIterator > &r)
 Check if the boundary point r points to same location as an iterator l.
 
template<typename BaseIterator >
bool operator!= (const BaseIterator &l, const boundary_point< BaseIterator > &r)
 Check if the boundary point r points to different location from an iterator l.
 
template<typename IteratorL , typename IteratorR >
bool operator== (const segment< IteratorL > &l, const segment< IteratorR > &r)
 Compare two segments.
 
template<typename IteratorL , typename IteratorR >
bool operator!= (const segment< IteratorL > &l, const segment< IteratorR > &r)
 Compare two segments.
 
template<typename IteratorL , typename IteratorR >
bool operator< (const segment< IteratorL > &l, const segment< IteratorR > &r)
 Compare two segments.
 
template<typename IteratorL , typename IteratorR >
bool operator<= (const segment< IteratorL > &l, const segment< IteratorR > &r)
 Compare two segments.
 
template<typename IteratorL , typename IteratorR >
bool operator> (const segment< IteratorL > &l, const segment< IteratorR > &r)
 Compare two segments.
 
template<typename IteratorL , typename IteratorR >
bool operator>= (const segment< IteratorL > &l, const segment< IteratorR > &r)
 Compare two segments.
 
template<typename CharType , typename Traits , typename Alloc , typename IteratorR >
bool operator== (const std::basic_string< CharType, Traits, Alloc > &l, const segment< IteratorR > &r)
 Compare string and segment.
 
template<typename CharType , typename Traits , typename Alloc , typename IteratorR >
bool operator!= (const std::basic_string< CharType, Traits, Alloc > &l, const segment< IteratorR > &r)
 Compare string and segment.
 
template<typename CharType , typename Traits , typename Alloc , typename IteratorR >
bool operator< (const std::basic_string< CharType, Traits, Alloc > &l, const segment< IteratorR > &r)
 Compare string and segment.
 
template<typename CharType , typename Traits , typename Alloc , typename IteratorR >
bool operator<= (const std::basic_string< CharType, Traits, Alloc > &l, const segment< IteratorR > &r)
 Compare string and segment.
 
template<typename CharType , typename Traits , typename Alloc , typename IteratorR >
bool operator> (const std::basic_string< CharType, Traits, Alloc > &l, const segment< IteratorR > &r)
 Compare string and segment.
 
template<typename CharType , typename Traits , typename Alloc , typename IteratorR >
bool operator>= (const std::basic_string< CharType, Traits, Alloc > &l, const segment< IteratorR > &r)
 Compare string and segment.
 
template<typename Iterator , typename CharType , typename Traits , typename Alloc >
bool operator== (const segment< Iterator > &l, const std::basic_string< CharType, Traits, Alloc > &r)
 Compare string and segment.
 
template<typename Iterator , typename CharType , typename Traits , typename Alloc >
bool operator!= (const segment< Iterator > &l, const std::basic_string< CharType, Traits, Alloc > &r)
 Compare string and segment.
 
template<typename Iterator , typename CharType , typename Traits , typename Alloc >
bool operator< (const segment< Iterator > &l, const std::basic_string< CharType, Traits, Alloc > &r)
 Compare string and segment.
 
template<typename Iterator , typename CharType , typename Traits , typename Alloc >
bool operator<= (const segment< Iterator > &l, const std::basic_string< CharType, Traits, Alloc > &r)
 Compare string and segment.
 
template<typename Iterator , typename CharType , typename Traits , typename Alloc >
bool operator> (const segment< Iterator > &l, const std::basic_string< CharType, Traits, Alloc > &r)
 Compare string and segment.
 
template<typename Iterator , typename CharType , typename Traits , typename Alloc >
bool operator>= (const segment< Iterator > &l, const std::basic_string< CharType, Traits, Alloc > &r)
 Compare string and segment.
 
template<typename CharType , typename IteratorR >
bool operator== (const CharType *l, const segment< IteratorR > &r)
 Compare C string and segment.
 
template<typename CharType , typename IteratorR >
bool operator!= (const CharType *l, const segment< IteratorR > &r)
 Compare C string and segment.
 
template<typename CharType , typename IteratorR >
bool operator< (const CharType *l, const segment< IteratorR > &r)
 Compare C string and segment.
 
template<typename CharType , typename IteratorR >
bool operator<= (const CharType *l, const segment< IteratorR > &r)
 Compare C string and segment.
 
template<typename CharType , typename IteratorR >
bool operator> (const CharType *l, const segment< IteratorR > &r)
 Compare C string and segment.
 
template<typename CharType , typename IteratorR >
bool operator>= (const CharType *l, const segment< IteratorR > &r)
 Compare C string and segment.
 
template<typename Iterator , typename CharType >
bool operator== (const segment< Iterator > &l, const CharType *r)
 Compare C string and segment.
 
template<typename Iterator , typename CharType >
bool operator!= (const segment< Iterator > &l, const CharType *r)
 Compare C string and segment.
 
template<typename Iterator , typename CharType >
bool operator< (const segment< Iterator > &l, const CharType *r)
 Compare C string and segment.
 
template<typename Iterator , typename CharType >
bool operator<= (const segment< Iterator > &l, const CharType *r)
 Compare C string and segment.
 
template<typename Iterator , typename CharType >
bool operator> (const segment< Iterator > &l, const CharType *r)
 Compare C string and segment.
 
template<typename Iterator , typename CharType >
bool operator>= (const segment< Iterator > &l, const CharType *r)
 Compare C string and segment.
 
template<typename CharType , typename TraitsType , typename Iterator >
std::basic_ostream< CharType, TraitsType > & operator<< (std::basic_ostream< CharType, TraitsType > &out, const segment< Iterator > &seg)
 Write the segment to the stream character by character.
 
rule_type boundary_rule (boundary_type t)
 This function returns the mask that covers all variants for specific boundary type.
 

Variables

Flags that describe a type of word selected

constexpr rule_type word_none = 0x0000F
 Not a word, like white space or punctuation mark.
 
constexpr rule_type word_number = 0x000F0
 Word that appear to be a number.
 
constexpr rule_type word_letter = 0x00F00
 Word that contains letters, excluding kana and ideographic characters.
 
constexpr rule_type word_kana = 0x0F000
 Word that contains kana characters.
 
constexpr rule_type word_ideo = 0xF0000
 Word that contains ideographic characters.
 
constexpr rule_type word_any = 0xFFFF0
 Any word including numbers, 0 is special flag, equivalent to 15.
 
constexpr rule_type word_letters = 0xFFF00
 Any word, excluding numbers but including letters, kana and ideograms.
 
constexpr rule_type word_kana_ideo = 0xFF000
 Word that includes kana or ideographic characters.
 
constexpr rule_type word_mask = 0xFFFFF
 Full word mask - select all possible variants.
 
Flags that describe a type of line break

constexpr rule_type line_soft = 0x0F
 Soft line break: optional but not required.
 
constexpr rule_type line_hard = 0xF0
 Hard line break: like break is required (as per CR/LF)
 
constexpr rule_type line_any = 0xFF
 Soft or Hard line break.
 
constexpr rule_type line_mask = 0xFF
 Select all types of line breaks.
 
Flags that describe a type of sentence break

constexpr rule_type sentence_term = 0x0F
 The sentence was terminated with a sentence terminator like ".", "!" possible followed by hard separator like CR, LF, PS.
 
constexpr rule_type sentence_sep
 The sentence does not contain terminator like ".", "!" but ended with hard separator like CR, LF, PS or end of input. More...
 
constexpr rule_type sentence_any = 0xFF
 Either first or second sentence break type;.
 
constexpr rule_type sentence_mask = 0xFF
 Select all sentence breaking points.
 
Flags that describe a type of character break.

At this point break iterator does not distinguish different kinds of characters so it is used for consistency.

constexpr rule_type character_any = 0xF
 Not in use, just for consistency.
 
constexpr rule_type character_mask = 0xF
 Select all character breaking points.
 

Detailed Description

This namespace contains all operations required for boundary analysis of text.