#include <misc/string.h>
Go to the source code of this file.
Namespaces | |
namespace | misc |
Enumerations | |
enum | { misc::ctNone = 0, misc::ctLowerCase = 1, misc::ctUpperCase = 2 } |
Possible transformations for crc*_str() functions. More... | |
Functions | |
void | misc::absolute_path (char *buf, size_t len, char const *default_dir, char const *filename) |
Fills buf with the absolute path to filename. | |
cstring | misc::absolute_path (char const *default_dir, char const *filename) |
Generates a string with the absolute path to filename. | |
std::string | misc::absolute_path (std::string const &default_dir, std::string const &filename) |
Same as absolute_path(char const *, char const *), but with std::string's. | |
size_t | misc::base64_decode (char const *input, size_t input_len, char *output) |
Decodes the input from base64. | |
size_t | misc::base64_encode (char const *input, size_t input_len, char *output) |
Encodes the input in base64. | |
size_t | misc::base64_decode_str (char const *input, size_t input_len, char *output) |
Like base64_decode, but the output buffer will be NULL terminated. | |
size_t | misc::base64_encode_str (char const *input, size_t input_len, char *output) |
Like base64_encode, but the output buffer will be NULL terminated. | |
uint16_t | misc::crc16 (char const *buf, size_t len, uint16_t start=0) |
Computes the CRC16 checksum of the given buffer. | |
uint16_t | misc::crc16_str (char const *s, int trans=ctNone) |
Computes the CRC16 checksum of a NULL-terminated string. | |
uint32_t | misc::crc32 (char const *buf, size_t len, uint32_t start=0xFFFFFFFF, bool last=true) |
Computes the CRC32 checksum of the given buffer. | |
uint32_t | misc::crc32_str (char const *s, int trans=ctNone) |
Computes the CRC32 checksum of a NULL-terminated string. | |
uint16_t | misc::crc_ccitt (char const *buf, size_t len, uint16_t start=0xFFFF) |
Computes the CRC-CCITT checksum of the given buffer. | |
uint16_t | misc::crc_ccitt_str (char const *s, int trans=ctNone) |
Computes the CRC-CCITT checksum of a NULL-terminated string. | |
uint16_t | misc::crc_dnp (char const *buf, size_t len, uint16_t start=0, bool last=true) |
Computes the CRC-DNP checksum of the given buffer. | |
uint16_t | misc::crc_dnp_str (char const *s, int trans=ctNone) |
Computes the CRC-DNP checksum of a NULL-terminated string. | |
char * | misc::duration_expr (char *buf, size_t len, time_t secs) |
Converts a number of seconds to a duration expression. | |
bool | misc::duration_scan (char const *expr, time_t *secs) |
Scans a string expression of a duration. | |
bool | misc::dir_exists (char const *dirname) |
Determines whether the given directory exists. | |
bool | misc::file_exists (char const *filename) |
Determines whether the given file exists. | |
bool | misc::match (char const *pattern, char const *str, bool cs=false) |
Matches a string against a pattern. | |
bool | misc::irc_match (char const *pattern, char const *str) |
Same as match but optimized and suited for IRC (always case-insensitive). | |
bool | misc::simple_range (char const *expr, unsigned long *first, unsigned long *last, bool desc=false) |
Converts a simple range expression. | |
bool | misc::complex_range (char const **expr, unsigned long *first, unsigned long *last, bool desc=false) |
Converts a complex range expression. | |
bool | misc::recursive_mkdir (char const *pathname, mode_t mode) |
Creates a directory recursively. | |
bool | misc::resolve_error (char *buf, size_t len, int err) |
Gets resolve error message. | |
bool | misc::resolve_host (char const *host, struct in_addr *in, int *err) |
Resolves a hostname. |