![]() |
MantisBase v0.4.9
|
#include "../../include/mantisbase/utils/utils.h"#include "../../include/mantisbase/core/exceptions.h"#include <algorithm>#include <regex>#include <unordered_map>#include <unordered_set>
Namespaces | |
| namespace | mb |
Functions | |
| MANTISBASE_API std::string | mb::sqlIdentifier (const std::string &ident) |
| Validate a string as a safe SQL identifier and return it unchanged. | |
| MANTISBASE_API std::pair< json, std::string > | mb::tryParseJsonStr (const std::string &json_str) |
| Try parsing a string to a JSON object and return the object and any error if parsing failed. | |
| MANTISBASE_API bool | mb::strToBool (const std::string &value) |
| Convert given string value to boolean type. | |
| MANTISBASE_API void | mb::toLowerCase (std::string &str) |
| Converts a string to its lowercase variant. | |
| MANTISBASE_API void | mb::toUpperCase (std::string &str) |
| Converts a string to its uppercase variant. | |
| MANTISBASE_API std::string | mb::trim (const std::string &s) |
| Trims leading and trailing whitespaces from a string. | |
| MANTISBASE_API std::string | mb::generateTimeBasedId () |
| Generate a time base UUID. | |
| MANTISBASE_API std::string | mb::generateReadableTimeId () |
| Generates a readable time-based UUID. | |
| MANTISBASE_API std::string | mb::generateShortId (size_t length=16) |
| Generates a short UUID. | |
| MANTISBASE_API std::vector< std::string > | mb::splitString (const std::string &input, const std::string &delimiter) |
| Split given string based on given delimiter. | |
| MANTISBASE_API std::string | mb::getEnvOrDefault (const std::string &key, const std::string &defaultValue) |
| Retrieves a value from an environment variable or a default value if the env variable was not set. | |
| MANTISBASE_API bool | mb::invalidChar (unsigned char c) |
| Check if a character is invalid in a filename. | |
| MANTISBASE_API void | mb::sanitizeInPlace (std::string &s) |
| Sanitize a string in-place by removing or replacing invalid characters. | |
| MANTISBASE_API bool | mb::isAllowedFileExtension (const std::string &extension) |
| MANTISBASE_API std::string | mb::safeContentType (const std::string &extension) |
| MANTISBASE_API std::string | mb::sanitizeFilename (std::string_view original, std::size_t maxLen=50, std::size_t idLen=12, std::string_view idSep="_") |
| Sanitize a filename and ensure uniqueness. | |
| std::string | mb::sanitizeFilename_JSWrapper (const std::string &original) |
| int | mb::safe_stoi (const std::string &s, const int default_val) |
| Safely convert string to integer with default fallback. | |
| MANTISBASE_API bool | mb::isValidIPv4 (const std::string &ip) |
| Validates if a string is a valid IPv4 address. | |
| MANTISBASE_API bool | mb::isValidIPv6 (const std::string &ip) |
| Validates if a string is a valid IPv6 address. | |
| MANTISBASE_API bool | mb::isValidIP (const std::string &ip) |
| Validates if a string is a valid IP address (IPv4 or IPv6). | |