This commit is contained in:
hyzboy 2020-09-18 19:49:45 +08:00
commit b84ae361a1
7 changed files with 23 additions and 23 deletions

View File

@ -1,4 +1,4 @@
#ifndef HGL_UTIL_XML_ELEMENT_PARSE_INCLUDE #ifndef HGL_UTIL_XML_ELEMENT_PARSE_INCLUDE
#define HGL_UTIL_XML_ELEMENT_PARSE_INCLUDE #define HGL_UTIL_XML_ELEMENT_PARSE_INCLUDE
#include<hgl/type/DataType.h> #include<hgl/type/DataType.h>

View File

@ -1,4 +1,4 @@
#ifndef HGL_UTIL_XML_ELEMENT_PARSE_CREATER_INCLUDE #ifndef HGL_UTIL_XML_ELEMENT_PARSE_CREATER_INCLUDE
#define HGL_UTIL_XML_ELEMENT_PARSE_CREATER_INCLUDE #define HGL_UTIL_XML_ELEMENT_PARSE_CREATER_INCLUDE
#include<hgl/util/xml/ElementParse.h> #include<hgl/util/xml/ElementParse.h>
@ -16,7 +16,7 @@ namespace hgl
UTF8String element_name; UTF8String element_name;
protected: protected:
Map<AnsiString,ElementCreater *> ecs_map; Map<AnsiString,ElementCreater *> ecs_map;
virtual ElementCreater *GetSubElementCreater(const UTF8String &sub_name); virtual ElementCreater *GetSubElementCreater(const UTF8String &sub_name);
@ -109,7 +109,7 @@ namespace hgl
} }
public: public:
virtual bool Init () override virtual bool Init () override
{ {
attrs_list.ClearData(); attrs_list.ClearData();
@ -132,7 +132,7 @@ namespace hgl
class ElementParseCreater:public ElementParse class ElementParseCreater:public ElementParse
{ {
Stack<ElementCreater *> ecs_stack; Stack<ElementCreater *> ecs_stack;
Map<AnsiString,ElementCreater *> ecs_map; Map<AnsiString,ElementCreater *> ecs_map;
ElementCreater *cur_ec; ElementCreater *cur_ec;
@ -151,7 +151,7 @@ namespace hgl
bool Registry (ElementCreater *ec); bool Registry (ElementCreater *ec);
public: public:
virtual bool Init (const u8char *element_name) override; virtual bool Init (const u8char *element_name) override;
virtual void Attr (const u8char *flag,const u8char *info) override; virtual void Attr (const u8char *flag,const u8char *info) override;
virtual bool Start () override; virtual bool Start () override;

View File

@ -1,4 +1,4 @@
#ifndef HGL_UTIL_XML_ELEMENT_PARSE_KV_INCLUDE #ifndef HGL_UTIL_XML_ELEMENT_PARSE_KV_INCLUDE
#define HGL_UTIL_XML_ELEMENT_PARSE_KV_INCLUDE #define HGL_UTIL_XML_ELEMENT_PARSE_KV_INCLUDE
#include<hgl/util/xml/ElementParse.h> #include<hgl/util/xml/ElementParse.h>
@ -26,7 +26,7 @@ namespace hgl
template<typename T> const bool GetInteger (const UTF8String &name,T &value){const AttrItem *ai=GetAttrItem(name);return(ai?stoi(ai->right.c_str(),value):false);} template<typename T> const bool GetInteger (const UTF8String &name,T &value){const AttrItem *ai=GetAttrItem(name);return(ai?stoi(ai->right.c_str(),value):false);}
template<typename T> const bool GetUInteger (const UTF8String &name,T &value){const AttrItem *ai=GetAttrItem(name);return(ai?stou(ai->right.c_str(),value):false);} template<typename T> const bool GetUInteger (const UTF8String &name,T &value){const AttrItem *ai=GetAttrItem(name);return(ai?stou(ai->right.c_str(),value):false);}
template<typename T> const bool GetFloat (const UTF8String &name,T &value){const AttrItem *ai=GetAttrItem(name);return(ai?stof(ai->right.c_str(),value):false);} template<typename T> const bool GetFloat (const UTF8String &name,T &value){const AttrItem *ai=GetAttrItem(name);return(ai?stof(ai->right.c_str(),value):false);}
public: public:

View File

@ -1,4 +1,4 @@
#include<hgl/util/xml/ElementParseCreater.h> #include<hgl/util/xml/ElementParseCreater.h>
namespace hgl namespace hgl
{ {
@ -16,7 +16,7 @@ namespace hgl
ecs_map.Add(name,ec); ecs_map.Add(name,ec);
return(true); return(true);
} }
ElementCreater *ElementCreater::GetSubElementCreater(const UTF8String &sub_name) ElementCreater *ElementCreater::GetSubElementCreater(const UTF8String &sub_name)
{ {
if(sub_name.IsEmpty())return(nullptr); if(sub_name.IsEmpty())return(nullptr);

View File

@ -1,4 +1,4 @@
#include<hgl/util/xml/ElementParseCreater.h> #include<hgl/util/xml/ElementParseCreater.h>
namespace hgl namespace hgl
{ {
@ -35,7 +35,7 @@ namespace hgl
ecs_stack.Push(cur_ec); ecs_stack.Push(cur_ec);
} }
cur_ec=nullptr; cur_ec=nullptr;
if(ec) if(ec)
{ {

View File

@ -1,4 +1,4 @@
#include<hgl/util/xml/ElementParseKV.h> #include<hgl/util/xml/ElementParseKV.h>
#include<hgl/CodePage.h> #include<hgl/CodePage.h>
namespace hgl namespace hgl
@ -22,9 +22,9 @@ namespace hgl
const bool ElementParseKV::Get(const UTF8String &name,UTF8String &str) const bool ElementParseKV::Get(const UTF8String &name,UTF8String &str)
{ {
const AttrItem *ai=GetAttrItem(name); const AttrItem *ai=GetAttrItem(name);
if(!ai)return(false); if(!ai)return(false);
str=ai->right; str=ai->right;
return(true); return(true);
} }
@ -32,19 +32,19 @@ namespace hgl
const bool ElementParseKV::Get(const UTF8String &name,UTF16String &str) const bool ElementParseKV::Get(const UTF8String &name,UTF16String &str)
{ {
const AttrItem *ai=GetAttrItem(name); const AttrItem *ai=GetAttrItem(name);
if(!ai)return(false); if(!ai)return(false);
str=to_u16(ai->right); str=to_u16(ai->right);
return(true); return(true);
} }
const bool ElementParseKV::Get(const UTF8String &name,char &ch) const bool ElementParseKV::Get(const UTF8String &name,char &ch)
{ {
const AttrItem *ai=GetAttrItem(name); const AttrItem *ai=GetAttrItem(name);
if(!ai)return(false); if(!ai)return(false);
ch=ai->right.GetBeginChar(); ch=ai->right.GetBeginChar();
return(true); return(true);
} }
@ -52,10 +52,10 @@ namespace hgl
const bool ElementParseKV::Get(const UTF8String &name,bool &value) const bool ElementParseKV::Get(const UTF8String &name,bool &value)
{ {
const AttrItem *ai=GetAttrItem(name); const AttrItem *ai=GetAttrItem(name);
return(ai?stob<char>(ai->right.c_str(),value):false); return(ai?stob<char>(ai->right.c_str(),value):false);
} }
const bool ElementParseKV::GetHexStr(const UTF8String &name,uint8 *data) const bool ElementParseKV::GetHexStr(const UTF8String &name,uint8 *data)
{ {
const AttrItem *ai=GetAttrItem(name); const AttrItem *ai=GetAttrItem(name);

View File

@ -23,7 +23,7 @@ namespace hgl
{ {
flag=*atts;++atts; flag=*atts;++atts;
info=*atts;++atts; info=*atts;++atts;
ep->Attr(flag,info); ep->Attr(flag,info);
} }