Commit 490630b7 authored by Milo Yip's avatar Milo Yip

Readd RAPIDJSON_SCHEMA_HAS_REGEX and fix compilation

parent 6b3244ea
......@@ -18,8 +18,6 @@
#include "document.h"
#include <cmath> // HUGE_VAL, abs, floor
#define RAPIDJSON_SCHEMA_USE_STDREGEX 0
#if !defined(RAPIDJSON_SCHEMA_USE_STDREGEX) && (__cplusplus >=201103L || (defined(_MSC_VER) && _MSC_VER >= 1800))
#define RAPIDJSON_SCHEMA_USE_STDREGEX 1
#else
......@@ -30,6 +28,12 @@
#include <regex>
#endif
#if RAPIDJSON_SCHEMA_USE_STDREGEX
#define RAPIDJSON_SCHEMA_HAS_REGEX 1
#else
#define RAPIDJSON_SCHEMA_HAS_REGEX 0
#endif
#if defined(__GNUC__)
RAPIDJSON_DIAG_PUSH
RAPIDJSON_DIAG_OFF(effc++)
......@@ -669,7 +673,7 @@ private:
static bool IsPatternMatch(const std::basic_regex<Ch>* pattern, const Ch *str, SizeType length) {
std::match_results<const Ch*> r;
return std::regex_search(str, str + length, r, pattern);
return std::regex_search(str, str + length, r, *pattern);
}
#else
template <typename ValueType>
......
......@@ -385,6 +385,7 @@ TEST(SchemaValidator, Object_SchemaDependencies) {
VALIDATE(s, "{\"name\": \"John Doe\", \"billing_address\" : \"555 Debtor's Lane\"}", true);
}
#if RAPIDJSON_SCHEMA_HAS_REGEX
TEST(SchemaValidator, Object_PatternProperties) {
Document sd;
sd.Parse(
......@@ -424,6 +425,7 @@ TEST(SchemaValidator, Object_PatternProperties_AdditionalProperties) {
VALIDATE(s, "{ \"keyword\": \"value\" }", true);
VALIDATE(s, "{ \"keyword\": 42 }", false);
}
#endif
TEST(SchemaValidator, Array) {
Document sd;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment