From: Andreas Tille Date: Thu, 13 Oct 2022 17:31:58 +0000 (-0400) Subject: Include Debian packaged rapidjson X-Git-Tag: archive/raspbian/1.3.2+dfsg-5+rpi1~1^2~1 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=899ba244a899be23c3d1409cd34a5a27ad23a3d9;p=libcereal.git Include Debian packaged rapidjson Last-Update: Sat, 05 Dec 2020 17:12:21 +0100 Bug-Debian: https://bugs.debian.org/976585 Forwarded: not-needed Gbp-Pq: Name use_debian_packaged_rapidjson.patch --- diff --git a/include/cereal/archives/json.hpp b/include/cereal/archives/json.hpp index 199efc9..2334e07 100644 --- a/include/cereal/archives/json.hpp +++ b/include/cereal/archives/json.hpp @@ -41,30 +41,30 @@ namespace cereal } // Inform rapidjson that assert will throw -#ifndef CEREAL_RAPIDJSON_ASSERT_THROWS -#define CEREAL_RAPIDJSON_ASSERT_THROWS -#endif // CEREAL_RAPIDJSON_ASSERT_THROWS +#ifndef RAPIDJSON_ASSERT_THROWS +#define RAPIDJSON_ASSERT_THROWS +#endif // RAPIDJSON_ASSERT_THROWS // Override rapidjson assertions to throw exceptions by default -#ifndef CEREAL_RAPIDJSON_ASSERT -#define CEREAL_RAPIDJSON_ASSERT(x) if(!(x)){ \ +#ifndef RAPIDJSON_ASSERT +#define RAPIDJSON_ASSERT(x) if(!(x)){ \ throw ::cereal::RapidJSONException("rapidjson internal assertion failure: " #x); } #endif // RAPIDJSON_ASSERT // Enable support for parsing of nan, inf, -inf -#ifndef CEREAL_RAPIDJSON_WRITE_DEFAULT_FLAGS -#define CEREAL_RAPIDJSON_WRITE_DEFAULT_FLAGS kWriteNanAndInfFlag +#ifndef RAPIDJSON_WRITE_DEFAULT_FLAGS +#define RAPIDJSON_WRITE_DEFAULT_FLAGS kWriteNanAndInfFlag #endif // Enable support for parsing of nan, inf, -inf -#ifndef CEREAL_RAPIDJSON_PARSE_DEFAULT_FLAGS -#define CEREAL_RAPIDJSON_PARSE_DEFAULT_FLAGS kParseFullPrecisionFlag | kParseNanAndInfFlag +#ifndef RAPIDJSON_PARSE_DEFAULT_FLAGS +#define RAPIDJSON_PARSE_DEFAULT_FLAGS kParseFullPrecisionFlag | kParseNanAndInfFlag #endif -#include "cereal/external/rapidjson/prettywriter.h" -#include "cereal/external/rapidjson/ostreamwrapper.h" -#include "cereal/external/rapidjson/istreamwrapper.h" -#include "cereal/external/rapidjson/document.h" +#include "rapidjson/prettywriter.h" +#include "rapidjson/ostreamwrapper.h" +#include "rapidjson/istreamwrapper.h" +#include "rapidjson/document.h" #include "cereal/external/base64.hpp" #include @@ -107,8 +107,8 @@ namespace cereal { enum class NodeType { StartObject, InObject, StartArray, InArray }; - using WriteStream = CEREAL_RAPIDJSON_NAMESPACE::OStreamWrapper; - using JSONWriter = CEREAL_RAPIDJSON_NAMESPACE::PrettyWriter; + using WriteStream = RAPIDJSON_NAMESPACE::OStreamWrapper; + using JSONWriter = RAPIDJSON_NAMESPACE::PrettyWriter; public: /*! @name Common Functionality @@ -255,7 +255,7 @@ namespace cereal //! Saves a double to the current node void saveValue(double d) { itsWriter.Double(d); } //! Saves a string to the current node - void saveValue(std::string const & s) { itsWriter.String(s.c_str(), static_cast( s.size() )); } + void saveValue(std::string const & s) { itsWriter.String(s.c_str(), static_cast( s.size() )); } //! Saves a const char * to the current node void saveValue(char const * s) { itsWriter.String(s); } //! Saves a nullptr to the current node @@ -419,11 +419,11 @@ namespace cereal class JSONInputArchive : public InputArchive, public traits::TextArchive { private: - using ReadStream = CEREAL_RAPIDJSON_NAMESPACE::IStreamWrapper; - typedef CEREAL_RAPIDJSON_NAMESPACE::GenericValue> JSONValue; + using ReadStream = RAPIDJSON_NAMESPACE::IStreamWrapper; + typedef RAPIDJSON_NAMESPACE::GenericValue> JSONValue; typedef JSONValue::ConstMemberIterator MemberIterator; typedef JSONValue::ConstValueIterator ValueIterator; - typedef CEREAL_RAPIDJSON_NAMESPACE::Document::GenericValue GenericValue; + typedef RAPIDJSON_NAMESPACE::Document::GenericValue GenericValue; public: /*! @name Common Functionality @@ -657,7 +657,7 @@ namespace cereal //! Loads a value from the current node - string overload void loadValue(std::string & val) { search(); val = itsIteratorStack.back().value().GetString(); ++itsIteratorStack.back(); } //! Loads a nullptr from the current node - void loadValue(std::nullptr_t&) { search(); CEREAL_RAPIDJSON_ASSERT(itsIteratorStack.back().value().IsNull()); ++itsIteratorStack.back(); } + void loadValue(std::nullptr_t&) { search(); RAPIDJSON_ASSERT(itsIteratorStack.back().value().IsNull()); ++itsIteratorStack.back(); } // Special cases to handle various flavors of long, which tend to conflict with // the int32_t or int64_t on various compiler/OS combinations. MSVC doesn't need any of this. @@ -737,7 +737,7 @@ namespace cereal const char * itsNextName; //!< Next name set by NVP ReadStream itsReadStream; //!< Rapidjson write stream std::vector itsIteratorStack; //!< 'Stack' of rapidJSON iterators - CEREAL_RAPIDJSON_NAMESPACE::Document itsDocument; //!< Rapidjson document + RAPIDJSON_NAMESPACE::Document itsDocument; //!< Rapidjson document }; // ######################################################################