#pragma once #include #include #include #ifndef WIN32 #include #endif //negative values allowed struct dimension_t {}; //positive or zero dimension (so that neg values represent empty value) struct pzdimension_t {}; struct pzdimension2_t {}; struct font_name_t {}; struct shortcut_t {}; struct color_t {}; //------------------------------------------------------------------ template struct typeid_func_name; template std::string typeid_name() { if constexpr (std::is_const_v) return "const " + typeid_name>(); else if constexpr (std::is_pointer_v) return typeid_name>() + "*"; else if constexpr (std::is_lvalue_reference_v) return typeid_name>() + "&"; else if constexpr (std::is_rvalue_reference_v) return typeid_name>() + "&&"; else if constexpr (std::is_function_v) return typeid_func_name::str(); else if constexpr (std::is_same_v) return "void"; else if constexpr (std::is_same_v) return "std::string"; else if constexpr (std::is_same_v) return "color4"; else if constexpr (std::is_same_v) return "float"; else if constexpr (std::is_same_v) return "int"; else if constexpr (std::is_same_v) return "float"; else if constexpr (std::is_same_v) return "double"; else if constexpr (std::is_same_v) return "size_t"; else if constexpr (std::is_same_v) return "bool"; else if constexpr (std::is_same_v || std::is_same_v) return "ImVec2"; else if constexpr (std::is_same_v) return "ImFont*"; else if constexpr (std::is_same_v>) return "std::vector"; else { std::string str = typeid(T).name(); #ifdef WIN32 auto i = str.find(' '); if (i != std::string::npos) str.erase(0, i + 1); //erase leading struct etc. #else int status; char* ptr = abi::__cxa_demangle(str.c_str(), nullptr, nullptr, &status); str = ptr; free(ptr); #endif return str; } } template struct typeid_func_name { static std::string str() { return typeid_name() + "()"; } }; template struct typeid_func_name { static std::string str() { return typeid_name() + "(" + typeid_name() + ")"; } };