整理代码

This commit is contained in:
蒲爽 2026-09-28 21:33:04 +08:00
commit c7b4e178ec
364 changed files with 59691 additions and 0 deletions

68
util/ClassAssistant.h Normal file
View file

@ -0,0 +1,68 @@
#ifndef AD5404F9_7A8A_45FF_8ABE_66F7E9E53212
#define AD5404F9_7A8A_45FF_8ABE_66F7E9E53212
/*
*******************************************************************************
* INCLUDE
*******************************************************************************
*/
#include <cxxabi.h>
#include <string>
#include <typeinfo>
/*
*******************************************************************************
* MACROS
*******************************************************************************
*/
#define PROPERTY_DECLARE(name, type, defaultValue, setAccessibility, getAccessibility) \
private: \
type _##name = defaultValue; \
setAccessibility: \
void set##name(const type& value) \
{ \
_##name = value; \
} \
getAccessibility: \
type get##name() \
{ \
return _##name; \
}
#define READONLY_PROPERTY_DECLARE(name, type) \
private: \
type _##name; \
\
public: \
const type& name() \
{ \
return _##name; \
}
namespace Util
{
/*
*******************************************************************************
* FUNCTIONS
*******************************************************************************
*/
class ClassAssistant
{
public:
template <typename T> static std::string demangle();
template <typename T> static std::string demangle(const T& object);
static std::string demangle(const std::type_info& ti);
};
template <typename T> std::string ClassAssistant::demangle()
{
return demangle(typeid(T));
}
template <typename T> inline std::string ClassAssistant::demangle(const T& object)
{
return demangle(typeid(object));
}
}
#endif