57 static const std::regex re(R
"(^[a-zA-Z_][a-zA-Z0-9_]*(?:\[\d+\])*$)");
59 if(!std::regex_match(identifier,
m, re)) {
61 throw std::invalid_argument(
"Invalid identifier");
91 if constexpr(std::is_integral_v<T>) {
93 int res = std::stoi(str, &pos);
94 if(pos != str.length())
95 throw std::invalid_argument(
"Extra characters after integer");
97 }
else if constexpr(std::is_floating_point_v<T>) {
99 double res = std::stod(str, &pos);
100 if(pos != str.length())
101 throw std::invalid_argument(
"Extra characters after double");
103 }
else if constexpr(std::is_same_v<T, std::string>) {
124 size_t start = s.find_first_not_of(
" \t\r\n");
125 size_t end = s.find_last_not_of(
" \t\r\n");
126 return (start == std::string::npos) ?
"" : s.substr(start, end - start + 1);
#define IRSOL_LOG_ERROR(...)
Logs an error-level message using the default logger.
#define IRSOL_LOG_TRACE(...)
Logs a trace-level message using the default logger.
Logging utilities and configuration for the irsol library.
Common portability and diagnostic macros for the irsol library.
#define IRSOL_MISSING_TEMPLATE_SPECIALIZATION(T, funcNameLiteral)
Emits a compile-time error when no template specialization is available.
std::string validateIdentifier(const std::string &identifier)
Validate that a string is a valid protocol identifier.
std::string trim(const std::string &s)
Remove leading and trailing whitespace from a string.
T fromString(const std::string &str)
Convert a string to a value of type T.
irsol::protocol::Assignment m(identifier, value)
Core type definitions for networking, time handling, and protocol values used throughout the irsol li...