openMSX
Public Member Functions | Static Public Attributes | List of all members
openmsx::XmlOutputArchive Class Referencefinal

#include <serialize.hh>

Inheritance diagram for openmsx::XmlOutputArchive:
Inheritance graph
[legend]
Collaboration diagram for openmsx::XmlOutputArchive:
Collaboration graph
[legend]

Public Member Functions

 XmlOutputArchive (zstring_view filename)
 
void close ()
 
 ~XmlOutputArchive ()
 
template<typename T >
void saveImpl (const T &t)
 
template<typename T >
void save (const T &t)
 
void saveChar (char c)
 
void save (std::string_view str)
 
void save (bool b)
 
void save (unsigned char b)
 
void save (signed char c)
 
void save (char c)
 
void save (int i)
 
void save (unsigned u)
 
void save (unsigned long long ull)
 
void beginSection ()
 
void endSection ()
 
template<typename T , typename ... Args>
ALWAYS_INLINE void serialize (const char *tag, const T &t, Args &&...args)
 
auto & getXMLOutputStream ()
 
void beginTag (const char *tag)
 
void endTag (const char *tag)
 
template<typename T >
void attributeImpl (const char *name, const T &t)
 
template<typename T >
void attribute (const char *name, const T &t)
 
void attribute (const char *name, std::string_view str)
 
void attribute (const char *name, int i)
 
void attribute (const char *name, unsigned u)
 
void write (std::span< const char > buf)
 
void write1 (char c)
 
void check (bool condition) const
 
void error ()
 
- Public Member Functions inherited from openmsx::OutputArchiveBase< XmlOutputArchive >
void serializeInlinedBase (T &t, unsigned version)
 
void serializeWithID (const char *tag, const T &t, Args...)
 
void serialize_blob (const char *tag, std::span< const uint8_t > data, bool diff=true)
 
void serialize (const char *tag, const T &t)
 
void serializePointerID (const char *tag, const T &t)
 
void serializePolymorphic (const char *tag, const T &t)
 
void serializeOnlyOnce (const char *tag, const T &t)
 
void serializeChar (const char *tag, char c)
 
- Public Member Functions inherited from openmsx::ArchiveBase< XmlOutputArchive >
void serializeBase (T &t)
 Is this archive a loader or a saver. More...
 
void serializeInlinedBase (T &t, unsigned version)
 Serialize the base class of this classtype. More...
 
void serialize_blob (const char *tag, std::span< T > data, bool diff=true)
 
void serialize_blob (const char *tag, std::span< const T > data, bool diff=true)
 
bool isReverseSnapshot () const
 Is this a reverse-snapshot? More...
 
void attribute (const char *name, T &t)
 Load/store an attribute from/in the archive. More...
 
void attribute (const char *name, const char *value)
 
bool hasAttribute (const char *)
 Check the presence of a (optional) attribute. More...
 
std::optional< T > findAttributeAs (const char *)
 Optimization: combination of hasAttribute() and getAttribute(). More...
 
int countChildren () const
 Count the number of child tags. More...
 
void beginTag (const char *)
 Indicate begin of a tag. More...
 
void endTag (const char *)
 Indicate begin of a tag. More...
 
- Public Member Functions inherited from openmsx::OutputArchiveBase2
bool versionAtLeast (unsigned, unsigned) const
 
bool versionBelow (unsigned, unsigned) const
 
void skipSection (bool)
 
template<typename T >
unsigned generateId (const T *p)
 
template<typename T >
unsigned getId (const T *p)
 

Static Public Attributes

static constexpr bool TRANSLATE_ENUM_TO_STRING = true
 
static constexpr bool CAN_HAVE_OPTIONAL_ATTRIBUTES = true
 
static constexpr bool CAN_COUNT_CHILDREN = true
 
- Static Public Attributes inherited from openmsx::ArchiveBase< XmlOutputArchive >
static constexpr bool NEED_VERSION
 Does this archive store version information. More...
 
static constexpr bool TRANSLATE_ENUM_TO_STRING
 Does this archive store enums as strings. More...
 
static constexpr bool CAN_HAVE_OPTIONAL_ATTRIBUTES
 Some archives (like XML archives) can store optional attributes. More...
 
static constexpr bool CAN_COUNT_CHILDREN
 Some archives (like XML archives) can count the number of subtags that belong to the current tag. More...
 
- Static Public Attributes inherited from openmsx::OutputArchiveBase2
static constexpr bool IS_LOADER = false
 

Additional Inherited Members

- Protected Member Functions inherited from openmsx::OutputArchiveBase< XmlOutputArchive >
 OutputArchiveBase ()=default
 
- Protected Member Functions inherited from openmsx::ArchiveBase< XmlOutputArchive >
XmlOutputArchiveself ()
 Returns a reference to the most derived class. More...
 
- Protected Member Functions inherited from openmsx::OutputArchiveBase2
 OutputArchiveBase2 ()=default
 

Detailed Description

Definition at line 857 of file serialize.hh.

Constructor & Destructor Documentation

◆ XmlOutputArchive()

openmsx::XmlOutputArchive::XmlOutputArchive ( zstring_view  filename)
explicit

Definition at line 255 of file serialize.cc.

References close(), error(), and openmsx::FileOperations::openFile().

◆ ~XmlOutputArchive()

openmsx::XmlOutputArchive::~XmlOutputArchive ( )

Definition at line 296 of file serialize.cc.

References close().

Member Function Documentation

