types.hpp
//
// 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 {
namespace boundary {
enum boundary_type {
character,
word,
sentence,
line
};
typedef uint32_t rule_type;
static const rule_type
word_none = 0x0000F,
word_number = 0x000F0,
word_letter = 0x00F00,
word_kana = 0x0F000,
word_ideo = 0xF0000,
word_any = 0xFFFF0,
word_letters = 0xFFF00,
word_kana_ideo = 0xFF000,
word_mask = 0xFFFFF;
static const rule_type
line_soft = 0x0F,
line_hard = 0xF0,
line_any = 0xFF,
line_mask = 0xFF;
static const rule_type
sentence_term = 0x0F,
sentence_sep = 0xF0,
sentence_any = 0xFF,
sentence_mask = 0xFF;
static const rule_type
character_any = 0xF,
character_mask = 0xF;
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
boost::locale::boundary::boundary_type
boundary_type
Definition: types.hpp:39
boost::locale::boundary::character_any
static const rule_type character_any
Not in use, just for consistency.
Definition: types.hpp:103
boost::locale::boundary::line
Analyse the text for positions suitable for line breaks.
Definition: types.hpp:43
boost::locale::boundary::sentence_sep
static const rule_type sentence_sep
The sentence does not contain terminator like ".", "!" but ended with hard separator like CR...
Definition: types.hpp:89
boost::locale::boundary::word_letter
static const rule_type word_letter
Word that contains letters, excluding kana and ideographic characters.
Definition: types.hpp:60
boost::locale::boundary::word_any
static const rule_type word_any
Any word including numbers, 0 is special flag, equivalent to 15.
Definition: types.hpp:63
boost::locale::boundary::line_any
static const rule_type line_any
Soft or Hard line break.
Definition: types.hpp:76
boost::locale::boundary::rule_type
uint32_t rule_type
Flags used with word boundary analysis – the type of the word, line or sentence boundary found...
Definition: types.hpp:51
boost::locale::boundary::line_hard
static const rule_type line_hard
Hard line break: like break is required (as per CR/LF)
Definition: types.hpp:75
boost::locale::boundary::sentence_term
static const rule_type sentence_term
The sentence was terminated with a sentence terminator like ".", "!" possible followed by hard separa...
Definition: types.hpp:87
boost::locale::boundary::line_mask
static const rule_type line_mask
Select all types of line breaks.
Definition: types.hpp:77
boost::locale::boundary::word_ideo
static const rule_type word_ideo
Word that contains ideographic characters.
Definition: types.hpp:62
boost::locale::boundary::word_letters
static const rule_type word_letters
Any word, excluding numbers but including letters, kana and ideograms.
Definition: types.hpp:64
boost::locale::boundary::boundary_rule
rule_type boundary_rule(boundary_type t)
Definition: types.hpp:111
boost::locale::boundary::sentence_mask
static const rule_type sentence_mask
Select all sentence breaking points.
Definition: types.hpp:92
boost::locale::boundary::character
Analyse the text for character boundaries.
Definition: types.hpp:40
boost::locale::boundary::word_number
static const rule_type word_number
Word that appear to be a number.
Definition: types.hpp:59
boost::locale::boundary::line_soft
static const rule_type line_soft
Soft line break: optional but not required.
Definition: types.hpp:74
boost::locale::boundary::word_kana
static const rule_type word_kana
Word that contains kana characters.
Definition: types.hpp:61
boost::locale::boundary::sentence
Analyse the text for Find sentence boundaries.
Definition: types.hpp:42
boost::locale::boundary::word_none
static const rule_type word_none
Not a word, like white space or punctuation mark.
Definition: types.hpp:58
boost::locale::boundary::character_mask
static const rule_type character_mask
Select all character breaking points.
Definition: types.hpp:104
boost::locale::boundary::word
Analyse the text for word boundaries.
Definition: types.hpp:41
boost::locale::boundary::word_mask
static const rule_type word_mask
Definition: types.hpp:66
boost::locale::boundary::word_kana_ideo
static const rule_type word_kana_ideo
Word that includes kana or ideographic characters.
Definition: types.hpp:65
boost::locale::boundary::sentence_any
static const rule_type sentence_any
Either first or second sentence break type;.
Definition: types.hpp:91
- © Copyright 2009-2012 Artyom Beilis, Distributed under the Boost Software License, Version 1.0.