|
mUPnP for C
|
Data Structures | |
| struct | _mUpnpString |
| struct | _mUpnpStringTokenizer |
Macros | |
| #define | MUPNP_STRING_MEMORY_ALLOCATION_UNIT 64 |
| #define | MUPNP_STRING_INTEGER_BUFLEN 16 |
| #define | MUPNP_STRING_LONG_BUFLEN 32 |
| #define | MUPNP_STRING_LONGLONG_BUFLEN 32 |
| #define | MUPNP_STRING_FLOAT_BUFLEN 64 |
| #define | MUPNP_STRING_DOUBLE_BUFLEN 64 |
| #define | mupnp_str2int(value) |
| Convert string to integer (NULL-safe) | |
| #define | mupnp_str2long(value) |
| Convert string to long (NULL-safe) | |
| #define | mupnp_strhex2long(value) |
| Convert hexadecimal string to long (NULL-safe) | |
| #define | mupnp_strhex2ulong(value) |
| Convert hexadecimal string to unsigned long (NULL-safe) | |
| #define | mupnp_str2float(value) |
| Convert string to float (NULL-safe) | |
| #define | mupnp_str2double(value) |
| Convert string to double (NULL-safe) | |
| #define | mupnp_str2sizet(value) |
| Convert string to size_t (NULL-safe) | |
| #define | mupnp_str2ssizet(value) |
| Convert string to ssize_t (NULL-safe) | |
| #define | mupnp_string_getintvalue(str) |
| #define | mupnp_string_getlongvalue(str) |
| #define | mupnp_string_getfloatvalue(str) |
| #define | mupnp_string_getdoublevalue(str) |
Typedefs | |
| typedef struct _mUpnpString | mUpnpString |
| typedef struct _mUpnpStringTokenizer | mUpnpStringTokenizer |
Functions | |
| char * | mupnp_strdup (const char *str) |
| Duplicate a string (NULL-safe wrapper for strdup) | |
| size_t | mupnp_strlen (const char *str) |
| Get the length of a string (NULL-safe wrapper for strlen) | |
| char * | mupnp_strcpy (char *dest, const char *src) |
| Copy a string (NULL-safe wrapper for strcpy) | |
| char * | mupnp_strcat (char *dest, const char *src) |
| Concatenate strings (NULL-safe wrapper for strcat) | |
| int | mupnp_strcmp (const char *str1, const char *str2) |
| Compare two strings (NULL-safe wrapper for strcmp) | |
| int | mupnp_strncmp (const char *str1, const char *str2, int nchars) |
| Compare first n characters of two strings (NULL-safe) | |
| int | mupnp_strcasecmp (const char *str1, const char *str2) |
| Compare two strings case-insensitively (NULL-safe) | |
| bool | mupnp_streq (const char *str1, const char *str2) |
| Test if two strings are equal (NULL-safe) | |
| bool | mupnp_strcaseeq (const char *str1, const char *str2) |
| Test if two strings are equal case-insensitively (NULL-safe) | |
| ssize_t | mupnp_strchr (const char *str, const char *chars, size_t nchars) |
| Find first occurrence of any character from a set (strcspn variant) | |
| ssize_t | mupnp_strrchr (const char *str, const char *chars, size_t nchars) |
| Find last occurrence of any character from a set. | |
| ssize_t | mupnp_strstr (const char *haystack, const char *needle) |
| Find substring (NULL-safe wrapper for strstr) | |
| char * | mupnp_strtrimwhite (char *str) |
| Trim whitespace from both ends of a string (in-place) | |
| char * | mupnp_strtrim (char *str, char *delim, size_t ndelim) |
| Trim specified delimiter characters from both ends (in-place) | |
| char * | mupnp_strltrim (char *str, char *delim, size_t ndelim) |
| Trim delimiter characters from the left (start) of string (in-place) | |
| char * | mupnp_strrtrim (char *str, char *delim, size_t ndelim) |
| Trim delimiter characters from the right (end) of string (in-place) | |
| char * | mupnp_strncpy (char *str1, const char *str2, size_t cnt) |
| Copy at most n characters from one string to another (NULL-safe) | |
| char * | mupnp_strncat (char *str1, const char *str2, size_t cnt) |
| Append at most n characters from one string to another (NULL-safe) | |
| const char * | mupnp_int2str (int value, char *buf, size_t bufSize) |
| Convert integer to string. | |
| const char * | mupnp_long2str (long value, char *buf, size_t bufSize) |
| Convert long integer to string. | |
| const char * | mupnp_float2str (float value, char *buf, size_t bufSize) |
| Convert float to string. | |
| const char * | mupnp_double2str (double value, char *buf, size_t bufSize) |
| Convert double to string. | |
| const char * | mupnp_sizet2str (size_t value, char *buf, size_t bufSize) |
| Convert size_t to string. | |
| const char * | mupnp_ssizet2str (ssize_t value, char *buf, size_t bufSize) |
| Convert ssize_t to string. | |
| mUpnpStringTokenizer * | mupnp_string_tokenizer_new (const char *str, const char *delim) |
| void | mupnp_string_tokenizer_delete (mUpnpStringTokenizer *strToken) |
| bool | mupnp_string_tokenizer_hasmoretoken (mUpnpStringTokenizer *strToken) |
| char * | mupnp_string_tokenizer_nexttoken (mUpnpStringTokenizer *strToken) |
| char * | mupnp_string_tokenizer_nextalltoken (mUpnpStringTokenizer *strToken) |
| void | mupnp_string_tokenizer_print (mUpnpStringTokenizer *strToken) |
| mUpnpString * | mupnp_string_new (void) |
| void | mupnp_string_delete (mUpnpString *str) |
| void | mupnp_string_clear (mUpnpString *str) |
| void | mupnp_string_setvalue (mUpnpString *str, const char *value) |
| void | mupnp_string_setintvalue (mUpnpString *str, int value) |
| void | mupnp_string_setlongvalue (mUpnpString *str, long value) |
| void | mupnp_string_setfloatvalue (mUpnpString *str, float value) |
| void | mupnp_string_setdoublevalue (mUpnpString *str, double value) |
| void | mupnp_string_setnvalue (mUpnpString *str, const char *value, size_t len) |
| void | mupnp_string_setpointervalue (mUpnpString *str, char *value, size_t len) |
| char * | mupnp_string_getvalue (mUpnpString *str) |
| size_t | mupnp_string_length (mUpnpString *str) |
| char * | mupnp_string_addvalue (mUpnpString *str, const char *value) |
| char * | mupnp_string_naddvalue (mUpnpString *str, const char *value, size_t valueLen) |
| char * | mupnp_string_addrepvalue (mUpnpString *str, const char *value, size_t repeatCnt) |
| char * | mupnp_string_naddrepvalue (mUpnpString *str, const char *value, size_t valueLen, size_t repeatCnt) |
| char * | mupnp_string_replace (mUpnpString *str, char *fromStr[], char *toStr[], size_t fromStrCnt) |
| size_t | mupnp_string_getmemorysize (mUpnpString *str) |
| #define mupnp_str2double | ( | value | ) |
Convert string to double (NULL-safe)
| value | String to convert. May be NULL. |
| #define mupnp_str2float | ( | value | ) |
Convert string to float (NULL-safe)
| value | String to convert. May be NULL. |
| #define mupnp_str2int | ( | value | ) |
Convert string to integer (NULL-safe)
| value | String to convert. May be NULL. |
| #define mupnp_str2long | ( | value | ) |
Convert string to long (NULL-safe)
| value | String to convert. May be NULL. |
| #define mupnp_str2sizet | ( | value | ) |
Convert string to size_t (NULL-safe)
| value | String to convert. May be NULL. |
| #define mupnp_str2ssizet | ( | value | ) |
Convert string to ssize_t (NULL-safe)
| value | String to convert. May be NULL. |
| #define mupnp_strhex2long | ( | value | ) |
Convert hexadecimal string to long (NULL-safe)
| value | Hexadecimal string to convert (e.g., "1A3F"). May be NULL. |
| #define mupnp_strhex2ulong | ( | value | ) |
Convert hexadecimal string to unsigned long (NULL-safe)
| value | Hexadecimal string to convert. May be NULL. |
| #define MUPNP_STRING_DOUBLE_BUFLEN 64 |
| #define MUPNP_STRING_FLOAT_BUFLEN 64 |
| #define mupnp_string_getdoublevalue | ( | str | ) |
| #define mupnp_string_getfloatvalue | ( | str | ) |
| #define mupnp_string_getintvalue | ( | str | ) |
| #define mupnp_string_getlongvalue | ( | str | ) |
| #define MUPNP_STRING_INTEGER_BUFLEN 16 |
| #define MUPNP_STRING_LONG_BUFLEN 32 |
| #define MUPNP_STRING_LONGLONG_BUFLEN 32 |
| #define MUPNP_STRING_MEMORY_ALLOCATION_UNIT 64 |
| typedef struct _mUpnpString mUpnpString |
| typedef struct _mUpnpStringTokenizer mUpnpStringTokenizer |
| const char * mupnp_double2str | ( | double | value, |
| char * | buf, | ||
| size_t | bufSize ) |
Convert double to string.
| value | The double value to convert. |
| buf | Buffer to store the result. Must not be NULL. |
| bufSize | Size of buf in bytes. Should be at least MUPNP_STRING_DOUBLE_BUFLEN (64) to safely hold any double. |
| const char * mupnp_float2str | ( | float | value, |
| char * | buf, | ||
| size_t | bufSize ) |
Convert float to string.
| value | The float value to convert. |
| buf | Buffer to store the result. Must not be NULL. |
| bufSize | Size of buf in bytes. Should be at least MUPNP_STRING_FLOAT_BUFLEN (64) to safely hold any float. |
| const char * mupnp_int2str | ( | int | value, |
| char * | buf, | ||
| size_t | bufSize ) |
Convert integer to string.
| value | The integer value to convert. |
| buf | Buffer to store the result. Must not be NULL. |
| bufSize | Size of buf in bytes. Should be at least MUPNP_STRING_INTEGER_BUFLEN (16) to safely hold any int. |
| const char * mupnp_long2str | ( | long | value, |
| char * | buf, | ||
| size_t | bufSize ) |
Convert long integer to string.
| value | The long value to convert. |
| buf | Buffer to store the result. Must not be NULL. |
| bufSize | Size of buf in bytes. Should be at least MUPNP_STRING_LONG_BUFLEN (32) to safely hold any long. |
| const char * mupnp_sizet2str | ( | size_t | value, |
| char * | buf, | ||
| size_t | bufSize ) |
Convert size_t to string.
| value | The size_t value to convert. |
| buf | Buffer to store the result. Must not be NULL. |
| bufSize | Size of buf in bytes. Should be at least MUPNP_STRING_LONG_BUFLEN (32) bytes. |
| const char * mupnp_ssizet2str | ( | ssize_t | value, |
| char * | buf, | ||
| size_t | bufSize ) |
Convert ssize_t to string.
| value | The ssize_t value to convert. |
| buf | Buffer to store the result. Must not be NULL. |
| bufSize | Size of buf in bytes. Should be at least MUPNP_STRING_LONG_BUFLEN (32) bytes. |
| int mupnp_strcasecmp | ( | const char * | str1, |
| const char * | str2 ) |
Compare two strings case-insensitively (NULL-safe)
| str1 | First string. May be NULL. |
| str2 | Second string. May be NULL. |
| bool mupnp_strcaseeq | ( | const char * | str1, |
| const char * | str2 ) |
Test if two strings are equal case-insensitively (NULL-safe)
| str1 | First string. May be NULL. |
| str2 | Second string. May be NULL. |
| char * mupnp_strcat | ( | char * | dest, |
| const char * | src ) |
Concatenate strings (NULL-safe wrapper for strcat)
| dest | Destination buffer. Must not be NULL and must have sufficient space. |
| src | Source string to append. May be NULL (no-op if NULL). |
| ssize_t mupnp_strchr | ( | const char * | str, |
| const char * | chars, | ||
| size_t | nchars ) |
Find first occurrence of any character from a set (strcspn variant)
| str | The string to search. Must not be NULL. |
| chars | Array of characters to search for. Must not be NULL. |
| nchars | Number of characters in chars array. |
| int mupnp_strcmp | ( | const char * | str1, |
| const char * | str2 ) |
Compare two strings (NULL-safe wrapper for strcmp)
| str1 | First string. May be NULL. |
| str2 | Second string. May be NULL. |
| char * mupnp_strcpy | ( | char * | dest, |
| const char * | src ) |
Copy a string (NULL-safe wrapper for strcpy)
| dest | Destination buffer. Must not be NULL and must be large enough. |
| src | Source string. May be NULL (dest will be set to empty string). |
| char * mupnp_strdup | ( | const char * | str | ) |
Duplicate a string (NULL-safe wrapper for strdup)
Allocates memory and creates a copy of the input string. The caller is responsible for freeing the returned string with free().
| str | The string to duplicate. May be NULL. |
| bool mupnp_streq | ( | const char * | str1, |
| const char * | str2 ) |
Test if two strings are equal (NULL-safe)
| str1 | First string. May be NULL. |
| str2 | Second string. May be NULL. |
| char * mupnp_string_addrepvalue | ( | mUpnpString * | str, |
| const char * | value, | ||
| size_t | repeatCnt ) |
| char * mupnp_string_addvalue | ( | mUpnpString * | str, |
| const char * | value ) |
| void mupnp_string_clear | ( | mUpnpString * | str | ) |
| void mupnp_string_delete | ( | mUpnpString * | str | ) |
| size_t mupnp_string_getmemorysize | ( | mUpnpString * | str | ) |
| char * mupnp_string_getvalue | ( | mUpnpString * | str | ) |
| size_t mupnp_string_length | ( | mUpnpString * | str | ) |
| char * mupnp_string_naddrepvalue | ( | mUpnpString * | str, |
| const char * | value, | ||
| size_t | valueLen, | ||
| size_t | repeatCnt ) |
| char * mupnp_string_naddvalue | ( | mUpnpString * | str, |
| const char * | value, | ||
| size_t | valueLen ) |
| mUpnpString * mupnp_string_new | ( | void | ) |
| char * mupnp_string_replace | ( | mUpnpString * | str, |
| char * | fromStr[], | ||
| char * | toStr[], | ||
| size_t | fromStrCnt ) |
| void mupnp_string_setdoublevalue | ( | mUpnpString * | str, |
| double | value ) |
| void mupnp_string_setfloatvalue | ( | mUpnpString * | str, |
| float | value ) |
| void mupnp_string_setintvalue | ( | mUpnpString * | str, |
| int | value ) |
| void mupnp_string_setlongvalue | ( | mUpnpString * | str, |
| long | value ) |
| void mupnp_string_setnvalue | ( | mUpnpString * | str, |
| const char * | value, | ||
| size_t | len ) |
| void mupnp_string_setpointervalue | ( | mUpnpString * | str, |
| char * | value, | ||
| size_t | len ) |
| void mupnp_string_setvalue | ( | mUpnpString * | str, |
| const char * | value ) |
| void mupnp_string_tokenizer_delete | ( | mUpnpStringTokenizer * | strToken | ) |
| bool mupnp_string_tokenizer_hasmoretoken | ( | mUpnpStringTokenizer * | strToken | ) |
| mUpnpStringTokenizer * mupnp_string_tokenizer_new | ( | const char * | str, |
| const char * | delim ) |
| char * mupnp_string_tokenizer_nextalltoken | ( | mUpnpStringTokenizer * | strToken | ) |
| char * mupnp_string_tokenizer_nexttoken | ( | mUpnpStringTokenizer * | strToken | ) |
| void mupnp_string_tokenizer_print | ( | mUpnpStringTokenizer * | strToken | ) |
| size_t mupnp_strlen | ( | const char * | str | ) |
Get the length of a string (NULL-safe wrapper for strlen)
| str | The string to measure. May be NULL. |
| char * mupnp_strltrim | ( | char * | str, |
| char * | delim, | ||
| size_t | ndelim ) |
Trim delimiter characters from the left (start) of string (in-place)
| str | The string to trim. Must not be NULL. Will be modified. |
| delim | Array of delimiter characters to remove. Must not be NULL. |
| ndelim | Number of characters in delim array. |
| char * mupnp_strncat | ( | char * | str1, |
| const char * | str2, | ||
| size_t | cnt ) |
Append at most n characters from one string to another (NULL-safe)
| str1 | Destination buffer. Must not be NULL and must have sufficient space. |
| str2 | Source string to append. May be NULL (no-op if NULL). |
| cnt | Maximum number of characters to append (excluding null terminator). |
| int mupnp_strncmp | ( | const char * | str1, |
| const char * | str2, | ||
| int | nchars ) |
Compare first n characters of two strings (NULL-safe)
| str1 | First string. May be NULL. |
| str2 | Second string. May be NULL. |
| nchars | Maximum number of characters to compare. |
| char * mupnp_strncpy | ( | char * | str1, |
| const char * | str2, | ||
| size_t | cnt ) |
Copy at most n characters from one string to another (NULL-safe)
| str1 | Destination buffer. Must not be NULL and must have space for cnt+1 bytes. |
| str2 | Source string. May be NULL (str1 will be set to empty string). |
| cnt | Maximum number of characters to copy (excluding null terminator). |
| ssize_t mupnp_strrchr | ( | const char * | str, |
| const char * | chars, | ||
| size_t | nchars ) |
Find last occurrence of any character from a set.
| str | The string to search. Must not be NULL. |
| chars | Array of characters to search for. Must not be NULL. |
| nchars | Number of characters in chars array. |
| char * mupnp_strrtrim | ( | char * | str, |
| char * | delim, | ||
| size_t | ndelim ) |
Trim delimiter characters from the right (end) of string (in-place)
| str | The string to trim. Must not be NULL. Will be modified. |
| delim | Array of delimiter characters to remove. Must not be NULL. |
| ndelim | Number of characters in delim array. |
| ssize_t mupnp_strstr | ( | const char * | haystack, |
| const char * | needle ) |
Find substring (NULL-safe wrapper for strstr)
| haystack | The string to search in. May be NULL. |
| needle | The substring to search for. May be NULL. |
| char * mupnp_strtrim | ( | char * | str, |
| char * | delim, | ||
| size_t | ndelim ) |
Trim specified delimiter characters from both ends (in-place)
| str | The string to trim. Must not be NULL. Will be modified. |
| delim | Array of delimiter characters to remove. Must not be NULL. |
| ndelim | Number of characters in delim array. |
| char * mupnp_strtrimwhite | ( | char * | str | ) |
Trim whitespace from both ends of a string (in-place)
Removes leading and trailing whitespace characters (space, tab, newline, carriage return) from the string by modifying it in place.
| str | The string to trim. Must not be NULL. Will be modified. |