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
 
template<typename T >
void load (T &t)
 
void loadChar (char &c)
 
void load (bool &b)
 
void load (unsigned char &b)
 
void load (signed char &c)
 
void load (char &c)
 
void load (int &i)
 
void load (unsigned &u)
 
void load (unsigned long long &ull)
 
void load (std::string &t)
 
std::string_view loadStr ()
 
void skipSection (bool)
 
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)
 
template<typename T >
void attribute (const char *name, T &t)
 
void attribute (const char *name, std::string &t)
 
void attribute (const char *name, int &i)
 
void attribute (const char *name, unsigned &u)
 
bool hasAttribute (const char *name)
 
bool findAttribute (const char *name, unsigned &value)
 
int countChildren () const
 
- Public Member Functions inherited from openmsx::InputArchiveBase< XmlInputArchive >
void serializeWithID (const char *tag, T &t, Args... args)
 
void serialize_blob (const char *tag, void *data, size_t len, 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. 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::InputArchiveBase2
void beginSection ()
 
void endSection ()
 
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. 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::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. More...
 
- Protected Member Functions inherited from openmsx::InputArchiveBase2
 InputArchiveBase2 ()=default
 

Detailed Description

Definition at line 917 of file serialize.hh.

Constructor & Destructor Documentation

◆ XmlInputArchive()

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

Member Function Documentation

◆ attribute() [1/4]

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

Definition at line 555 of file serialize.cc.

References attributeImpl().

◆ attribute() [2/4]

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

Definition at line 547 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 981 of file serialize.hh.

References attributeImpl(), and t.

Referenced by attributeImpl().

◆ attribute() [4/4]

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

Definition at line 559 of file serialize.cc.

References attributeImpl().

◆ attributeImpl()

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

Definition at line 974 of file serialize.hh.

References attribute(), and t.

Referenced by attribute().

◆ beginTag()

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

Definition at line 522 of file serialize.cc.

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

◆ countChildren()

int openmsx::XmlInputArchive::countChildren ( ) const

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

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

◆ findAttribute()

bool openmsx::XmlInputArchive::findAttribute ( const char *  name,
unsigned &  value 
)

Definition at line 567 of file serialize.cc.

References currentElement().

Referenced by openmsx::loadVersionHelper().

◆ hasAttribute()

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

Definition at line 563 of file serialize.cc.

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

◆ load() [1/9]

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

Definition at line 423 of file serialize.cc.

References loadStr().

◆ load() [2/9]

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

Definition at line 515 of file serialize.cc.

References load().

◆ load() [3/9]

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

Definition at line 488 of file serialize.cc.

References loadStr().

◆ load() [4/9]

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

Definition at line 509 of file serialize.cc.

References load().

◆ load() [5/9]

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

Definition at line 412 of file serialize.cc.

References loadStr(), and t.

◆ load() [6/9]

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

Definition at line 931 of file serialize.hh.

References t.

Referenced by load(), and loadChar().

◆ load() [7/9]

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

Definition at line 493 of file serialize.cc.

References loadStr().

◆ load() [8/9]

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

Definition at line 503 of file serialize.cc.

References load().

◆ load() [9/9]

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

Definition at line 498 of file serialize.cc.

References loadStr().

◆ loadChar()

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

Definition at line 416 of file serialize.cc.

References load().

◆ loadStr()

string_view openmsx::XmlInputArchive::loadStr ( )

Definition at line 405 of file serialize.cc.

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

Referenced by load().

◆ serialize()

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

Definition at line 955 of file serialize.hh.

References t.

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

◆ skipSection()

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

Definition at line 949 of file serialize.hh.

◆ versionAtLeast()

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

Definition at line 922 of file serialize.hh.

◆ versionBelow()

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

Definition at line 926 of file serialize.hh.

Member Data Documentation

◆ CAN_COUNT_CHILDREN

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

Definition at line 969 of file serialize.hh.

◆ CAN_HAVE_OPTIONAL_ATTRIBUTES

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

Definition at line 968 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 967 of file serialize.hh.


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