mirror of
https://github.com/tristanpenman/valijson.git
synced 2025-07-05 10:00:01 +02:00
Add missing #includes and remove usage of json_parser_error type for boost property_trees
This commit is contained in:
parent
b6854612a4
commit
3d3f76df10
@ -2,7 +2,9 @@
|
|||||||
#ifndef __VALIJSON_INTERNAL_JSON_POINTER_HPP
|
#ifndef __VALIJSON_INTERNAL_JSON_POINTER_HPP
|
||||||
#define __VALIJSON_INTERNAL_JSON_POINTER_HPP
|
#define __VALIJSON_INTERNAL_JSON_POINTER_HPP
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
#include <cerrno>
|
#include <cerrno>
|
||||||
|
#include <cstddef>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
@ -202,13 +204,13 @@ inline AdapterType resolveJsonPointer(
|
|||||||
"out of bounds; actual token: " + referenceToken);
|
"out of bounds; actual token: " + referenceToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (index > static_cast<uint64_t>(std::numeric_limits<ptrdiff_t>::max())) {
|
if (index > static_cast<uint64_t>(std::numeric_limits<std::ptrdiff_t>::max())) {
|
||||||
throw std::runtime_error("Array index out of bounds; hard "
|
throw std::runtime_error("Array index out of bounds; hard "
|
||||||
"limit is " + std::to_string(
|
"limit is " + std::to_string(
|
||||||
std::numeric_limits<ptrdiff_t>::max()));
|
std::numeric_limits<std::ptrdiff_t>::max()));
|
||||||
}
|
}
|
||||||
|
|
||||||
itr.advance(static_cast<ptrdiff_t>(index));
|
itr.advance(static_cast<std::ptrdiff_t>(index));
|
||||||
|
|
||||||
// Recursively process the remaining tokens
|
// Recursively process the remaining tokens
|
||||||
return resolveJsonPointer(*itr, jsonPointer, jsonPointerNext);
|
return resolveJsonPointer(*itr, jsonPointer, jsonPointerNext);
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
#define __VALIJSON_FILE_UTILS_HPP
|
#define __VALIJSON_FILE_UTILS_HPP
|
||||||
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
#include <limits>
|
||||||
|
|
||||||
namespace valijson {
|
namespace valijson {
|
||||||
namespace utils {
|
namespace utils {
|
||||||
|
@ -16,8 +16,6 @@
|
|||||||
# include <boost/property_tree/json_parser.hpp>
|
# include <boost/property_tree/json_parser.hpp>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <boost/property_tree/detail/json_parser_error.hpp>
|
|
||||||
|
|
||||||
#include <valijson/utils/file_utils.hpp>
|
#include <valijson/utils/file_utils.hpp>
|
||||||
|
|
||||||
namespace valijson {
|
namespace valijson {
|
||||||
@ -27,7 +25,7 @@ inline bool loadDocument(const std::string &path, boost::property_tree::ptree &d
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
boost::property_tree::read_json(path, document);
|
boost::property_tree::read_json(path, document);
|
||||||
} catch (boost::property_tree::json_parser::json_parser_error &e) {
|
} catch (std::exception &e) {
|
||||||
std::cerr << "Boost Property Tree JSON parser failed to parse the document:" << std::endl;
|
std::cerr << "Boost Property Tree JSON parser failed to parse the document:" << std::endl;
|
||||||
std::cerr << e.what() << std::endl;
|
std::cerr << e.what() << std::endl;
|
||||||
return false;
|
return false;
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
#include <memory>
|
||||||
|
|
||||||
#include <gtest/gtest.h>
|
#include <gtest/gtest.h>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user