avoided implicit QString(char *) conversion

This commit is contained in:
silverqx
2023-12-06 18:01:50 +01:00
parent 1f5253eb35
commit 4fbf5b774b

View File

@@ -30,7 +30,7 @@ TINYORM_BEGIN_COMMON_NAMESPACE
# define __tiny_func__ \
Orm::Utils::Type::prettyFunction(static_cast<const char *>(__FUNCTION__))
#else
# define __tiny_func__ QString {__FUNCTION__}
# define __tiny_func__ QString::fromUtf8(__FUNCTION__)
#endif
namespace Orm::Utils
@@ -60,6 +60,8 @@ namespace Orm::Utils
/*! Return a pretty function name in the following format: Xyz::function. */
static QString prettyFunction(const QString &function);
/*! Return a pretty function name in the following format: Xyz::function. */
inline static QString prettyFunction(const char *function);
/*! Determine if a string is the true bool value (false for "", '0', "false",
"off"). */
@@ -109,6 +111,11 @@ namespace Orm::Utils
return classPureBasenameInternal(typeid (type), withNamespace);
}
QString Type::prettyFunction(const char *const function)
{
return prettyFunction(QString::fromUtf8(function));
}
} // namespace Orm::Utils
TINYORM_END_COMMON_NAMESPACE