split Start&Init from Start in XMLParse

This commit is contained in:
2020-09-04 18:07:00 +08:00
parent 120b6b449c
commit 3f09d59ceb
4 changed files with 25 additions and 14 deletions

View File

@@ -11,7 +11,7 @@ namespace hgl
return ecs_map.Add(ec->GetElementName(),ec);
}
bool ElementParseCreater::Start (const u8char *element_name)
bool ElementParseCreater::Init(const u8char *element_name)
{
if(!element_name||!*element_name)return(false);
@@ -39,7 +39,7 @@ namespace hgl
if(ec)
{
if(ec->Start())
if(ec->Init())
cur_ec=ec;
else
delete ec;
@@ -55,6 +55,13 @@ namespace hgl
cur_ec->Attr(flag,info);
}
bool ElementParseCreater::Start()
{
if(!cur_ec)return(false);
return cur_ec->Start();
}
void ElementParseCreater::CharData(const u8char *str,const int str_length)
{
if(!cur_ec)return;

View File

@@ -13,7 +13,7 @@ namespace hgl
{
void XMLStartElement(ElementParse *ep,const XML_Char *name,const XML_Char **atts)
{
if(!ep->Start((const u8char *)name))
if(!ep->Init((const u8char *)name))
return;
const u8char *flag;
@@ -26,6 +26,8 @@ namespace hgl
ep->Attr(flag,info);
}
ep->Start();
}
void XMLCharData(ElementParse *ep,const XML_Char *str,int len)