diff options
Diffstat (limited to 'boost/regex/v4/w32_regex_traits.hpp')
-rw-r--r-- | boost/regex/v4/w32_regex_traits.hpp | 82 |
1 files changed, 43 insertions, 39 deletions
diff --git a/boost/regex/v4/w32_regex_traits.hpp b/boost/regex/v4/w32_regex_traits.hpp index ef934b75cc..560cc217bb 100644 --- a/boost/regex/v4/w32_regex_traits.hpp +++ b/boost/regex/v4/w32_regex_traits.hpp @@ -19,6 +19,8 @@ #ifndef BOOST_W32_REGEX_TRAITS_HPP_INCLUDED #define BOOST_W32_REGEX_TRAITS_HPP_INCLUDED +#ifndef BOOST_REGEX_NO_WIN32_LOCALE + #ifndef BOOST_RE_PAT_EXCEPT_HPP #include <boost/regex/pattern_except.hpp> #endif @@ -60,7 +62,7 @@ namespace boost{ template <class charT> class w32_regex_traits; -namespace re_detail{ +namespace BOOST_REGEX_DETAIL_NS{ // // start by typedeffing the types we'll need: @@ -164,19 +166,19 @@ public: map_iterator_type i = m_char_map.find(c); if(i == m_char_map.end()) { - if(::boost::re_detail::w32_is_lower(c, this->m_locale)) return regex_constants::escape_type_class; - if(::boost::re_detail::w32_is_upper(c, this->m_locale)) return regex_constants::escape_type_not_class; + if(::boost::BOOST_REGEX_DETAIL_NS::w32_is_lower(c, this->m_locale)) return regex_constants::escape_type_class; + if(::boost::BOOST_REGEX_DETAIL_NS::w32_is_upper(c, this->m_locale)) return regex_constants::escape_type_not_class; return 0; } return i->second; } charT tolower(charT c)const { - return ::boost::re_detail::w32_tolower(c, this->m_locale); + return ::boost::BOOST_REGEX_DETAIL_NS::w32_tolower(c, this->m_locale); } bool isctype(boost::uint32_t mask, charT c)const { - return ::boost::re_detail::w32_is(this->m_locale, mask, c); + return ::boost::BOOST_REGEX_DETAIL_NS::w32_is(this->m_locale, mask, c); } private: @@ -186,7 +188,7 @@ private: }; template <class charT> -w32_regex_traits_char_layer<charT>::w32_regex_traits_char_layer(::boost::re_detail::lcid_type l) +w32_regex_traits_char_layer<charT>::w32_regex_traits_char_layer(::boost::BOOST_REGEX_DETAIL_NS::lcid_type l) : w32_regex_traits_base<charT>(l) { // we need to start by initialising our syntax map so we know which @@ -195,12 +197,12 @@ w32_regex_traits_char_layer<charT>::w32_regex_traits_char_layer(::boost::re_deta std::string cat_name(w32_regex_traits<charT>::get_catalog_name()); if(cat_name.size()) { - cat = ::boost::re_detail::w32_cat_open(cat_name); + cat = ::boost::BOOST_REGEX_DETAIL_NS::w32_cat_open(cat_name); if(!cat) { std::string m("Unable to open message catalog: "); std::runtime_error err(m + cat_name); - boost::re_detail::raise_runtime_error(err); + boost::BOOST_REGEX_DETAIL_NS::raise_runtime_error(err); } } // @@ -210,7 +212,7 @@ w32_regex_traits_char_layer<charT>::w32_regex_traits_char_layer(::boost::re_deta { for(regex_constants::syntax_type i = 1; i < regex_constants::syntax_max; ++i) { - string_type mss = ::boost::re_detail::w32_cat_get(cat, this->m_locale, i, get_default_message(i)); + string_type mss = ::boost::BOOST_REGEX_DETAIL_NS::w32_cat_get(cat, this->m_locale, i, get_default_message(i)); for(typename string_type::size_type j = 0; j < mss.size(); ++j) { this->m_char_map[mss[j]] = i; @@ -253,7 +255,7 @@ class BOOST_REGEX_DECL w32_regex_traits_char_layer<char> : public w32_regex_trai { typedef std::string string_type; public: - w32_regex_traits_char_layer(::boost::re_detail::lcid_type l) + w32_regex_traits_char_layer(::boost::BOOST_REGEX_DETAIL_NS::lcid_type l) : w32_regex_traits_base<char>(l) { init(); @@ -300,7 +302,7 @@ public: typedef std::basic_string<charT> string_type; typedef charT char_type; - w32_regex_traits_implementation(::boost::re_detail::lcid_type l); + w32_regex_traits_implementation(::boost::BOOST_REGEX_DETAIL_NS::lcid_type l); std::string error_string(regex_constants::error_type n) const { if(!m_error_strings.empty()) @@ -327,7 +329,7 @@ public: string_type transform_primary(const charT* p1, const charT* p2) const; string_type transform(const charT* p1, const charT* p2) const { - return ::boost::re_detail::w32_transform(this->m_locale, p1, p2); + return ::boost::BOOST_REGEX_DETAIL_NS::w32_transform(this->m_locale, p1, p2); } private: std::map<int, std::string> m_error_strings; // error messages indexed by numberic ID @@ -430,19 +432,19 @@ typename w32_regex_traits_implementation<charT>::string_type } template <class charT> -w32_regex_traits_implementation<charT>::w32_regex_traits_implementation(::boost::re_detail::lcid_type l) +w32_regex_traits_implementation<charT>::w32_regex_traits_implementation(::boost::BOOST_REGEX_DETAIL_NS::lcid_type l) : w32_regex_traits_char_layer<charT>(l) { cat_type cat; std::string cat_name(w32_regex_traits<charT>::get_catalog_name()); if(cat_name.size()) { - cat = ::boost::re_detail::w32_cat_open(cat_name); + cat = ::boost::BOOST_REGEX_DETAIL_NS::w32_cat_open(cat_name); if(!cat) { std::string m("Unable to open message catalog: "); std::runtime_error err(m + cat_name); - boost::re_detail::raise_runtime_error(err); + boost::BOOST_REGEX_DETAIL_NS::raise_runtime_error(err); } } // @@ -464,7 +466,7 @@ w32_regex_traits_implementation<charT>::w32_regex_traits_implementation(::boost: default_message.append(1, static_cast<charT>(*p)); ++p; } - string_type s = ::boost::re_detail::w32_cat_get(cat, this->m_locale, i+200, default_message); + string_type s = ::boost::BOOST_REGEX_DETAIL_NS::w32_cat_get(cat, this->m_locale, i+200, default_message); std::string result; for(std::string::size_type j = 0; j < s.size(); ++j) { @@ -495,7 +497,7 @@ w32_regex_traits_implementation<charT>::w32_regex_traits_implementation(::boost: static const string_type null_string; for(unsigned int j = 0; j <= 13; ++j) { - string_type s(::boost::re_detail::w32_cat_get(cat, this->m_locale, j+300, null_string)); + string_type s(::boost::BOOST_REGEX_DETAIL_NS::w32_cat_get(cat, this->m_locale, j+300, null_string)); if(s.size()) this->m_custom_class_names[s] = masks[j]; } @@ -503,7 +505,7 @@ w32_regex_traits_implementation<charT>::w32_regex_traits_implementation(::boost: // // get the collation format used by m_pcollate: // - m_collate_type = re_detail::find_sort_syntax(this, &m_collate_delim); + m_collate_type = BOOST_REGEX_DETAIL_NS::find_sort_syntax(this, &m_collate_delim); } template <class charT> @@ -542,7 +544,7 @@ typename w32_regex_traits_implementation<charT>::char_class_type if(pos != m_custom_class_names.end()) return pos->second; } - std::size_t state_id = 1 + re_detail::get_default_class_id(p1, p2); + std::size_t state_id = 1 + BOOST_REGEX_DETAIL_NS::get_default_class_id(p1, p2); if(state_id < sizeof(masks) / sizeof(masks[0])) return masks[state_id]; return masks[0]; @@ -550,13 +552,13 @@ typename w32_regex_traits_implementation<charT>::char_class_type template <class charT> -boost::shared_ptr<const w32_regex_traits_implementation<charT> > create_w32_regex_traits(::boost::re_detail::lcid_type l) +boost::shared_ptr<const w32_regex_traits_implementation<charT> > create_w32_regex_traits(::boost::BOOST_REGEX_DETAIL_NS::lcid_type l) { // TODO: create a cache for previously constructed objects. - return boost::object_cache< ::boost::re_detail::lcid_type, w32_regex_traits_implementation<charT> >::get(l, 5); + return boost::object_cache< ::boost::BOOST_REGEX_DETAIL_NS::lcid_type, w32_regex_traits_implementation<charT> >::get(l, 5); } -} // re_detail +} // BOOST_REGEX_DETAIL_NS template <class charT> class w32_regex_traits @@ -565,13 +567,13 @@ public: typedef charT char_type; typedef std::size_t size_type; typedef std::basic_string<char_type> string_type; - typedef ::boost::re_detail::lcid_type locale_type; + typedef ::boost::BOOST_REGEX_DETAIL_NS::lcid_type locale_type; typedef boost::uint_least32_t char_class_type; struct boost_extensions_tag{}; w32_regex_traits() - : m_pimpl(re_detail::create_w32_regex_traits<charT>(::boost::re_detail::w32_get_default_locale())) + : m_pimpl(BOOST_REGEX_DETAIL_NS::create_w32_regex_traits<charT>(::boost::BOOST_REGEX_DETAIL_NS::w32_get_default_locale())) { } static size_type length(const char_type* p) { @@ -603,11 +605,11 @@ public: } charT toupper(charT c) const { - return ::boost::re_detail::w32_toupper(c, this->m_pimpl->m_locale); + return ::boost::BOOST_REGEX_DETAIL_NS::w32_toupper(c, this->m_pimpl->m_locale); } string_type transform(const charT* p1, const charT* p2) const { - return ::boost::re_detail::w32_transform(this->m_pimpl->m_locale, p1, p2); + return ::boost::BOOST_REGEX_DETAIL_NS::w32_transform(this->m_pimpl->m_locale, p1, p2); } string_type transform_primary(const charT* p1, const charT* p2) const { @@ -623,34 +625,34 @@ public: } bool isctype(charT c, char_class_type f) const { - if((f & re_detail::w32_regex_traits_implementation<charT>::mask_base) - && (this->m_pimpl->isctype(f & re_detail::w32_regex_traits_implementation<charT>::mask_base, c))) + if((f & BOOST_REGEX_DETAIL_NS::w32_regex_traits_implementation<charT>::mask_base) + && (this->m_pimpl->isctype(f & BOOST_REGEX_DETAIL_NS::w32_regex_traits_implementation<charT>::mask_base, c))) return true; - else if((f & re_detail::w32_regex_traits_implementation<charT>::mask_unicode) && re_detail::is_extended(c)) + else if((f & BOOST_REGEX_DETAIL_NS::w32_regex_traits_implementation<charT>::mask_unicode) && BOOST_REGEX_DETAIL_NS::is_extended(c)) return true; - else if((f & re_detail::w32_regex_traits_implementation<charT>::mask_word) && (c == '_')) + else if((f & BOOST_REGEX_DETAIL_NS::w32_regex_traits_implementation<charT>::mask_word) && (c == '_')) return true; - else if((f & re_detail::w32_regex_traits_implementation<charT>::mask_vertical) - && (::boost::re_detail::is_separator(c) || (c == '\v'))) + else if((f & BOOST_REGEX_DETAIL_NS::w32_regex_traits_implementation<charT>::mask_vertical) + && (::boost::BOOST_REGEX_DETAIL_NS::is_separator(c) || (c == '\v'))) return true; - else if((f & re_detail::w32_regex_traits_implementation<charT>::mask_horizontal) - && this->isctype(c, 0x0008u) && !this->isctype(c, re_detail::w32_regex_traits_implementation<charT>::mask_vertical)) + else if((f & BOOST_REGEX_DETAIL_NS::w32_regex_traits_implementation<charT>::mask_horizontal) + && this->isctype(c, 0x0008u) && !this->isctype(c, BOOST_REGEX_DETAIL_NS::w32_regex_traits_implementation<charT>::mask_vertical)) return true; return false; } int toi(const charT*& p1, const charT* p2, int radix)const { - return ::boost::re_detail::global_toi(p1, p2, radix, *this); + return ::boost::BOOST_REGEX_DETAIL_NS::global_toi(p1, p2, radix, *this); } int value(charT c, int radix)const { - int result = ::boost::re_detail::global_value(c); + int result = ::boost::BOOST_REGEX_DETAIL_NS::global_value(c); return result < radix ? result : -1; } locale_type imbue(locale_type l) { - ::boost::re_detail::lcid_type result(getloc()); - m_pimpl = re_detail::create_w32_regex_traits<charT>(l); + ::boost::BOOST_REGEX_DETAIL_NS::lcid_type result(getloc()); + m_pimpl = BOOST_REGEX_DETAIL_NS::create_w32_regex_traits<charT>(l); return result; } locale_type getloc()const @@ -670,7 +672,7 @@ public: static std::string get_catalog_name(); private: - boost::shared_ptr<const re_detail::w32_regex_traits_implementation<charT> > m_pimpl; + boost::shared_ptr<const BOOST_REGEX_DETAIL_NS::w32_regex_traits_implementation<charT> > m_pimpl; // // catalog name handler: // @@ -736,4 +738,6 @@ static_mutex& w32_regex_traits<charT>::get_mutex_inst() #pragma warning(pop) #endif +#endif // BOOST_REGEX_NO_WIN32_LOCALE + #endif |