Skip to content

Commit

Permalink
updated cereal to 1.2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
sfalkner committed Aug 29, 2017
1 parent 8b5b02e commit 8cc5c52
Show file tree
Hide file tree
Showing 36 changed files with 266 additions and 145 deletions.
File renamed without changes.
4 changes: 2 additions & 2 deletions include/cereal/access.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
#include <cstdint>
#include <functional>

#include <cereal/macros.hpp>
#include <cereal/details/helpers.hpp>
#include "cereal/macros.hpp"
#include "cereal/details/helpers.hpp"

namespace cereal
{
Expand Down
2 changes: 1 addition & 1 deletion include/cereal/archives/adapters.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#ifndef CEREAL_ARCHIVES_ADAPTERS_HPP_
#define CEREAL_ARCHIVES_ADAPTERS_HPP_

#include <cereal/details/helpers.hpp>
#include "cereal/details/helpers.hpp"
#include <utility>

namespace cereal
Expand Down
2 changes: 1 addition & 1 deletion include/cereal/archives/binary.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#ifndef CEREAL_ARCHIVES_BINARY_HPP_
#define CEREAL_ARCHIVES_BINARY_HPP_

#include <cereal/cereal.hpp>
#include "cereal/cereal.hpp"
#include <sstream>

namespace cereal
Expand Down
42 changes: 24 additions & 18 deletions include/cereal/archives/json.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
#ifndef CEREAL_ARCHIVES_JSON_HPP_
#define CEREAL_ARCHIVES_JSON_HPP_

#include <cereal/cereal.hpp>
#include <cereal/details/util.hpp>
#include "cereal/cereal.hpp"
#include "cereal/details/util.hpp"

namespace cereal
{
Expand All @@ -50,11 +50,11 @@ namespace cereal
#define CEREAL_RAPIDJSON_WRITE_DEFAULT_FLAGS kWriteNanAndInfFlag
#define CEREAL_RAPIDJSON_PARSE_DEFAULT_FLAGS kParseFullPrecisionFlag | kParseNanAndInfFlag

#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/base64.hpp>
#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/base64.hpp"

#include <limits>
#include <sstream>
Expand Down Expand Up @@ -96,8 +96,8 @@ namespace cereal
{
enum class NodeType { StartObject, InObject, StartArray, InArray };

using WriteStream = rapidjson::OStreamWrapper;
using JSONWriter = rapidjson::PrettyWriter<WriteStream>;
using WriteStream = CEREAL_RAPIDJSON_NAMESPACE::OStreamWrapper;
using JSONWriter = CEREAL_RAPIDJSON_NAMESPACE::PrettyWriter<WriteStream>;

public:
/*! @name Common Functionality
Expand Down Expand Up @@ -242,7 +242,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<rapidjson::SizeType>( s.size() )); }
void saveValue(std::string const & s) { itsWriter.String(s.c_str(), static_cast<CEREAL_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
Expand Down Expand Up @@ -406,11 +406,11 @@ namespace cereal
class JSONInputArchive : public InputArchive<JSONInputArchive>, public traits::TextArchive
{
private:
using ReadStream = rapidjson::IStreamWrapper;
typedef rapidjson::GenericValue<rapidjson::UTF8<>> JSONValue;
using ReadStream = CEREAL_RAPIDJSON_NAMESPACE::IStreamWrapper;
typedef CEREAL_RAPIDJSON_NAMESPACE::GenericValue<CEREAL_RAPIDJSON_NAMESPACE::UTF8<>> JSONValue;
typedef JSONValue::ConstMemberIterator MemberIterator;
typedef JSONValue::ConstValueIterator ValueIterator;
typedef rapidjson::Document::GenericValue GenericValue;
typedef CEREAL_RAPIDJSON_NAMESPACE::Document::GenericValue GenericValue;

public:
/*! @name Common Functionality
Expand Down Expand Up @@ -471,11 +471,17 @@ namespace cereal

Iterator(MemberIterator begin, MemberIterator end) :
itsMemberItBegin(begin), itsMemberItEnd(end), itsIndex(0), itsType(Member)
{ }
{
if( std::distance( begin, end ) == 0 )
itsType = Null_;
}

Iterator(ValueIterator begin, ValueIterator end) :
itsValueItBegin(begin), itsValueItEnd(end), itsIndex(0), itsType(Value)
{ }
{
if( std::distance( begin, end ) == 0 )
itsType = Null_;
}

//! Advance to the next node
Iterator & operator++()
Expand All @@ -491,7 +497,7 @@ namespace cereal
{
case Value : return itsValueItBegin[itsIndex];
case Member: return itsMemberItBegin[itsIndex].value;
default: throw cereal::Exception("Invalid Iterator Type!");
default: throw cereal::Exception("JSONInputArchive internal error: null or empty iterator to object or array!");
}
}

Expand Down Expand Up @@ -528,7 +534,7 @@ namespace cereal
MemberIterator itsMemberItBegin, itsMemberItEnd; //!< The member iterator (object)
ValueIterator itsValueItBegin, itsValueItEnd; //!< The value iterator (array)
size_t itsIndex; //!< The current index of this iterator
enum Type {Value, Member, Null_} itsType; //!< Whether this holds values (array) or members (objects) or nothing
enum Type {Value, Member, Null_} itsType; //!< Whether this holds values (array) or members (objects) or nothing
};

//! Searches for the expectedName node if it doesn't match the actualName
Expand Down Expand Up @@ -713,7 +719,7 @@ namespace cereal
const char * itsNextName; //!< Next name set by NVP
ReadStream itsReadStream; //!< Rapidjson write stream
std::vector<Iterator> itsIteratorStack; //!< 'Stack' of rapidJSON iterators
rapidjson::Document itsDocument; //!< Rapidjson document
CEREAL_RAPIDJSON_NAMESPACE::Document itsDocument; //!< Rapidjson document
};

// ######################################################################
Expand Down
2 changes: 1 addition & 1 deletion include/cereal/archives/portable_binary.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#ifndef CEREAL_ARCHIVES_PORTABLE_BINARY_HPP_
#define CEREAL_ARCHIVES_PORTABLE_BINARY_HPP_

#include <cereal/cereal.hpp>
#include "cereal/cereal.hpp"
#include <sstream>
#include <limits>

Expand Down
10 changes: 5 additions & 5 deletions include/cereal/archives/xml.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@
*/
#ifndef CEREAL_ARCHIVES_XML_HPP_
#define CEREAL_ARCHIVES_XML_HPP_
#include <cereal/cereal.hpp>
#include <cereal/details/util.hpp>
#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/base64.hpp>
#include "cereal/external/rapidxml/rapidxml.hpp"
#include "cereal/external/rapidxml/rapidxml_print.hpp"
#include "cereal/external/base64.hpp"

#include <sstream>
#include <stack>
Expand Down
38 changes: 33 additions & 5 deletions include/cereal/cereal.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@
#include <cstdint>
#include <functional>

#include <cereal/macros.hpp>
#include <cereal/details/traits.hpp>
#include <cereal/details/helpers.hpp>
#include <cereal/types/base_class.hpp>
#include "cereal/macros.hpp"
#include "cereal/details/traits.hpp"
#include "cereal/details/helpers.hpp"
#include "cereal/types/base_class.hpp"

namespace cereal
{
Expand Down Expand Up @@ -255,6 +255,20 @@ namespace cereal
a large project from Boost to cereal. The preferred interface for cereal is using operator(). */
//! @{

//! Indicates this archive is not intended for loading
/*! This ensures compatibility with boost archive types. If you are transitioning
from boost, you can check this value within a member or external serialize function
(i.e., Archive::is_loading::value) to disable behavior specific to loading, until
you can transition to split save/load or save_minimal/load_minimal functions */
using is_loading = std::false_type;

//! Indicates this archive is intended for saving
/*! This ensures compatibility with boost archive types. If you are transitioning
from boost, you can check this value within a member or external serialize function
(i.e., Archive::is_saving::value) to enable behavior specific to loading, until
you can transition to split save/load or save_minimal/load_minimal functions */
using is_saving = std::true_type;

//! Serializes passed in data
/*! This is a boost compatability layer and is not the preferred way of using
cereal. If you are transitioning from boost, use this until you can
Expand Down Expand Up @@ -611,6 +625,20 @@ namespace cereal
a large project from Boost to cereal. The preferred interface for cereal is using operator(). */
//! @{

//! Indicates this archive is intended for loading
/*! This ensures compatibility with boost archive types. If you are transitioning
from boost, you can check this value within a member or external serialize function
(i.e., Archive::is_loading::value) to enable behavior specific to loading, until
you can transition to split save/load or save_minimal/load_minimal functions */
using is_loading = std::true_type;

//! Indicates this archive is not intended for saving
/*! This ensures compatibility with boost archive types. If you are transitioning
from boost, you can check this value within a member or external serialize function
(i.e., Archive::is_saving::value) to disable behavior specific to loading, until
you can transition to split save/load or save_minimal/load_minimal functions */
using is_saving = std::false_type;

//! Serializes passed in data
/*! This is a boost compatability layer and is not the preferred way of using
cereal. If you are transitioning from boost, use this until you can
Expand Down Expand Up @@ -954,6 +982,6 @@ namespace cereal
} // namespace cereal

// This include needs to come after things such as binary_data, make_nvp, etc
#include <cereal/types/common.hpp>
#include "cereal/types/common.hpp"

#endif // CEREAL_CEREAL_HPP_
10 changes: 6 additions & 4 deletions include/cereal/details/helpers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
#include <unordered_map>
#include <stdexcept>

#include <cereal/macros.hpp>
#include <cereal/details/static_object.hpp>
#include "cereal/macros.hpp"
#include "cereal/details/static_object.hpp"

namespace cereal
{
Expand All @@ -55,8 +55,10 @@ namespace cereal
//! The size type used by cereal
/*! To ensure compatability between 32, 64, etc bit machines, we need to use
a fixed size type instead of size_t, which may vary from machine to
machine. */
using size_type = uint64_t;
machine.
The default value for CEREAL_SIZE_TYPE is specified in cereal/macros.hpp */
using size_type = CEREAL_SIZE_TYPE;

// forward decls
class BinaryOutputArchive;
Expand Down
Loading

0 comments on commit 8cc5c52

Please sign in to comment.