mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-12 13:37:00 -04:00
Merge branch 'twanvl:master' into master
This commit is contained in:
+11
-16
@@ -31,23 +31,18 @@
|
|||||||
// ----------------------------------------------------------------------------- : Boost implementation
|
// ----------------------------------------------------------------------------- : Boost implementation
|
||||||
|
|
||||||
#if USE_BOOST_REGEX
|
#if USE_BOOST_REGEX
|
||||||
// needed for boost::regex
|
// needed for boost::regex to compute hash values of unicode chars
|
||||||
inline std::size_t hash_value(wxUniChar const& x) {
|
#if BOOST_VERSION < 107600
|
||||||
boost::hash<int> hasher;
|
inline std::size_t hash_value(wxUniChar const& x) {
|
||||||
return hasher(static_cast<int>(x));
|
boost::hash<int> hasher;
|
||||||
}
|
return hasher(static_cast<int>(x));
|
||||||
/*
|
|
||||||
// fix: boost regex doesn't like that wxUniChar can't be constructed from an int
|
|
||||||
namespace boost {
|
|
||||||
namespace BOOST_REGEX_DETAIL_NS {
|
|
||||||
inline bool can_start(wxUniChar c, const unsigned char* map, unsigned char mask) {
|
|
||||||
return can_start(c.GetValue(), map, mask);
|
|
||||||
}
|
|
||||||
inline bool can_start(wxUniCharRef c, const unsigned char* map, unsigned char mask) {
|
|
||||||
return can_start(c.GetValue(), map, mask);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}*/
|
#else
|
||||||
|
// boost > 1.76 uses its own hash function that needs operator +
|
||||||
|
inline int operator + (wxUniChar x, unsigned int y) {
|
||||||
|
return static_cast<int>(x) + y;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/// Our own regular expression wrapper
|
/// Our own regular expression wrapper
|
||||||
/** Suppors both boost::regex and wxRegEx.
|
/** Suppors both boost::regex and wxRegEx.
|
||||||
|
|||||||
@@ -33,6 +33,17 @@ inline wxStdString const& toStdString(String const& s) {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if wxVERSION_NUMBER < 3100
|
||||||
|
// wxWidgets 3.1.0 added this specialization
|
||||||
|
namespace std {
|
||||||
|
template<> struct hash<String> {
|
||||||
|
size_t operator()(String const& s) const {
|
||||||
|
return std::hash<std::wstring>()(s.ToStdWstring());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------- : Unicode
|
// ----------------------------------------------------------------------------- : Unicode
|
||||||
|
|
||||||
/// u if UNICODE is defined, a otherwise
|
/// u if UNICODE is defined, a otherwise
|
||||||
|
|||||||
Reference in New Issue
Block a user