decompiler
1.0.0
|
Lightweight (and incomplete) XML parser for marshaling data to and from the decompiler. More...
#include "types.h"
#include <fstream>
#include <iomanip>
#include <string>
#include <vector>
#include <map>
Classes | |
class | Attributes |
The attributes for a single XML element. More... | |
class | ContentHandler |
The SAX interface for parsing XML documents. More... | |
class | Element |
An XML element. A node in the DOM tree. More... | |
class | Document |
A complete in-memory XML document. More... | |
class | TreeHandler |
A SAX interface implementation for constructing an in-memory DOM model. More... | |
class | DocumentStorage |
A container for parsed XML documents. More... | |
struct | XmlError |
An exception thrown by the XML parser. More... | |
Typedefs | |
typedef void * | Locator |
Placeholder for a document locator object. | |
typedef vector< Element * > | List |
A list of XML elements. | |
Functions | |
int4 | xml_parse (istream &i, ContentHandler *hand, int4 dbg=0) |
Start-up the XML parser given a stream and a handler. More... | |
Document * | xml_tree (istream &i) |
Parse the given XML stream into an in-memory document. More... | |
void | xml_escape (ostream &s, const char *str) |
Send the given character array to a stream, escaping characters with special XML meaning. More... | |
void | a_v (ostream &s, const string &attr, const string &val) |
Output an XML attribute name/value pair to stream. More... | |
void | a_v_i (ostream &s, const string &attr, intb val) |
Output the given signed integer as an XML attribute value. More... | |
void | a_v_u (ostream &s, const string &attr, uintb val) |
Output the given unsigned integer as an XML attribute value. More... | |
void | a_v_b (ostream &s, const string &attr, bool val) |
Output the given boolean value as an XML attribute. More... | |
bool | xml_readbool (const string &attr) |
Read an XML attribute value as a boolean. More... | |
Lightweight (and incomplete) XML parser for marshaling data to and from the decompiler.
|
inline |
Output an XML attribute name/value pair to stream.
s | is the output stream |
attr | is the name of the attribute |
val | is the attribute value |
References xml_escape().
Referenced by AddrSpace::saveBasicAttributes(), ContextInternal::saveContext(), SleighBase::saveXml(), Comment::saveXml(), Override::saveXml(), CPoolRecord::saveXml(), HighVariable::saveXml(), Funcdata::saveXml(), SpacebaseSpace::saveXml(), Range::saveXml(), ScopeLocal::saveXml(), OverlaySpace::saveXml(), FunctionSymbol::saveXml(), ExternRefSymbol::saveXml(), TypeSpacebase::saveXml(), ScopeInternal::saveXml(), ProtoStoreInternal::saveXml(), FuncProto::saveXml(), AddrSpace::saveXmlAttributes(), JoinSpace::saveXmlAttributes(), FspecSpace::saveXmlAttributes(), Datatype::saveXmlBasic(), BlockGraph::saveXmlBody(), SleighArchitecture::saveXmlHeader(), Symbol::saveXmlHeader(), BlockCondition::saveXmlHeader(), and Datatype::saveXmlRef().
|
inline |
Output the given boolean value as an XML attribute.
s | is the output stream |
attr | is the name of the attribute |
val | is the given boolean value |
Referenced by AddrSpace::saveBasicAttributes(), SleighBase::saveXml(), StringManager::saveXml(), CPoolRecord::saveXml(), FloatFormat::saveXml(), HighVariable::saveXml(), Funcdata::saveXml(), TypeChar::saveXml(), Architecture::saveXml(), TypeUnicode::saveXml(), ScopeLocal::saveXml(), TypeFactory::saveXml(), Database::saveXml(), ProtoStoreInternal::saveXml(), FuncProto::saveXml(), Datatype::saveXmlBasic(), and Symbol::saveXmlHeader().
|
inline |
Output the given signed integer as an XML attribute value.
s | is the output stream |
attr | is the name of the attribute |
val | is the given integer value |
Referenced by AddrSpace::saveBasicAttributes(), BlockEdge::saveXml(), LoadTable::saveXml(), SleighBase::saveXml(), Override::saveXml(), FloatFormat::saveXml(), HighVariable::saveXml(), Funcdata::saveXml(), PcodeOp::saveXml(), OverlaySpace::saveXml(), TypePointer::saveXml(), Varnode::saveXml(), TypeFactory::saveXml(), FuncProto::saveXml(), AddrSpace::saveXmlAttributes(), JoinSpace::saveXmlAttributes(), FspecSpace::saveXmlAttributes(), Datatype::saveXmlBasic(), BlockGraph::saveXmlBody(), BlockGoto::saveXmlBody(), BlockMultiGoto::saveXmlBody(), BlockIf::saveXmlBody(), FlowBlock::saveXmlHeader(), Symbol::saveXmlHeader(), BlockCopy::saveXmlHeader(), and Funcdata::saveXmlTree().
|
inline |
Output the given unsigned integer as an XML attribute value.
s | is the output stream |
attr | is the name of the attribute |
val | is the given unsigned integer value |
Referenced by ContextInternal::saveContext(), XmlArchitecture::saveXml(), RawBinaryArchitecture::saveXml(), BfdArchitecture::saveXml(), SleighBase::saveXml(), TrackedContext::saveXml(), HighVariable::saveXml(), SeqNum::saveXml(), Funcdata::saveXml(), ConstantPoolInternal::CheapSorter::saveXml(), Range::saveXml(), PcodeOp::saveXml(), FunctionSymbol::saveXml(), Varnode::saveXml(), JumpTable::saveXml(), ScopeInternal::saveXml(), Database::saveXml(), BlockGoto::saveXmlBody(), BlockIf::saveXmlBody(), and Symbol::saveXmlHeader().
void xml_escape | ( | ostream & | s, |
const char * | str | ||
) |
Send the given character array to a stream, escaping characters with special XML meaning.
This makes the following character substitutions:
s | is the stream to write to |
str | is the given character array to escape |
Referenced by a_v(), Comment::saveXml(), CPoolRecord::saveXml(), and XmlError::XmlError().
int4 xml_parse | ( | istream & | i, |
ContentHandler * | hand, | ||
int4 | dbg = 0 |
||
) |
Start-up the XML parser given a stream and a handler.
This runs the low-level XML parser.
i | is the given stream to get character data from |
hand | is the ContentHandler that stores or processes the XML content events |
dbg | is non-zero if the parser should output debug information during its parse |
Referenced by XmlError::XmlError().
|
inline |
Read an XML attribute value as a boolean.
This method is intended to recognize the strings, "true", "yes", and "1" as a true value. Anything else is returned as false.
attr | is the given XML attribute value (as a string) |
Referenced by LoadImageXml::open(), Architecture::parseAggressiveTrim(), TypeFactory::parseEnumConfig(), Architecture::parseStackPointer(), ScopeGhidra::processHole(), ScopeInternal::processHole(), GhidraTranslate::restoreXml(), SleighBase::restoreXml(), StringManager::restoreXml(), LanguageDescription::restoreXml(), CPoolRecord::restoreXml(), FloatFormat::restoreXml(), InjectPayload::restoreXml(), AddrSpace::restoreXml(), Funcdata::restoreXml(), Architecture::restoreXml(), ScopeLocal::restoreXml(), TypeFactory::restoreXml(), ParamListStandard::restoreXml(), ProtoModel::restoreXml(), Database::restoreXml(), ProtoStoreInternal::restoreXml(), FuncProto::restoreXml(), Datatype::restoreXmlBasic(), Symbol::restoreXmlHeader(), and TypeFactory::restoreXmlTypeNoRef().
Document* xml_tree | ( | istream & | i | ) |
Parse the given XML stream into an in-memory document.
The stream is parsed using the standard ContentHandler for producing an in-memory DOM representation of the XML document.
i | is the given stream |
Referenced by SleighArchitecture::loadLanguageDescription(), ArchitectureGhidra::readXMLStream(), and XmlError::XmlError().