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>
Go to the source code of this file.
|  | 
| typedef void * | Locator | 
|  | Placeholder for a document locator object. 
 | 
|  | 
| typedef vector< Element * > | List | 
|  | A list of XML elements. 
 | 
|  | 
|  | 
| 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. 
◆ a_v()
  
  | 
        
          | void a_v | ( | ostream & | s, |  
          |  |  | const string & | attr, |  
          |  |  | const string & | val |  
          |  | ) |  |  |  | inline | 
 
Output an XML attribute name/value pair to stream. 
- Parameters
- 
  
    | s | is the output stream |  | attr | is the name of the attribute |  | val | is the attribute value |  
 
 
 
◆ a_v_b()
  
  | 
        
          | void a_v_b | ( | ostream & | s, |  
          |  |  | const string & | attr, |  
          |  |  | bool | val |  
          |  | ) |  |  |  | inline | 
 
Output the given boolean value as an XML attribute. 
- Parameters
- 
  
    | s | is the output stream |  | attr | is the name of the attribute |  | val | is the given boolean value |  
 
 
 
◆ a_v_i()
  
  | 
        
          | void a_v_i | ( | ostream & | s, |  
          |  |  | const string & | attr, |  
          |  |  | intb | val |  
          |  | ) |  |  |  | inline | 
 
Output the given signed integer as an XML attribute value. 
- Parameters
- 
  
    | s | is the output stream |  | attr | is the name of the attribute |  | val | is the given integer value |  
 
 
 
◆ a_v_u()
  
  | 
        
          | void a_v_u | ( | ostream & | s, |  
          |  |  | const string & | attr, |  
          |  |  | uintb | val |  
          |  | ) |  |  |  | inline | 
 
Output the given unsigned integer as an XML attribute value. 
- Parameters
- 
  
    | s | is the output stream |  | attr | is the name of the attribute |  | val | is the given unsigned integer value |  
 
 
 
◆ xml_escape()
      
        
          | 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:
- '<' => "<"
- '>' => ">"
- '&' => "&"
- '"' => """
- '\'' => "'"
- Parameters
- 
  
    | s | is the stream to write to |  | str | is the given character array to escape |  
 
 
 
◆ xml_parse()
Start-up the XML parser given a stream and a handler. 
This runs the low-level XML parser. 
- Parameters
- 
  
    | 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 |  
 
- Returns
- 0 if there is no error during parsing or a (non-zero) error condition 
 
 
◆ xml_readbool()
  
  | 
        
          | bool xml_readbool | ( | const string & | attr | ) |  |  | 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. 
- Parameters
- 
  
    | attr | is the given XML attribute value (as a string) |  
 
- Returns
- either true or false 
 
 
◆ xml_tree()
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. 
- Parameters
- 
  
  
- Returns
- the in-memory XML document