CBlueUI  
C++ 跨平台跨框架的数据可视化工具
载入中...
搜索中...
未找到
BUI::XmlStorageW类 参考

xml文件储存类。xml文件中大量重复标签,采用共享字符串的方式,减少内存占用 更多...

Public 成员函数

 XmlStorageW (TransformTextProcW func=NULL)
 XmlStorageW (const char *file_utf8, TransformTextProcW func=NULL)
 XmlStorageW (const WCHAR *file, TransformTextProcW func=NULL)
 ~XmlStorageW ()
void Clear ()
 清空并释放内存
XMLItemWRoot ()
 跟节点
BeStringW FileBaseName () const
 文件名称(不包含目录结构)
int LoadBuffer (const char *data, int len=-1, BOOL no_write=FALSE)
 加载xml格式数据
int LoadBufferJson (const char *json_text, int len=-1, BOOL to_xml=FALSE)
 加载json数据并转换为xml树结构
BeStringW AddShareLabel (const char *str, int len, BOOL is_key=FALSE)
 自动检测文本是否在共享字符缓存中,不存在则新建字符串;存在则直接返回共享内存。 在xml和json文档中,存在大量重复的关键词。共享字符串可以减少内存占用

静态 Public 成员函数

static void SaveAsXmlFile (const XMLItemW *root, const char *filepath)

详细描述

xml文件储存类。xml文件中大量重复标签,采用共享字符串的方式,减少内存占用

构造及析构函数说明

◆ XmlStorageW() [1/3]

BUI::XmlStorageW::XmlStorageW ( TransformTextProcW func = NULL)

◆ XmlStorageW() [2/3]

BUI::XmlStorageW::XmlStorageW ( const char * file_utf8,
TransformTextProcW func = NULL )

◆ XmlStorageW() [3/3]

BUI::XmlStorageW::XmlStorageW ( const WCHAR * file,
TransformTextProcW func = NULL )

◆ ~XmlStorageW()

BUI::XmlStorageW::~XmlStorageW ( )

成员函数说明

◆ AddShareLabel()

BeStringW BUI::XmlStorageW::AddShareLabel ( const char * str,
int len,
BOOL is_key = FALSE )

自动检测文本是否在共享字符缓存中,不存在则新建字符串;存在则直接返回共享内存。 在xml和json文档中,存在大量重复的关键词。共享字符串可以减少内存占用

参数
str: 字符串
len: 字符串长度
is_key: 是不是属性名称
返回
BeStringW : 返回共享字符对象

◆ Clear()

void BUI::XmlStorageW::Clear ( )

清空并释放内存

◆ FileBaseName()

BeStringW BUI::XmlStorageW::FileBaseName ( ) const

文件名称(不包含目录结构)

◆ LoadBuffer()

int BUI::XmlStorageW::LoadBuffer ( const char * data,
int len = -1,
BOOL no_write = FALSE )

加载xml格式数据

参数
data数据
len数据长度
no_writeTRUE代表xmlText是不可写字符串,解析常量字符串时,需要标记为TRUE

◆ LoadBufferJson()

int BUI::XmlStorageW::LoadBufferJson ( const char * json_text,
int len = -1,
BOOL to_xml = FALSE )

加载json数据并转换为xml树结构

参数
json_text数据
len数据长度
to_xmlTRUE表示将json格式转换为紧凑的XML格式。FALSE表示保持json的树结构

◆ Root()

XMLItemW * BUI::XmlStorageW::Root ( )

跟节点

◆ SaveAsXmlFile()

void BUI::XmlStorageW::SaveAsXmlFile ( const XMLItemW * root,
const char * filepath )
static
鄂公网安备42018502007752 鄂ICP备2024082886
Copyright © 2026 · CBlueStudio 版权所有