From 12744a0b384573ded370b5c743a28105624c3435 Mon Sep 17 00:00:00 2001 From: Remy Chibois Date: Wed, 3 May 2023 15:32:06 +0200 Subject: [PATCH 01/26] chore: initial cpp structure and implementation --- cpp/Makefile | 34 ++++++++++ jsonschema/scripts/codegen.rb | 27 ++++++++ jsonschema/scripts/templates/cpp.enum.hpp.erb | 21 ++++++ jsonschema/scripts/templates/cpp.hpp.erb | 65 +++++++++++++++++++ 4 files changed, 147 insertions(+) create mode 100644 cpp/Makefile create mode 100644 jsonschema/scripts/templates/cpp.enum.hpp.erb create mode 100644 jsonschema/scripts/templates/cpp.hpp.erb diff --git a/cpp/Makefile b/cpp/Makefile new file mode 100644 index 00000000..eb9b214d --- /dev/null +++ b/cpp/Makefile @@ -0,0 +1,34 @@ +schemas = $(shell find ../jsonschema -name "*.json") + +.DEFAULT_GOAL = help + +help: ## Show this help + @awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \n\nWhere is one of:\n"} /^[$$()% a-zA-Z_-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST) + +generate: require .generate-messages ## Generate C++ code based on the schemas found in ../jsonschema and using the scripts in ../jsonschema/scripts for the generation + +require: ## Check requirements for the code generation (ruby, csplit and tail are required) + @ruby --version >/dev/null 2>&1 || (echo "ERROR: ruby is required."; exit 1) + @csplit --version >/dev/null 2>&1 || (echo "ERROR: csplit is required."; exit 1) + @tail --version >/dev/null 2>&1 || (echo "ERROR: tail is required."; exit 1) + +clean: ## Remove automatically generated files and related artifacts + rm -rf include/cucumber/messages + +.generate-messages: $(schemas) ../jsonschema/scripts/codegen.rb ../jsonschema/scripts/templates/cpp.hpp.erb ../jsonschema/scripts/templates/cpp.enum.hpp.erb + ruby ../jsonschema/scripts/codegen.rb Cpp ../jsonschema cpp.hpp.erb > Generated.hpp.tmp + ruby ../jsonschema/scripts/codegen.rb Cpp ../jsonschema cpp.enum.hpp.erb >> Generated.hpp.tmp + csplit --quiet --prefix=Generated --suffix-format=%02d.hpp.tmp --elide-empty-files Generated.hpp.tmp /^[A-Za-z_.]*[.][ch]pp/ {*} + rm Generated.hpp.tmp + rm -rf include/cucumber/messages src/cucumber/messages + mkdir -p include/cucumber/messages src/cucumber/messages + + for file in Generated**; do \ + F=$$(head -n 1 $$file | tr -d '\r\n'); \ + if [ -n "$$F" ]; then \ + tail -n +2 $$file > include/cucumber/messages/$$F; \ + fi; \ + rm $$file; \ + done + + mv include/cucumber/messages/*.cpp src/cucumber/messages || true diff --git a/jsonschema/scripts/codegen.rb b/jsonschema/scripts/codegen.rb index bf144575..2b0c558c 100644 --- a/jsonschema/scripts/codegen.rb +++ b/jsonschema/scripts/codegen.rb @@ -160,6 +160,33 @@ def array_type_for(type_name) end end +class Cpp < Codegen + def initialize(paths) + language_type_by_schema_type = { + 'integer' => 'std::size_t', + 'string' => 'std::string', + 'boolean' => 'bool', + } + + super(paths, language_type_by_schema_type) + end + + def array_type_for(type_name) + "std::vector<#{type_name}>" + end + + def format_description(raw_description, indent_string: "") + return '' if raw_description.nil? + + raw_description + .split("\n") + .map { |line| line.strip() } + .filter { |line| line != '*' } + .map { |line| "// #{line}".rstrip() } + .join("\n#{indent_string}") + end +end + class Java < Codegen def initialize(paths) language_type_by_schema_type = { diff --git a/jsonschema/scripts/templates/cpp.enum.hpp.erb b/jsonschema/scripts/templates/cpp.enum.hpp.erb new file mode 100644 index 00000000..72c9a100 --- /dev/null +++ b/jsonschema/scripts/templates/cpp.enum.hpp.erb @@ -0,0 +1,21 @@ +<% @enums.each do |enum| -%> +<% ename = underscore(enum[:name]) %> +<%= ename %>.hpp +#pragma once + +#include +#include + +namespace cucumber::messages { + +enum class <%= ename %> +<%- enum[:values].each_with_index do |value, index| -%> + <%= enum_constant(value) %> = '<%= value %>' +<%- end -%> +end + +using <%= ename %>_map = std::unordered_map; + +} + +<%- end -%> diff --git a/jsonschema/scripts/templates/cpp.hpp.erb b/jsonschema/scripts/templates/cpp.hpp.erb new file mode 100644 index 00000000..2f483355 --- /dev/null +++ b/jsonschema/scripts/templates/cpp.hpp.erb @@ -0,0 +1,65 @@ +<%- @schemas.each do |key, schema| -%> +<% myclass = underscore(class_name(key)) %> +<%= myclass %>.hpp +#pragma once + +#include +<%- + incs = [] + schema['properties'].each do |property_name, property| + type = underscore(type_for(class_name(key), property_name, property)) + incs.append(type) if !type.start_with?("std::") + end + + if incs.length > 0 +-%> + + <%- incs.each do |type| -%> +#include .hpp> + <%- end -%> +<%- end -%> + +namespace cucumber::messages { + +// +// Represents the <%= class_name(key) %> message in Cucumber's message protocol +// @see Github - Cucumber - Messages +<%- if not (schema['description'] || []).empty? -%> +// +<%= format_description(schema['description'], indent_string: '') %> +<%- end -%> +// +// Generated code + +struct <%= myclass %> : cucumber::message +{ + <%- schema['properties'].each do |property_name, property| -%> + <%= underscore(type_for(class_name(key), property_name, property)) -%> <%= underscore(property_name) %>; + <%- end -%> + + std::string to_string() const override; +}; + +} +<%= myclass %>.cpp +#include + +#include .hpp> + +namespace cucumber::messages { + +std::string +<%= myclass %>::to_string() const +{ + std::ostringstream oss; + + oss + <%- schema['properties'].each_with_index do |(property_name, property), index| -%> + << "<%= index == 0 ? '' : ', '%><%= underscore(property_name) %>=" << <%= underscore(property_name) %> + <%- end -%> + ; + + return oss.str(); +} + +}<%- end -%> From ae1cd045812b16cf8b5fee81dcf7b8e9c5681983 Mon Sep 17 00:00:00 2001 From: Remy Chibois Date: Wed, 3 May 2023 18:12:55 +0200 Subject: [PATCH 02/26] chore: compile ok --- cpp/.gitignore | 3 + cpp/CMakeLists.txt | 28 ++++ cpp/Makefile | 14 +- cpp/include/cucumber/message.hpp | 43 ++++++ cpp/src/CMakeLists.txt | 1 + cpp/src/lib/CMakeLists.txt | 1 + cpp/src/lib/cucumber-messages/CMakeLists.txt | 142 ++++++++++++++++++ .../lib/cucumber-messages/cucumber/utils.hpp | 26 ++++ jsonschema/scripts/templates/cpp.enum.hpp.erb | 45 +++++- jsonschema/scripts/templates/cpp.hpp.erb | 29 +++- 10 files changed, 319 insertions(+), 13 deletions(-) create mode 100644 cpp/.gitignore create mode 100644 cpp/CMakeLists.txt create mode 100644 cpp/include/cucumber/message.hpp create mode 100644 cpp/src/CMakeLists.txt create mode 100644 cpp/src/lib/CMakeLists.txt create mode 100644 cpp/src/lib/cucumber-messages/CMakeLists.txt create mode 100644 cpp/src/lib/cucumber-messages/cucumber/utils.hpp diff --git a/cpp/.gitignore b/cpp/.gitignore new file mode 100644 index 00000000..8de76d6e --- /dev/null +++ b/cpp/.gitignore @@ -0,0 +1,3 @@ +build/ +include/cucumber/messages/ +src/lib/cucumber-messages/cucumber/messages/ diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt new file mode 100644 index 00000000..9839a861 --- /dev/null +++ b/cpp/CMakeLists.txt @@ -0,0 +1,28 @@ +cmake_minimum_required(VERSION 3.12 FATAL_ERROR) + +project(cucumber-messages VERSION 1.0.0 LANGUAGES C CXX) + +include(GNUInstallDirs) + +set(CMAKE_CXX_STANDARD 20) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_CXX_EXTENSIONS OFF) +set(CMAKE_POSITION_INDEPENDENT_CODE ON) + +add_subdirectory(src) + +install( + TARGETS + cucumber-messages_library + EXPORT cucumber-messages-config + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} +) + +install( + EXPORT cucumber-messages-config + FILE cucumber-messages-config.cmake + NAMESPACE cucumber:: + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/cucumber-messages +) diff --git a/cpp/Makefile b/cpp/Makefile index eb9b214d..f3a28613 100644 --- a/cpp/Makefile +++ b/cpp/Makefile @@ -2,6 +2,10 @@ schemas = $(shell find ../jsonschema -name "*.json") .DEFAULT_GOAL = help +INC_DIR = include/cucumber/messages +LIB_DIR = src/lib/cucumber-messages/cucumber/messages +GEN_DIRS = $(INC_DIR) $(LIB_DIR) + help: ## Show this help @awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \n\nWhere is one of:\n"} /^[$$()% a-zA-Z_-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST) @@ -13,22 +17,22 @@ require: ## Check requirements for the code generation (ruby, csplit and tail ar @tail --version >/dev/null 2>&1 || (echo "ERROR: tail is required."; exit 1) clean: ## Remove automatically generated files and related artifacts - rm -rf include/cucumber/messages + rm -rf $(GEN_DIRS) .generate-messages: $(schemas) ../jsonschema/scripts/codegen.rb ../jsonschema/scripts/templates/cpp.hpp.erb ../jsonschema/scripts/templates/cpp.enum.hpp.erb ruby ../jsonschema/scripts/codegen.rb Cpp ../jsonschema cpp.hpp.erb > Generated.hpp.tmp ruby ../jsonschema/scripts/codegen.rb Cpp ../jsonschema cpp.enum.hpp.erb >> Generated.hpp.tmp csplit --quiet --prefix=Generated --suffix-format=%02d.hpp.tmp --elide-empty-files Generated.hpp.tmp /^[A-Za-z_.]*[.][ch]pp/ {*} rm Generated.hpp.tmp - rm -rf include/cucumber/messages src/cucumber/messages - mkdir -p include/cucumber/messages src/cucumber/messages + rm -rf $(GEN_DIRS) + mkdir -p $(GEN_DIRS) for file in Generated**; do \ F=$$(head -n 1 $$file | tr -d '\r\n'); \ if [ -n "$$F" ]; then \ - tail -n +2 $$file > include/cucumber/messages/$$F; \ + tail -n +2 $$file > $(INC_DIR)/$$F; \ fi; \ rm $$file; \ done - mv include/cucumber/messages/*.cpp src/cucumber/messages || true + mv $(INC_DIR)/*.cpp $(LIB_DIR)/ || true diff --git a/cpp/include/cucumber/message.hpp b/cpp/include/cucumber/message.hpp new file mode 100644 index 00000000..a415a4e0 --- /dev/null +++ b/cpp/include/cucumber/message.hpp @@ -0,0 +1,43 @@ +#pragma once + +#include +#include + +namespace cucumber { + +struct message +{ + virtual std::string to_string() const = 0; +}; + +template < + typename Msg, + typename = std::enable_if_t> +> +std::ostream& +operator<<(std::ostream& os, const Msg& msg) +{ + os << msg.to_string(); + + return os; +} + +template < + typename Msg, + typename = std::enable_if_t> +> +std::ostream& +operator<<(std::ostream& os, const std::vector& msgs) +{ + os << '['; + + for (std::size_t i = 0; i < msgs.size(); ++i) { + os << (i > 0 ? ", " : "") << msgs[i]; + } + + os << ']'; + + return os; +} + +} diff --git a/cpp/src/CMakeLists.txt b/cpp/src/CMakeLists.txt new file mode 100644 index 00000000..3ea7a419 --- /dev/null +++ b/cpp/src/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(lib) diff --git a/cpp/src/lib/CMakeLists.txt b/cpp/src/lib/CMakeLists.txt new file mode 100644 index 00000000..63df6a2a --- /dev/null +++ b/cpp/src/lib/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(cucumber-messages) diff --git a/cpp/src/lib/cucumber-messages/CMakeLists.txt b/cpp/src/lib/cucumber-messages/CMakeLists.txt new file mode 100644 index 00000000..152a58b6 --- /dev/null +++ b/cpp/src/lib/cucumber-messages/CMakeLists.txt @@ -0,0 +1,142 @@ +add_library(cucumber-messages_library) +add_library(cucumber::messages ALIAS cucumber-messages_library) + +set(INC_DIR "${CMAKE_SOURCE_DIR}/include") + +target_sources( + cucumber-messages_library + PRIVATE + ${INC_DIR}/cucumber/messages/attachment_content_encoding.hpp + ${INC_DIR}/cucumber/messages/attachment.hpp + ${INC_DIR}/cucumber/messages/background.hpp + ${INC_DIR}/cucumber/messages/ci.hpp + ${INC_DIR}/cucumber/messages/comment.hpp + ${INC_DIR}/cucumber/messages/data_table.hpp + ${INC_DIR}/cucumber/messages/doc_string.hpp + ${INC_DIR}/cucumber/messages/duration.hpp + ${INC_DIR}/cucumber/messages/envelope.hpp + ${INC_DIR}/cucumber/messages/examples.hpp + ${INC_DIR}/cucumber/messages/exception.hpp + ${INC_DIR}/cucumber/messages/feature_child.hpp + ${INC_DIR}/cucumber/messages/feature.hpp + ${INC_DIR}/cucumber/messages/gherkin_document.hpp + ${INC_DIR}/cucumber/messages/git.hpp + ${INC_DIR}/cucumber/messages/group.hpp + ${INC_DIR}/cucumber/messages/hook.hpp + ${INC_DIR}/cucumber/messages/java_method.hpp + ${INC_DIR}/cucumber/messages/java_stack_trace_element.hpp + ${INC_DIR}/cucumber/messages/location.hpp + ${INC_DIR}/cucumber/messages/meta.hpp + ${INC_DIR}/cucumber/messages/parameter_type.hpp + ${INC_DIR}/cucumber/messages/parse_error.hpp + ${INC_DIR}/cucumber/messages/pickle_doc_string.hpp + ${INC_DIR}/cucumber/messages/pickle.hpp + ${INC_DIR}/cucumber/messages/pickle_step_argument.hpp + ${INC_DIR}/cucumber/messages/pickle_step.hpp + ${INC_DIR}/cucumber/messages/pickle_step_type.hpp + ${INC_DIR}/cucumber/messages/pickle_table_cell.hpp + ${INC_DIR}/cucumber/messages/pickle_table.hpp + ${INC_DIR}/cucumber/messages/pickle_table_row.hpp + ${INC_DIR}/cucumber/messages/pickle_tag.hpp + ${INC_DIR}/cucumber/messages/product.hpp + ${INC_DIR}/cucumber/messages/rule_child.hpp + ${INC_DIR}/cucumber/messages/rule.hpp + ${INC_DIR}/cucumber/messages/scenario.hpp + ${INC_DIR}/cucumber/messages/source.hpp + ${INC_DIR}/cucumber/messages/source_media_type.hpp + ${INC_DIR}/cucumber/messages/source_reference.hpp + ${INC_DIR}/cucumber/messages/step_definition.hpp + ${INC_DIR}/cucumber/messages/step_definition_pattern.hpp + ${INC_DIR}/cucumber/messages/step_definition_pattern_type.hpp + ${INC_DIR}/cucumber/messages/step.hpp + ${INC_DIR}/cucumber/messages/step_keyword_type.hpp + ${INC_DIR}/cucumber/messages/step_match_argument.hpp + ${INC_DIR}/cucumber/messages/step_match_arguments_list.hpp + ${INC_DIR}/cucumber/messages/table_cell.hpp + ${INC_DIR}/cucumber/messages/table_row.hpp + ${INC_DIR}/cucumber/messages/tag.hpp + ${INC_DIR}/cucumber/messages/test_case_finished.hpp + ${INC_DIR}/cucumber/messages/test_case.hpp + ${INC_DIR}/cucumber/messages/test_case_started.hpp + ${INC_DIR}/cucumber/messages/test_run_finished.hpp + ${INC_DIR}/cucumber/messages/test_run_started.hpp + ${INC_DIR}/cucumber/messages/test_step_finished.hpp + ${INC_DIR}/cucumber/messages/test_step.hpp + ${INC_DIR}/cucumber/messages/test_step_result.hpp + ${INC_DIR}/cucumber/messages/test_step_result_status.hpp + ${INC_DIR}/cucumber/messages/test_step_started.hpp + ${INC_DIR}/cucumber/messages/timestamp.hpp + ${INC_DIR}/cucumber/messages/undefined_parameter_type.hpp + ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/utils.hpp + ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/attachment.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/background.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/ci.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/comment.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/data_table.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/doc_string.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/duration.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/envelope.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/examples.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/exception.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/feature_child.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/feature.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/gherkin_document.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/git.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/group.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/hook.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/java_method.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/java_stack_trace_element.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/location.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/meta.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/parameter_type.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/parse_error.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/pickle.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/pickle_doc_string.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/pickle_step_argument.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/pickle_step.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/pickle_table_cell.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/pickle_table.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/pickle_table_row.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/pickle_tag.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/product.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/rule_child.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/rule.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/scenario.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/source.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/source_reference.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/step.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/step_definition.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/step_definition_pattern.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/step_match_argument.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/step_match_arguments_list.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/table_cell.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/table_row.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/tag.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/test_case.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/test_case_finished.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/test_case_started.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/test_run_finished.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/test_run_started.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/test_step.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/test_step_finished.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/test_step_result.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/test_step_started.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/timestamp.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/undefined_parameter_type.cpp +) + +target_include_directories( + cucumber-messages_library + PUBLIC + $ + $ + PRIVATE + ${INC_DIR} + ${CMAKE_CURRENT_SOURCE_DIR} +) + +set_target_properties( + cucumber-messages_library + PROPERTIES + OUTPUT_NAME cucumber_messages +) diff --git a/cpp/src/lib/cucumber-messages/cucumber/utils.hpp b/cpp/src/lib/cucumber-messages/cucumber/utils.hpp new file mode 100644 index 00000000..6cd673b9 --- /dev/null +++ b/cpp/src/lib/cucumber-messages/cucumber/utils.hpp @@ -0,0 +1,26 @@ +#pragma once + +#include +#include +#include + +namespace cucumber { + +template +std::string +to_string(const std::vector& msgs) +{ + std::ostringstream oss; + + oss << '['; + + for (std::size_t i = 0; i < msgs.size(); ++i) { + oss << (i > 0 ? ", " : "") << msgs[i]; + } + + oss << ']'; + + return oss.str(); +} + +} diff --git a/jsonschema/scripts/templates/cpp.enum.hpp.erb b/jsonschema/scripts/templates/cpp.enum.hpp.erb index 72c9a100..111213ce 100644 --- a/jsonschema/scripts/templates/cpp.enum.hpp.erb +++ b/jsonschema/scripts/templates/cpp.enum.hpp.erb @@ -3,19 +3,52 @@ <%= ename %>.hpp #pragma once -#include #include namespace cucumber::messages { enum class <%= ename %> +{ +<%- + vals = enum[:values].map { |v| enum_constant(v) } +-%> + <%= vals.join(",\n ") %> +}; + +std::string_view +to_string(<%= ename %> v); + +std::ostream& +operator<<(std::ostream& os, <%= ename %> v); + +} +<%= ename %>.cpp +#include + +#include .hpp> + +namespace cucumber::messages { + +std::string_view +to_string(<%= ename %> v) +{ + using map_type = std::unordered_map<<%= ename %>, std::string_view>; + + static const map_type m = { <%- enum[:values].each_with_index do |value, index| -%> - <%= enum_constant(value) %> = '<%= value %>' -<%- end -%> -end + { <%= enum_constant(value) %>, "<%= value %>" }<%= index < enum[:values].length-1 ? ',' : '' %> +<% end -%> + }; + + return m.at(v); +} -using <%= ename %>_map = std::unordered_map; +std::ostream& +operator<<(std::ostream& os, <%= ename %> v) +{ + os << to_string(v); + return os; } -<%- end -%> +}<%- end -%> diff --git a/jsonschema/scripts/templates/cpp.hpp.erb b/jsonschema/scripts/templates/cpp.hpp.erb index 2f483355..088d4c51 100644 --- a/jsonschema/scripts/templates/cpp.hpp.erb +++ b/jsonschema/scripts/templates/cpp.hpp.erb @@ -3,12 +3,19 @@ <%= myclass %>.hpp #pragma once +#include + #include <%- incs = [] schema['properties'].each do |property_name, property| type = underscore(type_for(class_name(key), property_name, property)) - incs.append(type) if !type.start_with?("std::") + if m = /std::vector<(?.+)>/.match(type) + type = m['vtype'] + end + next if type.start_with?("std::") + next if type == "bool" + incs.append(type) end if incs.length > 0 @@ -34,7 +41,18 @@ namespace cucumber::messages { struct <%= myclass %> : cucumber::message { <%- schema['properties'].each do |property_name, property| -%> - <%= underscore(type_for(class_name(key), property_name, property)) -%> <%= underscore(property_name) %>; + <%- type = underscore(type_for(class_name(key), property_name, property)) -%> + <%- if m = /std::vector<(?.+)>/.match(type) -%> + <%- if !m['vtype'].start_with?("std::") -%> + std::vector> <%= underscore(property_name) %>; + <%- else -%> + <%= type -%> <%= underscore(property_name) %>; + <%- end -%> + <%- elsif !type.start_with?("std::") && type != "bool" -%> + cucumber::messages::<%= type -%> <%= underscore(property_name) %>; + <%- else -%> + <%= type -%> <%= underscore(property_name) %>; + <%- end -%> <%- end -%> std::string to_string() const override; @@ -44,6 +62,7 @@ struct <%= myclass %> : cucumber::message <%= myclass %>.cpp #include +#include #include .hpp> namespace cucumber::messages { @@ -55,7 +74,13 @@ std::string oss <%- schema['properties'].each_with_index do |(property_name, property), index| -%> + <%- type = underscore(type_for(class_name(key), property_name, property)) -%> + <%- std_vec = /std::vector/.match(type) -%> + <%- if std_vec -%> + << "<%= index == 0 ? '' : ', '%><%= underscore(property_name) %>=" << cucumber::to_string(<%= underscore(property_name) %>) + <%- else -%> << "<%= index == 0 ? '' : ', '%><%= underscore(property_name) %>=" << <%= underscore(property_name) %> + <%- end -%> <%- end -%> ; From 1082a8afe0889ca443e0cba6abb6d443692ad640 Mon Sep 17 00:00:00 2001 From: Remy Chibois Date: Thu, 4 May 2023 10:25:54 +0200 Subject: [PATCH 03/26] chore: cleaned library name, install interface --- cpp/.gitignore | 4 +++- cpp/CMakeLists.txt | 3 ++- cpp/Makefile | 12 ++++++++++- cpp/src/lib/cucumber-messages/CMakeLists.txt | 22 +++++++++++++------- 4 files changed, 30 insertions(+), 11 deletions(-) diff --git a/cpp/.gitignore b/cpp/.gitignore index 8de76d6e..9ea7933d 100644 --- a/cpp/.gitignore +++ b/cpp/.gitignore @@ -1,3 +1,5 @@ -build/ include/cucumber/messages/ src/lib/cucumber-messages/cucumber/messages/ +.configured +.built +build/ diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index 9839a861..a6ccb113 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -13,8 +13,9 @@ add_subdirectory(src) install( TARGETS - cucumber-messages_library + cucumber-messages EXPORT cucumber-messages-config + FILE_SET cucumber_messages_headers RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} diff --git a/cpp/Makefile b/cpp/Makefile index f3a28613..b2f0e350 100644 --- a/cpp/Makefile +++ b/cpp/Makefile @@ -17,7 +17,7 @@ require: ## Check requirements for the code generation (ruby, csplit and tail ar @tail --version >/dev/null 2>&1 || (echo "ERROR: tail is required."; exit 1) clean: ## Remove automatically generated files and related artifacts - rm -rf $(GEN_DIRS) + rm -rf $(GEN_DIRS) build .configured .generate-messages: $(schemas) ../jsonschema/scripts/codegen.rb ../jsonschema/scripts/templates/cpp.hpp.erb ../jsonschema/scripts/templates/cpp.enum.hpp.erb ruby ../jsonschema/scripts/codegen.rb Cpp ../jsonschema cpp.hpp.erb > Generated.hpp.tmp @@ -36,3 +36,13 @@ clean: ## Remove automatically generated files and related artifacts done mv $(INC_DIR)/*.cpp $(LIB_DIR)/ || true + +clean-build: + rm -rf build .configured .built + +.configured: + mkdir -p build + cmake -S . -B build && touch $@ + +.built: .configured + cmake --build build --parallel && touch $@ diff --git a/cpp/src/lib/cucumber-messages/CMakeLists.txt b/cpp/src/lib/cucumber-messages/CMakeLists.txt index 152a58b6..6ab0831c 100644 --- a/cpp/src/lib/cucumber-messages/CMakeLists.txt +++ b/cpp/src/lib/cucumber-messages/CMakeLists.txt @@ -1,11 +1,17 @@ -add_library(cucumber-messages_library) -add_library(cucumber::messages ALIAS cucumber-messages_library) +add_library(cucumber-messages) +add_library(cucumber::messages ALIAS cucumber-messages) set(INC_DIR "${CMAKE_SOURCE_DIR}/include") target_sources( - cucumber-messages_library - PRIVATE + cucumber-messages + PUBLIC + FILE_SET + "cucumber_messages_headers" + TYPE HEADERS + BASE_DIRS ${INC_DIR} + FILES + ${INC_DIR}/cucumber/message.hpp ${INC_DIR}/cucumber/messages/attachment_content_encoding.hpp ${INC_DIR}/cucumber/messages/attachment.hpp ${INC_DIR}/cucumber/messages/background.hpp @@ -67,6 +73,7 @@ target_sources( ${INC_DIR}/cucumber/messages/test_step_started.hpp ${INC_DIR}/cucumber/messages/timestamp.hpp ${INC_DIR}/cucumber/messages/undefined_parameter_type.hpp + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/utils.hpp ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/attachment.cpp ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/background.cpp @@ -126,17 +133,16 @@ target_sources( ) target_include_directories( - cucumber-messages_library - PUBLIC + cucumber-messages + INTERFACE $ $ PRIVATE - ${INC_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ) set_target_properties( - cucumber-messages_library + cucumber-messages PROPERTIES OUTPUT_NAME cucumber_messages ) From 37e5e89d840db105b0160c410d7c6283d6569a57 Mon Sep 17 00:00:00 2001 From: Remy Chibois Date: Thu, 4 May 2023 10:34:32 +0200 Subject: [PATCH 04/26] chore: add message files --- cpp/.gitignore | 2 - cpp/include/cucumber/messages/attachment.hpp | 44 +++++++++++++ .../messages/attachment_content_encoding.hpp | 19 ++++++ cpp/include/cucumber/messages/background.hpp | 30 +++++++++ cpp/include/cucumber/messages/ci.hpp | 29 +++++++++ cpp/include/cucumber/messages/comment.hpp | 27 ++++++++ cpp/include/cucumber/messages/data_table.hpp | 26 ++++++++ cpp/include/cucumber/messages/doc_string.hpp | 27 ++++++++ cpp/include/cucumber/messages/duration.hpp | 26 ++++++++ cpp/include/cucumber/messages/envelope.hpp | 63 +++++++++++++++++++ cpp/include/cucumber/messages/examples.hpp | 34 ++++++++++ cpp/include/cucumber/messages/exception.hpp | 25 ++++++++ cpp/include/cucumber/messages/feature.hpp | 32 ++++++++++ .../cucumber/messages/feature_child.hpp | 30 +++++++++ .../cucumber/messages/gherkin_document.hpp | 34 ++++++++++ cpp/include/cucumber/messages/git.hpp | 28 +++++++++ cpp/include/cucumber/messages/group.hpp | 26 ++++++++ cpp/include/cucumber/messages/hook.hpp | 27 ++++++++ cpp/include/cucumber/messages/java_method.hpp | 24 +++++++ .../messages/java_stack_trace_element.hpp | 24 +++++++ cpp/include/cucumber/messages/location.hpp | 25 ++++++++ cpp/include/cucumber/messages/meta.hpp | 36 +++++++++++ .../cucumber/messages/parameter_type.hpp | 29 +++++++++ cpp/include/cucumber/messages/parse_error.hpp | 25 ++++++++ cpp/include/cucumber/messages/pickle.hpp | 44 +++++++++++++ .../cucumber/messages/pickle_doc_string.hpp | 23 +++++++ cpp/include/cucumber/messages/pickle_step.hpp | 31 +++++++++ .../messages/pickle_step_argument.hpp | 28 +++++++++ .../cucumber/messages/pickle_step_type.hpp | 21 +++++++ .../cucumber/messages/pickle_table.hpp | 24 +++++++ .../cucumber/messages/pickle_table_cell.hpp | 22 +++++++ .../cucumber/messages/pickle_table_row.hpp | 24 +++++++ cpp/include/cucumber/messages/pickle_tag.hpp | 25 ++++++++ cpp/include/cucumber/messages/product.hpp | 25 ++++++++ cpp/include/cucumber/messages/rule.hpp | 32 ++++++++++ cpp/include/cucumber/messages/rule_child.hpp | 28 +++++++++ cpp/include/cucumber/messages/scenario.hpp | 34 ++++++++++ cpp/include/cucumber/messages/source.hpp | 30 +++++++++ .../cucumber/messages/source_media_type.hpp | 19 ++++++ .../cucumber/messages/source_reference.hpp | 32 ++++++++++ cpp/include/cucumber/messages/step.hpp | 35 +++++++++++ .../cucumber/messages/step_definition.hpp | 27 ++++++++ .../messages/step_definition_pattern.hpp | 25 ++++++++ .../messages/step_definition_pattern_type.hpp | 19 ++++++ .../cucumber/messages/step_keyword_type.hpp | 22 +++++++ .../cucumber/messages/step_match_argument.hpp | 32 ++++++++++ .../messages/step_match_arguments_list.hpp | 24 +++++++ cpp/include/cucumber/messages/table_cell.hpp | 27 ++++++++ cpp/include/cucumber/messages/table_row.hpp | 29 +++++++++ cpp/include/cucumber/messages/tag.hpp | 28 +++++++++ cpp/include/cucumber/messages/test_case.hpp | 30 +++++++++ .../cucumber/messages/test_case_finished.hpp | 26 ++++++++ .../cucumber/messages/test_case_started.hpp | 28 +++++++++ .../cucumber/messages/test_run_finished.hpp | 28 +++++++++ .../cucumber/messages/test_run_started.hpp | 24 +++++++ cpp/include/cucumber/messages/test_step.hpp | 31 +++++++++ .../cucumber/messages/test_step_finished.hpp | 28 +++++++++ .../cucumber/messages/test_step_result.hpp | 29 +++++++++ .../messages/test_step_result_status.hpp | 24 +++++++ .../cucumber/messages/test_step_started.hpp | 26 ++++++++ cpp/include/cucumber/messages/timestamp.hpp | 23 +++++++ .../messages/undefined_parameter_type.hpp | 23 +++++++ .../cucumber/messages/attachment.cpp | 27 ++++++++ .../messages/attachment_content_encoding.cpp | 28 +++++++++ .../cucumber/messages/background.cpp | 25 ++++++++ .../cucumber/messages/ci.cpp | 23 +++++++ .../cucumber/messages/comment.cpp | 21 +++++++ .../cucumber/messages/data_table.cpp | 21 +++++++ .../cucumber/messages/doc_string.cpp | 23 +++++++ .../cucumber/messages/duration.cpp | 21 +++++++ .../cucumber/messages/envelope.cpp | 36 +++++++++++ .../cucumber/messages/examples.cpp | 27 ++++++++ .../cucumber/messages/exception.cpp | 21 +++++++ .../cucumber/messages/feature.cpp | 26 ++++++++ .../cucumber/messages/feature_child.cpp | 22 +++++++ .../cucumber/messages/gherkin_document.cpp | 22 +++++++ .../cucumber/messages/git.cpp | 23 +++++++ .../cucumber/messages/group.cpp | 22 +++++++ .../cucumber/messages/hook.cpp | 23 +++++++ .../cucumber/messages/java_method.cpp | 22 +++++++ .../messages/java_stack_trace_element.cpp | 22 +++++++ .../cucumber/messages/location.cpp | 21 +++++++ .../cucumber/messages/meta.cpp | 25 ++++++++ .../cucumber/messages/parameter_type.cpp | 25 ++++++++ .../cucumber/messages/parse_error.cpp | 21 +++++++ .../cucumber/messages/pickle.cpp | 26 ++++++++ .../cucumber/messages/pickle_doc_string.cpp | 21 +++++++ .../cucumber/messages/pickle_step.cpp | 24 +++++++ .../messages/pickle_step_argument.cpp | 21 +++++++ .../cucumber/messages/pickle_step_type.cpp | 30 +++++++++ .../cucumber/messages/pickle_table.cpp | 20 ++++++ .../cucumber/messages/pickle_table_cell.cpp | 20 ++++++ .../cucumber/messages/pickle_table_row.cpp | 20 ++++++ .../cucumber/messages/pickle_tag.cpp | 21 +++++++ .../cucumber/messages/product.cpp | 21 +++++++ .../cucumber/messages/rule.cpp | 26 ++++++++ .../cucumber/messages/rule_child.cpp | 21 +++++++ .../cucumber/messages/scenario.cpp | 27 ++++++++ .../cucumber/messages/source.cpp | 22 +++++++ .../cucumber/messages/source_media_type.cpp | 28 +++++++++ .../cucumber/messages/source_reference.cpp | 23 +++++++ .../cucumber/messages/step.cpp | 26 ++++++++ .../cucumber/messages/step_definition.cpp | 22 +++++++ .../messages/step_definition_pattern.cpp | 21 +++++++ .../messages/step_definition_pattern_type.cpp | 28 +++++++++ .../cucumber/messages/step_keyword_type.cpp | 31 +++++++++ .../cucumber/messages/step_match_argument.cpp | 21 +++++++ .../messages/step_match_arguments_list.cpp | 20 ++++++ .../cucumber/messages/table_cell.cpp | 21 +++++++ .../cucumber/messages/table_row.cpp | 22 +++++++ .../cucumber/messages/tag.cpp | 22 +++++++ .../cucumber/messages/test_case.cpp | 22 +++++++ .../cucumber/messages/test_case_finished.cpp | 22 +++++++ .../cucumber/messages/test_case_started.cpp | 24 +++++++ .../cucumber/messages/test_run_finished.cpp | 23 +++++++ .../cucumber/messages/test_run_started.cpp | 20 ++++++ .../cucumber/messages/test_step.cpp | 24 +++++++ .../cucumber/messages/test_step_finished.cpp | 23 +++++++ .../cucumber/messages/test_step_result.cpp | 23 +++++++ .../messages/test_step_result_status.cpp | 33 ++++++++++ .../cucumber/messages/test_step_started.cpp | 22 +++++++ .../cucumber/messages/timestamp.cpp | 21 +++++++ .../messages/undefined_parameter_type.cpp | 21 +++++++ 123 files changed, 3150 insertions(+), 2 deletions(-) create mode 100644 cpp/include/cucumber/messages/attachment.hpp create mode 100644 cpp/include/cucumber/messages/attachment_content_encoding.hpp create mode 100644 cpp/include/cucumber/messages/background.hpp create mode 100644 cpp/include/cucumber/messages/ci.hpp create mode 100644 cpp/include/cucumber/messages/comment.hpp create mode 100644 cpp/include/cucumber/messages/data_table.hpp create mode 100644 cpp/include/cucumber/messages/doc_string.hpp create mode 100644 cpp/include/cucumber/messages/duration.hpp create mode 100644 cpp/include/cucumber/messages/envelope.hpp create mode 100644 cpp/include/cucumber/messages/examples.hpp create mode 100644 cpp/include/cucumber/messages/exception.hpp create mode 100644 cpp/include/cucumber/messages/feature.hpp create mode 100644 cpp/include/cucumber/messages/feature_child.hpp create mode 100644 cpp/include/cucumber/messages/gherkin_document.hpp create mode 100644 cpp/include/cucumber/messages/git.hpp create mode 100644 cpp/include/cucumber/messages/group.hpp create mode 100644 cpp/include/cucumber/messages/hook.hpp create mode 100644 cpp/include/cucumber/messages/java_method.hpp create mode 100644 cpp/include/cucumber/messages/java_stack_trace_element.hpp create mode 100644 cpp/include/cucumber/messages/location.hpp create mode 100644 cpp/include/cucumber/messages/meta.hpp create mode 100644 cpp/include/cucumber/messages/parameter_type.hpp create mode 100644 cpp/include/cucumber/messages/parse_error.hpp create mode 100644 cpp/include/cucumber/messages/pickle.hpp create mode 100644 cpp/include/cucumber/messages/pickle_doc_string.hpp create mode 100644 cpp/include/cucumber/messages/pickle_step.hpp create mode 100644 cpp/include/cucumber/messages/pickle_step_argument.hpp create mode 100644 cpp/include/cucumber/messages/pickle_step_type.hpp create mode 100644 cpp/include/cucumber/messages/pickle_table.hpp create mode 100644 cpp/include/cucumber/messages/pickle_table_cell.hpp create mode 100644 cpp/include/cucumber/messages/pickle_table_row.hpp create mode 100644 cpp/include/cucumber/messages/pickle_tag.hpp create mode 100644 cpp/include/cucumber/messages/product.hpp create mode 100644 cpp/include/cucumber/messages/rule.hpp create mode 100644 cpp/include/cucumber/messages/rule_child.hpp create mode 100644 cpp/include/cucumber/messages/scenario.hpp create mode 100644 cpp/include/cucumber/messages/source.hpp create mode 100644 cpp/include/cucumber/messages/source_media_type.hpp create mode 100644 cpp/include/cucumber/messages/source_reference.hpp create mode 100644 cpp/include/cucumber/messages/step.hpp create mode 100644 cpp/include/cucumber/messages/step_definition.hpp create mode 100644 cpp/include/cucumber/messages/step_definition_pattern.hpp create mode 100644 cpp/include/cucumber/messages/step_definition_pattern_type.hpp create mode 100644 cpp/include/cucumber/messages/step_keyword_type.hpp create mode 100644 cpp/include/cucumber/messages/step_match_argument.hpp create mode 100644 cpp/include/cucumber/messages/step_match_arguments_list.hpp create mode 100644 cpp/include/cucumber/messages/table_cell.hpp create mode 100644 cpp/include/cucumber/messages/table_row.hpp create mode 100644 cpp/include/cucumber/messages/tag.hpp create mode 100644 cpp/include/cucumber/messages/test_case.hpp create mode 100644 cpp/include/cucumber/messages/test_case_finished.hpp create mode 100644 cpp/include/cucumber/messages/test_case_started.hpp create mode 100644 cpp/include/cucumber/messages/test_run_finished.hpp create mode 100644 cpp/include/cucumber/messages/test_run_started.hpp create mode 100644 cpp/include/cucumber/messages/test_step.hpp create mode 100644 cpp/include/cucumber/messages/test_step_finished.hpp create mode 100644 cpp/include/cucumber/messages/test_step_result.hpp create mode 100644 cpp/include/cucumber/messages/test_step_result_status.hpp create mode 100644 cpp/include/cucumber/messages/test_step_started.hpp create mode 100644 cpp/include/cucumber/messages/timestamp.hpp create mode 100644 cpp/include/cucumber/messages/undefined_parameter_type.hpp create mode 100644 cpp/src/lib/cucumber-messages/cucumber/messages/attachment.cpp create mode 100644 cpp/src/lib/cucumber-messages/cucumber/messages/attachment_content_encoding.cpp create mode 100644 cpp/src/lib/cucumber-messages/cucumber/messages/background.cpp create mode 100644 cpp/src/lib/cucumber-messages/cucumber/messages/ci.cpp create mode 100644 cpp/src/lib/cucumber-messages/cucumber/messages/comment.cpp create mode 100644 cpp/src/lib/cucumber-messages/cucumber/messages/data_table.cpp create mode 100644 cpp/src/lib/cucumber-messages/cucumber/messages/doc_string.cpp create mode 100644 cpp/src/lib/cucumber-messages/cucumber/messages/duration.cpp create mode 100644 cpp/src/lib/cucumber-messages/cucumber/messages/envelope.cpp create mode 100644 cpp/src/lib/cucumber-messages/cucumber/messages/examples.cpp create mode 100644 cpp/src/lib/cucumber-messages/cucumber/messages/exception.cpp create mode 100644 cpp/src/lib/cucumber-messages/cucumber/messages/feature.cpp create mode 100644 cpp/src/lib/cucumber-messages/cucumber/messages/feature_child.cpp create mode 100644 cpp/src/lib/cucumber-messages/cucumber/messages/gherkin_document.cpp create mode 100644 cpp/src/lib/cucumber-messages/cucumber/messages/git.cpp create mode 100644 cpp/src/lib/cucumber-messages/cucumber/messages/group.cpp create mode 100644 cpp/src/lib/cucumber-messages/cucumber/messages/hook.cpp create mode 100644 cpp/src/lib/cucumber-messages/cucumber/messages/java_method.cpp create mode 100644 cpp/src/lib/cucumber-messages/cucumber/messages/java_stack_trace_element.cpp create mode 100644 cpp/src/lib/cucumber-messages/cucumber/messages/location.cpp create mode 100644 cpp/src/lib/cucumber-messages/cucumber/messages/meta.cpp create mode 100644 cpp/src/lib/cucumber-messages/cucumber/messages/parameter_type.cpp create mode 100644 cpp/src/lib/cucumber-messages/cucumber/messages/parse_error.cpp create mode 100644 cpp/src/lib/cucumber-messages/cucumber/messages/pickle.cpp create mode 100644 cpp/src/lib/cucumber-messages/cucumber/messages/pickle_doc_string.cpp create mode 100644 cpp/src/lib/cucumber-messages/cucumber/messages/pickle_step.cpp create mode 100644 cpp/src/lib/cucumber-messages/cucumber/messages/pickle_step_argument.cpp create mode 100644 cpp/src/lib/cucumber-messages/cucumber/messages/pickle_step_type.cpp create mode 100644 cpp/src/lib/cucumber-messages/cucumber/messages/pickle_table.cpp create mode 100644 cpp/src/lib/cucumber-messages/cucumber/messages/pickle_table_cell.cpp create mode 100644 cpp/src/lib/cucumber-messages/cucumber/messages/pickle_table_row.cpp create mode 100644 cpp/src/lib/cucumber-messages/cucumber/messages/pickle_tag.cpp create mode 100644 cpp/src/lib/cucumber-messages/cucumber/messages/product.cpp create mode 100644 cpp/src/lib/cucumber-messages/cucumber/messages/rule.cpp create mode 100644 cpp/src/lib/cucumber-messages/cucumber/messages/rule_child.cpp create mode 100644 cpp/src/lib/cucumber-messages/cucumber/messages/scenario.cpp create mode 100644 cpp/src/lib/cucumber-messages/cucumber/messages/source.cpp create mode 100644 cpp/src/lib/cucumber-messages/cucumber/messages/source_media_type.cpp create mode 100644 cpp/src/lib/cucumber-messages/cucumber/messages/source_reference.cpp create mode 100644 cpp/src/lib/cucumber-messages/cucumber/messages/step.cpp create mode 100644 cpp/src/lib/cucumber-messages/cucumber/messages/step_definition.cpp create mode 100644 cpp/src/lib/cucumber-messages/cucumber/messages/step_definition_pattern.cpp create mode 100644 cpp/src/lib/cucumber-messages/cucumber/messages/step_definition_pattern_type.cpp create mode 100644 cpp/src/lib/cucumber-messages/cucumber/messages/step_keyword_type.cpp create mode 100644 cpp/src/lib/cucumber-messages/cucumber/messages/step_match_argument.cpp create mode 100644 cpp/src/lib/cucumber-messages/cucumber/messages/step_match_arguments_list.cpp create mode 100644 cpp/src/lib/cucumber-messages/cucumber/messages/table_cell.cpp create mode 100644 cpp/src/lib/cucumber-messages/cucumber/messages/table_row.cpp create mode 100644 cpp/src/lib/cucumber-messages/cucumber/messages/tag.cpp create mode 100644 cpp/src/lib/cucumber-messages/cucumber/messages/test_case.cpp create mode 100644 cpp/src/lib/cucumber-messages/cucumber/messages/test_case_finished.cpp create mode 100644 cpp/src/lib/cucumber-messages/cucumber/messages/test_case_started.cpp create mode 100644 cpp/src/lib/cucumber-messages/cucumber/messages/test_run_finished.cpp create mode 100644 cpp/src/lib/cucumber-messages/cucumber/messages/test_run_started.cpp create mode 100644 cpp/src/lib/cucumber-messages/cucumber/messages/test_step.cpp create mode 100644 cpp/src/lib/cucumber-messages/cucumber/messages/test_step_finished.cpp create mode 100644 cpp/src/lib/cucumber-messages/cucumber/messages/test_step_result.cpp create mode 100644 cpp/src/lib/cucumber-messages/cucumber/messages/test_step_result_status.cpp create mode 100644 cpp/src/lib/cucumber-messages/cucumber/messages/test_step_started.cpp create mode 100644 cpp/src/lib/cucumber-messages/cucumber/messages/timestamp.cpp create mode 100644 cpp/src/lib/cucumber-messages/cucumber/messages/undefined_parameter_type.cpp diff --git a/cpp/.gitignore b/cpp/.gitignore index 9ea7933d..b3fcb7ca 100644 --- a/cpp/.gitignore +++ b/cpp/.gitignore @@ -1,5 +1,3 @@ -include/cucumber/messages/ -src/lib/cucumber-messages/cucumber/messages/ .configured .built build/ diff --git a/cpp/include/cucumber/messages/attachment.hpp b/cpp/include/cucumber/messages/attachment.hpp new file mode 100644 index 00000000..a587d37e --- /dev/null +++ b/cpp/include/cucumber/messages/attachment.hpp @@ -0,0 +1,44 @@ +#pragma once + +#include + +#include + +#include +#include + +namespace cucumber::messages { + +// +// Represents the Attachment message in Cucumber's message protocol +// @see Github - Cucumber - Messages +// +// //// Attachments (parse errors, execution errors, screenshots, links...) +// +// An attachment represents any kind of data associated with a line in a +// [Source](#io.cucumber.messages.Source) file. It can be used for: +// +// * Syntax errors during parse time +// * Screenshots captured and attached during execution +// * Logs captured and attached during execution +// +// It is not to be used for runtime errors raised/thrown during execution. This +// is captured in `TestResult`. +// +// Generated code + +struct attachment : cucumber::message +{ + std::string body; + cucumber::messages::attachment_content_encoding content_encoding; + std::string file_name; + std::string media_type; + cucumber::messages::source source; + std::string test_case_started_id; + std::string test_step_id; + std::string url; + + std::string to_string() const override; +}; + +} diff --git a/cpp/include/cucumber/messages/attachment_content_encoding.hpp b/cpp/include/cucumber/messages/attachment_content_encoding.hpp new file mode 100644 index 00000000..36f54140 --- /dev/null +++ b/cpp/include/cucumber/messages/attachment_content_encoding.hpp @@ -0,0 +1,19 @@ +#pragma once + +#include + +namespace cucumber::messages { + +enum class attachment_content_encoding +{ + IDENTITY, + BASE64 +}; + +std::string_view +to_string(attachment_content_encoding v); + +std::ostream& +operator<<(std::ostream& os, attachment_content_encoding v); + +} diff --git a/cpp/include/cucumber/messages/background.hpp b/cpp/include/cucumber/messages/background.hpp new file mode 100644 index 00000000..0b284beb --- /dev/null +++ b/cpp/include/cucumber/messages/background.hpp @@ -0,0 +1,30 @@ +#pragma once + +#include + +#include + +#include +#include + +namespace cucumber::messages { + +// +// Represents the Background message in Cucumber's message protocol +// @see Github - Cucumber - Messages +// +// Generated code + +struct background : cucumber::message +{ + cucumber::messages::location location; + std::string keyword; + std::string name; + std::string description; + std::vector steps; + std::string id; + + std::string to_string() const override; +}; + +} diff --git a/cpp/include/cucumber/messages/ci.hpp b/cpp/include/cucumber/messages/ci.hpp new file mode 100644 index 00000000..b766b1cd --- /dev/null +++ b/cpp/include/cucumber/messages/ci.hpp @@ -0,0 +1,29 @@ +#pragma once + +#include + +#include + +#include + +namespace cucumber::messages { + +// +// Represents the Ci message in Cucumber's message protocol +// @see Github - Cucumber - Messages +// +// CI environment +// +// Generated code + +struct ci : cucumber::message +{ + std::string name; + std::string url; + std::string build_number; + cucumber::messages::git git; + + std::string to_string() const override; +}; + +} diff --git a/cpp/include/cucumber/messages/comment.hpp b/cpp/include/cucumber/messages/comment.hpp new file mode 100644 index 00000000..097b5b16 --- /dev/null +++ b/cpp/include/cucumber/messages/comment.hpp @@ -0,0 +1,27 @@ +#pragma once + +#include + +#include + +#include + +namespace cucumber::messages { + +// +// Represents the Comment message in Cucumber's message protocol +// @see Github - Cucumber - Messages +// +// A comment in a Gherkin document +// +// Generated code + +struct comment : cucumber::message +{ + cucumber::messages::location location; + std::string text; + + std::string to_string() const override; +}; + +} diff --git a/cpp/include/cucumber/messages/data_table.hpp b/cpp/include/cucumber/messages/data_table.hpp new file mode 100644 index 00000000..1f4da9e8 --- /dev/null +++ b/cpp/include/cucumber/messages/data_table.hpp @@ -0,0 +1,26 @@ +#pragma once + +#include + +#include + +#include +#include + +namespace cucumber::messages { + +// +// Represents the DataTable message in Cucumber's message protocol +// @see Github - Cucumber - Messages +// +// Generated code + +struct data_table : cucumber::message +{ + cucumber::messages::location location; + std::vector rows; + + std::string to_string() const override; +}; + +} diff --git a/cpp/include/cucumber/messages/doc_string.hpp b/cpp/include/cucumber/messages/doc_string.hpp new file mode 100644 index 00000000..790f8bfe --- /dev/null +++ b/cpp/include/cucumber/messages/doc_string.hpp @@ -0,0 +1,27 @@ +#pragma once + +#include + +#include + +#include + +namespace cucumber::messages { + +// +// Represents the DocString message in Cucumber's message protocol +// @see Github - Cucumber - Messages +// +// Generated code + +struct doc_string : cucumber::message +{ + cucumber::messages::location location; + std::string media_type; + std::string content; + std::string delimiter; + + std::string to_string() const override; +}; + +} diff --git a/cpp/include/cucumber/messages/duration.hpp b/cpp/include/cucumber/messages/duration.hpp new file mode 100644 index 00000000..27169150 --- /dev/null +++ b/cpp/include/cucumber/messages/duration.hpp @@ -0,0 +1,26 @@ +#pragma once + +#include + +#include + +namespace cucumber::messages { + +// +// Represents the Duration message in Cucumber's message protocol +// @see Github - Cucumber - Messages +// +// The structure is pretty close of the Timestamp one. For clarity, a second type +// of message is used. +// +// Generated code + +struct duration : cucumber::message +{ + std::size_t seconds; + std::size_t nanos; + + std::string to_string() const override; +}; + +} diff --git a/cpp/include/cucumber/messages/envelope.hpp b/cpp/include/cucumber/messages/envelope.hpp new file mode 100644 index 00000000..d4ea6d31 --- /dev/null +++ b/cpp/include/cucumber/messages/envelope.hpp @@ -0,0 +1,63 @@ +#pragma once + +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace cucumber::messages { + +// +// Represents the Envelope message in Cucumber's message protocol +// @see Github - Cucumber - Messages +// +// When removing a field, replace it with reserved, rather than deleting the line. +// When adding a field, add it to the end and increment the number by one. +// See https://developers.google.com/protocol-buffers/docs/proto#updating for details +// +// All the messages that are passed between different components/processes are Envelope +// messages. +// +// Generated code + +struct envelope : cucumber::message +{ + cucumber::messages::attachment attachment; + cucumber::messages::gherkin_document gherkin_document; + cucumber::messages::hook hook; + cucumber::messages::meta meta; + cucumber::messages::parameter_type parameter_type; + cucumber::messages::parse_error parse_error; + cucumber::messages::pickle pickle; + cucumber::messages::source source; + cucumber::messages::step_definition step_definition; + cucumber::messages::test_case test_case; + cucumber::messages::test_case_finished test_case_finished; + cucumber::messages::test_case_started test_case_started; + cucumber::messages::test_run_finished test_run_finished; + cucumber::messages::test_run_started test_run_started; + cucumber::messages::test_step_finished test_step_finished; + cucumber::messages::test_step_started test_step_started; + cucumber::messages::undefined_parameter_type undefined_parameter_type; + + std::string to_string() const override; +}; + +} diff --git a/cpp/include/cucumber/messages/examples.hpp b/cpp/include/cucumber/messages/examples.hpp new file mode 100644 index 00000000..e256f453 --- /dev/null +++ b/cpp/include/cucumber/messages/examples.hpp @@ -0,0 +1,34 @@ +#pragma once + +#include + +#include + +#include +#include +#include +#include + +namespace cucumber::messages { + +// +// Represents the Examples message in Cucumber's message protocol +// @see Github - Cucumber - Messages +// +// Generated code + +struct examples : cucumber::message +{ + cucumber::messages::location location; + std::vector tags; + std::string keyword; + std::string name; + std::string description; + cucumber::messages::table_row table_header; + std::vector table_body; + std::string id; + + std::string to_string() const override; +}; + +} diff --git a/cpp/include/cucumber/messages/exception.hpp b/cpp/include/cucumber/messages/exception.hpp new file mode 100644 index 00000000..fc4e4a82 --- /dev/null +++ b/cpp/include/cucumber/messages/exception.hpp @@ -0,0 +1,25 @@ +#pragma once + +#include + +#include + +namespace cucumber::messages { + +// +// Represents the Exception message in Cucumber's message protocol +// @see Github - Cucumber - Messages +// +// A simplified representation of an exception +// +// Generated code + +struct exception : cucumber::message +{ + std::string type; + std::string message; + + std::string to_string() const override; +}; + +} diff --git a/cpp/include/cucumber/messages/feature.hpp b/cpp/include/cucumber/messages/feature.hpp new file mode 100644 index 00000000..d73675c4 --- /dev/null +++ b/cpp/include/cucumber/messages/feature.hpp @@ -0,0 +1,32 @@ +#pragma once + +#include + +#include + +#include +#include +#include + +namespace cucumber::messages { + +// +// Represents the Feature message in Cucumber's message protocol +// @see Github - Cucumber - Messages +// +// Generated code + +struct feature : cucumber::message +{ + cucumber::messages::location location; + std::vector tags; + std::string language; + std::string keyword; + std::string name; + std::string description; + std::vector children; + + std::string to_string() const override; +}; + +} diff --git a/cpp/include/cucumber/messages/feature_child.hpp b/cpp/include/cucumber/messages/feature_child.hpp new file mode 100644 index 00000000..009970a6 --- /dev/null +++ b/cpp/include/cucumber/messages/feature_child.hpp @@ -0,0 +1,30 @@ +#pragma once + +#include + +#include + +#include +#include +#include + +namespace cucumber::messages { + +// +// Represents the FeatureChild message in Cucumber's message protocol +// @see Github - Cucumber - Messages +// +// A child node of a `Feature` node +// +// Generated code + +struct feature_child : cucumber::message +{ + cucumber::messages::rule rule; + cucumber::messages::background background; + cucumber::messages::scenario scenario; + + std::string to_string() const override; +}; + +} diff --git a/cpp/include/cucumber/messages/gherkin_document.hpp b/cpp/include/cucumber/messages/gherkin_document.hpp new file mode 100644 index 00000000..a832a469 --- /dev/null +++ b/cpp/include/cucumber/messages/gherkin_document.hpp @@ -0,0 +1,34 @@ +#pragma once + +#include + +#include + +#include +#include + +namespace cucumber::messages { + +// +// Represents the GherkinDocument message in Cucumber's message protocol +// @see Github - Cucumber - Messages +// +// The [AST](https://en.wikipedia.org/wiki/Abstract_syntax_tree) of a Gherkin document. +// Cucumber implementations should *not* depend on `GherkinDocument` or any of its +// children for execution - use [Pickle](#io.cucumber.messages.Pickle) instead. +// +// The only consumers of `GherkinDocument` should only be formatters that produce +// "rich" output, resembling the original Gherkin document. +// +// Generated code + +struct gherkin_document : cucumber::message +{ + std::string uri; + cucumber::messages::feature feature; + std::vector comments; + + std::string to_string() const override; +}; + +} diff --git a/cpp/include/cucumber/messages/git.hpp b/cpp/include/cucumber/messages/git.hpp new file mode 100644 index 00000000..c184048b --- /dev/null +++ b/cpp/include/cucumber/messages/git.hpp @@ -0,0 +1,28 @@ +#pragma once + +#include + +#include + +namespace cucumber::messages { + +// +// Represents the Git message in Cucumber's message protocol +// @see Github - Cucumber - Messages +// +// Information about Git, provided by the Build/CI server as environment +// variables. +// +// Generated code + +struct git : cucumber::message +{ + std::string remote; + std::string revision; + std::string branch; + std::string tag; + + std::string to_string() const override; +}; + +} diff --git a/cpp/include/cucumber/messages/group.hpp b/cpp/include/cucumber/messages/group.hpp new file mode 100644 index 00000000..1b1d4e33 --- /dev/null +++ b/cpp/include/cucumber/messages/group.hpp @@ -0,0 +1,26 @@ +#pragma once + +#include + +#include + +#include + +namespace cucumber::messages { + +// +// Represents the Group message in Cucumber's message protocol +// @see Github - Cucumber - Messages +// +// Generated code + +struct group : cucumber::message +{ + std::vector children; + std::size_t start; + std::string value; + + std::string to_string() const override; +}; + +} diff --git a/cpp/include/cucumber/messages/hook.hpp b/cpp/include/cucumber/messages/hook.hpp new file mode 100644 index 00000000..319c9bd5 --- /dev/null +++ b/cpp/include/cucumber/messages/hook.hpp @@ -0,0 +1,27 @@ +#pragma once + +#include + +#include + +#include + +namespace cucumber::messages { + +// +// Represents the Hook message in Cucumber's message protocol +// @see Github - Cucumber - Messages +// +// Generated code + +struct hook : cucumber::message +{ + std::string id; + std::string name; + cucumber::messages::source_reference source_reference; + std::string tag_expression; + + std::string to_string() const override; +}; + +} diff --git a/cpp/include/cucumber/messages/java_method.hpp b/cpp/include/cucumber/messages/java_method.hpp new file mode 100644 index 00000000..8ebcf0b1 --- /dev/null +++ b/cpp/include/cucumber/messages/java_method.hpp @@ -0,0 +1,24 @@ +#pragma once + +#include + +#include + +namespace cucumber::messages { + +// +// Represents the JavaMethod message in Cucumber's message protocol +// @see Github - Cucumber - Messages +// +// Generated code + +struct java_method : cucumber::message +{ + std::string class_name; + std::string method_name; + std::vector method_parameter_types; + + std::string to_string() const override; +}; + +} diff --git a/cpp/include/cucumber/messages/java_stack_trace_element.hpp b/cpp/include/cucumber/messages/java_stack_trace_element.hpp new file mode 100644 index 00000000..f782df84 --- /dev/null +++ b/cpp/include/cucumber/messages/java_stack_trace_element.hpp @@ -0,0 +1,24 @@ +#pragma once + +#include + +#include + +namespace cucumber::messages { + +// +// Represents the JavaStackTraceElement message in Cucumber's message protocol +// @see Github - Cucumber - Messages +// +// Generated code + +struct java_stack_trace_element : cucumber::message +{ + std::string class_name; + std::string file_name; + std::string method_name; + + std::string to_string() const override; +}; + +} diff --git a/cpp/include/cucumber/messages/location.hpp b/cpp/include/cucumber/messages/location.hpp new file mode 100644 index 00000000..5348eb7f --- /dev/null +++ b/cpp/include/cucumber/messages/location.hpp @@ -0,0 +1,25 @@ +#pragma once + +#include + +#include + +namespace cucumber::messages { + +// +// Represents the Location message in Cucumber's message protocol +// @see Github - Cucumber - Messages +// +// Points to a line and a column in a text file +// +// Generated code + +struct location : cucumber::message +{ + std::size_t line; + std::size_t column; + + std::string to_string() const override; +}; + +} diff --git a/cpp/include/cucumber/messages/meta.hpp b/cpp/include/cucumber/messages/meta.hpp new file mode 100644 index 00000000..18d33892 --- /dev/null +++ b/cpp/include/cucumber/messages/meta.hpp @@ -0,0 +1,36 @@ +#pragma once + +#include + +#include + +#include +#include +#include +#include +#include + +namespace cucumber::messages { + +// +// Represents the Meta message in Cucumber's message protocol +// @see Github - Cucumber - Messages +// +// This message contains meta information about the environment. Consumers can use +// this for various purposes. +// +// Generated code + +struct meta : cucumber::message +{ + std::string protocol_version; + cucumber::messages::product implementation; + cucumber::messages::product runtime; + cucumber::messages::product os; + cucumber::messages::product cpu; + cucumber::messages::ci ci; + + std::string to_string() const override; +}; + +} diff --git a/cpp/include/cucumber/messages/parameter_type.hpp b/cpp/include/cucumber/messages/parameter_type.hpp new file mode 100644 index 00000000..d753c4b6 --- /dev/null +++ b/cpp/include/cucumber/messages/parameter_type.hpp @@ -0,0 +1,29 @@ +#pragma once + +#include + +#include + +#include + +namespace cucumber::messages { + +// +// Represents the ParameterType message in Cucumber's message protocol +// @see Github - Cucumber - Messages +// +// Generated code + +struct parameter_type : cucumber::message +{ + std::string name; + std::vector regular_expressions; + bool prefer_for_regular_expression_match; + bool use_for_snippets; + std::string id; + cucumber::messages::source_reference source_reference; + + std::string to_string() const override; +}; + +} diff --git a/cpp/include/cucumber/messages/parse_error.hpp b/cpp/include/cucumber/messages/parse_error.hpp new file mode 100644 index 00000000..30c72e9a --- /dev/null +++ b/cpp/include/cucumber/messages/parse_error.hpp @@ -0,0 +1,25 @@ +#pragma once + +#include + +#include + +#include + +namespace cucumber::messages { + +// +// Represents the ParseError message in Cucumber's message protocol +// @see Github - Cucumber - Messages +// +// Generated code + +struct parse_error : cucumber::message +{ + cucumber::messages::source_reference source; + std::string message; + + std::string to_string() const override; +}; + +} diff --git a/cpp/include/cucumber/messages/pickle.hpp b/cpp/include/cucumber/messages/pickle.hpp new file mode 100644 index 00000000..6214e242 --- /dev/null +++ b/cpp/include/cucumber/messages/pickle.hpp @@ -0,0 +1,44 @@ +#pragma once + +#include + +#include + +#include +#include + +namespace cucumber::messages { + +// +// Represents the Pickle message in Cucumber's message protocol +// @see Github - Cucumber - Messages +// +// //// Pickles +// +// A `Pickle` represents a template for a `TestCase`. It is typically derived +// from another format, such as [GherkinDocument](#io.cucumber.messages.GherkinDocument). +// In the future a `Pickle` may be derived from other formats such as Markdown or +// Excel files. +// +// By making `Pickle` the main data structure Cucumber uses for execution, the +// implementation of Cucumber itself becomes simpler, as it doesn't have to deal +// with the complex structure of a [GherkinDocument](#io.cucumber.messages.GherkinDocument). +// +// Each `PickleStep` of a `Pickle` is matched with a `StepDefinition` to create a `TestCase` +// +// Generated code + +struct pickle : cucumber::message +{ + std::string id; + std::string uri; + std::string name; + std::string language; + std::vector steps; + std::vector tags; + std::vector ast_node_ids; + + std::string to_string() const override; +}; + +} diff --git a/cpp/include/cucumber/messages/pickle_doc_string.hpp b/cpp/include/cucumber/messages/pickle_doc_string.hpp new file mode 100644 index 00000000..50d70294 --- /dev/null +++ b/cpp/include/cucumber/messages/pickle_doc_string.hpp @@ -0,0 +1,23 @@ +#pragma once + +#include + +#include + +namespace cucumber::messages { + +// +// Represents the PickleDocString message in Cucumber's message protocol +// @see Github - Cucumber - Messages +// +// Generated code + +struct pickle_doc_string : cucumber::message +{ + std::string media_type; + std::string content; + + std::string to_string() const override; +}; + +} diff --git a/cpp/include/cucumber/messages/pickle_step.hpp b/cpp/include/cucumber/messages/pickle_step.hpp new file mode 100644 index 00000000..69e05b8b --- /dev/null +++ b/cpp/include/cucumber/messages/pickle_step.hpp @@ -0,0 +1,31 @@ +#pragma once + +#include + +#include + +#include +#include + +namespace cucumber::messages { + +// +// Represents the PickleStep message in Cucumber's message protocol +// @see Github - Cucumber - Messages +// +// An executable step +// +// Generated code + +struct pickle_step : cucumber::message +{ + cucumber::messages::pickle_step_argument argument; + std::vector ast_node_ids; + std::string id; + cucumber::messages::pickle_step_type type; + std::string text; + + std::string to_string() const override; +}; + +} diff --git a/cpp/include/cucumber/messages/pickle_step_argument.hpp b/cpp/include/cucumber/messages/pickle_step_argument.hpp new file mode 100644 index 00000000..0c30f64b --- /dev/null +++ b/cpp/include/cucumber/messages/pickle_step_argument.hpp @@ -0,0 +1,28 @@ +#pragma once + +#include + +#include + +#include +#include + +namespace cucumber::messages { + +// +// Represents the PickleStepArgument message in Cucumber's message protocol +// @see Github - Cucumber - Messages +// +// An optional argument +// +// Generated code + +struct pickle_step_argument : cucumber::message +{ + cucumber::messages::pickle_doc_string doc_string; + cucumber::messages::pickle_table data_table; + + std::string to_string() const override; +}; + +} diff --git a/cpp/include/cucumber/messages/pickle_step_type.hpp b/cpp/include/cucumber/messages/pickle_step_type.hpp new file mode 100644 index 00000000..40a7f083 --- /dev/null +++ b/cpp/include/cucumber/messages/pickle_step_type.hpp @@ -0,0 +1,21 @@ +#pragma once + +#include + +namespace cucumber::messages { + +enum class pickle_step_type +{ + UNKNOWN, + CONTEXT, + ACTION, + OUTCOME +}; + +std::string_view +to_string(pickle_step_type v); + +std::ostream& +operator<<(std::ostream& os, pickle_step_type v); + +} diff --git a/cpp/include/cucumber/messages/pickle_table.hpp b/cpp/include/cucumber/messages/pickle_table.hpp new file mode 100644 index 00000000..ccde87e6 --- /dev/null +++ b/cpp/include/cucumber/messages/pickle_table.hpp @@ -0,0 +1,24 @@ +#pragma once + +#include + +#include + +#include + +namespace cucumber::messages { + +// +// Represents the PickleTable message in Cucumber's message protocol +// @see Github - Cucumber - Messages +// +// Generated code + +struct pickle_table : cucumber::message +{ + std::vector rows; + + std::string to_string() const override; +}; + +} diff --git a/cpp/include/cucumber/messages/pickle_table_cell.hpp b/cpp/include/cucumber/messages/pickle_table_cell.hpp new file mode 100644 index 00000000..fdab3447 --- /dev/null +++ b/cpp/include/cucumber/messages/pickle_table_cell.hpp @@ -0,0 +1,22 @@ +#pragma once + +#include + +#include + +namespace cucumber::messages { + +// +// Represents the PickleTableCell message in Cucumber's message protocol +// @see Github - Cucumber - Messages +// +// Generated code + +struct pickle_table_cell : cucumber::message +{ + std::string value; + + std::string to_string() const override; +}; + +} diff --git a/cpp/include/cucumber/messages/pickle_table_row.hpp b/cpp/include/cucumber/messages/pickle_table_row.hpp new file mode 100644 index 00000000..22a4479e --- /dev/null +++ b/cpp/include/cucumber/messages/pickle_table_row.hpp @@ -0,0 +1,24 @@ +#pragma once + +#include + +#include + +#include + +namespace cucumber::messages { + +// +// Represents the PickleTableRow message in Cucumber's message protocol +// @see Github - Cucumber - Messages +// +// Generated code + +struct pickle_table_row : cucumber::message +{ + std::vector cells; + + std::string to_string() const override; +}; + +} diff --git a/cpp/include/cucumber/messages/pickle_tag.hpp b/cpp/include/cucumber/messages/pickle_tag.hpp new file mode 100644 index 00000000..f7ff0518 --- /dev/null +++ b/cpp/include/cucumber/messages/pickle_tag.hpp @@ -0,0 +1,25 @@ +#pragma once + +#include + +#include + +namespace cucumber::messages { + +// +// Represents the PickleTag message in Cucumber's message protocol +// @see Github - Cucumber - Messages +// +// A tag +// +// Generated code + +struct pickle_tag : cucumber::message +{ + std::string name; + std::string ast_node_id; + + std::string to_string() const override; +}; + +} diff --git a/cpp/include/cucumber/messages/product.hpp b/cpp/include/cucumber/messages/product.hpp new file mode 100644 index 00000000..8aee270b --- /dev/null +++ b/cpp/include/cucumber/messages/product.hpp @@ -0,0 +1,25 @@ +#pragma once + +#include + +#include + +namespace cucumber::messages { + +// +// Represents the Product message in Cucumber's message protocol +// @see Github - Cucumber - Messages +// +// Used to describe various properties of Meta +// +// Generated code + +struct product : cucumber::message +{ + std::string name; + std::string version; + + std::string to_string() const override; +}; + +} diff --git a/cpp/include/cucumber/messages/rule.hpp b/cpp/include/cucumber/messages/rule.hpp new file mode 100644 index 00000000..124a9f3d --- /dev/null +++ b/cpp/include/cucumber/messages/rule.hpp @@ -0,0 +1,32 @@ +#pragma once + +#include + +#include + +#include +#include +#include + +namespace cucumber::messages { + +// +// Represents the Rule message in Cucumber's message protocol +// @see Github - Cucumber - Messages +// +// Generated code + +struct rule : cucumber::message +{ + cucumber::messages::location location; + std::vector tags; + std::string keyword; + std::string name; + std::string description; + std::vector children; + std::string id; + + std::string to_string() const override; +}; + +} diff --git a/cpp/include/cucumber/messages/rule_child.hpp b/cpp/include/cucumber/messages/rule_child.hpp new file mode 100644 index 00000000..ef2e62b4 --- /dev/null +++ b/cpp/include/cucumber/messages/rule_child.hpp @@ -0,0 +1,28 @@ +#pragma once + +#include + +#include + +#include +#include + +namespace cucumber::messages { + +// +// Represents the RuleChild message in Cucumber's message protocol +// @see Github - Cucumber - Messages +// +// A child node of a `Rule` node +// +// Generated code + +struct rule_child : cucumber::message +{ + cucumber::messages::background background; + cucumber::messages::scenario scenario; + + std::string to_string() const override; +}; + +} diff --git a/cpp/include/cucumber/messages/scenario.hpp b/cpp/include/cucumber/messages/scenario.hpp new file mode 100644 index 00000000..2eeb7ee4 --- /dev/null +++ b/cpp/include/cucumber/messages/scenario.hpp @@ -0,0 +1,34 @@ +#pragma once + +#include + +#include + +#include +#include +#include +#include + +namespace cucumber::messages { + +// +// Represents the Scenario message in Cucumber's message protocol +// @see Github - Cucumber - Messages +// +// Generated code + +struct scenario : cucumber::message +{ + cucumber::messages::location location; + std::vector tags; + std::string keyword; + std::string name; + std::string description; + std::vector steps; + std::vector examples; + std::string id; + + std::string to_string() const override; +}; + +} diff --git a/cpp/include/cucumber/messages/source.hpp b/cpp/include/cucumber/messages/source.hpp new file mode 100644 index 00000000..49113881 --- /dev/null +++ b/cpp/include/cucumber/messages/source.hpp @@ -0,0 +1,30 @@ +#pragma once + +#include + +#include + +#include + +namespace cucumber::messages { + +// +// Represents the Source message in Cucumber's message protocol +// @see Github - Cucumber - Messages +// +// //// Source +// +// A source file, typically a Gherkin document or Java/Ruby/JavaScript source code +// +// Generated code + +struct source : cucumber::message +{ + std::string uri; + std::string data; + cucumber::messages::source_media_type media_type; + + std::string to_string() const override; +}; + +} diff --git a/cpp/include/cucumber/messages/source_media_type.hpp b/cpp/include/cucumber/messages/source_media_type.hpp new file mode 100644 index 00000000..9c2f01f2 --- /dev/null +++ b/cpp/include/cucumber/messages/source_media_type.hpp @@ -0,0 +1,19 @@ +#pragma once + +#include + +namespace cucumber::messages { + +enum class source_media_type +{ + TEXT_X_CUCUMBER_GHERKIN_PLAIN, + TEXT_X_CUCUMBER_GHERKIN_MARKDOWN +}; + +std::string_view +to_string(source_media_type v); + +std::ostream& +operator<<(std::ostream& os, source_media_type v); + +} diff --git a/cpp/include/cucumber/messages/source_reference.hpp b/cpp/include/cucumber/messages/source_reference.hpp new file mode 100644 index 00000000..0dde140d --- /dev/null +++ b/cpp/include/cucumber/messages/source_reference.hpp @@ -0,0 +1,32 @@ +#pragma once + +#include + +#include + +#include +#include +#include + +namespace cucumber::messages { + +// +// Represents the SourceReference message in Cucumber's message protocol +// @see Github - Cucumber - Messages +// +// Points to a [Source](#io.cucumber.messages.Source) identified by `uri` and a +// [Location](#io.cucumber.messages.Location) within that file. +// +// Generated code + +struct source_reference : cucumber::message +{ + std::string uri; + cucumber::messages::java_method java_method; + cucumber::messages::java_stack_trace_element java_stack_trace_element; + cucumber::messages::location location; + + std::string to_string() const override; +}; + +} diff --git a/cpp/include/cucumber/messages/step.hpp b/cpp/include/cucumber/messages/step.hpp new file mode 100644 index 00000000..fe2ec9a1 --- /dev/null +++ b/cpp/include/cucumber/messages/step.hpp @@ -0,0 +1,35 @@ +#pragma once + +#include + +#include + +#include +#include +#include +#include + +namespace cucumber::messages { + +// +// Represents the Step message in Cucumber's message protocol +// @see Github - Cucumber - Messages +// +// A step +// +// Generated code + +struct step : cucumber::message +{ + cucumber::messages::location location; + std::string keyword; + cucumber::messages::step_keyword_type keyword_type; + std::string text; + cucumber::messages::doc_string doc_string; + cucumber::messages::data_table data_table; + std::string id; + + std::string to_string() const override; +}; + +} diff --git a/cpp/include/cucumber/messages/step_definition.hpp b/cpp/include/cucumber/messages/step_definition.hpp new file mode 100644 index 00000000..c3f7fa9f --- /dev/null +++ b/cpp/include/cucumber/messages/step_definition.hpp @@ -0,0 +1,27 @@ +#pragma once + +#include + +#include + +#include +#include + +namespace cucumber::messages { + +// +// Represents the StepDefinition message in Cucumber's message protocol +// @see Github - Cucumber - Messages +// +// Generated code + +struct step_definition : cucumber::message +{ + std::string id; + cucumber::messages::step_definition_pattern pattern; + cucumber::messages::source_reference source_reference; + + std::string to_string() const override; +}; + +} diff --git a/cpp/include/cucumber/messages/step_definition_pattern.hpp b/cpp/include/cucumber/messages/step_definition_pattern.hpp new file mode 100644 index 00000000..9477e6f5 --- /dev/null +++ b/cpp/include/cucumber/messages/step_definition_pattern.hpp @@ -0,0 +1,25 @@ +#pragma once + +#include + +#include + +#include + +namespace cucumber::messages { + +// +// Represents the StepDefinitionPattern message in Cucumber's message protocol +// @see Github - Cucumber - Messages +// +// Generated code + +struct step_definition_pattern : cucumber::message +{ + std::string source; + cucumber::messages::step_definition_pattern_type type; + + std::string to_string() const override; +}; + +} diff --git a/cpp/include/cucumber/messages/step_definition_pattern_type.hpp b/cpp/include/cucumber/messages/step_definition_pattern_type.hpp new file mode 100644 index 00000000..38ac5d52 --- /dev/null +++ b/cpp/include/cucumber/messages/step_definition_pattern_type.hpp @@ -0,0 +1,19 @@ +#pragma once + +#include + +namespace cucumber::messages { + +enum class step_definition_pattern_type +{ + CUCUMBER_EXPRESSION, + REGULAR_EXPRESSION +}; + +std::string_view +to_string(step_definition_pattern_type v); + +std::ostream& +operator<<(std::ostream& os, step_definition_pattern_type v); + +} diff --git a/cpp/include/cucumber/messages/step_keyword_type.hpp b/cpp/include/cucumber/messages/step_keyword_type.hpp new file mode 100644 index 00000000..3ad19c66 --- /dev/null +++ b/cpp/include/cucumber/messages/step_keyword_type.hpp @@ -0,0 +1,22 @@ +#pragma once + +#include + +namespace cucumber::messages { + +enum class step_keyword_type +{ + UNKNOWN, + CONTEXT, + ACTION, + OUTCOME, + CONJUNCTION +}; + +std::string_view +to_string(step_keyword_type v); + +std::ostream& +operator<<(std::ostream& os, step_keyword_type v); + +} diff --git a/cpp/include/cucumber/messages/step_match_argument.hpp b/cpp/include/cucumber/messages/step_match_argument.hpp new file mode 100644 index 00000000..7d7af9c1 --- /dev/null +++ b/cpp/include/cucumber/messages/step_match_argument.hpp @@ -0,0 +1,32 @@ +#pragma once + +#include + +#include + +#include + +namespace cucumber::messages { + +// +// Represents the StepMatchArgument message in Cucumber's message protocol +// @see Github - Cucumber - Messages +// +// Represents a single argument extracted from a step match and passed to a step definition. +// This is used for the following purposes: +// - Construct an argument to pass to a step definition (possibly through a parameter type transform) +// - Highlight the matched parameter in rich formatters such as the HTML formatter +// +// This message closely matches the `Argument` class in the `cucumber-expressions` library. +// +// Generated code + +struct step_match_argument : cucumber::message +{ + cucumber::messages::group group; + std::string parameter_type_name; + + std::string to_string() const override; +}; + +} diff --git a/cpp/include/cucumber/messages/step_match_arguments_list.hpp b/cpp/include/cucumber/messages/step_match_arguments_list.hpp new file mode 100644 index 00000000..acccaa1d --- /dev/null +++ b/cpp/include/cucumber/messages/step_match_arguments_list.hpp @@ -0,0 +1,24 @@ +#pragma once + +#include + +#include + +#include + +namespace cucumber::messages { + +// +// Represents the StepMatchArgumentsList message in Cucumber's message protocol +// @see Github - Cucumber - Messages +// +// Generated code + +struct step_match_arguments_list : cucumber::message +{ + std::vector step_match_arguments; + + std::string to_string() const override; +}; + +} diff --git a/cpp/include/cucumber/messages/table_cell.hpp b/cpp/include/cucumber/messages/table_cell.hpp new file mode 100644 index 00000000..acd7810e --- /dev/null +++ b/cpp/include/cucumber/messages/table_cell.hpp @@ -0,0 +1,27 @@ +#pragma once + +#include + +#include + +#include + +namespace cucumber::messages { + +// +// Represents the TableCell message in Cucumber's message protocol +// @see Github - Cucumber - Messages +// +// A cell in a `TableRow` +// +// Generated code + +struct table_cell : cucumber::message +{ + cucumber::messages::location location; + std::string value; + + std::string to_string() const override; +}; + +} diff --git a/cpp/include/cucumber/messages/table_row.hpp b/cpp/include/cucumber/messages/table_row.hpp new file mode 100644 index 00000000..3e0b3cb6 --- /dev/null +++ b/cpp/include/cucumber/messages/table_row.hpp @@ -0,0 +1,29 @@ +#pragma once + +#include + +#include + +#include +#include + +namespace cucumber::messages { + +// +// Represents the TableRow message in Cucumber's message protocol +// @see Github - Cucumber - Messages +// +// A row in a table +// +// Generated code + +struct table_row : cucumber::message +{ + cucumber::messages::location location; + std::vector cells; + std::string id; + + std::string to_string() const override; +}; + +} diff --git a/cpp/include/cucumber/messages/tag.hpp b/cpp/include/cucumber/messages/tag.hpp new file mode 100644 index 00000000..b5566a35 --- /dev/null +++ b/cpp/include/cucumber/messages/tag.hpp @@ -0,0 +1,28 @@ +#pragma once + +#include + +#include + +#include + +namespace cucumber::messages { + +// +// Represents the Tag message in Cucumber's message protocol +// @see Github - Cucumber - Messages +// +// A tag +// +// Generated code + +struct tag : cucumber::message +{ + cucumber::messages::location location; + std::string name; + std::string id; + + std::string to_string() const override; +}; + +} diff --git a/cpp/include/cucumber/messages/test_case.hpp b/cpp/include/cucumber/messages/test_case.hpp new file mode 100644 index 00000000..69ab921b --- /dev/null +++ b/cpp/include/cucumber/messages/test_case.hpp @@ -0,0 +1,30 @@ +#pragma once + +#include + +#include + +#include + +namespace cucumber::messages { + +// +// Represents the TestCase message in Cucumber's message protocol +// @see Github - Cucumber - Messages +// +// //// TestCases +// +// A `TestCase` contains a sequence of `TestStep`s. +// +// Generated code + +struct test_case : cucumber::message +{ + std::string id; + std::string pickle_id; + std::vector test_steps; + + std::string to_string() const override; +}; + +} diff --git a/cpp/include/cucumber/messages/test_case_finished.hpp b/cpp/include/cucumber/messages/test_case_finished.hpp new file mode 100644 index 00000000..ca474b55 --- /dev/null +++ b/cpp/include/cucumber/messages/test_case_finished.hpp @@ -0,0 +1,26 @@ +#pragma once + +#include + +#include + +#include + +namespace cucumber::messages { + +// +// Represents the TestCaseFinished message in Cucumber's message protocol +// @see Github - Cucumber - Messages +// +// Generated code + +struct test_case_finished : cucumber::message +{ + std::string test_case_started_id; + cucumber::messages::timestamp timestamp; + bool will_be_retried; + + std::string to_string() const override; +}; + +} diff --git a/cpp/include/cucumber/messages/test_case_started.hpp b/cpp/include/cucumber/messages/test_case_started.hpp new file mode 100644 index 00000000..5460a331 --- /dev/null +++ b/cpp/include/cucumber/messages/test_case_started.hpp @@ -0,0 +1,28 @@ +#pragma once + +#include + +#include + +#include + +namespace cucumber::messages { + +// +// Represents the TestCaseStarted message in Cucumber's message protocol +// @see Github - Cucumber - Messages +// +// Generated code + +struct test_case_started : cucumber::message +{ + std::size_t attempt; + std::string id; + std::string test_case_id; + std::string worker_id; + cucumber::messages::timestamp timestamp; + + std::string to_string() const override; +}; + +} diff --git a/cpp/include/cucumber/messages/test_run_finished.hpp b/cpp/include/cucumber/messages/test_run_finished.hpp new file mode 100644 index 00000000..f01b030d --- /dev/null +++ b/cpp/include/cucumber/messages/test_run_finished.hpp @@ -0,0 +1,28 @@ +#pragma once + +#include + +#include + +#include +#include + +namespace cucumber::messages { + +// +// Represents the TestRunFinished message in Cucumber's message protocol +// @see Github - Cucumber - Messages +// +// Generated code + +struct test_run_finished : cucumber::message +{ + std::string message; + bool success; + cucumber::messages::timestamp timestamp; + cucumber::messages::exception exception; + + std::string to_string() const override; +}; + +} diff --git a/cpp/include/cucumber/messages/test_run_started.hpp b/cpp/include/cucumber/messages/test_run_started.hpp new file mode 100644 index 00000000..9486ebc8 --- /dev/null +++ b/cpp/include/cucumber/messages/test_run_started.hpp @@ -0,0 +1,24 @@ +#pragma once + +#include + +#include + +#include + +namespace cucumber::messages { + +// +// Represents the TestRunStarted message in Cucumber's message protocol +// @see Github - Cucumber - Messages +// +// Generated code + +struct test_run_started : cucumber::message +{ + cucumber::messages::timestamp timestamp; + + std::string to_string() const override; +}; + +} diff --git a/cpp/include/cucumber/messages/test_step.hpp b/cpp/include/cucumber/messages/test_step.hpp new file mode 100644 index 00000000..2d03d250 --- /dev/null +++ b/cpp/include/cucumber/messages/test_step.hpp @@ -0,0 +1,31 @@ +#pragma once + +#include + +#include + +#include + +namespace cucumber::messages { + +// +// Represents the TestStep message in Cucumber's message protocol +// @see Github - Cucumber - Messages +// +// A `TestStep` is derived from either a `PickleStep` +// combined with a `StepDefinition`, or from a `Hook`. +// +// Generated code + +struct test_step : cucumber::message +{ + std::string hook_id; + std::string id; + std::string pickle_step_id; + std::vector step_definition_ids; + std::vector step_match_arguments_lists; + + std::string to_string() const override; +}; + +} diff --git a/cpp/include/cucumber/messages/test_step_finished.hpp b/cpp/include/cucumber/messages/test_step_finished.hpp new file mode 100644 index 00000000..e24cd929 --- /dev/null +++ b/cpp/include/cucumber/messages/test_step_finished.hpp @@ -0,0 +1,28 @@ +#pragma once + +#include + +#include + +#include +#include + +namespace cucumber::messages { + +// +// Represents the TestStepFinished message in Cucumber's message protocol +// @see Github - Cucumber - Messages +// +// Generated code + +struct test_step_finished : cucumber::message +{ + std::string test_case_started_id; + std::string test_step_id; + cucumber::messages::test_step_result test_step_result; + cucumber::messages::timestamp timestamp; + + std::string to_string() const override; +}; + +} diff --git a/cpp/include/cucumber/messages/test_step_result.hpp b/cpp/include/cucumber/messages/test_step_result.hpp new file mode 100644 index 00000000..de5bbe5e --- /dev/null +++ b/cpp/include/cucumber/messages/test_step_result.hpp @@ -0,0 +1,29 @@ +#pragma once + +#include + +#include + +#include +#include +#include + +namespace cucumber::messages { + +// +// Represents the TestStepResult message in Cucumber's message protocol +// @see Github - Cucumber - Messages +// +// Generated code + +struct test_step_result : cucumber::message +{ + cucumber::messages::duration duration; + std::string message; + cucumber::messages::test_step_result_status status; + cucumber::messages::exception exception; + + std::string to_string() const override; +}; + +} diff --git a/cpp/include/cucumber/messages/test_step_result_status.hpp b/cpp/include/cucumber/messages/test_step_result_status.hpp new file mode 100644 index 00000000..ee92d219 --- /dev/null +++ b/cpp/include/cucumber/messages/test_step_result_status.hpp @@ -0,0 +1,24 @@ +#pragma once + +#include + +namespace cucumber::messages { + +enum class test_step_result_status +{ + UNKNOWN, + PASSED, + SKIPPED, + PENDING, + UNDEFINED, + AMBIGUOUS, + FAILED +}; + +std::string_view +to_string(test_step_result_status v); + +std::ostream& +operator<<(std::ostream& os, test_step_result_status v); + +} diff --git a/cpp/include/cucumber/messages/test_step_started.hpp b/cpp/include/cucumber/messages/test_step_started.hpp new file mode 100644 index 00000000..714cf9a7 --- /dev/null +++ b/cpp/include/cucumber/messages/test_step_started.hpp @@ -0,0 +1,26 @@ +#pragma once + +#include + +#include + +#include + +namespace cucumber::messages { + +// +// Represents the TestStepStarted message in Cucumber's message protocol +// @see Github - Cucumber - Messages +// +// Generated code + +struct test_step_started : cucumber::message +{ + std::string test_case_started_id; + std::string test_step_id; + cucumber::messages::timestamp timestamp; + + std::string to_string() const override; +}; + +} diff --git a/cpp/include/cucumber/messages/timestamp.hpp b/cpp/include/cucumber/messages/timestamp.hpp new file mode 100644 index 00000000..e7a7d87b --- /dev/null +++ b/cpp/include/cucumber/messages/timestamp.hpp @@ -0,0 +1,23 @@ +#pragma once + +#include + +#include + +namespace cucumber::messages { + +// +// Represents the Timestamp message in Cucumber's message protocol +// @see Github - Cucumber - Messages +// +// Generated code + +struct timestamp : cucumber::message +{ + std::size_t seconds; + std::size_t nanos; + + std::string to_string() const override; +}; + +} diff --git a/cpp/include/cucumber/messages/undefined_parameter_type.hpp b/cpp/include/cucumber/messages/undefined_parameter_type.hpp new file mode 100644 index 00000000..91d5378c --- /dev/null +++ b/cpp/include/cucumber/messages/undefined_parameter_type.hpp @@ -0,0 +1,23 @@ +#pragma once + +#include + +#include + +namespace cucumber::messages { + +// +// Represents the UndefinedParameterType message in Cucumber's message protocol +// @see Github - Cucumber - Messages +// +// Generated code + +struct undefined_parameter_type : cucumber::message +{ + std::string expression; + std::string name; + + std::string to_string() const override; +}; + +} diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/attachment.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/attachment.cpp new file mode 100644 index 00000000..ca746bcd --- /dev/null +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/attachment.cpp @@ -0,0 +1,27 @@ +#include + +#include +#include + +namespace cucumber::messages { + +std::string +attachment::to_string() const +{ + std::ostringstream oss; + + oss + << "body=" << body + << ", content_encoding=" << content_encoding + << ", file_name=" << file_name + << ", media_type=" << media_type + << ", source=" << source + << ", test_case_started_id=" << test_case_started_id + << ", test_step_id=" << test_step_id + << ", url=" << url + ; + + return oss.str(); +} + +} diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/attachment_content_encoding.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/attachment_content_encoding.cpp new file mode 100644 index 00000000..9a0e272c --- /dev/null +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/attachment_content_encoding.cpp @@ -0,0 +1,28 @@ +#include + +#include + +namespace cucumber::messages { + +std::string_view +to_string(attachment_content_encoding v) +{ + using map_type = std::unordered_map; + + static const map_type m = { + { IDENTITY, "IDENTITY" }, + { BASE64, "BASE64" } + }; + + return m.at(v); +} + +std::ostream& +operator<<(std::ostream& os, attachment_content_encoding v) +{ + os << to_string(v); + + return os; +} + +} diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/background.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/background.cpp new file mode 100644 index 00000000..0bb90e65 --- /dev/null +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/background.cpp @@ -0,0 +1,25 @@ +#include + +#include +#include + +namespace cucumber::messages { + +std::string +background::to_string() const +{ + std::ostringstream oss; + + oss + << "location=" << location + << ", keyword=" << keyword + << ", name=" << name + << ", description=" << description + << ", steps=" << steps + << ", id=" << id + ; + + return oss.str(); +} + +} diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/ci.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/ci.cpp new file mode 100644 index 00000000..5e1f2d89 --- /dev/null +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/ci.cpp @@ -0,0 +1,23 @@ +#include + +#include +#include + +namespace cucumber::messages { + +std::string +ci::to_string() const +{ + std::ostringstream oss; + + oss + << "name=" << name + << ", url=" << url + << ", build_number=" << build_number + << ", git=" << git + ; + + return oss.str(); +} + +} diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/comment.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/comment.cpp new file mode 100644 index 00000000..b4d6db2d --- /dev/null +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/comment.cpp @@ -0,0 +1,21 @@ +#include + +#include +#include + +namespace cucumber::messages { + +std::string +comment::to_string() const +{ + std::ostringstream oss; + + oss + << "location=" << location + << ", text=" << text + ; + + return oss.str(); +} + +} diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/data_table.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/data_table.cpp new file mode 100644 index 00000000..5d8c947d --- /dev/null +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/data_table.cpp @@ -0,0 +1,21 @@ +#include + +#include +#include + +namespace cucumber::messages { + +std::string +data_table::to_string() const +{ + std::ostringstream oss; + + oss + << "location=" << location + << ", rows=" << rows + ; + + return oss.str(); +} + +} diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/doc_string.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/doc_string.cpp new file mode 100644 index 00000000..c60de5ec --- /dev/null +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/doc_string.cpp @@ -0,0 +1,23 @@ +#include + +#include +#include + +namespace cucumber::messages { + +std::string +doc_string::to_string() const +{ + std::ostringstream oss; + + oss + << "location=" << location + << ", media_type=" << media_type + << ", content=" << content + << ", delimiter=" << delimiter + ; + + return oss.str(); +} + +} diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/duration.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/duration.cpp new file mode 100644 index 00000000..067a21e3 --- /dev/null +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/duration.cpp @@ -0,0 +1,21 @@ +#include + +#include +#include + +namespace cucumber::messages { + +std::string +duration::to_string() const +{ + std::ostringstream oss; + + oss + << "seconds=" << seconds + << ", nanos=" << nanos + ; + + return oss.str(); +} + +} diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/envelope.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/envelope.cpp new file mode 100644 index 00000000..9706f5a0 --- /dev/null +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/envelope.cpp @@ -0,0 +1,36 @@ +#include + +#include +#include + +namespace cucumber::messages { + +std::string +envelope::to_string() const +{ + std::ostringstream oss; + + oss + << "attachment=" << attachment + << ", gherkin_document=" << gherkin_document + << ", hook=" << hook + << ", meta=" << meta + << ", parameter_type=" << parameter_type + << ", parse_error=" << parse_error + << ", pickle=" << pickle + << ", source=" << source + << ", step_definition=" << step_definition + << ", test_case=" << test_case + << ", test_case_finished=" << test_case_finished + << ", test_case_started=" << test_case_started + << ", test_run_finished=" << test_run_finished + << ", test_run_started=" << test_run_started + << ", test_step_finished=" << test_step_finished + << ", test_step_started=" << test_step_started + << ", undefined_parameter_type=" << undefined_parameter_type + ; + + return oss.str(); +} + +} diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/examples.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/examples.cpp new file mode 100644 index 00000000..5d3e39eb --- /dev/null +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/examples.cpp @@ -0,0 +1,27 @@ +#include + +#include +#include + +namespace cucumber::messages { + +std::string +examples::to_string() const +{ + std::ostringstream oss; + + oss + << "location=" << location + << ", tags=" << tags + << ", keyword=" << keyword + << ", name=" << name + << ", description=" << description + << ", table_header=" << table_header + << ", table_body=" << table_body + << ", id=" << id + ; + + return oss.str(); +} + +} diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/exception.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/exception.cpp new file mode 100644 index 00000000..39342acf --- /dev/null +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/exception.cpp @@ -0,0 +1,21 @@ +#include + +#include +#include + +namespace cucumber::messages { + +std::string +exception::to_string() const +{ + std::ostringstream oss; + + oss + << "type=" << type + << ", message=" << message + ; + + return oss.str(); +} + +} diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/feature.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/feature.cpp new file mode 100644 index 00000000..d01b402e --- /dev/null +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/feature.cpp @@ -0,0 +1,26 @@ +#include + +#include +#include + +namespace cucumber::messages { + +std::string +feature::to_string() const +{ + std::ostringstream oss; + + oss + << "location=" << location + << ", tags=" << tags + << ", language=" << language + << ", keyword=" << keyword + << ", name=" << name + << ", description=" << description + << ", children=" << children + ; + + return oss.str(); +} + +} diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/feature_child.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/feature_child.cpp new file mode 100644 index 00000000..89b06794 --- /dev/null +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/feature_child.cpp @@ -0,0 +1,22 @@ +#include + +#include +#include + +namespace cucumber::messages { + +std::string +feature_child::to_string() const +{ + std::ostringstream oss; + + oss + << "rule=" << rule + << ", background=" << background + << ", scenario=" << scenario + ; + + return oss.str(); +} + +} diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/gherkin_document.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/gherkin_document.cpp new file mode 100644 index 00000000..989d604b --- /dev/null +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/gherkin_document.cpp @@ -0,0 +1,22 @@ +#include + +#include +#include + +namespace cucumber::messages { + +std::string +gherkin_document::to_string() const +{ + std::ostringstream oss; + + oss + << "uri=" << uri + << ", feature=" << feature + << ", comments=" << comments + ; + + return oss.str(); +} + +} diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/git.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/git.cpp new file mode 100644 index 00000000..2ee1a0a6 --- /dev/null +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/git.cpp @@ -0,0 +1,23 @@ +#include + +#include +#include + +namespace cucumber::messages { + +std::string +git::to_string() const +{ + std::ostringstream oss; + + oss + << "remote=" << remote + << ", revision=" << revision + << ", branch=" << branch + << ", tag=" << tag + ; + + return oss.str(); +} + +} diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/group.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/group.cpp new file mode 100644 index 00000000..526c259c --- /dev/null +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/group.cpp @@ -0,0 +1,22 @@ +#include + +#include +#include + +namespace cucumber::messages { + +std::string +group::to_string() const +{ + std::ostringstream oss; + + oss + << "children=" << children + << ", start=" << start + << ", value=" << value + ; + + return oss.str(); +} + +} diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/hook.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/hook.cpp new file mode 100644 index 00000000..45301cc6 --- /dev/null +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/hook.cpp @@ -0,0 +1,23 @@ +#include + +#include +#include + +namespace cucumber::messages { + +std::string +hook::to_string() const +{ + std::ostringstream oss; + + oss + << "id=" << id + << ", name=" << name + << ", source_reference=" << source_reference + << ", tag_expression=" << tag_expression + ; + + return oss.str(); +} + +} diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/java_method.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/java_method.cpp new file mode 100644 index 00000000..2747d576 --- /dev/null +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/java_method.cpp @@ -0,0 +1,22 @@ +#include + +#include +#include + +namespace cucumber::messages { + +std::string +java_method::to_string() const +{ + std::ostringstream oss; + + oss + << "class_name=" << class_name + << ", method_name=" << method_name + << ", method_parameter_types=" << cucumber::to_string(method_parameter_types) + ; + + return oss.str(); +} + +} diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/java_stack_trace_element.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/java_stack_trace_element.cpp new file mode 100644 index 00000000..d0068de2 --- /dev/null +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/java_stack_trace_element.cpp @@ -0,0 +1,22 @@ +#include + +#include +#include + +namespace cucumber::messages { + +std::string +java_stack_trace_element::to_string() const +{ + std::ostringstream oss; + + oss + << "class_name=" << class_name + << ", file_name=" << file_name + << ", method_name=" << method_name + ; + + return oss.str(); +} + +} diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/location.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/location.cpp new file mode 100644 index 00000000..d9c71b91 --- /dev/null +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/location.cpp @@ -0,0 +1,21 @@ +#include + +#include +#include + +namespace cucumber::messages { + +std::string +location::to_string() const +{ + std::ostringstream oss; + + oss + << "line=" << line + << ", column=" << column + ; + + return oss.str(); +} + +} diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/meta.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/meta.cpp new file mode 100644 index 00000000..278a8080 --- /dev/null +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/meta.cpp @@ -0,0 +1,25 @@ +#include + +#include +#include + +namespace cucumber::messages { + +std::string +meta::to_string() const +{ + std::ostringstream oss; + + oss + << "protocol_version=" << protocol_version + << ", implementation=" << implementation + << ", runtime=" << runtime + << ", os=" << os + << ", cpu=" << cpu + << ", ci=" << ci + ; + + return oss.str(); +} + +} diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/parameter_type.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/parameter_type.cpp new file mode 100644 index 00000000..431f2198 --- /dev/null +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/parameter_type.cpp @@ -0,0 +1,25 @@ +#include + +#include +#include + +namespace cucumber::messages { + +std::string +parameter_type::to_string() const +{ + std::ostringstream oss; + + oss + << "name=" << name + << ", regular_expressions=" << cucumber::to_string(regular_expressions) + << ", prefer_for_regular_expression_match=" << prefer_for_regular_expression_match + << ", use_for_snippets=" << use_for_snippets + << ", id=" << id + << ", source_reference=" << source_reference + ; + + return oss.str(); +} + +} diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/parse_error.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/parse_error.cpp new file mode 100644 index 00000000..dd64e842 --- /dev/null +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/parse_error.cpp @@ -0,0 +1,21 @@ +#include + +#include +#include + +namespace cucumber::messages { + +std::string +parse_error::to_string() const +{ + std::ostringstream oss; + + oss + << "source=" << source + << ", message=" << message + ; + + return oss.str(); +} + +} diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/pickle.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/pickle.cpp new file mode 100644 index 00000000..c3bc1f78 --- /dev/null +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/pickle.cpp @@ -0,0 +1,26 @@ +#include + +#include +#include + +namespace cucumber::messages { + +std::string +pickle::to_string() const +{ + std::ostringstream oss; + + oss + << "id=" << id + << ", uri=" << uri + << ", name=" << name + << ", language=" << language + << ", steps=" << steps + << ", tags=" << tags + << ", ast_node_ids=" << cucumber::to_string(ast_node_ids) + ; + + return oss.str(); +} + +} diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/pickle_doc_string.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/pickle_doc_string.cpp new file mode 100644 index 00000000..7c3e2078 --- /dev/null +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/pickle_doc_string.cpp @@ -0,0 +1,21 @@ +#include + +#include +#include + +namespace cucumber::messages { + +std::string +pickle_doc_string::to_string() const +{ + std::ostringstream oss; + + oss + << "media_type=" << media_type + << ", content=" << content + ; + + return oss.str(); +} + +} diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/pickle_step.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/pickle_step.cpp new file mode 100644 index 00000000..8574a6dc --- /dev/null +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/pickle_step.cpp @@ -0,0 +1,24 @@ +#include + +#include +#include + +namespace cucumber::messages { + +std::string +pickle_step::to_string() const +{ + std::ostringstream oss; + + oss + << "argument=" << argument + << ", ast_node_ids=" << cucumber::to_string(ast_node_ids) + << ", id=" << id + << ", type=" << type + << ", text=" << text + ; + + return oss.str(); +} + +} diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/pickle_step_argument.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/pickle_step_argument.cpp new file mode 100644 index 00000000..a1424ca3 --- /dev/null +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/pickle_step_argument.cpp @@ -0,0 +1,21 @@ +#include + +#include +#include + +namespace cucumber::messages { + +std::string +pickle_step_argument::to_string() const +{ + std::ostringstream oss; + + oss + << "doc_string=" << doc_string + << ", data_table=" << data_table + ; + + return oss.str(); +} + +} diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/pickle_step_type.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/pickle_step_type.cpp new file mode 100644 index 00000000..9e8d1d7a --- /dev/null +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/pickle_step_type.cpp @@ -0,0 +1,30 @@ +#include + +#include + +namespace cucumber::messages { + +std::string_view +to_string(pickle_step_type v) +{ + using map_type = std::unordered_map; + + static const map_type m = { + { UNKNOWN, "Unknown" }, + { CONTEXT, "Context" }, + { ACTION, "Action" }, + { OUTCOME, "Outcome" } + }; + + return m.at(v); +} + +std::ostream& +operator<<(std::ostream& os, pickle_step_type v) +{ + os << to_string(v); + + return os; +} + +} diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/pickle_table.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/pickle_table.cpp new file mode 100644 index 00000000..800d491a --- /dev/null +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/pickle_table.cpp @@ -0,0 +1,20 @@ +#include + +#include +#include + +namespace cucumber::messages { + +std::string +pickle_table::to_string() const +{ + std::ostringstream oss; + + oss + << "rows=" << rows + ; + + return oss.str(); +} + +} diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/pickle_table_cell.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/pickle_table_cell.cpp new file mode 100644 index 00000000..adbd5f62 --- /dev/null +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/pickle_table_cell.cpp @@ -0,0 +1,20 @@ +#include + +#include +#include + +namespace cucumber::messages { + +std::string +pickle_table_cell::to_string() const +{ + std::ostringstream oss; + + oss + << "value=" << value + ; + + return oss.str(); +} + +} diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/pickle_table_row.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/pickle_table_row.cpp new file mode 100644 index 00000000..b14fc5ef --- /dev/null +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/pickle_table_row.cpp @@ -0,0 +1,20 @@ +#include + +#include +#include + +namespace cucumber::messages { + +std::string +pickle_table_row::to_string() const +{ + std::ostringstream oss; + + oss + << "cells=" << cells + ; + + return oss.str(); +} + +} diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/pickle_tag.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/pickle_tag.cpp new file mode 100644 index 00000000..36ea011c --- /dev/null +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/pickle_tag.cpp @@ -0,0 +1,21 @@ +#include + +#include +#include + +namespace cucumber::messages { + +std::string +pickle_tag::to_string() const +{ + std::ostringstream oss; + + oss + << "name=" << name + << ", ast_node_id=" << ast_node_id + ; + + return oss.str(); +} + +} diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/product.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/product.cpp new file mode 100644 index 00000000..22a72dbf --- /dev/null +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/product.cpp @@ -0,0 +1,21 @@ +#include + +#include +#include + +namespace cucumber::messages { + +std::string +product::to_string() const +{ + std::ostringstream oss; + + oss + << "name=" << name + << ", version=" << version + ; + + return oss.str(); +} + +} diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/rule.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/rule.cpp new file mode 100644 index 00000000..aa3a92af --- /dev/null +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/rule.cpp @@ -0,0 +1,26 @@ +#include + +#include +#include + +namespace cucumber::messages { + +std::string +rule::to_string() const +{ + std::ostringstream oss; + + oss + << "location=" << location + << ", tags=" << tags + << ", keyword=" << keyword + << ", name=" << name + << ", description=" << description + << ", children=" << children + << ", id=" << id + ; + + return oss.str(); +} + +} diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/rule_child.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/rule_child.cpp new file mode 100644 index 00000000..3cc22a7d --- /dev/null +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/rule_child.cpp @@ -0,0 +1,21 @@ +#include + +#include +#include + +namespace cucumber::messages { + +std::string +rule_child::to_string() const +{ + std::ostringstream oss; + + oss + << "background=" << background + << ", scenario=" << scenario + ; + + return oss.str(); +} + +} diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/scenario.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/scenario.cpp new file mode 100644 index 00000000..136bb400 --- /dev/null +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/scenario.cpp @@ -0,0 +1,27 @@ +#include + +#include +#include + +namespace cucumber::messages { + +std::string +scenario::to_string() const +{ + std::ostringstream oss; + + oss + << "location=" << location + << ", tags=" << tags + << ", keyword=" << keyword + << ", name=" << name + << ", description=" << description + << ", steps=" << steps + << ", examples=" << examples + << ", id=" << id + ; + + return oss.str(); +} + +} diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/source.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/source.cpp new file mode 100644 index 00000000..8e70138f --- /dev/null +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/source.cpp @@ -0,0 +1,22 @@ +#include + +#include +#include + +namespace cucumber::messages { + +std::string +source::to_string() const +{ + std::ostringstream oss; + + oss + << "uri=" << uri + << ", data=" << data + << ", media_type=" << media_type + ; + + return oss.str(); +} + +} diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/source_media_type.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/source_media_type.cpp new file mode 100644 index 00000000..35439aa4 --- /dev/null +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/source_media_type.cpp @@ -0,0 +1,28 @@ +#include + +#include + +namespace cucumber::messages { + +std::string_view +to_string(source_media_type v) +{ + using map_type = std::unordered_map; + + static const map_type m = { + { TEXT_X_CUCUMBER_GHERKIN_PLAIN, "text/x.cucumber.gherkin+plain" }, + { TEXT_X_CUCUMBER_GHERKIN_MARKDOWN, "text/x.cucumber.gherkin+markdown" } + }; + + return m.at(v); +} + +std::ostream& +operator<<(std::ostream& os, source_media_type v) +{ + os << to_string(v); + + return os; +} + +} diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/source_reference.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/source_reference.cpp new file mode 100644 index 00000000..0ac31ffe --- /dev/null +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/source_reference.cpp @@ -0,0 +1,23 @@ +#include + +#include +#include + +namespace cucumber::messages { + +std::string +source_reference::to_string() const +{ + std::ostringstream oss; + + oss + << "uri=" << uri + << ", java_method=" << java_method + << ", java_stack_trace_element=" << java_stack_trace_element + << ", location=" << location + ; + + return oss.str(); +} + +} diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/step.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/step.cpp new file mode 100644 index 00000000..50775f3c --- /dev/null +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/step.cpp @@ -0,0 +1,26 @@ +#include + +#include +#include + +namespace cucumber::messages { + +std::string +step::to_string() const +{ + std::ostringstream oss; + + oss + << "location=" << location + << ", keyword=" << keyword + << ", keyword_type=" << keyword_type + << ", text=" << text + << ", doc_string=" << doc_string + << ", data_table=" << data_table + << ", id=" << id + ; + + return oss.str(); +} + +} diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/step_definition.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/step_definition.cpp new file mode 100644 index 00000000..2808a70f --- /dev/null +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/step_definition.cpp @@ -0,0 +1,22 @@ +#include + +#include +#include + +namespace cucumber::messages { + +std::string +step_definition::to_string() const +{ + std::ostringstream oss; + + oss + << "id=" << id + << ", pattern=" << pattern + << ", source_reference=" << source_reference + ; + + return oss.str(); +} + +} diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/step_definition_pattern.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/step_definition_pattern.cpp new file mode 100644 index 00000000..7d2572ff --- /dev/null +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/step_definition_pattern.cpp @@ -0,0 +1,21 @@ +#include + +#include +#include + +namespace cucumber::messages { + +std::string +step_definition_pattern::to_string() const +{ + std::ostringstream oss; + + oss + << "source=" << source + << ", type=" << type + ; + + return oss.str(); +} + +} diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/step_definition_pattern_type.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/step_definition_pattern_type.cpp new file mode 100644 index 00000000..c67ddf35 --- /dev/null +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/step_definition_pattern_type.cpp @@ -0,0 +1,28 @@ +#include + +#include + +namespace cucumber::messages { + +std::string_view +to_string(step_definition_pattern_type v) +{ + using map_type = std::unordered_map; + + static const map_type m = { + { CUCUMBER_EXPRESSION, "CUCUMBER_EXPRESSION" }, + { REGULAR_EXPRESSION, "REGULAR_EXPRESSION" } + }; + + return m.at(v); +} + +std::ostream& +operator<<(std::ostream& os, step_definition_pattern_type v) +{ + os << to_string(v); + + return os; +} + +} diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/step_keyword_type.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/step_keyword_type.cpp new file mode 100644 index 00000000..6d82d017 --- /dev/null +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/step_keyword_type.cpp @@ -0,0 +1,31 @@ +#include + +#include + +namespace cucumber::messages { + +std::string_view +to_string(step_keyword_type v) +{ + using map_type = std::unordered_map; + + static const map_type m = { + { UNKNOWN, "Unknown" }, + { CONTEXT, "Context" }, + { ACTION, "Action" }, + { OUTCOME, "Outcome" }, + { CONJUNCTION, "Conjunction" } + }; + + return m.at(v); +} + +std::ostream& +operator<<(std::ostream& os, step_keyword_type v) +{ + os << to_string(v); + + return os; +} + +} diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/step_match_argument.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/step_match_argument.cpp new file mode 100644 index 00000000..3909c47f --- /dev/null +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/step_match_argument.cpp @@ -0,0 +1,21 @@ +#include + +#include +#include + +namespace cucumber::messages { + +std::string +step_match_argument::to_string() const +{ + std::ostringstream oss; + + oss + << "group=" << group + << ", parameter_type_name=" << parameter_type_name + ; + + return oss.str(); +} + +} diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/step_match_arguments_list.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/step_match_arguments_list.cpp new file mode 100644 index 00000000..0d35a6e5 --- /dev/null +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/step_match_arguments_list.cpp @@ -0,0 +1,20 @@ +#include + +#include +#include + +namespace cucumber::messages { + +std::string +step_match_arguments_list::to_string() const +{ + std::ostringstream oss; + + oss + << "step_match_arguments=" << step_match_arguments + ; + + return oss.str(); +} + +} diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/table_cell.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/table_cell.cpp new file mode 100644 index 00000000..c2024bf5 --- /dev/null +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/table_cell.cpp @@ -0,0 +1,21 @@ +#include + +#include +#include + +namespace cucumber::messages { + +std::string +table_cell::to_string() const +{ + std::ostringstream oss; + + oss + << "location=" << location + << ", value=" << value + ; + + return oss.str(); +} + +} diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/table_row.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/table_row.cpp new file mode 100644 index 00000000..8b94c892 --- /dev/null +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/table_row.cpp @@ -0,0 +1,22 @@ +#include + +#include +#include + +namespace cucumber::messages { + +std::string +table_row::to_string() const +{ + std::ostringstream oss; + + oss + << "location=" << location + << ", cells=" << cells + << ", id=" << id + ; + + return oss.str(); +} + +} diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/tag.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/tag.cpp new file mode 100644 index 00000000..b6e01815 --- /dev/null +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/tag.cpp @@ -0,0 +1,22 @@ +#include + +#include +#include + +namespace cucumber::messages { + +std::string +tag::to_string() const +{ + std::ostringstream oss; + + oss + << "location=" << location + << ", name=" << name + << ", id=" << id + ; + + return oss.str(); +} + +} diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/test_case.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/test_case.cpp new file mode 100644 index 00000000..a428c35f --- /dev/null +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/test_case.cpp @@ -0,0 +1,22 @@ +#include + +#include +#include + +namespace cucumber::messages { + +std::string +test_case::to_string() const +{ + std::ostringstream oss; + + oss + << "id=" << id + << ", pickle_id=" << pickle_id + << ", test_steps=" << test_steps + ; + + return oss.str(); +} + +} diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/test_case_finished.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/test_case_finished.cpp new file mode 100644 index 00000000..5ee68d28 --- /dev/null +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/test_case_finished.cpp @@ -0,0 +1,22 @@ +#include + +#include +#include + +namespace cucumber::messages { + +std::string +test_case_finished::to_string() const +{ + std::ostringstream oss; + + oss + << "test_case_started_id=" << test_case_started_id + << ", timestamp=" << timestamp + << ", will_be_retried=" << will_be_retried + ; + + return oss.str(); +} + +} diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/test_case_started.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/test_case_started.cpp new file mode 100644 index 00000000..d13bce77 --- /dev/null +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/test_case_started.cpp @@ -0,0 +1,24 @@ +#include + +#include +#include + +namespace cucumber::messages { + +std::string +test_case_started::to_string() const +{ + std::ostringstream oss; + + oss + << "attempt=" << attempt + << ", id=" << id + << ", test_case_id=" << test_case_id + << ", worker_id=" << worker_id + << ", timestamp=" << timestamp + ; + + return oss.str(); +} + +} diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/test_run_finished.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/test_run_finished.cpp new file mode 100644 index 00000000..186e8b69 --- /dev/null +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/test_run_finished.cpp @@ -0,0 +1,23 @@ +#include + +#include +#include + +namespace cucumber::messages { + +std::string +test_run_finished::to_string() const +{ + std::ostringstream oss; + + oss + << "message=" << message + << ", success=" << success + << ", timestamp=" << timestamp + << ", exception=" << exception + ; + + return oss.str(); +} + +} diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/test_run_started.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/test_run_started.cpp new file mode 100644 index 00000000..e0f81b1b --- /dev/null +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/test_run_started.cpp @@ -0,0 +1,20 @@ +#include + +#include +#include + +namespace cucumber::messages { + +std::string +test_run_started::to_string() const +{ + std::ostringstream oss; + + oss + << "timestamp=" << timestamp + ; + + return oss.str(); +} + +} diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/test_step.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/test_step.cpp new file mode 100644 index 00000000..44bb9be0 --- /dev/null +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/test_step.cpp @@ -0,0 +1,24 @@ +#include + +#include +#include + +namespace cucumber::messages { + +std::string +test_step::to_string() const +{ + std::ostringstream oss; + + oss + << "hook_id=" << hook_id + << ", id=" << id + << ", pickle_step_id=" << pickle_step_id + << ", step_definition_ids=" << cucumber::to_string(step_definition_ids) + << ", step_match_arguments_lists=" << step_match_arguments_lists + ; + + return oss.str(); +} + +} diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/test_step_finished.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/test_step_finished.cpp new file mode 100644 index 00000000..df391d1d --- /dev/null +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/test_step_finished.cpp @@ -0,0 +1,23 @@ +#include + +#include +#include + +namespace cucumber::messages { + +std::string +test_step_finished::to_string() const +{ + std::ostringstream oss; + + oss + << "test_case_started_id=" << test_case_started_id + << ", test_step_id=" << test_step_id + << ", test_step_result=" << test_step_result + << ", timestamp=" << timestamp + ; + + return oss.str(); +} + +} diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/test_step_result.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/test_step_result.cpp new file mode 100644 index 00000000..5a0b8240 --- /dev/null +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/test_step_result.cpp @@ -0,0 +1,23 @@ +#include + +#include +#include + +namespace cucumber::messages { + +std::string +test_step_result::to_string() const +{ + std::ostringstream oss; + + oss + << "duration=" << duration + << ", message=" << message + << ", status=" << status + << ", exception=" << exception + ; + + return oss.str(); +} + +} diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/test_step_result_status.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/test_step_result_status.cpp new file mode 100644 index 00000000..620abbbf --- /dev/null +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/test_step_result_status.cpp @@ -0,0 +1,33 @@ +#include + +#include + +namespace cucumber::messages { + +std::string_view +to_string(test_step_result_status v) +{ + using map_type = std::unordered_map; + + static const map_type m = { + { UNKNOWN, "UNKNOWN" }, + { PASSED, "PASSED" }, + { SKIPPED, "SKIPPED" }, + { PENDING, "PENDING" }, + { UNDEFINED, "UNDEFINED" }, + { AMBIGUOUS, "AMBIGUOUS" }, + { FAILED, "FAILED" } + }; + + return m.at(v); +} + +std::ostream& +operator<<(std::ostream& os, test_step_result_status v) +{ + os << to_string(v); + + return os; +} + +} \ No newline at end of file diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/test_step_started.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/test_step_started.cpp new file mode 100644 index 00000000..ffb6dba2 --- /dev/null +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/test_step_started.cpp @@ -0,0 +1,22 @@ +#include + +#include +#include + +namespace cucumber::messages { + +std::string +test_step_started::to_string() const +{ + std::ostringstream oss; + + oss + << "test_case_started_id=" << test_case_started_id + << ", test_step_id=" << test_step_id + << ", timestamp=" << timestamp + ; + + return oss.str(); +} + +} diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/timestamp.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/timestamp.cpp new file mode 100644 index 00000000..bb34cf87 --- /dev/null +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/timestamp.cpp @@ -0,0 +1,21 @@ +#include + +#include +#include + +namespace cucumber::messages { + +std::string +timestamp::to_string() const +{ + std::ostringstream oss; + + oss + << "seconds=" << seconds + << ", nanos=" << nanos + ; + + return oss.str(); +} + +} diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/undefined_parameter_type.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/undefined_parameter_type.cpp new file mode 100644 index 00000000..d88f1a62 --- /dev/null +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/undefined_parameter_type.cpp @@ -0,0 +1,21 @@ +#include + +#include +#include + +namespace cucumber::messages { + +std::string +undefined_parameter_type::to_string() const +{ + std::ostringstream oss; + + oss + << "expression=" << expression + << ", name=" << name + ; + + return oss.str(); +} + +} From dec222d0f805166921a810e8717ae2a4c8dfa60d Mon Sep 17 00:00:00 2001 From: Remy Chibois Date: Fri, 5 May 2023 17:19:24 +0200 Subject: [PATCH 05/26] chore: missing include --- cpp/include/cucumber/message.hpp | 1 + 1 file changed, 1 insertion(+) diff --git a/cpp/include/cucumber/message.hpp b/cpp/include/cucumber/message.hpp index a415a4e0..006b147f 100644 --- a/cpp/include/cucumber/message.hpp +++ b/cpp/include/cucumber/message.hpp @@ -2,6 +2,7 @@ #include #include +#include namespace cucumber { From 8c5f789afa94b38fcd7357a66e313624362cac5f Mon Sep 17 00:00:00 2001 From: Remy Chibois Date: Fri, 5 May 2023 17:23:15 +0200 Subject: [PATCH 06/26] chore: missing include --- cpp/include/cucumber/message.hpp | 1 + 1 file changed, 1 insertion(+) diff --git a/cpp/include/cucumber/message.hpp b/cpp/include/cucumber/message.hpp index 006b147f..c775e578 100644 --- a/cpp/include/cucumber/message.hpp +++ b/cpp/include/cucumber/message.hpp @@ -3,6 +3,7 @@ #include #include #include +#include namespace cucumber { From 6a204969c71b23ac119abdf9a16ec079c1f9324b Mon Sep 17 00:00:00 2001 From: Remy Chibois Date: Fri, 5 May 2023 18:25:16 +0200 Subject: [PATCH 07/26] chore: de-virtualized messages, cleaned CMakeLists --- cpp/include/cucumber/message.hpp | 2 +- cpp/include/cucumber/messages/attachment.hpp | 2 +- cpp/include/cucumber/messages/background.hpp | 2 +- cpp/include/cucumber/messages/ci.hpp | 2 +- cpp/include/cucumber/messages/comment.hpp | 2 +- cpp/include/cucumber/messages/data_table.hpp | 2 +- cpp/include/cucumber/messages/doc_string.hpp | 2 +- cpp/include/cucumber/messages/duration.hpp | 2 +- cpp/include/cucumber/messages/envelope.hpp | 2 +- cpp/include/cucumber/messages/examples.hpp | 2 +- cpp/include/cucumber/messages/exception.hpp | 2 +- cpp/include/cucumber/messages/feature.hpp | 2 +- .../cucumber/messages/feature_child.hpp | 2 +- .../cucumber/messages/gherkin_document.hpp | 2 +- cpp/include/cucumber/messages/git.hpp | 2 +- cpp/include/cucumber/messages/group.hpp | 2 +- cpp/include/cucumber/messages/hook.hpp | 2 +- cpp/include/cucumber/messages/java_method.hpp | 2 +- .../messages/java_stack_trace_element.hpp | 2 +- cpp/include/cucumber/messages/location.hpp | 2 +- cpp/include/cucumber/messages/meta.hpp | 2 +- .../cucumber/messages/parameter_type.hpp | 2 +- cpp/include/cucumber/messages/parse_error.hpp | 2 +- cpp/include/cucumber/messages/pickle.hpp | 2 +- .../cucumber/messages/pickle_doc_string.hpp | 2 +- cpp/include/cucumber/messages/pickle_step.hpp | 2 +- .../messages/pickle_step_argument.hpp | 2 +- .../cucumber/messages/pickle_table.hpp | 2 +- .../cucumber/messages/pickle_table_cell.hpp | 2 +- .../cucumber/messages/pickle_table_row.hpp | 2 +- cpp/include/cucumber/messages/pickle_tag.hpp | 2 +- cpp/include/cucumber/messages/product.hpp | 2 +- cpp/include/cucumber/messages/rule.hpp | 2 +- cpp/include/cucumber/messages/rule_child.hpp | 2 +- cpp/include/cucumber/messages/scenario.hpp | 2 +- cpp/include/cucumber/messages/source.hpp | 2 +- .../cucumber/messages/source_reference.hpp | 2 +- cpp/include/cucumber/messages/step.hpp | 2 +- .../cucumber/messages/step_definition.hpp | 2 +- .../messages/step_definition_pattern.hpp | 2 +- .../cucumber/messages/step_match_argument.hpp | 2 +- .../messages/step_match_arguments_list.hpp | 2 +- cpp/include/cucumber/messages/table_cell.hpp | 2 +- cpp/include/cucumber/messages/table_row.hpp | 2 +- cpp/include/cucumber/messages/tag.hpp | 2 +- cpp/include/cucumber/messages/test_case.hpp | 2 +- .../cucumber/messages/test_case_finished.hpp | 2 +- .../cucumber/messages/test_case_started.hpp | 2 +- .../cucumber/messages/test_run_finished.hpp | 2 +- .../cucumber/messages/test_run_started.hpp | 2 +- cpp/include/cucumber/messages/test_step.hpp | 2 +- .../cucumber/messages/test_step_finished.hpp | 2 +- .../cucumber/messages/test_step_result.hpp | 2 +- .../cucumber/messages/test_step_started.hpp | 2 +- cpp/include/cucumber/messages/timestamp.hpp | 2 +- .../messages/undefined_parameter_type.hpp | 2 +- cpp/src/lib/cucumber-messages/CMakeLists.txt | 124 +----------------- .../cucumber-messages/cucumber/message.cpp | 9 ++ jsonschema/scripts/templates/cpp.hpp.erb | 2 +- 59 files changed, 72 insertions(+), 175 deletions(-) create mode 100644 cpp/src/lib/cucumber-messages/cucumber/message.cpp diff --git a/cpp/include/cucumber/message.hpp b/cpp/include/cucumber/message.hpp index c775e578..73fc1cb8 100644 --- a/cpp/include/cucumber/message.hpp +++ b/cpp/include/cucumber/message.hpp @@ -9,7 +9,7 @@ namespace cucumber { struct message { - virtual std::string to_string() const = 0; + std::string to_string() const; }; template < diff --git a/cpp/include/cucumber/messages/attachment.hpp b/cpp/include/cucumber/messages/attachment.hpp index a587d37e..9e0885c2 100644 --- a/cpp/include/cucumber/messages/attachment.hpp +++ b/cpp/include/cucumber/messages/attachment.hpp @@ -38,7 +38,7 @@ struct attachment : cucumber::message std::string test_step_id; std::string url; - std::string to_string() const override; + std::string to_string() const; }; } diff --git a/cpp/include/cucumber/messages/background.hpp b/cpp/include/cucumber/messages/background.hpp index 0b284beb..fd6c55ca 100644 --- a/cpp/include/cucumber/messages/background.hpp +++ b/cpp/include/cucumber/messages/background.hpp @@ -24,7 +24,7 @@ struct background : cucumber::message std::vector steps; std::string id; - std::string to_string() const override; + std::string to_string() const; }; } diff --git a/cpp/include/cucumber/messages/ci.hpp b/cpp/include/cucumber/messages/ci.hpp index b766b1cd..8b6c3b1d 100644 --- a/cpp/include/cucumber/messages/ci.hpp +++ b/cpp/include/cucumber/messages/ci.hpp @@ -23,7 +23,7 @@ struct ci : cucumber::message std::string build_number; cucumber::messages::git git; - std::string to_string() const override; + std::string to_string() const; }; } diff --git a/cpp/include/cucumber/messages/comment.hpp b/cpp/include/cucumber/messages/comment.hpp index 097b5b16..10ba50fd 100644 --- a/cpp/include/cucumber/messages/comment.hpp +++ b/cpp/include/cucumber/messages/comment.hpp @@ -21,7 +21,7 @@ struct comment : cucumber::message cucumber::messages::location location; std::string text; - std::string to_string() const override; + std::string to_string() const; }; } diff --git a/cpp/include/cucumber/messages/data_table.hpp b/cpp/include/cucumber/messages/data_table.hpp index 1f4da9e8..8534c1b8 100644 --- a/cpp/include/cucumber/messages/data_table.hpp +++ b/cpp/include/cucumber/messages/data_table.hpp @@ -20,7 +20,7 @@ struct data_table : cucumber::message cucumber::messages::location location; std::vector rows; - std::string to_string() const override; + std::string to_string() const; }; } diff --git a/cpp/include/cucumber/messages/doc_string.hpp b/cpp/include/cucumber/messages/doc_string.hpp index 790f8bfe..ee6c3347 100644 --- a/cpp/include/cucumber/messages/doc_string.hpp +++ b/cpp/include/cucumber/messages/doc_string.hpp @@ -21,7 +21,7 @@ struct doc_string : cucumber::message std::string content; std::string delimiter; - std::string to_string() const override; + std::string to_string() const; }; } diff --git a/cpp/include/cucumber/messages/duration.hpp b/cpp/include/cucumber/messages/duration.hpp index 27169150..a7c007d5 100644 --- a/cpp/include/cucumber/messages/duration.hpp +++ b/cpp/include/cucumber/messages/duration.hpp @@ -20,7 +20,7 @@ struct duration : cucumber::message std::size_t seconds; std::size_t nanos; - std::string to_string() const override; + std::string to_string() const; }; } diff --git a/cpp/include/cucumber/messages/envelope.hpp b/cpp/include/cucumber/messages/envelope.hpp index d4ea6d31..15b95bd4 100644 --- a/cpp/include/cucumber/messages/envelope.hpp +++ b/cpp/include/cucumber/messages/envelope.hpp @@ -57,7 +57,7 @@ struct envelope : cucumber::message cucumber::messages::test_step_started test_step_started; cucumber::messages::undefined_parameter_type undefined_parameter_type; - std::string to_string() const override; + std::string to_string() const; }; } diff --git a/cpp/include/cucumber/messages/examples.hpp b/cpp/include/cucumber/messages/examples.hpp index e256f453..76830096 100644 --- a/cpp/include/cucumber/messages/examples.hpp +++ b/cpp/include/cucumber/messages/examples.hpp @@ -28,7 +28,7 @@ struct examples : cucumber::message std::vector table_body; std::string id; - std::string to_string() const override; + std::string to_string() const; }; } diff --git a/cpp/include/cucumber/messages/exception.hpp b/cpp/include/cucumber/messages/exception.hpp index fc4e4a82..66a92b56 100644 --- a/cpp/include/cucumber/messages/exception.hpp +++ b/cpp/include/cucumber/messages/exception.hpp @@ -19,7 +19,7 @@ struct exception : cucumber::message std::string type; std::string message; - std::string to_string() const override; + std::string to_string() const; }; } diff --git a/cpp/include/cucumber/messages/feature.hpp b/cpp/include/cucumber/messages/feature.hpp index d73675c4..6e4400a5 100644 --- a/cpp/include/cucumber/messages/feature.hpp +++ b/cpp/include/cucumber/messages/feature.hpp @@ -26,7 +26,7 @@ struct feature : cucumber::message std::string description; std::vector children; - std::string to_string() const override; + std::string to_string() const; }; } diff --git a/cpp/include/cucumber/messages/feature_child.hpp b/cpp/include/cucumber/messages/feature_child.hpp index 009970a6..be45a77a 100644 --- a/cpp/include/cucumber/messages/feature_child.hpp +++ b/cpp/include/cucumber/messages/feature_child.hpp @@ -24,7 +24,7 @@ struct feature_child : cucumber::message cucumber::messages::background background; cucumber::messages::scenario scenario; - std::string to_string() const override; + std::string to_string() const; }; } diff --git a/cpp/include/cucumber/messages/gherkin_document.hpp b/cpp/include/cucumber/messages/gherkin_document.hpp index a832a469..9a4b1638 100644 --- a/cpp/include/cucumber/messages/gherkin_document.hpp +++ b/cpp/include/cucumber/messages/gherkin_document.hpp @@ -28,7 +28,7 @@ struct gherkin_document : cucumber::message cucumber::messages::feature feature; std::vector comments; - std::string to_string() const override; + std::string to_string() const; }; } diff --git a/cpp/include/cucumber/messages/git.hpp b/cpp/include/cucumber/messages/git.hpp index c184048b..0f589277 100644 --- a/cpp/include/cucumber/messages/git.hpp +++ b/cpp/include/cucumber/messages/git.hpp @@ -22,7 +22,7 @@ struct git : cucumber::message std::string branch; std::string tag; - std::string to_string() const override; + std::string to_string() const; }; } diff --git a/cpp/include/cucumber/messages/group.hpp b/cpp/include/cucumber/messages/group.hpp index 1b1d4e33..a3a8efd5 100644 --- a/cpp/include/cucumber/messages/group.hpp +++ b/cpp/include/cucumber/messages/group.hpp @@ -20,7 +20,7 @@ struct group : cucumber::message std::size_t start; std::string value; - std::string to_string() const override; + std::string to_string() const; }; } diff --git a/cpp/include/cucumber/messages/hook.hpp b/cpp/include/cucumber/messages/hook.hpp index 319c9bd5..18189272 100644 --- a/cpp/include/cucumber/messages/hook.hpp +++ b/cpp/include/cucumber/messages/hook.hpp @@ -21,7 +21,7 @@ struct hook : cucumber::message cucumber::messages::source_reference source_reference; std::string tag_expression; - std::string to_string() const override; + std::string to_string() const; }; } diff --git a/cpp/include/cucumber/messages/java_method.hpp b/cpp/include/cucumber/messages/java_method.hpp index 8ebcf0b1..4d5316ba 100644 --- a/cpp/include/cucumber/messages/java_method.hpp +++ b/cpp/include/cucumber/messages/java_method.hpp @@ -18,7 +18,7 @@ struct java_method : cucumber::message std::string method_name; std::vector method_parameter_types; - std::string to_string() const override; + std::string to_string() const; }; } diff --git a/cpp/include/cucumber/messages/java_stack_trace_element.hpp b/cpp/include/cucumber/messages/java_stack_trace_element.hpp index f782df84..6ae53794 100644 --- a/cpp/include/cucumber/messages/java_stack_trace_element.hpp +++ b/cpp/include/cucumber/messages/java_stack_trace_element.hpp @@ -18,7 +18,7 @@ struct java_stack_trace_element : cucumber::message std::string file_name; std::string method_name; - std::string to_string() const override; + std::string to_string() const; }; } diff --git a/cpp/include/cucumber/messages/location.hpp b/cpp/include/cucumber/messages/location.hpp index 5348eb7f..54f4835e 100644 --- a/cpp/include/cucumber/messages/location.hpp +++ b/cpp/include/cucumber/messages/location.hpp @@ -19,7 +19,7 @@ struct location : cucumber::message std::size_t line; std::size_t column; - std::string to_string() const override; + std::string to_string() const; }; } diff --git a/cpp/include/cucumber/messages/meta.hpp b/cpp/include/cucumber/messages/meta.hpp index 18d33892..a4e5ce10 100644 --- a/cpp/include/cucumber/messages/meta.hpp +++ b/cpp/include/cucumber/messages/meta.hpp @@ -30,7 +30,7 @@ struct meta : cucumber::message cucumber::messages::product cpu; cucumber::messages::ci ci; - std::string to_string() const override; + std::string to_string() const; }; } diff --git a/cpp/include/cucumber/messages/parameter_type.hpp b/cpp/include/cucumber/messages/parameter_type.hpp index d753c4b6..fe1af92c 100644 --- a/cpp/include/cucumber/messages/parameter_type.hpp +++ b/cpp/include/cucumber/messages/parameter_type.hpp @@ -23,7 +23,7 @@ struct parameter_type : cucumber::message std::string id; cucumber::messages::source_reference source_reference; - std::string to_string() const override; + std::string to_string() const; }; } diff --git a/cpp/include/cucumber/messages/parse_error.hpp b/cpp/include/cucumber/messages/parse_error.hpp index 30c72e9a..df0a176b 100644 --- a/cpp/include/cucumber/messages/parse_error.hpp +++ b/cpp/include/cucumber/messages/parse_error.hpp @@ -19,7 +19,7 @@ struct parse_error : cucumber::message cucumber::messages::source_reference source; std::string message; - std::string to_string() const override; + std::string to_string() const; }; } diff --git a/cpp/include/cucumber/messages/pickle.hpp b/cpp/include/cucumber/messages/pickle.hpp index 6214e242..aa37a256 100644 --- a/cpp/include/cucumber/messages/pickle.hpp +++ b/cpp/include/cucumber/messages/pickle.hpp @@ -38,7 +38,7 @@ struct pickle : cucumber::message std::vector tags; std::vector ast_node_ids; - std::string to_string() const override; + std::string to_string() const; }; } diff --git a/cpp/include/cucumber/messages/pickle_doc_string.hpp b/cpp/include/cucumber/messages/pickle_doc_string.hpp index 50d70294..658e3f48 100644 --- a/cpp/include/cucumber/messages/pickle_doc_string.hpp +++ b/cpp/include/cucumber/messages/pickle_doc_string.hpp @@ -17,7 +17,7 @@ struct pickle_doc_string : cucumber::message std::string media_type; std::string content; - std::string to_string() const override; + std::string to_string() const; }; } diff --git a/cpp/include/cucumber/messages/pickle_step.hpp b/cpp/include/cucumber/messages/pickle_step.hpp index 69e05b8b..de4879ed 100644 --- a/cpp/include/cucumber/messages/pickle_step.hpp +++ b/cpp/include/cucumber/messages/pickle_step.hpp @@ -25,7 +25,7 @@ struct pickle_step : cucumber::message cucumber::messages::pickle_step_type type; std::string text; - std::string to_string() const override; + std::string to_string() const; }; } diff --git a/cpp/include/cucumber/messages/pickle_step_argument.hpp b/cpp/include/cucumber/messages/pickle_step_argument.hpp index 0c30f64b..7b988e2a 100644 --- a/cpp/include/cucumber/messages/pickle_step_argument.hpp +++ b/cpp/include/cucumber/messages/pickle_step_argument.hpp @@ -22,7 +22,7 @@ struct pickle_step_argument : cucumber::message cucumber::messages::pickle_doc_string doc_string; cucumber::messages::pickle_table data_table; - std::string to_string() const override; + std::string to_string() const; }; } diff --git a/cpp/include/cucumber/messages/pickle_table.hpp b/cpp/include/cucumber/messages/pickle_table.hpp index ccde87e6..0166bd15 100644 --- a/cpp/include/cucumber/messages/pickle_table.hpp +++ b/cpp/include/cucumber/messages/pickle_table.hpp @@ -18,7 +18,7 @@ struct pickle_table : cucumber::message { std::vector rows; - std::string to_string() const override; + std::string to_string() const; }; } diff --git a/cpp/include/cucumber/messages/pickle_table_cell.hpp b/cpp/include/cucumber/messages/pickle_table_cell.hpp index fdab3447..5a2a57e2 100644 --- a/cpp/include/cucumber/messages/pickle_table_cell.hpp +++ b/cpp/include/cucumber/messages/pickle_table_cell.hpp @@ -16,7 +16,7 @@ struct pickle_table_cell : cucumber::message { std::string value; - std::string to_string() const override; + std::string to_string() const; }; } diff --git a/cpp/include/cucumber/messages/pickle_table_row.hpp b/cpp/include/cucumber/messages/pickle_table_row.hpp index 22a4479e..fa2c0636 100644 --- a/cpp/include/cucumber/messages/pickle_table_row.hpp +++ b/cpp/include/cucumber/messages/pickle_table_row.hpp @@ -18,7 +18,7 @@ struct pickle_table_row : cucumber::message { std::vector cells; - std::string to_string() const override; + std::string to_string() const; }; } diff --git a/cpp/include/cucumber/messages/pickle_tag.hpp b/cpp/include/cucumber/messages/pickle_tag.hpp index f7ff0518..1e961ede 100644 --- a/cpp/include/cucumber/messages/pickle_tag.hpp +++ b/cpp/include/cucumber/messages/pickle_tag.hpp @@ -19,7 +19,7 @@ struct pickle_tag : cucumber::message std::string name; std::string ast_node_id; - std::string to_string() const override; + std::string to_string() const; }; } diff --git a/cpp/include/cucumber/messages/product.hpp b/cpp/include/cucumber/messages/product.hpp index 8aee270b..a25035a8 100644 --- a/cpp/include/cucumber/messages/product.hpp +++ b/cpp/include/cucumber/messages/product.hpp @@ -19,7 +19,7 @@ struct product : cucumber::message std::string name; std::string version; - std::string to_string() const override; + std::string to_string() const; }; } diff --git a/cpp/include/cucumber/messages/rule.hpp b/cpp/include/cucumber/messages/rule.hpp index 124a9f3d..399fc2c1 100644 --- a/cpp/include/cucumber/messages/rule.hpp +++ b/cpp/include/cucumber/messages/rule.hpp @@ -26,7 +26,7 @@ struct rule : cucumber::message std::vector children; std::string id; - std::string to_string() const override; + std::string to_string() const; }; } diff --git a/cpp/include/cucumber/messages/rule_child.hpp b/cpp/include/cucumber/messages/rule_child.hpp index ef2e62b4..e1214220 100644 --- a/cpp/include/cucumber/messages/rule_child.hpp +++ b/cpp/include/cucumber/messages/rule_child.hpp @@ -22,7 +22,7 @@ struct rule_child : cucumber::message cucumber::messages::background background; cucumber::messages::scenario scenario; - std::string to_string() const override; + std::string to_string() const; }; } diff --git a/cpp/include/cucumber/messages/scenario.hpp b/cpp/include/cucumber/messages/scenario.hpp index 2eeb7ee4..2f2dd2ac 100644 --- a/cpp/include/cucumber/messages/scenario.hpp +++ b/cpp/include/cucumber/messages/scenario.hpp @@ -28,7 +28,7 @@ struct scenario : cucumber::message std::vector examples; std::string id; - std::string to_string() const override; + std::string to_string() const; }; } diff --git a/cpp/include/cucumber/messages/source.hpp b/cpp/include/cucumber/messages/source.hpp index 49113881..f312cdf6 100644 --- a/cpp/include/cucumber/messages/source.hpp +++ b/cpp/include/cucumber/messages/source.hpp @@ -24,7 +24,7 @@ struct source : cucumber::message std::string data; cucumber::messages::source_media_type media_type; - std::string to_string() const override; + std::string to_string() const; }; } diff --git a/cpp/include/cucumber/messages/source_reference.hpp b/cpp/include/cucumber/messages/source_reference.hpp index 0dde140d..ddf8d736 100644 --- a/cpp/include/cucumber/messages/source_reference.hpp +++ b/cpp/include/cucumber/messages/source_reference.hpp @@ -26,7 +26,7 @@ struct source_reference : cucumber::message cucumber::messages::java_stack_trace_element java_stack_trace_element; cucumber::messages::location location; - std::string to_string() const override; + std::string to_string() const; }; } diff --git a/cpp/include/cucumber/messages/step.hpp b/cpp/include/cucumber/messages/step.hpp index fe2ec9a1..3a5ec69d 100644 --- a/cpp/include/cucumber/messages/step.hpp +++ b/cpp/include/cucumber/messages/step.hpp @@ -29,7 +29,7 @@ struct step : cucumber::message cucumber::messages::data_table data_table; std::string id; - std::string to_string() const override; + std::string to_string() const; }; } diff --git a/cpp/include/cucumber/messages/step_definition.hpp b/cpp/include/cucumber/messages/step_definition.hpp index c3f7fa9f..87b3b96c 100644 --- a/cpp/include/cucumber/messages/step_definition.hpp +++ b/cpp/include/cucumber/messages/step_definition.hpp @@ -21,7 +21,7 @@ struct step_definition : cucumber::message cucumber::messages::step_definition_pattern pattern; cucumber::messages::source_reference source_reference; - std::string to_string() const override; + std::string to_string() const; }; } diff --git a/cpp/include/cucumber/messages/step_definition_pattern.hpp b/cpp/include/cucumber/messages/step_definition_pattern.hpp index 9477e6f5..e14e5d26 100644 --- a/cpp/include/cucumber/messages/step_definition_pattern.hpp +++ b/cpp/include/cucumber/messages/step_definition_pattern.hpp @@ -19,7 +19,7 @@ struct step_definition_pattern : cucumber::message std::string source; cucumber::messages::step_definition_pattern_type type; - std::string to_string() const override; + std::string to_string() const; }; } diff --git a/cpp/include/cucumber/messages/step_match_argument.hpp b/cpp/include/cucumber/messages/step_match_argument.hpp index 7d7af9c1..c03bd9e9 100644 --- a/cpp/include/cucumber/messages/step_match_argument.hpp +++ b/cpp/include/cucumber/messages/step_match_argument.hpp @@ -26,7 +26,7 @@ struct step_match_argument : cucumber::message cucumber::messages::group group; std::string parameter_type_name; - std::string to_string() const override; + std::string to_string() const; }; } diff --git a/cpp/include/cucumber/messages/step_match_arguments_list.hpp b/cpp/include/cucumber/messages/step_match_arguments_list.hpp index acccaa1d..aa4a9316 100644 --- a/cpp/include/cucumber/messages/step_match_arguments_list.hpp +++ b/cpp/include/cucumber/messages/step_match_arguments_list.hpp @@ -18,7 +18,7 @@ struct step_match_arguments_list : cucumber::message { std::vector step_match_arguments; - std::string to_string() const override; + std::string to_string() const; }; } diff --git a/cpp/include/cucumber/messages/table_cell.hpp b/cpp/include/cucumber/messages/table_cell.hpp index acd7810e..664fb288 100644 --- a/cpp/include/cucumber/messages/table_cell.hpp +++ b/cpp/include/cucumber/messages/table_cell.hpp @@ -21,7 +21,7 @@ struct table_cell : cucumber::message cucumber::messages::location location; std::string value; - std::string to_string() const override; + std::string to_string() const; }; } diff --git a/cpp/include/cucumber/messages/table_row.hpp b/cpp/include/cucumber/messages/table_row.hpp index 3e0b3cb6..4ea9b94d 100644 --- a/cpp/include/cucumber/messages/table_row.hpp +++ b/cpp/include/cucumber/messages/table_row.hpp @@ -23,7 +23,7 @@ struct table_row : cucumber::message std::vector cells; std::string id; - std::string to_string() const override; + std::string to_string() const; }; } diff --git a/cpp/include/cucumber/messages/tag.hpp b/cpp/include/cucumber/messages/tag.hpp index b5566a35..a85bf370 100644 --- a/cpp/include/cucumber/messages/tag.hpp +++ b/cpp/include/cucumber/messages/tag.hpp @@ -22,7 +22,7 @@ struct tag : cucumber::message std::string name; std::string id; - std::string to_string() const override; + std::string to_string() const; }; } diff --git a/cpp/include/cucumber/messages/test_case.hpp b/cpp/include/cucumber/messages/test_case.hpp index 69ab921b..6e150da8 100644 --- a/cpp/include/cucumber/messages/test_case.hpp +++ b/cpp/include/cucumber/messages/test_case.hpp @@ -24,7 +24,7 @@ struct test_case : cucumber::message std::string pickle_id; std::vector test_steps; - std::string to_string() const override; + std::string to_string() const; }; } diff --git a/cpp/include/cucumber/messages/test_case_finished.hpp b/cpp/include/cucumber/messages/test_case_finished.hpp index ca474b55..6285fdab 100644 --- a/cpp/include/cucumber/messages/test_case_finished.hpp +++ b/cpp/include/cucumber/messages/test_case_finished.hpp @@ -20,7 +20,7 @@ struct test_case_finished : cucumber::message cucumber::messages::timestamp timestamp; bool will_be_retried; - std::string to_string() const override; + std::string to_string() const; }; } diff --git a/cpp/include/cucumber/messages/test_case_started.hpp b/cpp/include/cucumber/messages/test_case_started.hpp index 5460a331..deb6012b 100644 --- a/cpp/include/cucumber/messages/test_case_started.hpp +++ b/cpp/include/cucumber/messages/test_case_started.hpp @@ -22,7 +22,7 @@ struct test_case_started : cucumber::message std::string worker_id; cucumber::messages::timestamp timestamp; - std::string to_string() const override; + std::string to_string() const; }; } diff --git a/cpp/include/cucumber/messages/test_run_finished.hpp b/cpp/include/cucumber/messages/test_run_finished.hpp index f01b030d..f8e11360 100644 --- a/cpp/include/cucumber/messages/test_run_finished.hpp +++ b/cpp/include/cucumber/messages/test_run_finished.hpp @@ -22,7 +22,7 @@ struct test_run_finished : cucumber::message cucumber::messages::timestamp timestamp; cucumber::messages::exception exception; - std::string to_string() const override; + std::string to_string() const; }; } diff --git a/cpp/include/cucumber/messages/test_run_started.hpp b/cpp/include/cucumber/messages/test_run_started.hpp index 9486ebc8..6195cae0 100644 --- a/cpp/include/cucumber/messages/test_run_started.hpp +++ b/cpp/include/cucumber/messages/test_run_started.hpp @@ -18,7 +18,7 @@ struct test_run_started : cucumber::message { cucumber::messages::timestamp timestamp; - std::string to_string() const override; + std::string to_string() const; }; } diff --git a/cpp/include/cucumber/messages/test_step.hpp b/cpp/include/cucumber/messages/test_step.hpp index 2d03d250..027dbfc3 100644 --- a/cpp/include/cucumber/messages/test_step.hpp +++ b/cpp/include/cucumber/messages/test_step.hpp @@ -25,7 +25,7 @@ struct test_step : cucumber::message std::vector step_definition_ids; std::vector step_match_arguments_lists; - std::string to_string() const override; + std::string to_string() const; }; } diff --git a/cpp/include/cucumber/messages/test_step_finished.hpp b/cpp/include/cucumber/messages/test_step_finished.hpp index e24cd929..9934d92a 100644 --- a/cpp/include/cucumber/messages/test_step_finished.hpp +++ b/cpp/include/cucumber/messages/test_step_finished.hpp @@ -22,7 +22,7 @@ struct test_step_finished : cucumber::message cucumber::messages::test_step_result test_step_result; cucumber::messages::timestamp timestamp; - std::string to_string() const override; + std::string to_string() const; }; } diff --git a/cpp/include/cucumber/messages/test_step_result.hpp b/cpp/include/cucumber/messages/test_step_result.hpp index de5bbe5e..c647d48f 100644 --- a/cpp/include/cucumber/messages/test_step_result.hpp +++ b/cpp/include/cucumber/messages/test_step_result.hpp @@ -23,7 +23,7 @@ struct test_step_result : cucumber::message cucumber::messages::test_step_result_status status; cucumber::messages::exception exception; - std::string to_string() const override; + std::string to_string() const; }; } diff --git a/cpp/include/cucumber/messages/test_step_started.hpp b/cpp/include/cucumber/messages/test_step_started.hpp index 714cf9a7..7c427217 100644 --- a/cpp/include/cucumber/messages/test_step_started.hpp +++ b/cpp/include/cucumber/messages/test_step_started.hpp @@ -20,7 +20,7 @@ struct test_step_started : cucumber::message std::string test_step_id; cucumber::messages::timestamp timestamp; - std::string to_string() const override; + std::string to_string() const; }; } diff --git a/cpp/include/cucumber/messages/timestamp.hpp b/cpp/include/cucumber/messages/timestamp.hpp index e7a7d87b..77440fa9 100644 --- a/cpp/include/cucumber/messages/timestamp.hpp +++ b/cpp/include/cucumber/messages/timestamp.hpp @@ -17,7 +17,7 @@ struct timestamp : cucumber::message std::size_t seconds; std::size_t nanos; - std::string to_string() const override; + std::string to_string() const; }; } diff --git a/cpp/include/cucumber/messages/undefined_parameter_type.hpp b/cpp/include/cucumber/messages/undefined_parameter_type.hpp index 91d5378c..3a537365 100644 --- a/cpp/include/cucumber/messages/undefined_parameter_type.hpp +++ b/cpp/include/cucumber/messages/undefined_parameter_type.hpp @@ -17,7 +17,7 @@ struct undefined_parameter_type : cucumber::message std::string expression; std::string name; - std::string to_string() const override; + std::string to_string() const; }; } diff --git a/cpp/src/lib/cucumber-messages/CMakeLists.txt b/cpp/src/lib/cucumber-messages/CMakeLists.txt index 6ab0831c..8ee678d7 100644 --- a/cpp/src/lib/cucumber-messages/CMakeLists.txt +++ b/cpp/src/lib/cucumber-messages/CMakeLists.txt @@ -3,6 +3,10 @@ add_library(cucumber::messages ALIAS cucumber-messages) set(INC_DIR "${CMAKE_SOURCE_DIR}/include") +# We prefer it that way... +file(GLOB_RECURSE CUCUMBER_MESSAGES_HEADERS ${INC_DIR}/*.[ch]pp) +file(GLOB_RECURSE CUCUMBER_MESSAGES_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/*.[ch]pp) + target_sources( cucumber-messages PUBLIC @@ -11,125 +15,9 @@ target_sources( TYPE HEADERS BASE_DIRS ${INC_DIR} FILES - ${INC_DIR}/cucumber/message.hpp - ${INC_DIR}/cucumber/messages/attachment_content_encoding.hpp - ${INC_DIR}/cucumber/messages/attachment.hpp - ${INC_DIR}/cucumber/messages/background.hpp - ${INC_DIR}/cucumber/messages/ci.hpp - ${INC_DIR}/cucumber/messages/comment.hpp - ${INC_DIR}/cucumber/messages/data_table.hpp - ${INC_DIR}/cucumber/messages/doc_string.hpp - ${INC_DIR}/cucumber/messages/duration.hpp - ${INC_DIR}/cucumber/messages/envelope.hpp - ${INC_DIR}/cucumber/messages/examples.hpp - ${INC_DIR}/cucumber/messages/exception.hpp - ${INC_DIR}/cucumber/messages/feature_child.hpp - ${INC_DIR}/cucumber/messages/feature.hpp - ${INC_DIR}/cucumber/messages/gherkin_document.hpp - ${INC_DIR}/cucumber/messages/git.hpp - ${INC_DIR}/cucumber/messages/group.hpp - ${INC_DIR}/cucumber/messages/hook.hpp - ${INC_DIR}/cucumber/messages/java_method.hpp - ${INC_DIR}/cucumber/messages/java_stack_trace_element.hpp - ${INC_DIR}/cucumber/messages/location.hpp - ${INC_DIR}/cucumber/messages/meta.hpp - ${INC_DIR}/cucumber/messages/parameter_type.hpp - ${INC_DIR}/cucumber/messages/parse_error.hpp - ${INC_DIR}/cucumber/messages/pickle_doc_string.hpp - ${INC_DIR}/cucumber/messages/pickle.hpp - ${INC_DIR}/cucumber/messages/pickle_step_argument.hpp - ${INC_DIR}/cucumber/messages/pickle_step.hpp - ${INC_DIR}/cucumber/messages/pickle_step_type.hpp - ${INC_DIR}/cucumber/messages/pickle_table_cell.hpp - ${INC_DIR}/cucumber/messages/pickle_table.hpp - ${INC_DIR}/cucumber/messages/pickle_table_row.hpp - ${INC_DIR}/cucumber/messages/pickle_tag.hpp - ${INC_DIR}/cucumber/messages/product.hpp - ${INC_DIR}/cucumber/messages/rule_child.hpp - ${INC_DIR}/cucumber/messages/rule.hpp - ${INC_DIR}/cucumber/messages/scenario.hpp - ${INC_DIR}/cucumber/messages/source.hpp - ${INC_DIR}/cucumber/messages/source_media_type.hpp - ${INC_DIR}/cucumber/messages/source_reference.hpp - ${INC_DIR}/cucumber/messages/step_definition.hpp - ${INC_DIR}/cucumber/messages/step_definition_pattern.hpp - ${INC_DIR}/cucumber/messages/step_definition_pattern_type.hpp - ${INC_DIR}/cucumber/messages/step.hpp - ${INC_DIR}/cucumber/messages/step_keyword_type.hpp - ${INC_DIR}/cucumber/messages/step_match_argument.hpp - ${INC_DIR}/cucumber/messages/step_match_arguments_list.hpp - ${INC_DIR}/cucumber/messages/table_cell.hpp - ${INC_DIR}/cucumber/messages/table_row.hpp - ${INC_DIR}/cucumber/messages/tag.hpp - ${INC_DIR}/cucumber/messages/test_case_finished.hpp - ${INC_DIR}/cucumber/messages/test_case.hpp - ${INC_DIR}/cucumber/messages/test_case_started.hpp - ${INC_DIR}/cucumber/messages/test_run_finished.hpp - ${INC_DIR}/cucumber/messages/test_run_started.hpp - ${INC_DIR}/cucumber/messages/test_step_finished.hpp - ${INC_DIR}/cucumber/messages/test_step.hpp - ${INC_DIR}/cucumber/messages/test_step_result.hpp - ${INC_DIR}/cucumber/messages/test_step_result_status.hpp - ${INC_DIR}/cucumber/messages/test_step_started.hpp - ${INC_DIR}/cucumber/messages/timestamp.hpp - ${INC_DIR}/cucumber/messages/undefined_parameter_type.hpp + ${CUCUMBER_MESSAGES_HEADERS} PRIVATE - ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/utils.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/attachment.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/background.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/ci.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/comment.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/data_table.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/doc_string.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/duration.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/envelope.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/examples.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/exception.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/feature_child.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/feature.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/gherkin_document.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/git.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/group.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/hook.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/java_method.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/java_stack_trace_element.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/location.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/meta.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/parameter_type.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/parse_error.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/pickle.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/pickle_doc_string.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/pickle_step_argument.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/pickle_step.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/pickle_table_cell.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/pickle_table.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/pickle_table_row.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/pickle_tag.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/product.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/rule_child.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/rule.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/scenario.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/source.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/source_reference.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/step.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/step_definition.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/step_definition_pattern.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/step_match_argument.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/step_match_arguments_list.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/table_cell.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/table_row.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/tag.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/test_case.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/test_case_finished.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/test_case_started.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/test_run_finished.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/test_run_started.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/test_step.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/test_step_finished.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/test_step_result.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/test_step_started.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/timestamp.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/cucumber/messages/undefined_parameter_type.cpp + ${CUCUMBER_MESSAGES_SOURCES} ) target_include_directories( diff --git a/cpp/src/lib/cucumber-messages/cucumber/message.cpp b/cpp/src/lib/cucumber-messages/cucumber/message.cpp new file mode 100644 index 00000000..4b6e855a --- /dev/null +++ b/cpp/src/lib/cucumber-messages/cucumber/message.cpp @@ -0,0 +1,9 @@ +#include + +namespace cucumber { + +std::string +message::to_string() const +{ return "message"; } + +} diff --git a/jsonschema/scripts/templates/cpp.hpp.erb b/jsonschema/scripts/templates/cpp.hpp.erb index 088d4c51..6d6b0efc 100644 --- a/jsonschema/scripts/templates/cpp.hpp.erb +++ b/jsonschema/scripts/templates/cpp.hpp.erb @@ -55,7 +55,7 @@ struct <%= myclass %> : cucumber::message <%- end -%> <%- end -%> - std::string to_string() const override; + std::string to_string() const; }; } From 0a144c562bbd73e2580c2dcef47a83df67567365 Mon Sep 17 00:00:00 2001 From: Remy Chibois Date: Fri, 5 May 2023 18:28:59 +0200 Subject: [PATCH 08/26] chore: fixed enum --- .../messages/attachment_content_encoding.cpp | 4 ++-- .../cucumber/messages/pickle_step_type.cpp | 8 ++++---- .../cucumber/messages/source_media_type.cpp | 4 ++-- .../messages/step_definition_pattern_type.cpp | 4 ++-- .../cucumber/messages/step_keyword_type.cpp | 10 +++++----- .../cucumber/messages/test_step_result_status.cpp | 14 +++++++------- jsonschema/scripts/templates/cpp.enum.hpp.erb | 2 +- 7 files changed, 23 insertions(+), 23 deletions(-) diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/attachment_content_encoding.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/attachment_content_encoding.cpp index 9a0e272c..22cde9f8 100644 --- a/cpp/src/lib/cucumber-messages/cucumber/messages/attachment_content_encoding.cpp +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/attachment_content_encoding.cpp @@ -10,8 +10,8 @@ to_string(attachment_content_encoding v) using map_type = std::unordered_map; static const map_type m = { - { IDENTITY, "IDENTITY" }, - { BASE64, "BASE64" } + { attachment_content_encoding::IDENTITY, "IDENTITY" }, + { attachment_content_encoding::BASE64, "BASE64" } }; return m.at(v); diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/pickle_step_type.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/pickle_step_type.cpp index 9e8d1d7a..897da3c4 100644 --- a/cpp/src/lib/cucumber-messages/cucumber/messages/pickle_step_type.cpp +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/pickle_step_type.cpp @@ -10,10 +10,10 @@ to_string(pickle_step_type v) using map_type = std::unordered_map; static const map_type m = { - { UNKNOWN, "Unknown" }, - { CONTEXT, "Context" }, - { ACTION, "Action" }, - { OUTCOME, "Outcome" } + { pickle_step_type::UNKNOWN, "Unknown" }, + { pickle_step_type::CONTEXT, "Context" }, + { pickle_step_type::ACTION, "Action" }, + { pickle_step_type::OUTCOME, "Outcome" } }; return m.at(v); diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/source_media_type.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/source_media_type.cpp index 35439aa4..550ba295 100644 --- a/cpp/src/lib/cucumber-messages/cucumber/messages/source_media_type.cpp +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/source_media_type.cpp @@ -10,8 +10,8 @@ to_string(source_media_type v) using map_type = std::unordered_map; static const map_type m = { - { TEXT_X_CUCUMBER_GHERKIN_PLAIN, "text/x.cucumber.gherkin+plain" }, - { TEXT_X_CUCUMBER_GHERKIN_MARKDOWN, "text/x.cucumber.gherkin+markdown" } + { source_media_type::TEXT_X_CUCUMBER_GHERKIN_PLAIN, "text/x.cucumber.gherkin+plain" }, + { source_media_type::TEXT_X_CUCUMBER_GHERKIN_MARKDOWN, "text/x.cucumber.gherkin+markdown" } }; return m.at(v); diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/step_definition_pattern_type.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/step_definition_pattern_type.cpp index c67ddf35..101afeb7 100644 --- a/cpp/src/lib/cucumber-messages/cucumber/messages/step_definition_pattern_type.cpp +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/step_definition_pattern_type.cpp @@ -10,8 +10,8 @@ to_string(step_definition_pattern_type v) using map_type = std::unordered_map; static const map_type m = { - { CUCUMBER_EXPRESSION, "CUCUMBER_EXPRESSION" }, - { REGULAR_EXPRESSION, "REGULAR_EXPRESSION" } + { step_definition_pattern_type::CUCUMBER_EXPRESSION, "CUCUMBER_EXPRESSION" }, + { step_definition_pattern_type::REGULAR_EXPRESSION, "REGULAR_EXPRESSION" } }; return m.at(v); diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/step_keyword_type.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/step_keyword_type.cpp index 6d82d017..ff13059c 100644 --- a/cpp/src/lib/cucumber-messages/cucumber/messages/step_keyword_type.cpp +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/step_keyword_type.cpp @@ -10,11 +10,11 @@ to_string(step_keyword_type v) using map_type = std::unordered_map; static const map_type m = { - { UNKNOWN, "Unknown" }, - { CONTEXT, "Context" }, - { ACTION, "Action" }, - { OUTCOME, "Outcome" }, - { CONJUNCTION, "Conjunction" } + { step_keyword_type::UNKNOWN, "Unknown" }, + { step_keyword_type::CONTEXT, "Context" }, + { step_keyword_type::ACTION, "Action" }, + { step_keyword_type::OUTCOME, "Outcome" }, + { step_keyword_type::CONJUNCTION, "Conjunction" } }; return m.at(v); diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/test_step_result_status.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/test_step_result_status.cpp index 620abbbf..f7ae9ccc 100644 --- a/cpp/src/lib/cucumber-messages/cucumber/messages/test_step_result_status.cpp +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/test_step_result_status.cpp @@ -10,13 +10,13 @@ to_string(test_step_result_status v) using map_type = std::unordered_map; static const map_type m = { - { UNKNOWN, "UNKNOWN" }, - { PASSED, "PASSED" }, - { SKIPPED, "SKIPPED" }, - { PENDING, "PENDING" }, - { UNDEFINED, "UNDEFINED" }, - { AMBIGUOUS, "AMBIGUOUS" }, - { FAILED, "FAILED" } + { test_step_result_status::UNKNOWN, "UNKNOWN" }, + { test_step_result_status::PASSED, "PASSED" }, + { test_step_result_status::SKIPPED, "SKIPPED" }, + { test_step_result_status::PENDING, "PENDING" }, + { test_step_result_status::UNDEFINED, "UNDEFINED" }, + { test_step_result_status::AMBIGUOUS, "AMBIGUOUS" }, + { test_step_result_status::FAILED, "FAILED" } }; return m.at(v); diff --git a/jsonschema/scripts/templates/cpp.enum.hpp.erb b/jsonschema/scripts/templates/cpp.enum.hpp.erb index 111213ce..3cc4b2e0 100644 --- a/jsonschema/scripts/templates/cpp.enum.hpp.erb +++ b/jsonschema/scripts/templates/cpp.enum.hpp.erb @@ -36,7 +36,7 @@ to_string(<%= ename %> v) static const map_type m = { <%- enum[:values].each_with_index do |value, index| -%> - { <%= enum_constant(value) %>, "<%= value %>" }<%= index < enum[:values].length-1 ? ',' : '' %> + { <%= ename %>::<%= enum_constant(value) %>, "<%= value %>" }<%= index < enum[:values].length-1 ? ',' : '' %> <% end -%> }; From 20a40e3b1b93e5d70db29b5d87ec159df8bcad20 Mon Sep 17 00:00:00 2001 From: Remy Chibois Date: Sat, 6 May 2023 11:18:05 +0200 Subject: [PATCH 09/26] chore: removed inheritance --- cpp/Makefile | 14 +++--- cpp/include/cucumber/message.hpp | 45 ------------------- cpp/include/cucumber/messages/attachment.hpp | 8 ++-- cpp/include/cucumber/messages/background.hpp | 8 ++-- cpp/include/cucumber/messages/ci.hpp | 8 ++-- cpp/include/cucumber/messages/comment.hpp | 8 ++-- cpp/include/cucumber/messages/data_table.hpp | 8 ++-- cpp/include/cucumber/messages/doc_string.hpp | 8 ++-- cpp/include/cucumber/messages/duration.hpp | 8 ++-- cpp/include/cucumber/messages/envelope.hpp | 8 ++-- cpp/include/cucumber/messages/examples.hpp | 8 ++-- cpp/include/cucumber/messages/exception.hpp | 8 ++-- cpp/include/cucumber/messages/feature.hpp | 8 ++-- .../cucumber/messages/feature_child.hpp | 8 ++-- .../cucumber/messages/gherkin_document.hpp | 8 ++-- cpp/include/cucumber/messages/git.hpp | 8 ++-- cpp/include/cucumber/messages/group.hpp | 8 ++-- cpp/include/cucumber/messages/hook.hpp | 8 ++-- cpp/include/cucumber/messages/java_method.hpp | 8 ++-- .../messages/java_stack_trace_element.hpp | 8 ++-- cpp/include/cucumber/messages/location.hpp | 8 ++-- cpp/include/cucumber/messages/meta.hpp | 8 ++-- .../cucumber/messages/parameter_type.hpp | 8 ++-- cpp/include/cucumber/messages/parse_error.hpp | 8 ++-- cpp/include/cucumber/messages/pickle.hpp | 8 ++-- .../cucumber/messages/pickle_doc_string.hpp | 8 ++-- cpp/include/cucumber/messages/pickle_step.hpp | 8 ++-- .../messages/pickle_step_argument.hpp | 8 ++-- .../cucumber/messages/pickle_table.hpp | 8 ++-- .../cucumber/messages/pickle_table_cell.hpp | 8 ++-- .../cucumber/messages/pickle_table_row.hpp | 8 ++-- cpp/include/cucumber/messages/pickle_tag.hpp | 8 ++-- cpp/include/cucumber/messages/product.hpp | 8 ++-- cpp/include/cucumber/messages/rule.hpp | 8 ++-- cpp/include/cucumber/messages/rule_child.hpp | 8 ++-- cpp/include/cucumber/messages/scenario.hpp | 8 ++-- cpp/include/cucumber/messages/source.hpp | 8 ++-- .../cucumber/messages/source_reference.hpp | 8 ++-- cpp/include/cucumber/messages/step.hpp | 8 ++-- .../cucumber/messages/step_definition.hpp | 8 ++-- .../messages/step_definition_pattern.hpp | 8 ++-- .../cucumber/messages/step_match_argument.hpp | 8 ++-- .../messages/step_match_arguments_list.hpp | 8 ++-- cpp/include/cucumber/messages/table_cell.hpp | 8 ++-- cpp/include/cucumber/messages/table_row.hpp | 8 ++-- cpp/include/cucumber/messages/tag.hpp | 8 ++-- cpp/include/cucumber/messages/test_case.hpp | 8 ++-- .../cucumber/messages/test_case_finished.hpp | 8 ++-- .../cucumber/messages/test_case_started.hpp | 8 ++-- .../cucumber/messages/test_run_finished.hpp | 8 ++-- .../cucumber/messages/test_run_started.hpp | 8 ++-- cpp/include/cucumber/messages/test_step.hpp | 8 ++-- .../cucumber/messages/test_step_finished.hpp | 8 ++-- .../cucumber/messages/test_step_result.hpp | 8 ++-- .../cucumber/messages/test_step_started.hpp | 8 ++-- cpp/include/cucumber/messages/timestamp.hpp | 8 ++-- .../messages/undefined_parameter_type.hpp | 8 ++-- .../cucumber-messages/cucumber/message.cpp | 9 ---- .../cucumber/messages/attachment.cpp | 26 +++++++---- .../cucumber/messages/background.cpp | 22 ++++++--- .../cucumber/messages/ci.cpp | 18 +++++--- .../cucumber/messages/comment.cpp | 14 ++++-- .../cucumber/messages/data_table.cpp | 14 ++++-- .../cucumber/messages/doc_string.cpp | 18 +++++--- .../cucumber/messages/duration.cpp | 14 ++++-- .../cucumber/messages/envelope.cpp | 44 ++++++++++-------- .../cucumber/messages/examples.cpp | 26 +++++++---- .../cucumber/messages/exception.cpp | 14 ++++-- .../cucumber/messages/feature.cpp | 24 ++++++---- .../cucumber/messages/feature_child.cpp | 16 +++++-- .../cucumber/messages/gherkin_document.cpp | 16 +++++-- .../cucumber/messages/git.cpp | 18 +++++--- .../cucumber/messages/group.cpp | 16 +++++-- .../cucumber/messages/hook.cpp | 18 +++++--- .../cucumber/messages/java_method.cpp | 16 +++++-- .../messages/java_stack_trace_element.cpp | 16 +++++-- .../cucumber/messages/location.cpp | 14 ++++-- .../cucumber/messages/meta.cpp | 22 ++++++--- .../cucumber/messages/parameter_type.cpp | 22 ++++++--- .../cucumber/messages/parse_error.cpp | 14 ++++-- .../cucumber/messages/pickle.cpp | 24 ++++++---- .../cucumber/messages/pickle_doc_string.cpp | 14 ++++-- .../cucumber/messages/pickle_step.cpp | 20 ++++++--- .../messages/pickle_step_argument.cpp | 14 ++++-- .../cucumber/messages/pickle_table.cpp | 12 ++++- .../cucumber/messages/pickle_table_cell.cpp | 12 ++++- .../cucumber/messages/pickle_table_row.cpp | 12 ++++- .../cucumber/messages/pickle_tag.cpp | 14 ++++-- .../cucumber/messages/product.cpp | 14 ++++-- .../cucumber/messages/rule.cpp | 24 ++++++---- .../cucumber/messages/rule_child.cpp | 14 ++++-- .../cucumber/messages/scenario.cpp | 26 +++++++---- .../cucumber/messages/source.cpp | 16 +++++-- .../cucumber/messages/source_reference.cpp | 18 +++++--- .../cucumber/messages/step.cpp | 24 ++++++---- .../cucumber/messages/step_definition.cpp | 16 +++++-- .../messages/step_definition_pattern.cpp | 14 ++++-- .../cucumber/messages/step_match_argument.cpp | 14 ++++-- .../messages/step_match_arguments_list.cpp | 12 ++++- .../cucumber/messages/table_cell.cpp | 14 ++++-- .../cucumber/messages/table_row.cpp | 16 +++++-- .../cucumber/messages/tag.cpp | 16 +++++-- .../cucumber/messages/test_case.cpp | 16 +++++-- .../cucumber/messages/test_case_finished.cpp | 16 +++++-- .../cucumber/messages/test_case_started.cpp | 20 ++++++--- .../cucumber/messages/test_run_finished.cpp | 18 +++++--- .../cucumber/messages/test_run_started.cpp | 12 ++++- .../cucumber/messages/test_step.cpp | 20 ++++++--- .../cucumber/messages/test_step_finished.cpp | 18 +++++--- .../cucumber/messages/test_step_result.cpp | 18 +++++--- .../cucumber/messages/test_step_started.cpp | 16 +++++-- .../cucumber/messages/timestamp.cpp | 14 ++++-- .../messages/undefined_parameter_type.cpp | 14 ++++-- .../cucumber/messages/utils.hpp | 23 ++++++++++ .../lib/cucumber-messages/cucumber/utils.hpp | 26 ----------- jsonschema/scripts/templates/cpp.hpp.erb | 25 ++++++----- 116 files changed, 1023 insertions(+), 523 deletions(-) delete mode 100644 cpp/include/cucumber/message.hpp delete mode 100644 cpp/src/lib/cucumber-messages/cucumber/message.cpp create mode 100644 cpp/src/lib/cucumber-messages/cucumber/messages/utils.hpp delete mode 100644 cpp/src/lib/cucumber-messages/cucumber/utils.hpp diff --git a/cpp/Makefile b/cpp/Makefile index b2f0e350..34d8cb77 100644 --- a/cpp/Makefile +++ b/cpp/Makefile @@ -4,7 +4,11 @@ schemas = $(shell find ../jsonschema -name "*.json") INC_DIR = include/cucumber/messages LIB_DIR = src/lib/cucumber-messages/cucumber/messages -GEN_DIRS = $(INC_DIR) $(LIB_DIR) + +SOURCES = \ + $(shell find $(INC_DIR) -name "*.[ch]pp") \ + $(shell find $(LIB_DIR) -name "*.[ch]pp") +CMAKELISTS = $(shell find . -name CMakeLists.txt) help: ## Show this help @awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \n\nWhere is one of:\n"} /^[$$()% a-zA-Z_-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST) @@ -17,15 +21,13 @@ require: ## Check requirements for the code generation (ruby, csplit and tail ar @tail --version >/dev/null 2>&1 || (echo "ERROR: tail is required."; exit 1) clean: ## Remove automatically generated files and related artifacts - rm -rf $(GEN_DIRS) build .configured + rm -rf build .configured .generate-messages: $(schemas) ../jsonschema/scripts/codegen.rb ../jsonschema/scripts/templates/cpp.hpp.erb ../jsonschema/scripts/templates/cpp.enum.hpp.erb ruby ../jsonschema/scripts/codegen.rb Cpp ../jsonschema cpp.hpp.erb > Generated.hpp.tmp ruby ../jsonschema/scripts/codegen.rb Cpp ../jsonschema cpp.enum.hpp.erb >> Generated.hpp.tmp csplit --quiet --prefix=Generated --suffix-format=%02d.hpp.tmp --elide-empty-files Generated.hpp.tmp /^[A-Za-z_.]*[.][ch]pp/ {*} rm Generated.hpp.tmp - rm -rf $(GEN_DIRS) - mkdir -p $(GEN_DIRS) for file in Generated**; do \ F=$$(head -n 1 $$file | tr -d '\r\n'); \ @@ -40,9 +42,9 @@ clean: ## Remove automatically generated files and related artifacts clean-build: rm -rf build .configured .built -.configured: +.configured: $(CMAKELISTS) mkdir -p build cmake -S . -B build && touch $@ -.built: .configured +.built: .configured $(SOURCES) cmake --build build --parallel && touch $@ diff --git a/cpp/include/cucumber/message.hpp b/cpp/include/cucumber/message.hpp deleted file mode 100644 index 73fc1cb8..00000000 --- a/cpp/include/cucumber/message.hpp +++ /dev/null @@ -1,45 +0,0 @@ -#pragma once - -#include -#include -#include -#include - -namespace cucumber { - -struct message -{ - std::string to_string() const; -}; - -template < - typename Msg, - typename = std::enable_if_t> -> -std::ostream& -operator<<(std::ostream& os, const Msg& msg) -{ - os << msg.to_string(); - - return os; -} - -template < - typename Msg, - typename = std::enable_if_t> -> -std::ostream& -operator<<(std::ostream& os, const std::vector& msgs) -{ - os << '['; - - for (std::size_t i = 0; i < msgs.size(); ++i) { - os << (i > 0 ? ", " : "") << msgs[i]; - } - - os << ']'; - - return os; -} - -} diff --git a/cpp/include/cucumber/messages/attachment.hpp b/cpp/include/cucumber/messages/attachment.hpp index 9e0885c2..4e4166fa 100644 --- a/cpp/include/cucumber/messages/attachment.hpp +++ b/cpp/include/cucumber/messages/attachment.hpp @@ -1,8 +1,7 @@ #pragma once #include - -#include +#include #include #include @@ -27,7 +26,7 @@ namespace cucumber::messages { // // Generated code -struct attachment : cucumber::message +struct attachment { std::string body; cucumber::messages::attachment_content_encoding content_encoding; @@ -41,4 +40,7 @@ struct attachment : cucumber::message std::string to_string() const; }; +std::ostream& +operator<<(std::ostream& os, const attachment& msg); + } diff --git a/cpp/include/cucumber/messages/background.hpp b/cpp/include/cucumber/messages/background.hpp index fd6c55ca..cdbd6729 100644 --- a/cpp/include/cucumber/messages/background.hpp +++ b/cpp/include/cucumber/messages/background.hpp @@ -1,8 +1,7 @@ #pragma once #include - -#include +#include #include #include @@ -15,7 +14,7 @@ namespace cucumber::messages { // // Generated code -struct background : cucumber::message +struct background { cucumber::messages::location location; std::string keyword; @@ -27,4 +26,7 @@ struct background : cucumber::message std::string to_string() const; }; +std::ostream& +operator<<(std::ostream& os, const background& msg); + } diff --git a/cpp/include/cucumber/messages/ci.hpp b/cpp/include/cucumber/messages/ci.hpp index 8b6c3b1d..446d1741 100644 --- a/cpp/include/cucumber/messages/ci.hpp +++ b/cpp/include/cucumber/messages/ci.hpp @@ -1,8 +1,7 @@ #pragma once #include - -#include +#include #include @@ -16,7 +15,7 @@ namespace cucumber::messages { // // Generated code -struct ci : cucumber::message +struct ci { std::string name; std::string url; @@ -26,4 +25,7 @@ struct ci : cucumber::message std::string to_string() const; }; +std::ostream& +operator<<(std::ostream& os, const ci& msg); + } diff --git a/cpp/include/cucumber/messages/comment.hpp b/cpp/include/cucumber/messages/comment.hpp index 10ba50fd..cef7a694 100644 --- a/cpp/include/cucumber/messages/comment.hpp +++ b/cpp/include/cucumber/messages/comment.hpp @@ -1,8 +1,7 @@ #pragma once #include - -#include +#include #include @@ -16,7 +15,7 @@ namespace cucumber::messages { // // Generated code -struct comment : cucumber::message +struct comment { cucumber::messages::location location; std::string text; @@ -24,4 +23,7 @@ struct comment : cucumber::message std::string to_string() const; }; +std::ostream& +operator<<(std::ostream& os, const comment& msg); + } diff --git a/cpp/include/cucumber/messages/data_table.hpp b/cpp/include/cucumber/messages/data_table.hpp index 8534c1b8..192fa03c 100644 --- a/cpp/include/cucumber/messages/data_table.hpp +++ b/cpp/include/cucumber/messages/data_table.hpp @@ -1,8 +1,7 @@ #pragma once #include - -#include +#include #include #include @@ -15,7 +14,7 @@ namespace cucumber::messages { // // Generated code -struct data_table : cucumber::message +struct data_table { cucumber::messages::location location; std::vector rows; @@ -23,4 +22,7 @@ struct data_table : cucumber::message std::string to_string() const; }; +std::ostream& +operator<<(std::ostream& os, const data_table& msg); + } diff --git a/cpp/include/cucumber/messages/doc_string.hpp b/cpp/include/cucumber/messages/doc_string.hpp index ee6c3347..65df7ba5 100644 --- a/cpp/include/cucumber/messages/doc_string.hpp +++ b/cpp/include/cucumber/messages/doc_string.hpp @@ -1,8 +1,7 @@ #pragma once #include - -#include +#include #include @@ -14,7 +13,7 @@ namespace cucumber::messages { // // Generated code -struct doc_string : cucumber::message +struct doc_string { cucumber::messages::location location; std::string media_type; @@ -24,4 +23,7 @@ struct doc_string : cucumber::message std::string to_string() const; }; +std::ostream& +operator<<(std::ostream& os, const doc_string& msg); + } diff --git a/cpp/include/cucumber/messages/duration.hpp b/cpp/include/cucumber/messages/duration.hpp index a7c007d5..a72ba504 100644 --- a/cpp/include/cucumber/messages/duration.hpp +++ b/cpp/include/cucumber/messages/duration.hpp @@ -1,8 +1,7 @@ #pragma once #include - -#include +#include namespace cucumber::messages { @@ -15,7 +14,7 @@ namespace cucumber::messages { // // Generated code -struct duration : cucumber::message +struct duration { std::size_t seconds; std::size_t nanos; @@ -23,4 +22,7 @@ struct duration : cucumber::message std::string to_string() const; }; +std::ostream& +operator<<(std::ostream& os, const duration& msg); + } diff --git a/cpp/include/cucumber/messages/envelope.hpp b/cpp/include/cucumber/messages/envelope.hpp index 15b95bd4..f96db3c9 100644 --- a/cpp/include/cucumber/messages/envelope.hpp +++ b/cpp/include/cucumber/messages/envelope.hpp @@ -1,8 +1,7 @@ #pragma once #include - -#include +#include #include #include @@ -37,7 +36,7 @@ namespace cucumber::messages { // // Generated code -struct envelope : cucumber::message +struct envelope { cucumber::messages::attachment attachment; cucumber::messages::gherkin_document gherkin_document; @@ -60,4 +59,7 @@ struct envelope : cucumber::message std::string to_string() const; }; +std::ostream& +operator<<(std::ostream& os, const envelope& msg); + } diff --git a/cpp/include/cucumber/messages/examples.hpp b/cpp/include/cucumber/messages/examples.hpp index 76830096..6dc43f66 100644 --- a/cpp/include/cucumber/messages/examples.hpp +++ b/cpp/include/cucumber/messages/examples.hpp @@ -1,8 +1,7 @@ #pragma once #include - -#include +#include #include #include @@ -17,7 +16,7 @@ namespace cucumber::messages { // // Generated code -struct examples : cucumber::message +struct examples { cucumber::messages::location location; std::vector tags; @@ -31,4 +30,7 @@ struct examples : cucumber::message std::string to_string() const; }; +std::ostream& +operator<<(std::ostream& os, const examples& msg); + } diff --git a/cpp/include/cucumber/messages/exception.hpp b/cpp/include/cucumber/messages/exception.hpp index 66a92b56..cf4326b6 100644 --- a/cpp/include/cucumber/messages/exception.hpp +++ b/cpp/include/cucumber/messages/exception.hpp @@ -1,8 +1,7 @@ #pragma once #include - -#include +#include namespace cucumber::messages { @@ -14,7 +13,7 @@ namespace cucumber::messages { // // Generated code -struct exception : cucumber::message +struct exception { std::string type; std::string message; @@ -22,4 +21,7 @@ struct exception : cucumber::message std::string to_string() const; }; +std::ostream& +operator<<(std::ostream& os, const exception& msg); + } diff --git a/cpp/include/cucumber/messages/feature.hpp b/cpp/include/cucumber/messages/feature.hpp index 6e4400a5..a390253d 100644 --- a/cpp/include/cucumber/messages/feature.hpp +++ b/cpp/include/cucumber/messages/feature.hpp @@ -1,8 +1,7 @@ #pragma once #include - -#include +#include #include #include @@ -16,7 +15,7 @@ namespace cucumber::messages { // // Generated code -struct feature : cucumber::message +struct feature { cucumber::messages::location location; std::vector tags; @@ -29,4 +28,7 @@ struct feature : cucumber::message std::string to_string() const; }; +std::ostream& +operator<<(std::ostream& os, const feature& msg); + } diff --git a/cpp/include/cucumber/messages/feature_child.hpp b/cpp/include/cucumber/messages/feature_child.hpp index be45a77a..dec5e234 100644 --- a/cpp/include/cucumber/messages/feature_child.hpp +++ b/cpp/include/cucumber/messages/feature_child.hpp @@ -1,8 +1,7 @@ #pragma once #include - -#include +#include #include #include @@ -18,7 +17,7 @@ namespace cucumber::messages { // // Generated code -struct feature_child : cucumber::message +struct feature_child { cucumber::messages::rule rule; cucumber::messages::background background; @@ -27,4 +26,7 @@ struct feature_child : cucumber::message std::string to_string() const; }; +std::ostream& +operator<<(std::ostream& os, const feature_child& msg); + } diff --git a/cpp/include/cucumber/messages/gherkin_document.hpp b/cpp/include/cucumber/messages/gherkin_document.hpp index 9a4b1638..b8bdf050 100644 --- a/cpp/include/cucumber/messages/gherkin_document.hpp +++ b/cpp/include/cucumber/messages/gherkin_document.hpp @@ -1,8 +1,7 @@ #pragma once #include - -#include +#include #include #include @@ -22,7 +21,7 @@ namespace cucumber::messages { // // Generated code -struct gherkin_document : cucumber::message +struct gherkin_document { std::string uri; cucumber::messages::feature feature; @@ -31,4 +30,7 @@ struct gherkin_document : cucumber::message std::string to_string() const; }; +std::ostream& +operator<<(std::ostream& os, const gherkin_document& msg); + } diff --git a/cpp/include/cucumber/messages/git.hpp b/cpp/include/cucumber/messages/git.hpp index 0f589277..4de134b6 100644 --- a/cpp/include/cucumber/messages/git.hpp +++ b/cpp/include/cucumber/messages/git.hpp @@ -1,8 +1,7 @@ #pragma once #include - -#include +#include namespace cucumber::messages { @@ -15,7 +14,7 @@ namespace cucumber::messages { // // Generated code -struct git : cucumber::message +struct git { std::string remote; std::string revision; @@ -25,4 +24,7 @@ struct git : cucumber::message std::string to_string() const; }; +std::ostream& +operator<<(std::ostream& os, const git& msg); + } diff --git a/cpp/include/cucumber/messages/group.hpp b/cpp/include/cucumber/messages/group.hpp index a3a8efd5..bc971faa 100644 --- a/cpp/include/cucumber/messages/group.hpp +++ b/cpp/include/cucumber/messages/group.hpp @@ -1,8 +1,7 @@ #pragma once #include - -#include +#include #include @@ -14,7 +13,7 @@ namespace cucumber::messages { // // Generated code -struct group : cucumber::message +struct group { std::vector children; std::size_t start; @@ -23,4 +22,7 @@ struct group : cucumber::message std::string to_string() const; }; +std::ostream& +operator<<(std::ostream& os, const group& msg); + } diff --git a/cpp/include/cucumber/messages/hook.hpp b/cpp/include/cucumber/messages/hook.hpp index 18189272..4f1fad10 100644 --- a/cpp/include/cucumber/messages/hook.hpp +++ b/cpp/include/cucumber/messages/hook.hpp @@ -1,8 +1,7 @@ #pragma once #include - -#include +#include #include @@ -14,7 +13,7 @@ namespace cucumber::messages { // // Generated code -struct hook : cucumber::message +struct hook { std::string id; std::string name; @@ -24,4 +23,7 @@ struct hook : cucumber::message std::string to_string() const; }; +std::ostream& +operator<<(std::ostream& os, const hook& msg); + } diff --git a/cpp/include/cucumber/messages/java_method.hpp b/cpp/include/cucumber/messages/java_method.hpp index 4d5316ba..acf03c8a 100644 --- a/cpp/include/cucumber/messages/java_method.hpp +++ b/cpp/include/cucumber/messages/java_method.hpp @@ -1,8 +1,7 @@ #pragma once #include - -#include +#include namespace cucumber::messages { @@ -12,7 +11,7 @@ namespace cucumber::messages { // // Generated code -struct java_method : cucumber::message +struct java_method { std::string class_name; std::string method_name; @@ -21,4 +20,7 @@ struct java_method : cucumber::message std::string to_string() const; }; +std::ostream& +operator<<(std::ostream& os, const java_method& msg); + } diff --git a/cpp/include/cucumber/messages/java_stack_trace_element.hpp b/cpp/include/cucumber/messages/java_stack_trace_element.hpp index 6ae53794..7f3104c3 100644 --- a/cpp/include/cucumber/messages/java_stack_trace_element.hpp +++ b/cpp/include/cucumber/messages/java_stack_trace_element.hpp @@ -1,8 +1,7 @@ #pragma once #include - -#include +#include namespace cucumber::messages { @@ -12,7 +11,7 @@ namespace cucumber::messages { // // Generated code -struct java_stack_trace_element : cucumber::message +struct java_stack_trace_element { std::string class_name; std::string file_name; @@ -21,4 +20,7 @@ struct java_stack_trace_element : cucumber::message std::string to_string() const; }; +std::ostream& +operator<<(std::ostream& os, const java_stack_trace_element& msg); + } diff --git a/cpp/include/cucumber/messages/location.hpp b/cpp/include/cucumber/messages/location.hpp index 54f4835e..4221bf0d 100644 --- a/cpp/include/cucumber/messages/location.hpp +++ b/cpp/include/cucumber/messages/location.hpp @@ -1,8 +1,7 @@ #pragma once #include - -#include +#include namespace cucumber::messages { @@ -14,7 +13,7 @@ namespace cucumber::messages { // // Generated code -struct location : cucumber::message +struct location { std::size_t line; std::size_t column; @@ -22,4 +21,7 @@ struct location : cucumber::message std::string to_string() const; }; +std::ostream& +operator<<(std::ostream& os, const location& msg); + } diff --git a/cpp/include/cucumber/messages/meta.hpp b/cpp/include/cucumber/messages/meta.hpp index a4e5ce10..1afa05bf 100644 --- a/cpp/include/cucumber/messages/meta.hpp +++ b/cpp/include/cucumber/messages/meta.hpp @@ -1,8 +1,7 @@ #pragma once #include - -#include +#include #include #include @@ -21,7 +20,7 @@ namespace cucumber::messages { // // Generated code -struct meta : cucumber::message +struct meta { std::string protocol_version; cucumber::messages::product implementation; @@ -33,4 +32,7 @@ struct meta : cucumber::message std::string to_string() const; }; +std::ostream& +operator<<(std::ostream& os, const meta& msg); + } diff --git a/cpp/include/cucumber/messages/parameter_type.hpp b/cpp/include/cucumber/messages/parameter_type.hpp index fe1af92c..1a16e57e 100644 --- a/cpp/include/cucumber/messages/parameter_type.hpp +++ b/cpp/include/cucumber/messages/parameter_type.hpp @@ -1,8 +1,7 @@ #pragma once #include - -#include +#include #include @@ -14,7 +13,7 @@ namespace cucumber::messages { // // Generated code -struct parameter_type : cucumber::message +struct parameter_type { std::string name; std::vector regular_expressions; @@ -26,4 +25,7 @@ struct parameter_type : cucumber::message std::string to_string() const; }; +std::ostream& +operator<<(std::ostream& os, const parameter_type& msg); + } diff --git a/cpp/include/cucumber/messages/parse_error.hpp b/cpp/include/cucumber/messages/parse_error.hpp index df0a176b..01949b73 100644 --- a/cpp/include/cucumber/messages/parse_error.hpp +++ b/cpp/include/cucumber/messages/parse_error.hpp @@ -1,8 +1,7 @@ #pragma once #include - -#include +#include #include @@ -14,7 +13,7 @@ namespace cucumber::messages { // // Generated code -struct parse_error : cucumber::message +struct parse_error { cucumber::messages::source_reference source; std::string message; @@ -22,4 +21,7 @@ struct parse_error : cucumber::message std::string to_string() const; }; +std::ostream& +operator<<(std::ostream& os, const parse_error& msg); + } diff --git a/cpp/include/cucumber/messages/pickle.hpp b/cpp/include/cucumber/messages/pickle.hpp index aa37a256..46fdf7ff 100644 --- a/cpp/include/cucumber/messages/pickle.hpp +++ b/cpp/include/cucumber/messages/pickle.hpp @@ -1,8 +1,7 @@ #pragma once #include - -#include +#include #include #include @@ -28,7 +27,7 @@ namespace cucumber::messages { // // Generated code -struct pickle : cucumber::message +struct pickle { std::string id; std::string uri; @@ -41,4 +40,7 @@ struct pickle : cucumber::message std::string to_string() const; }; +std::ostream& +operator<<(std::ostream& os, const pickle& msg); + } diff --git a/cpp/include/cucumber/messages/pickle_doc_string.hpp b/cpp/include/cucumber/messages/pickle_doc_string.hpp index 658e3f48..fe474f3e 100644 --- a/cpp/include/cucumber/messages/pickle_doc_string.hpp +++ b/cpp/include/cucumber/messages/pickle_doc_string.hpp @@ -1,8 +1,7 @@ #pragma once #include - -#include +#include namespace cucumber::messages { @@ -12,7 +11,7 @@ namespace cucumber::messages { // // Generated code -struct pickle_doc_string : cucumber::message +struct pickle_doc_string { std::string media_type; std::string content; @@ -20,4 +19,7 @@ struct pickle_doc_string : cucumber::message std::string to_string() const; }; +std::ostream& +operator<<(std::ostream& os, const pickle_doc_string& msg); + } diff --git a/cpp/include/cucumber/messages/pickle_step.hpp b/cpp/include/cucumber/messages/pickle_step.hpp index de4879ed..33d117b1 100644 --- a/cpp/include/cucumber/messages/pickle_step.hpp +++ b/cpp/include/cucumber/messages/pickle_step.hpp @@ -1,8 +1,7 @@ #pragma once #include - -#include +#include #include #include @@ -17,7 +16,7 @@ namespace cucumber::messages { // // Generated code -struct pickle_step : cucumber::message +struct pickle_step { cucumber::messages::pickle_step_argument argument; std::vector ast_node_ids; @@ -28,4 +27,7 @@ struct pickle_step : cucumber::message std::string to_string() const; }; +std::ostream& +operator<<(std::ostream& os, const pickle_step& msg); + } diff --git a/cpp/include/cucumber/messages/pickle_step_argument.hpp b/cpp/include/cucumber/messages/pickle_step_argument.hpp index 7b988e2a..6f59690b 100644 --- a/cpp/include/cucumber/messages/pickle_step_argument.hpp +++ b/cpp/include/cucumber/messages/pickle_step_argument.hpp @@ -1,8 +1,7 @@ #pragma once #include - -#include +#include #include #include @@ -17,7 +16,7 @@ namespace cucumber::messages { // // Generated code -struct pickle_step_argument : cucumber::message +struct pickle_step_argument { cucumber::messages::pickle_doc_string doc_string; cucumber::messages::pickle_table data_table; @@ -25,4 +24,7 @@ struct pickle_step_argument : cucumber::message std::string to_string() const; }; +std::ostream& +operator<<(std::ostream& os, const pickle_step_argument& msg); + } diff --git a/cpp/include/cucumber/messages/pickle_table.hpp b/cpp/include/cucumber/messages/pickle_table.hpp index 0166bd15..5dee89e2 100644 --- a/cpp/include/cucumber/messages/pickle_table.hpp +++ b/cpp/include/cucumber/messages/pickle_table.hpp @@ -1,8 +1,7 @@ #pragma once #include - -#include +#include #include @@ -14,11 +13,14 @@ namespace cucumber::messages { // // Generated code -struct pickle_table : cucumber::message +struct pickle_table { std::vector rows; std::string to_string() const; }; +std::ostream& +operator<<(std::ostream& os, const pickle_table& msg); + } diff --git a/cpp/include/cucumber/messages/pickle_table_cell.hpp b/cpp/include/cucumber/messages/pickle_table_cell.hpp index 5a2a57e2..c26e2c3d 100644 --- a/cpp/include/cucumber/messages/pickle_table_cell.hpp +++ b/cpp/include/cucumber/messages/pickle_table_cell.hpp @@ -1,8 +1,7 @@ #pragma once #include - -#include +#include namespace cucumber::messages { @@ -12,11 +11,14 @@ namespace cucumber::messages { // // Generated code -struct pickle_table_cell : cucumber::message +struct pickle_table_cell { std::string value; std::string to_string() const; }; +std::ostream& +operator<<(std::ostream& os, const pickle_table_cell& msg); + } diff --git a/cpp/include/cucumber/messages/pickle_table_row.hpp b/cpp/include/cucumber/messages/pickle_table_row.hpp index fa2c0636..5942bfae 100644 --- a/cpp/include/cucumber/messages/pickle_table_row.hpp +++ b/cpp/include/cucumber/messages/pickle_table_row.hpp @@ -1,8 +1,7 @@ #pragma once #include - -#include +#include #include @@ -14,11 +13,14 @@ namespace cucumber::messages { // // Generated code -struct pickle_table_row : cucumber::message +struct pickle_table_row { std::vector cells; std::string to_string() const; }; +std::ostream& +operator<<(std::ostream& os, const pickle_table_row& msg); + } diff --git a/cpp/include/cucumber/messages/pickle_tag.hpp b/cpp/include/cucumber/messages/pickle_tag.hpp index 1e961ede..355c4cb7 100644 --- a/cpp/include/cucumber/messages/pickle_tag.hpp +++ b/cpp/include/cucumber/messages/pickle_tag.hpp @@ -1,8 +1,7 @@ #pragma once #include - -#include +#include namespace cucumber::messages { @@ -14,7 +13,7 @@ namespace cucumber::messages { // // Generated code -struct pickle_tag : cucumber::message +struct pickle_tag { std::string name; std::string ast_node_id; @@ -22,4 +21,7 @@ struct pickle_tag : cucumber::message std::string to_string() const; }; +std::ostream& +operator<<(std::ostream& os, const pickle_tag& msg); + } diff --git a/cpp/include/cucumber/messages/product.hpp b/cpp/include/cucumber/messages/product.hpp index a25035a8..c5a90bfa 100644 --- a/cpp/include/cucumber/messages/product.hpp +++ b/cpp/include/cucumber/messages/product.hpp @@ -1,8 +1,7 @@ #pragma once #include - -#include +#include namespace cucumber::messages { @@ -14,7 +13,7 @@ namespace cucumber::messages { // // Generated code -struct product : cucumber::message +struct product { std::string name; std::string version; @@ -22,4 +21,7 @@ struct product : cucumber::message std::string to_string() const; }; +std::ostream& +operator<<(std::ostream& os, const product& msg); + } diff --git a/cpp/include/cucumber/messages/rule.hpp b/cpp/include/cucumber/messages/rule.hpp index 399fc2c1..8675de74 100644 --- a/cpp/include/cucumber/messages/rule.hpp +++ b/cpp/include/cucumber/messages/rule.hpp @@ -1,8 +1,7 @@ #pragma once #include - -#include +#include #include #include @@ -16,7 +15,7 @@ namespace cucumber::messages { // // Generated code -struct rule : cucumber::message +struct rule { cucumber::messages::location location; std::vector tags; @@ -29,4 +28,7 @@ struct rule : cucumber::message std::string to_string() const; }; +std::ostream& +operator<<(std::ostream& os, const rule& msg); + } diff --git a/cpp/include/cucumber/messages/rule_child.hpp b/cpp/include/cucumber/messages/rule_child.hpp index e1214220..3d90a2db 100644 --- a/cpp/include/cucumber/messages/rule_child.hpp +++ b/cpp/include/cucumber/messages/rule_child.hpp @@ -1,8 +1,7 @@ #pragma once #include - -#include +#include #include #include @@ -17,7 +16,7 @@ namespace cucumber::messages { // // Generated code -struct rule_child : cucumber::message +struct rule_child { cucumber::messages::background background; cucumber::messages::scenario scenario; @@ -25,4 +24,7 @@ struct rule_child : cucumber::message std::string to_string() const; }; +std::ostream& +operator<<(std::ostream& os, const rule_child& msg); + } diff --git a/cpp/include/cucumber/messages/scenario.hpp b/cpp/include/cucumber/messages/scenario.hpp index 2f2dd2ac..62e5c489 100644 --- a/cpp/include/cucumber/messages/scenario.hpp +++ b/cpp/include/cucumber/messages/scenario.hpp @@ -1,8 +1,7 @@ #pragma once #include - -#include +#include #include #include @@ -17,7 +16,7 @@ namespace cucumber::messages { // // Generated code -struct scenario : cucumber::message +struct scenario { cucumber::messages::location location; std::vector tags; @@ -31,4 +30,7 @@ struct scenario : cucumber::message std::string to_string() const; }; +std::ostream& +operator<<(std::ostream& os, const scenario& msg); + } diff --git a/cpp/include/cucumber/messages/source.hpp b/cpp/include/cucumber/messages/source.hpp index f312cdf6..30f9e786 100644 --- a/cpp/include/cucumber/messages/source.hpp +++ b/cpp/include/cucumber/messages/source.hpp @@ -1,8 +1,7 @@ #pragma once #include - -#include +#include #include @@ -18,7 +17,7 @@ namespace cucumber::messages { // // Generated code -struct source : cucumber::message +struct source { std::string uri; std::string data; @@ -27,4 +26,7 @@ struct source : cucumber::message std::string to_string() const; }; +std::ostream& +operator<<(std::ostream& os, const source& msg); + } diff --git a/cpp/include/cucumber/messages/source_reference.hpp b/cpp/include/cucumber/messages/source_reference.hpp index ddf8d736..46366bdb 100644 --- a/cpp/include/cucumber/messages/source_reference.hpp +++ b/cpp/include/cucumber/messages/source_reference.hpp @@ -1,8 +1,7 @@ #pragma once #include - -#include +#include #include #include @@ -19,7 +18,7 @@ namespace cucumber::messages { // // Generated code -struct source_reference : cucumber::message +struct source_reference { std::string uri; cucumber::messages::java_method java_method; @@ -29,4 +28,7 @@ struct source_reference : cucumber::message std::string to_string() const; }; +std::ostream& +operator<<(std::ostream& os, const source_reference& msg); + } diff --git a/cpp/include/cucumber/messages/step.hpp b/cpp/include/cucumber/messages/step.hpp index 3a5ec69d..9f37c874 100644 --- a/cpp/include/cucumber/messages/step.hpp +++ b/cpp/include/cucumber/messages/step.hpp @@ -1,8 +1,7 @@ #pragma once #include - -#include +#include #include #include @@ -19,7 +18,7 @@ namespace cucumber::messages { // // Generated code -struct step : cucumber::message +struct step { cucumber::messages::location location; std::string keyword; @@ -32,4 +31,7 @@ struct step : cucumber::message std::string to_string() const; }; +std::ostream& +operator<<(std::ostream& os, const step& msg); + } diff --git a/cpp/include/cucumber/messages/step_definition.hpp b/cpp/include/cucumber/messages/step_definition.hpp index 87b3b96c..49922e33 100644 --- a/cpp/include/cucumber/messages/step_definition.hpp +++ b/cpp/include/cucumber/messages/step_definition.hpp @@ -1,8 +1,7 @@ #pragma once #include - -#include +#include #include #include @@ -15,7 +14,7 @@ namespace cucumber::messages { // // Generated code -struct step_definition : cucumber::message +struct step_definition { std::string id; cucumber::messages::step_definition_pattern pattern; @@ -24,4 +23,7 @@ struct step_definition : cucumber::message std::string to_string() const; }; +std::ostream& +operator<<(std::ostream& os, const step_definition& msg); + } diff --git a/cpp/include/cucumber/messages/step_definition_pattern.hpp b/cpp/include/cucumber/messages/step_definition_pattern.hpp index e14e5d26..cbb39b24 100644 --- a/cpp/include/cucumber/messages/step_definition_pattern.hpp +++ b/cpp/include/cucumber/messages/step_definition_pattern.hpp @@ -1,8 +1,7 @@ #pragma once #include - -#include +#include #include @@ -14,7 +13,7 @@ namespace cucumber::messages { // // Generated code -struct step_definition_pattern : cucumber::message +struct step_definition_pattern { std::string source; cucumber::messages::step_definition_pattern_type type; @@ -22,4 +21,7 @@ struct step_definition_pattern : cucumber::message std::string to_string() const; }; +std::ostream& +operator<<(std::ostream& os, const step_definition_pattern& msg); + } diff --git a/cpp/include/cucumber/messages/step_match_argument.hpp b/cpp/include/cucumber/messages/step_match_argument.hpp index c03bd9e9..d4c06da4 100644 --- a/cpp/include/cucumber/messages/step_match_argument.hpp +++ b/cpp/include/cucumber/messages/step_match_argument.hpp @@ -1,8 +1,7 @@ #pragma once #include - -#include +#include #include @@ -21,7 +20,7 @@ namespace cucumber::messages { // // Generated code -struct step_match_argument : cucumber::message +struct step_match_argument { cucumber::messages::group group; std::string parameter_type_name; @@ -29,4 +28,7 @@ struct step_match_argument : cucumber::message std::string to_string() const; }; +std::ostream& +operator<<(std::ostream& os, const step_match_argument& msg); + } diff --git a/cpp/include/cucumber/messages/step_match_arguments_list.hpp b/cpp/include/cucumber/messages/step_match_arguments_list.hpp index aa4a9316..19965e5a 100644 --- a/cpp/include/cucumber/messages/step_match_arguments_list.hpp +++ b/cpp/include/cucumber/messages/step_match_arguments_list.hpp @@ -1,8 +1,7 @@ #pragma once #include - -#include +#include #include @@ -14,11 +13,14 @@ namespace cucumber::messages { // // Generated code -struct step_match_arguments_list : cucumber::message +struct step_match_arguments_list { std::vector step_match_arguments; std::string to_string() const; }; +std::ostream& +operator<<(std::ostream& os, const step_match_arguments_list& msg); + } diff --git a/cpp/include/cucumber/messages/table_cell.hpp b/cpp/include/cucumber/messages/table_cell.hpp index 664fb288..e22fa77c 100644 --- a/cpp/include/cucumber/messages/table_cell.hpp +++ b/cpp/include/cucumber/messages/table_cell.hpp @@ -1,8 +1,7 @@ #pragma once #include - -#include +#include #include @@ -16,7 +15,7 @@ namespace cucumber::messages { // // Generated code -struct table_cell : cucumber::message +struct table_cell { cucumber::messages::location location; std::string value; @@ -24,4 +23,7 @@ struct table_cell : cucumber::message std::string to_string() const; }; +std::ostream& +operator<<(std::ostream& os, const table_cell& msg); + } diff --git a/cpp/include/cucumber/messages/table_row.hpp b/cpp/include/cucumber/messages/table_row.hpp index 4ea9b94d..4b79f7e8 100644 --- a/cpp/include/cucumber/messages/table_row.hpp +++ b/cpp/include/cucumber/messages/table_row.hpp @@ -1,8 +1,7 @@ #pragma once #include - -#include +#include #include #include @@ -17,7 +16,7 @@ namespace cucumber::messages { // // Generated code -struct table_row : cucumber::message +struct table_row { cucumber::messages::location location; std::vector cells; @@ -26,4 +25,7 @@ struct table_row : cucumber::message std::string to_string() const; }; +std::ostream& +operator<<(std::ostream& os, const table_row& msg); + } diff --git a/cpp/include/cucumber/messages/tag.hpp b/cpp/include/cucumber/messages/tag.hpp index a85bf370..aa880cf6 100644 --- a/cpp/include/cucumber/messages/tag.hpp +++ b/cpp/include/cucumber/messages/tag.hpp @@ -1,8 +1,7 @@ #pragma once #include - -#include +#include #include @@ -16,7 +15,7 @@ namespace cucumber::messages { // // Generated code -struct tag : cucumber::message +struct tag { cucumber::messages::location location; std::string name; @@ -25,4 +24,7 @@ struct tag : cucumber::message std::string to_string() const; }; +std::ostream& +operator<<(std::ostream& os, const tag& msg); + } diff --git a/cpp/include/cucumber/messages/test_case.hpp b/cpp/include/cucumber/messages/test_case.hpp index 6e150da8..732d884f 100644 --- a/cpp/include/cucumber/messages/test_case.hpp +++ b/cpp/include/cucumber/messages/test_case.hpp @@ -1,8 +1,7 @@ #pragma once #include - -#include +#include #include @@ -18,7 +17,7 @@ namespace cucumber::messages { // // Generated code -struct test_case : cucumber::message +struct test_case { std::string id; std::string pickle_id; @@ -27,4 +26,7 @@ struct test_case : cucumber::message std::string to_string() const; }; +std::ostream& +operator<<(std::ostream& os, const test_case& msg); + } diff --git a/cpp/include/cucumber/messages/test_case_finished.hpp b/cpp/include/cucumber/messages/test_case_finished.hpp index 6285fdab..934f49c3 100644 --- a/cpp/include/cucumber/messages/test_case_finished.hpp +++ b/cpp/include/cucumber/messages/test_case_finished.hpp @@ -1,8 +1,7 @@ #pragma once #include - -#include +#include #include @@ -14,7 +13,7 @@ namespace cucumber::messages { // // Generated code -struct test_case_finished : cucumber::message +struct test_case_finished { std::string test_case_started_id; cucumber::messages::timestamp timestamp; @@ -23,4 +22,7 @@ struct test_case_finished : cucumber::message std::string to_string() const; }; +std::ostream& +operator<<(std::ostream& os, const test_case_finished& msg); + } diff --git a/cpp/include/cucumber/messages/test_case_started.hpp b/cpp/include/cucumber/messages/test_case_started.hpp index deb6012b..f5116942 100644 --- a/cpp/include/cucumber/messages/test_case_started.hpp +++ b/cpp/include/cucumber/messages/test_case_started.hpp @@ -1,8 +1,7 @@ #pragma once #include - -#include +#include #include @@ -14,7 +13,7 @@ namespace cucumber::messages { // // Generated code -struct test_case_started : cucumber::message +struct test_case_started { std::size_t attempt; std::string id; @@ -25,4 +24,7 @@ struct test_case_started : cucumber::message std::string to_string() const; }; +std::ostream& +operator<<(std::ostream& os, const test_case_started& msg); + } diff --git a/cpp/include/cucumber/messages/test_run_finished.hpp b/cpp/include/cucumber/messages/test_run_finished.hpp index f8e11360..857e8edf 100644 --- a/cpp/include/cucumber/messages/test_run_finished.hpp +++ b/cpp/include/cucumber/messages/test_run_finished.hpp @@ -1,8 +1,7 @@ #pragma once #include - -#include +#include #include #include @@ -15,7 +14,7 @@ namespace cucumber::messages { // // Generated code -struct test_run_finished : cucumber::message +struct test_run_finished { std::string message; bool success; @@ -25,4 +24,7 @@ struct test_run_finished : cucumber::message std::string to_string() const; }; +std::ostream& +operator<<(std::ostream& os, const test_run_finished& msg); + } diff --git a/cpp/include/cucumber/messages/test_run_started.hpp b/cpp/include/cucumber/messages/test_run_started.hpp index 6195cae0..66850a69 100644 --- a/cpp/include/cucumber/messages/test_run_started.hpp +++ b/cpp/include/cucumber/messages/test_run_started.hpp @@ -1,8 +1,7 @@ #pragma once #include - -#include +#include #include @@ -14,11 +13,14 @@ namespace cucumber::messages { // // Generated code -struct test_run_started : cucumber::message +struct test_run_started { cucumber::messages::timestamp timestamp; std::string to_string() const; }; +std::ostream& +operator<<(std::ostream& os, const test_run_started& msg); + } diff --git a/cpp/include/cucumber/messages/test_step.hpp b/cpp/include/cucumber/messages/test_step.hpp index 027dbfc3..d8e83469 100644 --- a/cpp/include/cucumber/messages/test_step.hpp +++ b/cpp/include/cucumber/messages/test_step.hpp @@ -1,8 +1,7 @@ #pragma once #include - -#include +#include #include @@ -17,7 +16,7 @@ namespace cucumber::messages { // // Generated code -struct test_step : cucumber::message +struct test_step { std::string hook_id; std::string id; @@ -28,4 +27,7 @@ struct test_step : cucumber::message std::string to_string() const; }; +std::ostream& +operator<<(std::ostream& os, const test_step& msg); + } diff --git a/cpp/include/cucumber/messages/test_step_finished.hpp b/cpp/include/cucumber/messages/test_step_finished.hpp index 9934d92a..30619dad 100644 --- a/cpp/include/cucumber/messages/test_step_finished.hpp +++ b/cpp/include/cucumber/messages/test_step_finished.hpp @@ -1,8 +1,7 @@ #pragma once #include - -#include +#include #include #include @@ -15,7 +14,7 @@ namespace cucumber::messages { // // Generated code -struct test_step_finished : cucumber::message +struct test_step_finished { std::string test_case_started_id; std::string test_step_id; @@ -25,4 +24,7 @@ struct test_step_finished : cucumber::message std::string to_string() const; }; +std::ostream& +operator<<(std::ostream& os, const test_step_finished& msg); + } diff --git a/cpp/include/cucumber/messages/test_step_result.hpp b/cpp/include/cucumber/messages/test_step_result.hpp index c647d48f..c80e9752 100644 --- a/cpp/include/cucumber/messages/test_step_result.hpp +++ b/cpp/include/cucumber/messages/test_step_result.hpp @@ -1,8 +1,7 @@ #pragma once #include - -#include +#include #include #include @@ -16,7 +15,7 @@ namespace cucumber::messages { // // Generated code -struct test_step_result : cucumber::message +struct test_step_result { cucumber::messages::duration duration; std::string message; @@ -26,4 +25,7 @@ struct test_step_result : cucumber::message std::string to_string() const; }; +std::ostream& +operator<<(std::ostream& os, const test_step_result& msg); + } diff --git a/cpp/include/cucumber/messages/test_step_started.hpp b/cpp/include/cucumber/messages/test_step_started.hpp index 7c427217..428c0b8d 100644 --- a/cpp/include/cucumber/messages/test_step_started.hpp +++ b/cpp/include/cucumber/messages/test_step_started.hpp @@ -1,8 +1,7 @@ #pragma once #include - -#include +#include #include @@ -14,7 +13,7 @@ namespace cucumber::messages { // // Generated code -struct test_step_started : cucumber::message +struct test_step_started { std::string test_case_started_id; std::string test_step_id; @@ -23,4 +22,7 @@ struct test_step_started : cucumber::message std::string to_string() const; }; +std::ostream& +operator<<(std::ostream& os, const test_step_started& msg); + } diff --git a/cpp/include/cucumber/messages/timestamp.hpp b/cpp/include/cucumber/messages/timestamp.hpp index 77440fa9..f2796e96 100644 --- a/cpp/include/cucumber/messages/timestamp.hpp +++ b/cpp/include/cucumber/messages/timestamp.hpp @@ -1,8 +1,7 @@ #pragma once #include - -#include +#include namespace cucumber::messages { @@ -12,7 +11,7 @@ namespace cucumber::messages { // // Generated code -struct timestamp : cucumber::message +struct timestamp { std::size_t seconds; std::size_t nanos; @@ -20,4 +19,7 @@ struct timestamp : cucumber::message std::string to_string() const; }; +std::ostream& +operator<<(std::ostream& os, const timestamp& msg); + } diff --git a/cpp/include/cucumber/messages/undefined_parameter_type.hpp b/cpp/include/cucumber/messages/undefined_parameter_type.hpp index 3a537365..cf410fa9 100644 --- a/cpp/include/cucumber/messages/undefined_parameter_type.hpp +++ b/cpp/include/cucumber/messages/undefined_parameter_type.hpp @@ -1,8 +1,7 @@ #pragma once #include - -#include +#include namespace cucumber::messages { @@ -12,7 +11,7 @@ namespace cucumber::messages { // // Generated code -struct undefined_parameter_type : cucumber::message +struct undefined_parameter_type { std::string expression; std::string name; @@ -20,4 +19,7 @@ struct undefined_parameter_type : cucumber::message std::string to_string() const; }; +std::ostream& +operator<<(std::ostream& os, const undefined_parameter_type& msg); + } diff --git a/cpp/src/lib/cucumber-messages/cucumber/message.cpp b/cpp/src/lib/cucumber-messages/cucumber/message.cpp deleted file mode 100644 index 4b6e855a..00000000 --- a/cpp/src/lib/cucumber-messages/cucumber/message.cpp +++ /dev/null @@ -1,9 +0,0 @@ -#include - -namespace cucumber { - -std::string -message::to_string() const -{ return "message"; } - -} diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/attachment.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/attachment.cpp index ca746bcd..9cfeff5c 100644 --- a/cpp/src/lib/cucumber-messages/cucumber/messages/attachment.cpp +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/attachment.cpp @@ -1,6 +1,6 @@ #include -#include +#include #include namespace cucumber::messages { @@ -11,17 +11,25 @@ attachment::to_string() const std::ostringstream oss; oss - << "body=" << body - << ", content_encoding=" << content_encoding - << ", file_name=" << file_name - << ", media_type=" << media_type - << ", source=" << source - << ", test_case_started_id=" << test_case_started_id - << ", test_step_id=" << test_step_id - << ", url=" << url + << "body=" << body + << ", content_encoding=" << content_encoding + << ", file_name=" << file_name + << ", media_type=" << media_type + << ", source=" << source + << ", test_case_started_id=" << test_case_started_id + << ", test_step_id=" << test_step_id + << ", url=" << url ; return oss.str(); } +std::ostream& +operator<<(std::ostream& os, const attachment& msg) +{ + os << msg.to_string(); + + return os; +} + } diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/background.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/background.cpp index 0bb90e65..8b54b1d0 100644 --- a/cpp/src/lib/cucumber-messages/cucumber/messages/background.cpp +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/background.cpp @@ -1,6 +1,6 @@ #include -#include +#include #include namespace cucumber::messages { @@ -11,15 +11,23 @@ background::to_string() const std::ostringstream oss; oss - << "location=" << location - << ", keyword=" << keyword - << ", name=" << name - << ", description=" << description - << ", steps=" << steps - << ", id=" << id + << "location=" << location + << ", keyword=" << keyword + << ", name=" << name + << ", description=" << description + << ", steps=" << steps + << ", id=" << id ; return oss.str(); } +std::ostream& +operator<<(std::ostream& os, const background& msg) +{ + os << msg.to_string(); + + return os; +} + } diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/ci.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/ci.cpp index 5e1f2d89..fef2d216 100644 --- a/cpp/src/lib/cucumber-messages/cucumber/messages/ci.cpp +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/ci.cpp @@ -1,6 +1,6 @@ #include -#include +#include #include namespace cucumber::messages { @@ -11,13 +11,21 @@ ci::to_string() const std::ostringstream oss; oss - << "name=" << name - << ", url=" << url - << ", build_number=" << build_number - << ", git=" << git + << "name=" << name + << ", url=" << url + << ", build_number=" << build_number + << ", git=" << git ; return oss.str(); } +std::ostream& +operator<<(std::ostream& os, const ci& msg) +{ + os << msg.to_string(); + + return os; +} + } diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/comment.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/comment.cpp index b4d6db2d..2a7431bf 100644 --- a/cpp/src/lib/cucumber-messages/cucumber/messages/comment.cpp +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/comment.cpp @@ -1,6 +1,6 @@ #include -#include +#include #include namespace cucumber::messages { @@ -11,11 +11,19 @@ comment::to_string() const std::ostringstream oss; oss - << "location=" << location - << ", text=" << text + << "location=" << location + << ", text=" << text ; return oss.str(); } +std::ostream& +operator<<(std::ostream& os, const comment& msg) +{ + os << msg.to_string(); + + return os; +} + } diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/data_table.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/data_table.cpp index 5d8c947d..f268e05a 100644 --- a/cpp/src/lib/cucumber-messages/cucumber/messages/data_table.cpp +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/data_table.cpp @@ -1,6 +1,6 @@ #include -#include +#include #include namespace cucumber::messages { @@ -11,11 +11,19 @@ data_table::to_string() const std::ostringstream oss; oss - << "location=" << location - << ", rows=" << rows + << "location=" << location + << ", rows=" << rows ; return oss.str(); } +std::ostream& +operator<<(std::ostream& os, const data_table& msg) +{ + os << msg.to_string(); + + return os; +} + } diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/doc_string.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/doc_string.cpp index c60de5ec..008c2ff9 100644 --- a/cpp/src/lib/cucumber-messages/cucumber/messages/doc_string.cpp +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/doc_string.cpp @@ -1,6 +1,6 @@ #include -#include +#include #include namespace cucumber::messages { @@ -11,13 +11,21 @@ doc_string::to_string() const std::ostringstream oss; oss - << "location=" << location - << ", media_type=" << media_type - << ", content=" << content - << ", delimiter=" << delimiter + << "location=" << location + << ", media_type=" << media_type + << ", content=" << content + << ", delimiter=" << delimiter ; return oss.str(); } +std::ostream& +operator<<(std::ostream& os, const doc_string& msg) +{ + os << msg.to_string(); + + return os; +} + } diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/duration.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/duration.cpp index 067a21e3..b07bbcf3 100644 --- a/cpp/src/lib/cucumber-messages/cucumber/messages/duration.cpp +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/duration.cpp @@ -1,6 +1,6 @@ #include -#include +#include #include namespace cucumber::messages { @@ -11,11 +11,19 @@ duration::to_string() const std::ostringstream oss; oss - << "seconds=" << seconds - << ", nanos=" << nanos + << "seconds=" << seconds + << ", nanos=" << nanos ; return oss.str(); } +std::ostream& +operator<<(std::ostream& os, const duration& msg) +{ + os << msg.to_string(); + + return os; +} + } diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/envelope.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/envelope.cpp index 9706f5a0..dfb6636a 100644 --- a/cpp/src/lib/cucumber-messages/cucumber/messages/envelope.cpp +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/envelope.cpp @@ -1,6 +1,6 @@ #include -#include +#include #include namespace cucumber::messages { @@ -11,26 +11,34 @@ envelope::to_string() const std::ostringstream oss; oss - << "attachment=" << attachment - << ", gherkin_document=" << gherkin_document - << ", hook=" << hook - << ", meta=" << meta - << ", parameter_type=" << parameter_type - << ", parse_error=" << parse_error - << ", pickle=" << pickle - << ", source=" << source - << ", step_definition=" << step_definition - << ", test_case=" << test_case - << ", test_case_finished=" << test_case_finished - << ", test_case_started=" << test_case_started - << ", test_run_finished=" << test_run_finished - << ", test_run_started=" << test_run_started - << ", test_step_finished=" << test_step_finished - << ", test_step_started=" << test_step_started - << ", undefined_parameter_type=" << undefined_parameter_type + << "attachment=" << attachment + << ", gherkin_document=" << gherkin_document + << ", hook=" << hook + << ", meta=" << meta + << ", parameter_type=" << parameter_type + << ", parse_error=" << parse_error + << ", pickle=" << pickle + << ", source=" << source + << ", step_definition=" << step_definition + << ", test_case=" << test_case + << ", test_case_finished=" << test_case_finished + << ", test_case_started=" << test_case_started + << ", test_run_finished=" << test_run_finished + << ", test_run_started=" << test_run_started + << ", test_step_finished=" << test_step_finished + << ", test_step_started=" << test_step_started + << ", undefined_parameter_type=" << undefined_parameter_type ; return oss.str(); } +std::ostream& +operator<<(std::ostream& os, const envelope& msg) +{ + os << msg.to_string(); + + return os; +} + } diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/examples.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/examples.cpp index 5d3e39eb..e4e0e119 100644 --- a/cpp/src/lib/cucumber-messages/cucumber/messages/examples.cpp +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/examples.cpp @@ -1,6 +1,6 @@ #include -#include +#include #include namespace cucumber::messages { @@ -11,17 +11,25 @@ examples::to_string() const std::ostringstream oss; oss - << "location=" << location - << ", tags=" << tags - << ", keyword=" << keyword - << ", name=" << name - << ", description=" << description - << ", table_header=" << table_header - << ", table_body=" << table_body - << ", id=" << id + << "location=" << location + << ", tags=" << tags + << ", keyword=" << keyword + << ", name=" << name + << ", description=" << description + << ", table_header=" << table_header + << ", table_body=" << table_body + << ", id=" << id ; return oss.str(); } +std::ostream& +operator<<(std::ostream& os, const examples& msg) +{ + os << msg.to_string(); + + return os; +} + } diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/exception.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/exception.cpp index 39342acf..dadc89ec 100644 --- a/cpp/src/lib/cucumber-messages/cucumber/messages/exception.cpp +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/exception.cpp @@ -1,6 +1,6 @@ #include -#include +#include #include namespace cucumber::messages { @@ -11,11 +11,19 @@ exception::to_string() const std::ostringstream oss; oss - << "type=" << type - << ", message=" << message + << "type=" << type + << ", message=" << message ; return oss.str(); } +std::ostream& +operator<<(std::ostream& os, const exception& msg) +{ + os << msg.to_string(); + + return os; +} + } diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/feature.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/feature.cpp index d01b402e..61764165 100644 --- a/cpp/src/lib/cucumber-messages/cucumber/messages/feature.cpp +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/feature.cpp @@ -1,6 +1,6 @@ #include -#include +#include #include namespace cucumber::messages { @@ -11,16 +11,24 @@ feature::to_string() const std::ostringstream oss; oss - << "location=" << location - << ", tags=" << tags - << ", language=" << language - << ", keyword=" << keyword - << ", name=" << name - << ", description=" << description - << ", children=" << children + << "location=" << location + << ", tags=" << tags + << ", language=" << language + << ", keyword=" << keyword + << ", name=" << name + << ", description=" << description + << ", children=" << children ; return oss.str(); } +std::ostream& +operator<<(std::ostream& os, const feature& msg) +{ + os << msg.to_string(); + + return os; +} + } diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/feature_child.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/feature_child.cpp index 89b06794..7830f4f7 100644 --- a/cpp/src/lib/cucumber-messages/cucumber/messages/feature_child.cpp +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/feature_child.cpp @@ -1,6 +1,6 @@ #include -#include +#include #include namespace cucumber::messages { @@ -11,12 +11,20 @@ feature_child::to_string() const std::ostringstream oss; oss - << "rule=" << rule - << ", background=" << background - << ", scenario=" << scenario + << "rule=" << rule + << ", background=" << background + << ", scenario=" << scenario ; return oss.str(); } +std::ostream& +operator<<(std::ostream& os, const feature_child& msg) +{ + os << msg.to_string(); + + return os; +} + } diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/gherkin_document.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/gherkin_document.cpp index 989d604b..b0c5f45f 100644 --- a/cpp/src/lib/cucumber-messages/cucumber/messages/gherkin_document.cpp +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/gherkin_document.cpp @@ -1,6 +1,6 @@ #include -#include +#include #include namespace cucumber::messages { @@ -11,12 +11,20 @@ gherkin_document::to_string() const std::ostringstream oss; oss - << "uri=" << uri - << ", feature=" << feature - << ", comments=" << comments + << "uri=" << uri + << ", feature=" << feature + << ", comments=" << comments ; return oss.str(); } +std::ostream& +operator<<(std::ostream& os, const gherkin_document& msg) +{ + os << msg.to_string(); + + return os; +} + } diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/git.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/git.cpp index 2ee1a0a6..77788f60 100644 --- a/cpp/src/lib/cucumber-messages/cucumber/messages/git.cpp +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/git.cpp @@ -1,6 +1,6 @@ #include -#include +#include #include namespace cucumber::messages { @@ -11,13 +11,21 @@ git::to_string() const std::ostringstream oss; oss - << "remote=" << remote - << ", revision=" << revision - << ", branch=" << branch - << ", tag=" << tag + << "remote=" << remote + << ", revision=" << revision + << ", branch=" << branch + << ", tag=" << tag ; return oss.str(); } +std::ostream& +operator<<(std::ostream& os, const git& msg) +{ + os << msg.to_string(); + + return os; +} + } diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/group.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/group.cpp index 526c259c..2ef52c2a 100644 --- a/cpp/src/lib/cucumber-messages/cucumber/messages/group.cpp +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/group.cpp @@ -1,6 +1,6 @@ #include -#include +#include #include namespace cucumber::messages { @@ -11,12 +11,20 @@ group::to_string() const std::ostringstream oss; oss - << "children=" << children - << ", start=" << start - << ", value=" << value + << "children=" << children + << ", start=" << start + << ", value=" << value ; return oss.str(); } +std::ostream& +operator<<(std::ostream& os, const group& msg) +{ + os << msg.to_string(); + + return os; +} + } diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/hook.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/hook.cpp index 45301cc6..2af2513c 100644 --- a/cpp/src/lib/cucumber-messages/cucumber/messages/hook.cpp +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/hook.cpp @@ -1,6 +1,6 @@ #include -#include +#include #include namespace cucumber::messages { @@ -11,13 +11,21 @@ hook::to_string() const std::ostringstream oss; oss - << "id=" << id - << ", name=" << name - << ", source_reference=" << source_reference - << ", tag_expression=" << tag_expression + << "id=" << id + << ", name=" << name + << ", source_reference=" << source_reference + << ", tag_expression=" << tag_expression ; return oss.str(); } +std::ostream& +operator<<(std::ostream& os, const hook& msg) +{ + os << msg.to_string(); + + return os; +} + } diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/java_method.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/java_method.cpp index 2747d576..bc256511 100644 --- a/cpp/src/lib/cucumber-messages/cucumber/messages/java_method.cpp +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/java_method.cpp @@ -1,6 +1,6 @@ #include -#include +#include #include namespace cucumber::messages { @@ -11,12 +11,20 @@ java_method::to_string() const std::ostringstream oss; oss - << "class_name=" << class_name - << ", method_name=" << method_name - << ", method_parameter_types=" << cucumber::to_string(method_parameter_types) + << "class_name=" << class_name + << ", method_name=" << method_name + << ", method_parameter_types=" << method_parameter_types ; return oss.str(); } +std::ostream& +operator<<(std::ostream& os, const java_method& msg) +{ + os << msg.to_string(); + + return os; +} + } diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/java_stack_trace_element.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/java_stack_trace_element.cpp index d0068de2..8b133e47 100644 --- a/cpp/src/lib/cucumber-messages/cucumber/messages/java_stack_trace_element.cpp +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/java_stack_trace_element.cpp @@ -1,6 +1,6 @@ #include -#include +#include #include namespace cucumber::messages { @@ -11,12 +11,20 @@ java_stack_trace_element::to_string() const std::ostringstream oss; oss - << "class_name=" << class_name - << ", file_name=" << file_name - << ", method_name=" << method_name + << "class_name=" << class_name + << ", file_name=" << file_name + << ", method_name=" << method_name ; return oss.str(); } +std::ostream& +operator<<(std::ostream& os, const java_stack_trace_element& msg) +{ + os << msg.to_string(); + + return os; +} + } diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/location.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/location.cpp index d9c71b91..108fb7f1 100644 --- a/cpp/src/lib/cucumber-messages/cucumber/messages/location.cpp +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/location.cpp @@ -1,6 +1,6 @@ #include -#include +#include #include namespace cucumber::messages { @@ -11,11 +11,19 @@ location::to_string() const std::ostringstream oss; oss - << "line=" << line - << ", column=" << column + << "line=" << line + << ", column=" << column ; return oss.str(); } +std::ostream& +operator<<(std::ostream& os, const location& msg) +{ + os << msg.to_string(); + + return os; +} + } diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/meta.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/meta.cpp index 278a8080..fd8ecebd 100644 --- a/cpp/src/lib/cucumber-messages/cucumber/messages/meta.cpp +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/meta.cpp @@ -1,6 +1,6 @@ #include -#include +#include #include namespace cucumber::messages { @@ -11,15 +11,23 @@ meta::to_string() const std::ostringstream oss; oss - << "protocol_version=" << protocol_version - << ", implementation=" << implementation - << ", runtime=" << runtime - << ", os=" << os - << ", cpu=" << cpu - << ", ci=" << ci + << "protocol_version=" << protocol_version + << ", implementation=" << implementation + << ", runtime=" << runtime + << ", os=" << os + << ", cpu=" << cpu + << ", ci=" << ci ; return oss.str(); } +std::ostream& +operator<<(std::ostream& os, const meta& msg) +{ + os << msg.to_string(); + + return os; +} + } diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/parameter_type.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/parameter_type.cpp index 431f2198..50e48022 100644 --- a/cpp/src/lib/cucumber-messages/cucumber/messages/parameter_type.cpp +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/parameter_type.cpp @@ -1,6 +1,6 @@ #include -#include +#include #include namespace cucumber::messages { @@ -11,15 +11,23 @@ parameter_type::to_string() const std::ostringstream oss; oss - << "name=" << name - << ", regular_expressions=" << cucumber::to_string(regular_expressions) - << ", prefer_for_regular_expression_match=" << prefer_for_regular_expression_match - << ", use_for_snippets=" << use_for_snippets - << ", id=" << id - << ", source_reference=" << source_reference + << "name=" << name + << ", regular_expressions=" << regular_expressions + << ", prefer_for_regular_expression_match=" << prefer_for_regular_expression_match + << ", use_for_snippets=" << use_for_snippets + << ", id=" << id + << ", source_reference=" << source_reference ; return oss.str(); } +std::ostream& +operator<<(std::ostream& os, const parameter_type& msg) +{ + os << msg.to_string(); + + return os; +} + } diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/parse_error.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/parse_error.cpp index dd64e842..00e11cdb 100644 --- a/cpp/src/lib/cucumber-messages/cucumber/messages/parse_error.cpp +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/parse_error.cpp @@ -1,6 +1,6 @@ #include -#include +#include #include namespace cucumber::messages { @@ -11,11 +11,19 @@ parse_error::to_string() const std::ostringstream oss; oss - << "source=" << source - << ", message=" << message + << "source=" << source + << ", message=" << message ; return oss.str(); } +std::ostream& +operator<<(std::ostream& os, const parse_error& msg) +{ + os << msg.to_string(); + + return os; +} + } diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/pickle.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/pickle.cpp index c3bc1f78..d688fe23 100644 --- a/cpp/src/lib/cucumber-messages/cucumber/messages/pickle.cpp +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/pickle.cpp @@ -1,6 +1,6 @@ #include -#include +#include #include namespace cucumber::messages { @@ -11,16 +11,24 @@ pickle::to_string() const std::ostringstream oss; oss - << "id=" << id - << ", uri=" << uri - << ", name=" << name - << ", language=" << language - << ", steps=" << steps - << ", tags=" << tags - << ", ast_node_ids=" << cucumber::to_string(ast_node_ids) + << "id=" << id + << ", uri=" << uri + << ", name=" << name + << ", language=" << language + << ", steps=" << steps + << ", tags=" << tags + << ", ast_node_ids=" << ast_node_ids ; return oss.str(); } +std::ostream& +operator<<(std::ostream& os, const pickle& msg) +{ + os << msg.to_string(); + + return os; +} + } diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/pickle_doc_string.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/pickle_doc_string.cpp index 7c3e2078..c097930e 100644 --- a/cpp/src/lib/cucumber-messages/cucumber/messages/pickle_doc_string.cpp +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/pickle_doc_string.cpp @@ -1,6 +1,6 @@ #include -#include +#include #include namespace cucumber::messages { @@ -11,11 +11,19 @@ pickle_doc_string::to_string() const std::ostringstream oss; oss - << "media_type=" << media_type - << ", content=" << content + << "media_type=" << media_type + << ", content=" << content ; return oss.str(); } +std::ostream& +operator<<(std::ostream& os, const pickle_doc_string& msg) +{ + os << msg.to_string(); + + return os; +} + } diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/pickle_step.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/pickle_step.cpp index 8574a6dc..bb591c1e 100644 --- a/cpp/src/lib/cucumber-messages/cucumber/messages/pickle_step.cpp +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/pickle_step.cpp @@ -1,6 +1,6 @@ #include -#include +#include #include namespace cucumber::messages { @@ -11,14 +11,22 @@ pickle_step::to_string() const std::ostringstream oss; oss - << "argument=" << argument - << ", ast_node_ids=" << cucumber::to_string(ast_node_ids) - << ", id=" << id - << ", type=" << type - << ", text=" << text + << "argument=" << argument + << ", ast_node_ids=" << ast_node_ids + << ", id=" << id + << ", type=" << type + << ", text=" << text ; return oss.str(); } +std::ostream& +operator<<(std::ostream& os, const pickle_step& msg) +{ + os << msg.to_string(); + + return os; +} + } diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/pickle_step_argument.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/pickle_step_argument.cpp index a1424ca3..632c0a82 100644 --- a/cpp/src/lib/cucumber-messages/cucumber/messages/pickle_step_argument.cpp +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/pickle_step_argument.cpp @@ -1,6 +1,6 @@ #include -#include +#include #include namespace cucumber::messages { @@ -11,11 +11,19 @@ pickle_step_argument::to_string() const std::ostringstream oss; oss - << "doc_string=" << doc_string - << ", data_table=" << data_table + << "doc_string=" << doc_string + << ", data_table=" << data_table ; return oss.str(); } +std::ostream& +operator<<(std::ostream& os, const pickle_step_argument& msg) +{ + os << msg.to_string(); + + return os; +} + } diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/pickle_table.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/pickle_table.cpp index 800d491a..3bbbb441 100644 --- a/cpp/src/lib/cucumber-messages/cucumber/messages/pickle_table.cpp +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/pickle_table.cpp @@ -1,6 +1,6 @@ #include -#include +#include #include namespace cucumber::messages { @@ -11,10 +11,18 @@ pickle_table::to_string() const std::ostringstream oss; oss - << "rows=" << rows + << "rows=" << rows ; return oss.str(); } +std::ostream& +operator<<(std::ostream& os, const pickle_table& msg) +{ + os << msg.to_string(); + + return os; +} + } diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/pickle_table_cell.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/pickle_table_cell.cpp index adbd5f62..1657f4ad 100644 --- a/cpp/src/lib/cucumber-messages/cucumber/messages/pickle_table_cell.cpp +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/pickle_table_cell.cpp @@ -1,6 +1,6 @@ #include -#include +#include #include namespace cucumber::messages { @@ -11,10 +11,18 @@ pickle_table_cell::to_string() const std::ostringstream oss; oss - << "value=" << value + << "value=" << value ; return oss.str(); } +std::ostream& +operator<<(std::ostream& os, const pickle_table_cell& msg) +{ + os << msg.to_string(); + + return os; +} + } diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/pickle_table_row.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/pickle_table_row.cpp index b14fc5ef..28780120 100644 --- a/cpp/src/lib/cucumber-messages/cucumber/messages/pickle_table_row.cpp +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/pickle_table_row.cpp @@ -1,6 +1,6 @@ #include -#include +#include #include namespace cucumber::messages { @@ -11,10 +11,18 @@ pickle_table_row::to_string() const std::ostringstream oss; oss - << "cells=" << cells + << "cells=" << cells ; return oss.str(); } +std::ostream& +operator<<(std::ostream& os, const pickle_table_row& msg) +{ + os << msg.to_string(); + + return os; +} + } diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/pickle_tag.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/pickle_tag.cpp index 36ea011c..f7e27668 100644 --- a/cpp/src/lib/cucumber-messages/cucumber/messages/pickle_tag.cpp +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/pickle_tag.cpp @@ -1,6 +1,6 @@ #include -#include +#include #include namespace cucumber::messages { @@ -11,11 +11,19 @@ pickle_tag::to_string() const std::ostringstream oss; oss - << "name=" << name - << ", ast_node_id=" << ast_node_id + << "name=" << name + << ", ast_node_id=" << ast_node_id ; return oss.str(); } +std::ostream& +operator<<(std::ostream& os, const pickle_tag& msg) +{ + os << msg.to_string(); + + return os; +} + } diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/product.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/product.cpp index 22a72dbf..87bfc578 100644 --- a/cpp/src/lib/cucumber-messages/cucumber/messages/product.cpp +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/product.cpp @@ -1,6 +1,6 @@ #include -#include +#include #include namespace cucumber::messages { @@ -11,11 +11,19 @@ product::to_string() const std::ostringstream oss; oss - << "name=" << name - << ", version=" << version + << "name=" << name + << ", version=" << version ; return oss.str(); } +std::ostream& +operator<<(std::ostream& os, const product& msg) +{ + os << msg.to_string(); + + return os; +} + } diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/rule.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/rule.cpp index aa3a92af..19e251f5 100644 --- a/cpp/src/lib/cucumber-messages/cucumber/messages/rule.cpp +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/rule.cpp @@ -1,6 +1,6 @@ #include -#include +#include #include namespace cucumber::messages { @@ -11,16 +11,24 @@ rule::to_string() const std::ostringstream oss; oss - << "location=" << location - << ", tags=" << tags - << ", keyword=" << keyword - << ", name=" << name - << ", description=" << description - << ", children=" << children - << ", id=" << id + << "location=" << location + << ", tags=" << tags + << ", keyword=" << keyword + << ", name=" << name + << ", description=" << description + << ", children=" << children + << ", id=" << id ; return oss.str(); } +std::ostream& +operator<<(std::ostream& os, const rule& msg) +{ + os << msg.to_string(); + + return os; +} + } diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/rule_child.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/rule_child.cpp index 3cc22a7d..0d34afc3 100644 --- a/cpp/src/lib/cucumber-messages/cucumber/messages/rule_child.cpp +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/rule_child.cpp @@ -1,6 +1,6 @@ #include -#include +#include #include namespace cucumber::messages { @@ -11,11 +11,19 @@ rule_child::to_string() const std::ostringstream oss; oss - << "background=" << background - << ", scenario=" << scenario + << "background=" << background + << ", scenario=" << scenario ; return oss.str(); } +std::ostream& +operator<<(std::ostream& os, const rule_child& msg) +{ + os << msg.to_string(); + + return os; +} + } diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/scenario.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/scenario.cpp index 136bb400..02d4486a 100644 --- a/cpp/src/lib/cucumber-messages/cucumber/messages/scenario.cpp +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/scenario.cpp @@ -1,6 +1,6 @@ #include -#include +#include #include namespace cucumber::messages { @@ -11,17 +11,25 @@ scenario::to_string() const std::ostringstream oss; oss - << "location=" << location - << ", tags=" << tags - << ", keyword=" << keyword - << ", name=" << name - << ", description=" << description - << ", steps=" << steps - << ", examples=" << examples - << ", id=" << id + << "location=" << location + << ", tags=" << tags + << ", keyword=" << keyword + << ", name=" << name + << ", description=" << description + << ", steps=" << steps + << ", examples=" << examples + << ", id=" << id ; return oss.str(); } +std::ostream& +operator<<(std::ostream& os, const scenario& msg) +{ + os << msg.to_string(); + + return os; +} + } diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/source.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/source.cpp index 8e70138f..61504e13 100644 --- a/cpp/src/lib/cucumber-messages/cucumber/messages/source.cpp +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/source.cpp @@ -1,6 +1,6 @@ #include -#include +#include #include namespace cucumber::messages { @@ -11,12 +11,20 @@ source::to_string() const std::ostringstream oss; oss - << "uri=" << uri - << ", data=" << data - << ", media_type=" << media_type + << "uri=" << uri + << ", data=" << data + << ", media_type=" << media_type ; return oss.str(); } +std::ostream& +operator<<(std::ostream& os, const source& msg) +{ + os << msg.to_string(); + + return os; +} + } diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/source_reference.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/source_reference.cpp index 0ac31ffe..6d06acd6 100644 --- a/cpp/src/lib/cucumber-messages/cucumber/messages/source_reference.cpp +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/source_reference.cpp @@ -1,6 +1,6 @@ #include -#include +#include #include namespace cucumber::messages { @@ -11,13 +11,21 @@ source_reference::to_string() const std::ostringstream oss; oss - << "uri=" << uri - << ", java_method=" << java_method - << ", java_stack_trace_element=" << java_stack_trace_element - << ", location=" << location + << "uri=" << uri + << ", java_method=" << java_method + << ", java_stack_trace_element=" << java_stack_trace_element + << ", location=" << location ; return oss.str(); } +std::ostream& +operator<<(std::ostream& os, const source_reference& msg) +{ + os << msg.to_string(); + + return os; +} + } diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/step.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/step.cpp index 50775f3c..72d99336 100644 --- a/cpp/src/lib/cucumber-messages/cucumber/messages/step.cpp +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/step.cpp @@ -1,6 +1,6 @@ #include -#include +#include #include namespace cucumber::messages { @@ -11,16 +11,24 @@ step::to_string() const std::ostringstream oss; oss - << "location=" << location - << ", keyword=" << keyword - << ", keyword_type=" << keyword_type - << ", text=" << text - << ", doc_string=" << doc_string - << ", data_table=" << data_table - << ", id=" << id + << "location=" << location + << ", keyword=" << keyword + << ", keyword_type=" << keyword_type + << ", text=" << text + << ", doc_string=" << doc_string + << ", data_table=" << data_table + << ", id=" << id ; return oss.str(); } +std::ostream& +operator<<(std::ostream& os, const step& msg) +{ + os << msg.to_string(); + + return os; +} + } diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/step_definition.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/step_definition.cpp index 2808a70f..23cf9b72 100644 --- a/cpp/src/lib/cucumber-messages/cucumber/messages/step_definition.cpp +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/step_definition.cpp @@ -1,6 +1,6 @@ #include -#include +#include #include namespace cucumber::messages { @@ -11,12 +11,20 @@ step_definition::to_string() const std::ostringstream oss; oss - << "id=" << id - << ", pattern=" << pattern - << ", source_reference=" << source_reference + << "id=" << id + << ", pattern=" << pattern + << ", source_reference=" << source_reference ; return oss.str(); } +std::ostream& +operator<<(std::ostream& os, const step_definition& msg) +{ + os << msg.to_string(); + + return os; +} + } diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/step_definition_pattern.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/step_definition_pattern.cpp index 7d2572ff..69a0b54e 100644 --- a/cpp/src/lib/cucumber-messages/cucumber/messages/step_definition_pattern.cpp +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/step_definition_pattern.cpp @@ -1,6 +1,6 @@ #include -#include +#include #include namespace cucumber::messages { @@ -11,11 +11,19 @@ step_definition_pattern::to_string() const std::ostringstream oss; oss - << "source=" << source - << ", type=" << type + << "source=" << source + << ", type=" << type ; return oss.str(); } +std::ostream& +operator<<(std::ostream& os, const step_definition_pattern& msg) +{ + os << msg.to_string(); + + return os; +} + } diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/step_match_argument.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/step_match_argument.cpp index 3909c47f..09ae706e 100644 --- a/cpp/src/lib/cucumber-messages/cucumber/messages/step_match_argument.cpp +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/step_match_argument.cpp @@ -1,6 +1,6 @@ #include -#include +#include #include namespace cucumber::messages { @@ -11,11 +11,19 @@ step_match_argument::to_string() const std::ostringstream oss; oss - << "group=" << group - << ", parameter_type_name=" << parameter_type_name + << "group=" << group + << ", parameter_type_name=" << parameter_type_name ; return oss.str(); } +std::ostream& +operator<<(std::ostream& os, const step_match_argument& msg) +{ + os << msg.to_string(); + + return os; +} + } diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/step_match_arguments_list.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/step_match_arguments_list.cpp index 0d35a6e5..68b6bdec 100644 --- a/cpp/src/lib/cucumber-messages/cucumber/messages/step_match_arguments_list.cpp +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/step_match_arguments_list.cpp @@ -1,6 +1,6 @@ #include -#include +#include #include namespace cucumber::messages { @@ -11,10 +11,18 @@ step_match_arguments_list::to_string() const std::ostringstream oss; oss - << "step_match_arguments=" << step_match_arguments + << "step_match_arguments=" << step_match_arguments ; return oss.str(); } +std::ostream& +operator<<(std::ostream& os, const step_match_arguments_list& msg) +{ + os << msg.to_string(); + + return os; +} + } diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/table_cell.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/table_cell.cpp index c2024bf5..7f13fe9d 100644 --- a/cpp/src/lib/cucumber-messages/cucumber/messages/table_cell.cpp +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/table_cell.cpp @@ -1,6 +1,6 @@ #include -#include +#include #include namespace cucumber::messages { @@ -11,11 +11,19 @@ table_cell::to_string() const std::ostringstream oss; oss - << "location=" << location - << ", value=" << value + << "location=" << location + << ", value=" << value ; return oss.str(); } +std::ostream& +operator<<(std::ostream& os, const table_cell& msg) +{ + os << msg.to_string(); + + return os; +} + } diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/table_row.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/table_row.cpp index 8b94c892..6ceffa12 100644 --- a/cpp/src/lib/cucumber-messages/cucumber/messages/table_row.cpp +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/table_row.cpp @@ -1,6 +1,6 @@ #include -#include +#include #include namespace cucumber::messages { @@ -11,12 +11,20 @@ table_row::to_string() const std::ostringstream oss; oss - << "location=" << location - << ", cells=" << cells - << ", id=" << id + << "location=" << location + << ", cells=" << cells + << ", id=" << id ; return oss.str(); } +std::ostream& +operator<<(std::ostream& os, const table_row& msg) +{ + os << msg.to_string(); + + return os; +} + } diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/tag.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/tag.cpp index b6e01815..b577b3db 100644 --- a/cpp/src/lib/cucumber-messages/cucumber/messages/tag.cpp +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/tag.cpp @@ -1,6 +1,6 @@ #include -#include +#include #include namespace cucumber::messages { @@ -11,12 +11,20 @@ tag::to_string() const std::ostringstream oss; oss - << "location=" << location - << ", name=" << name - << ", id=" << id + << "location=" << location + << ", name=" << name + << ", id=" << id ; return oss.str(); } +std::ostream& +operator<<(std::ostream& os, const tag& msg) +{ + os << msg.to_string(); + + return os; +} + } diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/test_case.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/test_case.cpp index a428c35f..6b6222d0 100644 --- a/cpp/src/lib/cucumber-messages/cucumber/messages/test_case.cpp +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/test_case.cpp @@ -1,6 +1,6 @@ #include -#include +#include #include namespace cucumber::messages { @@ -11,12 +11,20 @@ test_case::to_string() const std::ostringstream oss; oss - << "id=" << id - << ", pickle_id=" << pickle_id - << ", test_steps=" << test_steps + << "id=" << id + << ", pickle_id=" << pickle_id + << ", test_steps=" << test_steps ; return oss.str(); } +std::ostream& +operator<<(std::ostream& os, const test_case& msg) +{ + os << msg.to_string(); + + return os; +} + } diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/test_case_finished.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/test_case_finished.cpp index 5ee68d28..77aba079 100644 --- a/cpp/src/lib/cucumber-messages/cucumber/messages/test_case_finished.cpp +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/test_case_finished.cpp @@ -1,6 +1,6 @@ #include -#include +#include #include namespace cucumber::messages { @@ -11,12 +11,20 @@ test_case_finished::to_string() const std::ostringstream oss; oss - << "test_case_started_id=" << test_case_started_id - << ", timestamp=" << timestamp - << ", will_be_retried=" << will_be_retried + << "test_case_started_id=" << test_case_started_id + << ", timestamp=" << timestamp + << ", will_be_retried=" << will_be_retried ; return oss.str(); } +std::ostream& +operator<<(std::ostream& os, const test_case_finished& msg) +{ + os << msg.to_string(); + + return os; +} + } diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/test_case_started.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/test_case_started.cpp index d13bce77..0f6d98bf 100644 --- a/cpp/src/lib/cucumber-messages/cucumber/messages/test_case_started.cpp +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/test_case_started.cpp @@ -1,6 +1,6 @@ #include -#include +#include #include namespace cucumber::messages { @@ -11,14 +11,22 @@ test_case_started::to_string() const std::ostringstream oss; oss - << "attempt=" << attempt - << ", id=" << id - << ", test_case_id=" << test_case_id - << ", worker_id=" << worker_id - << ", timestamp=" << timestamp + << "attempt=" << attempt + << ", id=" << id + << ", test_case_id=" << test_case_id + << ", worker_id=" << worker_id + << ", timestamp=" << timestamp ; return oss.str(); } +std::ostream& +operator<<(std::ostream& os, const test_case_started& msg) +{ + os << msg.to_string(); + + return os; +} + } diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/test_run_finished.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/test_run_finished.cpp index 186e8b69..8cdcff29 100644 --- a/cpp/src/lib/cucumber-messages/cucumber/messages/test_run_finished.cpp +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/test_run_finished.cpp @@ -1,6 +1,6 @@ #include -#include +#include #include namespace cucumber::messages { @@ -11,13 +11,21 @@ test_run_finished::to_string() const std::ostringstream oss; oss - << "message=" << message - << ", success=" << success - << ", timestamp=" << timestamp - << ", exception=" << exception + << "message=" << message + << ", success=" << success + << ", timestamp=" << timestamp + << ", exception=" << exception ; return oss.str(); } +std::ostream& +operator<<(std::ostream& os, const test_run_finished& msg) +{ + os << msg.to_string(); + + return os; +} + } diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/test_run_started.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/test_run_started.cpp index e0f81b1b..b33f3bee 100644 --- a/cpp/src/lib/cucumber-messages/cucumber/messages/test_run_started.cpp +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/test_run_started.cpp @@ -1,6 +1,6 @@ #include -#include +#include #include namespace cucumber::messages { @@ -11,10 +11,18 @@ test_run_started::to_string() const std::ostringstream oss; oss - << "timestamp=" << timestamp + << "timestamp=" << timestamp ; return oss.str(); } +std::ostream& +operator<<(std::ostream& os, const test_run_started& msg) +{ + os << msg.to_string(); + + return os; +} + } diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/test_step.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/test_step.cpp index 44bb9be0..587480d5 100644 --- a/cpp/src/lib/cucumber-messages/cucumber/messages/test_step.cpp +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/test_step.cpp @@ -1,6 +1,6 @@ #include -#include +#include #include namespace cucumber::messages { @@ -11,14 +11,22 @@ test_step::to_string() const std::ostringstream oss; oss - << "hook_id=" << hook_id - << ", id=" << id - << ", pickle_step_id=" << pickle_step_id - << ", step_definition_ids=" << cucumber::to_string(step_definition_ids) - << ", step_match_arguments_lists=" << step_match_arguments_lists + << "hook_id=" << hook_id + << ", id=" << id + << ", pickle_step_id=" << pickle_step_id + << ", step_definition_ids=" << step_definition_ids + << ", step_match_arguments_lists=" << step_match_arguments_lists ; return oss.str(); } +std::ostream& +operator<<(std::ostream& os, const test_step& msg) +{ + os << msg.to_string(); + + return os; +} + } diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/test_step_finished.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/test_step_finished.cpp index df391d1d..b1cab6b1 100644 --- a/cpp/src/lib/cucumber-messages/cucumber/messages/test_step_finished.cpp +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/test_step_finished.cpp @@ -1,6 +1,6 @@ #include -#include +#include #include namespace cucumber::messages { @@ -11,13 +11,21 @@ test_step_finished::to_string() const std::ostringstream oss; oss - << "test_case_started_id=" << test_case_started_id - << ", test_step_id=" << test_step_id - << ", test_step_result=" << test_step_result - << ", timestamp=" << timestamp + << "test_case_started_id=" << test_case_started_id + << ", test_step_id=" << test_step_id + << ", test_step_result=" << test_step_result + << ", timestamp=" << timestamp ; return oss.str(); } +std::ostream& +operator<<(std::ostream& os, const test_step_finished& msg) +{ + os << msg.to_string(); + + return os; +} + } diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/test_step_result.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/test_step_result.cpp index 5a0b8240..885f23c9 100644 --- a/cpp/src/lib/cucumber-messages/cucumber/messages/test_step_result.cpp +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/test_step_result.cpp @@ -1,6 +1,6 @@ #include -#include +#include #include namespace cucumber::messages { @@ -11,13 +11,21 @@ test_step_result::to_string() const std::ostringstream oss; oss - << "duration=" << duration - << ", message=" << message - << ", status=" << status - << ", exception=" << exception + << "duration=" << duration + << ", message=" << message + << ", status=" << status + << ", exception=" << exception ; return oss.str(); } +std::ostream& +operator<<(std::ostream& os, const test_step_result& msg) +{ + os << msg.to_string(); + + return os; +} + } diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/test_step_started.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/test_step_started.cpp index ffb6dba2..885c0286 100644 --- a/cpp/src/lib/cucumber-messages/cucumber/messages/test_step_started.cpp +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/test_step_started.cpp @@ -1,6 +1,6 @@ #include -#include +#include #include namespace cucumber::messages { @@ -11,12 +11,20 @@ test_step_started::to_string() const std::ostringstream oss; oss - << "test_case_started_id=" << test_case_started_id - << ", test_step_id=" << test_step_id - << ", timestamp=" << timestamp + << "test_case_started_id=" << test_case_started_id + << ", test_step_id=" << test_step_id + << ", timestamp=" << timestamp ; return oss.str(); } +std::ostream& +operator<<(std::ostream& os, const test_step_started& msg) +{ + os << msg.to_string(); + + return os; +} + } diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/timestamp.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/timestamp.cpp index bb34cf87..9c6dba60 100644 --- a/cpp/src/lib/cucumber-messages/cucumber/messages/timestamp.cpp +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/timestamp.cpp @@ -1,6 +1,6 @@ #include -#include +#include #include namespace cucumber::messages { @@ -11,11 +11,19 @@ timestamp::to_string() const std::ostringstream oss; oss - << "seconds=" << seconds - << ", nanos=" << nanos + << "seconds=" << seconds + << ", nanos=" << nanos ; return oss.str(); } +std::ostream& +operator<<(std::ostream& os, const timestamp& msg) +{ + os << msg.to_string(); + + return os; +} + } diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/undefined_parameter_type.cpp b/cpp/src/lib/cucumber-messages/cucumber/messages/undefined_parameter_type.cpp index d88f1a62..d068c70a 100644 --- a/cpp/src/lib/cucumber-messages/cucumber/messages/undefined_parameter_type.cpp +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/undefined_parameter_type.cpp @@ -1,6 +1,6 @@ #include -#include +#include #include namespace cucumber::messages { @@ -11,11 +11,19 @@ undefined_parameter_type::to_string() const std::ostringstream oss; oss - << "expression=" << expression - << ", name=" << name + << "expression=" << expression + << ", name=" << name ; return oss.str(); } +std::ostream& +operator<<(std::ostream& os, const undefined_parameter_type& msg) +{ + os << msg.to_string(); + + return os; +} + } diff --git a/cpp/src/lib/cucumber-messages/cucumber/messages/utils.hpp b/cpp/src/lib/cucumber-messages/cucumber/messages/utils.hpp new file mode 100644 index 00000000..0dfb0678 --- /dev/null +++ b/cpp/src/lib/cucumber-messages/cucumber/messages/utils.hpp @@ -0,0 +1,23 @@ +#pragma once + +#include +#include + +namespace cucumber::messages { + +template +std::ostream& +operator<<(std::ostream& os, const std::vector& msgs) +{ + os << '['; + + for (std::size_t i = 0; i < msgs.size(); ++i) { + os << (i > 0 ? ", " : "") << msgs[i]; + } + + os << ']'; + + return os; +} + +} diff --git a/cpp/src/lib/cucumber-messages/cucumber/utils.hpp b/cpp/src/lib/cucumber-messages/cucumber/utils.hpp deleted file mode 100644 index 6cd673b9..00000000 --- a/cpp/src/lib/cucumber-messages/cucumber/utils.hpp +++ /dev/null @@ -1,26 +0,0 @@ -#pragma once - -#include -#include -#include - -namespace cucumber { - -template -std::string -to_string(const std::vector& msgs) -{ - std::ostringstream oss; - - oss << '['; - - for (std::size_t i = 0; i < msgs.size(); ++i) { - oss << (i > 0 ? ", " : "") << msgs[i]; - } - - oss << ']'; - - return oss.str(); -} - -} diff --git a/jsonschema/scripts/templates/cpp.hpp.erb b/jsonschema/scripts/templates/cpp.hpp.erb index 6d6b0efc..0d5d0a1e 100644 --- a/jsonschema/scripts/templates/cpp.hpp.erb +++ b/jsonschema/scripts/templates/cpp.hpp.erb @@ -4,8 +4,7 @@ #pragma once #include - -#include +#include <%- incs = [] schema['properties'].each do |property_name, property| @@ -38,7 +37,7 @@ namespace cucumber::messages { // // Generated code -struct <%= myclass %> : cucumber::message +struct <%= myclass %> { <%- schema['properties'].each do |property_name, property| -%> <%- type = underscore(type_for(class_name(key), property_name, property)) -%> @@ -58,11 +57,14 @@ struct <%= myclass %> : cucumber::message std::string to_string() const; }; +std::ostream& +operator<<(std::ostream& os, const <%= myclass %>& msg); + } <%= myclass %>.cpp #include -#include +#include #include .hpp> namespace cucumber::messages { @@ -75,16 +77,19 @@ std::string oss <%- schema['properties'].each_with_index do |(property_name, property), index| -%> <%- type = underscore(type_for(class_name(key), property_name, property)) -%> - <%- std_vec = /std::vector/.match(type) -%> - <%- if std_vec -%> - << "<%= index == 0 ? '' : ', '%><%= underscore(property_name) %>=" << cucumber::to_string(<%= underscore(property_name) %>) - <%- else -%> - << "<%= index == 0 ? '' : ', '%><%= underscore(property_name) %>=" << <%= underscore(property_name) %> - <%- end -%> + << "<%= index == 0 ? '' : ', '%><%= underscore(property_name) %>=" << <%= underscore(property_name) %> <%- end -%> ; return oss.str(); } +std::ostream& +operator<<(std::ostream& os, const <%= myclass %>& msg) +{ + os << msg.to_string(); + + return os; +} + }<%- end -%> From b23af981def586974ff15e4d694c35cd1ef5d34a Mon Sep 17 00:00:00 2001 From: Remy Chibois Date: Tue, 9 May 2023 18:20:01 +0200 Subject: [PATCH 10/26] chore: added nlohmann json library --- cpp/include/cucumber/messages/attachment.hpp | 6 + cpp/include/cucumber/messages/background.hpp | 6 + cpp/include/cucumber/messages/ci.hpp | 6 + cpp/include/cucumber/messages/comment.hpp | 6 + cpp/include/cucumber/messages/data_table.hpp | 6 + cpp/include/cucumber/messages/doc_string.hpp | 6 + cpp/include/cucumber/messages/duration.hpp | 6 + cpp/include/cucumber/messages/envelope.hpp | 6 + cpp/include/cucumber/messages/examples.hpp | 6 + cpp/include/cucumber/messages/exception.hpp | 6 + cpp/include/cucumber/messages/feature.hpp | 6 + .../cucumber/messages/feature_child.hpp | 6 + .../cucumber/messages/gherkin_document.hpp | 6 + cpp/include/cucumber/messages/git.hpp | 6 + cpp/include/cucumber/messages/group.hpp | 6 + cpp/include/cucumber/messages/hook.hpp | 6 + cpp/include/cucumber/messages/java_method.hpp | 6 + .../messages/java_stack_trace_element.hpp | 6 + cpp/include/cucumber/messages/location.hpp | 6 + cpp/include/cucumber/messages/meta.hpp | 6 + .../cucumber/messages/parameter_type.hpp | 6 + cpp/include/cucumber/messages/parse_error.hpp | 6 + cpp/include/cucumber/messages/pickle.hpp | 6 + .../cucumber/messages/pickle_doc_string.hpp | 6 + cpp/include/cucumber/messages/pickle_step.hpp | 6 + .../messages/pickle_step_argument.hpp | 6 + .../cucumber/messages/pickle_table.hpp | 6 + .../cucumber/messages/pickle_table_cell.hpp | 6 + .../cucumber/messages/pickle_table_row.hpp | 6 + cpp/include/cucumber/messages/pickle_tag.hpp | 6 + cpp/include/cucumber/messages/product.hpp | 6 + cpp/include/cucumber/messages/rule.hpp | 6 + cpp/include/cucumber/messages/rule_child.hpp | 6 + cpp/include/cucumber/messages/scenario.hpp | 6 + cpp/include/cucumber/messages/source.hpp | 6 + .../cucumber/messages/source_reference.hpp | 6 + cpp/include/cucumber/messages/step.hpp | 6 + .../cucumber/messages/step_definition.hpp | 6 + .../messages/step_definition_pattern.hpp | 6 + .../cucumber/messages/step_match_argument.hpp | 6 + .../messages/step_match_arguments_list.hpp | 6 + cpp/include/cucumber/messages/table_cell.hpp | 6 + cpp/include/cucumber/messages/table_row.hpp | 6 + cpp/include/cucumber/messages/tag.hpp | 6 + cpp/include/cucumber/messages/test_case.hpp | 6 + .../cucumber/messages/test_case_finished.hpp | 6 + .../cucumber/messages/test_case_started.hpp | 6 + .../cucumber/messages/test_run_finished.hpp | 6 + .../cucumber/messages/test_run_started.hpp | 6 + cpp/include/cucumber/messages/test_step.hpp | 6 + .../cucumber/messages/test_step_finished.hpp | 6 + .../cucumber/messages/test_step_result.hpp | 6 + .../cucumber/messages/test_step_started.hpp | 6 + cpp/include/cucumber/messages/timestamp.hpp | 6 + .../messages/undefined_parameter_type.hpp | 6 + cpp/include/nlohmann/json.hpp | 24674 ++++++++++++++++ .../cucumber/messages/attachment.cpp | 14 + .../cucumber/messages/background.cpp | 12 + .../cucumber/messages/ci.cpp | 10 + .../cucumber/messages/comment.cpp | 8 + .../cucumber/messages/data_table.cpp | 8 + .../cucumber/messages/doc_string.cpp | 10 + .../cucumber/messages/duration.cpp | 8 + .../cucumber/messages/envelope.cpp | 23 + .../cucumber/messages/examples.cpp | 14 + .../cucumber/messages/exception.cpp | 8 + .../cucumber/messages/feature.cpp | 13 + .../cucumber/messages/feature_child.cpp | 9 + .../cucumber/messages/gherkin_document.cpp | 9 + .../cucumber/messages/git.cpp | 10 + .../cucumber/messages/group.cpp | 9 + .../cucumber/messages/hook.cpp | 10 + .../cucumber/messages/java_method.cpp | 9 + .../messages/java_stack_trace_element.cpp | 9 + .../cucumber/messages/location.cpp | 8 + .../cucumber/messages/meta.cpp | 12 + .../cucumber/messages/parameter_type.cpp | 12 + .../cucumber/messages/parse_error.cpp | 8 + .../cucumber/messages/pickle.cpp | 13 + .../cucumber/messages/pickle_doc_string.cpp | 8 + .../cucumber/messages/pickle_step.cpp | 11 + .../messages/pickle_step_argument.cpp | 8 + .../cucumber/messages/pickle_table.cpp | 7 + .../cucumber/messages/pickle_table_cell.cpp | 7 + .../cucumber/messages/pickle_table_row.cpp | 7 + .../cucumber/messages/pickle_tag.cpp | 8 + .../cucumber/messages/product.cpp | 8 + .../cucumber/messages/rule.cpp | 13 + .../cucumber/messages/rule_child.cpp | 8 + .../cucumber/messages/scenario.cpp | 14 + .../cucumber/messages/source.cpp | 9 + .../cucumber/messages/source_reference.cpp | 10 + .../cucumber/messages/step.cpp | 13 + .../cucumber/messages/step_definition.cpp | 9 + .../messages/step_definition_pattern.cpp | 8 + .../cucumber/messages/step_match_argument.cpp | 8 + .../messages/step_match_arguments_list.cpp | 7 + .../cucumber/messages/table_cell.cpp | 8 + .../cucumber/messages/table_row.cpp | 9 + .../cucumber/messages/tag.cpp | 9 + .../cucumber/messages/test_case.cpp | 9 + .../cucumber/messages/test_case_finished.cpp | 9 + .../cucumber/messages/test_case_started.cpp | 11 + .../cucumber/messages/test_run_finished.cpp | 10 + .../cucumber/messages/test_run_started.cpp | 7 + .../cucumber/messages/test_step.cpp | 11 + .../cucumber/messages/test_step_finished.cpp | 10 + .../cucumber/messages/test_step_result.cpp | 10 + .../cucumber/messages/test_step_started.cpp | 9 + .../cucumber/messages/timestamp.cpp | 8 + .../messages/undefined_parameter_type.cpp | 8 + jsonschema/scripts/templates/cpp.hpp.erb | 24 + 112 files changed, 25565 insertions(+) create mode 100644 cpp/include/nlohmann/json.hpp diff --git a/cpp/include/cucumber/messages/attachment.hpp b/cpp/include/cucumber/messages/attachment.hpp index 4e4166fa..f550990a 100644 --- a/cpp/include/cucumber/messages/attachment.hpp +++ b/cpp/include/cucumber/messages/attachment.hpp @@ -3,6 +3,8 @@ #include #include +#include + #include #include @@ -43,4 +45,8 @@ struct attachment std::ostream& operator<<(std::ostream& os, const attachment& msg); +using json = nlohmann::json; + +void to_json(json& j, const attachment& m); + } diff --git a/cpp/include/cucumber/messages/background.hpp b/cpp/include/cucumber/messages/background.hpp index cdbd6729..631ee716 100644 --- a/cpp/include/cucumber/messages/background.hpp +++ b/cpp/include/cucumber/messages/background.hpp @@ -3,6 +3,8 @@ #include #include +#include + #include #include @@ -29,4 +31,8 @@ struct background std::ostream& operator<<(std::ostream& os, const background& msg); +using json = nlohmann::json; + +void to_json(json& j, const background& m); + } diff --git a/cpp/include/cucumber/messages/ci.hpp b/cpp/include/cucumber/messages/ci.hpp index 446d1741..fbafed83 100644 --- a/cpp/include/cucumber/messages/ci.hpp +++ b/cpp/include/cucumber/messages/ci.hpp @@ -3,6 +3,8 @@ #include #include +#include + #include namespace cucumber::messages { @@ -28,4 +30,8 @@ struct ci std::ostream& operator<<(std::ostream& os, const ci& msg); +using json = nlohmann::json; + +void to_json(json& j, const ci& m); + } diff --git a/cpp/include/cucumber/messages/comment.hpp b/cpp/include/cucumber/messages/comment.hpp index cef7a694..d5a452e2 100644 --- a/cpp/include/cucumber/messages/comment.hpp +++ b/cpp/include/cucumber/messages/comment.hpp @@ -3,6 +3,8 @@ #include #include +#include + #include namespace cucumber::messages { @@ -26,4 +28,8 @@ struct comment std::ostream& operator<<(std::ostream& os, const comment& msg); +using json = nlohmann::json; + +void to_json(json& j, const comment& m); + } diff --git a/cpp/include/cucumber/messages/data_table.hpp b/cpp/include/cucumber/messages/data_table.hpp index 192fa03c..c880e32b 100644 --- a/cpp/include/cucumber/messages/data_table.hpp +++ b/cpp/include/cucumber/messages/data_table.hpp @@ -3,6 +3,8 @@ #include #include +#include + #include #include @@ -25,4 +27,8 @@ struct data_table std::ostream& operator<<(std::ostream& os, const data_table& msg); +using json = nlohmann::json; + +void to_json(json& j, const data_table& m); + } diff --git a/cpp/include/cucumber/messages/doc_string.hpp b/cpp/include/cucumber/messages/doc_string.hpp index 65df7ba5..874cf96a 100644 --- a/cpp/include/cucumber/messages/doc_string.hpp +++ b/cpp/include/cucumber/messages/doc_string.hpp @@ -3,6 +3,8 @@ #include #include +#include + #include namespace cucumber::messages { @@ -26,4 +28,8 @@ struct doc_string std::ostream& operator<<(std::ostream& os, const doc_string& msg); +using json = nlohmann::json; + +void to_json(json& j, const doc_string& m); + } diff --git a/cpp/include/cucumber/messages/duration.hpp b/cpp/include/cucumber/messages/duration.hpp index a72ba504..67663183 100644 --- a/cpp/include/cucumber/messages/duration.hpp +++ b/cpp/include/cucumber/messages/duration.hpp @@ -3,6 +3,8 @@ #include #include +#include + namespace cucumber::messages { // @@ -25,4 +27,8 @@ struct duration std::ostream& operator<<(std::ostream& os, const duration& msg); +using json = nlohmann::json; + +void to_json(json& j, const duration& m); + } diff --git a/cpp/include/cucumber/messages/envelope.hpp b/cpp/include/cucumber/messages/envelope.hpp index f96db3c9..82404224 100644 --- a/cpp/include/cucumber/messages/envelope.hpp +++ b/cpp/include/cucumber/messages/envelope.hpp @@ -3,6 +3,8 @@ #include #include +#include + #include #include #include @@ -62,4 +64,8 @@ struct envelope std::ostream& operator<<(std::ostream& os, const envelope& msg); +using json = nlohmann::json; + +void to_json(json& j, const envelope& m); + } diff --git a/cpp/include/cucumber/messages/examples.hpp b/cpp/include/cucumber/messages/examples.hpp index 6dc43f66..82e79174 100644 --- a/cpp/include/cucumber/messages/examples.hpp +++ b/cpp/include/cucumber/messages/examples.hpp @@ -3,6 +3,8 @@ #include #include +#include + #include #include #include @@ -33,4 +35,8 @@ struct examples std::ostream& operator<<(std::ostream& os, const examples& msg); +using json = nlohmann::json; + +void to_json(json& j, const examples& m); + } diff --git a/cpp/include/cucumber/messages/exception.hpp b/cpp/include/cucumber/messages/exception.hpp index cf4326b6..d9c1c108 100644 --- a/cpp/include/cucumber/messages/exception.hpp +++ b/cpp/include/cucumber/messages/exception.hpp @@ -3,6 +3,8 @@ #include #include +#include + namespace cucumber::messages { // @@ -24,4 +26,8 @@ struct exception std::ostream& operator<<(std::ostream& os, const exception& msg); +using json = nlohmann::json; + +void to_json(json& j, const exception& m); + } diff --git a/cpp/include/cucumber/messages/feature.hpp b/cpp/include/cucumber/messages/feature.hpp index a390253d..3a381732 100644 --- a/cpp/include/cucumber/messages/feature.hpp +++ b/cpp/include/cucumber/messages/feature.hpp @@ -3,6 +3,8 @@ #include #include +#include + #include #include #include @@ -31,4 +33,8 @@ struct feature std::ostream& operator<<(std::ostream& os, const feature& msg); +using json = nlohmann::json; + +void to_json(json& j, const feature& m); + } diff --git a/cpp/include/cucumber/messages/feature_child.hpp b/cpp/include/cucumber/messages/feature_child.hpp index dec5e234..622501f2 100644 --- a/cpp/include/cucumber/messages/feature_child.hpp +++ b/cpp/include/cucumber/messages/feature_child.hpp @@ -3,6 +3,8 @@ #include #include +#include + #include #include #include @@ -29,4 +31,8 @@ struct feature_child std::ostream& operator<<(std::ostream& os, const feature_child& msg); +using json = nlohmann::json; + +void to_json(json& j, const feature_child& m); + } diff --git a/cpp/include/cucumber/messages/gherkin_document.hpp b/cpp/include/cucumber/messages/gherkin_document.hpp index b8bdf050..c5e3a890 100644 --- a/cpp/include/cucumber/messages/gherkin_document.hpp +++ b/cpp/include/cucumber/messages/gherkin_document.hpp @@ -3,6 +3,8 @@ #include #include +#include + #include #include @@ -33,4 +35,8 @@ struct gherkin_document std::ostream& operator<<(std::ostream& os, const gherkin_document& msg); +using json = nlohmann::json; + +void to_json(json& j, const gherkin_document& m); + } diff --git a/cpp/include/cucumber/messages/git.hpp b/cpp/include/cucumber/messages/git.hpp index 4de134b6..329547dd 100644 --- a/cpp/include/cucumber/messages/git.hpp +++ b/cpp/include/cucumber/messages/git.hpp @@ -3,6 +3,8 @@ #include #include +#include + namespace cucumber::messages { // @@ -27,4 +29,8 @@ struct git std::ostream& operator<<(std::ostream& os, const git& msg); +using json = nlohmann::json; + +void to_json(json& j, const git& m); + } diff --git a/cpp/include/cucumber/messages/group.hpp b/cpp/include/cucumber/messages/group.hpp index bc971faa..e0ff88a6 100644 --- a/cpp/include/cucumber/messages/group.hpp +++ b/cpp/include/cucumber/messages/group.hpp @@ -3,6 +3,8 @@ #include #include +#include + #include namespace cucumber::messages { @@ -25,4 +27,8 @@ struct group std::ostream& operator<<(std::ostream& os, const group& msg); +using json = nlohmann::json; + +void to_json(json& j, const group& m); + } diff --git a/cpp/include/cucumber/messages/hook.hpp b/cpp/include/cucumber/messages/hook.hpp index 4f1fad10..628b417d 100644 --- a/cpp/include/cucumber/messages/hook.hpp +++ b/cpp/include/cucumber/messages/hook.hpp @@ -3,6 +3,8 @@ #include #include +#include + #include namespace cucumber::messages { @@ -26,4 +28,8 @@ struct hook std::ostream& operator<<(std::ostream& os, const hook& msg); +using json = nlohmann::json; + +void to_json(json& j, const hook& m); + } diff --git a/cpp/include/cucumber/messages/java_method.hpp b/cpp/include/cucumber/messages/java_method.hpp index acf03c8a..44143d8d 100644 --- a/cpp/include/cucumber/messages/java_method.hpp +++ b/cpp/include/cucumber/messages/java_method.hpp @@ -3,6 +3,8 @@ #include #include +#include + namespace cucumber::messages { // @@ -23,4 +25,8 @@ struct java_method std::ostream& operator<<(std::ostream& os, const java_method& msg); +using json = nlohmann::json; + +void to_json(json& j, const java_method& m); + } diff --git a/cpp/include/cucumber/messages/java_stack_trace_element.hpp b/cpp/include/cucumber/messages/java_stack_trace_element.hpp index 7f3104c3..5833c837 100644 --- a/cpp/include/cucumber/messages/java_stack_trace_element.hpp +++ b/cpp/include/cucumber/messages/java_stack_trace_element.hpp @@ -3,6 +3,8 @@ #include #include +#include + namespace cucumber::messages { // @@ -23,4 +25,8 @@ struct java_stack_trace_element std::ostream& operator<<(std::ostream& os, const java_stack_trace_element& msg); +using json = nlohmann::json; + +void to_json(json& j, const java_stack_trace_element& m); + } diff --git a/cpp/include/cucumber/messages/location.hpp b/cpp/include/cucumber/messages/location.hpp index 4221bf0d..4addc190 100644 --- a/cpp/include/cucumber/messages/location.hpp +++ b/cpp/include/cucumber/messages/location.hpp @@ -3,6 +3,8 @@ #include #include +#include + namespace cucumber::messages { // @@ -24,4 +26,8 @@ struct location std::ostream& operator<<(std::ostream& os, const location& msg); +using json = nlohmann::json; + +void to_json(json& j, const location& m); + } diff --git a/cpp/include/cucumber/messages/meta.hpp b/cpp/include/cucumber/messages/meta.hpp index 1afa05bf..143feff8 100644 --- a/cpp/include/cucumber/messages/meta.hpp +++ b/cpp/include/cucumber/messages/meta.hpp @@ -3,6 +3,8 @@ #include #include +#include + #include #include #include @@ -35,4 +37,8 @@ struct meta std::ostream& operator<<(std::ostream& os, const meta& msg); +using json = nlohmann::json; + +void to_json(json& j, const meta& m); + } diff --git a/cpp/include/cucumber/messages/parameter_type.hpp b/cpp/include/cucumber/messages/parameter_type.hpp index 1a16e57e..a30cc9be 100644 --- a/cpp/include/cucumber/messages/parameter_type.hpp +++ b/cpp/include/cucumber/messages/parameter_type.hpp @@ -3,6 +3,8 @@ #include #include +#include + #include namespace cucumber::messages { @@ -28,4 +30,8 @@ struct parameter_type std::ostream& operator<<(std::ostream& os, const parameter_type& msg); +using json = nlohmann::json; + +void to_json(json& j, const parameter_type& m); + } diff --git a/cpp/include/cucumber/messages/parse_error.hpp b/cpp/include/cucumber/messages/parse_error.hpp index 01949b73..bd369290 100644 --- a/cpp/include/cucumber/messages/parse_error.hpp +++ b/cpp/include/cucumber/messages/parse_error.hpp @@ -3,6 +3,8 @@ #include #include +#include + #include namespace cucumber::messages { @@ -24,4 +26,8 @@ struct parse_error std::ostream& operator<<(std::ostream& os, const parse_error& msg); +using json = nlohmann::json; + +void to_json(json& j, const parse_error& m); + } diff --git a/cpp/include/cucumber/messages/pickle.hpp b/cpp/include/cucumber/messages/pickle.hpp index 46fdf7ff..20b5fe35 100644 --- a/cpp/include/cucumber/messages/pickle.hpp +++ b/cpp/include/cucumber/messages/pickle.hpp @@ -3,6 +3,8 @@ #include #include +#include + #include #include @@ -43,4 +45,8 @@ struct pickle std::ostream& operator<<(std::ostream& os, const pickle& msg); +using json = nlohmann::json; + +void to_json(json& j, const pickle& m); + } diff --git a/cpp/include/cucumber/messages/pickle_doc_string.hpp b/cpp/include/cucumber/messages/pickle_doc_string.hpp index fe474f3e..2e9a59f7 100644 --- a/cpp/include/cucumber/messages/pickle_doc_string.hpp +++ b/cpp/include/cucumber/messages/pickle_doc_string.hpp @@ -3,6 +3,8 @@ #include #include +#include + namespace cucumber::messages { // @@ -22,4 +24,8 @@ struct pickle_doc_string std::ostream& operator<<(std::ostream& os, const pickle_doc_string& msg); +using json = nlohmann::json; + +void to_json(json& j, const pickle_doc_string& m); + } diff --git a/cpp/include/cucumber/messages/pickle_step.hpp b/cpp/include/cucumber/messages/pickle_step.hpp index 33d117b1..2fb52c83 100644 --- a/cpp/include/cucumber/messages/pickle_step.hpp +++ b/cpp/include/cucumber/messages/pickle_step.hpp @@ -3,6 +3,8 @@ #include #include +#include + #include #include @@ -30,4 +32,8 @@ struct pickle_step std::ostream& operator<<(std::ostream& os, const pickle_step& msg); +using json = nlohmann::json; + +void to_json(json& j, const pickle_step& m); + } diff --git a/cpp/include/cucumber/messages/pickle_step_argument.hpp b/cpp/include/cucumber/messages/pickle_step_argument.hpp index 6f59690b..a5dd8734 100644 --- a/cpp/include/cucumber/messages/pickle_step_argument.hpp +++ b/cpp/include/cucumber/messages/pickle_step_argument.hpp @@ -3,6 +3,8 @@ #include #include +#include + #include #include @@ -27,4 +29,8 @@ struct pickle_step_argument std::ostream& operator<<(std::ostream& os, const pickle_step_argument& msg); +using json = nlohmann::json; + +void to_json(json& j, const pickle_step_argument& m); + } diff --git a/cpp/include/cucumber/messages/pickle_table.hpp b/cpp/include/cucumber/messages/pickle_table.hpp index 5dee89e2..dba0ac4a 100644 --- a/cpp/include/cucumber/messages/pickle_table.hpp +++ b/cpp/include/cucumber/messages/pickle_table.hpp @@ -3,6 +3,8 @@ #include #include +#include + #include namespace cucumber::messages { @@ -23,4 +25,8 @@ struct pickle_table std::ostream& operator<<(std::ostream& os, const pickle_table& msg); +using json = nlohmann::json; + +void to_json(json& j, const pickle_table& m); + } diff --git a/cpp/include/cucumber/messages/pickle_table_cell.hpp b/cpp/include/cucumber/messages/pickle_table_cell.hpp index c26e2c3d..3c20ff73 100644 --- a/cpp/include/cucumber/messages/pickle_table_cell.hpp +++ b/cpp/include/cucumber/messages/pickle_table_cell.hpp @@ -3,6 +3,8 @@ #include #include +#include + namespace cucumber::messages { // @@ -21,4 +23,8 @@ struct pickle_table_cell std::ostream& operator<<(std::ostream& os, const pickle_table_cell& msg); +using json = nlohmann::json; + +void to_json(json& j, const pickle_table_cell& m); + } diff --git a/cpp/include/cucumber/messages/pickle_table_row.hpp b/cpp/include/cucumber/messages/pickle_table_row.hpp index 5942bfae..f8b469ed 100644 --- a/cpp/include/cucumber/messages/pickle_table_row.hpp +++ b/cpp/include/cucumber/messages/pickle_table_row.hpp @@ -3,6 +3,8 @@ #include #include +#include + #include namespace cucumber::messages { @@ -23,4 +25,8 @@ struct pickle_table_row std::ostream& operator<<(std::ostream& os, const pickle_table_row& msg); +using json = nlohmann::json; + +void to_json(json& j, const pickle_table_row& m); + } diff --git a/cpp/include/cucumber/messages/pickle_tag.hpp b/cpp/include/cucumber/messages/pickle_tag.hpp index 355c4cb7..4016b62f 100644 --- a/cpp/include/cucumber/messages/pickle_tag.hpp +++ b/cpp/include/cucumber/messages/pickle_tag.hpp @@ -3,6 +3,8 @@ #include #include +#include + namespace cucumber::messages { // @@ -24,4 +26,8 @@ struct pickle_tag std::ostream& operator<<(std::ostream& os, const pickle_tag& msg); +using json = nlohmann::json; + +void to_json(json& j, const pickle_tag& m); + } diff --git a/cpp/include/cucumber/messages/product.hpp b/cpp/include/cucumber/messages/product.hpp index c5a90bfa..e247a66b 100644 --- a/cpp/include/cucumber/messages/product.hpp +++ b/cpp/include/cucumber/messages/product.hpp @@ -3,6 +3,8 @@ #include #include +#include + namespace cucumber::messages { // @@ -24,4 +26,8 @@ struct product std::ostream& operator<<(std::ostream& os, const product& msg); +using json = nlohmann::json; + +void to_json(json& j, const product& m); + } diff --git a/cpp/include/cucumber/messages/rule.hpp b/cpp/include/cucumber/messages/rule.hpp index 8675de74..89cc8625 100644 --- a/cpp/include/cucumber/messages/rule.hpp +++ b/cpp/include/cucumber/messages/rule.hpp @@ -3,6 +3,8 @@ #include #include +#include + #include #include #include @@ -31,4 +33,8 @@ struct rule std::ostream& operator<<(std::ostream& os, const rule& msg); +using json = nlohmann::json; + +void to_json(json& j, const rule& m); + } diff --git a/cpp/include/cucumber/messages/rule_child.hpp b/cpp/include/cucumber/messages/rule_child.hpp index 3d90a2db..44936ef4 100644 --- a/cpp/include/cucumber/messages/rule_child.hpp +++ b/cpp/include/cucumber/messages/rule_child.hpp @@ -3,6 +3,8 @@ #include #include +#include + #include #include @@ -27,4 +29,8 @@ struct rule_child std::ostream& operator<<(std::ostream& os, const rule_child& msg); +using json = nlohmann::json; + +void to_json(json& j, const rule_child& m); + } diff --git a/cpp/include/cucumber/messages/scenario.hpp b/cpp/include/cucumber/messages/scenario.hpp index 62e5c489..84a72956 100644 --- a/cpp/include/cucumber/messages/scenario.hpp +++ b/cpp/include/cucumber/messages/scenario.hpp @@ -3,6 +3,8 @@ #include #include +#include + #include #include #include @@ -33,4 +35,8 @@ struct scenario std::ostream& operator<<(std::ostream& os, const scenario& msg); +using json = nlohmann::json; + +void to_json(json& j, const scenario& m); + } diff --git a/cpp/include/cucumber/messages/source.hpp b/cpp/include/cucumber/messages/source.hpp index 30f9e786..57aed3fb 100644 --- a/cpp/include/cucumber/messages/source.hpp +++ b/cpp/include/cucumber/messages/source.hpp @@ -3,6 +3,8 @@ #include #include +#include + #include namespace cucumber::messages { @@ -29,4 +31,8 @@ struct source std::ostream& operator<<(std::ostream& os, const source& msg); +using json = nlohmann::json; + +void to_json(json& j, const source& m); + } diff --git a/cpp/include/cucumber/messages/source_reference.hpp b/cpp/include/cucumber/messages/source_reference.hpp index 46366bdb..b0469d28 100644 --- a/cpp/include/cucumber/messages/source_reference.hpp +++ b/cpp/include/cucumber/messages/source_reference.hpp @@ -3,6 +3,8 @@ #include #include +#include + #include #include #include @@ -31,4 +33,8 @@ struct source_reference std::ostream& operator<<(std::ostream& os, const source_reference& msg); +using json = nlohmann::json; + +void to_json(json& j, const source_reference& m); + } diff --git a/cpp/include/cucumber/messages/step.hpp b/cpp/include/cucumber/messages/step.hpp index 9f37c874..bb182a16 100644 --- a/cpp/include/cucumber/messages/step.hpp +++ b/cpp/include/cucumber/messages/step.hpp @@ -3,6 +3,8 @@ #include #include +#include + #include #include #include @@ -34,4 +36,8 @@ struct step std::ostream& operator<<(std::ostream& os, const step& msg); +using json = nlohmann::json; + +void to_json(json& j, const step& m); + } diff --git a/cpp/include/cucumber/messages/step_definition.hpp b/cpp/include/cucumber/messages/step_definition.hpp index 49922e33..52a158fb 100644 --- a/cpp/include/cucumber/messages/step_definition.hpp +++ b/cpp/include/cucumber/messages/step_definition.hpp @@ -3,6 +3,8 @@ #include #include +#include + #include #include @@ -26,4 +28,8 @@ struct step_definition std::ostream& operator<<(std::ostream& os, const step_definition& msg); +using json = nlohmann::json; + +void to_json(json& j, const step_definition& m); + } diff --git a/cpp/include/cucumber/messages/step_definition_pattern.hpp b/cpp/include/cucumber/messages/step_definition_pattern.hpp index cbb39b24..ea5e0722 100644 --- a/cpp/include/cucumber/messages/step_definition_pattern.hpp +++ b/cpp/include/cucumber/messages/step_definition_pattern.hpp @@ -3,6 +3,8 @@ #include #include +#include + #include namespace cucumber::messages { @@ -24,4 +26,8 @@ struct step_definition_pattern std::ostream& operator<<(std::ostream& os, const step_definition_pattern& msg); +using json = nlohmann::json; + +void to_json(json& j, const step_definition_pattern& m); + } diff --git a/cpp/include/cucumber/messages/step_match_argument.hpp b/cpp/include/cucumber/messages/step_match_argument.hpp index d4c06da4..8c391833 100644 --- a/cpp/include/cucumber/messages/step_match_argument.hpp +++ b/cpp/include/cucumber/messages/step_match_argument.hpp @@ -3,6 +3,8 @@ #include #include +#include + #include namespace cucumber::messages { @@ -31,4 +33,8 @@ struct step_match_argument std::ostream& operator<<(std::ostream& os, const step_match_argument& msg); +using json = nlohmann::json; + +void to_json(json& j, const step_match_argument& m); + } diff --git a/cpp/include/cucumber/messages/step_match_arguments_list.hpp b/cpp/include/cucumber/messages/step_match_arguments_list.hpp index 19965e5a..ef929049 100644 --- a/cpp/include/cucumber/messages/step_match_arguments_list.hpp +++ b/cpp/include/cucumber/messages/step_match_arguments_list.hpp @@ -3,6 +3,8 @@ #include #include +#include + #include namespace cucumber::messages { @@ -23,4 +25,8 @@ struct step_match_arguments_list std::ostream& operator<<(std::ostream& os, const step_match_arguments_list& msg); +using json = nlohmann::json; + +void to_json(json& j, const step_match_arguments_list& m); + } diff --git a/cpp/include/cucumber/messages/table_cell.hpp b/cpp/include/cucumber/messages/table_cell.hpp index e22fa77c..829b629d 100644 --- a/cpp/include/cucumber/messages/table_cell.hpp +++ b/cpp/include/cucumber/messages/table_cell.hpp @@ -3,6 +3,8 @@ #include #include +#include + #include namespace cucumber::messages { @@ -26,4 +28,8 @@ struct table_cell std::ostream& operator<<(std::ostream& os, const table_cell& msg); +using json = nlohmann::json; + +void to_json(json& j, const table_cell& m); + } diff --git a/cpp/include/cucumber/messages/table_row.hpp b/cpp/include/cucumber/messages/table_row.hpp index 4b79f7e8..d83dace4 100644 --- a/cpp/include/cucumber/messages/table_row.hpp +++ b/cpp/include/cucumber/messages/table_row.hpp @@ -3,6 +3,8 @@ #include #include +#include + #include #include @@ -28,4 +30,8 @@ struct table_row std::ostream& operator<<(std::ostream& os, const table_row& msg); +using json = nlohmann::json; + +void to_json(json& j, const table_row& m); + } diff --git a/cpp/include/cucumber/messages/tag.hpp b/cpp/include/cucumber/messages/tag.hpp index aa880cf6..0753c75e 100644 --- a/cpp/include/cucumber/messages/tag.hpp +++ b/cpp/include/cucumber/messages/tag.hpp @@ -3,6 +3,8 @@ #include #include +#include + #include namespace cucumber::messages { @@ -27,4 +29,8 @@ struct tag std::ostream& operator<<(std::ostream& os, const tag& msg); +using json = nlohmann::json; + +void to_json(json& j, const tag& m); + } diff --git a/cpp/include/cucumber/messages/test_case.hpp b/cpp/include/cucumber/messages/test_case.hpp index 732d884f..6029e6f8 100644 --- a/cpp/include/cucumber/messages/test_case.hpp +++ b/cpp/include/cucumber/messages/test_case.hpp @@ -3,6 +3,8 @@ #include #include +#include + #include namespace cucumber::messages { @@ -29,4 +31,8 @@ struct test_case std::ostream& operator<<(std::ostream& os, const test_case& msg); +using json = nlohmann::json; + +void to_json(json& j, const test_case& m); + } diff --git a/cpp/include/cucumber/messages/test_case_finished.hpp b/cpp/include/cucumber/messages/test_case_finished.hpp index 934f49c3..dc70e3fa 100644 --- a/cpp/include/cucumber/messages/test_case_finished.hpp +++ b/cpp/include/cucumber/messages/test_case_finished.hpp @@ -3,6 +3,8 @@ #include #include +#include + #include namespace cucumber::messages { @@ -25,4 +27,8 @@ struct test_case_finished std::ostream& operator<<(std::ostream& os, const test_case_finished& msg); +using json = nlohmann::json; + +void to_json(json& j, const test_case_finished& m); + } diff --git a/cpp/include/cucumber/messages/test_case_started.hpp b/cpp/include/cucumber/messages/test_case_started.hpp index f5116942..89359b5d 100644 --- a/cpp/include/cucumber/messages/test_case_started.hpp +++ b/cpp/include/cucumber/messages/test_case_started.hpp @@ -3,6 +3,8 @@ #include #include +#include + #include namespace cucumber::messages { @@ -27,4 +29,8 @@ struct test_case_started std::ostream& operator<<(std::ostream& os, const test_case_started& msg); +using json = nlohmann::json; + +void to_json(json& j, const test_case_started& m); + } diff --git a/cpp/include/cucumber/messages/test_run_finished.hpp b/cpp/include/cucumber/messages/test_run_finished.hpp index 857e8edf..b36181e0 100644 --- a/cpp/include/cucumber/messages/test_run_finished.hpp +++ b/cpp/include/cucumber/messages/test_run_finished.hpp @@ -3,6 +3,8 @@ #include #include +#include + #include #include @@ -27,4 +29,8 @@ struct test_run_finished std::ostream& operator<<(std::ostream& os, const test_run_finished& msg); +using json = nlohmann::json; + +void to_json(json& j, const test_run_finished& m); + } diff --git a/cpp/include/cucumber/messages/test_run_started.hpp b/cpp/include/cucumber/messages/test_run_started.hpp index 66850a69..a2c1793a 100644 --- a/cpp/include/cucumber/messages/test_run_started.hpp +++ b/cpp/include/cucumber/messages/test_run_started.hpp @@ -3,6 +3,8 @@ #include #include +#include + #include namespace cucumber::messages { @@ -23,4 +25,8 @@ struct test_run_started std::ostream& operator<<(std::ostream& os, const test_run_started& msg); +using json = nlohmann::json; + +void to_json(json& j, const test_run_started& m); + } diff --git a/cpp/include/cucumber/messages/test_step.hpp b/cpp/include/cucumber/messages/test_step.hpp index d8e83469..b1af181f 100644 --- a/cpp/include/cucumber/messages/test_step.hpp +++ b/cpp/include/cucumber/messages/test_step.hpp @@ -3,6 +3,8 @@ #include #include +#include + #include namespace cucumber::messages { @@ -30,4 +32,8 @@ struct test_step std::ostream& operator<<(std::ostream& os, const test_step& msg); +using json = nlohmann::json; + +void to_json(json& j, const test_step& m); + } diff --git a/cpp/include/cucumber/messages/test_step_finished.hpp b/cpp/include/cucumber/messages/test_step_finished.hpp index 30619dad..ac1f2e2c 100644 --- a/cpp/include/cucumber/messages/test_step_finished.hpp +++ b/cpp/include/cucumber/messages/test_step_finished.hpp @@ -3,6 +3,8 @@ #include #include +#include + #include #include @@ -27,4 +29,8 @@ struct test_step_finished std::ostream& operator<<(std::ostream& os, const test_step_finished& msg); +using json = nlohmann::json; + +void to_json(json& j, const test_step_finished& m); + } diff --git a/cpp/include/cucumber/messages/test_step_result.hpp b/cpp/include/cucumber/messages/test_step_result.hpp index c80e9752..5010c1df 100644 --- a/cpp/include/cucumber/messages/test_step_result.hpp +++ b/cpp/include/cucumber/messages/test_step_result.hpp @@ -3,6 +3,8 @@ #include #include +#include + #include #include #include @@ -28,4 +30,8 @@ struct test_step_result std::ostream& operator<<(std::ostream& os, const test_step_result& msg); +using json = nlohmann::json; + +void to_json(json& j, const test_step_result& m); + } diff --git a/cpp/include/cucumber/messages/test_step_started.hpp b/cpp/include/cucumber/messages/test_step_started.hpp index 428c0b8d..f4f7a97c 100644 --- a/cpp/include/cucumber/messages/test_step_started.hpp +++ b/cpp/include/cucumber/messages/test_step_started.hpp @@ -3,6 +3,8 @@ #include #include +#include + #include namespace cucumber::messages { @@ -25,4 +27,8 @@ struct test_step_started std::ostream& operator<<(std::ostream& os, const test_step_started& msg); +using json = nlohmann::json; + +void to_json(json& j, const test_step_started& m); + } diff --git a/cpp/include/cucumber/messages/timestamp.hpp b/cpp/include/cucumber/messages/timestamp.hpp index f2796e96..c17b0190 100644 --- a/cpp/include/cucumber/messages/timestamp.hpp +++ b/cpp/include/cucumber/messages/timestamp.hpp @@ -3,6 +3,8 @@ #include #include +#include + namespace cucumber::messages { // @@ -22,4 +24,8 @@ struct timestamp std::ostream& operator<<(std::ostream& os, const timestamp& msg); +using json = nlohmann::json; + +void to_json(json& j, const timestamp& m); + } diff --git a/cpp/include/cucumber/messages/undefined_parameter_type.hpp b/cpp/include/cucumber/messages/undefined_parameter_type.hpp index cf410fa9..6e75c084 100644 --- a/cpp/include/cucumber/messages/undefined_parameter_type.hpp +++ b/cpp/include/cucumber/messages/undefined_parameter_type.hpp @@ -3,6 +3,8 @@ #include #include +#include + namespace cucumber::messages { // @@ -22,4 +24,8 @@ struct undefined_parameter_type std::ostream& operator<<(std::ostream& os, const undefined_parameter_type& msg); +using json = nlohmann::json; + +void to_json(json& j, const undefined_parameter_type& m); + } diff --git a/cpp/include/nlohmann/json.hpp b/cpp/include/nlohmann/json.hpp new file mode 100644 index 00000000..dbbe6845 --- /dev/null +++ b/cpp/include/nlohmann/json.hpp @@ -0,0 +1,24674 @@ +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.2 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann +// SPDX-License-Identifier: MIT + +/****************************************************************************\ + * Note on documentation: The source files contain links to the online * + * documentation of the public API at https://json.nlohmann.me. This URL * + * contains the most recent documentation and should also be applicable to * + * previous versions; documentation for deprecated functions is not * + * removed, but marked deprecated. See "Generate documentation" section in * + * file docs/README.md. * +\****************************************************************************/ + +#ifndef INCLUDE_NLOHMANN_JSON_HPP_ +#define INCLUDE_NLOHMANN_JSON_HPP_ + +#include // all_of, find, for_each +#include // nullptr_t, ptrdiff_t, size_t +#include // hash, less +#include // initializer_list +#ifndef JSON_NO_IO + #include // istream, ostream +#endif // JSON_NO_IO +#include // random_access_iterator_tag +#include // unique_ptr +#include // string, stoi, to_string +#include // declval, forward, move, pair, swap +#include // vector + +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.2 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann +// SPDX-License-Identifier: MIT + + + +#include + +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.2 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann +// SPDX-License-Identifier: MIT + + + +// This file contains all macro definitions affecting or depending on the ABI + +#ifndef JSON_SKIP_LIBRARY_VERSION_CHECK + #if defined(NLOHMANN_JSON_VERSION_MAJOR) && defined(NLOHMANN_JSON_VERSION_MINOR) && defined(NLOHMANN_JSON_VERSION_PATCH) + #if NLOHMANN_JSON_VERSION_MAJOR != 3 || NLOHMANN_JSON_VERSION_MINOR != 11 || NLOHMANN_JSON_VERSION_PATCH != 2 + #warning "Already included a different version of the library!" + #endif + #endif +#endif + +#define NLOHMANN_JSON_VERSION_MAJOR 3 // NOLINT(modernize-macro-to-enum) +#define NLOHMANN_JSON_VERSION_MINOR 11 // NOLINT(modernize-macro-to-enum) +#define NLOHMANN_JSON_VERSION_PATCH 2 // NOLINT(modernize-macro-to-enum) + +#ifndef JSON_DIAGNOSTICS + #define JSON_DIAGNOSTICS 0 +#endif + +#ifndef JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON + #define JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON 0 +#endif + +#if JSON_DIAGNOSTICS + #define NLOHMANN_JSON_ABI_TAG_DIAGNOSTICS _diag +#else + #define NLOHMANN_JSON_ABI_TAG_DIAGNOSTICS +#endif + +#if JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON + #define NLOHMANN_JSON_ABI_TAG_LEGACY_DISCARDED_VALUE_COMPARISON _ldvcmp +#else + #define NLOHMANN_JSON_ABI_TAG_LEGACY_DISCARDED_VALUE_COMPARISON +#endif + +#ifndef NLOHMANN_JSON_NAMESPACE_NO_VERSION + #define NLOHMANN_JSON_NAMESPACE_NO_VERSION 0 +#endif + +// Construct the namespace ABI tags component +#define NLOHMANN_JSON_ABI_TAGS_CONCAT_EX(a, b) json_abi ## a ## b +#define NLOHMANN_JSON_ABI_TAGS_CONCAT(a, b) \ + NLOHMANN_JSON_ABI_TAGS_CONCAT_EX(a, b) + +#define NLOHMANN_JSON_ABI_TAGS \ + NLOHMANN_JSON_ABI_TAGS_CONCAT( \ + NLOHMANN_JSON_ABI_TAG_DIAGNOSTICS, \ + NLOHMANN_JSON_ABI_TAG_LEGACY_DISCARDED_VALUE_COMPARISON) + +// Construct the namespace version component +#define NLOHMANN_JSON_NAMESPACE_VERSION_CONCAT_EX(major, minor, patch) \ + _v ## major ## _ ## minor ## _ ## patch +#define NLOHMANN_JSON_NAMESPACE_VERSION_CONCAT(major, minor, patch) \ + NLOHMANN_JSON_NAMESPACE_VERSION_CONCAT_EX(major, minor, patch) + +#if NLOHMANN_JSON_NAMESPACE_NO_VERSION +#define NLOHMANN_JSON_NAMESPACE_VERSION +#else +#define NLOHMANN_JSON_NAMESPACE_VERSION \ + NLOHMANN_JSON_NAMESPACE_VERSION_CONCAT(NLOHMANN_JSON_VERSION_MAJOR, \ + NLOHMANN_JSON_VERSION_MINOR, \ + NLOHMANN_JSON_VERSION_PATCH) +#endif + +// Combine namespace components +#define NLOHMANN_JSON_NAMESPACE_CONCAT_EX(a, b) a ## b +#define NLOHMANN_JSON_NAMESPACE_CONCAT(a, b) \ + NLOHMANN_JSON_NAMESPACE_CONCAT_EX(a, b) + +#ifndef NLOHMANN_JSON_NAMESPACE +#define NLOHMANN_JSON_NAMESPACE \ + nlohmann::NLOHMANN_JSON_NAMESPACE_CONCAT( \ + NLOHMANN_JSON_ABI_TAGS, \ + NLOHMANN_JSON_NAMESPACE_VERSION) +#endif + +#ifndef NLOHMANN_JSON_NAMESPACE_BEGIN +#define NLOHMANN_JSON_NAMESPACE_BEGIN \ + namespace nlohmann \ + { \ + inline namespace NLOHMANN_JSON_NAMESPACE_CONCAT( \ + NLOHMANN_JSON_ABI_TAGS, \ + NLOHMANN_JSON_NAMESPACE_VERSION) \ + { +#endif + +#ifndef NLOHMANN_JSON_NAMESPACE_END +#define NLOHMANN_JSON_NAMESPACE_END \ + } /* namespace (inline namespace) NOLINT(readability/namespace) */ \ + } // namespace nlohmann +#endif + +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.2 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann +// SPDX-License-Identifier: MIT + + + +#include // transform +#include // array +#include // forward_list +#include // inserter, front_inserter, end +#include // map +#include // string +#include // tuple, make_tuple +#include // is_arithmetic, is_same, is_enum, underlying_type, is_convertible +#include // unordered_map +#include // pair, declval +#include // valarray + +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.2 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann +// SPDX-License-Identifier: MIT + + + +#include // nullptr_t +#include // exception +#if JSON_DIAGNOSTICS + #include // accumulate +#endif +#include // runtime_error +#include // to_string +#include // vector + +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.2 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann +// SPDX-License-Identifier: MIT + + + +#include // array +#include // size_t +#include // uint8_t +#include // string + +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.2 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann +// SPDX-License-Identifier: MIT + + + +#include // declval, pair +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.2 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann +// SPDX-License-Identifier: MIT + + + +#include + +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.2 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann +// SPDX-License-Identifier: MIT + + + +// #include + + +NLOHMANN_JSON_NAMESPACE_BEGIN +namespace detail +{ + +template struct make_void +{ + using type = void; +}; +template using void_t = typename make_void::type; + +} // namespace detail +NLOHMANN_JSON_NAMESPACE_END + + +NLOHMANN_JSON_NAMESPACE_BEGIN +namespace detail +{ + +// https://en.cppreference.com/w/cpp/experimental/is_detected +struct nonesuch +{ + nonesuch() = delete; + ~nonesuch() = delete; + nonesuch(nonesuch const&) = delete; + nonesuch(nonesuch const&&) = delete; + void operator=(nonesuch const&) = delete; + void operator=(nonesuch&&) = delete; +}; + +template class Op, + class... Args> +struct detector +{ + using value_t = std::false_type; + using type = Default; +}; + +template class Op, class... Args> +struct detector>, Op, Args...> +{ + using value_t = std::true_type; + using type = Op; +}; + +template class Op, class... Args> +using is_detected = typename detector::value_t; + +template class Op, class... Args> +struct is_detected_lazy : is_detected { }; + +template class Op, class... Args> +using detected_t = typename detector::type; + +template class Op, class... Args> +using detected_or = detector; + +template class Op, class... Args> +using detected_or_t = typename detected_or::type; + +template class Op, class... Args> +using is_detected_exact = std::is_same>; + +template class Op, class... Args> +using is_detected_convertible = + std::is_convertible, To>; + +} // namespace detail +NLOHMANN_JSON_NAMESPACE_END + +// #include + + +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.2 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann +// SPDX-FileCopyrightText: 2016-2021 Evan Nemerson +// SPDX-License-Identifier: MIT + +/* Hedley - https://nemequ.github.io/hedley + * Created by Evan Nemerson + */ + +#if !defined(JSON_HEDLEY_VERSION) || (JSON_HEDLEY_VERSION < 15) +#if defined(JSON_HEDLEY_VERSION) + #undef JSON_HEDLEY_VERSION +#endif +#define JSON_HEDLEY_VERSION 15 + +#if defined(JSON_HEDLEY_STRINGIFY_EX) + #undef JSON_HEDLEY_STRINGIFY_EX +#endif +#define JSON_HEDLEY_STRINGIFY_EX(x) #x + +#if defined(JSON_HEDLEY_STRINGIFY) + #undef JSON_HEDLEY_STRINGIFY +#endif +#define JSON_HEDLEY_STRINGIFY(x) JSON_HEDLEY_STRINGIFY_EX(x) + +#if defined(JSON_HEDLEY_CONCAT_EX) + #undef JSON_HEDLEY_CONCAT_EX +#endif +#define JSON_HEDLEY_CONCAT_EX(a,b) a##b + +#if defined(JSON_HEDLEY_CONCAT) + #undef JSON_HEDLEY_CONCAT +#endif +#define JSON_HEDLEY_CONCAT(a,b) JSON_HEDLEY_CONCAT_EX(a,b) + +#if defined(JSON_HEDLEY_CONCAT3_EX) + #undef JSON_HEDLEY_CONCAT3_EX +#endif +#define JSON_HEDLEY_CONCAT3_EX(a,b,c) a##b##c + +#if defined(JSON_HEDLEY_CONCAT3) + #undef JSON_HEDLEY_CONCAT3 +#endif +#define JSON_HEDLEY_CONCAT3(a,b,c) JSON_HEDLEY_CONCAT3_EX(a,b,c) + +#if defined(JSON_HEDLEY_VERSION_ENCODE) + #undef JSON_HEDLEY_VERSION_ENCODE +#endif +#define JSON_HEDLEY_VERSION_ENCODE(major,minor,revision) (((major) * 1000000) + ((minor) * 1000) + (revision)) + +#if defined(JSON_HEDLEY_VERSION_DECODE_MAJOR) + #undef JSON_HEDLEY_VERSION_DECODE_MAJOR +#endif +#define JSON_HEDLEY_VERSION_DECODE_MAJOR(version) ((version) / 1000000) + +#if defined(JSON_HEDLEY_VERSION_DECODE_MINOR) + #undef JSON_HEDLEY_VERSION_DECODE_MINOR +#endif +#define JSON_HEDLEY_VERSION_DECODE_MINOR(version) (((version) % 1000000) / 1000) + +#if defined(JSON_HEDLEY_VERSION_DECODE_REVISION) + #undef JSON_HEDLEY_VERSION_DECODE_REVISION +#endif +#define JSON_HEDLEY_VERSION_DECODE_REVISION(version) ((version) % 1000) + +#if defined(JSON_HEDLEY_GNUC_VERSION) + #undef JSON_HEDLEY_GNUC_VERSION +#endif +#if defined(__GNUC__) && defined(__GNUC_PATCHLEVEL__) + #define JSON_HEDLEY_GNUC_VERSION JSON_HEDLEY_VERSION_ENCODE(__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__) +#elif defined(__GNUC__) + #define JSON_HEDLEY_GNUC_VERSION JSON_HEDLEY_VERSION_ENCODE(__GNUC__, __GNUC_MINOR__, 0) +#endif + +#if defined(JSON_HEDLEY_GNUC_VERSION_CHECK) + #undef JSON_HEDLEY_GNUC_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_GNUC_VERSION) + #define JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_GNUC_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_MSVC_VERSION) + #undef JSON_HEDLEY_MSVC_VERSION +#endif +#if defined(_MSC_FULL_VER) && (_MSC_FULL_VER >= 140000000) && !defined(__ICL) + #define JSON_HEDLEY_MSVC_VERSION JSON_HEDLEY_VERSION_ENCODE(_MSC_FULL_VER / 10000000, (_MSC_FULL_VER % 10000000) / 100000, (_MSC_FULL_VER % 100000) / 100) +#elif defined(_MSC_FULL_VER) && !defined(__ICL) + #define JSON_HEDLEY_MSVC_VERSION JSON_HEDLEY_VERSION_ENCODE(_MSC_FULL_VER / 1000000, (_MSC_FULL_VER % 1000000) / 10000, (_MSC_FULL_VER % 10000) / 10) +#elif defined(_MSC_VER) && !defined(__ICL) + #define JSON_HEDLEY_MSVC_VERSION JSON_HEDLEY_VERSION_ENCODE(_MSC_VER / 100, _MSC_VER % 100, 0) +#endif + +#if defined(JSON_HEDLEY_MSVC_VERSION_CHECK) + #undef JSON_HEDLEY_MSVC_VERSION_CHECK +#endif +#if !defined(JSON_HEDLEY_MSVC_VERSION) + #define JSON_HEDLEY_MSVC_VERSION_CHECK(major,minor,patch) (0) +#elif defined(_MSC_VER) && (_MSC_VER >= 1400) + #define JSON_HEDLEY_MSVC_VERSION_CHECK(major,minor,patch) (_MSC_FULL_VER >= ((major * 10000000) + (minor * 100000) + (patch))) +#elif defined(_MSC_VER) && (_MSC_VER >= 1200) + #define JSON_HEDLEY_MSVC_VERSION_CHECK(major,minor,patch) (_MSC_FULL_VER >= ((major * 1000000) + (minor * 10000) + (patch))) +#else + #define JSON_HEDLEY_MSVC_VERSION_CHECK(major,minor,patch) (_MSC_VER >= ((major * 100) + (minor))) +#endif + +#if defined(JSON_HEDLEY_INTEL_VERSION) + #undef JSON_HEDLEY_INTEL_VERSION +#endif +#if defined(__INTEL_COMPILER) && defined(__INTEL_COMPILER_UPDATE) && !defined(__ICL) + #define JSON_HEDLEY_INTEL_VERSION JSON_HEDLEY_VERSION_ENCODE(__INTEL_COMPILER / 100, __INTEL_COMPILER % 100, __INTEL_COMPILER_UPDATE) +#elif defined(__INTEL_COMPILER) && !defined(__ICL) + #define JSON_HEDLEY_INTEL_VERSION JSON_HEDLEY_VERSION_ENCODE(__INTEL_COMPILER / 100, __INTEL_COMPILER % 100, 0) +#endif + +#if defined(JSON_HEDLEY_INTEL_VERSION_CHECK) + #undef JSON_HEDLEY_INTEL_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_INTEL_VERSION) + #define JSON_HEDLEY_INTEL_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_INTEL_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_INTEL_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_INTEL_CL_VERSION) + #undef JSON_HEDLEY_INTEL_CL_VERSION +#endif +#if defined(__INTEL_COMPILER) && defined(__INTEL_COMPILER_UPDATE) && defined(__ICL) + #define JSON_HEDLEY_INTEL_CL_VERSION JSON_HEDLEY_VERSION_ENCODE(__INTEL_COMPILER, __INTEL_COMPILER_UPDATE, 0) +#endif + +#if defined(JSON_HEDLEY_INTEL_CL_VERSION_CHECK) + #undef JSON_HEDLEY_INTEL_CL_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_INTEL_CL_VERSION) + #define JSON_HEDLEY_INTEL_CL_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_INTEL_CL_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_INTEL_CL_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_PGI_VERSION) + #undef JSON_HEDLEY_PGI_VERSION +#endif +#if defined(__PGI) && defined(__PGIC__) && defined(__PGIC_MINOR__) && defined(__PGIC_PATCHLEVEL__) + #define JSON_HEDLEY_PGI_VERSION JSON_HEDLEY_VERSION_ENCODE(__PGIC__, __PGIC_MINOR__, __PGIC_PATCHLEVEL__) +#endif + +#if defined(JSON_HEDLEY_PGI_VERSION_CHECK) + #undef JSON_HEDLEY_PGI_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_PGI_VERSION) + #define JSON_HEDLEY_PGI_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_PGI_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_PGI_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_SUNPRO_VERSION) + #undef JSON_HEDLEY_SUNPRO_VERSION +#endif +#if defined(__SUNPRO_C) && (__SUNPRO_C > 0x1000) + #define JSON_HEDLEY_SUNPRO_VERSION JSON_HEDLEY_VERSION_ENCODE((((__SUNPRO_C >> 16) & 0xf) * 10) + ((__SUNPRO_C >> 12) & 0xf), (((__SUNPRO_C >> 8) & 0xf) * 10) + ((__SUNPRO_C >> 4) & 0xf), (__SUNPRO_C & 0xf) * 10) +#elif defined(__SUNPRO_C) + #define JSON_HEDLEY_SUNPRO_VERSION JSON_HEDLEY_VERSION_ENCODE((__SUNPRO_C >> 8) & 0xf, (__SUNPRO_C >> 4) & 0xf, (__SUNPRO_C) & 0xf) +#elif defined(__SUNPRO_CC) && (__SUNPRO_CC > 0x1000) + #define JSON_HEDLEY_SUNPRO_VERSION JSON_HEDLEY_VERSION_ENCODE((((__SUNPRO_CC >> 16) & 0xf) * 10) + ((__SUNPRO_CC >> 12) & 0xf), (((__SUNPRO_CC >> 8) & 0xf) * 10) + ((__SUNPRO_CC >> 4) & 0xf), (__SUNPRO_CC & 0xf) * 10) +#elif defined(__SUNPRO_CC) + #define JSON_HEDLEY_SUNPRO_VERSION JSON_HEDLEY_VERSION_ENCODE((__SUNPRO_CC >> 8) & 0xf, (__SUNPRO_CC >> 4) & 0xf, (__SUNPRO_CC) & 0xf) +#endif + +#if defined(JSON_HEDLEY_SUNPRO_VERSION_CHECK) + #undef JSON_HEDLEY_SUNPRO_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_SUNPRO_VERSION) + #define JSON_HEDLEY_SUNPRO_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_SUNPRO_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_SUNPRO_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_EMSCRIPTEN_VERSION) + #undef JSON_HEDLEY_EMSCRIPTEN_VERSION +#endif +#if defined(__EMSCRIPTEN__) + #define JSON_HEDLEY_EMSCRIPTEN_VERSION JSON_HEDLEY_VERSION_ENCODE(__EMSCRIPTEN_major__, __EMSCRIPTEN_minor__, __EMSCRIPTEN_tiny__) +#endif + +#if defined(JSON_HEDLEY_EMSCRIPTEN_VERSION_CHECK) + #undef JSON_HEDLEY_EMSCRIPTEN_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_EMSCRIPTEN_VERSION) + #define JSON_HEDLEY_EMSCRIPTEN_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_EMSCRIPTEN_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_EMSCRIPTEN_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_ARM_VERSION) + #undef JSON_HEDLEY_ARM_VERSION +#endif +#if defined(__CC_ARM) && defined(__ARMCOMPILER_VERSION) + #define JSON_HEDLEY_ARM_VERSION JSON_HEDLEY_VERSION_ENCODE(__ARMCOMPILER_VERSION / 1000000, (__ARMCOMPILER_VERSION % 1000000) / 10000, (__ARMCOMPILER_VERSION % 10000) / 100) +#elif defined(__CC_ARM) && defined(__ARMCC_VERSION) + #define JSON_HEDLEY_ARM_VERSION JSON_HEDLEY_VERSION_ENCODE(__ARMCC_VERSION / 1000000, (__ARMCC_VERSION % 1000000) / 10000, (__ARMCC_VERSION % 10000) / 100) +#endif + +#if defined(JSON_HEDLEY_ARM_VERSION_CHECK) + #undef JSON_HEDLEY_ARM_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_ARM_VERSION) + #define JSON_HEDLEY_ARM_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_ARM_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_ARM_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_IBM_VERSION) + #undef JSON_HEDLEY_IBM_VERSION +#endif +#if defined(__ibmxl__) + #define JSON_HEDLEY_IBM_VERSION JSON_HEDLEY_VERSION_ENCODE(__ibmxl_version__, __ibmxl_release__, __ibmxl_modification__) +#elif defined(__xlC__) && defined(__xlC_ver__) + #define JSON_HEDLEY_IBM_VERSION JSON_HEDLEY_VERSION_ENCODE(__xlC__ >> 8, __xlC__ & 0xff, (__xlC_ver__ >> 8) & 0xff) +#elif defined(__xlC__) + #define JSON_HEDLEY_IBM_VERSION JSON_HEDLEY_VERSION_ENCODE(__xlC__ >> 8, __xlC__ & 0xff, 0) +#endif + +#if defined(JSON_HEDLEY_IBM_VERSION_CHECK) + #undef JSON_HEDLEY_IBM_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_IBM_VERSION) + #define JSON_HEDLEY_IBM_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_IBM_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_IBM_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_TI_VERSION) + #undef JSON_HEDLEY_TI_VERSION +#endif +#if \ + defined(__TI_COMPILER_VERSION__) && \ + ( \ + defined(__TMS470__) || defined(__TI_ARM__) || \ + defined(__MSP430__) || \ + defined(__TMS320C2000__) \ + ) +#if (__TI_COMPILER_VERSION__ >= 16000000) + #define JSON_HEDLEY_TI_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) +#endif +#endif + +#if defined(JSON_HEDLEY_TI_VERSION_CHECK) + #undef JSON_HEDLEY_TI_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_TI_VERSION) + #define JSON_HEDLEY_TI_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_TI_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_TI_CL2000_VERSION) + #undef JSON_HEDLEY_TI_CL2000_VERSION +#endif +#if defined(__TI_COMPILER_VERSION__) && defined(__TMS320C2000__) + #define JSON_HEDLEY_TI_CL2000_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) +#endif + +#if defined(JSON_HEDLEY_TI_CL2000_VERSION_CHECK) + #undef JSON_HEDLEY_TI_CL2000_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_TI_CL2000_VERSION) + #define JSON_HEDLEY_TI_CL2000_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_CL2000_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_TI_CL2000_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_TI_CL430_VERSION) + #undef JSON_HEDLEY_TI_CL430_VERSION +#endif +#if defined(__TI_COMPILER_VERSION__) && defined(__MSP430__) + #define JSON_HEDLEY_TI_CL430_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) +#endif + +#if defined(JSON_HEDLEY_TI_CL430_VERSION_CHECK) + #undef JSON_HEDLEY_TI_CL430_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_TI_CL430_VERSION) + #define JSON_HEDLEY_TI_CL430_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_CL430_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_TI_CL430_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_TI_ARMCL_VERSION) + #undef JSON_HEDLEY_TI_ARMCL_VERSION +#endif +#if defined(__TI_COMPILER_VERSION__) && (defined(__TMS470__) || defined(__TI_ARM__)) + #define JSON_HEDLEY_TI_ARMCL_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) +#endif + +#if defined(JSON_HEDLEY_TI_ARMCL_VERSION_CHECK) + #undef JSON_HEDLEY_TI_ARMCL_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_TI_ARMCL_VERSION) + #define JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_ARMCL_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_TI_CL6X_VERSION) + #undef JSON_HEDLEY_TI_CL6X_VERSION +#endif +#if defined(__TI_COMPILER_VERSION__) && defined(__TMS320C6X__) + #define JSON_HEDLEY_TI_CL6X_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) +#endif + +#if defined(JSON_HEDLEY_TI_CL6X_VERSION_CHECK) + #undef JSON_HEDLEY_TI_CL6X_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_TI_CL6X_VERSION) + #define JSON_HEDLEY_TI_CL6X_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_CL6X_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_TI_CL6X_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_TI_CL7X_VERSION) + #undef JSON_HEDLEY_TI_CL7X_VERSION +#endif +#if defined(__TI_COMPILER_VERSION__) && defined(__C7000__) + #define JSON_HEDLEY_TI_CL7X_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) +#endif + +#if defined(JSON_HEDLEY_TI_CL7X_VERSION_CHECK) + #undef JSON_HEDLEY_TI_CL7X_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_TI_CL7X_VERSION) + #define JSON_HEDLEY_TI_CL7X_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_CL7X_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_TI_CL7X_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_TI_CLPRU_VERSION) + #undef JSON_HEDLEY_TI_CLPRU_VERSION +#endif +#if defined(__TI_COMPILER_VERSION__) && defined(__PRU__) + #define JSON_HEDLEY_TI_CLPRU_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) +#endif + +#if defined(JSON_HEDLEY_TI_CLPRU_VERSION_CHECK) + #undef JSON_HEDLEY_TI_CLPRU_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_TI_CLPRU_VERSION) + #define JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_CLPRU_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_CRAY_VERSION) + #undef JSON_HEDLEY_CRAY_VERSION +#endif +#if defined(_CRAYC) + #if defined(_RELEASE_PATCHLEVEL) + #define JSON_HEDLEY_CRAY_VERSION JSON_HEDLEY_VERSION_ENCODE(_RELEASE_MAJOR, _RELEASE_MINOR, _RELEASE_PATCHLEVEL) + #else + #define JSON_HEDLEY_CRAY_VERSION JSON_HEDLEY_VERSION_ENCODE(_RELEASE_MAJOR, _RELEASE_MINOR, 0) + #endif +#endif + +#if defined(JSON_HEDLEY_CRAY_VERSION_CHECK) + #undef JSON_HEDLEY_CRAY_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_CRAY_VERSION) + #define JSON_HEDLEY_CRAY_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_CRAY_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_CRAY_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_IAR_VERSION) + #undef JSON_HEDLEY_IAR_VERSION +#endif +#if defined(__IAR_SYSTEMS_ICC__) + #if __VER__ > 1000 + #define JSON_HEDLEY_IAR_VERSION JSON_HEDLEY_VERSION_ENCODE((__VER__ / 1000000), ((__VER__ / 1000) % 1000), (__VER__ % 1000)) + #else + #define JSON_HEDLEY_IAR_VERSION JSON_HEDLEY_VERSION_ENCODE(__VER__ / 100, __VER__ % 100, 0) + #endif +#endif + +#if defined(JSON_HEDLEY_IAR_VERSION_CHECK) + #undef JSON_HEDLEY_IAR_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_IAR_VERSION) + #define JSON_HEDLEY_IAR_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_IAR_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_IAR_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_TINYC_VERSION) + #undef JSON_HEDLEY_TINYC_VERSION +#endif +#if defined(__TINYC__) + #define JSON_HEDLEY_TINYC_VERSION JSON_HEDLEY_VERSION_ENCODE(__TINYC__ / 1000, (__TINYC__ / 100) % 10, __TINYC__ % 100) +#endif + +#if defined(JSON_HEDLEY_TINYC_VERSION_CHECK) + #undef JSON_HEDLEY_TINYC_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_TINYC_VERSION) + #define JSON_HEDLEY_TINYC_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TINYC_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_TINYC_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_DMC_VERSION) + #undef JSON_HEDLEY_DMC_VERSION +#endif +#if defined(__DMC__) + #define JSON_HEDLEY_DMC_VERSION JSON_HEDLEY_VERSION_ENCODE(__DMC__ >> 8, (__DMC__ >> 4) & 0xf, __DMC__ & 0xf) +#endif + +#if defined(JSON_HEDLEY_DMC_VERSION_CHECK) + #undef JSON_HEDLEY_DMC_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_DMC_VERSION) + #define JSON_HEDLEY_DMC_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_DMC_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_DMC_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_COMPCERT_VERSION) + #undef JSON_HEDLEY_COMPCERT_VERSION +#endif +#if defined(__COMPCERT_VERSION__) + #define JSON_HEDLEY_COMPCERT_VERSION JSON_HEDLEY_VERSION_ENCODE(__COMPCERT_VERSION__ / 10000, (__COMPCERT_VERSION__ / 100) % 100, __COMPCERT_VERSION__ % 100) +#endif + +#if defined(JSON_HEDLEY_COMPCERT_VERSION_CHECK) + #undef JSON_HEDLEY_COMPCERT_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_COMPCERT_VERSION) + #define JSON_HEDLEY_COMPCERT_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_COMPCERT_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_COMPCERT_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_PELLES_VERSION) + #undef JSON_HEDLEY_PELLES_VERSION +#endif +#if defined(__POCC__) + #define JSON_HEDLEY_PELLES_VERSION JSON_HEDLEY_VERSION_ENCODE(__POCC__ / 100, __POCC__ % 100, 0) +#endif + +#if defined(JSON_HEDLEY_PELLES_VERSION_CHECK) + #undef JSON_HEDLEY_PELLES_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_PELLES_VERSION) + #define JSON_HEDLEY_PELLES_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_PELLES_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_PELLES_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_MCST_LCC_VERSION) + #undef JSON_HEDLEY_MCST_LCC_VERSION +#endif +#if defined(__LCC__) && defined(__LCC_MINOR__) + #define JSON_HEDLEY_MCST_LCC_VERSION JSON_HEDLEY_VERSION_ENCODE(__LCC__ / 100, __LCC__ % 100, __LCC_MINOR__) +#endif + +#if defined(JSON_HEDLEY_MCST_LCC_VERSION_CHECK) + #undef JSON_HEDLEY_MCST_LCC_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_MCST_LCC_VERSION) + #define JSON_HEDLEY_MCST_LCC_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_MCST_LCC_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_MCST_LCC_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_GCC_VERSION) + #undef JSON_HEDLEY_GCC_VERSION +#endif +#if \ + defined(JSON_HEDLEY_GNUC_VERSION) && \ + !defined(__clang__) && \ + !defined(JSON_HEDLEY_INTEL_VERSION) && \ + !defined(JSON_HEDLEY_PGI_VERSION) && \ + !defined(JSON_HEDLEY_ARM_VERSION) && \ + !defined(JSON_HEDLEY_CRAY_VERSION) && \ + !defined(JSON_HEDLEY_TI_VERSION) && \ + !defined(JSON_HEDLEY_TI_ARMCL_VERSION) && \ + !defined(JSON_HEDLEY_TI_CL430_VERSION) && \ + !defined(JSON_HEDLEY_TI_CL2000_VERSION) && \ + !defined(JSON_HEDLEY_TI_CL6X_VERSION) && \ + !defined(JSON_HEDLEY_TI_CL7X_VERSION) && \ + !defined(JSON_HEDLEY_TI_CLPRU_VERSION) && \ + !defined(__COMPCERT__) && \ + !defined(JSON_HEDLEY_MCST_LCC_VERSION) + #define JSON_HEDLEY_GCC_VERSION JSON_HEDLEY_GNUC_VERSION +#endif + +#if defined(JSON_HEDLEY_GCC_VERSION_CHECK) + #undef JSON_HEDLEY_GCC_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_GCC_VERSION) + #define JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_GCC_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_HAS_ATTRIBUTE) + #undef JSON_HEDLEY_HAS_ATTRIBUTE +#endif +#if \ + defined(__has_attribute) && \ + ( \ + (!defined(JSON_HEDLEY_IAR_VERSION) || JSON_HEDLEY_IAR_VERSION_CHECK(8,5,9)) \ + ) +# define JSON_HEDLEY_HAS_ATTRIBUTE(attribute) __has_attribute(attribute) +#else +# define JSON_HEDLEY_HAS_ATTRIBUTE(attribute) (0) +#endif + +#if defined(JSON_HEDLEY_GNUC_HAS_ATTRIBUTE) + #undef JSON_HEDLEY_GNUC_HAS_ATTRIBUTE +#endif +#if defined(__has_attribute) + #define JSON_HEDLEY_GNUC_HAS_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_HAS_ATTRIBUTE(attribute) +#else + #define JSON_HEDLEY_GNUC_HAS_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) +#endif + +#if defined(JSON_HEDLEY_GCC_HAS_ATTRIBUTE) + #undef JSON_HEDLEY_GCC_HAS_ATTRIBUTE +#endif +#if defined(__has_attribute) + #define JSON_HEDLEY_GCC_HAS_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_HAS_ATTRIBUTE(attribute) +#else + #define JSON_HEDLEY_GCC_HAS_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) +#endif + +#if defined(JSON_HEDLEY_HAS_CPP_ATTRIBUTE) + #undef JSON_HEDLEY_HAS_CPP_ATTRIBUTE +#endif +#if \ + defined(__has_cpp_attribute) && \ + defined(__cplusplus) && \ + (!defined(JSON_HEDLEY_SUNPRO_VERSION) || JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,15,0)) + #define JSON_HEDLEY_HAS_CPP_ATTRIBUTE(attribute) __has_cpp_attribute(attribute) +#else + #define JSON_HEDLEY_HAS_CPP_ATTRIBUTE(attribute) (0) +#endif + +#if defined(JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS) + #undef JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS +#endif +#if !defined(__cplusplus) || !defined(__has_cpp_attribute) + #define JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS(ns,attribute) (0) +#elif \ + !defined(JSON_HEDLEY_PGI_VERSION) && \ + !defined(JSON_HEDLEY_IAR_VERSION) && \ + (!defined(JSON_HEDLEY_SUNPRO_VERSION) || JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,15,0)) && \ + (!defined(JSON_HEDLEY_MSVC_VERSION) || JSON_HEDLEY_MSVC_VERSION_CHECK(19,20,0)) + #define JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS(ns,attribute) JSON_HEDLEY_HAS_CPP_ATTRIBUTE(ns::attribute) +#else + #define JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS(ns,attribute) (0) +#endif + +#if defined(JSON_HEDLEY_GNUC_HAS_CPP_ATTRIBUTE) + #undef JSON_HEDLEY_GNUC_HAS_CPP_ATTRIBUTE +#endif +#if defined(__has_cpp_attribute) && defined(__cplusplus) + #define JSON_HEDLEY_GNUC_HAS_CPP_ATTRIBUTE(attribute,major,minor,patch) __has_cpp_attribute(attribute) +#else + #define JSON_HEDLEY_GNUC_HAS_CPP_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) +#endif + +#if defined(JSON_HEDLEY_GCC_HAS_CPP_ATTRIBUTE) + #undef JSON_HEDLEY_GCC_HAS_CPP_ATTRIBUTE +#endif +#if defined(__has_cpp_attribute) && defined(__cplusplus) + #define JSON_HEDLEY_GCC_HAS_CPP_ATTRIBUTE(attribute,major,minor,patch) __has_cpp_attribute(attribute) +#else + #define JSON_HEDLEY_GCC_HAS_CPP_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) +#endif + +#if defined(JSON_HEDLEY_HAS_BUILTIN) + #undef JSON_HEDLEY_HAS_BUILTIN +#endif +#if defined(__has_builtin) + #define JSON_HEDLEY_HAS_BUILTIN(builtin) __has_builtin(builtin) +#else + #define JSON_HEDLEY_HAS_BUILTIN(builtin) (0) +#endif + +#if defined(JSON_HEDLEY_GNUC_HAS_BUILTIN) + #undef JSON_HEDLEY_GNUC_HAS_BUILTIN +#endif +#if defined(__has_builtin) + #define JSON_HEDLEY_GNUC_HAS_BUILTIN(builtin,major,minor,patch) __has_builtin(builtin) +#else + #define JSON_HEDLEY_GNUC_HAS_BUILTIN(builtin,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) +#endif + +#if defined(JSON_HEDLEY_GCC_HAS_BUILTIN) + #undef JSON_HEDLEY_GCC_HAS_BUILTIN +#endif +#if defined(__has_builtin) + #define JSON_HEDLEY_GCC_HAS_BUILTIN(builtin,major,minor,patch) __has_builtin(builtin) +#else + #define JSON_HEDLEY_GCC_HAS_BUILTIN(builtin,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) +#endif + +#if defined(JSON_HEDLEY_HAS_FEATURE) + #undef JSON_HEDLEY_HAS_FEATURE +#endif +#if defined(__has_feature) + #define JSON_HEDLEY_HAS_FEATURE(feature) __has_feature(feature) +#else + #define JSON_HEDLEY_HAS_FEATURE(feature) (0) +#endif + +#if defined(JSON_HEDLEY_GNUC_HAS_FEATURE) + #undef JSON_HEDLEY_GNUC_HAS_FEATURE +#endif +#if defined(__has_feature) + #define JSON_HEDLEY_GNUC_HAS_FEATURE(feature,major,minor,patch) __has_feature(feature) +#else + #define JSON_HEDLEY_GNUC_HAS_FEATURE(feature,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) +#endif + +#if defined(JSON_HEDLEY_GCC_HAS_FEATURE) + #undef JSON_HEDLEY_GCC_HAS_FEATURE +#endif +#if defined(__has_feature) + #define JSON_HEDLEY_GCC_HAS_FEATURE(feature,major,minor,patch) __has_feature(feature) +#else + #define JSON_HEDLEY_GCC_HAS_FEATURE(feature,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) +#endif + +#if defined(JSON_HEDLEY_HAS_EXTENSION) + #undef JSON_HEDLEY_HAS_EXTENSION +#endif +#if defined(__has_extension) + #define JSON_HEDLEY_HAS_EXTENSION(extension) __has_extension(extension) +#else + #define JSON_HEDLEY_HAS_EXTENSION(extension) (0) +#endif + +#if defined(JSON_HEDLEY_GNUC_HAS_EXTENSION) + #undef JSON_HEDLEY_GNUC_HAS_EXTENSION +#endif +#if defined(__has_extension) + #define JSON_HEDLEY_GNUC_HAS_EXTENSION(extension,major,minor,patch) __has_extension(extension) +#else + #define JSON_HEDLEY_GNUC_HAS_EXTENSION(extension,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) +#endif + +#if defined(JSON_HEDLEY_GCC_HAS_EXTENSION) + #undef JSON_HEDLEY_GCC_HAS_EXTENSION +#endif +#if defined(__has_extension) + #define JSON_HEDLEY_GCC_HAS_EXTENSION(extension,major,minor,patch) __has_extension(extension) +#else + #define JSON_HEDLEY_GCC_HAS_EXTENSION(extension,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) +#endif + +#if defined(JSON_HEDLEY_HAS_DECLSPEC_ATTRIBUTE) + #undef JSON_HEDLEY_HAS_DECLSPEC_ATTRIBUTE +#endif +#if defined(__has_declspec_attribute) + #define JSON_HEDLEY_HAS_DECLSPEC_ATTRIBUTE(attribute) __has_declspec_attribute(attribute) +#else + #define JSON_HEDLEY_HAS_DECLSPEC_ATTRIBUTE(attribute) (0) +#endif + +#if defined(JSON_HEDLEY_GNUC_HAS_DECLSPEC_ATTRIBUTE) + #undef JSON_HEDLEY_GNUC_HAS_DECLSPEC_ATTRIBUTE +#endif +#if defined(__has_declspec_attribute) + #define JSON_HEDLEY_GNUC_HAS_DECLSPEC_ATTRIBUTE(attribute,major,minor,patch) __has_declspec_attribute(attribute) +#else + #define JSON_HEDLEY_GNUC_HAS_DECLSPEC_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) +#endif + +#if defined(JSON_HEDLEY_GCC_HAS_DECLSPEC_ATTRIBUTE) + #undef JSON_HEDLEY_GCC_HAS_DECLSPEC_ATTRIBUTE +#endif +#if defined(__has_declspec_attribute) + #define JSON_HEDLEY_GCC_HAS_DECLSPEC_ATTRIBUTE(attribute,major,minor,patch) __has_declspec_attribute(attribute) +#else + #define JSON_HEDLEY_GCC_HAS_DECLSPEC_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) +#endif + +#if defined(JSON_HEDLEY_HAS_WARNING) + #undef JSON_HEDLEY_HAS_WARNING +#endif +#if defined(__has_warning) + #define JSON_HEDLEY_HAS_WARNING(warning) __has_warning(warning) +#else + #define JSON_HEDLEY_HAS_WARNING(warning) (0) +#endif + +#if defined(JSON_HEDLEY_GNUC_HAS_WARNING) + #undef JSON_HEDLEY_GNUC_HAS_WARNING +#endif +#if defined(__has_warning) + #define JSON_HEDLEY_GNUC_HAS_WARNING(warning,major,minor,patch) __has_warning(warning) +#else + #define JSON_HEDLEY_GNUC_HAS_WARNING(warning,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) +#endif + +#if defined(JSON_HEDLEY_GCC_HAS_WARNING) + #undef JSON_HEDLEY_GCC_HAS_WARNING +#endif +#if defined(__has_warning) + #define JSON_HEDLEY_GCC_HAS_WARNING(warning,major,minor,patch) __has_warning(warning) +#else + #define JSON_HEDLEY_GCC_HAS_WARNING(warning,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) +#endif + +#if \ + (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) || \ + defined(__clang__) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(3,0,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) || \ + JSON_HEDLEY_PGI_VERSION_CHECK(18,4,0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ + JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,7,0) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(2,0,1) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,1,0) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,0,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ + JSON_HEDLEY_CRAY_VERSION_CHECK(5,0,0) || \ + JSON_HEDLEY_TINYC_VERSION_CHECK(0,9,17) || \ + JSON_HEDLEY_SUNPRO_VERSION_CHECK(8,0,0) || \ + (JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) && defined(__C99_PRAGMA_OPERATOR)) + #define JSON_HEDLEY_PRAGMA(value) _Pragma(#value) +#elif JSON_HEDLEY_MSVC_VERSION_CHECK(15,0,0) + #define JSON_HEDLEY_PRAGMA(value) __pragma(value) +#else + #define JSON_HEDLEY_PRAGMA(value) +#endif + +#if defined(JSON_HEDLEY_DIAGNOSTIC_PUSH) + #undef JSON_HEDLEY_DIAGNOSTIC_PUSH +#endif +#if defined(JSON_HEDLEY_DIAGNOSTIC_POP) + #undef JSON_HEDLEY_DIAGNOSTIC_POP +#endif +#if defined(__clang__) + #define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("clang diagnostic push") + #define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("clang diagnostic pop") +#elif JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) + #define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("warning(push)") + #define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("warning(pop)") +#elif JSON_HEDLEY_GCC_VERSION_CHECK(4,6,0) + #define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("GCC diagnostic push") + #define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("GCC diagnostic pop") +#elif \ + JSON_HEDLEY_MSVC_VERSION_CHECK(15,0,0) || \ + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) + #define JSON_HEDLEY_DIAGNOSTIC_PUSH __pragma(warning(push)) + #define JSON_HEDLEY_DIAGNOSTIC_POP __pragma(warning(pop)) +#elif JSON_HEDLEY_ARM_VERSION_CHECK(5,6,0) + #define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("push") + #define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("pop") +#elif \ + JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,4,0) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,1,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) + #define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("diag_push") + #define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("diag_pop") +#elif JSON_HEDLEY_PELLES_VERSION_CHECK(2,90,0) + #define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("warning(push)") + #define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("warning(pop)") +#else + #define JSON_HEDLEY_DIAGNOSTIC_PUSH + #define JSON_HEDLEY_DIAGNOSTIC_POP +#endif + +/* JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_ is for + HEDLEY INTERNAL USE ONLY. API subject to change without notice. */ +#if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_) + #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_ +#endif +#if defined(__cplusplus) +# if JSON_HEDLEY_HAS_WARNING("-Wc++98-compat") +# if JSON_HEDLEY_HAS_WARNING("-Wc++17-extensions") +# if JSON_HEDLEY_HAS_WARNING("-Wc++1z-extensions") +# define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(xpr) \ + JSON_HEDLEY_DIAGNOSTIC_PUSH \ + _Pragma("clang diagnostic ignored \"-Wc++98-compat\"") \ + _Pragma("clang diagnostic ignored \"-Wc++17-extensions\"") \ + _Pragma("clang diagnostic ignored \"-Wc++1z-extensions\"") \ + xpr \ + JSON_HEDLEY_DIAGNOSTIC_POP +# else +# define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(xpr) \ + JSON_HEDLEY_DIAGNOSTIC_PUSH \ + _Pragma("clang diagnostic ignored \"-Wc++98-compat\"") \ + _Pragma("clang diagnostic ignored \"-Wc++17-extensions\"") \ + xpr \ + JSON_HEDLEY_DIAGNOSTIC_POP +# endif +# else +# define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(xpr) \ + JSON_HEDLEY_DIAGNOSTIC_PUSH \ + _Pragma("clang diagnostic ignored \"-Wc++98-compat\"") \ + xpr \ + JSON_HEDLEY_DIAGNOSTIC_POP +# endif +# endif +#endif +#if !defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(x) x +#endif + +#if defined(JSON_HEDLEY_CONST_CAST) + #undef JSON_HEDLEY_CONST_CAST +#endif +#if defined(__cplusplus) +# define JSON_HEDLEY_CONST_CAST(T, expr) (const_cast(expr)) +#elif \ + JSON_HEDLEY_HAS_WARNING("-Wcast-qual") || \ + JSON_HEDLEY_GCC_VERSION_CHECK(4,6,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) +# define JSON_HEDLEY_CONST_CAST(T, expr) (__extension__ ({ \ + JSON_HEDLEY_DIAGNOSTIC_PUSH \ + JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL \ + ((T) (expr)); \ + JSON_HEDLEY_DIAGNOSTIC_POP \ + })) +#else +# define JSON_HEDLEY_CONST_CAST(T, expr) ((T) (expr)) +#endif + +#if defined(JSON_HEDLEY_REINTERPRET_CAST) + #undef JSON_HEDLEY_REINTERPRET_CAST +#endif +#if defined(__cplusplus) + #define JSON_HEDLEY_REINTERPRET_CAST(T, expr) (reinterpret_cast(expr)) +#else + #define JSON_HEDLEY_REINTERPRET_CAST(T, expr) ((T) (expr)) +#endif + +#if defined(JSON_HEDLEY_STATIC_CAST) + #undef JSON_HEDLEY_STATIC_CAST +#endif +#if defined(__cplusplus) + #define JSON_HEDLEY_STATIC_CAST(T, expr) (static_cast(expr)) +#else + #define JSON_HEDLEY_STATIC_CAST(T, expr) ((T) (expr)) +#endif + +#if defined(JSON_HEDLEY_CPP_CAST) + #undef JSON_HEDLEY_CPP_CAST +#endif +#if defined(__cplusplus) +# if JSON_HEDLEY_HAS_WARNING("-Wold-style-cast") +# define JSON_HEDLEY_CPP_CAST(T, expr) \ + JSON_HEDLEY_DIAGNOSTIC_PUSH \ + _Pragma("clang diagnostic ignored \"-Wold-style-cast\"") \ + ((T) (expr)) \ + JSON_HEDLEY_DIAGNOSTIC_POP +# elif JSON_HEDLEY_IAR_VERSION_CHECK(8,3,0) +# define JSON_HEDLEY_CPP_CAST(T, expr) \ + JSON_HEDLEY_DIAGNOSTIC_PUSH \ + _Pragma("diag_suppress=Pe137") \ + JSON_HEDLEY_DIAGNOSTIC_POP +# else +# define JSON_HEDLEY_CPP_CAST(T, expr) ((T) (expr)) +# endif +#else +# define JSON_HEDLEY_CPP_CAST(T, expr) (expr) +#endif + +#if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED) + #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED +#endif +#if JSON_HEDLEY_HAS_WARNING("-Wdeprecated-declarations") + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"") +#elif JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("warning(disable:1478 1786)") +#elif JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED __pragma(warning(disable:1478 1786)) +#elif JSON_HEDLEY_PGI_VERSION_CHECK(20,7,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("diag_suppress 1215,1216,1444,1445") +#elif JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("diag_suppress 1215,1444") +#elif JSON_HEDLEY_GCC_VERSION_CHECK(4,3,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") +#elif JSON_HEDLEY_MSVC_VERSION_CHECK(15,0,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED __pragma(warning(disable:4996)) +#elif JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("diag_suppress 1215,1444") +#elif \ + JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ + (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ + (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ + (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ + (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("diag_suppress 1291,1718") +#elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,13,0) && !defined(__cplusplus) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("error_messages(off,E_DEPRECATED_ATT,E_DEPRECATED_ATT_MESS)") +#elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,13,0) && defined(__cplusplus) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("error_messages(off,symdeprecated,symdeprecated2)") +#elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("diag_suppress=Pe1444,Pe1215") +#elif JSON_HEDLEY_PELLES_VERSION_CHECK(2,90,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("warn(disable:2241)") +#else + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED +#endif + +#if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS) + #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS +#endif +#if JSON_HEDLEY_HAS_WARNING("-Wunknown-pragmas") + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("clang diagnostic ignored \"-Wunknown-pragmas\"") +#elif JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("warning(disable:161)") +#elif JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS __pragma(warning(disable:161)) +#elif JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("diag_suppress 1675") +#elif JSON_HEDLEY_GCC_VERSION_CHECK(4,3,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("GCC diagnostic ignored \"-Wunknown-pragmas\"") +#elif JSON_HEDLEY_MSVC_VERSION_CHECK(15,0,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS __pragma(warning(disable:4068)) +#elif \ + JSON_HEDLEY_TI_VERSION_CHECK(16,9,0) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,0,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,3,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("diag_suppress 163") +#elif JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,0,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("diag_suppress 163") +#elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("diag_suppress=Pe161") +#elif JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("diag_suppress 161") +#else + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS +#endif + +#if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES) + #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES +#endif +#if JSON_HEDLEY_HAS_WARNING("-Wunknown-attributes") + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("clang diagnostic ignored \"-Wunknown-attributes\"") +#elif JSON_HEDLEY_GCC_VERSION_CHECK(4,6,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") +#elif JSON_HEDLEY_INTEL_VERSION_CHECK(17,0,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("warning(disable:1292)") +#elif JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES __pragma(warning(disable:1292)) +#elif JSON_HEDLEY_MSVC_VERSION_CHECK(19,0,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES __pragma(warning(disable:5030)) +#elif JSON_HEDLEY_PGI_VERSION_CHECK(20,7,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("diag_suppress 1097,1098") +#elif JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("diag_suppress 1097") +#elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,14,0) && defined(__cplusplus) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("error_messages(off,attrskipunsup)") +#elif \ + JSON_HEDLEY_TI_VERSION_CHECK(18,1,0) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,3,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("diag_suppress 1173") +#elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("diag_suppress=Pe1097") +#elif JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("diag_suppress 1097") +#else + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES +#endif + +#if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL) + #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL +#endif +#if JSON_HEDLEY_HAS_WARNING("-Wcast-qual") + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL _Pragma("clang diagnostic ignored \"-Wcast-qual\"") +#elif JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL _Pragma("warning(disable:2203 2331)") +#elif JSON_HEDLEY_GCC_VERSION_CHECK(3,0,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL _Pragma("GCC diagnostic ignored \"-Wcast-qual\"") +#else + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL +#endif + +#if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION) + #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION +#endif +#if JSON_HEDLEY_HAS_WARNING("-Wunused-function") + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION _Pragma("clang diagnostic ignored \"-Wunused-function\"") +#elif JSON_HEDLEY_GCC_VERSION_CHECK(3,4,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION _Pragma("GCC diagnostic ignored \"-Wunused-function\"") +#elif JSON_HEDLEY_MSVC_VERSION_CHECK(1,0,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION __pragma(warning(disable:4505)) +#elif JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION _Pragma("diag_suppress 3142") +#else + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION +#endif + +#if defined(JSON_HEDLEY_DEPRECATED) + #undef JSON_HEDLEY_DEPRECATED +#endif +#if defined(JSON_HEDLEY_DEPRECATED_FOR) + #undef JSON_HEDLEY_DEPRECATED_FOR +#endif +#if \ + JSON_HEDLEY_MSVC_VERSION_CHECK(14,0,0) || \ + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) + #define JSON_HEDLEY_DEPRECATED(since) __declspec(deprecated("Since " # since)) + #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) __declspec(deprecated("Since " #since "; use " #replacement)) +#elif \ + (JSON_HEDLEY_HAS_EXTENSION(attribute_deprecated_with_message) && !defined(JSON_HEDLEY_IAR_VERSION)) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(4,5,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(5,6,0) || \ + JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,13,0) || \ + JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) || \ + JSON_HEDLEY_TI_VERSION_CHECK(18,1,0) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(18,1,0) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,3,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,3,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_DEPRECATED(since) __attribute__((__deprecated__("Since " #since))) + #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) __attribute__((__deprecated__("Since " #since "; use " #replacement))) +#elif defined(__cplusplus) && (__cplusplus >= 201402L) + #define JSON_HEDLEY_DEPRECATED(since) JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[deprecated("Since " #since)]]) + #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[deprecated("Since " #since "; use " #replacement)]]) +#elif \ + JSON_HEDLEY_HAS_ATTRIBUTE(deprecated) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(3,1,0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ + JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ + (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ + (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ + (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ + (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) || \ + JSON_HEDLEY_IAR_VERSION_CHECK(8,10,0) + #define JSON_HEDLEY_DEPRECATED(since) __attribute__((__deprecated__)) + #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) __attribute__((__deprecated__)) +#elif \ + JSON_HEDLEY_MSVC_VERSION_CHECK(13,10,0) || \ + JSON_HEDLEY_PELLES_VERSION_CHECK(6,50,0) || \ + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) + #define JSON_HEDLEY_DEPRECATED(since) __declspec(deprecated) + #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) __declspec(deprecated) +#elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) + #define JSON_HEDLEY_DEPRECATED(since) _Pragma("deprecated") + #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) _Pragma("deprecated") +#else + #define JSON_HEDLEY_DEPRECATED(since) + #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) +#endif + +#if defined(JSON_HEDLEY_UNAVAILABLE) + #undef JSON_HEDLEY_UNAVAILABLE +#endif +#if \ + JSON_HEDLEY_HAS_ATTRIBUTE(warning) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(4,3,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_UNAVAILABLE(available_since) __attribute__((__warning__("Not available until " #available_since))) +#else + #define JSON_HEDLEY_UNAVAILABLE(available_since) +#endif + +#if defined(JSON_HEDLEY_WARN_UNUSED_RESULT) + #undef JSON_HEDLEY_WARN_UNUSED_RESULT +#endif +#if defined(JSON_HEDLEY_WARN_UNUSED_RESULT_MSG) + #undef JSON_HEDLEY_WARN_UNUSED_RESULT_MSG +#endif +#if \ + JSON_HEDLEY_HAS_ATTRIBUTE(warn_unused_result) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(3,4,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ + (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ + (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ + (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ + (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ + (JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,15,0) && defined(__cplusplus)) || \ + JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_WARN_UNUSED_RESULT __attribute__((__warn_unused_result__)) + #define JSON_HEDLEY_WARN_UNUSED_RESULT_MSG(msg) __attribute__((__warn_unused_result__)) +#elif (JSON_HEDLEY_HAS_CPP_ATTRIBUTE(nodiscard) >= 201907L) + #define JSON_HEDLEY_WARN_UNUSED_RESULT JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[nodiscard]]) + #define JSON_HEDLEY_WARN_UNUSED_RESULT_MSG(msg) JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[nodiscard(msg)]]) +#elif JSON_HEDLEY_HAS_CPP_ATTRIBUTE(nodiscard) + #define JSON_HEDLEY_WARN_UNUSED_RESULT JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[nodiscard]]) + #define JSON_HEDLEY_WARN_UNUSED_RESULT_MSG(msg) JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[nodiscard]]) +#elif defined(_Check_return_) /* SAL */ + #define JSON_HEDLEY_WARN_UNUSED_RESULT _Check_return_ + #define JSON_HEDLEY_WARN_UNUSED_RESULT_MSG(msg) _Check_return_ +#else + #define JSON_HEDLEY_WARN_UNUSED_RESULT + #define JSON_HEDLEY_WARN_UNUSED_RESULT_MSG(msg) +#endif + +#if defined(JSON_HEDLEY_SENTINEL) + #undef JSON_HEDLEY_SENTINEL +#endif +#if \ + JSON_HEDLEY_HAS_ATTRIBUTE(sentinel) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(4,0,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(5,4,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_SENTINEL(position) __attribute__((__sentinel__(position))) +#else + #define JSON_HEDLEY_SENTINEL(position) +#endif + +#if defined(JSON_HEDLEY_NO_RETURN) + #undef JSON_HEDLEY_NO_RETURN +#endif +#if JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) + #define JSON_HEDLEY_NO_RETURN __noreturn +#elif \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_NO_RETURN __attribute__((__noreturn__)) +#elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L + #define JSON_HEDLEY_NO_RETURN _Noreturn +#elif defined(__cplusplus) && (__cplusplus >= 201103L) + #define JSON_HEDLEY_NO_RETURN JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[noreturn]]) +#elif \ + JSON_HEDLEY_HAS_ATTRIBUTE(noreturn) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(3,2,0) || \ + JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ + JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ + JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ + (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ + (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ + (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ + (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ + JSON_HEDLEY_IAR_VERSION_CHECK(8,10,0) + #define JSON_HEDLEY_NO_RETURN __attribute__((__noreturn__)) +#elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,10,0) + #define JSON_HEDLEY_NO_RETURN _Pragma("does_not_return") +#elif \ + JSON_HEDLEY_MSVC_VERSION_CHECK(13,10,0) || \ + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) + #define JSON_HEDLEY_NO_RETURN __declspec(noreturn) +#elif JSON_HEDLEY_TI_CL6X_VERSION_CHECK(6,0,0) && defined(__cplusplus) + #define JSON_HEDLEY_NO_RETURN _Pragma("FUNC_NEVER_RETURNS;") +#elif JSON_HEDLEY_COMPCERT_VERSION_CHECK(3,2,0) + #define JSON_HEDLEY_NO_RETURN __attribute((noreturn)) +#elif JSON_HEDLEY_PELLES_VERSION_CHECK(9,0,0) + #define JSON_HEDLEY_NO_RETURN __declspec(noreturn) +#else + #define JSON_HEDLEY_NO_RETURN +#endif + +#if defined(JSON_HEDLEY_NO_ESCAPE) + #undef JSON_HEDLEY_NO_ESCAPE +#endif +#if JSON_HEDLEY_HAS_ATTRIBUTE(noescape) + #define JSON_HEDLEY_NO_ESCAPE __attribute__((__noescape__)) +#else + #define JSON_HEDLEY_NO_ESCAPE +#endif + +#if defined(JSON_HEDLEY_UNREACHABLE) + #undef JSON_HEDLEY_UNREACHABLE +#endif +#if defined(JSON_HEDLEY_UNREACHABLE_RETURN) + #undef JSON_HEDLEY_UNREACHABLE_RETURN +#endif +#if defined(JSON_HEDLEY_ASSUME) + #undef JSON_HEDLEY_ASSUME +#endif +#if \ + JSON_HEDLEY_MSVC_VERSION_CHECK(13,10,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) + #define JSON_HEDLEY_ASSUME(expr) __assume(expr) +#elif JSON_HEDLEY_HAS_BUILTIN(__builtin_assume) + #define JSON_HEDLEY_ASSUME(expr) __builtin_assume(expr) +#elif \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,2,0) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(4,0,0) + #if defined(__cplusplus) + #define JSON_HEDLEY_ASSUME(expr) std::_nassert(expr) + #else + #define JSON_HEDLEY_ASSUME(expr) _nassert(expr) + #endif +#endif +#if \ + (JSON_HEDLEY_HAS_BUILTIN(__builtin_unreachable) && (!defined(JSON_HEDLEY_ARM_VERSION))) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(4,5,0) || \ + JSON_HEDLEY_PGI_VERSION_CHECK(18,10,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_IBM_VERSION_CHECK(13,1,5) || \ + JSON_HEDLEY_CRAY_VERSION_CHECK(10,0,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_UNREACHABLE() __builtin_unreachable() +#elif defined(JSON_HEDLEY_ASSUME) + #define JSON_HEDLEY_UNREACHABLE() JSON_HEDLEY_ASSUME(0) +#endif +#if !defined(JSON_HEDLEY_ASSUME) + #if defined(JSON_HEDLEY_UNREACHABLE) + #define JSON_HEDLEY_ASSUME(expr) JSON_HEDLEY_STATIC_CAST(void, ((expr) ? 1 : (JSON_HEDLEY_UNREACHABLE(), 1))) + #else + #define JSON_HEDLEY_ASSUME(expr) JSON_HEDLEY_STATIC_CAST(void, expr) + #endif +#endif +#if defined(JSON_HEDLEY_UNREACHABLE) + #if \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,2,0) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(4,0,0) + #define JSON_HEDLEY_UNREACHABLE_RETURN(value) return (JSON_HEDLEY_STATIC_CAST(void, JSON_HEDLEY_ASSUME(0)), (value)) + #else + #define JSON_HEDLEY_UNREACHABLE_RETURN(value) JSON_HEDLEY_UNREACHABLE() + #endif +#else + #define JSON_HEDLEY_UNREACHABLE_RETURN(value) return (value) +#endif +#if !defined(JSON_HEDLEY_UNREACHABLE) + #define JSON_HEDLEY_UNREACHABLE() JSON_HEDLEY_ASSUME(0) +#endif + +JSON_HEDLEY_DIAGNOSTIC_PUSH +#if JSON_HEDLEY_HAS_WARNING("-Wpedantic") + #pragma clang diagnostic ignored "-Wpedantic" +#endif +#if JSON_HEDLEY_HAS_WARNING("-Wc++98-compat-pedantic") && defined(__cplusplus) + #pragma clang diagnostic ignored "-Wc++98-compat-pedantic" +#endif +#if JSON_HEDLEY_GCC_HAS_WARNING("-Wvariadic-macros",4,0,0) + #if defined(__clang__) + #pragma clang diagnostic ignored "-Wvariadic-macros" + #elif defined(JSON_HEDLEY_GCC_VERSION) + #pragma GCC diagnostic ignored "-Wvariadic-macros" + #endif +#endif +#if defined(JSON_HEDLEY_NON_NULL) + #undef JSON_HEDLEY_NON_NULL +#endif +#if \ + JSON_HEDLEY_HAS_ATTRIBUTE(nonnull) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(3,3,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) + #define JSON_HEDLEY_NON_NULL(...) __attribute__((__nonnull__(__VA_ARGS__))) +#else + #define JSON_HEDLEY_NON_NULL(...) +#endif +JSON_HEDLEY_DIAGNOSTIC_POP + +#if defined(JSON_HEDLEY_PRINTF_FORMAT) + #undef JSON_HEDLEY_PRINTF_FORMAT +#endif +#if defined(__MINGW32__) && JSON_HEDLEY_GCC_HAS_ATTRIBUTE(format,4,4,0) && !defined(__USE_MINGW_ANSI_STDIO) + #define JSON_HEDLEY_PRINTF_FORMAT(string_idx,first_to_check) __attribute__((__format__(ms_printf, string_idx, first_to_check))) +#elif defined(__MINGW32__) && JSON_HEDLEY_GCC_HAS_ATTRIBUTE(format,4,4,0) && defined(__USE_MINGW_ANSI_STDIO) + #define JSON_HEDLEY_PRINTF_FORMAT(string_idx,first_to_check) __attribute__((__format__(gnu_printf, string_idx, first_to_check))) +#elif \ + JSON_HEDLEY_HAS_ATTRIBUTE(format) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(3,1,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(5,6,0) || \ + JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ + JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ + (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ + (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ + (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ + (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_PRINTF_FORMAT(string_idx,first_to_check) __attribute__((__format__(__printf__, string_idx, first_to_check))) +#elif JSON_HEDLEY_PELLES_VERSION_CHECK(6,0,0) + #define JSON_HEDLEY_PRINTF_FORMAT(string_idx,first_to_check) __declspec(vaformat(printf,string_idx,first_to_check)) +#else + #define JSON_HEDLEY_PRINTF_FORMAT(string_idx,first_to_check) +#endif + +#if defined(JSON_HEDLEY_CONSTEXPR) + #undef JSON_HEDLEY_CONSTEXPR +#endif +#if defined(__cplusplus) + #if __cplusplus >= 201103L + #define JSON_HEDLEY_CONSTEXPR JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(constexpr) + #endif +#endif +#if !defined(JSON_HEDLEY_CONSTEXPR) + #define JSON_HEDLEY_CONSTEXPR +#endif + +#if defined(JSON_HEDLEY_PREDICT) + #undef JSON_HEDLEY_PREDICT +#endif +#if defined(JSON_HEDLEY_LIKELY) + #undef JSON_HEDLEY_LIKELY +#endif +#if defined(JSON_HEDLEY_UNLIKELY) + #undef JSON_HEDLEY_UNLIKELY +#endif +#if defined(JSON_HEDLEY_UNPREDICTABLE) + #undef JSON_HEDLEY_UNPREDICTABLE +#endif +#if JSON_HEDLEY_HAS_BUILTIN(__builtin_unpredictable) + #define JSON_HEDLEY_UNPREDICTABLE(expr) __builtin_unpredictable((expr)) +#endif +#if \ + (JSON_HEDLEY_HAS_BUILTIN(__builtin_expect_with_probability) && !defined(JSON_HEDLEY_PGI_VERSION)) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(9,0,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) +# define JSON_HEDLEY_PREDICT(expr, value, probability) __builtin_expect_with_probability( (expr), (value), (probability)) +# define JSON_HEDLEY_PREDICT_TRUE(expr, probability) __builtin_expect_with_probability(!!(expr), 1 , (probability)) +# define JSON_HEDLEY_PREDICT_FALSE(expr, probability) __builtin_expect_with_probability(!!(expr), 0 , (probability)) +# define JSON_HEDLEY_LIKELY(expr) __builtin_expect (!!(expr), 1 ) +# define JSON_HEDLEY_UNLIKELY(expr) __builtin_expect (!!(expr), 0 ) +#elif \ + (JSON_HEDLEY_HAS_BUILTIN(__builtin_expect) && !defined(JSON_HEDLEY_INTEL_CL_VERSION)) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(3,0,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + (JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,15,0) && defined(__cplusplus)) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ + JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ + JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,7,0) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(3,1,0) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,1,0) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(6,1,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ + JSON_HEDLEY_TINYC_VERSION_CHECK(0,9,27) || \ + JSON_HEDLEY_CRAY_VERSION_CHECK(8,1,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) +# define JSON_HEDLEY_PREDICT(expr, expected, probability) \ + (((probability) >= 0.9) ? __builtin_expect((expr), (expected)) : (JSON_HEDLEY_STATIC_CAST(void, expected), (expr))) +# define JSON_HEDLEY_PREDICT_TRUE(expr, probability) \ + (__extension__ ({ \ + double hedley_probability_ = (probability); \ + ((hedley_probability_ >= 0.9) ? __builtin_expect(!!(expr), 1) : ((hedley_probability_ <= 0.1) ? __builtin_expect(!!(expr), 0) : !!(expr))); \ + })) +# define JSON_HEDLEY_PREDICT_FALSE(expr, probability) \ + (__extension__ ({ \ + double hedley_probability_ = (probability); \ + ((hedley_probability_ >= 0.9) ? __builtin_expect(!!(expr), 0) : ((hedley_probability_ <= 0.1) ? __builtin_expect(!!(expr), 1) : !!(expr))); \ + })) +# define JSON_HEDLEY_LIKELY(expr) __builtin_expect(!!(expr), 1) +# define JSON_HEDLEY_UNLIKELY(expr) __builtin_expect(!!(expr), 0) +#else +# define JSON_HEDLEY_PREDICT(expr, expected, probability) (JSON_HEDLEY_STATIC_CAST(void, expected), (expr)) +# define JSON_HEDLEY_PREDICT_TRUE(expr, probability) (!!(expr)) +# define JSON_HEDLEY_PREDICT_FALSE(expr, probability) (!!(expr)) +# define JSON_HEDLEY_LIKELY(expr) (!!(expr)) +# define JSON_HEDLEY_UNLIKELY(expr) (!!(expr)) +#endif +#if !defined(JSON_HEDLEY_UNPREDICTABLE) + #define JSON_HEDLEY_UNPREDICTABLE(expr) JSON_HEDLEY_PREDICT(expr, 1, 0.5) +#endif + +#if defined(JSON_HEDLEY_MALLOC) + #undef JSON_HEDLEY_MALLOC +#endif +#if \ + JSON_HEDLEY_HAS_ATTRIBUTE(malloc) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(3,1,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ + JSON_HEDLEY_IBM_VERSION_CHECK(12,1,0) || \ + JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ + (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ + (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ + (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ + (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_MALLOC __attribute__((__malloc__)) +#elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,10,0) + #define JSON_HEDLEY_MALLOC _Pragma("returns_new_memory") +#elif \ + JSON_HEDLEY_MSVC_VERSION_CHECK(14,0,0) || \ + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) + #define JSON_HEDLEY_MALLOC __declspec(restrict) +#else + #define JSON_HEDLEY_MALLOC +#endif + +#if defined(JSON_HEDLEY_PURE) + #undef JSON_HEDLEY_PURE +#endif +#if \ + JSON_HEDLEY_HAS_ATTRIBUTE(pure) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(2,96,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ + JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ + JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ + (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ + (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ + (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ + (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ + JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) +# define JSON_HEDLEY_PURE __attribute__((__pure__)) +#elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,10,0) +# define JSON_HEDLEY_PURE _Pragma("does_not_write_global_data") +#elif defined(__cplusplus) && \ + ( \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(2,0,1) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(4,0,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) \ + ) +# define JSON_HEDLEY_PURE _Pragma("FUNC_IS_PURE;") +#else +# define JSON_HEDLEY_PURE +#endif + +#if defined(JSON_HEDLEY_CONST) + #undef JSON_HEDLEY_CONST +#endif +#if \ + JSON_HEDLEY_HAS_ATTRIBUTE(const) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(2,5,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ + JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ + JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ + (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ + (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ + (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ + (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ + JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_CONST __attribute__((__const__)) +#elif \ + JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,10,0) + #define JSON_HEDLEY_CONST _Pragma("no_side_effect") +#else + #define JSON_HEDLEY_CONST JSON_HEDLEY_PURE +#endif + +#if defined(JSON_HEDLEY_RESTRICT) + #undef JSON_HEDLEY_RESTRICT +#endif +#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) && !defined(__cplusplus) + #define JSON_HEDLEY_RESTRICT restrict +#elif \ + JSON_HEDLEY_GCC_VERSION_CHECK(3,1,0) || \ + JSON_HEDLEY_MSVC_VERSION_CHECK(14,0,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ + JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ + JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,2,4) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,1,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + (JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,14,0) && defined(__cplusplus)) || \ + JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) || \ + defined(__clang__) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_RESTRICT __restrict +#elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,3,0) && !defined(__cplusplus) + #define JSON_HEDLEY_RESTRICT _Restrict +#else + #define JSON_HEDLEY_RESTRICT +#endif + +#if defined(JSON_HEDLEY_INLINE) + #undef JSON_HEDLEY_INLINE +#endif +#if \ + (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) || \ + (defined(__cplusplus) && (__cplusplus >= 199711L)) + #define JSON_HEDLEY_INLINE inline +#elif \ + defined(JSON_HEDLEY_GCC_VERSION) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(6,2,0) + #define JSON_HEDLEY_INLINE __inline__ +#elif \ + JSON_HEDLEY_MSVC_VERSION_CHECK(12,0,0) || \ + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,1,0) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(3,1,0) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,2,0) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,0,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_INLINE __inline +#else + #define JSON_HEDLEY_INLINE +#endif + +#if defined(JSON_HEDLEY_ALWAYS_INLINE) + #undef JSON_HEDLEY_ALWAYS_INLINE +#endif +#if \ + JSON_HEDLEY_HAS_ATTRIBUTE(always_inline) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(4,0,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ + JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ + JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ + (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ + (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ + (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ + (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) || \ + JSON_HEDLEY_IAR_VERSION_CHECK(8,10,0) +# define JSON_HEDLEY_ALWAYS_INLINE __attribute__((__always_inline__)) JSON_HEDLEY_INLINE +#elif \ + JSON_HEDLEY_MSVC_VERSION_CHECK(12,0,0) || \ + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) +# define JSON_HEDLEY_ALWAYS_INLINE __forceinline +#elif defined(__cplusplus) && \ + ( \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(6,1,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) \ + ) +# define JSON_HEDLEY_ALWAYS_INLINE _Pragma("FUNC_ALWAYS_INLINE;") +#elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) +# define JSON_HEDLEY_ALWAYS_INLINE _Pragma("inline=forced") +#else +# define JSON_HEDLEY_ALWAYS_INLINE JSON_HEDLEY_INLINE +#endif + +#if defined(JSON_HEDLEY_NEVER_INLINE) + #undef JSON_HEDLEY_NEVER_INLINE +#endif +#if \ + JSON_HEDLEY_HAS_ATTRIBUTE(noinline) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(4,0,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ + JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ + JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ + (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ + (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ + (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ + (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) || \ + JSON_HEDLEY_IAR_VERSION_CHECK(8,10,0) + #define JSON_HEDLEY_NEVER_INLINE __attribute__((__noinline__)) +#elif \ + JSON_HEDLEY_MSVC_VERSION_CHECK(13,10,0) || \ + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) + #define JSON_HEDLEY_NEVER_INLINE __declspec(noinline) +#elif JSON_HEDLEY_PGI_VERSION_CHECK(10,2,0) + #define JSON_HEDLEY_NEVER_INLINE _Pragma("noinline") +#elif JSON_HEDLEY_TI_CL6X_VERSION_CHECK(6,0,0) && defined(__cplusplus) + #define JSON_HEDLEY_NEVER_INLINE _Pragma("FUNC_CANNOT_INLINE;") +#elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) + #define JSON_HEDLEY_NEVER_INLINE _Pragma("inline=never") +#elif JSON_HEDLEY_COMPCERT_VERSION_CHECK(3,2,0) + #define JSON_HEDLEY_NEVER_INLINE __attribute((noinline)) +#elif JSON_HEDLEY_PELLES_VERSION_CHECK(9,0,0) + #define JSON_HEDLEY_NEVER_INLINE __declspec(noinline) +#else + #define JSON_HEDLEY_NEVER_INLINE +#endif + +#if defined(JSON_HEDLEY_PRIVATE) + #undef JSON_HEDLEY_PRIVATE +#endif +#if defined(JSON_HEDLEY_PUBLIC) + #undef JSON_HEDLEY_PUBLIC +#endif +#if defined(JSON_HEDLEY_IMPORT) + #undef JSON_HEDLEY_IMPORT +#endif +#if defined(_WIN32) || defined(__CYGWIN__) +# define JSON_HEDLEY_PRIVATE +# define JSON_HEDLEY_PUBLIC __declspec(dllexport) +# define JSON_HEDLEY_IMPORT __declspec(dllimport) +#else +# if \ + JSON_HEDLEY_HAS_ATTRIBUTE(visibility) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(3,3,0) || \ + JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ + JSON_HEDLEY_IBM_VERSION_CHECK(13,1,0) || \ + ( \ + defined(__TI_EABI__) && \ + ( \ + (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) \ + ) \ + ) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) +# define JSON_HEDLEY_PRIVATE __attribute__((__visibility__("hidden"))) +# define JSON_HEDLEY_PUBLIC __attribute__((__visibility__("default"))) +# else +# define JSON_HEDLEY_PRIVATE +# define JSON_HEDLEY_PUBLIC +# endif +# define JSON_HEDLEY_IMPORT extern +#endif + +#if defined(JSON_HEDLEY_NO_THROW) + #undef JSON_HEDLEY_NO_THROW +#endif +#if \ + JSON_HEDLEY_HAS_ATTRIBUTE(nothrow) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(3,3,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_NO_THROW __attribute__((__nothrow__)) +#elif \ + JSON_HEDLEY_MSVC_VERSION_CHECK(13,1,0) || \ + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) + #define JSON_HEDLEY_NO_THROW __declspec(nothrow) +#else + #define JSON_HEDLEY_NO_THROW +#endif + +#if defined(JSON_HEDLEY_FALL_THROUGH) + #undef JSON_HEDLEY_FALL_THROUGH +#endif +#if \ + JSON_HEDLEY_HAS_ATTRIBUTE(fallthrough) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(7,0,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_FALL_THROUGH __attribute__((__fallthrough__)) +#elif JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS(clang,fallthrough) + #define JSON_HEDLEY_FALL_THROUGH JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[clang::fallthrough]]) +#elif JSON_HEDLEY_HAS_CPP_ATTRIBUTE(fallthrough) + #define JSON_HEDLEY_FALL_THROUGH JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[fallthrough]]) +#elif defined(__fallthrough) /* SAL */ + #define JSON_HEDLEY_FALL_THROUGH __fallthrough +#else + #define JSON_HEDLEY_FALL_THROUGH +#endif + +#if defined(JSON_HEDLEY_RETURNS_NON_NULL) + #undef JSON_HEDLEY_RETURNS_NON_NULL +#endif +#if \ + JSON_HEDLEY_HAS_ATTRIBUTE(returns_nonnull) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(4,9,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_RETURNS_NON_NULL __attribute__((__returns_nonnull__)) +#elif defined(_Ret_notnull_) /* SAL */ + #define JSON_HEDLEY_RETURNS_NON_NULL _Ret_notnull_ +#else + #define JSON_HEDLEY_RETURNS_NON_NULL +#endif + +#if defined(JSON_HEDLEY_ARRAY_PARAM) + #undef JSON_HEDLEY_ARRAY_PARAM +#endif +#if \ + defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) && \ + !defined(__STDC_NO_VLA__) && \ + !defined(__cplusplus) && \ + !defined(JSON_HEDLEY_PGI_VERSION) && \ + !defined(JSON_HEDLEY_TINYC_VERSION) + #define JSON_HEDLEY_ARRAY_PARAM(name) (name) +#else + #define JSON_HEDLEY_ARRAY_PARAM(name) +#endif + +#if defined(JSON_HEDLEY_IS_CONSTANT) + #undef JSON_HEDLEY_IS_CONSTANT +#endif +#if defined(JSON_HEDLEY_REQUIRE_CONSTEXPR) + #undef JSON_HEDLEY_REQUIRE_CONSTEXPR +#endif +/* JSON_HEDLEY_IS_CONSTEXPR_ is for + HEDLEY INTERNAL USE ONLY. API subject to change without notice. */ +#if defined(JSON_HEDLEY_IS_CONSTEXPR_) + #undef JSON_HEDLEY_IS_CONSTEXPR_ +#endif +#if \ + JSON_HEDLEY_HAS_BUILTIN(__builtin_constant_p) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(3,4,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_TINYC_VERSION_CHECK(0,9,19) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ + JSON_HEDLEY_IBM_VERSION_CHECK(13,1,0) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(6,1,0) || \ + (JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,10,0) && !defined(__cplusplus)) || \ + JSON_HEDLEY_CRAY_VERSION_CHECK(8,1,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_IS_CONSTANT(expr) __builtin_constant_p(expr) +#endif +#if !defined(__cplusplus) +# if \ + JSON_HEDLEY_HAS_BUILTIN(__builtin_types_compatible_p) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(3,4,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_IBM_VERSION_CHECK(13,1,0) || \ + JSON_HEDLEY_CRAY_VERSION_CHECK(8,1,0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(5,4,0) || \ + JSON_HEDLEY_TINYC_VERSION_CHECK(0,9,24) +#if defined(__INTPTR_TYPE__) + #define JSON_HEDLEY_IS_CONSTEXPR_(expr) __builtin_types_compatible_p(__typeof__((1 ? (void*) ((__INTPTR_TYPE__) ((expr) * 0)) : (int*) 0)), int*) +#else + #include + #define JSON_HEDLEY_IS_CONSTEXPR_(expr) __builtin_types_compatible_p(__typeof__((1 ? (void*) ((intptr_t) ((expr) * 0)) : (int*) 0)), int*) +#endif +# elif \ + ( \ + defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) && \ + !defined(JSON_HEDLEY_SUNPRO_VERSION) && \ + !defined(JSON_HEDLEY_PGI_VERSION) && \ + !defined(JSON_HEDLEY_IAR_VERSION)) || \ + (JSON_HEDLEY_HAS_EXTENSION(c_generic_selections) && !defined(JSON_HEDLEY_IAR_VERSION)) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(4,9,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(17,0,0) || \ + JSON_HEDLEY_IBM_VERSION_CHECK(12,1,0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(5,3,0) +#if defined(__INTPTR_TYPE__) + #define JSON_HEDLEY_IS_CONSTEXPR_(expr) _Generic((1 ? (void*) ((__INTPTR_TYPE__) ((expr) * 0)) : (int*) 0), int*: 1, void*: 0) +#else + #include + #define JSON_HEDLEY_IS_CONSTEXPR_(expr) _Generic((1 ? (void*) ((intptr_t) * 0) : (int*) 0), int*: 1, void*: 0) +#endif +# elif \ + defined(JSON_HEDLEY_GCC_VERSION) || \ + defined(JSON_HEDLEY_INTEL_VERSION) || \ + defined(JSON_HEDLEY_TINYC_VERSION) || \ + defined(JSON_HEDLEY_TI_ARMCL_VERSION) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(18,12,0) || \ + defined(JSON_HEDLEY_TI_CL2000_VERSION) || \ + defined(JSON_HEDLEY_TI_CL6X_VERSION) || \ + defined(JSON_HEDLEY_TI_CL7X_VERSION) || \ + defined(JSON_HEDLEY_TI_CLPRU_VERSION) || \ + defined(__clang__) +# define JSON_HEDLEY_IS_CONSTEXPR_(expr) ( \ + sizeof(void) != \ + sizeof(*( \ + 1 ? \ + ((void*) ((expr) * 0L) ) : \ +((struct { char v[sizeof(void) * 2]; } *) 1) \ + ) \ + ) \ + ) +# endif +#endif +#if defined(JSON_HEDLEY_IS_CONSTEXPR_) + #if !defined(JSON_HEDLEY_IS_CONSTANT) + #define JSON_HEDLEY_IS_CONSTANT(expr) JSON_HEDLEY_IS_CONSTEXPR_(expr) + #endif + #define JSON_HEDLEY_REQUIRE_CONSTEXPR(expr) (JSON_HEDLEY_IS_CONSTEXPR_(expr) ? (expr) : (-1)) +#else + #if !defined(JSON_HEDLEY_IS_CONSTANT) + #define JSON_HEDLEY_IS_CONSTANT(expr) (0) + #endif + #define JSON_HEDLEY_REQUIRE_CONSTEXPR(expr) (expr) +#endif + +#if defined(JSON_HEDLEY_BEGIN_C_DECLS) + #undef JSON_HEDLEY_BEGIN_C_DECLS +#endif +#if defined(JSON_HEDLEY_END_C_DECLS) + #undef JSON_HEDLEY_END_C_DECLS +#endif +#if defined(JSON_HEDLEY_C_DECL) + #undef JSON_HEDLEY_C_DECL +#endif +#if defined(__cplusplus) + #define JSON_HEDLEY_BEGIN_C_DECLS extern "C" { + #define JSON_HEDLEY_END_C_DECLS } + #define JSON_HEDLEY_C_DECL extern "C" +#else + #define JSON_HEDLEY_BEGIN_C_DECLS + #define JSON_HEDLEY_END_C_DECLS + #define JSON_HEDLEY_C_DECL +#endif + +#if defined(JSON_HEDLEY_STATIC_ASSERT) + #undef JSON_HEDLEY_STATIC_ASSERT +#endif +#if \ + !defined(__cplusplus) && ( \ + (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)) || \ + (JSON_HEDLEY_HAS_FEATURE(c_static_assert) && !defined(JSON_HEDLEY_INTEL_CL_VERSION)) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(6,0,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + defined(_Static_assert) \ + ) +# define JSON_HEDLEY_STATIC_ASSERT(expr, message) _Static_assert(expr, message) +#elif \ + (defined(__cplusplus) && (__cplusplus >= 201103L)) || \ + JSON_HEDLEY_MSVC_VERSION_CHECK(16,0,0) || \ + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) +# define JSON_HEDLEY_STATIC_ASSERT(expr, message) JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(static_assert(expr, message)) +#else +# define JSON_HEDLEY_STATIC_ASSERT(expr, message) +#endif + +#if defined(JSON_HEDLEY_NULL) + #undef JSON_HEDLEY_NULL +#endif +#if defined(__cplusplus) + #if __cplusplus >= 201103L + #define JSON_HEDLEY_NULL JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(nullptr) + #elif defined(NULL) + #define JSON_HEDLEY_NULL NULL + #else + #define JSON_HEDLEY_NULL JSON_HEDLEY_STATIC_CAST(void*, 0) + #endif +#elif defined(NULL) + #define JSON_HEDLEY_NULL NULL +#else + #define JSON_HEDLEY_NULL ((void*) 0) +#endif + +#if defined(JSON_HEDLEY_MESSAGE) + #undef JSON_HEDLEY_MESSAGE +#endif +#if JSON_HEDLEY_HAS_WARNING("-Wunknown-pragmas") +# define JSON_HEDLEY_MESSAGE(msg) \ + JSON_HEDLEY_DIAGNOSTIC_PUSH \ + JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS \ + JSON_HEDLEY_PRAGMA(message msg) \ + JSON_HEDLEY_DIAGNOSTIC_POP +#elif \ + JSON_HEDLEY_GCC_VERSION_CHECK(4,4,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) +# define JSON_HEDLEY_MESSAGE(msg) JSON_HEDLEY_PRAGMA(message msg) +#elif JSON_HEDLEY_CRAY_VERSION_CHECK(5,0,0) +# define JSON_HEDLEY_MESSAGE(msg) JSON_HEDLEY_PRAGMA(_CRI message msg) +#elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) +# define JSON_HEDLEY_MESSAGE(msg) JSON_HEDLEY_PRAGMA(message(msg)) +#elif JSON_HEDLEY_PELLES_VERSION_CHECK(2,0,0) +# define JSON_HEDLEY_MESSAGE(msg) JSON_HEDLEY_PRAGMA(message(msg)) +#else +# define JSON_HEDLEY_MESSAGE(msg) +#endif + +#if defined(JSON_HEDLEY_WARNING) + #undef JSON_HEDLEY_WARNING +#endif +#if JSON_HEDLEY_HAS_WARNING("-Wunknown-pragmas") +# define JSON_HEDLEY_WARNING(msg) \ + JSON_HEDLEY_DIAGNOSTIC_PUSH \ + JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS \ + JSON_HEDLEY_PRAGMA(clang warning msg) \ + JSON_HEDLEY_DIAGNOSTIC_POP +#elif \ + JSON_HEDLEY_GCC_VERSION_CHECK(4,8,0) || \ + JSON_HEDLEY_PGI_VERSION_CHECK(18,4,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) +# define JSON_HEDLEY_WARNING(msg) JSON_HEDLEY_PRAGMA(GCC warning msg) +#elif \ + JSON_HEDLEY_MSVC_VERSION_CHECK(15,0,0) || \ + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) +# define JSON_HEDLEY_WARNING(msg) JSON_HEDLEY_PRAGMA(message(msg)) +#else +# define JSON_HEDLEY_WARNING(msg) JSON_HEDLEY_MESSAGE(msg) +#endif + +#if defined(JSON_HEDLEY_REQUIRE) + #undef JSON_HEDLEY_REQUIRE +#endif +#if defined(JSON_HEDLEY_REQUIRE_MSG) + #undef JSON_HEDLEY_REQUIRE_MSG +#endif +#if JSON_HEDLEY_HAS_ATTRIBUTE(diagnose_if) +# if JSON_HEDLEY_HAS_WARNING("-Wgcc-compat") +# define JSON_HEDLEY_REQUIRE(expr) \ + JSON_HEDLEY_DIAGNOSTIC_PUSH \ + _Pragma("clang diagnostic ignored \"-Wgcc-compat\"") \ + __attribute__((diagnose_if(!(expr), #expr, "error"))) \ + JSON_HEDLEY_DIAGNOSTIC_POP +# define JSON_HEDLEY_REQUIRE_MSG(expr,msg) \ + JSON_HEDLEY_DIAGNOSTIC_PUSH \ + _Pragma("clang diagnostic ignored \"-Wgcc-compat\"") \ + __attribute__((diagnose_if(!(expr), msg, "error"))) \ + JSON_HEDLEY_DIAGNOSTIC_POP +# else +# define JSON_HEDLEY_REQUIRE(expr) __attribute__((diagnose_if(!(expr), #expr, "error"))) +# define JSON_HEDLEY_REQUIRE_MSG(expr,msg) __attribute__((diagnose_if(!(expr), msg, "error"))) +# endif +#else +# define JSON_HEDLEY_REQUIRE(expr) +# define JSON_HEDLEY_REQUIRE_MSG(expr,msg) +#endif + +#if defined(JSON_HEDLEY_FLAGS) + #undef JSON_HEDLEY_FLAGS +#endif +#if JSON_HEDLEY_HAS_ATTRIBUTE(flag_enum) && (!defined(__cplusplus) || JSON_HEDLEY_HAS_WARNING("-Wbitfield-enum-conversion")) + #define JSON_HEDLEY_FLAGS __attribute__((__flag_enum__)) +#else + #define JSON_HEDLEY_FLAGS +#endif + +#if defined(JSON_HEDLEY_FLAGS_CAST) + #undef JSON_HEDLEY_FLAGS_CAST +#endif +#if JSON_HEDLEY_INTEL_VERSION_CHECK(19,0,0) +# define JSON_HEDLEY_FLAGS_CAST(T, expr) (__extension__ ({ \ + JSON_HEDLEY_DIAGNOSTIC_PUSH \ + _Pragma("warning(disable:188)") \ + ((T) (expr)); \ + JSON_HEDLEY_DIAGNOSTIC_POP \ + })) +#else +# define JSON_HEDLEY_FLAGS_CAST(T, expr) JSON_HEDLEY_STATIC_CAST(T, expr) +#endif + +#if defined(JSON_HEDLEY_EMPTY_BASES) + #undef JSON_HEDLEY_EMPTY_BASES +#endif +#if \ + (JSON_HEDLEY_MSVC_VERSION_CHECK(19,0,23918) && !JSON_HEDLEY_MSVC_VERSION_CHECK(20,0,0)) || \ + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) + #define JSON_HEDLEY_EMPTY_BASES __declspec(empty_bases) +#else + #define JSON_HEDLEY_EMPTY_BASES +#endif + +/* Remaining macros are deprecated. */ + +#if defined(JSON_HEDLEY_GCC_NOT_CLANG_VERSION_CHECK) + #undef JSON_HEDLEY_GCC_NOT_CLANG_VERSION_CHECK +#endif +#if defined(__clang__) + #define JSON_HEDLEY_GCC_NOT_CLANG_VERSION_CHECK(major,minor,patch) (0) +#else + #define JSON_HEDLEY_GCC_NOT_CLANG_VERSION_CHECK(major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) +#endif + +#if defined(JSON_HEDLEY_CLANG_HAS_ATTRIBUTE) + #undef JSON_HEDLEY_CLANG_HAS_ATTRIBUTE +#endif +#define JSON_HEDLEY_CLANG_HAS_ATTRIBUTE(attribute) JSON_HEDLEY_HAS_ATTRIBUTE(attribute) + +#if defined(JSON_HEDLEY_CLANG_HAS_CPP_ATTRIBUTE) + #undef JSON_HEDLEY_CLANG_HAS_CPP_ATTRIBUTE +#endif +#define JSON_HEDLEY_CLANG_HAS_CPP_ATTRIBUTE(attribute) JSON_HEDLEY_HAS_CPP_ATTRIBUTE(attribute) + +#if defined(JSON_HEDLEY_CLANG_HAS_BUILTIN) + #undef JSON_HEDLEY_CLANG_HAS_BUILTIN +#endif +#define JSON_HEDLEY_CLANG_HAS_BUILTIN(builtin) JSON_HEDLEY_HAS_BUILTIN(builtin) + +#if defined(JSON_HEDLEY_CLANG_HAS_FEATURE) + #undef JSON_HEDLEY_CLANG_HAS_FEATURE +#endif +#define JSON_HEDLEY_CLANG_HAS_FEATURE(feature) JSON_HEDLEY_HAS_FEATURE(feature) + +#if defined(JSON_HEDLEY_CLANG_HAS_EXTENSION) + #undef JSON_HEDLEY_CLANG_HAS_EXTENSION +#endif +#define JSON_HEDLEY_CLANG_HAS_EXTENSION(extension) JSON_HEDLEY_HAS_EXTENSION(extension) + +#if defined(JSON_HEDLEY_CLANG_HAS_DECLSPEC_DECLSPEC_ATTRIBUTE) + #undef JSON_HEDLEY_CLANG_HAS_DECLSPEC_DECLSPEC_ATTRIBUTE +#endif +#define JSON_HEDLEY_CLANG_HAS_DECLSPEC_ATTRIBUTE(attribute) JSON_HEDLEY_HAS_DECLSPEC_ATTRIBUTE(attribute) + +#if defined(JSON_HEDLEY_CLANG_HAS_WARNING) + #undef JSON_HEDLEY_CLANG_HAS_WARNING +#endif +#define JSON_HEDLEY_CLANG_HAS_WARNING(warning) JSON_HEDLEY_HAS_WARNING(warning) + +#endif /* !defined(JSON_HEDLEY_VERSION) || (JSON_HEDLEY_VERSION < X) */ + + +// This file contains all internal macro definitions (except those affecting ABI) +// You MUST include macro_unscope.hpp at the end of json.hpp to undef all of them + +// #include + + +// exclude unsupported compilers +#if !defined(JSON_SKIP_UNSUPPORTED_COMPILER_CHECK) + #if defined(__clang__) + #if (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__) < 30400 + #error "unsupported Clang version - see https://github.com/nlohmann/json#supported-compilers" + #endif + #elif defined(__GNUC__) && !(defined(__ICC) || defined(__INTEL_COMPILER)) + #if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) < 40800 + #error "unsupported GCC version - see https://github.com/nlohmann/json#supported-compilers" + #endif + #endif +#endif + +// C++ language standard detection +// if the user manually specified the used c++ version this is skipped +#if !defined(JSON_HAS_CPP_20) && !defined(JSON_HAS_CPP_17) && !defined(JSON_HAS_CPP_14) && !defined(JSON_HAS_CPP_11) + #if (defined(__cplusplus) && __cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + #define JSON_HAS_CPP_20 + #define JSON_HAS_CPP_17 + #define JSON_HAS_CPP_14 + #elif (defined(__cplusplus) && __cplusplus >= 201703L) || (defined(_HAS_CXX17) && _HAS_CXX17 == 1) // fix for issue #464 + #define JSON_HAS_CPP_17 + #define JSON_HAS_CPP_14 + #elif (defined(__cplusplus) && __cplusplus >= 201402L) || (defined(_HAS_CXX14) && _HAS_CXX14 == 1) + #define JSON_HAS_CPP_14 + #endif + // the cpp 11 flag is always specified because it is the minimal required version + #define JSON_HAS_CPP_11 +#endif + +#ifdef __has_include + #if __has_include() + #include + #endif +#endif + +#if !defined(JSON_HAS_FILESYSTEM) && !defined(JSON_HAS_EXPERIMENTAL_FILESYSTEM) + #ifdef JSON_HAS_CPP_17 + #if defined(__cpp_lib_filesystem) + #define JSON_HAS_FILESYSTEM 1 + #elif defined(__cpp_lib_experimental_filesystem) + #define JSON_HAS_EXPERIMENTAL_FILESYSTEM 1 + #elif !defined(__has_include) + #define JSON_HAS_EXPERIMENTAL_FILESYSTEM 1 + #elif __has_include() + #define JSON_HAS_FILESYSTEM 1 + #elif __has_include() + #define JSON_HAS_EXPERIMENTAL_FILESYSTEM 1 + #endif + + // std::filesystem does not work on MinGW GCC 8: https://sourceforge.net/p/mingw-w64/bugs/737/ + #if defined(__MINGW32__) && defined(__GNUC__) && __GNUC__ == 8 + #undef JSON_HAS_FILESYSTEM + #undef JSON_HAS_EXPERIMENTAL_FILESYSTEM + #endif + + // no filesystem support before GCC 8: https://en.cppreference.com/w/cpp/compiler_support + #if defined(__GNUC__) && !defined(__clang__) && __GNUC__ < 8 + #undef JSON_HAS_FILESYSTEM + #undef JSON_HAS_EXPERIMENTAL_FILESYSTEM + #endif + + // no filesystem support before Clang 7: https://en.cppreference.com/w/cpp/compiler_support + #if defined(__clang_major__) && __clang_major__ < 7 + #undef JSON_HAS_FILESYSTEM + #undef JSON_HAS_EXPERIMENTAL_FILESYSTEM + #endif + + // no filesystem support before MSVC 19.14: https://en.cppreference.com/w/cpp/compiler_support + #if defined(_MSC_VER) && _MSC_VER < 1914 + #undef JSON_HAS_FILESYSTEM + #undef JSON_HAS_EXPERIMENTAL_FILESYSTEM + #endif + + // no filesystem support before iOS 13 + #if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED < 130000 + #undef JSON_HAS_FILESYSTEM + #undef JSON_HAS_EXPERIMENTAL_FILESYSTEM + #endif + + // no filesystem support before macOS Catalina + #if defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101500 + #undef JSON_HAS_FILESYSTEM + #undef JSON_HAS_EXPERIMENTAL_FILESYSTEM + #endif + #endif +#endif + +#ifndef JSON_HAS_EXPERIMENTAL_FILESYSTEM + #define JSON_HAS_EXPERIMENTAL_FILESYSTEM 0 +#endif + +#ifndef JSON_HAS_FILESYSTEM + #define JSON_HAS_FILESYSTEM 0 +#endif + +#ifndef JSON_HAS_THREE_WAY_COMPARISON + #if defined(__cpp_impl_three_way_comparison) && __cpp_impl_three_way_comparison >= 201907L \ + && defined(__cpp_lib_three_way_comparison) && __cpp_lib_three_way_comparison >= 201907L + #define JSON_HAS_THREE_WAY_COMPARISON 1 + #else + #define JSON_HAS_THREE_WAY_COMPARISON 0 + #endif +#endif + +#ifndef JSON_HAS_RANGES + // ranges header shipping in GCC 11.1.0 (released 2021-04-27) has syntax error + #if defined(__GLIBCXX__) && __GLIBCXX__ == 20210427 + #define JSON_HAS_RANGES 0 + #elif defined(__cpp_lib_ranges) + #define JSON_HAS_RANGES 1 + #else + #define JSON_HAS_RANGES 0 + #endif +#endif + +#ifdef JSON_HAS_CPP_17 + #define JSON_INLINE_VARIABLE inline +#else + #define JSON_INLINE_VARIABLE +#endif + +#if JSON_HEDLEY_HAS_ATTRIBUTE(no_unique_address) + #define JSON_NO_UNIQUE_ADDRESS [[no_unique_address]] +#else + #define JSON_NO_UNIQUE_ADDRESS +#endif + +// disable documentation warnings on clang +#if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wdocumentation" + #pragma clang diagnostic ignored "-Wdocumentation-unknown-command" +#endif + +// allow disabling exceptions +#if (defined(__cpp_exceptions) || defined(__EXCEPTIONS) || defined(_CPPUNWIND)) && !defined(JSON_NOEXCEPTION) + #define JSON_THROW(exception) throw exception + #define JSON_TRY try + #define JSON_CATCH(exception) catch(exception) + #define JSON_INTERNAL_CATCH(exception) catch(exception) +#else + #include + #define JSON_THROW(exception) std::abort() + #define JSON_TRY if(true) + #define JSON_CATCH(exception) if(false) + #define JSON_INTERNAL_CATCH(exception) if(false) +#endif + +// override exception macros +#if defined(JSON_THROW_USER) + #undef JSON_THROW + #define JSON_THROW JSON_THROW_USER +#endif +#if defined(JSON_TRY_USER) + #undef JSON_TRY + #define JSON_TRY JSON_TRY_USER +#endif +#if defined(JSON_CATCH_USER) + #undef JSON_CATCH + #define JSON_CATCH JSON_CATCH_USER + #undef JSON_INTERNAL_CATCH + #define JSON_INTERNAL_CATCH JSON_CATCH_USER +#endif +#if defined(JSON_INTERNAL_CATCH_USER) + #undef JSON_INTERNAL_CATCH + #define JSON_INTERNAL_CATCH JSON_INTERNAL_CATCH_USER +#endif + +// allow overriding assert +#if !defined(JSON_ASSERT) + #include // assert + #define JSON_ASSERT(x) assert(x) +#endif + +// allow to access some private functions (needed by the test suite) +#if defined(JSON_TESTS_PRIVATE) + #define JSON_PRIVATE_UNLESS_TESTED public +#else + #define JSON_PRIVATE_UNLESS_TESTED private +#endif + +/*! +@brief macro to briefly define a mapping between an enum and JSON +@def NLOHMANN_JSON_SERIALIZE_ENUM +@since version 3.4.0 +*/ +#define NLOHMANN_JSON_SERIALIZE_ENUM(ENUM_TYPE, ...) \ + template \ + inline void to_json(BasicJsonType& j, const ENUM_TYPE& e) \ + { \ + static_assert(std::is_enum::value, #ENUM_TYPE " must be an enum!"); \ + static const std::pair m[] = __VA_ARGS__; \ + auto it = std::find_if(std::begin(m), std::end(m), \ + [e](const std::pair& ej_pair) -> bool \ + { \ + return ej_pair.first == e; \ + }); \ + j = ((it != std::end(m)) ? it : std::begin(m))->second; \ + } \ + template \ + inline void from_json(const BasicJsonType& j, ENUM_TYPE& e) \ + { \ + static_assert(std::is_enum::value, #ENUM_TYPE " must be an enum!"); \ + static const std::pair m[] = __VA_ARGS__; \ + auto it = std::find_if(std::begin(m), std::end(m), \ + [&j](const std::pair& ej_pair) -> bool \ + { \ + return ej_pair.second == j; \ + }); \ + e = ((it != std::end(m)) ? it : std::begin(m))->first; \ + } + +// Ugly macros to avoid uglier copy-paste when specializing basic_json. They +// may be removed in the future once the class is split. + +#define NLOHMANN_BASIC_JSON_TPL_DECLARATION \ + template class ObjectType, \ + template class ArrayType, \ + class StringType, class BooleanType, class NumberIntegerType, \ + class NumberUnsignedType, class NumberFloatType, \ + template class AllocatorType, \ + template class JSONSerializer, \ + class BinaryType, \ + class CustomBaseClass> + +#define NLOHMANN_BASIC_JSON_TPL \ + basic_json + +// Macros to simplify conversion from/to types + +#define NLOHMANN_JSON_EXPAND( x ) x +#define NLOHMANN_JSON_GET_MACRO(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, _48, _49, _50, _51, _52, _53, _54, _55, _56, _57, _58, _59, _60, _61, _62, _63, _64, NAME,...) NAME +#define NLOHMANN_JSON_PASTE(...) NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_GET_MACRO(__VA_ARGS__, \ + NLOHMANN_JSON_PASTE64, \ + NLOHMANN_JSON_PASTE63, \ + NLOHMANN_JSON_PASTE62, \ + NLOHMANN_JSON_PASTE61, \ + NLOHMANN_JSON_PASTE60, \ + NLOHMANN_JSON_PASTE59, \ + NLOHMANN_JSON_PASTE58, \ + NLOHMANN_JSON_PASTE57, \ + NLOHMANN_JSON_PASTE56, \ + NLOHMANN_JSON_PASTE55, \ + NLOHMANN_JSON_PASTE54, \ + NLOHMANN_JSON_PASTE53, \ + NLOHMANN_JSON_PASTE52, \ + NLOHMANN_JSON_PASTE51, \ + NLOHMANN_JSON_PASTE50, \ + NLOHMANN_JSON_PASTE49, \ + NLOHMANN_JSON_PASTE48, \ + NLOHMANN_JSON_PASTE47, \ + NLOHMANN_JSON_PASTE46, \ + NLOHMANN_JSON_PASTE45, \ + NLOHMANN_JSON_PASTE44, \ + NLOHMANN_JSON_PASTE43, \ + NLOHMANN_JSON_PASTE42, \ + NLOHMANN_JSON_PASTE41, \ + NLOHMANN_JSON_PASTE40, \ + NLOHMANN_JSON_PASTE39, \ + NLOHMANN_JSON_PASTE38, \ + NLOHMANN_JSON_PASTE37, \ + NLOHMANN_JSON_PASTE36, \ + NLOHMANN_JSON_PASTE35, \ + NLOHMANN_JSON_PASTE34, \ + NLOHMANN_JSON_PASTE33, \ + NLOHMANN_JSON_PASTE32, \ + NLOHMANN_JSON_PASTE31, \ + NLOHMANN_JSON_PASTE30, \ + NLOHMANN_JSON_PASTE29, \ + NLOHMANN_JSON_PASTE28, \ + NLOHMANN_JSON_PASTE27, \ + NLOHMANN_JSON_PASTE26, \ + NLOHMANN_JSON_PASTE25, \ + NLOHMANN_JSON_PASTE24, \ + NLOHMANN_JSON_PASTE23, \ + NLOHMANN_JSON_PASTE22, \ + NLOHMANN_JSON_PASTE21, \ + NLOHMANN_JSON_PASTE20, \ + NLOHMANN_JSON_PASTE19, \ + NLOHMANN_JSON_PASTE18, \ + NLOHMANN_JSON_PASTE17, \ + NLOHMANN_JSON_PASTE16, \ + NLOHMANN_JSON_PASTE15, \ + NLOHMANN_JSON_PASTE14, \ + NLOHMANN_JSON_PASTE13, \ + NLOHMANN_JSON_PASTE12, \ + NLOHMANN_JSON_PASTE11, \ + NLOHMANN_JSON_PASTE10, \ + NLOHMANN_JSON_PASTE9, \ + NLOHMANN_JSON_PASTE8, \ + NLOHMANN_JSON_PASTE7, \ + NLOHMANN_JSON_PASTE6, \ + NLOHMANN_JSON_PASTE5, \ + NLOHMANN_JSON_PASTE4, \ + NLOHMANN_JSON_PASTE3, \ + NLOHMANN_JSON_PASTE2, \ + NLOHMANN_JSON_PASTE1)(__VA_ARGS__)) +#define NLOHMANN_JSON_PASTE2(func, v1) func(v1) +#define NLOHMANN_JSON_PASTE3(func, v1, v2) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE2(func, v2) +#define NLOHMANN_JSON_PASTE4(func, v1, v2, v3) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE3(func, v2, v3) +#define NLOHMANN_JSON_PASTE5(func, v1, v2, v3, v4) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE4(func, v2, v3, v4) +#define NLOHMANN_JSON_PASTE6(func, v1, v2, v3, v4, v5) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE5(func, v2, v3, v4, v5) +#define NLOHMANN_JSON_PASTE7(func, v1, v2, v3, v4, v5, v6) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE6(func, v2, v3, v4, v5, v6) +#define NLOHMANN_JSON_PASTE8(func, v1, v2, v3, v4, v5, v6, v7) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE7(func, v2, v3, v4, v5, v6, v7) +#define NLOHMANN_JSON_PASTE9(func, v1, v2, v3, v4, v5, v6, v7, v8) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE8(func, v2, v3, v4, v5, v6, v7, v8) +#define NLOHMANN_JSON_PASTE10(func, v1, v2, v3, v4, v5, v6, v7, v8, v9) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE9(func, v2, v3, v4, v5, v6, v7, v8, v9) +#define NLOHMANN_JSON_PASTE11(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE10(func, v2, v3, v4, v5, v6, v7, v8, v9, v10) +#define NLOHMANN_JSON_PASTE12(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE11(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11) +#define NLOHMANN_JSON_PASTE13(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE12(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12) +#define NLOHMANN_JSON_PASTE14(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE13(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13) +#define NLOHMANN_JSON_PASTE15(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE14(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14) +#define NLOHMANN_JSON_PASTE16(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE15(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15) +#define NLOHMANN_JSON_PASTE17(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE16(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16) +#define NLOHMANN_JSON_PASTE18(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE17(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17) +#define NLOHMANN_JSON_PASTE19(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE18(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18) +#define NLOHMANN_JSON_PASTE20(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE19(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19) +#define NLOHMANN_JSON_PASTE21(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE20(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20) +#define NLOHMANN_JSON_PASTE22(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE21(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21) +#define NLOHMANN_JSON_PASTE23(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE22(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22) +#define NLOHMANN_JSON_PASTE24(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE23(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23) +#define NLOHMANN_JSON_PASTE25(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE24(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24) +#define NLOHMANN_JSON_PASTE26(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE25(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25) +#define NLOHMANN_JSON_PASTE27(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE26(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26) +#define NLOHMANN_JSON_PASTE28(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE27(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27) +#define NLOHMANN_JSON_PASTE29(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE28(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28) +#define NLOHMANN_JSON_PASTE30(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE29(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29) +#define NLOHMANN_JSON_PASTE31(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE30(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30) +#define NLOHMANN_JSON_PASTE32(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE31(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31) +#define NLOHMANN_JSON_PASTE33(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE32(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32) +#define NLOHMANN_JSON_PASTE34(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE33(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33) +#define NLOHMANN_JSON_PASTE35(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE34(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34) +#define NLOHMANN_JSON_PASTE36(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE35(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35) +#define NLOHMANN_JSON_PASTE37(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE36(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36) +#define NLOHMANN_JSON_PASTE38(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE37(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37) +#define NLOHMANN_JSON_PASTE39(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE38(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38) +#define NLOHMANN_JSON_PASTE40(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE39(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39) +#define NLOHMANN_JSON_PASTE41(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE40(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40) +#define NLOHMANN_JSON_PASTE42(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE41(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41) +#define NLOHMANN_JSON_PASTE43(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE42(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42) +#define NLOHMANN_JSON_PASTE44(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE43(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43) +#define NLOHMANN_JSON_PASTE45(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE44(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44) +#define NLOHMANN_JSON_PASTE46(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE45(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45) +#define NLOHMANN_JSON_PASTE47(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE46(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46) +#define NLOHMANN_JSON_PASTE48(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE47(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47) +#define NLOHMANN_JSON_PASTE49(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE48(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48) +#define NLOHMANN_JSON_PASTE50(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE49(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49) +#define NLOHMANN_JSON_PASTE51(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE50(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50) +#define NLOHMANN_JSON_PASTE52(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE51(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51) +#define NLOHMANN_JSON_PASTE53(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE52(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52) +#define NLOHMANN_JSON_PASTE54(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE53(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53) +#define NLOHMANN_JSON_PASTE55(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE54(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54) +#define NLOHMANN_JSON_PASTE56(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE55(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55) +#define NLOHMANN_JSON_PASTE57(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE56(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56) +#define NLOHMANN_JSON_PASTE58(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE57(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57) +#define NLOHMANN_JSON_PASTE59(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE58(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58) +#define NLOHMANN_JSON_PASTE60(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE59(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59) +#define NLOHMANN_JSON_PASTE61(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE60(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60) +#define NLOHMANN_JSON_PASTE62(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE61(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61) +#define NLOHMANN_JSON_PASTE63(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61, v62) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE62(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61, v62) +#define NLOHMANN_JSON_PASTE64(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61, v62, v63) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE63(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61, v62, v63) + +#define NLOHMANN_JSON_TO(v1) nlohmann_json_j[#v1] = nlohmann_json_t.v1; +#define NLOHMANN_JSON_FROM(v1) nlohmann_json_j.at(#v1).get_to(nlohmann_json_t.v1); +#define NLOHMANN_JSON_FROM_WITH_DEFAULT(v1) nlohmann_json_t.v1 = nlohmann_json_j.value(#v1, nlohmann_json_default_obj.v1); + +/*! +@brief macro +@def NLOHMANN_DEFINE_TYPE_INTRUSIVE +@since version 3.9.0 +*/ +#define NLOHMANN_DEFINE_TYPE_INTRUSIVE(Type, ...) \ + friend void to_json(nlohmann::json& nlohmann_json_j, const Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \ + friend void from_json(const nlohmann::json& nlohmann_json_j, Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM, __VA_ARGS__)) } + +#define NLOHMANN_DEFINE_TYPE_INTRUSIVE_WITH_DEFAULT(Type, ...) \ + friend void to_json(nlohmann::json& nlohmann_json_j, const Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \ + friend void from_json(const nlohmann::json& nlohmann_json_j, Type& nlohmann_json_t) { const Type nlohmann_json_default_obj{}; NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM_WITH_DEFAULT, __VA_ARGS__)) } + +/*! +@brief macro +@def NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE +@since version 3.9.0 +*/ +#define NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(Type, ...) \ + inline void to_json(nlohmann::json& nlohmann_json_j, const Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \ + inline void from_json(const nlohmann::json& nlohmann_json_j, Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM, __VA_ARGS__)) } + +#define NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT(Type, ...) \ + inline void to_json(nlohmann::json& nlohmann_json_j, const Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \ + inline void from_json(const nlohmann::json& nlohmann_json_j, Type& nlohmann_json_t) { const Type nlohmann_json_default_obj{}; NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM_WITH_DEFAULT, __VA_ARGS__)) } + + +// inspired from https://stackoverflow.com/a/26745591 +// allows to call any std function as if (e.g. with begin): +// using std::begin; begin(x); +// +// it allows using the detected idiom to retrieve the return type +// of such an expression +#define NLOHMANN_CAN_CALL_STD_FUNC_IMPL(std_name) \ + namespace detail { \ + using std::std_name; \ + \ + template \ + using result_of_##std_name = decltype(std_name(std::declval()...)); \ + } \ + \ + namespace detail2 { \ + struct std_name##_tag \ + { \ + }; \ + \ + template \ + std_name##_tag std_name(T&&...); \ + \ + template \ + using result_of_##std_name = decltype(std_name(std::declval()...)); \ + \ + template \ + struct would_call_std_##std_name \ + { \ + static constexpr auto const value = ::nlohmann::detail:: \ + is_detected_exact::value; \ + }; \ + } /* namespace detail2 */ \ + \ + template \ + struct would_call_std_##std_name : detail2::would_call_std_##std_name \ + { \ + } + +#ifndef JSON_USE_IMPLICIT_CONVERSIONS + #define JSON_USE_IMPLICIT_CONVERSIONS 1 +#endif + +#if JSON_USE_IMPLICIT_CONVERSIONS + #define JSON_EXPLICIT +#else + #define JSON_EXPLICIT explicit +#endif + +#ifndef JSON_DISABLE_ENUM_SERIALIZATION + #define JSON_DISABLE_ENUM_SERIALIZATION 0 +#endif + +#ifndef JSON_USE_GLOBAL_UDLS + #define JSON_USE_GLOBAL_UDLS 1 +#endif + +#if JSON_HAS_THREE_WAY_COMPARISON + #include // partial_ordering +#endif + +NLOHMANN_JSON_NAMESPACE_BEGIN +namespace detail +{ + +/////////////////////////// +// JSON type enumeration // +/////////////////////////// + +/*! +@brief the JSON type enumeration + +This enumeration collects the different JSON types. It is internally used to +distinguish the stored values, and the functions @ref basic_json::is_null(), +@ref basic_json::is_object(), @ref basic_json::is_array(), +@ref basic_json::is_string(), @ref basic_json::is_boolean(), +@ref basic_json::is_number() (with @ref basic_json::is_number_integer(), +@ref basic_json::is_number_unsigned(), and @ref basic_json::is_number_float()), +@ref basic_json::is_discarded(), @ref basic_json::is_primitive(), and +@ref basic_json::is_structured() rely on it. + +@note There are three enumeration entries (number_integer, number_unsigned, and +number_float), because the library distinguishes these three types for numbers: +@ref basic_json::number_unsigned_t is used for unsigned integers, +@ref basic_json::number_integer_t is used for signed integers, and +@ref basic_json::number_float_t is used for floating-point numbers or to +approximate integers which do not fit in the limits of their respective type. + +@sa see @ref basic_json::basic_json(const value_t value_type) -- create a JSON +value with the default value for a given type + +@since version 1.0.0 +*/ +enum class value_t : std::uint8_t +{ + null, ///< null value + object, ///< object (unordered set of name/value pairs) + array, ///< array (ordered collection of values) + string, ///< string value + boolean, ///< boolean value + number_integer, ///< number value (signed integer) + number_unsigned, ///< number value (unsigned integer) + number_float, ///< number value (floating-point) + binary, ///< binary array (ordered collection of bytes) + discarded ///< discarded by the parser callback function +}; + +/*! +@brief comparison operator for JSON types + +Returns an ordering that is similar to Python: +- order: null < boolean < number < object < array < string < binary +- furthermore, each type is not smaller than itself +- discarded values are not comparable +- binary is represented as a b"" string in python and directly comparable to a + string; however, making a binary array directly comparable with a string would + be surprising behavior in a JSON file. + +@since version 1.0.0 +*/ +#if JSON_HAS_THREE_WAY_COMPARISON + inline std::partial_ordering operator<=>(const value_t lhs, const value_t rhs) noexcept // *NOPAD* +#else + inline bool operator<(const value_t lhs, const value_t rhs) noexcept +#endif +{ + static constexpr std::array order = {{ + 0 /* null */, 3 /* object */, 4 /* array */, 5 /* string */, + 1 /* boolean */, 2 /* integer */, 2 /* unsigned */, 2 /* float */, + 6 /* binary */ + } + }; + + const auto l_index = static_cast(lhs); + const auto r_index = static_cast(rhs); +#if JSON_HAS_THREE_WAY_COMPARISON + if (l_index < order.size() && r_index < order.size()) + { + return order[l_index] <=> order[r_index]; // *NOPAD* + } + return std::partial_ordering::unordered; +#else + return l_index < order.size() && r_index < order.size() && order[l_index] < order[r_index]; +#endif +} + +// GCC selects the built-in operator< over an operator rewritten from +// a user-defined spaceship operator +// Clang, MSVC, and ICC select the rewritten candidate +// (see GCC bug https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105200) +#if JSON_HAS_THREE_WAY_COMPARISON && defined(__GNUC__) +inline bool operator<(const value_t lhs, const value_t rhs) noexcept +{ + return std::is_lt(lhs <=> rhs); // *NOPAD* +} +#endif + +} // namespace detail +NLOHMANN_JSON_NAMESPACE_END + +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.2 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann +// SPDX-License-Identifier: MIT + + + +// #include + + +NLOHMANN_JSON_NAMESPACE_BEGIN +namespace detail +{ + +/*! +@brief replace all occurrences of a substring by another string + +@param[in,out] s the string to manipulate; changed so that all + occurrences of @a f are replaced with @a t +@param[in] f the substring to replace with @a t +@param[in] t the string to replace @a f + +@pre The search string @a f must not be empty. **This precondition is +enforced with an assertion.** + +@since version 2.0.0 +*/ +template +inline void replace_substring(StringType& s, const StringType& f, + const StringType& t) +{ + JSON_ASSERT(!f.empty()); + for (auto pos = s.find(f); // find first occurrence of f + pos != StringType::npos; // make sure f was found + s.replace(pos, f.size(), t), // replace with t, and + pos = s.find(f, pos + t.size())) // find next occurrence of f + {} +} + +/*! + * @brief string escaping as described in RFC 6901 (Sect. 4) + * @param[in] s string to escape + * @return escaped string + * + * Note the order of escaping "~" to "~0" and "/" to "~1" is important. + */ +template +inline StringType escape(StringType s) +{ + replace_substring(s, StringType{"~"}, StringType{"~0"}); + replace_substring(s, StringType{"/"}, StringType{"~1"}); + return s; +} + +/*! + * @brief string unescaping as described in RFC 6901 (Sect. 4) + * @param[in] s string to unescape + * @return unescaped string + * + * Note the order of escaping "~1" to "/" and "~0" to "~" is important. + */ +template +static void unescape(StringType& s) +{ + replace_substring(s, StringType{"~1"}, StringType{"/"}); + replace_substring(s, StringType{"~0"}, StringType{"~"}); +} + +} // namespace detail +NLOHMANN_JSON_NAMESPACE_END + +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.2 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann +// SPDX-License-Identifier: MIT + + + +#include // size_t + +// #include + + +NLOHMANN_JSON_NAMESPACE_BEGIN +namespace detail +{ + +/// struct to capture the start position of the current token +struct position_t +{ + /// the total number of characters read + std::size_t chars_read_total = 0; + /// the number of characters read in the current line + std::size_t chars_read_current_line = 0; + /// the number of lines read + std::size_t lines_read = 0; + + /// conversion to size_t to preserve SAX interface + constexpr operator size_t() const + { + return chars_read_total; + } +}; + +} // namespace detail +NLOHMANN_JSON_NAMESPACE_END + +// #include + +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.2 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann +// SPDX-FileCopyrightText: 2018 The Abseil Authors +// SPDX-License-Identifier: MIT + + + +#include // array +#include // size_t +#include // conditional, enable_if, false_type, integral_constant, is_constructible, is_integral, is_same, remove_cv, remove_reference, true_type +#include // index_sequence, make_index_sequence, index_sequence_for + +// #include + + +NLOHMANN_JSON_NAMESPACE_BEGIN +namespace detail +{ + +template +using uncvref_t = typename std::remove_cv::type>::type; + +#ifdef JSON_HAS_CPP_14 + +// the following utilities are natively available in C++14 +using std::enable_if_t; +using std::index_sequence; +using std::make_index_sequence; +using std::index_sequence_for; + +#else + +// alias templates to reduce boilerplate +template +using enable_if_t = typename std::enable_if::type; + +// The following code is taken from https://github.com/abseil/abseil-cpp/blob/10cb35e459f5ecca5b2ff107635da0bfa41011b4/absl/utility/utility.h +// which is part of Google Abseil (https://github.com/abseil/abseil-cpp), licensed under the Apache License 2.0. + +//// START OF CODE FROM GOOGLE ABSEIL + +// integer_sequence +// +// Class template representing a compile-time integer sequence. An instantiation +// of `integer_sequence` has a sequence of integers encoded in its +// type through its template arguments (which is a common need when +// working with C++11 variadic templates). `absl::integer_sequence` is designed +// to be a drop-in replacement for C++14's `std::integer_sequence`. +// +// Example: +// +// template< class T, T... Ints > +// void user_function(integer_sequence); +// +// int main() +// { +// // user_function's `T` will be deduced to `int` and `Ints...` +// // will be deduced to `0, 1, 2, 3, 4`. +// user_function(make_integer_sequence()); +// } +template +struct integer_sequence +{ + using value_type = T; + static constexpr std::size_t size() noexcept + { + return sizeof...(Ints); + } +}; + +// index_sequence +// +// A helper template for an `integer_sequence` of `size_t`, +// `absl::index_sequence` is designed to be a drop-in replacement for C++14's +// `std::index_sequence`. +template +using index_sequence = integer_sequence; + +namespace utility_internal +{ + +template +struct Extend; + +// Note that SeqSize == sizeof...(Ints). It's passed explicitly for efficiency. +template +struct Extend, SeqSize, 0> +{ + using type = integer_sequence < T, Ints..., (Ints + SeqSize)... >; +}; + +template +struct Extend, SeqSize, 1> +{ + using type = integer_sequence < T, Ints..., (Ints + SeqSize)..., 2 * SeqSize >; +}; + +// Recursion helper for 'make_integer_sequence'. +// 'Gen::type' is an alias for 'integer_sequence'. +template +struct Gen +{ + using type = + typename Extend < typename Gen < T, N / 2 >::type, N / 2, N % 2 >::type; +}; + +template +struct Gen +{ + using type = integer_sequence; +}; + +} // namespace utility_internal + +// Compile-time sequences of integers + +// make_integer_sequence +// +// This template alias is equivalent to +// `integer_sequence`, and is designed to be a drop-in +// replacement for C++14's `std::make_integer_sequence`. +template +using make_integer_sequence = typename utility_internal::Gen::type; + +// make_index_sequence +// +// This template alias is equivalent to `index_sequence<0, 1, ..., N-1>`, +// and is designed to be a drop-in replacement for C++14's +// `std::make_index_sequence`. +template +using make_index_sequence = make_integer_sequence; + +// index_sequence_for +// +// Converts a typename pack into an index sequence of the same length, and +// is designed to be a drop-in replacement for C++14's +// `std::index_sequence_for()` +template +using index_sequence_for = make_index_sequence; + +//// END OF CODE FROM GOOGLE ABSEIL + +#endif + +// dispatch utility (taken from ranges-v3) +template struct priority_tag : priority_tag < N - 1 > {}; +template<> struct priority_tag<0> {}; + +// taken from ranges-v3 +template +struct static_const +{ + static JSON_INLINE_VARIABLE constexpr T value{}; +}; + +#ifndef JSON_HAS_CPP_17 + template + constexpr T static_const::value; +#endif + +template +inline constexpr std::array make_array(Args&& ... args) +{ + return std::array {{static_cast(std::forward(args))...}}; +} + +} // namespace detail +NLOHMANN_JSON_NAMESPACE_END + +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.2 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann +// SPDX-License-Identifier: MIT + + + +#include // numeric_limits +#include // false_type, is_constructible, is_integral, is_same, true_type +#include // declval +#include // tuple + +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.2 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann +// SPDX-License-Identifier: MIT + + + +#include // random_access_iterator_tag + +// #include + +// #include + +// #include + + +NLOHMANN_JSON_NAMESPACE_BEGIN +namespace detail +{ + +template +struct iterator_types {}; + +template +struct iterator_types < + It, + void_t> +{ + using difference_type = typename It::difference_type; + using value_type = typename It::value_type; + using pointer = typename It::pointer; + using reference = typename It::reference; + using iterator_category = typename It::iterator_category; +}; + +// This is required as some compilers implement std::iterator_traits in a way that +// doesn't work with SFINAE. See https://github.com/nlohmann/json/issues/1341. +template +struct iterator_traits +{ +}; + +template +struct iterator_traits < T, enable_if_t < !std::is_pointer::value >> + : iterator_types +{ +}; + +template +struct iterator_traits::value>> +{ + using iterator_category = std::random_access_iterator_tag; + using value_type = T; + using difference_type = ptrdiff_t; + using pointer = T*; + using reference = T&; +}; + +} // namespace detail +NLOHMANN_JSON_NAMESPACE_END + +// #include + +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.2 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann +// SPDX-License-Identifier: MIT + + + +// #include + + +NLOHMANN_JSON_NAMESPACE_BEGIN + +NLOHMANN_CAN_CALL_STD_FUNC_IMPL(begin); + +NLOHMANN_JSON_NAMESPACE_END + +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.2 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann +// SPDX-License-Identifier: MIT + + + +// #include + + +NLOHMANN_JSON_NAMESPACE_BEGIN + +NLOHMANN_CAN_CALL_STD_FUNC_IMPL(end); + +NLOHMANN_JSON_NAMESPACE_END + +// #include + +// #include + +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.2 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann +// SPDX-License-Identifier: MIT + +#ifndef INCLUDE_NLOHMANN_JSON_FWD_HPP_ + #define INCLUDE_NLOHMANN_JSON_FWD_HPP_ + + #include // int64_t, uint64_t + #include // map + #include // allocator + #include // string + #include // vector + + // #include + + + /*! + @brief namespace for Niels Lohmann + @see https://github.com/nlohmann + @since version 1.0.0 + */ + NLOHMANN_JSON_NAMESPACE_BEGIN + + /*! + @brief default JSONSerializer template argument + + This serializer ignores the template arguments and uses ADL + ([argument-dependent lookup](https://en.cppreference.com/w/cpp/language/adl)) + for serialization. + */ + template + struct adl_serializer; + + /// a class to store JSON values + /// @sa https://json.nlohmann.me/api/basic_json/ + template class ObjectType = + std::map, + template class ArrayType = std::vector, + class StringType = std::string, class BooleanType = bool, + class NumberIntegerType = std::int64_t, + class NumberUnsignedType = std::uint64_t, + class NumberFloatType = double, + template class AllocatorType = std::allocator, + template class JSONSerializer = + adl_serializer, + class BinaryType = std::vector, // cppcheck-suppress syntaxError + class CustomBaseClass = void> + class basic_json; + + /// @brief JSON Pointer defines a string syntax for identifying a specific value within a JSON document + /// @sa https://json.nlohmann.me/api/json_pointer/ + template + class json_pointer; + + /*! + @brief default specialization + @sa https://json.nlohmann.me/api/json/ + */ + using json = basic_json<>; + + /// @brief a minimal map-like container that preserves insertion order + /// @sa https://json.nlohmann.me/api/ordered_map/ + template + struct ordered_map; + + /// @brief specialization that maintains the insertion order of object keys + /// @sa https://json.nlohmann.me/api/ordered_json/ + using ordered_json = basic_json; + + NLOHMANN_JSON_NAMESPACE_END + +#endif // INCLUDE_NLOHMANN_JSON_FWD_HPP_ + + +NLOHMANN_JSON_NAMESPACE_BEGIN +/*! +@brief detail namespace with internal helper functions + +This namespace collects functions that should not be exposed, +implementations of some @ref basic_json methods, and meta-programming helpers. + +@since version 2.1.0 +*/ +namespace detail +{ + +///////////// +// helpers // +///////////// + +// Note to maintainers: +// +// Every trait in this file expects a non CV-qualified type. +// The only exceptions are in the 'aliases for detected' section +// (i.e. those of the form: decltype(T::member_function(std::declval()))) +// +// In this case, T has to be properly CV-qualified to constraint the function arguments +// (e.g. to_json(BasicJsonType&, const T&)) + +template struct is_basic_json : std::false_type {}; + +NLOHMANN_BASIC_JSON_TPL_DECLARATION +struct is_basic_json : std::true_type {}; + +// used by exceptions create() member functions +// true_type for pointer to possibly cv-qualified basic_json or std::nullptr_t +// false_type otherwise +template +struct is_basic_json_context : + std::integral_constant < bool, + is_basic_json::type>::type>::value + || std::is_same::value > +{}; + +////////////////////// +// json_ref helpers // +////////////////////// + +template +class json_ref; + +template +struct is_json_ref : std::false_type {}; + +template +struct is_json_ref> : std::true_type {}; + +////////////////////////// +// aliases for detected // +////////////////////////// + +template +using mapped_type_t = typename T::mapped_type; + +template +using key_type_t = typename T::key_type; + +template +using value_type_t = typename T::value_type; + +template +using difference_type_t = typename T::difference_type; + +template +using pointer_t = typename T::pointer; + +template +using reference_t = typename T::reference; + +template +using iterator_category_t = typename T::iterator_category; + +template +using to_json_function = decltype(T::to_json(std::declval()...)); + +template +using from_json_function = decltype(T::from_json(std::declval()...)); + +template +using get_template_function = decltype(std::declval().template get()); + +// trait checking if JSONSerializer::from_json(json const&, udt&) exists +template +struct has_from_json : std::false_type {}; + +// trait checking if j.get is valid +// use this trait instead of std::is_constructible or std::is_convertible, +// both rely on, or make use of implicit conversions, and thus fail when T +// has several constructors/operator= (see https://github.com/nlohmann/json/issues/958) +template +struct is_getable +{ + static constexpr bool value = is_detected::value; +}; + +template +struct has_from_json < BasicJsonType, T, enable_if_t < !is_basic_json::value >> +{ + using serializer = typename BasicJsonType::template json_serializer; + + static constexpr bool value = + is_detected_exact::value; +}; + +// This trait checks if JSONSerializer::from_json(json const&) exists +// this overload is used for non-default-constructible user-defined-types +template +struct has_non_default_from_json : std::false_type {}; + +template +struct has_non_default_from_json < BasicJsonType, T, enable_if_t < !is_basic_json::value >> +{ + using serializer = typename BasicJsonType::template json_serializer; + + static constexpr bool value = + is_detected_exact::value; +}; + +// This trait checks if BasicJsonType::json_serializer::to_json exists +// Do not evaluate the trait when T is a basic_json type, to avoid template instantiation infinite recursion. +template +struct has_to_json : std::false_type {}; + +template +struct has_to_json < BasicJsonType, T, enable_if_t < !is_basic_json::value >> +{ + using serializer = typename BasicJsonType::template json_serializer; + + static constexpr bool value = + is_detected_exact::value; +}; + +template +using detect_key_compare = typename T::key_compare; + +template +struct has_key_compare : std::integral_constant::value> {}; + +// obtains the actual object key comparator +template +struct actual_object_comparator +{ + using object_t = typename BasicJsonType::object_t; + using object_comparator_t = typename BasicJsonType::default_object_comparator_t; + using type = typename std::conditional < has_key_compare::value, + typename object_t::key_compare, object_comparator_t>::type; +}; + +template +using actual_object_comparator_t = typename actual_object_comparator::type; + +/////////////////// +// is_ functions // +/////////////////// + +// https://en.cppreference.com/w/cpp/types/conjunction +template struct conjunction : std::true_type { }; +template struct conjunction : B { }; +template +struct conjunction +: std::conditional(B::value), conjunction, B>::type {}; + +// https://en.cppreference.com/w/cpp/types/negation +template struct negation : std::integral_constant < bool, !B::value > { }; + +// Reimplementation of is_constructible and is_default_constructible, due to them being broken for +// std::pair and std::tuple until LWG 2367 fix (see https://cplusplus.github.io/LWG/lwg-defects.html#2367). +// This causes compile errors in e.g. clang 3.5 or gcc 4.9. +template +struct is_default_constructible : std::is_default_constructible {}; + +template +struct is_default_constructible> + : conjunction, is_default_constructible> {}; + +template +struct is_default_constructible> + : conjunction, is_default_constructible> {}; + +template +struct is_default_constructible> + : conjunction...> {}; + +template +struct is_default_constructible> + : conjunction...> {}; + + +template +struct is_constructible : std::is_constructible {}; + +template +struct is_constructible> : is_default_constructible> {}; + +template +struct is_constructible> : is_default_constructible> {}; + +template +struct is_constructible> : is_default_constructible> {}; + +template +struct is_constructible> : is_default_constructible> {}; + + +template +struct is_iterator_traits : std::false_type {}; + +template +struct is_iterator_traits> +{ + private: + using traits = iterator_traits; + + public: + static constexpr auto value = + is_detected::value && + is_detected::value && + is_detected::value && + is_detected::value && + is_detected::value; +}; + +template +struct is_range +{ + private: + using t_ref = typename std::add_lvalue_reference::type; + + using iterator = detected_t; + using sentinel = detected_t; + + // to be 100% correct, it should use https://en.cppreference.com/w/cpp/iterator/input_or_output_iterator + // and https://en.cppreference.com/w/cpp/iterator/sentinel_for + // but reimplementing these would be too much work, as a lot of other concepts are used underneath + static constexpr auto is_iterator_begin = + is_iterator_traits>::value; + + public: + static constexpr bool value = !std::is_same::value && !std::is_same::value && is_iterator_begin; +}; + +template +using iterator_t = enable_if_t::value, result_of_begin())>>; + +template +using range_value_t = value_type_t>>; + +// The following implementation of is_complete_type is taken from +// https://blogs.msdn.microsoft.com/vcblog/2015/12/02/partial-support-for-expression-sfinae-in-vs-2015-update-1/ +// and is written by Xiang Fan who agreed to using it in this library. + +template +struct is_complete_type : std::false_type {}; + +template +struct is_complete_type : std::true_type {}; + +template +struct is_compatible_object_type_impl : std::false_type {}; + +template +struct is_compatible_object_type_impl < + BasicJsonType, CompatibleObjectType, + enable_if_t < is_detected::value&& + is_detected::value >> +{ + using object_t = typename BasicJsonType::object_t; + + // macOS's is_constructible does not play well with nonesuch... + static constexpr bool value = + is_constructible::value && + is_constructible::value; +}; + +template +struct is_compatible_object_type + : is_compatible_object_type_impl {}; + +template +struct is_constructible_object_type_impl : std::false_type {}; + +template +struct is_constructible_object_type_impl < + BasicJsonType, ConstructibleObjectType, + enable_if_t < is_detected::value&& + is_detected::value >> +{ + using object_t = typename BasicJsonType::object_t; + + static constexpr bool value = + (is_default_constructible::value && + (std::is_move_assignable::value || + std::is_copy_assignable::value) && + (is_constructible::value && + std::is_same < + typename object_t::mapped_type, + typename ConstructibleObjectType::mapped_type >::value)) || + (has_from_json::value || + has_non_default_from_json < + BasicJsonType, + typename ConstructibleObjectType::mapped_type >::value); +}; + +template +struct is_constructible_object_type + : is_constructible_object_type_impl {}; + +template +struct is_compatible_string_type +{ + static constexpr auto value = + is_constructible::value; +}; + +template +struct is_constructible_string_type +{ + // launder type through decltype() to fix compilation failure on ICPC +#ifdef __INTEL_COMPILER + using laundered_type = decltype(std::declval()); +#else + using laundered_type = ConstructibleStringType; +#endif + + static constexpr auto value = + conjunction < + is_constructible, + is_detected_exact>::value; +}; + +template +struct is_compatible_array_type_impl : std::false_type {}; + +template +struct is_compatible_array_type_impl < + BasicJsonType, CompatibleArrayType, + enable_if_t < + is_detected::value&& + is_iterator_traits>>::value&& +// special case for types like std::filesystem::path whose iterator's value_type are themselves +// c.f. https://github.com/nlohmann/json/pull/3073 + !std::is_same>::value >> +{ + static constexpr bool value = + is_constructible>::value; +}; + +template +struct is_compatible_array_type + : is_compatible_array_type_impl {}; + +template +struct is_constructible_array_type_impl : std::false_type {}; + +template +struct is_constructible_array_type_impl < + BasicJsonType, ConstructibleArrayType, + enable_if_t::value >> + : std::true_type {}; + +template +struct is_constructible_array_type_impl < + BasicJsonType, ConstructibleArrayType, + enable_if_t < !std::is_same::value&& + !is_compatible_string_type::value&& + is_default_constructible::value&& +(std::is_move_assignable::value || + std::is_copy_assignable::value)&& +is_detected::value&& +is_iterator_traits>>::value&& +is_detected::value&& +// special case for types like std::filesystem::path whose iterator's value_type are themselves +// c.f. https://github.com/nlohmann/json/pull/3073 +!std::is_same>::value&& + is_complete_type < + detected_t>::value >> +{ + using value_type = range_value_t; + + static constexpr bool value = + std::is_same::value || + has_from_json::value || + has_non_default_from_json < + BasicJsonType, + value_type >::value; +}; + +template +struct is_constructible_array_type + : is_constructible_array_type_impl {}; + +template +struct is_compatible_integer_type_impl : std::false_type {}; + +template +struct is_compatible_integer_type_impl < + RealIntegerType, CompatibleNumberIntegerType, + enable_if_t < std::is_integral::value&& + std::is_integral::value&& + !std::is_same::value >> +{ + // is there an assert somewhere on overflows? + using RealLimits = std::numeric_limits; + using CompatibleLimits = std::numeric_limits; + + static constexpr auto value = + is_constructible::value && + CompatibleLimits::is_integer && + RealLimits::is_signed == CompatibleLimits::is_signed; +}; + +template +struct is_compatible_integer_type + : is_compatible_integer_type_impl {}; + +template +struct is_compatible_type_impl: std::false_type {}; + +template +struct is_compatible_type_impl < + BasicJsonType, CompatibleType, + enable_if_t::value >> +{ + static constexpr bool value = + has_to_json::value; +}; + +template +struct is_compatible_type + : is_compatible_type_impl {}; + +template +struct is_constructible_tuple : std::false_type {}; + +template +struct is_constructible_tuple> : conjunction...> {}; + +template +struct is_json_iterator_of : std::false_type {}; + +template +struct is_json_iterator_of : std::true_type {}; + +template +struct is_json_iterator_of : std::true_type +{}; + +// checks if a given type T is a template specialization of Primary +template