|
🛰️航天仿真算法库 SpaceAST 0.0.1
|
#include <XMLNode.hpp>
Public 成员函数 | |
| XMLNode (EXMLNodeType kind, StringView nameOrText) | |
| XMLNode (StringView nameOrText) | |
| errc_t | load (StringView filepath) |
| errc_t | save (StringView filepath) |
| EXMLNodeType | getKind () const |
| const std::string & | getName () const |
| void | setName (StringView name) |
| const std::string & | getText () const |
| void | setText (StringView text) |
| void | addChild (HXMLNode &&child) |
| void | addText (StringView text) |
| void | addComment (StringView text) |
| const std::vector< HXMLNode > & | getChildren () const |
| void | addAttribute (const std::string &name, const GenericValue &value) |
| const std::map< std::string, GenericValue > & | getAttributes () const |
| ValueView | getAttribute (const std::string &name) |
| void | clearChildren () |
| void | clearAttributes () |
| void | clear () |
XML节点
| void ast::XMLNode::addAttribute | ( | const std::string & | name, |
| const GenericValue & | value ) |
添加属性
| name | 属性名称 |
| value | 属性值 |
| void ast::XMLNode::addChild | ( | HXMLNode && | child | ) |
添加子节点
| child | 子节点 |
| void ast::XMLNode::addComment | ( | StringView | text | ) |
添加注释节点
| text | 注释内容 |
| void ast::XMLNode::addText | ( | StringView | text | ) |
添加文本节点
| text | 文本内容 |
| void ast::XMLNode::clear | ( | ) |
清除节点内容
清除节点的所有子节点和属性。
| void ast::XMLNode::clearAttributes | ( | ) |
清除属性
清除节点的所有属性。
| void ast::XMLNode::clearChildren | ( | ) |
清除子节点
递归清除所有子节点,包括子节点的子节点。
| ValueView ast::XMLNode::getAttribute | ( | const std::string & | name | ) |
获取属性值
| name | 属性名称 |
|
inline |
获取属性列表
|
inline |
获取子节点
从 startIndex 开始查找子节点,返回第一个匹配的子节点。 如果未找到匹配的子节点,返回 nullptr。
| name | 子节点名称 |
| startIndex | 子节点索引 |
获取子节点列表
|
inline |
获取节点类型
获取节点类型
|
inline |
获取节点名称
|
inline |
获取节点文本
| errc_t ast::XMLNode::load | ( | StringView | filepath | ) |
从XML解析器加载节点
| filepath | 文件路径 |
| errc_t ast::XMLNode::save | ( | StringView | filepath | ) |
保存节点到XML文件
| filepath | 文件路径 |
| void ast::XMLNode::setName | ( | StringView | name | ) |
设置节点名称
| name | 节点名称 |
| void ast::XMLNode::setText | ( | StringView | text | ) |
设置节点文本
| text | 节点文本 |