Implements string operations in the UPnP library.
More...
|
| typedef struct s_UpnpString | UpnpString |
| | Type of the string objects inside libupnp. More...
|
| |
|
| UpnpString * | UpnpString_new (void) |
| | Constructor. More...
|
| |
| void | UpnpString_delete (UpnpString *p) |
| | Destructor. More...
|
| |
| UpnpString * | UpnpString_dup (const UpnpString *p) |
| | Copy Constructor. More...
|
| |
| void | UpnpString_assign (UpnpString *p, const UpnpString *q) |
| | Assignment operator. More...
|
| |
| size_t | UpnpString_get_Length (const UpnpString *p) |
| | Returns the length of the string. More...
|
| |
| void | UpnpString_set_Length (UpnpString *p, size_t n) |
| | Truncates the string to the specified lenght, or does nothing if the current lenght is less than or equal to the requested length. More...
|
| |
| const char * | UpnpString_get_String (const UpnpString *p) |
| | Returns the pointer to char. More...
|
| |
| int | UpnpString_set_String (UpnpString *p, const char *s) |
| | Sets the string from a pointer to char. More...
|
| |
| int | UpnpString_set_StringN (UpnpString *p, const char *s, size_t n) |
| | Sets the string from a pointer to char using a maximum of N chars. More...
|
| |
| void | UpnpString_clear (UpnpString *p) |
| | Clears the string, sets its size to zero. More...
|
| |
| int | UpnpString_cmp (UpnpString *p, UpnpString *q) |
| | Compares two strings for equality. Case matters. More...
|
| |
| int | UpnpString_casecmp (UpnpString *p, UpnpString *q) |
| | Compares two strings for equality. Case does not matter. More...
|
| |
|
static size_t | strnlen (const char *s, size_t n) |
| |
|
static char * | strndup (const char *__string, size_t __n) |
| |
Implements string operations in the UPnP library.
- Author
- Marcelo Roberto Jimenez
- Version
- 1.0
Due to its heavy use, this class is coded for efficiency, not for beauty. Do not use this as example to other classes. Please take a look at any other one.
- Todo:
- Always alloc a minimum size like 64 bytes or so and when shrinking do not perform a new memory allocation.
◆ UpnpString
Type of the string objects inside libupnp.
◆ UpnpString_assign()
◆ UpnpString_casecmp()
Compares two strings for equality. Case does not matter.
- Returns
- The result of strcasecmp().
- Parameters
-
| [in] | p | The the first string. |
| [in] | q | The the second string. |
References UpnpString_get_String().
◆ UpnpString_clear()
Clears the string, sets its size to zero.
- Parameters
-
◆ UpnpString_cmp()
Compares two strings for equality. Case matters.
- Returns
- The result of strcmp().
- Parameters
-
| [in] | p | The the first string. |
| [in] | q | The the second string. |
References UpnpString_get_String().
◆ UpnpString_delete()
◆ UpnpString_dup()
◆ UpnpString_get_Length()
| size_t UpnpString_get_Length |
( |
const UpnpString * |
p | ) |
|
Returns the length of the string.
- Returns
- The length of the string.
- Parameters
-
◆ UpnpString_get_String()
| const char * UpnpString_get_String |
( |
const UpnpString * |
p | ) |
|
◆ UpnpString_new()
◆ UpnpString_set_Length()
| void UpnpString_set_Length |
( |
UpnpString * |
p, |
|
|
size_t |
n |
|
) |
| |
Truncates the string to the specified lenght, or does nothing if the current lenght is less than or equal to the requested length.
- Parameters
-
| [in] | p | The this pointer. |
| [in] | n | The requested length. |
References SUpnpString::m_length.
◆ UpnpString_set_String()
| int UpnpString_set_String |
( |
UpnpString * |
p, |
|
|
const char * |
s |
|
) |
| |
◆ UpnpString_set_StringN()
| int UpnpString_set_StringN |
( |
UpnpString * |
p, |
|
|
const char * |
s, |
|
|
size_t |
n |
|
) |
| |
Sets the string from a pointer to char using a maximum of N chars.
- Parameters
-
| [in] | p | The this pointer. |
| [in] | s | (char *) to copy from. |
| n | Maximum number of chars to copy. |