Skip to content

Commit

Permalink
✨ added define for library version #948 #943
Browse files Browse the repository at this point in the history
  • Loading branch information
nlohmann committed Jan 31, 2018
1 parent 552d153 commit e8bf1f6
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 8 deletions.
15 changes: 11 additions & 4 deletions develop/json.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ SOFTWARE.
#ifndef NLOHMANN_JSON_HPP
#define NLOHMANN_JSON_HPP

#define NLOHMANN_JSON_VERSION_MAJOR 3
#define NLOHMANN_JSON_VERSION_MINOR 0
#define NLOHMANN_JSON_VERSION_PATCH 1

#include <algorithm> // all_of, find, for_each
#include <cassert> // assert
#include <ciso646> // and, not, or
Expand Down Expand Up @@ -308,10 +312,13 @@ class basic_json
result["copyright"] = "(C) 2013-2017 Niels Lohmann";
result["name"] = "JSON for Modern C++";
result["url"] = "https://github.com/nlohmann/json";
result["version"] =
{
{"string", "3.0.1"}, {"major", 3}, {"minor", 0}, {"patch", 1}
};
result["version"]["string"] =
std::to_string(NLOHMANN_JSON_VERSION_MAJOR) + "." +
std::to_string(NLOHMANN_JSON_VERSION_MINOR) + "." +
std::to_string(NLOHMANN_JSON_VERSION_PATCH);
result["version"]["major"] = NLOHMANN_JSON_VERSION_MAJOR;
result["version"]["minor"] = NLOHMANN_JSON_VERSION_MINOR;
result["version"]["patch"] = NLOHMANN_JSON_VERSION_PATCH;

#ifdef _WIN32
result["platform"] = "win32";
Expand Down
15 changes: 11 additions & 4 deletions src/json.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ SOFTWARE.
#ifndef NLOHMANN_JSON_HPP
#define NLOHMANN_JSON_HPP

#define NLOHMANN_JSON_VERSION_MAJOR 3
#define NLOHMANN_JSON_VERSION_MINOR 0
#define NLOHMANN_JSON_VERSION_PATCH 1

#include <algorithm> // all_of, find, for_each
#include <cassert> // assert
#include <ciso646> // and, not, or
Expand Down Expand Up @@ -9885,10 +9889,13 @@ class basic_json
result["copyright"] = "(C) 2013-2017 Niels Lohmann";
result["name"] = "JSON for Modern C++";
result["url"] = "https://github.com/nlohmann/json";
result["version"] =
{
{"string", "3.0.1"}, {"major", 3}, {"minor", 0}, {"patch", 1}
};
result["version"]["string"] =
std::to_string(NLOHMANN_JSON_VERSION_MAJOR) + "." +
std::to_string(NLOHMANN_JSON_VERSION_MINOR) + "." +
std::to_string(NLOHMANN_JSON_VERSION_PATCH);
result["version"]["major"] = NLOHMANN_JSON_VERSION_MAJOR;
result["version"]["minor"] = NLOHMANN_JSON_VERSION_MINOR;
result["version"]["patch"] = NLOHMANN_JSON_VERSION_PATCH;

#ifdef _WIN32
result["platform"] = "win32";
Expand Down

0 comments on commit e8bf1f6

Please sign in to comment.