Added boost header

This commit is contained in:
Christophe Riccio
2012-01-08 01:26:07 +00:00
parent 9c3faaca40
commit c7d752cdf8
8946 changed files with 1732316 additions and 0 deletions

View File

@@ -0,0 +1,183 @@
//
// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh)
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef BOOST_LOCALE_BOUNDARY_BOUNDARY_POINT_HPP_INCLUDED
#define BOOST_LOCALE_BOUNDARY_BOUNDARY_POINT_HPP_INCLUDED
#include <boost/locale/boundary/types.hpp>
namespace boost {
namespace locale {
namespace boundary {
///
/// \addtogroup boundary
/// @{
///
/// \brief This class represents a boundary point in the text.
///
/// It represents a pair - an iterator and a rule that defines this
/// point.
///
/// This type of object is dereference by the iterators of boundary_point_index. Using a rule()
/// member function you can get the reason why this specific boundary point was selected.
///
/// For example, When you use a sentence boundary analysis, the (rule() & \ref sentence_term) != 0 means
/// that this boundary point was selected because a sentence terminator (like .?!) was spotted
/// and the (rule() & \ref sentence_sep)!=0 means that a separator like line feed or carriage
/// return was observed.
///
/// \note
///
/// - The beginning of analyzed range is always considered a boundary point and its rule is always 0.
/// - when using a word boundary analysis the returned rule relates to a chunk of text preceding
/// this point.
///
/// \see
///
/// - \ref boundary_point_index
/// - \ref segment
/// - \ref segment_index
///
template<typename IteratorType>
class boundary_point {
public:
///
/// The type of the base iterator that iterates the original text
///
typedef IteratorType iterator_type;
///
/// Empty default constructor
///
boundary_point() : rule_(0) {}
///
/// Create a new boundary_point using iterator \p and a rule \a r
///
boundary_point(iterator_type p,rule_type r) :
iterator_(p),
rule_(r)
{
}
///
/// Set an new iterator value \a i
///
void iterator(iterator_type i)
{
iterator_ = i;
}
///
/// Set an new rule value \a r
///
void rule(rule_type r)
{
rule_ = r;
}
///
/// Fetch an iterator
///
iterator_type iterator() const
{
return iterator_;
}
///
/// Fetch a rule
///
rule_type rule() const
{
return rule_;
}
///
/// Check if two boundary points are the same
///
bool operator==(boundary_point const &other) const
{
return iterator_ == other.iterator_ && rule_ = other.rule_;
}
///
/// Check if two boundary points are different
///
bool operator!=(boundary_point const &other) const
{
return !(*this==other);
}
///
/// Check if the boundary point points to same location as an iterator \a other
///
bool operator==(iterator_type const &other) const
{
return iterator_ == other;
}
///
/// Check if the boundary point points to different location from an iterator \a other
///
bool operator!=(iterator_type const &other) const
{
return iterator_ != other;
}
///
/// Automatic cast to the iterator it represents
///
operator iterator_type ()const
{
return iterator_;
}
private:
iterator_type iterator_;
rule_type rule_;
};
///
/// Check if the boundary point \a r points to same location as an iterator \a l
///
template<typename BaseIterator>
bool operator==(BaseIterator const &l,boundary_point<BaseIterator> const &r)
{
return r==l;
}
///
/// Check if the boundary point \a r points to different location from an iterator \a l
///
template<typename BaseIterator>
bool operator!=(BaseIterator const &l,boundary_point<BaseIterator> const &r)
{
return r!=l;
}
/// @}
typedef boundary_point<std::string::const_iterator> sboundary_point; ///< convenience typedef
typedef boundary_point<std::wstring::const_iterator> wsboundary_point; ///< convenience typedef
#ifdef BOOST_HAS_CHAR16_T
typedef boundary_point<std::u16string::const_iterator> u16sboundary_point;///< convenience typedef
#endif
#ifdef BOOST_HAS_CHAR32_T
typedef boundary_point<std::u32string::const_iterator> u32sboundary_point;///< convenience typedef
#endif
typedef boundary_point<char const *> cboundary_point; ///< convenience typedef
typedef boundary_point<wchar_t const *> wcboundary_point; ///< convenience typedef
#ifdef BOOST_HAS_CHAR16_T
typedef boundary_point<char16_t const *> u16cboundary_point; ///< convenience typedef
#endif
#ifdef BOOST_HAS_CHAR32_T
typedef boundary_point<char32_t const *> u32cboundary_point; ///< convenience typedef
#endif
} // boundary
} // locale
} // boost
#endif
// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4

