openMSX
Public Types | Public Member Functions | Static Public Member Functions | List of all members
openmsx::XMLElement Class Reference

#include <XMLElement.hh>

Public Types

typedef std::vector< XMLElementChildren

Public Member Functions

 XMLElement ()
 XMLElement (string_ref name)
 XMLElement (string_ref name, string_ref data)
const std::string & getName () const
void setName (string_ref name)
void clearName ()
const std::string & getData () const
void setData (string_ref data)
void addAttribute (string_ref name, string_ref value)
void setAttribute (string_ref name, string_ref value)
void removeAttribute (string_ref name)
XMLElementaddChild (XMLElement child)
void removeChild (const XMLElement &child)
const ChildrengetChildren () const
bool hasChildren () const
bool getDataAsBool () const
int getDataAsInt () const
double getDataAsDouble () const
bool hasAttribute (string_ref name) const
const std::string & getAttribute (string_ref attName) const
string_ref getAttribute (string_ref attName, string_ref defaultValue) const
bool getAttributeAsBool (string_ref attName, bool defaultValue=false) const
int getAttributeAsInt (string_ref attName, int defaultValue=0) const
bool findAttributeInt (string_ref attName, unsigned &result) const
const XMLElementfindChild (string_ref name) const
XMLElementfindChild (string_ref name)
const XMLElementgetChild (string_ref name) const
XMLElementgetChild (string_ref name)
const XMLElementfindChildWithAttribute (string_ref name, string_ref attName, string_ref attValue) const
XMLElementfindChildWithAttribute (string_ref name, string_ref attName, string_ref attValue)
const XMLElementfindNextChild (string_ref name, size_t &fromIndex) const
std::vector< const XMLElement * > getChildren (string_ref name) const
XMLElementgetCreateChild (string_ref name, string_ref defaultValue="")
XMLElementgetCreateChildWithAttribute (string_ref name, string_ref attName, string_ref attValue)
const std::string & getChildData (string_ref name) const
string_ref getChildData (string_ref name, string_ref defaultValue) const
bool getChildDataAsBool (string_ref name, bool defaultValue=false) const
int getChildDataAsInt (string_ref name, int defaultValue=0) const
void setChildData (string_ref name, string_ref value)
void removeAllChildren ()
std::string dump () const
template<typename Archive >
void serialize (Archive &ar, unsigned version)

Static Public Member Functions

static std::string XMLEscape (const std::string &str)
static std::unique_ptr
< FileContext
getLastSerializedFileContext ()

Detailed Description

Definition at line 17 of file XMLElement.hh.

Member Typedef Documentation

Definition at line 45 of file XMLElement.hh.

Constructor & Destructor Documentation

openmsx::XMLElement::XMLElement ( )
inline

Definition at line 26 of file XMLElement.hh.

Referenced by getCreateChild(), getCreateChildWithAttribute(), and setChildData().

openmsx::XMLElement::XMLElement ( string_ref  name)
explicit

Definition at line 18 of file XMLElement.cc.

openmsx::XMLElement::XMLElement ( string_ref  name,
string_ref  data 
)

Definition at line 23 of file XMLElement.cc.

Member Function Documentation

void openmsx::XMLElement::addAttribute ( string_ref  name,
string_ref  value 
)
XMLElement & openmsx::XMLElement::addChild ( XMLElement  child)
void openmsx::XMLElement::clearName ( )

Definition at line 108 of file XMLElement.cc.

References string_ref::clear().

Referenced by openmsx::XmlInputArchive::endTag().

string openmsx::XMLElement::dump ( ) const
bool openmsx::XMLElement::findAttributeInt ( string_ref  attName,
unsigned &  result 
) const

Definition at line 291 of file XMLElement.cc.

References StringOp::stringToInt().

const XMLElement * openmsx::XMLElement::findChild ( string_ref  name) const
XMLElement * openmsx::XMLElement::findChild ( string_ref  name)

Definition at line 130 of file XMLElement.cc.

const XMLElement * openmsx::XMLElement::findChildWithAttribute ( string_ref  name,
string_ref  attName,
string_ref  attValue 
) const

Definition at line 174 of file XMLElement.cc.

Referenced by getCreateChildWithAttribute(), and openmsx::SettingImplBase::init().

XMLElement * openmsx::XMLElement::findChildWithAttribute ( string_ref  name,
string_ref  attName,
string_ref  attValue 
)

Definition at line 162 of file XMLElement.cc.

const XMLElement * openmsx::XMLElement::findNextChild ( string_ref  name,
size_t &  fromIndex 
) const

Definition at line 144 of file XMLElement.cc.

References getName(), and xrange().

const string & openmsx::XMLElement::getAttribute ( string_ref  attName) const

Definition at line 258 of file XMLElement.cc.

Referenced by openmsx::DeviceConfig::getAttribute().

