The UpnpString Class

Implements string operations in the UPnP library. More...

## Files

file | UpnpString.h
| UpnpString object declarartion.
file | UpnpString.c
| UpnpString object implementation.

## Data Structures

struct | SUpnpString
| Internal implementation of the class UpnpString. More...

## Typedefs

typedef struct s_UpnpString | UpnpString
| Type of the string objects inside libupnp. More...

## Functions

UpnpString * | UpnpString_new ()
| 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...
int | UpnpString_get_Length (const UpnpString *p)
| Returns the length of the string. More...
const char * | UpnpString_get_String (const UpnpString *p)
| Returns the pointer to char. More...
void | UpnpString_set_String (UpnpString *p, const char *s)
| Sets the string from a pointer to char. More...
void | UpnpString_set_StringN (UpnpString *p, const char *s, int 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...

## Detailed Description

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.

## Typedef Documentation

typedef struct s_UpnpString UpnpString

Type of the string objects inside libupnp.

## Function Documentation

void UpnpString_assign | ( | UpnpString * | p,
|  | const UpnpString * | q
| ) |  |

Assignment operator.

Parameters

  [in] | p | The this pointer.
  [in] | q | The that pointer.

References UpnpString_get_String(), and UpnpString_set_String().

Referenced by genaSubscribe().

void UpnpString_clear | ( | UpnpString * | p | ) |

Clears the string, sets its size to zero.

Parameters

  [in] | p | The this pointer.

Referenced by gena_subscribe(), and genaSubscribe().

void UpnpString_delete | ( | UpnpString * | p | ) |

Destructor.

Parameters

  [in] | p | The this pointer.

References SUpnpString::m_length, and SUpnpString::m_string.

Referenced by genaRenewSubscription(), genaSubscribe(), GenlibClientSubscription_delete(), GenlibClientSubscription_set_ActualSID(), GenlibClientSubscription_set_EventURL(), GenlibClientSubscription_set_SID(), GenlibClientSubscription_strcpy_ActualSID(), GenlibClientSubscription_strcpy_EventURL(), GenlibClientSubscription_strcpy_SID(), UpnpActionComplete_delete(), UpnpActionComplete_set_CtrlUrl(), UpnpActionComplete_strcpy_CtrlUrl(), UpnpActionRequest_delete(), UpnpDiscovery_delete(), UpnpEvent_delete(), UpnpEventSubscribe_delete(), UpnpRenewSubscription(), UpnpStateVarComplete_delete(), UpnpStateVarRequest_delete(), UpnpSubscribe(), UpnpSubscriptionRequest_delete(), and UpnpUnSubscribe().

UpnpString * UpnpString_dup | ( | const UpnpString * | p | ) |

Copy Constructor.

Returns
  A pointer to a new allocated copy of the original object.

Parameters

  [in] | p | The this pointer.

References SUpnpString::m_length, and SUpnpString::m_string.

Referenced by GenlibClientSubscription_set_ActualSID(), GenlibClientSubscription_set_EventURL(), GenlibClientSubscription_set_SID(), and UpnpActionComplete_set_CtrlUrl().

int UpnpString_get_Length | ( | const UpnpString * | p | ) |

Returns the length of the string.

Returns
  The length of the string.

Parameters

  [in] | p | The this pointer.

Referenced by gena_subscribe(), and gena_unsubscribe().

const char * UpnpString_get_String | ( | const UpnpString * | p | ) |

Returns the pointer to char.

Returns
  The pointer to char.

Parameters

  [in] | p | The this pointer.

Referenced by gena_subscribe(), gena_unsubscribe(), GenlibClientSubscription_get_ActualSID_cstr(), GenlibClientSubscription_get_SID_cstr(), GetClientSubClientSID(), RemoveClientSubClientSID(), UpnpActionComplete_get_CtrlUrl_cstr(), UpnpString_assign(), and UpnpSubscribe().

UpnpString * UpnpString_new | ( |  | ) |

Constructor.

Returns
  A pointer to a new allocated object.

References SUpnpString::m_length, and SUpnpString::m_string.

Referenced by genaRenewSubscription(), genaSubscribe(), GenlibClientSubscription_new(), GenlibClientSubscription_strcpy_ActualSID(), GenlibClientSubscription_strcpy_EventURL(), GenlibClientSubscription_strcpy_SID(), UpnpActionComplete_new(), UpnpActionComplete_strcpy_CtrlUrl(), UpnpActionRequest_new(), UpnpDiscovery_new(), UpnpEvent_new(), UpnpEventSubscribe_new(), UpnpRenewSubscription(), UpnpStateVarComplete_new(), UpnpStateVarRequest_new(), UpnpSubscribe(), UpnpSubscriptionRequest_new(), and UpnpUnSubscribe().

void UpnpString_set_String | ( | UpnpString * | p,
|  | const char * | s
| ) |  |

Sets the string from a pointer to char.

Parameters

  [in] | p | The this pointer.
  [in] | s | (char *) to copy from.

References SUpnpString::m_string.

Referenced by genaSubscribe(), GenlibClientSubscription_strcpy_ActualSID(), GenlibClientSubscription_strcpy_EventURL(), GenlibClientSubscription_strcpy_SID(), UpnpActionComplete_strcpy_CtrlUrl(), UpnpRenewSubscription(), UpnpString_assign(), UpnpSubscribe(), and UpnpUnSubscribe().

void UpnpString_set_StringN | ( | UpnpString * | p,
|  | const char * | s,
|  | int | 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.

References SUpnpString::m_string.

Referenced by gena_subscribe().