cereal
A C++11 library for serialization
Classes | Macros | Functions
json.hpp File Reference

JSON input and output archives. More...

#include <cereal/cereal.hpp>
#include <cereal/details/util.hpp>
#include <cereal/external/rapidjson/prettywriter.h>
#include <cereal/external/rapidjson/genericstream.h>
#include <cereal/external/rapidjson/reader.h>
#include <cereal/external/rapidjson/document.h>
#include <cereal/external/base64.hpp>
#include <limits>
#include <sstream>
#include <stack>
#include <vector>
#include <string>

Go to the source code of this file.

Classes

struct  cereal::RapidJSONException
 An exception thrown when rapidjson fails an internal assertion. More...
 
class  cereal::JSONOutputArchive
 An output archive designed to save data to JSON. More...
 
class  cereal::JSONOutputArchive::Options
 A class containing various advanced options for the JSON archive. More...
 
class  cereal::JSONInputArchive
 An input archive designed to load data from JSON. More...
 

Macros

#define RAPIDJSON_ASSERT(x)
 

Functions

template<class T >
void cereal::prologue (JSONOutputArchive &, NameValuePair< T > const &)
 Prologue for NVPs for JSON archives. More...
 
template<class T >
void cereal::prologue (JSONInputArchive &, NameValuePair< T > const &)
 Prologue for NVPs for JSON archives.
 
template<class T >
void cereal::epilogue (JSONOutputArchive &, NameValuePair< T > const &)
 Epilogue for NVPs for JSON archives. More...
 
template<class T >
void cereal::epilogue (JSONInputArchive &, NameValuePair< T > const &)
 Epilogue for NVPs for JSON archives. More...
 
template<class T >
void cereal::prologue (JSONOutputArchive &ar, SizeTag< T > const &)
 Prologue for SizeTags for JSON archives. More...
 
template<class T >
void cereal::prologue (JSONInputArchive &, SizeTag< T > const &)
 Prologue for SizeTags for JSON archives.
 
template<class T >
void cereal::epilogue (JSONOutputArchive &, SizeTag< T > const &)
 Epilogue for SizeTags for JSON archives. More...
 
template<class T >
void cereal::epilogue (JSONInputArchive &, SizeTag< T > const &)
 Epilogue for SizeTags for JSON archives.
 
template<class T , traits::DisableIf< std::is_arithmetic< T >::value||traits::has_minimal_base_class_serialization< T, traits::has_minimal_output_serialization, JSONOutputArchive >::value||traits::has_minimal_output_serialization< T, JSONOutputArchive >::value > = traits::sfinae>
void cereal::prologue (JSONOutputArchive &ar, T const &)
 Prologue for all other types for JSON archives (except minimal types) More...
 
template<class T , traits::DisableIf< std::is_arithmetic< T >::value||traits::has_minimal_base_class_serialization< T, traits::has_minimal_input_serialization, JSONInputArchive >::value||traits::has_minimal_input_serialization< T, JSONInputArchive >::value > = traits::sfinae>
void cereal::prologue (JSONInputArchive &ar, T const &)
 Prologue for all other types for JSON archives. More...
 
template<class T , traits::DisableIf< std::is_arithmetic< T >::value||traits::has_minimal_base_class_serialization< T, traits::has_minimal_output_serialization, JSONOutputArchive >::value||traits::has_minimal_output_serialization< T, JSONOutputArchive >::value > = traits::sfinae>
void cereal::epilogue (JSONOutputArchive &ar, T const &)
 Epilogue for all other types other for JSON archives (except minimal types. More...
 
template<class T , traits::DisableIf< std::is_arithmetic< T >::value||traits::has_minimal_base_class_serialization< T, traits::has_minimal_input_serialization, JSONInputArchive >::value||traits::has_minimal_input_serialization< T, JSONInputArchive >::value > = traits::sfinae>
void cereal::epilogue (JSONInputArchive &ar, T const &)
 Epilogue for all other types other for JSON archives. More...
 
template<class CharT , class Traits , class Alloc >
void cereal::prologue (JSONOutputArchive &ar, std::basic_string< CharT, Traits, Alloc > const &)
 Prologue for strings for JSON archives.
 
template<class CharT , class Traits , class Alloc >
void cereal::prologue (JSONInputArchive &, std::basic_string< CharT, Traits, Alloc > const &)
 Prologue for strings for JSON archives.
 
template<class CharT , class Traits , class Alloc >
void cereal::epilogue (JSONOutputArchive &, std::basic_string< CharT, Traits, Alloc > const &)
 Epilogue for strings for JSON archives.
 
template<class CharT , class Traits , class Alloc >
void cereal::epilogue (JSONInputArchive &, std::basic_string< CharT, Traits, Alloc > const &)
 Epilogue for strings for JSON archives.
 
template<class T >
void cereal::CEREAL_SAVE_FUNCTION_NAME (JSONOutputArchive &ar, NameValuePair< T > const &t)
 Serializing NVP types to JSON.
 
template<class T >
void cereal::CEREAL_LOAD_FUNCTION_NAME (JSONInputArchive &ar, NameValuePair< T > &t)
 
template<class T , traits::EnableIf< std::is_arithmetic< T >::value > = traits::sfinae>
void cereal::CEREAL_SAVE_FUNCTION_NAME (JSONOutputArchive &ar, T const &t)
 Saving for arithmetic to JSON.
 
template<class T , traits::EnableIf< std::is_arithmetic< T >::value > = traits::sfinae>
void cereal::CEREAL_LOAD_FUNCTION_NAME (JSONInputArchive &ar, T &t)
 Loading arithmetic from JSON.
 
template<class CharT , class Traits , class Alloc >
void cereal::CEREAL_SAVE_FUNCTION_NAME (JSONOutputArchive &ar, std::basic_string< CharT, Traits, Alloc > const &str)
 saving string to JSON
 
template<class CharT , class Traits , class Alloc >
void cereal::CEREAL_LOAD_FUNCTION_NAME (JSONInputArchive &ar, std::basic_string< CharT, Traits, Alloc > &str)
 loading string from JSON
 
template<class T >
void cereal::CEREAL_SAVE_FUNCTION_NAME (JSONOutputArchive &, SizeTag< T > const &)
 Saving SizeTags to JSON.
 
template<class T >
void cereal::CEREAL_LOAD_FUNCTION_NAME (JSONInputArchive &ar, SizeTag< T > &st)
 Loading SizeTags from JSON.
 

Detailed Description

JSON input and output archives.

Macro Definition Documentation

#define RAPIDJSON_ASSERT (   x)
Value:
if(!(x)){ \
throw ::cereal::RapidJSONException("rapidjson internal assertion failure: " #x); }