mirror of
https://github.com/USCiLab/cereal.git
synced 2025-10-18 01:45:52 +02:00
removed ^M from some files, skeleton of input json
This commit is contained in:
@@ -34,6 +34,7 @@
|
|||||||
|
|
||||||
#include <cereal/external/rapidjson/prettywriter.h>
|
#include <cereal/external/rapidjson/prettywriter.h>
|
||||||
#include <cereal/external/rapidjson/genericstream.h>
|
#include <cereal/external/rapidjson/genericstream.h>
|
||||||
|
#include <cereal/external/rapidjson/reader.h>
|
||||||
#include <cereal/external/base64.hpp>
|
#include <cereal/external/base64.hpp>
|
||||||
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
@@ -135,6 +136,11 @@ namespace cereal
|
|||||||
the data encoded as a base64 string */
|
the data encoded as a base64 string */
|
||||||
void saveBinaryValue( const void * data, size_t size, const char * name = nullptr )
|
void saveBinaryValue( const void * data, size_t size, const char * name = nullptr )
|
||||||
{
|
{
|
||||||
|
setNextName( name );
|
||||||
|
writeName();
|
||||||
|
|
||||||
|
auto base64string = base64::encode( reinterpret_cast<const unsigned char *>( data ), size );
|
||||||
|
saveValue( base64string );
|
||||||
};
|
};
|
||||||
|
|
||||||
void setOutputType(bool outputType)
|
void setOutputType(bool outputType)
|
||||||
@@ -142,8 +148,6 @@ namespace cereal
|
|||||||
itsOutputType = outputType;
|
itsOutputType = outputType;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
WriteStream itsWriteStream; //!< Rapidjson write stream
|
WriteStream itsWriteStream; //!< Rapidjson write stream
|
||||||
JSONWriter itsWriter; //!< Rapidjson writer
|
JSONWriter itsWriter; //!< Rapidjson writer
|
||||||
@@ -153,18 +157,28 @@ namespace cereal
|
|||||||
std::stack<uint32_t> itsNameCounter; //!< Counter for creating unique names for unnamed nodes
|
std::stack<uint32_t> itsNameCounter; //!< Counter for creating unique names for unnamed nodes
|
||||||
}; // JSONOutputArchive
|
}; // JSONOutputArchive
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// ######################################################################
|
// ######################################################################
|
||||||
//! An input archive designed to load data from JSON
|
//! An input archive designed to load data from JSON
|
||||||
/*! \note Not working yet!
|
/*! \note Not working yet!
|
||||||
\ingroup Archives */
|
\ingroup Archives */
|
||||||
class JSONInputArchive
|
class JSONInputArchive : public InputArchive<JSONInputArchive>
|
||||||
{
|
{
|
||||||
|
//typedef rapidjson::GenericWriteStream WriteStream;
|
||||||
|
//typedef rapidjson::PrettyWriter<WriteStream> JSONWriter;
|
||||||
|
|
||||||
|
public:
|
||||||
|
//! Construct, outputting to the provided stream
|
||||||
|
/*! @param stream The stream to output to. Can be a stringstream, a file stream, or
|
||||||
|
even cout! */
|
||||||
|
JSONInputArchive(std::istream & ) :
|
||||||
|
InputArchive<JSONInputArchive>(this)
|
||||||
|
{
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// ######################################################################
|
// ######################################################################
|
||||||
// JSONArchive prologue and epilogue functions
|
// JSONArchive prologue and epilogue functions
|
||||||
|
// ######################################################################
|
||||||
|
|
||||||
//! Prologue for NVPs for JSON archives
|
//! Prologue for NVPs for JSON archives
|
||||||
/*! NVPs do not start or finish nodes - they just set up the names */
|
/*! NVPs do not start or finish nodes - they just set up the names */
|
||||||
@@ -194,7 +208,7 @@ namespace cereal
|
|||||||
/*! Starts a new node, named either automatically or by some NVP,
|
/*! Starts a new node, named either automatically or by some NVP,
|
||||||
that may be given data by the type about to be archived */
|
that may be given data by the type about to be archived */
|
||||||
template <class T>
|
template <class T>
|
||||||
typename std::enable_if<!std::is_arithmetic<T>::value, void>::type
|
typename std::enable_if<!std::is_arithmetic<T>::value, void>::type
|
||||||
prologue( JSONOutputArchive & ar, T const & data )
|
prologue( JSONOutputArchive & ar, T const & data )
|
||||||
{
|
{
|
||||||
ar.startNode();
|
ar.startNode();
|
||||||
@@ -203,21 +217,21 @@ namespace cereal
|
|||||||
//! Epilogue for all other types other for JSON archives
|
//! Epilogue for all other types other for JSON archives
|
||||||
/*! Finishes the node created in the prologue */
|
/*! Finishes the node created in the prologue */
|
||||||
template <class T>
|
template <class T>
|
||||||
typename std::enable_if<!std::is_arithmetic<T>::value, void>::type
|
typename std::enable_if<!std::is_arithmetic<T>::value, void>::type
|
||||||
epilogue( JSONOutputArchive & ar, T const & data )
|
epilogue( JSONOutputArchive & ar, T const & data )
|
||||||
{
|
{
|
||||||
ar.finishNode();
|
ar.finishNode();
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
typename std::enable_if<std::is_arithmetic<T>::value, void>::type
|
typename std::enable_if<std::is_arithmetic<T>::value, void>::type
|
||||||
prologue( JSONOutputArchive & ar, T const & data )
|
prologue( JSONOutputArchive & ar, T const & data )
|
||||||
{
|
{
|
||||||
ar.writeName();
|
ar.writeName();
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
typename std::enable_if<std::is_arithmetic<T>::value, void>::type
|
typename std::enable_if<std::is_arithmetic<T>::value, void>::type
|
||||||
epilogue( JSONOutputArchive & ar, T const & data )
|
epilogue( JSONOutputArchive & ar, T const & data )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -235,6 +249,7 @@ namespace cereal
|
|||||||
|
|
||||||
// ######################################################################
|
// ######################################################################
|
||||||
// Common JSONArchive serialization functions
|
// Common JSONArchive serialization functions
|
||||||
|
// ######################################################################
|
||||||
|
|
||||||
//! Serializing NVP types to JSON
|
//! Serializing NVP types to JSON
|
||||||
template <class Archive, class T> inline
|
template <class Archive, class T> inline
|
||||||
@@ -248,7 +263,7 @@ namespace cereal
|
|||||||
//! Serializing SizeTags to JSON
|
//! Serializing SizeTags to JSON
|
||||||
template <class Archive, class T> inline
|
template <class Archive, class T> inline
|
||||||
CEREAL_ARCHIVE_RESTRICT(JSONInputArchive, JSONOutputArchive)
|
CEREAL_ARCHIVE_RESTRICT(JSONInputArchive, JSONOutputArchive)
|
||||||
serialize( Archive & ar, SizeTag<T> & )
|
serialize( Archive &, SizeTag<T> & )
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
//! Saving for arithmetic to JSON
|
//! Saving for arithmetic to JSON
|
||||||
@@ -265,11 +280,10 @@ namespace cereal
|
|||||||
{
|
{
|
||||||
ar.saveValue( str );
|
ar.saveValue( str );
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace cereal
|
} // namespace cereal
|
||||||
|
|
||||||
// register archives for polymorphic support
|
// register archives for polymorphic support
|
||||||
|
CEREAL_REGISTER_ARCHIVE(cereal::JSONInputArchive);
|
||||||
CEREAL_REGISTER_ARCHIVE(cereal::JSONOutputArchive);
|
CEREAL_REGISTER_ARCHIVE(cereal::JSONOutputArchive);
|
||||||
|
|
||||||
#endif // CEREAL_ARCHIVES_JSON_HPP_
|
#endif // CEREAL_ARCHIVES_JSON_HPP_
|
||||||
|
|
||||||
|
|||||||
1642
include/cereal/external/rapidjson/document.h
vendored
1642
include/cereal/external/rapidjson/document.h
vendored
File diff suppressed because it is too large
Load Diff
312
include/cereal/external/rapidjson/prettywriter.h
vendored
312
include/cereal/external/rapidjson/prettywriter.h
vendored
@@ -1,156 +1,156 @@
|
|||||||
#ifndef RAPIDJSON_PRETTYWRITER_H_
|
#ifndef RAPIDJSON_PRETTYWRITER_H_
|
||||||
#define RAPIDJSON_PRETTYWRITER_H_
|
#define RAPIDJSON_PRETTYWRITER_H_
|
||||||
|
|
||||||
#include "writer.h"
|
#include "writer.h"
|
||||||
|
|
||||||
namespace rapidjson {
|
namespace rapidjson {
|
||||||
|
|
||||||
//! Writer with indentation and spacing.
|
//! Writer with indentation and spacing.
|
||||||
/*!
|
/*!
|
||||||
\tparam Stream Type of ouptut stream.
|
\tparam Stream Type of ouptut stream.
|
||||||
\tparam Encoding Encoding of both source strings and output.
|
\tparam Encoding Encoding of both source strings and output.
|
||||||
\tparam Allocator Type of allocator for allocating memory of stack.
|
\tparam Allocator Type of allocator for allocating memory of stack.
|
||||||
*/
|
*/
|
||||||
template<typename Stream, typename Encoding = UTF8<>, typename Allocator = MemoryPoolAllocator<> >
|
template<typename Stream, typename Encoding = UTF8<>, typename Allocator = MemoryPoolAllocator<> >
|
||||||
class PrettyWriter : public Writer<Stream, Encoding, Allocator> {
|
class PrettyWriter : public Writer<Stream, Encoding, Allocator> {
|
||||||
public:
|
public:
|
||||||
typedef Writer<Stream, Encoding, Allocator> Base;
|
typedef Writer<Stream, Encoding, Allocator> Base;
|
||||||
typedef typename Base::Ch Ch;
|
typedef typename Base::Ch Ch;
|
||||||
|
|
||||||
//! Constructor
|
//! Constructor
|
||||||
/*! \param stream Output stream.
|
/*! \param stream Output stream.
|
||||||
\param allocator User supplied allocator. If it is null, it will create a private one.
|
\param allocator User supplied allocator. If it is null, it will create a private one.
|
||||||
\param levelDepth Initial capacity of
|
\param levelDepth Initial capacity of
|
||||||
*/
|
*/
|
||||||
PrettyWriter(Stream& stream, Allocator* allocator = 0, size_t levelDepth = Base::kDefaultLevelDepth) :
|
PrettyWriter(Stream& stream, Allocator* allocator = 0, size_t levelDepth = Base::kDefaultLevelDepth) :
|
||||||
Base(stream, allocator, levelDepth), indentChar_(' '), indentCharCount_(4) {}
|
Base(stream, allocator, levelDepth), indentChar_(' '), indentCharCount_(4) {}
|
||||||
|
|
||||||
//! Set custom indentation.
|
//! Set custom indentation.
|
||||||
/*! \param indentChar Character for indentation. Must be whitespace character (' ', '\t', '\n', '\r').
|
/*! \param indentChar Character for indentation. Must be whitespace character (' ', '\t', '\n', '\r').
|
||||||
\param indentCharCount Number of indent characters for each indentation level.
|
\param indentCharCount Number of indent characters for each indentation level.
|
||||||
\note The default indentation is 4 spaces.
|
\note The default indentation is 4 spaces.
|
||||||
*/
|
*/
|
||||||
PrettyWriter& SetIndent(Ch indentChar, unsigned indentCharCount) {
|
PrettyWriter& SetIndent(Ch indentChar, unsigned indentCharCount) {
|
||||||
RAPIDJSON_ASSERT(indentChar == ' ' || indentChar == '\t' || indentChar == '\n' || indentChar == '\r');
|
RAPIDJSON_ASSERT(indentChar == ' ' || indentChar == '\t' || indentChar == '\n' || indentChar == '\r');
|
||||||
indentChar_ = indentChar;
|
indentChar_ = indentChar;
|
||||||
indentCharCount_ = indentCharCount;
|
indentCharCount_ = indentCharCount;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
//@name Implementation of Handler.
|
//@name Implementation of Handler.
|
||||||
//@{
|
//@{
|
||||||
|
|
||||||
PrettyWriter& Null() { PrettyPrefix(kNullType); Base::WriteNull(); return *this; }
|
PrettyWriter& Null() { PrettyPrefix(kNullType); Base::WriteNull(); return *this; }
|
||||||
PrettyWriter& Bool(bool b) { PrettyPrefix(b ? kTrueType : kFalseType); Base::WriteBool(b); return *this; }
|
PrettyWriter& Bool(bool b) { PrettyPrefix(b ? kTrueType : kFalseType); Base::WriteBool(b); return *this; }
|
||||||
PrettyWriter& Int(int i) { PrettyPrefix(kNumberType); Base::WriteInt(i); return *this; }
|
PrettyWriter& Int(int i) { PrettyPrefix(kNumberType); Base::WriteInt(i); return *this; }
|
||||||
PrettyWriter& Uint(unsigned u) { PrettyPrefix(kNumberType); Base::WriteUint(u); return *this; }
|
PrettyWriter& Uint(unsigned u) { PrettyPrefix(kNumberType); Base::WriteUint(u); return *this; }
|
||||||
PrettyWriter& Int64(int64_t i64) { PrettyPrefix(kNumberType); Base::WriteInt64(i64); return *this; }
|
PrettyWriter& Int64(int64_t i64) { PrettyPrefix(kNumberType); Base::WriteInt64(i64); return *this; }
|
||||||
PrettyWriter& Uint64(uint64_t u64) { PrettyPrefix(kNumberType); Base::WriteUint64(u64); return *this; }
|
PrettyWriter& Uint64(uint64_t u64) { PrettyPrefix(kNumberType); Base::WriteUint64(u64); return *this; }
|
||||||
PrettyWriter& Double(double d) { PrettyPrefix(kNumberType); Base::WriteDouble(d); return *this; }
|
PrettyWriter& Double(double d) { PrettyPrefix(kNumberType); Base::WriteDouble(d); return *this; }
|
||||||
|
|
||||||
PrettyWriter& String(const Ch* str, SizeType length, bool copy = false) {
|
PrettyWriter& String(const Ch* str, SizeType length, bool copy = false) {
|
||||||
(void)copy;
|
(void)copy;
|
||||||
PrettyPrefix(kStringType);
|
PrettyPrefix(kStringType);
|
||||||
Base::WriteString(str, length);
|
Base::WriteString(str, length);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
PrettyWriter& StartObject() {
|
PrettyWriter& StartObject() {
|
||||||
PrettyPrefix(kObjectType);
|
PrettyPrefix(kObjectType);
|
||||||
new (Base::level_stack_.template Push<typename Base::Level>()) typename Base::Level(false);
|
new (Base::level_stack_.template Push<typename Base::Level>()) typename Base::Level(false);
|
||||||
Base::WriteStartObject();
|
Base::WriteStartObject();
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
PrettyWriter& EndObject(SizeType memberCount = 0) {
|
PrettyWriter& EndObject(SizeType memberCount = 0) {
|
||||||
(void)memberCount;
|
(void)memberCount;
|
||||||
RAPIDJSON_ASSERT(Base::level_stack_.GetSize() >= sizeof(typename Base::Level));
|
RAPIDJSON_ASSERT(Base::level_stack_.GetSize() >= sizeof(typename Base::Level));
|
||||||
RAPIDJSON_ASSERT(!Base::level_stack_.template Top<typename Base::Level>()->inArray);
|
RAPIDJSON_ASSERT(!Base::level_stack_.template Top<typename Base::Level>()->inArray);
|
||||||
bool empty = Base::level_stack_.template Pop<typename Base::Level>(1)->valueCount == 0;
|
bool empty = Base::level_stack_.template Pop<typename Base::Level>(1)->valueCount == 0;
|
||||||
|
|
||||||
if (!empty) {
|
if (!empty) {
|
||||||
Base::stream_.Put('\n');
|
Base::stream_.Put('\n');
|
||||||
WriteIndent();
|
WriteIndent();
|
||||||
}
|
}
|
||||||
Base::WriteEndObject();
|
Base::WriteEndObject();
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
PrettyWriter& StartArray() {
|
PrettyWriter& StartArray() {
|
||||||
PrettyPrefix(kArrayType);
|
PrettyPrefix(kArrayType);
|
||||||
new (Base::level_stack_.template Push<typename Base::Level>()) typename Base::Level(true);
|
new (Base::level_stack_.template Push<typename Base::Level>()) typename Base::Level(true);
|
||||||
Base::WriteStartArray();
|
Base::WriteStartArray();
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
PrettyWriter& EndArray(SizeType memberCount = 0) {
|
PrettyWriter& EndArray(SizeType memberCount = 0) {
|
||||||
(void)memberCount;
|
(void)memberCount;
|
||||||
RAPIDJSON_ASSERT(Base::level_stack_.GetSize() >= sizeof(typename Base::Level));
|
RAPIDJSON_ASSERT(Base::level_stack_.GetSize() >= sizeof(typename Base::Level));
|
||||||
RAPIDJSON_ASSERT(Base::level_stack_.template Top<typename Base::Level>()->inArray);
|
RAPIDJSON_ASSERT(Base::level_stack_.template Top<typename Base::Level>()->inArray);
|
||||||
bool empty = Base::level_stack_.template Pop<typename Base::Level>(1)->valueCount == 0;
|
bool empty = Base::level_stack_.template Pop<typename Base::Level>(1)->valueCount == 0;
|
||||||
|
|
||||||
if (!empty) {
|
if (!empty) {
|
||||||
Base::stream_.Put('\n');
|
Base::stream_.Put('\n');
|
||||||
WriteIndent();
|
WriteIndent();
|
||||||
}
|
}
|
||||||
Base::WriteEndArray();
|
Base::WriteEndArray();
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
//! Simpler but slower overload.
|
//! Simpler but slower overload.
|
||||||
PrettyWriter& String(const Ch* str) { return String(str, internal::StrLen(str)); }
|
PrettyWriter& String(const Ch* str) { return String(str, internal::StrLen(str)); }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void PrettyPrefix(Type type) {
|
void PrettyPrefix(Type type) {
|
||||||
(void)type;
|
(void)type;
|
||||||
if (Base::level_stack_.GetSize() != 0) { // this value is not at root
|
if (Base::level_stack_.GetSize() != 0) { // this value is not at root
|
||||||
typename Base::Level* level = Base::level_stack_.template Top<typename Base::Level>();
|
typename Base::Level* level = Base::level_stack_.template Top<typename Base::Level>();
|
||||||
|
|
||||||
if (level->inArray) {
|
if (level->inArray) {
|
||||||
if (level->valueCount > 0) {
|
if (level->valueCount > 0) {
|
||||||
Base::stream_.Put(','); // add comma if it is not the first element in array
|
Base::stream_.Put(','); // add comma if it is not the first element in array
|
||||||
Base::stream_.Put('\n');
|
Base::stream_.Put('\n');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Base::stream_.Put('\n');
|
Base::stream_.Put('\n');
|
||||||
WriteIndent();
|
WriteIndent();
|
||||||
}
|
}
|
||||||
else { // in object
|
else { // in object
|
||||||
if (level->valueCount > 0) {
|
if (level->valueCount > 0) {
|
||||||
if (level->valueCount % 2 == 0) {
|
if (level->valueCount % 2 == 0) {
|
||||||
Base::stream_.Put(',');
|
Base::stream_.Put(',');
|
||||||
Base::stream_.Put('\n');
|
Base::stream_.Put('\n');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Base::stream_.Put(':');
|
Base::stream_.Put(':');
|
||||||
Base::stream_.Put(' ');
|
Base::stream_.Put(' ');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Base::stream_.Put('\n');
|
Base::stream_.Put('\n');
|
||||||
|
|
||||||
if (level->valueCount % 2 == 0)
|
if (level->valueCount % 2 == 0)
|
||||||
WriteIndent();
|
WriteIndent();
|
||||||
}
|
}
|
||||||
if (!level->inArray && level->valueCount % 2 == 0)
|
if (!level->inArray && level->valueCount % 2 == 0)
|
||||||
RAPIDJSON_ASSERT(type == kStringType); // if it's in object, then even number should be a name
|
RAPIDJSON_ASSERT(type == kStringType); // if it's in object, then even number should be a name
|
||||||
level->valueCount++;
|
level->valueCount++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
RAPIDJSON_ASSERT(type == kObjectType || type == kArrayType);
|
RAPIDJSON_ASSERT(type == kObjectType || type == kArrayType);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WriteIndent() {
|
void WriteIndent() {
|
||||||
size_t count = (Base::level_stack_.GetSize() / sizeof(typename Base::Level)) * indentCharCount_;
|
size_t count = (Base::level_stack_.GetSize() / sizeof(typename Base::Level)) * indentCharCount_;
|
||||||
PutN(Base::stream_, indentChar_, count);
|
PutN(Base::stream_, indentChar_, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
Ch indentChar_;
|
Ch indentChar_;
|
||||||
unsigned indentCharCount_;
|
unsigned indentCharCount_;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace rapidjson
|
} // namespace rapidjson
|
||||||
|
|
||||||
#endif // RAPIDJSON_RAPIDJSON_H_
|
#endif // RAPIDJSON_RAPIDJSON_H_
|
||||||
|
|||||||
1366
include/cereal/external/rapidjson/reader.h
vendored
1366
include/cereal/external/rapidjson/reader.h
vendored
File diff suppressed because it is too large
Load Diff
@@ -273,6 +273,14 @@ struct SubFixture
|
|||||||
CEREAL_NVP(d),
|
CEREAL_NVP(d),
|
||||||
CEREAL_NVP(s) );
|
CEREAL_NVP(s) );
|
||||||
}
|
}
|
||||||
|
void change()
|
||||||
|
{
|
||||||
|
a = 4;
|
||||||
|
b = 4;
|
||||||
|
c = 4;
|
||||||
|
d = 4;
|
||||||
|
s = "4";
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Fixture
|
struct Fixture
|
||||||
@@ -286,6 +294,12 @@ struct Fixture
|
|||||||
f3 );
|
f3 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void change()
|
||||||
|
{
|
||||||
|
f1.change();
|
||||||
|
f2.change();
|
||||||
|
f3.change();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
void foo(int t)
|
void foo(int t)
|
||||||
@@ -307,12 +321,34 @@ int main()
|
|||||||
cereal::JSONOutputArchive oar( std::cout );
|
cereal::JSONOutputArchive oar( std::cout );
|
||||||
|
|
||||||
Fixture fixture;
|
Fixture fixture;
|
||||||
|
|
||||||
oar( CEREAL_NVP(fixture) );
|
oar( CEREAL_NVP(fixture) );
|
||||||
|
|
||||||
|
std::vector<double> vecD = {1.23, 4.56, 7,89};
|
||||||
|
oar( CEREAL_NVP(vecD) );
|
||||||
|
|
||||||
|
bool b = true;
|
||||||
|
oar( cereal::make_nvp("coolean boolean", b) );
|
||||||
|
|
||||||
|
std::shared_ptr<std::string> sPtr = std::make_shared<std::string>("i'm a shared pointer");
|
||||||
|
oar( CEREAL_NVP(sPtr) );
|
||||||
|
|
||||||
|
int xxx[] = {-1, 95, 3};
|
||||||
|
oar.saveBinaryValue( xxx, sizeof(int)*3, "xxxbinary" );
|
||||||
|
oar.saveBinaryValue( xxx, sizeof(int)*3 );
|
||||||
}
|
}
|
||||||
|
|
||||||
std::cout << std::endl;
|
std::cout << std::endl;
|
||||||
|
|
||||||
|
{
|
||||||
|
cereal::JSONInputArchive iar( std::cin );
|
||||||
|
|
||||||
|
Fixture fixture; fixture.change();
|
||||||
|
//iar( fixture );
|
||||||
|
|
||||||
|
std::vector<double> vecD;
|
||||||
|
//iar( vecD );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user