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 (const char *buf, size_t len)
 
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, const void *data, size_t len, 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. More...
 
template<typename Base , typename T >
void serializeInlinedBase (T &t, unsigned version)
 Serialize the base class of this classtype. More...
 
bool isReverseSnapshot () const
 Is this a reverse-snapshot? More...
 
template<typename T >
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...
 
bool findAttribute (const char *, unsigned &)
 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< Derived >
static constexpr bool NEED_VERSION = true
 Does this archive store version information. More...
 
static constexpr bool TRANSLATE_ENUM_TO_STRING = false
 Does this archive store enums as strings. More...
 
static constexpr bool CAN_HAVE_OPTIONAL_ATTRIBUTES = false
 Some archives (like XML archives) can store optional attributes. More...
 
static constexpr bool CAN_COUNT_CHILDREN = false
 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< Derived >
Derived & self ()
 Returns a reference to the most derived class. More...
 
- Protected Member Functions inherited from openmsx::OutputArchiveBase2
 OutputArchiveBase2 ()=default
 

Detailed Description

Definition at line 842 of file serialize.hh.

Constructor & Destructor Documentation

◆ XmlOutputArchive()

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

Definition at line 259 of file serialize.cc.

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

◆ ~XmlOutputArchive()

openmsx::XmlOutputArchive::~XmlOutputArchive ( )

Definition at line 300 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 897 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 378 of file serialize.cc.

References attributeImpl().

◆ attribute() [3/4]

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

Definition at line 374 of file serialize.cc.

◆ attribute() [4/4]

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

Definition at line 382 of file serialize.cc.

References attributeImpl().

◆ attributeImpl()

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

Definition at line 893 of file serialize.hh.

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

Referenced by attribute().

◆ beginSection()

void openmsx::XmlOutputArchive::beginSection ( )
inline

Definition at line 869 of file serialize.hh.

◆ beginTag()

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

Definition at line 387 of file serialize.cc.

◆ check()

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

Definition at line 323 of file serialize.cc.

◆ close()

void openmsx::XmlOutputArchive::close ( )

Definition at line 288 of file serialize.cc.

References error().

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

◆ endSection()

void openmsx::XmlOutputArchive::endSection ( )
inline

Definition at line 870 of file serialize.hh.

◆ endTag()

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

Definition at line 391 of file serialize.cc.

◆ error()

void openmsx::XmlOutputArchive::error ( )

Definition at line 328 of file serialize.cc.

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

◆ getXMLOutputStream()

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

Definition at line 883 of file serialize.hh.

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

◆ save() [1/9]

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

Definition at line 345 of file serialize.cc.

◆ save() [2/9]

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

Definition at line 357 of file serialize.cc.

References save().

◆ save() [3/9]

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

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

References saveImpl().

◆ save() [5/9]

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

Definition at line 353 of file serialize.cc.

References save().

◆ save() [6/9]

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

Definition at line 341 of file serialize.cc.

◆ save() [7/9]

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

Definition at line 349 of file serialize.cc.

References save().

◆ save() [8/9]

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

Definition at line 369 of file serialize.cc.

References saveImpl().

◆ save() [9/9]

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

Definition at line 365 of file serialize.cc.

References saveImpl().

◆ saveChar()

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

Definition at line 337 of file serialize.cc.

◆ saveImpl()

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

Definition at line 849 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

Definition at line 876 of file serialize.hh.

References t.

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

◆ write()

void openmsx::XmlOutputArchive::write ( const char *  buf,
size_t  len 
)

Definition at line 309 of file serialize.cc.

References error().

◆ write1()

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

Definition at line 316 of file serialize.cc.

References error().

Member Data Documentation

◆ CAN_COUNT_CHILDREN

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

Definition at line 888 of file serialize.hh.

◆ CAN_HAVE_OPTIONAL_ATTRIBUTES

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

Definition at line 887 of file serialize.hh.

◆ TRANSLATE_ENUM_TO_STRING

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

Definition at line 886 of file serialize.hh.


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