fixed String's name in JsonTool.cpp
This commit is contained in:
parent
78149024ee
commit
57ff3a70c9
@ -1,9 +1,9 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include<hgl/type/List.h>
|
#include<hgl/type/Map.h>
|
||||||
#include<hgl/type/String.h>
|
#include<hgl/type/String.h>
|
||||||
#include<hgl/type/StringView.h>
|
#include<hgl/type/StringView.h>
|
||||||
#include<hgl/type/KeyValue.h>
|
#include<hgl/type/Pair.h>
|
||||||
|
|
||||||
namespace hgl
|
namespace hgl
|
||||||
{
|
{
|
||||||
@ -32,19 +32,19 @@ namespace hgl
|
|||||||
class TreeXMLNode
|
class TreeXMLNode
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
<node atts="info">
|
<node number="123456">
|
||||||
abcdefg
|
abcdefg
|
||||||
</root>
|
</root>
|
||||||
|
|
||||||
element_name root
|
name root
|
||||||
atts atts=info
|
atts number=123456
|
||||||
data abcdefg
|
data abcdefg
|
||||||
*/
|
*/
|
||||||
|
|
||||||
TreeXMLData * xml_raw_data;
|
TreeXMLData * xml_raw_data;
|
||||||
|
|
||||||
int element_name; ///<元素点名字视图
|
int name; ///<元素点名字视图
|
||||||
List<KeyValue<int,int>> atts; ///<属性点文字视图
|
Map<int,int> atts; ///<属性点文字视图
|
||||||
int data; ///<数据文本视图
|
int data; ///<数据文本视图
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#################################################################################################### XML
|
#################################################################################################### XML
|
||||||
option(CM_UTIL_SUPPORT_XML "Build XML Parse module." ON)
|
option(CM_UTIL_SUPPORT_XML "Build XML Parse module." ON)
|
||||||
|
|
||||||
if(CM_UTIL_SUPPORT_XML)
|
if(CM_UTIL_SUPPORT_XML)
|
||||||
@ -27,7 +27,7 @@ if(CM_UTIL_SUPPORT_XML)
|
|||||||
${XML_ELEMENT_PARSE_SOURCE}
|
${XML_ELEMENT_PARSE_SOURCE}
|
||||||
|
|
||||||
${XML_PARSE_CLASS_SOURCE}
|
${XML_PARSE_CLASS_SOURCE}
|
||||||
${TREE_XML_SOURCE}
|
#${TREE_XML_SOURCE}
|
||||||
)
|
)
|
||||||
|
|
||||||
SOURCE_GROUP("XML\\ElementParse\\KV" FILES ${XML_ELEMENT_PARSE_KV})
|
SOURCE_GROUP("XML\\ElementParse\\KV" FILES ${XML_ELEMENT_PARSE_KV})
|
||||||
|
@ -28,7 +28,7 @@ namespace hgl
|
|||||||
writer->write(jv_root,&json_result);
|
writer->write(jv_root,&json_result);
|
||||||
result=true;
|
result=true;
|
||||||
|
|
||||||
str=ToUTF8String(json_result.str());
|
str=ToU8String(json_result.str());
|
||||||
}
|
}
|
||||||
catch(std::exception &e)
|
catch(std::exception &e)
|
||||||
{
|
{
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#include<hgl/util/xml/TreeXML.h>
|
#include<hgl/util/xml/TreeXML.h>
|
||||||
#include<hgl/type/Stack.h>
|
#include<hgl/type/Stack.h>
|
||||||
#include<expat.h>
|
#include<expat.h>
|
||||||
|
|
||||||
@ -9,7 +9,7 @@ namespace hgl
|
|||||||
TreeXMLNode::TreeXMLNode(TreeXMLData *xdata,int name)
|
TreeXMLNode::TreeXMLNode(TreeXMLData *xdata,int name)
|
||||||
{
|
{
|
||||||
xml_raw_data=xdata;
|
xml_raw_data=xdata;
|
||||||
element_name=name;
|
name=name;
|
||||||
|
|
||||||
data=-1;
|
data=-1;
|
||||||
}
|
}
|
||||||
@ -26,10 +26,10 @@ namespace hgl
|
|||||||
|
|
||||||
const U8StringView *TreeXMLNode::GetElementName()const
|
const U8StringView *TreeXMLNode::GetElementName()const
|
||||||
{
|
{
|
||||||
if(!xml_raw_data||element_name<0)
|
if(!xml_raw_data||name<0)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
return xml_raw_data->ElementNameList.At(element_name);
|
return xml_raw_data->ElementNameList.At(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
const U8StringView *TreeXMLNode::GetAtts(const U8String &name)
|
const U8StringView *TreeXMLNode::GetAtts(const U8String &name)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user