Functions | |
| void | regexReplaceCallback (std::string &s, std::regex const &rgx, std::function< std::string(std::vector< std::string > const &)> const &fmt) | 
| std::string | hexDump (std::string const &in) | 
| std::string | toLowercase (std::string s) | 
| std::string | toUppercase (std::string s) | 
| std::string | generateErrorPage (unsigned int httpStatus) | 
| std::string | getFileExtension (std::string const &filename) | 
| std::string | contentTypeByExtension (std::string extension) | 
| std::string | makeHttpTime (time_t time) | 
| time_t | readHttpTime (std::string const &httpTime) | 
| std::string | makeSmtpTime (time_t time) | 
| time_t | readSmtpTime (std::string const &smtpTime) | 
| std::vector< std::string > | splitString (std::string str, char delimiter, bool ignoreEmpty=false) | 
| std::string | mergePath (std::vector< std::string > const &path) | 
| std::vector< std::string > | splitPath (std::string const &pathString) | 
| std::string | convertLineEndings (std::string const &in, std::string const &ending) | 
| std::string | getFileContents (std::string const &path) | 
| std::string | stringReplace (std::string input, std::unordered_map< char, char > const &patterns) | 
| std::string | stringReplace (std::string input, std::unordered_map< std::string, std::string > const &patterns) | 
| std::unordered_multimap< std::string, std::string > | splitQueryString (std::string const &queryString) | 
| std::unordered_map< std::string, std::string > | parseHeaders (std::string rawHeaders) | 
| std::unordered_multimap< std::string, std::string > | parseCookies (std::string const &rawCookies) | 
| template<typename KeyType , typename ValueType , template< typename, typename, typename... > class MapType, typename... Args> | |
| std::unordered_multimap< KeyType, ValueType > | toUnorderedMultimap (MapType< KeyType, ValueType, Args... > inputMap) | 
| void nawa::utils::regexReplaceCallback | ( | std::string & | s, | 
| std::regex const & | rgx, | ||
| std::function< std::string(std::vector< std::string > const &)> const & | fmt | ||
| ) | 
ASCII (byte-)string based regex_replace variant which takes a callback function as format parameter. This function may be used to generate individual replacements for each match.
| s | String in which the replacements should take place. | 
| rgx | std::regex object containing the regular expression to use for replacement. | 
| fmt | Callback function taking a reference to a string vector as a parameter and returning the replacement as a string. The vector contains the full match at index 0 and, if capturing groups are used in the expression, the submatches at the following indexes (capturing group 1 at index 1, ...) | 
| std::string nawa::utils::hexDump | ( | std::string const & | in | ) | 
| std::string nawa::utils::toLowercase | ( | std::string | s | ) | 
| std::string nawa::utils::toUppercase | ( | std::string | s | ) | 
| std::string nawa::utils::generateErrorPage | ( | unsigned int | httpStatus | ) | 
Generate a very basic HTML error page for a given HTTP status.
| httpStatus | The HTTP status. Currently supported: 400, 401, 403, 404, 405, 406, 408, 409, 410, 415, 418, 429, 451, 500, 501, 503. | 
| std::string nawa::utils::getFileExtension | ( | std::string const & | filename | ) | 
| std::string nawa::utils::contentTypeByExtension | ( | std::string | extension | ) | 
Get the MIME content type string for a particular file extension. This function checks the extension against a limited, incomplete set of file types (case-insensitive). If no match is found, "application/octet-stream" will be returned.
| extension | The file extension (without '.'). | 
| std::string nawa::utils::makeHttpTime | ( | time_t | time | ) | 
Convert a time_t value (UNIX timestamp) to a HTTP header compatible date/time string. May throw an Exception with error code 1 if interpretation of the UNIX timestamp fails.
| time | UNIX timestamp as a time_t value. | 
| time_t nawa::utils::readHttpTime | ( | std::string const & | httpTime | ) | 
Create a time_t value (UNIX timestamp) from a HTTP header date/time string. May throw an Exception with error code 1 if parsing fails.
| httpTime | Time string in the format: "<day-name(3)>, <day(2)> <month(3)> <year(4)> <hour(2)>:<minute(2)>:<second(2)> GMT". | 
| std::string nawa::utils::makeSmtpTime | ( | time_t | time | ) | 
Convert a time_t value (UNIX timestamp) to a SMTP header compatible date/time string. May throw an Exception with error code 1 if interpretation of the UNIX timestamp fails.
| time | UNIX timestamp as a time_t value. | 
| time_t nawa::utils::readSmtpTime | ( | std::string const & | smtpTime | ) | 
Create a time_t value (UNIX timestamp) from a SMTP header date/time string. May throw an Exception with error code 1 if parsing fails.
| smtpTime | Time string in the format: "<day-name(3)>, <day(1*2)> <month(3)> <year(4)> <hour(2)>:<minute(2)>:<second(2)> <tzoffset(5)>". | 
| std::vector< std::string > nawa::utils::splitString | ( | std::string | str, | 
| char | delimiter, | ||
| bool | ignoreEmpty = false  | 
        ||
| ) | 
| std::string nawa::utils::mergePath | ( | std::vector< std::string > const & | path | ) | 
Convert a vector representation of a path ({"dir1", "dir2"}) to a string representation ("/dir1/dir2"). An empty vector will result in the string representation "/".
| path | Vector representation of a path. | 
| std::vector< std::string > nawa::utils::splitPath | ( | std::string const & | pathString | ) | 
Convert a string representation of a path ("/dir1/dir2") to a vector representation ({"dir1", "dir2"}). Query strings (starting with '?') are being ignored and will not be part of the returned vector.
| pathString | Sting representation of the path. | 
| std::string nawa::utils::convertLineEndings | ( | std::string const & | in, | 
| std::string const & | ending | ||
| ) | 
| std::string nawa::utils::getFileContents | ( | std::string const & | path | ) | 
Simple function to read a whole file into a string. Will throw a nawa::Exception with error code 1 if the file does not exist.
| path | Path and filename. | 
| std::string nawa::utils::stringReplace | ( | std::string | input, | 
| std::unordered_map< char, char > const & | patterns | ||
| ) | 
Replace all occurrences of pattern keys by the corresponding pattern values in the input string.
| input | String in which the patterns shall be replaced. | 
| patterns | Map of key characters (to be replaced in the input string) and value characters (the replacements). | 
| std::string nawa::utils::stringReplace | ( | std::string | input, | 
| std::unordered_map< std::string, std::string > const & | patterns | ||
| ) | 
Replace all occurrences of pattern keys by the corresponding pattern values in the input string.
| input | String in which the patterns shall be replaced. | 
| patterns | Map of key strings (to be replaced in the input string) and value strings (the replacements). | 
| std::unordered_multimap< std::string, std::string > nawa::utils::splitQueryString | ( | std::string const & | queryString | ) | 
| std::unordered_map< std::string, std::string > nawa::utils::parseHeaders | ( | std::string | rawHeaders | ) | 
| std::unordered_multimap< std::string, std::string > nawa::utils::parseCookies | ( | std::string const & | rawCookies | ) | 
| std::unordered_multimap< KeyType, ValueType > nawa::utils::toUnorderedMultimap | ( | MapType< KeyType, ValueType, Args... > | inputMap | ) | 
Convert any iterable map to an unordered_multimap.
| KeyType | Key type (automatically deduced). | 
| ValueType | Value type (automatically deduced). | 
| MapType | Input map type (automatically deduced). | 
| Args | Further template arguments of map type (automatically deduced). | 
| inputMap | The input map to convert. |