mirror of
https://github.com/tristanpenman/valijson.git
synced 2024-12-12 10:13:51 +01:00
Apply feedback, add boost version check
This commit is contained in:
parent
8f6f9b6a80
commit
b8e9581057
@ -30,6 +30,10 @@ inline bool loadDocument(const std::string &path, nlohmann::json &document)
|
||||
}
|
||||
#else
|
||||
document = nlohmann::json::parse(file, nullptr, false);
|
||||
if (document.is_discarded()) {
|
||||
std::cerr << "nlohmann::json failed to parse the document.";
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
|
@ -14,7 +14,12 @@
|
||||
# include <boost/property_tree/json_parser.hpp>
|
||||
#endif
|
||||
|
||||
// Source locations were added in boost 1.73.
|
||||
#include <boost/version.hpp>
|
||||
#if (BOOST_VERSION > 107300)
|
||||
#include <boost/assert/source_location.hpp>
|
||||
#endif
|
||||
|
||||
#include <boost/config/detail/suffix.hpp>
|
||||
#include <valijson/utils/file_utils.hpp>
|
||||
#include <valijson/exceptions.hpp>
|
||||
@ -29,9 +34,11 @@ BOOST_NORETURN void throw_exception(std::exception const & e ) {
|
||||
valijson::throwRuntimeError(e.what());
|
||||
}
|
||||
|
||||
#if (BOOST_VERSION > 107300)
|
||||
BOOST_NORETURN void throw_exception(std::exception const & e, boost::source_location const & loc ) {
|
||||
valijson::throwRuntimeError(e.what());
|
||||
}
|
||||
#endif
|
||||
|
||||
} // namespace boost
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user