port to C17/C++20
This commit is contained in:
parent
417e7fb002
commit
a1fe8f54ee
@ -294,6 +294,7 @@ namespace hgl
|
||||
return ToAnsiString(cs,str);
|
||||
}
|
||||
|
||||
inline OSString ToOSString(const char *str){return to_u16((u8char *)str);}
|
||||
inline OSString ToOSString(const u8char *str){return to_u16(str);}
|
||||
inline OSString ToOSString(const UTF8String &str){return to_u16(str.c_str(), (int)(str.Length()));}
|
||||
|
||||
|
@ -125,7 +125,7 @@ namespace hgl
|
||||
|
||||
const SC *GetString(const int id)const ///<根据ID取得字符串
|
||||
{
|
||||
if(id<0||id>=count)return(nullptr);
|
||||
if(id<0||id>=GetCount())return(nullptr);
|
||||
|
||||
size_t offset;
|
||||
|
||||
@ -180,7 +180,6 @@ namespace hgl
|
||||
}
|
||||
};//class ConstStringSet
|
||||
|
||||
using ConstAnsiStringSet =ConstStringSet<char>;
|
||||
using ConstWideStringSet =ConstStringSet<wchar_t>;
|
||||
using ConstUTF8StringSet =ConstStringSet<u8char>;
|
||||
using ConstUTF16StringSet =ConstStringSet<u16char>;
|
||||
|
@ -63,7 +63,7 @@ namespace hgl
|
||||
if(index<0||num<=0||index+num>=List<T *>::GetCount())
|
||||
return(false);
|
||||
|
||||
ItemPointer *p=data_array.data()+index;
|
||||
ItemPointer *p=this->data_array.data()+index;
|
||||
|
||||
for(int i=0;i<num;i++)
|
||||
{
|
||||
@ -134,7 +134,7 @@ namespace hgl
|
||||
|
||||
virtual T *operator[](int n)const ///<操作符重载取得指定索引处的数据
|
||||
{
|
||||
T **obj=data_array.GetPointer(n);
|
||||
T **obj=this->data_array.GetPointer(n);
|
||||
|
||||
if(!obj)return(nullptr);
|
||||
|
||||
@ -145,13 +145,13 @@ namespace hgl
|
||||
{
|
||||
if(!enum_func)return;
|
||||
|
||||
for(auto *obj:data_array)
|
||||
for(auto *obj:this->data_array)
|
||||
enum_func(obj);
|
||||
}
|
||||
|
||||
virtual bool SetCount(const int new_count) override
|
||||
{
|
||||
const int cur_count=GetCount();
|
||||
const int cur_count=this->GetCount();
|
||||
|
||||
if(new_count==cur_count)return(true);
|
||||
|
||||
@ -163,10 +163,10 @@ namespace hgl
|
||||
|
||||
if(new_count>cur_count)
|
||||
{
|
||||
if(!data_array.SetCount(new_count))
|
||||
if(!this->data_array.SetCount(new_count))
|
||||
return(false);
|
||||
|
||||
ItemPointer *p=data_array.GetPointer(cur_count);
|
||||
ItemPointer *p=this->data_array.GetPointer(cur_count);
|
||||
|
||||
hgl_zero<ItemPointer>(p,new_count-cur_count);
|
||||
|
||||
@ -176,14 +176,14 @@ namespace hgl
|
||||
{
|
||||
const int del_count=cur_count-new_count;
|
||||
|
||||
Delete(GetCount()-del_count,del_count);
|
||||
Delete(this->GetCount()-del_count,del_count);
|
||||
return(true);
|
||||
}
|
||||
}
|
||||
|
||||
virtual bool Set(int index,const ItemPointer &data) override
|
||||
{
|
||||
ItemPointer *p=data_array.GetPointer(index);
|
||||
ItemPointer *p=this->data_array.GetPointer(index);
|
||||
|
||||
if(!p)return(false);
|
||||
|
||||
|
@ -149,7 +149,7 @@ namespace hgl
|
||||
{
|
||||
ObjectStack<T>::Clear(olc);
|
||||
|
||||
data_array.Free();
|
||||
this->data_array.Free();
|
||||
}
|
||||
};//template<typename T> class ObjectStack
|
||||
}//namespace hgl
|
||||
|
@ -35,18 +35,18 @@ namespace hgl
|
||||
}
|
||||
};//struct MethodPtr
|
||||
|
||||
template<size_t ClassCounter> class IDObject:public _Object
|
||||
{
|
||||
public:
|
||||
//template<size_t ClassCounter> class IDObject:public _Object
|
||||
//{
|
||||
//public:
|
||||
|
||||
static const size_t GetClassID(){return ClassID;}
|
||||
static const char *GetClassName(){return ClassName;}
|
||||
static const char *GetClassRawName(){return ClassRawName;}
|
||||
// static const size_t GetClassID(){return ClassID;}
|
||||
// static const char *GetClassName(){return ClassName;}
|
||||
// static const char *GetClassRawName(){return ClassRawName;}
|
||||
|
||||
public:
|
||||
//public:
|
||||
|
||||
virtual ~IDObject()=default;
|
||||
};
|
||||
// virtual ~IDObject()=default;
|
||||
//};
|
||||
|
||||
#define HGL_IDOBJECT IDObject<__COUNTER__>
|
||||
//#define HGL_IDOBJECT IDObject<__COUNTER__>
|
||||
}//namespace hgl
|
||||
|
@ -78,12 +78,12 @@ namespace hgl
|
||||
|
||||
//下面这些定义是为了实例化上面的函数,所以不要删掉
|
||||
|
||||
bool SaveToAnsiTextStream(hgl::io::TextOutputStream *tos,const ConstAnsiStringSet *css,bool output_id){return SaveToTextStream(tos,css,output_id);}
|
||||
//bool SaveToAnsiTextStream(hgl::io::TextOutputStream *tos,const ConstAnsiStringSet *css,bool output_id){return SaveToTextStream(tos,css,output_id);}
|
||||
bool SaveToWideTextStream(hgl::io::TextOutputStream *tos,const ConstWideStringSet *css,bool output_id){return SaveToTextStream(tos,css,output_id);}
|
||||
bool SaveToUTF8TextStream(hgl::io::TextOutputStream *tos,const ConstUTF8StringSet *css,bool output_id){return SaveToTextStream(tos,css,output_id);}
|
||||
bool SaveToUTF16TextStream(hgl::io::TextOutputStream *tos,const ConstUTF16StringSet *css,bool output_id){return SaveToTextStream(tos,css,output_id);}
|
||||
|
||||
bool SaveToAnsiTextFile(const OSString &filename,const ConstAnsiStringSet *css,bool output_id,bool output_bom){return SaveToTextFile(filename,css,output_id,output_bom);}
|
||||
//bool SaveToAnsiTextFile(const OSString &filename,const ConstAnsiStringSet *css,bool output_id,bool output_bom){return SaveToTextFile(filename,css,output_id,output_bom);}
|
||||
bool SaveToWideTextFile(const OSString &filename,const ConstWideStringSet *css,bool output_id,bool output_bom){return SaveToTextFile(filename,css,output_id,output_bom);}
|
||||
bool SaveToUTF8TextFile(const OSString &filename,const ConstUTF8StringSet *css,bool output_id,bool output_bom){return SaveToTextFile(filename,css,output_id,output_bom);}
|
||||
bool SaveToUTF16TextFile(const OSString &filename,const ConstUTF16StringSet *css,bool output_id,bool output_bom){return SaveToTextFile(filename,css,output_id,output_bom);}
|
||||
|
Loading…
x
Reference in New Issue
Block a user