◆ attribute() [1/4]

template<typename T >
void openmsx::XmlOutputArchive::attribute ( const char *  name,
const T &  t 
)
inline

Definition at line 912 of file serialize.hh.

References attributeImpl(), and t.

Referenced by attributeImpl().

◆ attribute() [2/4]

void openmsx::XmlOutputArchive::attribute ( const char *  name,
int  i 
)

Definition at line 374 of file serialize.cc.

References attributeImpl().

◆ attribute() [3/4]

void openmsx::XmlOutputArchive::attribute ( const char *  name,
std::string_view  str 
)

Definition at line 370 of file serialize.cc.

◆ attribute() [4/4]

void openmsx::XmlOutputArchive::attribute ( const char *  name,
unsigned  u 
)

Definition at line 378 of file serialize.cc.

References attributeImpl().

◆ attributeImpl()

template<typename T >
void openmsx::XmlOutputArchive::attributeImpl ( const char *  name,
const T &  t 
)
inline

Definition at line 908 of file serialize.hh.

References attribute(), t, and tmpStrCat().

Referenced by attribute().

◆ beginSection()

void openmsx::XmlOutputArchive::beginSection ( )
inline

Definition at line 884 of file serialize.hh.

◆ beginTag()

void openmsx::XmlOutputArchive::beginTag ( const char *  tag)

Definition at line 383 of file serialize.cc.

◆ check()

void openmsx::XmlOutputArchive::check ( bool  condition) const

Definition at line 319 of file serialize.cc.

◆ close()

void openmsx::XmlOutputArchive::close ( )

Definition at line 284 of file serialize.cc.

References error().

Referenced by openmsx::StoreMachineCommand::execute(), XmlOutputArchive(), and ~XmlOutputArchive().

◆ endSection()

void openmsx::XmlOutputArchive::endSection ( )
inline

Definition at line 885 of file serialize.hh.

◆ endTag()

void openmsx::XmlOutputArchive::endTag ( const char *  tag)

Definition at line 387 of file serialize.cc.

◆ error()

void openmsx::XmlOutputArchive::error ( )

Definition at line 324 of file serialize.cc.

Referenced by close(), write(), write1(), and XmlOutputArchive().

◆ getXMLOutputStream()

auto & openmsx::XmlOutputArchive::getXMLOutputStream ( )
inline

Definition at line 898 of file serialize.hh.

Referenced by openmsx::XMLDocument::serialize().

◆ save() [1/9]

void openmsx::XmlOutputArchive::save ( bool  b)

Definition at line 341 of file serialize.cc.

◆ save() [2/9]

void openmsx::XmlOutputArchive::save ( char  c)

Definition at line 353 of file serialize.cc.

References save().

◆ save() [3/9]

template<typename T >
void openmsx::XmlOutputArchive::save ( const T &  t)
inline

Definition at line 870 of file serialize.hh.

References saveImpl(), and t.

Referenced by save(), and saveImpl().

◆ save() [4/9]

void openmsx::XmlOutputArchive::save ( int  i)

Definition at line 357 of file serialize.cc.

References saveImpl().

◆ save() [5/9]

void openmsx::XmlOutputArchive::save ( signed char  c)

Definition at line 349 of file serialize.cc.

References save().

◆ save() [6/9]

void openmsx::XmlOutputArchive::save ( std::string_view  str)

Definition at line 337 of file serialize.cc.

◆ save() [7/9]

void openmsx::XmlOutputArchive::save ( unsigned char  b)

Definition at line 345 of file serialize.cc.

References save().

◆ save() [8/9]

void openmsx::XmlOutputArchive::save ( unsigned long long  ull)

Definition at line 365 of file serialize.cc.

References saveImpl().

◆ save() [9/9]

void openmsx::XmlOutputArchive::save ( unsigned  u)

Definition at line 361 of file serialize.cc.

References saveImpl().

◆ saveChar()

void openmsx::XmlOutputArchive::saveChar ( char  c)

Definition at line 333 of file serialize.cc.

◆ saveImpl()

template<typename T >
void openmsx::XmlOutputArchive::saveImpl ( const T &  t)
inline

Definition at line 864 of file serialize.hh.

References save(), t, and tmpStrCat().

Referenced by save().

◆ serialize()

template<typename T , typename ... Args>
ALWAYS_INLINE void openmsx::XmlOutputArchive::serialize ( const char *  tag,
const T &  t,
Args &&...  args 
)
inline

◆ write()

void openmsx::XmlOutputArchive::write ( std::span< const char >  buf)

Definition at line 305 of file serialize.cc.

References error().

◆ write1()

void openmsx::XmlOutputArchive::write1 ( char  c)

Definition at line 312 of file serialize.cc.

References error().

Member Data Documentation

◆ CAN_COUNT_CHILDREN

constexpr bool openmsx::XmlOutputArchive::CAN_COUNT_CHILDREN = true
staticconstexpr

Definition at line 903 of file serialize.hh.

◆ CAN_HAVE_OPTIONAL_ATTRIBUTES

constexpr bool openmsx::XmlOutputArchive::CAN_HAVE_OPTIONAL_ATTRIBUTES = true
staticconstexpr

Definition at line 902 of file serialize.hh.

◆ TRANSLATE_ENUM_TO_STRING

constexpr bool openmsx::XmlOutputArchive::TRANSLATE_ENUM_TO_STRING = true
staticconstexpr

Definition at line 901 of file serialize.hh.


The documentation for this class was generated from the following files: