UPnPsdk 0.1
Universal Plug and Play +, Software Development Kit
 
Loading...
Searching...
No Matches
ixmlmembuf.cpp File Reference
#include <ixml/ixmlmembuf.hpp>
#include <ixml/ixml.hpp>
#include <cassert>
#include <cstring>
+ Include dependency graph for ixmlmembuf.cpp:

Go to the source code of this file.

Functions

static int ixml_membuf_set_size (ixml_membuf *m, size_t new_length)
 Increases or decreases buffer capacity so that at least 'new_length' bytes can be stored.
 
void ixml_membuf_init (ixml_membuf *m)
 ixml_membuf initialization routine.
 
void ixml_membuf_destroy (ixml_membuf *m)
 ixml_membuf clearing routine.
 
int ixml_membuf_assign (ixml_membuf *m, const void *buf, size_t buf_len)
 Copies the contents o a buffer to the designated ixml_membuf.
 
int ixml_membuf_assign_str (ixml_membuf *m, const char *c_str)
 Copies a NULL terminated string to the ixml_buffer.
 
int ixml_membuf_append (ixml_membuf *m, const void *buf)
 Appends one byte to the designated ixml_membuffer.
 
int ixml_membuf_append_str (ixml_membuf *m, const char *c_str)
 Appends the contents of a NULL terminated string to the designated ixml_membuf.
 
int ixml_membuf_insert (ixml_membuf *m, const void *buf, size_t buf_len, size_t index)
 

Function Documentation

◆ ixml_membuf_set_size()

static int ixml_membuf_set_size ( ixml_membuf m,
size_t  new_length 
)
static

Increases or decreases buffer capacity so that at least 'new_length' bytes can be stored.

On error, m's fields do not change.

Returns
  • UPNP_E_SUCCESS
  • UPNP_E_OUTOF_MEMORY
Parameters
[in,out]mThe memory buffer.
[in]new_lengthThe new lenght.

Definition at line 54 of file ixmlmembuf.cpp.

+ Here is the caller graph for this function:

◆ ixml_membuf_init()

void ixml_membuf_init ( ixml_membuf m)

ixml_membuf initialization routine.

Parameters
[in,out]mThe memory buffer to initializa.

Definition at line 102 of file ixmlmembuf.cpp.

+ Here is the caller graph for this function:

◆ ixml_membuf_destroy()

void ixml_membuf_destroy ( ixml_membuf m)

ixml_membuf clearing routine.

The internal buffer is deleted and ixml_membuf_init() is called in the end to reinitialize the buffer.

Parameters
[in,out]mThe memory buffer to clear.

Definition at line 111 of file ixmlmembuf.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ixml_membuf_assign()

int ixml_membuf_assign ( ixml_membuf m,
const void *  buf,
size_t  buf_len 
)

Copies the contents o a buffer to the designated ixml_membuf.

The previous contents of the ixml_membuf are destroyed.

Returns
IXML_SUCCESS if successfull, or the error code returned by ixml_membuf_set_size().
See also
ixml_membuf_assign_str().
Parameters
[in,out]mThe memory buffer on which to operate.
[in]bufThe input buffer to copy from.
[in]buf_lenThe number of bytes to copy from the input buffer.

Definition at line 120 of file ixmlmembuf.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ixml_membuf_assign_str()

int ixml_membuf_assign_str ( ixml_membuf m,
const char *  c_str 
)

Copies a NULL terminated string to the ixml_buffer.

This is a convenience function that internally uses ixml_membuf_assign().

Returns
The return value of ixml_membuf_assign().
See also
ixml_membuf_assign().
Parameters
[in,out]mThe memory buffer on which to operate.
[in]c_strThe input string to copy from.

Definition at line 146 of file ixmlmembuf.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ixml_membuf_append()

int ixml_membuf_append ( ixml_membuf m,
const void *  buf 
)

Appends one byte to the designated ixml_membuffer.

This is a convenience function that internally uses ixml_membuf_insert().

Returns
The return value of ixml_membuf_insert().
See also
ixml_membuf_insert()
Parameters
[in,out]mThe memory buffer
[in]bufThe buffer to append

Definition at line 150 of file ixmlmembuf.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ixml_membuf_append_str()

int ixml_membuf_append_str ( ixml_membuf m,
const char *  c_str 
)

Appends the contents of a NULL terminated string to the designated ixml_membuf.

This is a convenience function that internally uses ixml_membuf_insert().

Returns
The return value of ixml_membuf_insert().
See also
ixml_membuf_insert().
Parameters
[in,out]mThe memory buffer
[in]c_strThe characters to append (null-terminated)

Definition at line 160 of file ixmlmembuf.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ixml_membuf_insert()

int ixml_membuf_insert ( ixml_membuf m,
const void *  buf,
size_t  buf_len,
size_t  index 
)
Returns
  • 0 if successfull.
  • IXML_INDEX_SIZE_ERR if the index parameter is out of range.
  • Or the return code of ixml_membuf_set_size()
See also
ixml_membuf_set_size()
Parameters
[in,out]mThe memory buffer
[in]bufThe buffer to insert
[in]buf_lenThe length of the buffer
[in]indexPosition where to insert the buffer

Definition at line 168 of file ixmlmembuf.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function: