![]() |
Boost.Locale
|
00001 // 00002 // Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) 00003 // 00004 // Distributed under the Boost Software License, Version 1.0. (See 00005 // accompanying file LICENSE_1_0.txt or copy at 00006 // http://www.boost.org/LICENSE_1_0.txt) 00007 // 00008 #ifndef BOOST_LOCALE_BOUNDARY_TYPES_HPP_INCLUDED 00009 #define BOOST_LOCALE_BOUNDARY_TYPES_HPP_INCLUDED 00010 00011 #include <boost/locale/config.hpp> 00012 #include <boost/cstdint.hpp> 00013 #include <boost/assert.hpp> 00014 #ifdef BOOST_MSVC 00015 # pragma warning(push) 00016 # pragma warning(disable : 4275 4251 4231 4660) 00017 #endif 00018 00019 00020 namespace boost { 00021 00022 namespace locale { 00023 00027 namespace boundary { 00035 00039 enum boundary_type { 00040 character, 00041 word, 00042 sentence, 00043 line 00044 }; 00045 00051 typedef uint32_t rule_type; 00052 00057 static const rule_type 00058 word_none = 0x0000F, 00059 word_number = 0x000F0, 00060 word_letter = 0x00F00, 00061 word_kana = 0x0F000, 00062 word_ideo = 0xF0000, 00063 word_any = 0xFFFF0, 00064 word_letters = 0xFFF00, 00065 word_kana_ideo = 0xFF000, 00066 word_mask = 0xFFFFF; 00067 00068 00073 static const rule_type 00074 line_soft = 0x0F, 00075 line_hard = 0xF0, 00076 line_any = 0xFF, 00077 line_mask = 0xFF; 00078 00080 00086 static const rule_type 00087 sentence_term = 0x0F, 00088 00089 sentence_sep = 0xF0, 00090 00091 sentence_any = 0xFF, 00092 sentence_mask = 0xFF; 00093 00095 00102 static const rule_type 00103 character_any = 0xF, 00104 character_mask = 0xF; 00105 00107 00111 inline rule_type boundary_rule(boundary_type t) 00112 { 00113 switch(t) { 00114 case character: return character_mask; 00115 case word: return word_mask; 00116 case sentence: return sentence_mask; 00117 case line: return line_mask; 00118 default: return 0; 00119 } 00120 } 00121 00125 00126 } // boundary 00127 } // locale 00128 } // boost 00129 00130 00131 #ifdef BOOST_MSVC 00132 #pragma warning(pop) 00133 #endif 00134 00135 #endif 00136 // vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4