fix typoes

This commit is contained in:
leipeng 2022-09-20 14:07:17 +08:00
parent 17082c770f
commit b2a63864aa

View file

@ -23,14 +23,14 @@ public:
};
template<class Enum>
Slice enum_name(Enum v, const char* unkown = "") {
Slice enum_name(Enum v, const char* unknown = "") {
auto names = enum_all_names ((Enum*)0);
auto values = enum_all_values((Enum*)0);
for (size_t i = 0; i < names.second; ++i) {
if (v == values[i])
return names.first[i];
}
return unkown;
return unknown;
}
template<class Enum>
@ -41,20 +41,20 @@ std::string enum_stdstr(Enum v) {
if (v == values[i])
return names.first[i].ToString();
}
return "unkown:" + (sizeof(Enum) <= sizeof(int)
return "unknown:" + (sizeof(Enum) <= sizeof(int)
? std::to_string((int)v)
: std::to_string((long)v));
}
template<class Enum>
const char* enum_cstr(Enum v, const char* unkown = "") {
const char* enum_cstr(Enum v, const char* unknown = "") {
auto names = enum_all_names ((Enum*)0);
auto values = enum_all_values((Enum*)0);
for (size_t i = 0; i < names.second; ++i) {
if (v == values[i])
return names.first[i].data();
}
return unkown;
return unknown;
}
template<class Enum>