string_ref openmsx::XMLElement::getAttribute ( string_ref  attName,
string_ref  defaultValue 
) const

Definition at line 268 of file XMLElement.cc.

bool openmsx::XMLElement::getAttributeAsBool ( string_ref  attName,
bool  defaultValue = false 
) const

Definition at line 275 of file XMLElement.cc.

References StringOp::stringToBool().

int openmsx::XMLElement::getAttributeAsInt ( string_ref  attName,
int  defaultValue = 0 
) const

Definition at line 283 of file XMLElement.cc.

References StringOp::stringToInt().

Referenced by openmsx::DeviceConfig::getAttributeAsInt().

const XMLElement & openmsx::XMLElement::getChild ( string_ref  name) const
XMLElement & openmsx::XMLElement::getChild ( string_ref  name)

Definition at line 181 of file XMLElement.cc.

References findChild().

const string & openmsx::XMLElement::getChildData ( string_ref  name) const
string_ref openmsx::XMLElement::getChildData ( string_ref  name,
string_ref  defaultValue 
) const

Definition at line 220 of file XMLElement.cc.

References findChild().

bool openmsx::XMLElement::getChildDataAsBool ( string_ref  name,
bool  defaultValue = false 
) const

Definition at line 227 of file XMLElement.cc.

References findChild(), and StringOp::stringToBool().

Referenced by openmsx::DeviceConfig::getChildDataAsBool().

int openmsx::XMLElement::getChildDataAsInt ( string_ref  name,
int  defaultValue = 0 
) const
const Children& openmsx::XMLElement::getChildren ( ) const
inline
std::vector< const XMLElement * > openmsx::XMLElement::getChildren ( string_ref  name) const

Definition at line 119 of file XMLElement.cc.

XMLElement & openmsx::XMLElement::getCreateChild ( string_ref  name,
string_ref  defaultValue = "" 
)

Definition at line 194 of file XMLElement.cc.

References addChild(), findChild(), and XMLElement().

Referenced by openmsx::HotKey::saveBindings(), and openmsx::Setting::sync().

XMLElement & openmsx::XMLElement::getCreateChildWithAttribute ( string_ref  name,
string_ref  attName,
string_ref  attValue 
)

Definition at line 203 of file XMLElement.cc.

References addChild(), findChildWithAttribute(), and XMLElement().

const std::string& openmsx::XMLElement::getData ( ) const
inline
bool openmsx::XMLElement::getDataAsBool ( ) const

Definition at line 88 of file XMLElement.cc.

References getData(), and StringOp::stringToBool().

double openmsx::XMLElement::getDataAsDouble ( ) const

Definition at line 98 of file XMLElement.cc.

References getData(), and StringOp::stringToDouble().

int openmsx::XMLElement::getDataAsInt ( ) const

Definition at line 93 of file XMLElement.cc.

References getData(), and StringOp::stringToInt().

unique_ptr< FileContext > openmsx::XMLElement::getLastSerializedFileContext ( )
static

Definition at line 344 of file XMLElement.cc.

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

const std::string& openmsx::XMLElement::getName ( ) const
inline
bool openmsx::XMLElement::hasAttribute ( string_ref  name) const

Definition at line 253 of file XMLElement.cc.

bool openmsx::XMLElement::hasChildren ( ) const
inline

Definition at line 49 of file XMLElement.hh.

void openmsx::XMLElement::removeAllChildren ( )

Definition at line 248 of file XMLElement.cc.

Referenced by openmsx::HotKey::saveBindings().

void openmsx::XMLElement::removeAttribute ( string_ref  name)

Definition at line 80 of file XMLElement.cc.

void openmsx::XMLElement::removeChild ( const XMLElement child)

Definition at line 43 of file XMLElement.cc.

Referenced by openmsx::Setting::sync().

template<typename Archive >
void openmsx::XMLElement::serialize ( Archive &  ar,
unsigned  version 
)

Definition at line 361 of file XMLElement.cc.

void openmsx::XMLElement::setAttribute ( string_ref  name,
string_ref  value 
)

Definition at line 70 of file XMLElement.cc.

References string_ref::str().

Referenced by openmsx::HardwareConfig::parseSlots().

void openmsx::XMLElement::setChildData ( string_ref  name,
string_ref  value 
)

Definition at line 239 of file XMLElement.cc.

References addChild(), findChild(), and XMLElement().

Referenced by openmsx::RomFactory::create().

void openmsx::XMLElement::setData ( string_ref  data)

Definition at line 113 of file XMLElement.cc.

References string_ref::str().

void openmsx::XMLElement::setName ( string_ref  name)

Definition at line 103 of file XMLElement.cc.

References string_ref::str().

Referenced by openmsx::HardwareConfig::createRomConfig().

string openmsx::XMLElement::XMLEscape ( const std::string &  str)
static

Definition at line 334 of file XMLElement.cc.


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