Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix build when JSON_USE_EXCEPTION == 0 #332

Merged
merged 2 commits into from
Mar 14, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions src/JSONParser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ using namespace fuel_tools;
#define timegm _mkgmtime
#endif

#define GZ_JSON_HAVE_EXCEPTIONS ((JSONCPP_VERSION_MAJOR < 1 && \
JSONCPP_VERSION_MINOR < 10) || JSON_USE_EXCEPTION == 0)

/////////////////////////////////////////////////
std::time_t ParseDateTime(const std::string &_datetime)
{
Expand Down Expand Up @@ -78,7 +81,7 @@ bool ParseLicenseImpl(const Json::Value &_json,
if (_json.isMember("ID"))
_license.second = _json["ID"].asUInt();
}
#if JSONCPP_VERSION_MAJOR < 1 && JSONCPP_VERSION_MINOR < 10
#if GZ_JSON_HAVE_EXCEPTIONS == 1
catch (...)
{
std::string what;
Expand Down Expand Up @@ -109,7 +112,7 @@ std::vector<std::string> JSONParser::ParseTags(const Json::Value &_json)
for (auto tagIt = _json.begin(); tagIt != _json.end(); ++tagIt)
tags.push_back(tagIt->asString());
}
#if JSONCPP_VERSION_MAJOR < 1 && JSONCPP_VERSION_MINOR < 10
#if GZ_JSON_HAVE_EXCEPTIONS == 1
catch (...)
{
std::string what;
Expand Down Expand Up @@ -221,7 +224,7 @@ bool JSONParser::ParseModelImpl(
if (_json.isMember("version"))
_model.SetVersion(_json["version"].asUInt());
}
#if JSONCPP_VERSION_MAJOR < 1 && JSONCPP_VERSION_MINOR < 10
#if GZ_JSON_HAVE_EXCEPTIONS == 1
catch (...)
{
std::string what;
Expand Down Expand Up @@ -326,7 +329,7 @@ bool JSONParser::ParseWorldImpl(
if (_json.isMember("version"))
_world.SetVersion(_json["version"].asUInt());
}
#if JSONCPP_VERSION_MAJOR < 1 && JSONCPP_VERSION_MINOR < 10
#if GZ_JSON_HAVE_EXCEPTIONS == 1
catch (...)
{
std::string what;
Expand Down