|
|
Common use cases for directly interacting with an XMLOutputArchive
|
| XMLOutputArchive (std::ostream &stream, Options const &options=Options::Default()) |
| Construct, outputting to the provided stream upon destruction. More...
|
|
| ~XMLOutputArchive () CEREAL_NOEXCEPT |
| Destructor, flushes the XML. More...
|
|
void | saveBinaryValue (const void *data, size_t size, const char *name=nullptr) |
| Saves some binary data, encoded as a base64 string, with an optional name. More...
|
|
|
Functionality designed for use by those requiring control over the inner mechanisms of the XMLOutputArchive
|
void | startNode () |
| Creates a new node that is a child of the node at the top of the stack. More...
|
|
void | finishNode () |
| Designates the most recently added node as finished. More...
|
|
void | setNextName (const char *name) |
| Sets the name for the next node created with startNode. More...
|
|
template<class T > |
void | saveValue (T const &value) |
| Saves some data, encoded as a string, into the current top level node. More...
|
|
void | saveValue (uint8_t const &value) |
| Overload for uint8_t prevents them from being serialized as characters. More...
|
|
void | saveValue (int8_t const &value) |
| Overload for int8_t prevents them from being serialized as characters. More...
|
|
template<class T > |
void | insertType () |
| Causes the type to be appended as an attribute to the most recently made node if output type is set to true. More...
|
|
void | appendAttribute (const char *name, const char *value) |
| Appends an attribute to the current top level node. More...
|
|
bool | hasSizeAttributes () const |
|
| OutputArchive (XMLOutputArchive *const derived) |
| Construct the output archive. More...
|
|
OutputArchive & | operator= (OutputArchive const &)=delete |
|
XMLOutputArchive & | operator() (Types &&... args) |
| Serializes all passed in data. More...
|
|
void | serializeDeferments () |
| Serializes any data marked for deferment using defer. More...
|
|
std::uint32_t | registerSharedPointer (const std::shared_ptr< const void > &sharedPointer) |
| Registers a shared pointer with the archive. More...
|
|
std::uint32_t | registerPolymorphicType (char const *name) |
| Registers a polymorphic type name with the archive. More...
|
|
XMLOutputArchive & | operator& (T &&arg) |
| Serializes passed in data. More...
|
|
XMLOutputArchive & | operator<< (T &&arg) |
| Serializes passed in data. More...
|
|
| OutputArchiveBase ()=default |
|
| OutputArchiveBase (OutputArchiveBase &&) CEREAL_NOEXCEPT |
|
OutputArchiveBase & | operator= (OutputArchiveBase &&) CEREAL_NOEXCEPT |
|
virtual | ~OutputArchiveBase () CEREAL_NOEXCEPT=default |
|
An output archive designed to save data to XML.
This archive uses RapidXML to build an in memory XML tree of the data it serializes before outputting it to its stream upon destruction. This archive should be used in an RAII fashion, letting the automatic destruction of the object cause the flush to its stream.
XML archives provides a human readable output but at decreased performance (both in time and space) compared to binary archives.
XML benefits greatly from name-value pairs, which if present, will name the nodes in the output. If these are not present, each level of the output tree will be given an automatically generated delimited name.
The precision of the output archive controls the number of decimals output for floating point numbers and should be sufficiently large (i.e. at least 20) if there is a desire to have binary equality between the numbers output and those read in. In general you should expect a loss of precision when going from floating point to text and back.
XML archives can optionally print the type of everything they serialize, which adds an attribute to each node.
XML archives do not output the size information for any dynamically sized structure and instead infer it from the number of children for a node. This means that data can be hand edited for dynamic sized structures and will still be readable. This is accomplished through the cereal::SizeTag object, which will also add an attribute to its parent field.