mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-28 06:49:43 +00:00
Fix some thinkos in MSVC regex hack
The changed code is not used, but I tried to use a similar approach for boost::regex, and found some problems: - regex_replace and regex_search are implemented in the replacement, so they must not be used directly - an smatch object must be given by reference (as in the called methods), otherwise an exception would be thrown at runtime - the commented out regex_replace version is actually needed This code is supposed to be deleted, but nevertheless I wanted to record here how it had to be modified if it was actually needed.
This commit is contained in:
parent
faadac9f4a
commit
08317ecc0b
@ -17,7 +17,7 @@
|
|||||||
# ifdef _MSC_VER
|
# ifdef _MSC_VER
|
||||||
namespace lyx {
|
namespace lyx {
|
||||||
// inheriting 'private' to see which functions are used and if there are
|
// inheriting 'private' to see which functions are used and if there are
|
||||||
// other ECMAScrip defaults
|
// other ECMAScript defaults
|
||||||
// FIXME: Is this really needed?
|
// FIXME: Is this really needed?
|
||||||
// If yes, then the MSVC regex implementation is not standard-conforming.
|
// If yes, then the MSVC regex implementation is not standard-conforming.
|
||||||
class regex : private std::regex
|
class regex : private std::regex
|
||||||
@ -35,20 +35,20 @@ namespace lyx {
|
|||||||
};
|
};
|
||||||
template<class T>
|
template<class T>
|
||||||
bool regex_match(T t, const regex& r) { return std::regex_match(t, r.toStd()); }
|
bool regex_match(T t, const regex& r) { return std::regex_match(t, r.toStd()); }
|
||||||
|
template<class T>
|
||||||
|
bool regex_match(T t, std::smatch& m, const regex& r) { return std::regex_match(t, m, r.toStd()); }
|
||||||
template<class T, class V>
|
template<class T, class V>
|
||||||
bool regex_match(T t, V v, const regex& r) { return std::regex_match(t, v, r.toStd()); }
|
bool regex_match(T t, V v, std::smatch& m, const regex& r) { return std::regex_match(t, v, m, r.toStd()); }
|
||||||
template<class T, class V, class U, class H>
|
|
||||||
bool regex_match(T t, V v, H h, const regex& r, U u) { return std::regex_match(t, v, h, r.toStd(), u); }
|
|
||||||
template<class T, class V>
|
template<class T, class V>
|
||||||
std::string regex_replace(T t, const regex& r, V v) { return std::regex_replace(t, r.toStd(), v); }
|
std::string regex_replace(T t, const regex& r, V v) { return std::regex_replace(t, r.toStd(), v); }
|
||||||
//template<class T, class V, class U, class H>
|
template<class T, class V, class U, class H>
|
||||||
//std::string regex_replace(T t, V v, U u, const regex& r, H h) { return std::regex_replace(t, v, u, r.toStd(), h); }
|
T regex_replace(T t, V v, U u, const regex& r, H h) { return std::regex_replace(t, v, u, r.toStd(), h); }
|
||||||
template<class T>
|
template<class T>
|
||||||
bool regex_search(T t, const regex& r) { return std::regex_search(t, r.toStd()); }
|
bool regex_search(T t, const regex& r) { return std::regex_search(t, r.toStd()); }
|
||||||
|
template<class T>
|
||||||
|
bool regex_search(T t, std::smatch& m, const regex& r) { return std::regex_search(t, m, r.toStd()); }
|
||||||
template<class T, class V>
|
template<class T, class V>
|
||||||
bool regex_search(T t, V v, const regex& r) { return std::regex_search(t, v, r.toStd()); }
|
bool regex_search(T t, V v, std::smatch& m, const regex& r) { return std::regex_search(t, v, m, r.toStd()); }
|
||||||
template<class T, class V, class U>
|
|
||||||
bool regex_search(T t, V v, U u, const regex& r) { return std::regex_search(t, v, u, r.toStd()); }
|
|
||||||
|
|
||||||
struct sregex_iterator : std::sregex_iterator
|
struct sregex_iterator : std::sregex_iterator
|
||||||
{
|
{
|
||||||
@ -64,6 +64,8 @@ namespace lyx {
|
|||||||
namespace lyx {
|
namespace lyx {
|
||||||
using LR_NS::regex;
|
using LR_NS::regex;
|
||||||
using LR_NS::regex_match;
|
using LR_NS::regex_match;
|
||||||
|
using LR_NS::regex_replace;
|
||||||
|
using LR_NS::regex_search;
|
||||||
using LR_NS::sregex_iterator;
|
using LR_NS::sregex_iterator;
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
@ -73,16 +75,16 @@ using LR_NS::sregex_iterator;
|
|||||||
namespace lyx {
|
namespace lyx {
|
||||||
using LR_NS::regex;
|
using LR_NS::regex;
|
||||||
using LR_NS::regex_match;
|
using LR_NS::regex_match;
|
||||||
|
using LR_NS::regex_replace;
|
||||||
|
using LR_NS::regex_search;
|
||||||
using LR_NS::sregex_iterator;
|
using LR_NS::sregex_iterator;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace lyx {
|
namespace lyx {
|
||||||
using LR_NS::smatch;
|
using LR_NS::smatch;
|
||||||
using LR_NS::regex_replace;
|
|
||||||
using LR_NS::basic_regex;
|
using LR_NS::basic_regex;
|
||||||
using LR_NS::regex_error;
|
using LR_NS::regex_error;
|
||||||
using LR_NS::regex_search;
|
|
||||||
using LR_NS::match_results;
|
using LR_NS::match_results;
|
||||||
|
|
||||||
namespace regex_constants
|
namespace regex_constants
|
||||||
|
Loading…
Reference in New Issue
Block a user