Skip to content

Commit

Permalink
added asserts to type.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
silverqx committed Aug 17, 2022
1 parent cc9327a commit 4474006
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/orm/utils/type.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ QString Type::prettyFunction(const QString &function)
"Unsupported compiler in Utils::Type::prettyFunction().");
#endif

Q_ASSERT_X(!function.isEmpty(), "empty string",
"The function name can't be empty in Utils::Type::prettyFunction().");

const auto match = regex.match(function);

// This should never happen, but who knows 🤔
Expand Down Expand Up @@ -118,6 +121,9 @@ Type::classPureBasenameInternal(const char *typeName, const bool withNamespace)
QString
Type::classPureBasenameMsvc(const QString &className, const bool withNamespace)
{
Q_ASSERT_X(!className.isEmpty(), "empty string",
"The class name can't be empty in Utils::Type::classPureBasenameMsvc().");

auto findBeginWithoutNS = [&className]
{
return className.indexOf(SPACE) + 1;
Expand Down Expand Up @@ -158,6 +164,9 @@ Type::classPureBasenameMsvc(const QString &className, const bool withNamespace)
QString
Type::classPureBasenameGcc(const QString &className, const bool withNamespace)
{
Q_ASSERT_X(!className.isEmpty(), "empty string",
"The class name can't be empty in Utils::Type::classPureBasenameGcc().");

// Find the beginning of the class name
const auto *itBegin = className.cbegin();

Expand Down

0 comments on commit 4474006

Please sign in to comment.