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

Use submodules to have a recent rapidjson & rapidxml version #829

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[submodule "include/cereal/external/rapidjson"]
path = include/cereal/external/rapidjson
url = https://github.com/Tencent/rapidjson.git
[submodule "include/cereal/external/rapidxml"]
path = include/cereal/external/rapidxml
url = https://github.com/Fe-Bell/RapidXML.git
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
cmake_minimum_required(VERSION 3.6...3.15)
cmake_policy(SET CMP0167 NEW)

project(cereal LANGUAGES CXX VERSION 1.3.2)

Expand Down
22 changes: 11 additions & 11 deletions include/cereal/archives/json.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ namespace cereal
#define CEREAL_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 "cereal/external/rapidjson/include/rapidjson/prettywriter.h"
#include "cereal/external/rapidjson/include/rapidjson/ostreamwrapper.h"
#include "cereal/external/rapidjson/include/rapidjson/istreamwrapper.h"
#include "cereal/external/rapidjson/include/rapidjson/document.h"
#include "cereal/external/base64.hpp"

#include <limits>
Expand Down Expand Up @@ -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::OStreamWrapper;
using JSONWriter = rapidjson::PrettyWriter<WriteStream>;

public:
/*! @name Common Functionality
Expand Down Expand Up @@ -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::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
Expand Down Expand Up @@ -428,11 +428,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::IStreamWrapper;
typedef rapidjson::GenericValue<rapidjson::UTF8<>> JSONValue;
typedef JSONValue::ConstMemberIterator MemberIterator;
typedef JSONValue::ConstValueIterator ValueIterator;
typedef CEREAL_RAPIDJSON_NAMESPACE::Document::GenericValue GenericValue;
typedef rapidjson::Document::GenericValue GenericValue;

public:
/*! @name Common Functionality
Expand Down Expand Up @@ -754,7 +754,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::Document itsDocument; //!< Rapidjson document
};

// ######################################################################
Expand Down
12 changes: 6 additions & 6 deletions include/cereal/archives/xml.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
#include "cereal/cereal.hpp"
#include "cereal/details/util.hpp"

#include "cereal/external/rapidxml/rapidxml.hpp"
#include "cereal/external/rapidxml/rapidxml_print.hpp"
#include "cereal/external/rapidxml/RapidXML/rapidxml.hpp"
#include "cereal/external/rapidxml/RapidXML/rapidxml_print.hpp"
#include "cereal/external/base64.hpp"

#include <sstream>
Expand Down Expand Up @@ -168,13 +168,13 @@ namespace cereal
itsSizeAttributes(options.itsSizeAttributes)
{
// rapidxml will delete all allocations when xml_document is cleared
auto node = itsXML.allocate_node( rapidxml::node_declaration );
auto node = itsXML.allocate_node( rapidxml::node_type::node_declaration );
node->append_attribute( itsXML.allocate_attribute( "version", "1.0" ) );
node->append_attribute( itsXML.allocate_attribute( "encoding", "utf-8" ) );
itsXML.append_node( node );

// allocate root node
auto root = itsXML.allocate_node( rapidxml::node_element, xml_detail::CEREAL_XML_STRING );
auto root = itsXML.allocate_node( rapidxml::node_type::node_element, xml_detail::CEREAL_XML_STRING );
itsXML.append_node( root );
itsNodes.emplace( root );

Expand Down Expand Up @@ -233,7 +233,7 @@ namespace cereal
auto namePtr = itsXML.allocate_string( nameString.data(), nameString.length() + 1 );

// insert into the XML
auto node = itsXML.allocate_node( rapidxml::node_element, namePtr, nullptr, nameString.size() );
auto node = itsXML.allocate_node( rapidxml::node_type::node_element, namePtr, nullptr, nameString.size() );
itsNodes.top().node->append_node( node );
itsNodes.emplace( node );
}
Expand Down Expand Up @@ -278,7 +278,7 @@ namespace cereal
auto dataPtr = itsXML.allocate_string(strValue.c_str(), strValue.length() + 1 );

// insert into the XML
itsNodes.top().node->append_node( itsXML.allocate_node( rapidxml::node_data, nullptr, dataPtr ) );
itsNodes.top().node->append_node( itsXML.allocate_node( rapidxml::node_type::node_data, nullptr, dataPtr ) );
}

//! Overload for uint8_t prevents them from being serialized as characters
Expand Down
1 change: 1 addition & 0 deletions include/cereal/external/rapidjson
Submodule rapidjson added at ab1842
13 changes: 0 additions & 13 deletions include/cereal/external/rapidjson/LICENSE

This file was deleted.

Loading