Implements string operations in the UPnP library. More...
Classes | |
struct | s_UpnpString |
Internal implementation of the class UpnpString. More... | |
Typedefs | |
typedef struct s_UpnpString | UpnpString |
Type of the string objects inside libupnp. | |
Functions | |
PUPNP_Api UpnpString * | UpnpString_new (void) |
Constructor. | |
PUPNP_Api void | UpnpString_delete (UpnpString *p) |
Destructor. | |
PUPNP_Api UpnpString * | UpnpString_dup (const UpnpString *p) |
Copy Constructor. | |
PUPNP_Api void | UpnpString_assign (UpnpString *p, const UpnpString *q) |
Assignment operator. | |
PUPNP_Api size_t | UpnpString_get_Length (const UpnpString *p) |
Returns the length of the string. | |
PUPNP_Api 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. | |
PUPNP_Api const char * | UpnpString_get_String (const UpnpString *p) |
Returns the pointer to char. | |
PUPNP_Api int | UpnpString_set_String (UpnpString *p, const char *s) |
Sets the string from a pointer to char. | |
PUPNP_Api 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. | |
PUPNP_Api void | UpnpString_clear (UpnpString *p) |
Clears the string, sets its size to zero. | |
PUPNP_Api int | UpnpString_cmp (UpnpString *p, UpnpString *q) |
Compares two strings for equality. Case matters. | |
PUPNP_Api int | UpnpString_casecmp (UpnpString *p, UpnpString *q) |
Compares two strings for equality. Case does not matter. | |
static size_t | strnlen (const char *s, size_t n) |
strnlen() is a GNU extension and here provided for portability. | |
Implements string operations in the UPnP library.
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.
struct s_UpnpString |
Internal implementation of the class UpnpString.
Definition at line 74 of file UpnpString.cpp.
Class Members | ||
---|---|---|
size_t | m_length | Length of the string excluding terminating null byte ('\0'). |
char * | m_string | Pointer to a dynamically allocated area that holds the NULL terminated string. |
typedef struct s_UpnpString UpnpString |
Type of the string objects inside libupnp.
Definition at line 37 of file UpnpString.hpp.
UpnpString * UpnpString_new | ( | void | ) |
Constructor.
Definition at line 82 of file UpnpString.cpp.
void UpnpString_delete | ( | UpnpString * | p | ) |
Destructor.
[in] | p | The this pointer. |
Definition at line 108 of file UpnpString.cpp.
UpnpString * UpnpString_dup | ( | const UpnpString * | p | ) |
Copy Constructor.
[in] | p | The this pointer. |
Definition at line 122 of file UpnpString.cpp.
void UpnpString_assign | ( | UpnpString * | p, |
const UpnpString * | q | ||
) |
Assignment operator.
[in] | p | The this pointer. |
[in] | q | The that pointer. |
Definition at line 143 of file UpnpString.cpp.
size_t UpnpString_get_Length | ( | const UpnpString * | p | ) |
Returns the length of the string.
[in] | p | The this pointer. |
Definition at line 149 of file UpnpString.cpp.
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.
[in] | p | The this pointer. |
[in] | n | The requested length. |
Definition at line 155 of file UpnpString.cpp.
const char * UpnpString_get_String | ( | const UpnpString * | p | ) |
Returns the pointer to char.
[in] | p | The this pointer. |
Definition at line 164 of file UpnpString.cpp.
int UpnpString_set_String | ( | UpnpString * | p, |
const char * | s | ||
) |
Sets the string from a pointer to char.
[in] | p | The this pointer. |
[in] | s | (char *) to copy from. |
Definition at line 171 of file UpnpString.cpp.
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.
[in] | p | The this pointer. |
[in] | s | (char *) to copy from. |
n | Maximum number of chars to copy. |
Definition at line 185 of file UpnpString.cpp.
void UpnpString_clear | ( | UpnpString * | p | ) |
Clears the string, sets its size to zero.
[in] | p | The this pointer. |
Definition at line 199 of file UpnpString.cpp.
int UpnpString_cmp | ( | UpnpString * | p, |
UpnpString * | q | ||
) |
Compares two strings for equality. Case matters.
[in] | p | The the first string. |
[in] | q | The the second string. |
Definition at line 207 of file UpnpString.cpp.
int UpnpString_casecmp | ( | UpnpString * | p, |
UpnpString * | q | ||
) |
Compares two strings for equality. Case does not matter.
[in] | p | The the first string. |
[in] | q | The the second string. |
Definition at line 214 of file UpnpString.cpp.
|
static |
strnlen() is a GNU extension and here provided for portability.
Definition at line 40 of file UpnpString.cpp.