View File

@@ -0,0 +1,203 @@
//
// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh)
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef BOOST_LOCALE_BOUNDARY_FACETS_HPP_INCLUDED
#define BOOST_LOCALE_BOUNDARY_FACETS_HPP_INCLUDED
#include <boost/locale/config.hpp>
#include <boost/locale/boundary/types.hpp>
#ifdef BOOST_MSVC
# pragma warning(push)
# pragma warning(disable : 4275 4251 4231 4660)
#endif
#include <locale>
#include <vector>
namespace boost {
namespace locale {
///
/// \brief This namespae contains all operations required for boundary analysis of text
///
namespace boundary {
///
/// \addtogroup boundary
///
/// @{
///
///
/// \brief This structure is used for representing boundary point
/// that follows the offset.
///
struct break_info {
///
/// Create empty break point at beginning
///
break_info() :
offset(0),
rule(0)
{
}
///
/// Create empty break point at offset v.
/// it is useful for order comparison with other points.
///
break_info(size_t v) :
offset(v),
rule(0)
{
}
///
/// Offset from the beggining of the text where a break occurs.
///
size_t offset;
///
/// The identification of this break point according to
/// various break types
///
rule_type rule;
///
/// Compare two break points' offset. Allows to search with
/// standard algorithms over the index.
///
bool operator<(break_info const &other) const
{
return offset < other.offset;
}
};
///
/// This type holds the analysis of the text - all its break points
/// with marks
///
typedef std::vector<break_info> index_type;
template<typename CharType>
class boundary_indexing;
#ifdef BOOST_LOCALE_DOXYGEN
///
/// \brief This facet generates an index for boundary analysis
/// for a given text.
///
/// It is specialized for 4 types of characters \c char_t, \c wchar_t, \c char16_t and \c char32_t
///
template<typename Char>
class BOOST_LOCALE_DECL boundary_indexing : public std::locale::facet {
public:
///
/// Default constructor typical for facets
///
boundary_indexing(size_t refs=0) : std::locale::facet(refs)
{
}
///
/// Create index for boundary type \a t for text in range [begin,end)
///
/// The returned value is an index of type \ref index_type. Note that this
/// index is never empty, even if the range [begin,end) is empty it consists
/// of at least one boundary point with the offset 0.
///
virtual index_type map(boundary_type t,Char const *begin,Char const *end) const = 0;
///
/// Identification of this facet
///
static std::locale::id id;
#if defined (__SUNPRO_CC) && defined (_RWSTD_VER)
std::locale::id& __get_id (void) const { return id; }
#endif
};
#else
template<>
class BOOST_LOCALE_DECL boundary_indexing<char> : public std::locale::facet {
public:
boundary_indexing(size_t refs=0) : std::locale::facet(refs)
{
}
virtual index_type map(boundary_type t,char const *begin,char const *end) const = 0;
static std::locale::id id;
#if defined (__SUNPRO_CC) && defined (_RWSTD_VER)
std::locale::id& __get_id (void) const { return id; }
#endif
};
template<>
class BOOST_LOCALE_DECL boundary_indexing<wchar_t> : public std::locale::facet {
public:
boundary_indexing(size_t refs=0) : std::locale::facet(refs)
{
}
virtual index_type map(boundary_type t,wchar_t const *begin,wchar_t const *end) const = 0;
static std::locale::id id;
#if defined (__SUNPRO_CC) && defined (_RWSTD_VER)
std::locale::id& __get_id (void) const { return id; }
#endif
};
#ifdef BOOST_HAS_CHAR16_T
template<>
class BOOST_LOCALE_DECL boundary_indexing<char16_t> : public std::locale::facet {
public:
boundary_indexing(size_t refs=0) : std::locale::facet(refs)
{
}
virtual index_type map(boundary_type t,char16_t const *begin,char16_t const *end) const = 0;
static std::locale::id id;
#if defined (__SUNPRO_CC) && defined (_RWSTD_VER)
std::locale::id& __get_id (void) const { return id; }
#endif
};
#endif
#ifdef BOOST_HAS_CHAR32_T
template<>
class BOOST_LOCALE_DECL boundary_indexing<char32_t> : public std::locale::facet {
public:
boundary_indexing(size_t refs=0) : std::locale::facet(refs)
{
}
virtual index_type map(boundary_type t,char32_t const *begin,char32_t const *end) const = 0;
static std::locale::id id;
#if defined (__SUNPRO_CC) && defined (_RWSTD_VER)
std::locale::id& __get_id (void) const { return id; }
#endif
};
#endif
#endif
///
/// @}
///
} // boundary
} // locale
} // boost
#ifdef BOOST_MSVC
#pragma warning(pop)
#endif
#endif
// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,484 @@
//
// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh)
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef BOOST_LOCALE_BOUNDARY_SEGMENT_HPP_INCLUDED
#define BOOST_LOCALE_BOUNDARY_SEGMENT_HPP_INCLUDED
#include <boost/locale/config.hpp>
#ifdef BOOST_MSVC
# pragma warning(push)
# pragma warning(disable : 4275 4251 4231 4660)
#endif
#include <locale>
#include <string>
#include <iosfwd>
#include <iterator>
namespace boost {
namespace locale {
namespace boundary {
/// \cond INTERNAL
namespace details {
template<typename LeftIterator,typename RightIterator>
int compare_text(LeftIterator l_begin,LeftIterator l_end,RightIterator r_begin,RightIterator r_end)
{
typedef LeftIterator left_iterator;
typedef RightIterator right_iterator;
typedef typename std::iterator_traits<left_iterator>::value_type char_type;
typedef std::char_traits<char_type> traits;
while(l_begin!=l_end && r_begin!=r_end) {
char_type lchar = *l_begin++;
char_type rchar = *r_begin++;
if(traits::eq(lchar,rchar))
continue;
if(traits::lt(lchar,rchar))
return -1;
else
return 1;
}
if(l_begin==l_end && r_begin==r_end)
return 0;
if(l_begin==l_end)
return -1;
else
return 1;
}
template<typename Left,typename Right>
int compare_text(Left const &l,Right const &r)
{
return compare_text(l.begin(),l.end(),r.begin(),r.end());
}
template<typename Left,typename Char>
int compare_string(Left const &l,Char const *begin)
{
Char const *end = begin;
while(*end!=0)
end++;
return compare_text(l.begin(),l.end(),begin,end);
}
template<typename Right,typename Char>
int compare_string(Char const *begin,Right const &r)
{
Char const *end = begin;
while(*end!=0)
end++;
return compare_text(begin,end,r.begin(),r.end());
}
}
/// \endcond
///
/// \addtogroup boundary
/// @{
///
/// \brief 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() & \ref word_kana)!=0
/// For a sentence analysis you can check if the sentence is selected because a sentence terminator is found (\ref sentence_term) or
/// there is a line break (\ref 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
///
/// - \ref segment_index
/// - \ref boundary_point
/// - \ref boundary_point_index
///
template<typename IteratorType>
class segment : public std::pair<IteratorType,IteratorType> {
public:
///
/// The type of the underlying character
///
typedef typename std::iterator_traits<IteratorType>::value_type char_type;
///
/// The type of the string it is converted to
///
typedef std::basic_string<char_type> string_type;
///
/// The value that iterators return - the character itself
///
typedef char_type value_type;
///
/// The iterator that allows to iterate the range
///
typedef IteratorType iterator;
///
/// The iterator that allows to iterate the range
///
typedef IteratorType const_iterator;
///
/// The type that represent a difference between two iterators
///
typedef typename std::iterator_traits<IteratorType>::difference_type difference_type;
///
/// Default constructor
///
segment() {}
///
/// Create a segment using two iterators and a rule that represents this point
///
segment(iterator b,iterator e,rule_type r) :
std::pair<IteratorType,IteratorType>(b,e),
rule_(r)
{
}
///
/// Set the start of the range
///
void begin(iterator const &v)
{
this->first = v;
}
///
/// Set the end of the range
///
void end(iterator const &v)
{
this->second = v;
}
///
/// Get the start of the range
///
IteratorType begin() const
{
return this->first;
}
///
/// Set the end of the range
///
IteratorType end() const
{
return this->second;
}
///
/// Convert the range to a string automatically
///
template <class T, class A>
operator std::basic_string<char_type, T, A> ()const
{
return std::basic_string<char_type, T, A>(this->first, this->second);
}
///
/// Create a string from the range explicitly
///
string_type str() const
{
return string_type(begin(),end());
}
///
/// Get the length of the text chunk
///
size_t length() const
{
return std::distance(begin(),end());
}
///
/// Check if the segment is empty
///
bool empty() const
{
return begin() == end();
}
///
/// Get the rule that is used for selection of this segment.
///
rule_type rule() const
{
return rule_;
}
///
/// Set a rule that is used for segment selection
///
void rule(rule_type r)
{
rule_ = r;
}
// make sure we override std::pair's operator==
/// Compare two segments
bool operator==(segment const &other)
{
return details::compare_text(*this,other) == 0;
}
/// Compare two segments
bool operator!=(segment const &other)
{
return details::compare_text(*this,other) != 0;
}
private:
rule_type rule_;
};
/// Compare two segments
template<typename IteratorL,typename IteratorR>
bool operator==(segment<IteratorL> const &l,segment<IteratorR> const &r)
{
return details::compare_text(l,r) == 0;
}
/// Compare two segments
template<typename IteratorL,typename IteratorR>
bool operator!=(segment<IteratorL> const &l,segment<IteratorR> const &r)
{
return details::compare_text(l,r) != 0;
}
/// Compare two segments
template<typename IteratorL,typename IteratorR>
bool operator<(segment<IteratorL> const &l,segment<IteratorR> const &r)
{
return details::compare_text(l,r) < 0;
}
/// Compare two segments
template<typename IteratorL,typename IteratorR>
bool operator<=(segment<IteratorL> const &l,segment<IteratorR> const &r)
{
return details::compare_text(l,r) <= 0;
}
/// Compare two segments
template<typename IteratorL,typename IteratorR>
bool operator>(segment<IteratorL> const &l,segment<IteratorR> const &r)
{
return details::compare_text(l,r) > 0;
}
/// Compare two segments
template<typename IteratorL,typename IteratorR>
bool operator>=(segment<IteratorL> const &l,segment<IteratorR> const &r)
{
return details::compare_text(l,r) >= 0;
}
/// Compare string and segment
template<typename CharType,typename Traits,typename Alloc,typename IteratorR>
bool operator==(std::basic_string<CharType,Traits,Alloc> const &l,segment<IteratorR> const &r)
{
return details::compare_text(l,r) == 0;
}
/// Compare string and segment
template<typename CharType,typename Traits,typename Alloc,typename IteratorR>
bool operator!=(std::basic_string<CharType,Traits,Alloc> const &l,segment<IteratorR> const &r)
{
return details::compare_text(l,r) != 0;
}
/// Compare string and segment
template<typename CharType,typename Traits,typename Alloc,typename IteratorR>
bool operator<(std::basic_string<CharType,Traits,Alloc> const &l,segment<IteratorR> const &r)
{
return details::compare_text(l,r) < 0;
}
/// Compare string and segment
template<typename CharType,typename Traits,typename Alloc,typename IteratorR>
bool operator<=(std::basic_string<CharType,Traits,Alloc> const &l,segment<IteratorR> const &r)
{
return details::compare_text(l,r) <= 0;
}
/// Compare string and segment
template<typename CharType,typename Traits,typename Alloc,typename IteratorR>
bool operator>(std::basic_string<CharType,Traits,Alloc> const &l,segment<IteratorR> const &r)
{
return details::compare_text(l,r) > 0;
}
/// Compare string and segment
template<typename CharType,typename Traits,typename Alloc,typename IteratorR>
bool operator>=(std::basic_string<CharType,Traits,Alloc> const &l,segment<IteratorR> const &r)
{
return details::compare_text(l,r) >= 0;
}
/// Compare string and segment
template<typename Iterator,typename CharType,typename Traits,typename Alloc>
bool operator==(segment<Iterator> const &l,std::basic_string<CharType,Traits,Alloc> const &r)
{
return details::compare_text(l,r) == 0;
}
/// Compare string and segment
template<typename Iterator,typename CharType,typename Traits,typename Alloc>
bool operator!=(segment<Iterator> const &l,std::basic_string<CharType,Traits,Alloc> const &r)
{
return details::compare_text(l,r) != 0;
}
/// Compare string and segment
template<typename Iterator,typename CharType,typename Traits,typename Alloc>
bool operator<(segment<Iterator> const &l,std::basic_string<CharType,Traits,Alloc> const &r)
{
return details::compare_text(l,r) < 0;
}
/// Compare string and segment
template<typename Iterator,typename CharType,typename Traits,typename Alloc>
bool operator<=(segment<Iterator> const &l,std::basic_string<CharType,Traits,Alloc> const &r)
{
return details::compare_text(l,r) <= 0;
}
/// Compare string and segment
template<typename Iterator,typename CharType,typename Traits,typename Alloc>
bool operator>(segment<Iterator> const &l,std::basic_string<CharType,Traits,Alloc> const &r)
{
return details::compare_text(l,r) > 0;
}
/// Compare string and segment
template<typename Iterator,typename CharType,typename Traits,typename Alloc>
bool operator>=(segment<Iterator> const &l,std::basic_string<CharType,Traits,Alloc> const &r)
{
return details::compare_text(l,r) >= 0;
}
/// Compare C string and segment
template<typename CharType,typename IteratorR>
bool operator==(CharType const *l,segment<IteratorR> const &r)
{
return details::compare_string(l,r) == 0;
}
/// Compare C string and segment
template<typename CharType,typename IteratorR>
bool operator!=(CharType const *l,segment<IteratorR> const &r)
{
return details::compare_string(l,r) != 0;
}
/// Compare C string and segment
template<typename CharType,typename IteratorR>
bool operator<(CharType const *l,segment<IteratorR> const &r)
{
return details::compare_string(l,r) < 0;
}
/// Compare C string and segment
template<typename CharType,typename IteratorR>
bool operator<=(CharType const *l,segment<IteratorR> const &r)
{
return details::compare_string(l,r) <= 0;
}
/// Compare C string and segment
template<typename CharType,typename IteratorR>
bool operator>(CharType const *l,segment<IteratorR> const &r)
{
return details::compare_string(l,r) > 0;
}
/// Compare C string and segment
template<typename CharType,typename IteratorR>
bool operator>=(CharType const *l,segment<IteratorR> const &r)
{
return details::compare_string(l,r) >= 0;
}
/// Compare C string and segment
template<typename Iterator,typename CharType>
bool operator==(segment<Iterator> const &l,CharType const *r)
{
return details::compare_string(l,r) == 0;
}
/// Compare C string and segment
template<typename Iterator,typename CharType>
bool operator!=(segment<Iterator> const &l,CharType const *r)
{
return details::compare_string(l,r) != 0;
}
/// Compare C string and segment
template<typename Iterator,typename CharType>
bool operator<(segment<Iterator> const &l,CharType const *r)
{
return details::compare_string(l,r) < 0;
}
/// Compare C string and segment
template<typename Iterator,typename CharType>
bool operator<=(segment<Iterator> const &l,CharType const *r)
{
return details::compare_string(l,r) <= 0;
}
/// Compare C string and segment
template<typename Iterator,typename CharType>
bool operator>(segment<Iterator> const &l,CharType const *r)
{
return details::compare_string(l,r) > 0;
}
/// Compare C string and segment
template<typename Iterator,typename CharType>
bool operator>=(segment<Iterator> const &l,CharType const *r)
{
return details::compare_string(l,r) >= 0;
}
typedef segment<std::string::const_iterator> ssegment; ///< convenience typedef
typedef segment<std::wstring::const_iterator> wssegment; ///< convenience typedef
#ifdef BOOST_HAS_CHAR16_T
typedef segment<std::u16string::const_iterator> u16ssegment;///< convenience typedef
#endif
#ifdef BOOST_HAS_CHAR32_T
typedef segment<std::u32string::const_iterator> u32ssegment;///< convenience typedef
#endif
typedef segment<char const *> csegment; ///< convenience typedef
typedef segment<wchar_t const *> wcsegment; ///< convenience typedef
#ifdef BOOST_HAS_CHAR16_T
typedef segment<char16_t const *> u16csegment; ///< convenience typedef
#endif
#ifdef BOOST_HAS_CHAR32_T
typedef segment<char32_t const *> u32csegment; ///< convenience typedef
#endif
///
/// Write the segment to the stream character by character
///
template<typename CharType,typename TraitsType,typename Iterator>
std::basic_ostream<CharType,TraitsType> &operator<<(
std::basic_ostream<CharType,TraitsType> &out,
segment<Iterator> const &tok)
{
for(Iterator p=tok.begin(),e=tok.end();p!=e;++p)
out << *p;
return out;
}
/// @}
} // boundary
} // locale
} // boost
#ifdef BOOST_MSVC
#pragma warning(pop)
#endif
#endif
// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4

