diff options
author | Remko Tronçon <git@el-tramo.be> | 2010-04-11 18:19:17 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2010-04-11 19:20:07 (GMT) |
commit | 857e44c156a1dbefcb49bb5792c4384cebd8762a (patch) | |
tree | 11947fb81ad9c502627f1b2bb8f090fb8d53c107 /3rdParty/Boost/src/boost/regex/v4/cpp_regex_traits.hpp | |
parent | 77d4eb7588e113beaa03f3347523b26adefdeb06 (diff) | |
download | swift-contrib-857e44c156a1dbefcb49bb5792c4384cebd8762a.zip swift-contrib-857e44c156a1dbefcb49bb5792c4384cebd8762a.tar.bz2 |
Updated Boost to 1.42.
Diffstat (limited to '3rdParty/Boost/src/boost/regex/v4/cpp_regex_traits.hpp')
-rw-r--r-- | 3rdParty/Boost/src/boost/regex/v4/cpp_regex_traits.hpp | 46 |
1 files changed, 36 insertions, 10 deletions
diff --git a/3rdParty/Boost/src/boost/regex/v4/cpp_regex_traits.hpp b/3rdParty/Boost/src/boost/regex/v4/cpp_regex_traits.hpp index 89fe49d..bb40aa1 100644 --- a/3rdParty/Boost/src/boost/regex/v4/cpp_regex_traits.hpp +++ b/3rdParty/Boost/src/boost/regex/v4/cpp_regex_traits.hpp @@ -187,6 +187,7 @@ struct cpp_regex_traits_base #ifndef BOOST_NO_STD_MESSAGES if(m_pmessages == b.m_pmessages) { + return m_pcollate < b.m_pcollate; } return m_pmessages < b.m_pmessages; #else @@ -212,7 +213,7 @@ std::locale cpp_regex_traits_base<charT>::imbue(const std::locale& l) m_locale = l; m_pctype = &BOOST_USE_FACET(std::ctype<charT>, l); #ifndef BOOST_NO_STD_MESSAGES - m_pmessages = &BOOST_USE_FACET(std::messages<charT>, l); + m_pmessages = BOOST_HAS_FACET(std::messages<charT>, l) ? &BOOST_USE_FACET(std::messages<charT>, l) : 0; #endif m_pcollate = &BOOST_USE_FACET(std::collate<charT>, l); return result; @@ -276,7 +277,7 @@ void cpp_regex_traits_char_layer<charT>::init() typename std::messages<charT>::catalog cat = reinterpret_cast<std::messages<char>::catalog>(-1); #endif std::string cat_name(cpp_regex_traits<charT>::get_catalog_name()); - if(cat_name.size()) + if(cat_name.size() && (this->m_pmessages != 0)) { cat = this->m_pmessages->open( cat_name, @@ -309,7 +310,8 @@ void cpp_regex_traits_char_layer<charT>::init() } catch(...) { - this->m_pmessages->close(cat); + if(this->m_pmessages) + this->m_pmessages->close(cat); throw; } #endif @@ -394,7 +396,9 @@ enum char_class_graph=char_class_alnum|char_class_punct, char_class_blank=1<<9, char_class_word=1<<10, - char_class_unicode=1<<11 + char_class_unicode=1<<11, + char_class_horizontal_space=1<<12, + char_class_vertical_space=1<<13 }; #endif @@ -413,6 +417,8 @@ public: BOOST_STATIC_CONSTANT(char_class_type, mask_blank = 1u << 24); BOOST_STATIC_CONSTANT(char_class_type, mask_word = 1u << 25); BOOST_STATIC_CONSTANT(char_class_type, mask_unicode = 1u << 26); + BOOST_STATIC_CONSTANT(char_class_type, mask_horizontal = 1u << 27); + BOOST_STATIC_CONSTANT(char_class_type, mask_vertical = 1u << 28); #endif typedef std::basic_string<charT> string_type; @@ -477,6 +483,10 @@ template <class charT> typename cpp_regex_traits_implementation<charT>::char_class_type const cpp_regex_traits_implementation<charT>::mask_word; template <class charT> typename cpp_regex_traits_implementation<charT>::char_class_type const cpp_regex_traits_implementation<charT>::mask_unicode; +template <class charT> +typename cpp_regex_traits_implementation<charT>::char_class_type const cpp_regex_traits_implementation<charT>::mask_vertical; +template <class charT> +typename cpp_regex_traits_implementation<charT>::char_class_type const cpp_regex_traits_implementation<charT>::mask_horizontal; #endif #endif @@ -645,7 +655,7 @@ void cpp_regex_traits_implementation<charT>::init() typename std::messages<charT>::catalog cat = reinterpret_cast<std::messages<char>::catalog>(-1); #endif std::string cat_name(cpp_regex_traits<charT>::get_catalog_name()); - if(cat_name.size()) + if(cat_name.size() && (this->m_pmessages != 0)) { cat = this->m_pmessages->open( cat_name, @@ -688,36 +698,40 @@ void cpp_regex_traits_implementation<charT>::init() // Custom class names: // #ifndef BOOST_REGEX_BUGGY_CTYPE_FACET - static const char_class_type masks[14] = + static const char_class_type masks[16] = { std::ctype<charT>::alnum, std::ctype<charT>::alpha, std::ctype<charT>::cntrl, std::ctype<charT>::digit, std::ctype<charT>::graph, + cpp_regex_traits_implementation<charT>::mask_horizontal, std::ctype<charT>::lower, std::ctype<charT>::print, std::ctype<charT>::punct, std::ctype<charT>::space, std::ctype<charT>::upper, + cpp_regex_traits_implementation<charT>::mask_vertical, std::ctype<charT>::xdigit, cpp_regex_traits_implementation<charT>::mask_blank, cpp_regex_traits_implementation<charT>::mask_word, cpp_regex_traits_implementation<charT>::mask_unicode, }; #else - static const char_class_type masks[14] = + static const char_class_type masks[16] = { ::boost::re_detail::char_class_alnum, ::boost::re_detail::char_class_alpha, ::boost::re_detail::char_class_cntrl, ::boost::re_detail::char_class_digit, ::boost::re_detail::char_class_graph, + ::boost::re_detail::char_class_horizontal_space, ::boost::re_detail::char_class_lower, ::boost::re_detail::char_class_print, ::boost::re_detail::char_class_punct, ::boost::re_detail::char_class_space, ::boost::re_detail::char_class_upper, + ::boost::re_detail::char_class_vertical_space, ::boost::re_detail::char_class_xdigit, ::boost::re_detail::char_class_blank, ::boost::re_detail::char_class_word, @@ -744,7 +758,7 @@ typename cpp_regex_traits_implementation<charT>::char_class_type cpp_regex_traits_implementation<charT>::lookup_classname_imp(const charT* p1, const charT* p2) const { #ifndef BOOST_REGEX_BUGGY_CTYPE_FACET - static const char_class_type masks[20] = + static const char_class_type masks[22] = { 0, std::ctype<char>::alnum, @@ -754,6 +768,7 @@ typename cpp_regex_traits_implementation<charT>::char_class_type std::ctype<char>::digit, std::ctype<char>::digit, std::ctype<char>::graph, + cpp_regex_traits_implementation<charT>::mask_horizontal, std::ctype<char>::lower, std::ctype<char>::lower, std::ctype<char>::print, @@ -763,12 +778,13 @@ typename cpp_regex_traits_implementation<charT>::char_class_type std::ctype<char>::upper, cpp_regex_traits_implementation<charT>::mask_unicode, std::ctype<char>::upper, + cpp_regex_traits_implementation<charT>::mask_vertical, std::ctype<char>::alnum | cpp_regex_traits_implementation<charT>::mask_word, std::ctype<char>::alnum | cpp_regex_traits_implementation<charT>::mask_word, std::ctype<char>::xdigit, }; #else - static const char_class_type masks[20] = + static const char_class_type masks[22] = { 0, ::boost::re_detail::char_class_alnum, @@ -778,6 +794,7 @@ typename cpp_regex_traits_implementation<charT>::char_class_type ::boost::re_detail::char_class_digit, ::boost::re_detail::char_class_digit, ::boost::re_detail::char_class_graph, + ::boost::re_detail::char_class_horizontal_space, ::boost::re_detail::char_class_lower, ::boost::re_detail::char_class_lower, ::boost::re_detail::char_class_print, @@ -787,6 +804,7 @@ typename cpp_regex_traits_implementation<charT>::char_class_type ::boost::re_detail::char_class_upper, ::boost::re_detail::char_class_unicode, ::boost::re_detail::char_class_upper, + ::boost::re_detail::char_class_vertical_space, ::boost::re_detail::char_class_alnum | ::boost::re_detail::char_class_word, ::boost::re_detail::char_class_alnum | ::boost::re_detail::char_class_word, ::boost::re_detail::char_class_xdigit, @@ -820,7 +838,9 @@ bool cpp_regex_traits_implementation<charT>::isctype(const charT c, char_class_t || ((mask & ::boost::re_detail::char_class_xdigit) && (m_pctype->is(std::ctype<charT>::xdigit, c))) || ((mask & ::boost::re_detail::char_class_blank) && (m_pctype->is(std::ctype<charT>::space, c)) && !::boost::re_detail::is_separator(c)) || ((mask & ::boost::re_detail::char_class_word) && (c == '_')) - || ((mask & ::boost::re_detail::char_class_unicode) && ::boost::re_detail::is_extended(c)); + || ((mask & ::boost::re_detail::char_class_unicode) && ::boost::re_detail::is_extended(c)) + || ((mask & ::boost::re_detail::char_class_vertical_space) && (is_separator(c) || (c == '\v'))) + || ((mask & ::boost::re_detail::char_class_horizontal_space) && m_pctype->is(std::ctype<charT>::space, c) && !(is_separator(c) || (c == '\v'))); } #endif @@ -930,6 +950,12 @@ public: && m_pimpl->m_pctype->is(std::ctype<charT>::space, c) && !re_detail::is_separator(c)) return true; + else if((f & re_detail::cpp_regex_traits_implementation<charT>::mask_vertical) + && (::boost::re_detail::is_separator(c) || (c == '\v'))) + return true; + else if((f & re_detail::cpp_regex_traits_implementation<charT>::mask_horizontal) + && this->isctype(c, std::ctype<charT>::space) && !this->isctype(c, re_detail::cpp_regex_traits_implementation<charT>::mask_vertical)) + return true; return false; #else return m_pimpl->isctype(c, f); |