Use U8String/U16String/WString instead of UTF8String/UTF16String/WideString
This commit is contained in:
@@ -15,18 +15,18 @@ namespace hgl
|
||||
{
|
||||
protected:
|
||||
|
||||
using AttrsMap=Map<UTF8String,UTF8String>;
|
||||
using AttrItem=KeyValue<UTF8String,UTF8String>;
|
||||
using AttrsMap=Map<U8String,U8String>;
|
||||
using AttrItem=KeyValue<U8String,U8String>;
|
||||
|
||||
AttrsMap attrs_map;
|
||||
|
||||
protected:
|
||||
|
||||
const AttrItem *GetAttrItem(const UTF8String &name);
|
||||
const AttrItem *GetAttrItem(const U8String &name);
|
||||
|
||||
template<typename T> const bool GetInteger (const UTF8String &name,T &value){const AttrItem *ai=GetAttrItem(name);return(ai?stoi(ai->value.c_str(),value):false);}
|
||||
template<typename T> const bool GetUInteger (const UTF8String &name,T &value){const AttrItem *ai=GetAttrItem(name);return(ai?stou(ai->value.c_str(),value):false);}
|
||||
template<typename T> const bool GetFloat (const UTF8String &name,T &value){const AttrItem *ai=GetAttrItem(name);return(ai?stof(ai->value.c_str(),value):false);}
|
||||
template<typename T> const bool GetInteger (const U8String &name,T &value){const AttrItem *ai=GetAttrItem(name);return(ai?stoi(ai->value.c_str(),value):false);}
|
||||
template<typename T> const bool GetUInteger (const U8String &name,T &value){const AttrItem *ai=GetAttrItem(name);return(ai?stou(ai->value.c_str(),value):false);}
|
||||
template<typename T> const bool GetFloat (const U8String &name,T &value){const AttrItem *ai=GetAttrItem(name);return(ai?stof(ai->value.c_str(),value):false);}
|
||||
|
||||
public:
|
||||
|
||||
@@ -36,28 +36,28 @@ namespace hgl
|
||||
|
||||
public:
|
||||
|
||||
const bool Contains (const UTF8String &name)const{return attrs_map.ContainsKey(name);}
|
||||
const bool Contains (const U8String &name)const{return attrs_map.ContainsKey(name);}
|
||||
|
||||
const u8char * ToCString (const UTF8String &name){const AttrItem *ai=GetAttrItem(name);return(ai?ai->value.c_str():nullptr);}
|
||||
const u8char * operator[] (const UTF8String &name){return ToCString(name);}
|
||||
const u8char * ToCString (const U8String &name){const AttrItem *ai=GetAttrItem(name);return(ai?ai->value.c_str():nullptr);}
|
||||
const u8char * operator[] (const U8String &name){return ToCString(name);}
|
||||
|
||||
public:
|
||||
|
||||
const bool Get(const UTF8String &name,UTF8String &str);
|
||||
const bool Get(const UTF8String &name,UTF16String &str);
|
||||
const bool Get(const UTF8String &name,u8char &ch);
|
||||
const bool Get(const UTF8String &name,bool &value);
|
||||
const bool Get(const U8String &name,U8String &str);
|
||||
const bool Get(const U8String &name,U16String &str);
|
||||
const bool Get(const U8String &name,u8char &ch);
|
||||
const bool Get(const U8String &name,bool &value);
|
||||
|
||||
const bool Get(const UTF8String &name, int8 &value){return GetInteger < int8 >(name,value);}
|
||||
const bool Get(const UTF8String &name,uint8 &value){return GetUInteger<uint8 >(name,value);}
|
||||
const bool Get(const UTF8String &name, int16 &value){return GetInteger < int16>(name,value);}
|
||||
const bool Get(const UTF8String &name,uint16 &value){return GetUInteger<uint16>(name,value);}
|
||||
const bool Get(const UTF8String &name, int32 &value){return GetInteger < int32>(name,value);}
|
||||
const bool Get(const UTF8String &name,uint32 &value){return GetUInteger<uint32>(name,value);}
|
||||
const bool Get(const UTF8String &name, int64 &value){return GetInteger < int64>(name,value);}
|
||||
const bool Get(const UTF8String &name,uint64 &value){return GetUInteger<uint64>(name,value);}
|
||||
const bool Get(const U8String &name, int8 &value){return GetInteger < int8 >(name,value);}
|
||||
const bool Get(const U8String &name,uint8 &value){return GetUInteger<uint8 >(name,value);}
|
||||
const bool Get(const U8String &name, int16 &value){return GetInteger < int16>(name,value);}
|
||||
const bool Get(const U8String &name,uint16 &value){return GetUInteger<uint16>(name,value);}
|
||||
const bool Get(const U8String &name, int32 &value){return GetInteger < int32>(name,value);}
|
||||
const bool Get(const U8String &name,uint32 &value){return GetUInteger<uint32>(name,value);}
|
||||
const bool Get(const U8String &name, int64 &value){return GetInteger < int64>(name,value);}
|
||||
const bool Get(const U8String &name,uint64 &value){return GetUInteger<uint64>(name,value);}
|
||||
|
||||
const bool GetHexStr(const UTF8String &name,uint8 *data);
|
||||
const bool GetHexStr(const U8String &name,uint8 *data);
|
||||
};//class ElementParseKV:public ElementParse
|
||||
}//namespace xml
|
||||
}//namespace hgl
|
||||
|
Reference in New Issue
Block a user