View File

@@ -0,0 +1,136 @@
//
// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh)
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef BOOST_LOCALE_BOUNDARY_TYPES_HPP_INCLUDED
#define BOOST_LOCALE_BOUNDARY_TYPES_HPP_INCLUDED
#include <boost/locale/config.hpp>
#include <boost/cstdint.hpp>
#include <boost/assert.hpp>
#ifdef BOOST_MSVC
# pragma warning(push)
# pragma warning(disable : 4275 4251 4231 4660)
#endif
namespace boost {
namespace locale {
///
/// \brief This namespase contains all operations required for boundary analysis of text
///
namespace boundary {
///
/// \defgroup boundary Boundary Analysis
///
/// This module contains all operations required for boundary analysis of text: character, word, like and sentence boundaries
///
/// @{
///
///
/// This type describes a possible boundary analysis alternatives.
///
enum boundary_type {
character, ///< Analyse the text for character boundaries
word, ///< Analyse the text for word boundaries
sentence, ///< Analyse the text for Find sentence boundaries
line ///< Analyse the text for positions suitable for line breaks
};
///
/// \brief Flags used with word boundary analysis -- the type of the word, line or sentence boundary found.
///
/// It is a bit-mask that represents various combinations of rules used to select this specific boundary.
///
typedef uint32_t rule_type;
///
/// \anchor bl_boundary_word_rules
/// \name Flags that describe a type of word selected
/// @{
static const rule_type
word_none = 0x0000F, ///< Not a word, like white space or punctuation mark
word_number = 0x000F0, ///< Word that appear to be a number
word_letter = 0x00F00, ///< Word that contains letters, excluding kana and ideographic characters
word_kana = 0x0F000, ///< Word that contains kana characters
word_ideo = 0xF0000, ///< Word that contains ideographic characters
word_any = 0xFFFF0, ///< Any word including numbers, 0 is special flag, equivalent to 15
word_letters = 0xFFF00, ///< Any word, excluding numbers but including letters, kana and ideograms.
word_kana_ideo = 0xFF000, ///< Word that includes kana or ideographic characters
word_mask = 0xFFFFF; ///< Full word mask - select all possible variants
/// @}
///
/// \anchor bl_boundary_line_rules
/// \name Flags that describe a type of line break
/// @{
static const rule_type
line_soft = 0x0F, ///< Soft line break: optional but not required
line_hard = 0xF0, ///< Hard line break: like break is required (as per CR/LF)
line_any = 0xFF, ///< Soft or Hard line break
line_mask = 0xFF; ///< Select all types of line breaks
/// @}
///
/// \anchor bl_boundary_sentence_rules
/// \name Flags that describe a type of sentence break
///
/// @{
static const rule_type
sentence_term = 0x0F, ///< \brief The sentence was terminated with a sentence terminator
/// like ".", "!" possible followed by hard separator like CR, LF, PS
sentence_sep = 0xF0, ///< \brief The sentence does not contain terminator like ".", "!" but ended with hard separator
/// like CR, LF, PS or end of input.
sentence_any = 0xFF, ///< Either first or second sentence break type;.
sentence_mask = 0xFF; ///< Select all sentence breaking points
///@}
///
/// \name 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.
///@{
static const rule_type
character_any = 0xF, ///< Not in use, just for consistency
character_mask = 0xF; ///< Select all character breaking points
///@}
///
/// This function returns the mask that covers all variants for specific boundary type
///
inline rule_type boundary_rule(boundary_type t)
{
switch(t) {
case character: return character_mask;
case word: return word_mask;
case sentence: return sentence_mask;
case line: return line_mask;
default: return 0;
}
}
///
///@}
///
} // boundary
} // locale
} // boost
#ifdef BOOST_MSVC
#pragma warning(pop)
#endif
#endif
// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4