Include Debian packaged rapidjson
authorAndreas Tille <tille@debian.org>
Thu, 13 Oct 2022 17:31:58 +0000 (13:31 -0400)
committerScott Talbert <swt@techie.net>
Thu, 13 Oct 2022 17:31:58 +0000 (13:31 -0400)
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

include/cereal/archives/json.hpp

index 199efc946d3e7390b8b66285e6cbbbf1e4b6d48d..2334e074d1aff8466409e7a9bd83b25e16c359eb 100644 (file)
@@ -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 <limits>
@@ -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<WriteStream>;
+    using WriteStream = RAPIDJSON_NAMESPACE::OStreamWrapper;
+    using JSONWriter = RAPIDJSON_NAMESPACE::PrettyWriter<WriteStream>;
 
     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<CEREAL_RAPIDJSON_NAMESPACE::SizeType>( s.size() )); }
+      void saveValue(std::string const & s) { itsWriter.String(s.c_str(), static_cast<RAPIDJSON_NAMESPACE::SizeType>( 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<JSONInputArchive>, public traits::TextArchive
   {
     private:
-      using ReadStream = CEREAL_RAPIDJSON_NAMESPACE::IStreamWrapper;
-      typedef CEREAL_RAPIDJSON_NAMESPACE::GenericValue<CEREAL_RAPIDJSON_NAMESPACE::UTF8<>> JSONValue;
+      using ReadStream = RAPIDJSON_NAMESPACE::IStreamWrapper;
+      typedef RAPIDJSON_NAMESPACE::GenericValue<RAPIDJSON_NAMESPACE::UTF8<>> 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<Iterator> itsIteratorStack; //!< 'Stack' of rapidJSON iterators
-      CEREAL_RAPIDJSON_NAMESPACE::Document itsDocument; //!< Rapidjson document
+      RAPIDJSON_NAMESPACE::Document itsDocument; //!< Rapidjson document
   };
 
   // ######################################################################