8#ifndef SEN_LIBS_CORE_SRC_META_UTILS_H
9#define SEN_LIBS_CORE_SRC_META_UTILS_H
21inline std::string capitalize(
const std::string& str)
noexcept
25 std::string result = str;
26 result.at(0) =
static_cast<char>(std::toupper(str.at(0U)));
31inline bool isLower(
char ch)
noexcept {
return std::islower(
static_cast<unsigned char>(ch)) != 0; }
34inline bool isDigit(
char ch)
noexcept {
return std::isdigit(
static_cast<unsigned char>(ch)) != 0; }
37inline void checkIdentifier(std::string_view name,
bool isQualifiedName =
false)
47 if (impl::isDigit(name.at(0U)))
53 if (name.find_first_of(
' ') != std::string::npos)
59 if (
auto pos = name.find_first_not_of(
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_");
60 pos != std::string::npos)
63 if (!isQualifiedName || name[pos] !=
'.')
66 err.append(
"invalid character '");
67 err.append(1, name[pos]);
69 err.append(
" in identifier: ");
77inline void checkMemberName(
const std::string& name)
79 checkIdentifier(name);
82 if (!impl::isLower(name.at(0U)))
89inline void checkUserTypeName(
const std::string& name)
91 checkIdentifier(name);
94 if (impl::isLower(name.at(0U)))
The following macros implement a replacement of assert that is connected to the overall fault handlin...
#define SEN_EXPECT(expr)
Checks a pre-condition of a procedure (function parameter for example). NOLINTNEXTLINE.
Definition assert.h:36
void throwRuntimeError(const std::string &err)
Throws std::exception that attempts to collect the stack trace. We also wrap it to avoid including st...