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

#include <serialize.hh>

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

Public Member Functions

 XmlInputArchive (const std::string &filename)
 
bool versionAtLeast (unsigned actual, unsigned required) const
 
bool versionBelow (unsigned actual, unsigned required) const
 
void loadChar (char &c) const
 
void load (bool &b) const
 
void load (unsigned char &b) const
 
void load (signed char &c) const
 
void load (char &c) const
 
void load (int &i) const
 
void load (unsigned &u) const
 
void load (unsigned long long &ull) const
 
void load (std::string &t) const
 
template<typename T >
void load (T &t) const
 
std::string_view loadStr () const
 
void skipSection (bool) const
 
template<typename T , typename ... Args>
ALWAYS_INLINE void serialize (const char *tag, T &t, Args &&...args)
 
const XMLElementcurrentElement () const
 
void beginTag (const char *tag)
 
void endTag (const char *tag)
 
template<typename T >
void attributeImpl (const char *name, T &t) const
 
template<typename T >
void attribute (const char *name, T &t)
 
void attribute (const char *name, std::string &t) const
 
void attribute (const char *name, int &i) const
 
void attribute (const char *name, unsigned &u) const
 
bool hasAttribute (const char *name) const
 
int countChildren () const
 
template<typename T >
std::optional< T > findAttributeAs (const char *name)
 
- Public Member Functions inherited from openmsx::InputArchiveBase< XmlInputArchive >
void serializeWithID (const char *tag, T &t, Args... args)
 
void serialize_blob (const char *tag, std::span< uint8_t > data, bool diff=true)
 
void serialize (const char *tag, T &t)
 
void serializePointerID (const char *tag, const T &t)
 
void serializePolymorphic (const char *tag, T &t)
 
void serializeOnlyOnce (const char *tag, const T &t)
 
void serializeChar (const char *tag, char &c)
 
void doSerialize (const char *tag, T &t, TUPLE args, int id=0)
 
- 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::InputArchiveBase2
void beginSection () const
 
void endSection () const
 
void * getPointer (unsigned id)
 
void addPointer (unsigned id, const void *p)
 
unsigned getId (const void *p) const
 
template<typename T >
void resetSharedPtr (std::shared_ptr< T > &s, T *r)
 

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::InputArchiveBase2
static constexpr bool IS_LOADER = true
 

Additional Inherited Members

- Protected Member Functions inherited from openmsx::InputArchiveBase< XmlInputArchive >
 InputArchiveBase ()=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::InputArchiveBase2
 InputArchiveBase2 ()=default
 

Detailed Description

Definition at line 921 of file serialize.hh.

Constructor & Destructor Documentation

◆ XmlInputArchive()

openmsx::XmlInputArchive::XmlInputArchive ( const std::string &  filename)
explicit

Definition at line 390 of file serialize.cc.

References openmsx::XMLDocument::getRoot(), and openmsx::XMLDocument::load().

Member Function Documentation

◆ attribute() [1/4]

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

Definition at line 544 of file serialize.cc.

References attributeImpl().

◆ attribute() [2/4]

void openmsx::XmlInputArchive::attribute ( const char *  name,
std::string &  t 
) const

Definition at line 536 of file serialize.cc.

References currentElement(), openmsx::XMLElement::findAttribute(), and t.

◆ attribute() [3/4]

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

Definition at line 985 of file serialize.hh.

References attributeImpl(), and t.

Referenced by attributeImpl().

◆ attribute() [4/4]

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

Definition at line 548 of file serialize.cc.

References attributeImpl().

◆ attributeImpl()

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

Definition at line 978 of file serialize.hh.

References attribute(), and t.

Referenced by attribute(), attribute(), and attribute().

◆ beginTag()

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

Definition at line 511 of file serialize.cc.

References currentElement(), openmsx::XMLElement::findChild(), and strAppend().

◆ countChildren()

int openmsx::XmlInputArchive::countChildren ( ) const

Definition at line 556 of file serialize.cc.

References currentElement().

◆ currentElement()

const XMLElement * openmsx::XmlInputArchive::currentElement ( ) const
inline

◆ endTag()

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

Definition at line 524 of file serialize.cc.

References openmsx::XMLElement::clearName(), and currentElement().

◆ findAttributeAs()

template<typename T >
std::optional< T > openmsx::XmlInputArchive::findAttributeAs ( const char *  name)
inline

Definition at line 997 of file serialize.hh.

References currentElement().

Referenced by openmsx::loadVersionHelper().

◆ hasAttribute()

bool openmsx::XmlInputArchive::hasAttribute ( const char *  name) const

Definition at line 552 of file serialize.cc.

References currentElement(), and openmsx::XMLElement::findAttribute().

◆ load() [1/9]

void openmsx::XmlInputArchive::load ( bool &  b) const

Definition at line 415 of file serialize.cc.

References loadStr().

Referenced by load(), load(), load(), load(), and loadChar().

◆ load() [2/9]

void openmsx::XmlInputArchive::load ( char &  c) const

Definition at line 504 of file serialize.cc.

References load().

◆ load() [3/9]

void openmsx::XmlInputArchive::load ( int &  i) const

Definition at line 467 of file serialize.cc.

References loadStr().

◆ load() [4/9]

void openmsx::XmlInputArchive::load ( signed char &  c) const

Definition at line 498 of file serialize.cc.

References load().

◆ load() [5/9]

void openmsx::XmlInputArchive::load ( std::string &  t) const

Definition at line 404 of file serialize.cc.

References loadStr(), and t.

◆ load() [6/9]

template<typename T >
void openmsx::XmlInputArchive::load ( T &  t) const
inline

Definition at line 944 of file serialize.hh.

References load(), and t.

◆ load() [7/9]

void openmsx::XmlInputArchive::load ( unsigned &  u) const

Definition at line 472 of file serialize.cc.

References loadStr().

◆ load() [8/9]

void openmsx::XmlInputArchive::load ( unsigned char &  b) const

Definition at line 492 of file serialize.cc.

References load().

◆ load() [9/9]

void openmsx::XmlInputArchive::load ( unsigned long long &  ull) const

Definition at line 487 of file serialize.cc.

References loadStr().

◆ loadChar()

void openmsx::XmlInputArchive::loadChar ( char &  c) const

Definition at line 408 of file serialize.cc.

References load().

◆ loadStr()

string_view openmsx::XmlInputArchive::loadStr ( ) const

Definition at line 397 of file serialize.cc.

References currentElement(), and openmsx::XMLElement::getData().

Referenced by load(), load(), load(), load(), and load().

◆ serialize()

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

◆ skipSection()

void openmsx::XmlInputArchive::skipSection ( bool  ) const
inline

Definition at line 953 of file serialize.hh.

◆ versionAtLeast()

bool openmsx::XmlInputArchive::versionAtLeast ( unsigned  actual,
unsigned  required 
) const
inline

Definition at line 926 of file serialize.hh.

Referenced by openmsx::YMF278B::serialize_bw_compat().

◆ versionBelow()

bool openmsx::XmlInputArchive::versionBelow ( unsigned  actual,
unsigned  required 
) const
inline

Definition at line 930 of file serialize.hh.

Member Data Documentation

◆ CAN_COUNT_CHILDREN

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

Definition at line 973 of file serialize.hh.

◆ CAN_HAVE_OPTIONAL_ATTRIBUTES

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

Definition at line 972 of file serialize.hh.

Referenced by openmsx::loadVersionHelper().

◆ TRANSLATE_ENUM_TO_STRING

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

Definition at line 971 of file serialize.hh.


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