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 () const
 
void endSection () const
 
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< Derived >
template<typename Base , typename T >
void serializeBase (T &t)
 Is this archive a loader or a saver.
 
template<typename Base , typename T >
void serializeInlinedBase (T &t, unsigned version)
 Serialize the base class of this classtype.
 
template<typename T >
void serialize_blob (const char *tag, std::span< T > data, bool diff=true)
 
template<typename T >
void serialize_blob (const char *tag, std::span< const T > data, bool diff=true)
 
bool isReverseSnapshot () const
 Is this a reverse-snapshot?
 
template<typename T >
void attribute (const char *name, T &t)
 Load/store an attribute from/in the archive.
 
void attribute (const char *name, const char *value)
 
bool hasAttribute (const char *) const
 Check the presence of a (optional) attribute.
 
template<typename T >
std::optional< T > findAttributeAs (const char *)
 Optimization: combination of hasAttribute() and getAttribute().
 
int countChildren () const
 Count the number of child tags.
 
void beginTag (const char *) const
 Indicate begin of a tag.
 
void endTag (const char *) const
 Indicate begin of a tag.
 
- Public Member Functions inherited from openmsx::OutputArchiveBase2
bool versionAtLeast (unsigned, unsigned) const
 
bool versionBelow (unsigned, unsigned) const
 
void skipSection (bool) const
 
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< Derived >
static constexpr bool NEED_VERSION = true
 Does this archive store version information.
 
static constexpr bool TRANSLATE_ENUM_TO_STRING = false
 Does this archive store enums as strings.
 
static constexpr bool CAN_HAVE_OPTIONAL_ATTRIBUTES = false
 Some archives (like XML archives) can store optional attributes.
 
static constexpr bool CAN_COUNT_CHILDREN = false
 Some archives (like XML archives) can count the number of subtags that belong to the current tag.
 
- 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< Derived >
Derived & self ()
 Returns a reference to the most derived class.
 
- 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

◆ ~XmlOutputArchive()

openmsx::XmlOutputArchive::~XmlOutputArchive ( )

Definition at line 297 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 375 of file serialize.cc.

References attributeImpl().

◆ attribute() [3/4]

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

Definition at line 371 of file serialize.cc.

◆ attribute() [4/4]

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

Definition at line 379 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(), attribute(), and attribute().

◆ beginSection()

void openmsx::XmlOutputArchive::beginSection ( ) const
inline

Definition at line 884 of file serialize.hh.

◆ beginTag()

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

Definition at line 384 of file serialize.cc.

◆ check()

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

Definition at line 320 of file serialize.cc.

◆ close()

void openmsx::XmlOutputArchive::close ( )

Definition at line 285 of file serialize.cc.

References error().

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

◆ endSection()

void openmsx::XmlOutputArchive::endSection ( ) const
inline

Definition at line 885 of file serialize.hh.

◆ endTag()

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

Definition at line 388 of file serialize.cc.

◆ error()

void openmsx::XmlOutputArchive::error ( )

Definition at line 325 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 342 of file serialize.cc.

◆ save() [2/9]

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

Definition at line 354 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(), save(), save(), and saveImpl().

◆ save() [4/9]

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

Definition at line 358 of file serialize.cc.

References saveImpl().

◆ save() [5/9]

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

Definition at line 350 of file serialize.cc.

References save().

◆ save() [6/9]

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

Definition at line 338 of file serialize.cc.

◆ save() [7/9]

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

Definition at line 346 of file serialize.cc.

References save().

◆ save() [8/9]

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

Definition at line 366 of file serialize.cc.

References saveImpl().

◆ save() [9/9]

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

Definition at line 362 of file serialize.cc.

References saveImpl().

◆ saveChar()

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

Definition at line 334 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(), save(), save(), and save().

◆ serialize()

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

Definition at line 891 of file serialize.hh.

References openmsx::ArchiveBase< Derived >::self(), and t.

Referenced by openmsx::StoreMachineCommand::execute().

◆ write()

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

Definition at line 306 of file serialize.cc.

References error().

Referenced by XmlOutputArchive().

◆ write1()

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

Definition at line 313 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: