The previous section describes the control builder Cdialogbuilder, which will then parse its XML parser cmarkup;
Cmarkup:xml parser, currently built in support of three encoding formats: UTF8, UNICODE, Asni;cmarkupnode:xml node class
First introduce cmarkup:
Xmlelement:xml node element type definition, IStart, the starting position of the node element in the XML file, ichild, node element child node, INext, node element's next node (sibling node), iparent, node element's parent node, IData,
The data for the node element.
Cmarkupnode, as a friend of CMarkup, means that CMarkup's member functions and data properties can be accessed, in fact, the later traversal of XML is implemented in conjunction with Cmarkupnode getsibling and Getchild.
Class member Data:
M_pstrxml: A pointer buffer stored for CMARKUP to load the contents of the XML file data;
M_pelements: The buffer that holds the node element information of the XmlElement type, in fact there may be some unforeseen storage space;
M_nelements: The number of active node elements in the actual save m_pelements;
M_nreservedelements: Reserved m_pelements buffer space size, the specific policy is: m_nelements >= m_nreservedelements) {m_nreservedelements + = (m_ NRESERVEDELEMENTS/2)
+ 500;m_pelements = static_cast<xmlelement*> (ReAlloc (m_pelements, m_nreservedelements * sizeof (XMLELEMENT)));
M_SZERRORMSG: Error message at last parse;
M_szerrorxml: XML location information at the time of the last parse;
M_bpreservewhitespace: Skip ignoring whitespace, default is ignore;
Cmarkupnode:
XmlAttribute: The structure of the node attribute is defined, Iname is the attribute name, and the Ivalue is the ulong type;
Max_xml_attributes: The node supports a maximum of 64 attributes;
Class member Data:
M_aattributes: A list of node attributes (an array of node properties that hold data similar to key-value pairs);
M_ipos: Specifies the current position of the attribute node in the node element of the owning owner (referred to as the CMarkup object) (in fact its node element is also saved as an array of pointers);
M_nattributes: Number of attributes in the node;
M_powner: The owner of the node (referred to as CMarkup object);
Duilib Source Code Analysis (iii) XML parser-cmarkup