From dd45ba6f8957cb32f92af7b0d2aefee94d50ed2a Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Sun, 8 Jan 2017 09:19:44 +0100 Subject: [PATCH] :construction: renamed `version()` to `meta()` --- src/json.hpp | 8 ++++---- src/json.hpp.re2c | 8 ++++---- test/src/unit-version.cpp | 3 ++- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/json.hpp b/src/json.hpp index 9e065e59..3200e095 100644 --- a/src/json.hpp +++ b/src/json.hpp @@ -284,11 +284,11 @@ class basic_json /*! @brief returns version information on the library */ - static basic_json version() + static basic_json meta() { basic_json result; - result["copyright"] = "(C) 2013-2016 Niels Lohmann"; + result["copyright"] = "(C) 2013-2017 Niels Lohmann"; result["name"] = "JSON for Modern C++"; result["url"] = "https://github.com/nlohmann/json"; result["version"] = @@ -312,11 +312,11 @@ class basic_json #endif #if defined(__clang__) - result["compiler"] = {{"family", "clang"}, {"version", CLANG_VERSION}}; + result["compiler"] = {{"family", "clang"}, {"version", __clang_version__}}; #elif defined(__ICC) || defined(__INTEL_COMPILER) result["compiler"] = {{"family", "icc"}, {"version", __INTEL_COMPILER}}; #elif defined(__GNUC__) || defined(__GNUG__) - result["compiler"] = {{"family", "gcc"}, {"version", GCC_VERSION}}; + result["compiler"] = {{"family", "gcc"}, {"version", std::to_string(__GNUC__) + "." + std::to_string(__GNUC_MINOR__) + "." + std::to_string(__GNUC_PATCHLEVEL__)}}; #elif defined(__HP_cc) || defined(__HP_aCC) result["compiler"] = "hp" #elif defined(__IBMCPP__) diff --git a/src/json.hpp.re2c b/src/json.hpp.re2c index a66a0238..c7171a27 100644 --- a/src/json.hpp.re2c +++ b/src/json.hpp.re2c @@ -284,11 +284,11 @@ class basic_json /*! @brief returns version information on the library */ - static basic_json version() + static basic_json meta() { basic_json result; - result["copyright"] = "(C) 2013-2016 Niels Lohmann"; + result["copyright"] = "(C) 2013-2017 Niels Lohmann"; result["name"] = "JSON for Modern C++"; result["url"] = "https://github.com/nlohmann/json"; result["version"] = @@ -312,11 +312,11 @@ class basic_json #endif #if defined(__clang__) - result["compiler"] = {{"family", "clang"}, {"version", CLANG_VERSION}}; + result["compiler"] = {{"family", "clang"}, {"version", __clang_version__}}; #elif defined(__ICC) || defined(__INTEL_COMPILER) result["compiler"] = {{"family", "icc"}, {"version", __INTEL_COMPILER}}; #elif defined(__GNUC__) || defined(__GNUG__) - result["compiler"] = {{"family", "gcc"}, {"version", GCC_VERSION}}; + result["compiler"] = {{"family", "gcc"}, {"version", std::to_string(__GNUC__) + "." + std::to_string(__GNUC_MINOR__) + "." + std::to_string(__GNUC_PATCHLEVEL__)}}; #elif defined(__HP_cc) || defined(__HP_aCC) result["compiler"] = "hp" #elif defined(__IBMCPP__) diff --git a/test/src/unit-version.cpp b/test/src/unit-version.cpp index bede4ff3..1b4ea91c 100644 --- a/test/src/unit-version.cpp +++ b/test/src/unit-version.cpp @@ -35,6 +35,7 @@ TEST_CASE("version information") { SECTION("version()") { - CHECK(json::version()["name"] == "JSON for Modern C++"); + CHECK(json::meta()["name"] == "JSON for Modern C++"); + CHECK(json::meta()["compiler"] == "JSON for Modern C++"); } }