CMUtil/src/xml/ElementCreater.cpp

35 lines
820 B
C++
Raw Normal View History

2020-09-17 23:30:25 +08:00
#include<hgl/util/xml/ElementParseCreater.h>
2020-08-21 21:11:07 +08:00
namespace hgl
{
namespace xml
{
2020-08-25 21:47:05 +08:00
bool ElementCreater::Registry(ElementCreater *ec)
2020-08-21 21:11:07 +08:00
{
2020-08-25 21:47:05 +08:00
if(!ec)return(false);
2020-09-18 19:48:47 +08:00
const UTF8String &name=ec->GetElementName().ToLowerCase();
2020-08-25 21:47:05 +08:00
if(name.IsEmpty())return(false);
if(ecs_map.ContainsKey(name))return(false);
2020-08-21 21:11:07 +08:00
ecs_map.Add(name,ec);
return(true);
}
2020-09-17 23:30:25 +08:00
2020-08-25 21:47:05 +08:00
ElementCreater *ElementCreater::GetSubElementCreater(const UTF8String &sub_name)
2020-08-21 21:11:07 +08:00
{
if(sub_name.IsEmpty())return(nullptr);
ElementCreater *ec;
2020-09-18 19:48:47 +08:00
const UTF8String &sn=sub_name.ToLowerCase();
if(!ecs_map.Get(sn,ec))
2020-08-21 21:11:07 +08:00
return(nullptr);
return ec;
}
}//namespace xml
}//namespace hgl