🛰️航天仿真算法库 SpaceAST 0.0.1
载入中...
搜索中...
未找到
ast::XMLNode类 参考

#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节点

成员函数说明

◆ addAttribute()

void ast::XMLNode::addAttribute ( const std::string & name,
const GenericValue & value )

添加属性

参数
name属性名称
value属性值

◆ addChild()

void ast::XMLNode::addChild ( HXMLNode && child)

添加子节点

参数
child子节点

◆ addComment()

void ast::XMLNode::addComment ( StringView text)

添加注释节点

参数
text注释内容

◆ addText()

void ast::XMLNode::addText ( StringView text)

添加文本节点

参数
text文本内容

◆ clear()

void ast::XMLNode::clear ( )

清除节点内容

清除节点的所有子节点和属性。

◆ clearAttributes()

void ast::XMLNode::clearAttributes ( )

清除属性

清除节点的所有属性。

◆ clearChildren()

void ast::XMLNode::clearChildren ( )

清除子节点

递归清除所有子节点,包括子节点的子节点。

◆ getAttribute()

ValueView ast::XMLNode::getAttribute ( const std::string & name)

获取属性值

参数
name属性名称
返回
属性值

◆ getAttributes()

const std::map< std::string, GenericValue > & ast::XMLNode::getAttributes ( ) const
inline

获取属性列表

返回
属性列表

◆ getChildren()

const std::vector< HXMLNode > & ast::XMLNode::getChildren ( ) const
inline

获取子节点

从 startIndex 开始查找子节点,返回第一个匹配的子节点。 如果未找到匹配的子节点,返回 nullptr。

参数
name子节点名称
startIndex子节点索引
返回
子节点

获取子节点列表

返回
子节点列表

◆ getKind()

EXMLNodeType ast::XMLNode::getKind ( ) const
inline

获取节点类型

返回
节点类型

获取节点类型

返回
节点类型

◆ getName()

const std::string & ast::XMLNode::getName ( ) const
inline

获取节点名称

返回
节点名称

◆ getText()

const std::string & ast::XMLNode::getText ( ) const
inline

获取节点文本

返回
节点文本

◆ load()

errc_t ast::XMLNode::load ( StringView filepath)

从XML解析器加载节点

参数
filepath文件路径

◆ save()

errc_t ast::XMLNode::save ( StringView filepath)

保存节点到XML文件

参数
filepath文件路径

◆ setName()

void ast::XMLNode::setName ( StringView name)

设置节点名称

参数
name节点名称

◆ setText()

void ast::XMLNode::setText ( StringView text)

设置节点文本

参数
text节点文本

该类的文档由以下文件生成: