4#include <interface/obj-ref-i.h>
5#include <interface/sstring-i.h>
15#define INTERFACE IXmlAttr
28 STDMETHOD_(BOOL,
Empty)(CTHIS) SCONST PURE;
34 STDMETHOD_(
const wchar_t*,
Name)(CTHIS) SCONST PURE;
40 STDMETHOD_(
const wchar_t*,
Value)(CTHIS) SCONST PURE;
72 STDMETHOD_(
int,
AsInt)(THIS_
int def DEF_VAL(0)) PURE;
79 STDMETHOD_(
unsigned int,
AsUint)(THIS_
int def DEF_VAL(0)) PURE;
86 STDMETHOD_(
float,
AsFloat)(THIS_
float def DEF_VAL(0.0f)) PURE;
93 STDMETHOD_(
double,
AsDouble)(THIS_
double def DEF_VAL(0.0)) PURE;
100 STDMETHOD_(BOOL,
AsBool)(THIS_ BOOL def DEF_VAL(FALSE)) PURE;
107typedef enum _XmlNodeType
126#define INTERFACE IXmlNode
133 STDMETHOD_(
void,
ToString)(CTHIS_ IStringW *out) SCONST PURE;
145 STDMETHOD_(BOOL,
Empty)(CTHIS) SCONST PURE;
151 STDMETHOD_(
const wchar_t*,
Name)(CTHIS) SCONST PURE;
157 STDMETHOD_(
const wchar_t*,
Value)(CTHIS) SCONST PURE;
163 STDMETHOD_(
const wchar_t*,
Text)(CTHIS) SCONST PURE;
204 STDMETHOD_(
IXmlNode*,
Child)(CTHIS_
const wchar_t* name, BOOL bCaseSensitive) SCONST PURE;
327typedef enum _XmlStatus
334 xml_unrecognized_tag,
340 xml_bad_start_element,
343 xml_end_element_mismatch,
344 xml_append_invalid_root,
345 xml_no_document_element
352typedef enum _XmlEncoding
371typedef enum _XmlParseOpt
375 xml_parse_minimal = 0x0000,
378 xml_parse_pi = 0x0001,
381 xml_parse_comments = 0x0002,
384 xml_parse_cdata = 0x0004,
388 xml_parse_ws_pcdata = 0x0008,
391 xml_parse_escapes = 0x0010,
394 xml_parse_eol = 0x0020,
397 xml_parse_wconv_attribute = 0x0040,
400 xml_parse_wnorm_attribute = 0x0080,
403 xml_parse_declaration = 0x0100,
406 xml_parse_doctype = 0x0200,
411 xml_parse_ws_pcdata_single = 0x0400,
414 xml_parse_trim_pcdata = 0x0800,
419 xml_parse_fragment = 0x1000,
426 xml_parse_embed_pcdata = 0x2000,
433 xml_parse_default = xml_parse_cdata | xml_parse_escapes | xml_parse_wconv_attribute | xml_parse_eol,
440 xml_parse_full = xml_parse_default | xml_parse_pi | xml_parse_comments | xml_parse_declaration | xml_parse_doctype,
466#define INTERFACE IXmlDoc
513 STDMETHOD_(BOOL,
LoadString)(THIS_
const wchar_t* contents,
unsigned int options) PURE;
522 STDMETHOD_(BOOL,
LoadFileA)(THIS_
const char* path,
unsigned int options, XmlEncoding encoding) PURE;
531 STDMETHOD_(BOOL,
LoadFileW)(THIS_
const wchar_t* path,
unsigned int options, XmlEncoding encoding) PURE;
541 STDMETHOD_(BOOL,
LoadBuffer)(THIS_
const void* contents,
size_t size,
unsigned int options, XmlEncoding encoding) PURE;
552 STDMETHOD_(BOOL,
LoadBufferInplace)(THIS_
void* contents,
size_t size,
unsigned int options, XmlEncoding encoding) PURE;
563 STDMETHOD_(BOOL,
LoadBufferInplaceOwn)(THIS_
void* contents,
size_t size,
unsigned int options, XmlEncoding encoding) PURE;
585 STDMETHOD_(BOOL,
SaveFileA)(CTHIS_
const char* path,
const wchar_t* indent,
unsigned int flags, XmlEncoding encoding) SCONST PURE;
595 STDMETHOD_(BOOL,
SaveFileW)(CTHIS_
const wchar_t* path,
const wchar_t* indent,
unsigned int flags, XmlEncoding encoding) SCONST PURE;
607typedef SOUI::IXmlDoc * IXmlDocPtr;
Structure containing the result of XML parsing.
XmlStatus status
Parsing status (see XmlStatus).
ptrdiff_t offset
Last parsed offset (in char_t units from the start of input data).
XmlEncoding encoding
Source document encoding.
Interface for reference counting.
Interface for XML attributes.
double AsDouble(double def=0.0) PURE
Converts the attribute value to a double.
IXmlAttr * Prev() PURE
Gets the previous attribute in the attribute list of the parent node.
BOOL Empty() SCONST PURE
Checks if the attribute is empty.
LPVOID GetPrivPtr() SCONST PURE
Gets the private pointer associated with the attribute.
IXmlAttr * Next() PURE
Gets the next attribute in the attribute list of the parent node.
int AsInt(int def=0) PURE
Converts the attribute value to an integer.
unsigned int AsUint(int def=0) PURE
Converts the attribute value to an unsigned integer.
int get_userdata() SCONST PURE
Gets user-defined data associated with the attribute.
const wchar_t * Value() SCONST PURE
Gets the value of the attribute.
const wchar_t * Name() SCONST PURE
Gets the name of the attribute.
BOOL AsBool(BOOL def=FALSE) PURE
Converts the attribute value to a boolean.
float AsFloat(float def=0.0f) PURE
Converts the attribute value to a float.
BOOL set_userdata(int data) PURE
Sets user-defined data associated with the attribute.
Interface for XML Document.
BOOL SaveFileW(const wchar_t *path, const wchar_t *indent, unsigned int flags, XmlEncoding encoding) SCONST PURE
Saves the XML document to a file (Unicode version).
void Copy(const IXmlDoc *proto) PURE
Removes all nodes, then copies the entire contents of the specified document.
void GetParseResult(XmlParseResult *pResult) SCONST PURE
Gets the parsing result.
BOOL SaveFileA(const char *path, const wchar_t *indent, unsigned int flags, XmlEncoding encoding) SCONST PURE
Saves the XML document to a file (ANSI version).
void SaveBinary(FILE *f) SCONST PURE
Saves the XML document to a writer (semantics is slightly different from xml_node::print,...
void Reset() PURE
Resets the document, removing all nodes.
void OnFinalRelease() PURE
Releases the document object.
BOOL LoadBufferInplace(void *contents, size_t size, unsigned int options, XmlEncoding encoding) PURE
Loads the document from a buffer, using the buffer for in-place parsing (the buffer is modified and u...
BOOL LoadFileA(const char *path, unsigned int options, XmlEncoding encoding) PURE
Loads the document from a file (ANSI version).
long AddRef() PURE
Adds a reference to the document.
BOOL LoadFileW(const wchar_t *path, unsigned int options, XmlEncoding encoding) PURE
Loads the document from a file (Unicode version).
IXmlNode * Root() SCONST PURE
Gets the document element (root node).
BOOL LoadString(const wchar_t *contents, unsigned int options) PURE
Loads the document from a zero-terminated string. No encoding conversions are applied.
LPVOID GetPrivPtr() SCONST PURE
Gets the private pointer associated with the document.
BOOL LoadBuffer(const void *contents, size_t size, unsigned int options, XmlEncoding encoding) PURE
Loads the document from a buffer. Copies/converts the buffer, so it may be deleted or changed after t...
long Release() PURE
Releases a reference to the document.
BOOL LoadBufferInplaceOwn(void *contents, size_t size, unsigned int options, XmlEncoding encoding) PURE
Loads the document from a buffer, using the buffer for in-place parsing (the buffer is modified and u...
IXmlAttr * PrependCopyAttribute(const IXmlAttr *proto) PURE
Prepends a copy of the specified attribute.
const wchar_t * Name() SCONST PURE
Gets the name of the node.
BOOL RemoveAttribute(const wchar_t *name) PURE
Removes an attribute by name.
BOOL set_userdata(int data) PURE
Sets user-defined data associated with the node.
IXmlAttr * FirstAttribute() SCONST PURE
Gets the first attribute in the attribute list.
BOOL Empty() SCONST PURE
Checks if the node is empty.
BOOL RemoveChild(const wchar_t *name) PURE
Removes a child node by name.
LPVOID GetPrivPtr() SCONST PURE
Gets the private pointer associated with the node.
BOOL RemoveAllChilden() PURE
Removes all child nodes.
IXmlNode * FirstChild() SCONST PURE
Gets the first child node.
IXmlAttr * AppendCopyAttribute(const IXmlAttr *proto) PURE
Appends a copy of the specified attribute.
IXmlNode * LastChild() SCONST PURE
Gets the last child node.
IXmlNode * AppendCopyNode(const IXmlNode *proto) PURE
Appends a copy of the specified node as a child.
IXmlNode * Child(const wchar_t *name, BOOL bCaseSensitive) SCONST PURE
Gets a child node by name.
IXmlNode * AppendChild(const wchar_t *name) PURE
Appends a child node with the specified name.
const wchar_t * Value() SCONST PURE
Gets the value of the node.
IXmlAttr * AppendAttribute(const wchar_t *name) PURE
Appends an attribute with the specified name.
IXmlAttr * Attribute(const wchar_t *name, BOOL bCaseSensitive) SCONST PURE
Gets an attribute by name.
IXmlAttr * PrependAttribute(const wchar_t *name) PURE
Prepends an attribute with the specified name.
IXmlAttr * LastAttribute() SCONST PURE
Gets the last attribute in the attribute list.
IXmlNode * NextSibling2(const wchar_t *name, BOOL bCaseSensitive) SCONST PURE
Gets the next sibling node with the specified name.
IXmlNode * PrependCopyNode(const IXmlNode *proto) PURE
Prepends a copy of the specified node as a child.
const wchar_t * Text() SCONST PURE
Gets the text content of the node.
IXmlNode * NextSibling() SCONST PURE
Gets the next sibling node in the children list of the parent node.
IXmlNode * PrependChild(const wchar_t *name) PURE
Prepends a child node with the specified name.
IXmlNode * PrevSibling() SCONST PURE
Gets the previous sibling node in the children list of the parent node.
void ToString(IStringW *out) SCONST PURE
Converts the node to a string representation.
int get_userdata() SCONST PURE
Gets user-defined data associated with the node.
IXmlNode * PrevSibling2(const wchar_t *name, BOOL bCaseSensitive) SCONST PURE
Gets the previous sibling node with the specified name.