Skip to content

Commit

Permalink
Merge f48b2b3 into bb4bb4c
Browse files Browse the repository at this point in the history
  • Loading branch information
mristin committed Apr 1, 2020
2 parents bb4bb4c + f48b2b3 commit 8abf472
Show file tree
Hide file tree
Showing 122 changed files with 510 additions and 510 deletions.
60 changes: 30 additions & 30 deletions mapry/cpp/generate/jsoncpp_impl.py
Expand Up @@ -277,7 +277,7 @@ def _duration_from_string() -> str:
std::smatch mtch;
const bool matched = std::regex_match(s, mtch, re::kDuration);
if (not matched) {
if (!matched) {
std::stringstream sserr;
sserr << "failed to match the duration: " << s;
*error = sserr.str();
Expand Down Expand Up @@ -507,7 +507,7 @@ def next_identifier(self) -> str:
{% set value = "value_%s"|format(uid) %}
const Json::Value& value_{{ uid }} = {{ value_expr }};
{% endif %}
if (not {{ value }}.isBool()) {
if (!{{ value }}.isBool()) {
constexpr auto expected_but_got(
"Expected a bool, but got: ");
Expand Down Expand Up @@ -558,7 +558,7 @@ def _parse_boolean(
{% set value = "value_%s"|format(uid) %}
const Json::Value& value_{{ uid }} = {{ value_expr }};
{% endif %}{# /value_expr|is_variable #}
if (not {{ value }}.isInt64()) {
if (!{{ value }}.isInt64()) {
constexpr auto expected_but_got(
"Expected an int64, but got: ");
Expand All @@ -578,7 +578,7 @@ def _parse_boolean(
{% if a_type.minimum is not none %}
{% set op = ">" if a_type.exclusive_minimum else ">=" %}
if (not (cast_{{ uid }} {{ op }} {{ a_type.minimum }})) {
if (!(cast_{{ uid }} {{ op }} {{ a_type.minimum }})) {
constexpr auto expected_but_got(
"Expected "
{{ "%s %d"|format(op, a_type.minimum)|escaped_str }}
Expand All @@ -596,7 +596,7 @@ def _parse_boolean(
{% if a_type.maximum is not none %}
{% set op = "<" if a_type.exclusive_maximum else "<=" %}
if (not (cast_{{ uid }} {{ op }} {{ a_type.maximum }})) {
if (!(cast_{{ uid }} {{ op }} {{ a_type.maximum }})) {
constexpr auto expected_but_got(
"Expected "
{{ "%s %d"|format(op, a_type.maximum)|escaped_str }}
Expand Down Expand Up @@ -657,7 +657,7 @@ def _parse_integer(
{% set value = "value_%s"|format(uid) %}
const Json::Value& value_{{ uid }} = {{ value_expr }};
{% endif %}
if (not {{ value }}.isDouble()) {
if (!{{ value }}.isDouble()) {
constexpr auto expected_but_got(
"Expected a double, but got: ");
Expand All @@ -677,7 +677,7 @@ def _parse_integer(
{% if a_type.minimum is not none %}
{% set op = ">" if a_type.exclusive_minimum else ">=" %}
if (not (cast_{{ uid }} {{ op }} {{ a_type.minimum }})) {
if (!(cast_{{ uid }} {{ op }} {{ a_type.minimum }})) {
constexpr auto expected_but_got(
"Expected "
{{ "%s %f"|format(op, a_type.minimum)|escaped_str }}
Expand All @@ -695,7 +695,7 @@ def _parse_integer(
{% if a_type.maximum is not none %}
{% set op = "<" if a_type.exclusive_maximum else "<=" %}
if (not (cast_{{ uid }} {{ op }} {{ a_type.maximum }})) {
if (!(cast_{{ uid }} {{ op }} {{ a_type.maximum }})) {
constexpr auto expected_but_got(
"Expected "
{{ "%s %f"|format(op, a_type.maximum)|escaped_str }}
Expand Down Expand Up @@ -755,7 +755,7 @@ def _parse_float(
{% set value = "value_%s"|format(uid) %}
const Json::Value& value_{{ uid }} = {{ value_expr }};
{% endif %}
if (not {{ value }}.isString()) {
if (!{{ value }}.isString()) {
constexpr auto expected_but_got(
"Expected a string, but got: ");
Expand All @@ -775,7 +775,7 @@ def _parse_float(
const std::string cast_{{ uid }} = {{ value }}.asString();
bool ok_{{ uid }} = true;
if (not std::regex_match(cast_{{ uid }}, regex_{{ uid }})) {
if (!std::regex_match(cast_{{ uid }}, regex_{{ uid }})) {
constexpr auto expected_but_got(
"Expected to match "
{{ a_type.pattern.pattern|escaped_str }}
Expand Down Expand Up @@ -834,7 +834,7 @@ def _parse_string(
{% set value = "value_%s"|format(uid) %}
const Json::Value& value_{{ uid }} = {{ value_expr }};
{% endif %}
if (not {{ value }}.isString()) {
if (!{{ value }}.isString()) {
constexpr auto expected_but_got(
"Expected a string, but got: ");
Expand Down Expand Up @@ -867,7 +867,7 @@ def _parse_string(
const std::string cast_{{ uid }} = {{ value }}.asString();
bool ok_{{ uid }} = true;
if (not std::regex_match(cast_{{ uid }}, regex)) {
if (!std::regex_match(cast_{{ uid }}, regex)) {
constexpr auto expected_but_got(
"Expected to match "
{{ a_type.pattern.pattern|escaped_str }}
Expand Down Expand Up @@ -928,7 +928,7 @@ def _parse_path(
{% set value = "value_%s"|format(uid) %}
const Json::Value& value_{{ uid }} = {{ value_expr }};
{% endif %}
if (not {{ value }}.isString()) {
if (!{{ value }}.isString()) {
constexpr auto expected_but_got(
"Expected a string, but got: ");
Expand Down Expand Up @@ -975,7 +975,7 @@ def _parse_path(
{% set value = "value_%s"|format(uid) %}
const Json::Value& value_{{ uid }} = {{ value_expr }};
{% endif %}
if (not {{ value }}.isString()) {
if (!{{ value }}.isString()) {
constexpr auto expected_but_got(
"Expected a string, but got: ");
Expand Down Expand Up @@ -1099,7 +1099,7 @@ def _parse_date_time(
{% set value = "value_%s"|format(uid) %}
const Json::Value& value_{{ uid }} = {{ value_expr }};
{% endif %}
if (not {{ value }}.isString()) {
if (!{{ value }}.isString()) {
constexpr auto expected_but_got(
"Expected a string, but got: ");
Expand Down Expand Up @@ -1189,7 +1189,7 @@ def _parse_time(
{% set value = "value_%s"|format(uid) %}
const Json::Value& value_{{ uid }} = {{ value_expr }};
{% endif %}
if (not {{ value }}.isString()) {
if (!{{ value }}.isString()) {
constexpr auto expected_but_got(
"Expected a string, but got: ");
Expand All @@ -1215,7 +1215,7 @@ def _parse_time(
{% set value = "value_%s"|format(uid) %}
const Json::Value& value_{{ uid }} = {{ value_expr }};
{% endif %}
if (not {{ value }}.isString()) {
if (!{{ value }}.isString()) {
constexpr auto expected_but_got(
"Expected a string, but got: ");
Expand Down Expand Up @@ -1295,7 +1295,7 @@ def _parse_time_zone(
{% set value = "value_%s"|format(uid) %}
const Json::Value& value_{{ uid }} = {{ value_expr }};
{% endif %}
if (not {{ value }}.isString()) {
if (!{{ value }}.isString()) {
constexpr auto expected_but_got(
"Expected a string, but got: ");
Expand All @@ -1312,7 +1312,7 @@ def _parse_time_zone(
std::chrono::nanoseconds cast_{{ uid }} = duration_from_string(
cast_{{ uid }}_str, &error_{{ uid }});
if (not error_{{ uid }}.empty()) {
if (!error_{{ uid }}.empty()) {
constexpr auto invalid_duration(
"Invalid duration: ");
Expand Down Expand Up @@ -1378,7 +1378,7 @@ def _parse_duration(
}
}
{% endset %}
if (not {{ value }}.isArray()) {
if (!{{ value }}.isArray()) {
constexpr auto expected_but_got(
"Expected an array, but got: ");
Expand Down Expand Up @@ -1476,7 +1476,7 @@ def _parse_array(
{% set value = "value_%s"|format(uid) %}
const Json::Value& value_{{ uid }} = {{ value_expr }};
{% endif %}
if (not {{ value }}.isObject()) {
if (!{{ value }}.isObject()) {
constexpr auto expected_but_got(
"Expected an object, but got: ");
Expand Down Expand Up @@ -1552,7 +1552,7 @@ def _parse_map(
{% set value = "value_%s"|format(uid) %}
const Json::Value& value_{{ uid }} = {{ value_expr }};
{% endif %}
if (not {{ value }}.isString()) {
if (!{{ value }}.isString()) {
constexpr auto expected_but_got(
"Expected a string, but got: ");
Expand Down Expand Up @@ -1831,7 +1831,7 @@ def _parse_value(
////
{% if not a_property.optional %}
if (not {{value_obj_expr}}.isMember({{a_property.json|escaped_str}})) {
if (!{{value_obj_expr}}.isMember({{a_property.json|escaped_str}})) {
errors->add(
{{ ref_obj_parts|join_strings|indent|indent }},
{{ "Property is missing: %s"|format(a_property.json)|escaped_str }});
Expand Down Expand Up @@ -1921,7 +1921,7 @@ def _parse_property(
std::string ref,
{{ composite.name|as_composite }}* target,
parse::Errors* errors) {
if (not value.isObject()) {
if (!value.isObject()) {
constexpr auto expected_but_got(
"Expected an object, but got: ");
Expand Down Expand Up @@ -1997,11 +1997,11 @@ def _parse_composite(
throw std::invalid_argument("Unexpected null errors");
}
if (not errors->empty()) {
if (!errors->empty()) {
throw std::invalid_argument("Unexpected non-empty errors");
}
if (not value.isObject()) {
if (!value.isObject()) {
constexpr auto expected_but_got(
"Expected an object, but got: ");
Expand Down Expand Up @@ -2030,7 +2030,7 @@ def _parse_composite(
if (value.isMember({{ cls.plural|json_plural|escaped_str }})) {
const Json::Value& obj = value[{{
cls.plural|json_plural|escaped_str }}];
if (not obj.isObject()) {
if (!obj.isObject()) {
constexpr auto expected_but_got(
"Expected an object, but got: ");
Expand All @@ -2051,7 +2051,7 @@ def _parse_composite(
cls.plural|as_field }}[it.name()] = std::move(instance);
{% endset %}
{% if cls.id_pattern is not none %}
if (not std::regex_match(
if (!std::regex_match(
it.name(),
{{ cls.name|as_variable }}_re::kID)) {
constexpr auto expected_but_got(
Expand Down Expand Up @@ -2083,7 +2083,7 @@ def _parse_composite(
// Pre-allocating class instances is critical.
// If the pre-allocation failed, we can not continue to parse the instances.
if (not errors->empty()) {
if (!errors->empty()) {
return;
}
Expand Down Expand Up @@ -2713,7 +2713,7 @@ def _serialize_class_or_embed(
{% endfor %}{# /for property_serializations #}
{% for cls in graph.classes.values() %}
if (not {{ graph.name|as_variable }}.{{ cls.plural|as_variable }}.empty()) {
if (!{{ graph.name|as_variable }}.{{ cls.plural|as_variable }}.empty()) {
Json::Value {{ cls.plural|as_variable }}_as_value;
for (const auto& kv : {{
graph.name|as_variable }}.{{ cls.plural|as_variable }}) {
Expand Down
2 changes: 1 addition & 1 deletion mapry/cpp/generate/parse_impl.py
Expand Up @@ -26,7 +26,7 @@ def _parse_errors() -> str:
void Errors::add(const std::string& ref, const std::string& message) {
if (errors_.size() < cap_) {
errors_.emplace_back(Error{.ref = ref, .message = message});
errors_.emplace_back(Error{ref, message});
}
}
Expand Down
26 changes: 13 additions & 13 deletions test_cases/cpp/boost_optional/cpp/test_generate/jsoncpp.cpp
Expand Up @@ -71,11 +71,11 @@ void some_graph_from(
throw std::invalid_argument("Unexpected null errors");
}

if (not errors->empty()) {
if (!errors->empty()) {
throw std::invalid_argument("Unexpected non-empty errors");
}

if (not value.isObject()) {
if (!value.isObject()) {
constexpr auto expected_but_got(
"Expected an object, but got: ");

Expand All @@ -100,7 +100,7 @@ void some_graph_from(

if (value.isMember("empties")) {
const Json::Value& obj = value["empties"];
if (not obj.isObject()) {
if (!obj.isObject()) {
constexpr auto expected_but_got(
"Expected an object, but got: ");

Expand All @@ -114,7 +114,7 @@ void some_graph_from(
} else {
for (Json::ValueConstIterator it = obj.begin();
it != obj.end(); ++it) {
if (not std::regex_match(
if (!std::regex_match(
it.name(),
empty_re::kID)) {
constexpr auto expected_but_got(
Expand Down Expand Up @@ -144,7 +144,7 @@ void some_graph_from(

// Pre-allocating class instances is critical.
// If the pre-allocation failed, we can not continue to parse the instances.
if (not errors->empty()) {
if (!errors->empty()) {
return;
}

Expand Down Expand Up @@ -196,7 +196,7 @@ void some_graph_from(

if (value.isMember("optional_reference")) {
const Json::Value& value_0 = value["optional_reference"];
if (not value_0.isString()) {
if (!value_0.isString()) {
constexpr auto expected_but_got(
"Expected a string, but got: ");

Expand Down Expand Up @@ -238,7 +238,7 @@ void some_graph_from(

if (value.isMember("optional_path")) {
const Json::Value& value_1 = value["optional_path"];
if (not value_1.isString()) {
if (!value_1.isString()) {
constexpr auto expected_but_got(
"Expected a string, but got: ");

Expand Down Expand Up @@ -267,7 +267,7 @@ void some_graph_from(
if (value.isMember("optional_array")) {
target->optional_array.emplace();
const Json::Value& value_2 = value["optional_array"];
if (not value_2.isArray()) {
if (!value_2.isArray()) {
constexpr auto expected_but_got(
"Expected an array, but got: ");

Expand All @@ -284,7 +284,7 @@ void some_graph_from(
target_2.resize(value_2.size());
size_t i_2 = 0;
for (const Json::Value& item_2 : value_2) {
if (not item_2.isInt64()) {
if (!item_2.isInt64()) {
constexpr auto expected_but_got(
"Expected an int64, but got: ");

Expand Down Expand Up @@ -321,7 +321,7 @@ void some_graph_from(
if (value.isMember("optional_map")) {
target->optional_map.emplace();
const Json::Value& value_4 = value["optional_map"];
if (not value_4.isObject()) {
if (!value_4.isObject()) {
constexpr auto expected_but_got(
"Expected an object, but got: ");

Expand All @@ -337,7 +337,7 @@ void some_graph_from(
std::map<std::string, int64_t>& target_4 = *target->optional_map;
for (Json::ValueConstIterator it_4 = value_4.begin(); it_4 != value_4.end(); ++it_4) {
const Json::Value& value_5 = *it_4;
if (not value_5.isInt64()) {
if (!value_5.isInt64()) {
constexpr auto expected_but_got(
"Expected an int64, but got: ");

Expand Down Expand Up @@ -371,7 +371,7 @@ void empty_from(
std::string ref,
Empty* target,
parse::Errors* errors) {
if (not value.isObject()) {
if (!value.isObject()) {
constexpr auto expected_but_got(
"Expected an object, but got: ");

Expand Down Expand Up @@ -423,7 +423,7 @@ Json::Value serialize_some_graph(
some_graph_as_value["optional_map"] = std::move(target_1);
}

if (not some_graph.empties.empty()) {
if (!some_graph.empties.empty()) {
Json::Value empties_as_value;
for (const auto& kv : some_graph.empties) {
const std::string& id = kv.first;
Expand Down
2 changes: 1 addition & 1 deletion test_cases/cpp/boost_optional/cpp/test_generate/parse.cpp
Expand Up @@ -18,7 +18,7 @@ void Errors::reserve(size_t expected_errors) {

void Errors::add(const std::string& ref, const std::string& message) {
if (errors_.size() < cap_) {
errors_.emplace_back(Error{.ref = ref, .message = message});
errors_.emplace_back(Error{ref, message});
}
}

Expand Down

0 comments on commit 8abf472

Please sign in to comment.