cereal
A C++11 library for serialization
Loading...
Searching...
No Matches
xml.hpp File Reference

XML input and output archives. More...

#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 <sstream>
#include <stack>
#include <vector>
#include <limits>
#include <string>
#include <cstring>
#include <cmath>

Go to the source code of this file.

Classes

class  cereal::XMLOutputArchive
 An output archive designed to save data to XML. More...
class  cereal::XMLOutputArchive::Options
 A class containing various advanced options for the XML archive. More...
struct  cereal::XMLOutputArchive::NodeInfo
 A struct that contains metadata about a node. More...
class  cereal::XMLInputArchive
 An output archive designed to load data from XML. More...
struct  cereal::XMLInputArchive::NodeInfo
 A struct that contains metadata about a node. More...

Macros

#define CEREAL_XML_STRING_VALUE   "cereal"
 The default name for the root node in a cereal xml archive.

Functions

bool cereal::xml_detail::isWhitespace (char c)
 Returns true if the character is whitespace.
template<class T>
void cereal::prologue (XMLOutputArchive &, NameValuePair< T > const &)
 Prologue for NVPs for XML output archives.
template<class T>
void cereal::prologue (XMLInputArchive &, NameValuePair< T > const &)
 Prologue for NVPs for XML input archives.
template<class T>
void cereal::epilogue (XMLOutputArchive &, NameValuePair< T > const &)
 Epilogue for NVPs for XML output archives.
template<class T>
void cereal::epilogue (XMLInputArchive &, NameValuePair< T > const &)
 Epilogue for NVPs for XML input archives.
template<class T>
void cereal::prologue (XMLOutputArchive &, DeferredData< T > const &)
 Prologue for deferred data for XML archives.
template<class T>
void cereal::prologue (XMLInputArchive &, DeferredData< T > const &)
 Prologue for deferred data for XML archives.
template<class T>
void cereal::epilogue (XMLOutputArchive &, DeferredData< T > const &)
 Epilogue for deferred for XML archives.
template<class T>
void cereal::epilogue (XMLInputArchive &, DeferredData< T > const &)
 Epilogue for deferred for XML archives.
template<class T>
void cereal::prologue (XMLOutputArchive &ar, SizeTag< T > const &)
 Prologue for SizeTags for XML output archives.
template<class T>
void cereal::prologue (XMLInputArchive &, SizeTag< T > const &)
template<class T>
void cereal::epilogue (XMLOutputArchive &, SizeTag< T > const &)
 Epilogue for SizeTags for XML output archives.
template<class T>
void cereal::epilogue (XMLInputArchive &, SizeTag< T > const &)
template<class T, traits::DisableIf< traits::has_minimal_base_class_serialization< T, traits::has_minimal_output_serialization, XMLOutputArchive >::value||traits::has_minimal_output_serialization< T, XMLOutputArchive >::value > = traits::sfinae>
void cereal::prologue (XMLOutputArchive &ar, T const &)
 Prologue for all other types for XML output archives (except minimal types).
template<class T, traits::DisableIf< traits::has_minimal_base_class_serialization< T, traits::has_minimal_input_serialization, XMLInputArchive >::value||traits::has_minimal_input_serialization< T, XMLInputArchive >::value > = traits::sfinae>
void cereal::prologue (XMLInputArchive &ar, T const &)
 Prologue for all other types for XML input archives (except minimal types).
template<class T, traits::DisableIf< traits::has_minimal_base_class_serialization< T, traits::has_minimal_output_serialization, XMLOutputArchive >::value||traits::has_minimal_output_serialization< T, XMLOutputArchive >::value > = traits::sfinae>
void cereal::epilogue (XMLOutputArchive &ar, T const &)
 Epilogue for all other types other for XML output archives (except minimal types).
template<class T, traits::DisableIf< traits::has_minimal_base_class_serialization< T, traits::has_minimal_input_serialization, XMLInputArchive >::value||traits::has_minimal_input_serialization< T, XMLInputArchive >::value > = traits::sfinae>
void cereal::epilogue (XMLInputArchive &ar, T const &)
 Epilogue for all other types other for XML output archives (except minimal types).
template<class T>
void cereal::CEREAL_SAVE_FUNCTION_NAME (XMLOutputArchive &ar, NameValuePair< T > const &t)
 Saving NVP types to XML.
template<class T>
void cereal::CEREAL_LOAD_FUNCTION_NAME (XMLInputArchive &ar, NameValuePair< T > &t)
 Loading NVP types from XML.
template<class T>
void cereal::CEREAL_SAVE_FUNCTION_NAME (XMLOutputArchive &, SizeTag< T > const &)
 Saving SizeTags to XML.
template<class T>
void cereal::CEREAL_LOAD_FUNCTION_NAME (XMLInputArchive &ar, SizeTag< T > &st)
 Loading SizeTags from XML.
template<class T, traits::EnableIf< std::is_arithmetic< T >::value > = traits::sfinae>
void cereal::CEREAL_SAVE_FUNCTION_NAME (XMLOutputArchive &ar, T const &t)
 Saving for POD types to xml.
template<class T, traits::EnableIf< std::is_arithmetic< T >::value > = traits::sfinae>
void cereal::CEREAL_LOAD_FUNCTION_NAME (XMLInputArchive &ar, T &t)
 Loading for POD types from xml.
template<class CharT, class Traits, class Alloc>
void cereal::CEREAL_SAVE_FUNCTION_NAME (XMLOutputArchive &ar, std::basic_string< CharT, Traits, Alloc > const &str)
 saving string to xml
template<class CharT, class Traits, class Alloc>
void cereal::CEREAL_LOAD_FUNCTION_NAME (XMLInputArchive &ar, std::basic_string< CharT, Traits, Alloc > &str)
 loading string from xml

Detailed Description

XML input and output archives.

Macro Definition Documentation

◆ CEREAL_XML_STRING_VALUE

#define CEREAL_XML_STRING_VALUE   "cereal"

The default name for the root node in a cereal xml archive.

You can define CEREAL_XML_STRING_VALUE to be different assuming you do so before this file is included.

Function Documentation

◆ epilogue() [1/5]

template<class T>
void cereal::epilogue ( XMLInputArchive & ,
DeferredData< T > const &  )
inline

Epilogue for deferred for XML archives.

Do nothing for the defer wrapper

◆ epilogue() [2/5]

template<class T>
void cereal::epilogue ( XMLOutputArchive & ,
DeferredData< T > const &  )
inline

Epilogue for deferred for XML archives.

NVPs do not start or finish nodes - they just set up the names

◆ epilogue() [3/5]

template<class T>
void cereal::epilogue ( XMLOutputArchive & ,
NameValuePair< T > const &  )
inline

Epilogue for NVPs for XML output archives.

NVPs do not start or finish nodes - they just set up the names

◆ epilogue() [4/5]

template<class T>
void cereal::epilogue ( XMLOutputArchive & ,
SizeTag< T > const &  )
inline

Epilogue for SizeTags for XML output archives.

SizeTags do not start or finish nodes

◆ epilogue() [5/5]

template<class T, traits::DisableIf< traits::has_minimal_base_class_serialization< T, traits::has_minimal_output_serialization, XMLOutputArchive >::value||traits::has_minimal_output_serialization< T, XMLOutputArchive >::value > = traits::sfinae>
void cereal::epilogue ( XMLOutputArchive & ar,
T const &  )
inline

Epilogue for all other types other for XML output archives (except minimal types).

Finishes the node created in the prologue

Minimal types do not start or end nodes

◆ prologue() [1/4]

template<class T>
void cereal::prologue ( XMLOutputArchive & ,
DeferredData< T > const &  )
inline

Prologue for deferred data for XML archives.

Do nothing for the defer wrapper

◆ prologue() [2/4]

template<class T>
void cereal::prologue ( XMLOutputArchive & ,
NameValuePair< T > const &  )
inline

Prologue for NVPs for XML output archives.

NVPs do not start or finish nodes - they just set up the names

◆ prologue() [3/4]

template<class T>
void cereal::prologue ( XMLOutputArchive & ar,
SizeTag< T > const &  )
inline

Prologue for SizeTags for XML output archives.

SizeTags do not start or finish nodes

◆ prologue() [4/4]

template<class T, traits::DisableIf< traits::has_minimal_base_class_serialization< T, traits::has_minimal_output_serialization, XMLOutputArchive >::value||traits::has_minimal_output_serialization< T, XMLOutputArchive >::value > = traits::sfinae>
void cereal::prologue ( XMLOutputArchive & ar,
T const &  )
inline

Prologue for all other types for XML output archives (except minimal types).

Starts a new node, named either automatically or by some NVP, that may be given data by the type about to be archived

Minimal types do not start or end nodes