- Main Page
- Data Structures
- Files

- File List
- Globals

# jasperserver/stringbuffer.h File Reference

`#include <libxml/encoding.h>`

Go to the source code of this file.

## Data Structures
struct | jasperserver_string
## Defines
#define | INCREMENT_STRING_SIZE 256
#define | JS_CSTR(c) (const char *)c->buffer->content
#define | JS_UTFSTR(c) (const xmlChar *)c->buffer->content
#define | JS_NOTNULL(c) (c && c->buffer->use >0)
## Typedefs
typedef jasperserver_string | jasperserver_string_t
## Functions
jasperserver_string_t * | jasperserver_string_new ()
| Create a new blank string.
void | jasperserver_string_free (jasperserver_string_t *jsstr)
| Free the memory allocated for a string.
void | jasperserver_string_append (jasperserver_string_t *jsstr, const xmlChar *str)
| Append an string to a jasperserver_string.
void | jasperserver_string_cappend (jasperserver_string_t *jsstr, const char *str)
| Append an C-string to a jasperserver_string.
void | jasperserver_string_set (jasperserver_string_t *jsstr, const xmlChar *str)
| set the value of the string
void | jasperserver_string_cset (jasperserver_string_t *jsstr, const char *str)
| set the value of the string
int | jasperserver_string_format (jasperserver_string_t *jsstr, const char *format,...)
| set the formatted string as value of the string

## Define Documentation

#define INCREMENT_STRING_SIZE 256

Definition at line 25 of file stringbuffer.h.

#define JS_CSTR | ( | c |  | ) | (const char *)c->buffer->content

Easy way to cast a jasperserver_string to a C-string.

      printf( "%s", JS_CSTR( my_jasperserver_string ) );

Definition at line 34 of file stringbuffer.h.

#define JS_NOTNULL | ( | c |  | ) | (c && c->buffer->use >0)

Easy syntax to check if a jasperserver_string or has length == 0

Definition at line 46 of file stringbuffer.h.

#define JS_UTFSTR | ( | c |  | ) | (const xmlChar *)c->buffer->content

Easy way to cast a jasperserver_string to an xmlChar *.

Definition at line 40 of file stringbuffer.h.

## Typedef Documentation

typedef struct jasperserver_string jasperserver_string_t

## Function Documentation

void jasperserver_string_append | ( | jasperserver_string_t * | jsstr,
|  | const xmlChar * | str |
| ) |  |  |

Append an string to a jasperserver_string.

Parameters:

  | jsstr | a pointer to a jasperserver_string
  | str | an xmlChar *, it can contain UTF cahracters

Definition at line 95 of file stringbuffer.c.

void jasperserver_string_cappend | ( | jasperserver_string_t * | jsstr,
|  | const char * | str |
| ) |  |  |

Append an C-string to a jasperserver_string.

Parameters:

  | jsstr | a pointer to a jasperserver_string
  | str | a C-string to append

Definition at line 82 of file stringbuffer.c.

void jasperserver_string_cset | ( | jasperserver_string_t * | jsstr,
|  | const char * | str |
| ) |  |  |

set the value of the string

Parameters:

  | jsstr | a pointer to a jasperserver_string
  | str | a C-string to append

Definition at line 167 of file stringbuffer.c.

int jasperserver_string_format | ( | jasperserver_string_t * | jsstr,
|  | const char * | format,
|  |  | ... |
| ) |  |  |

set the formatted string as value of the string

Parameters:

  | jsstr | a pointer to a jasperserver_string
  | format | see printf
  | ... | set of parameters

Returns:
  the bytes used by the buffer to store the string.

Definition at line 176 of file stringbuffer.c.

void jasperserver_string_free | ( | jasperserver_string_t * | jsstr | ) |

Free the memory allocated for a string.

Parameters:

  | jsstr | a pointer to a jasperserver_string

See also:
  jasperserver_string_new()

Definition at line 71 of file stringbuffer.c.

jasperserver_string_t* jasperserver_string_new | ( |  | ) |

Create a new blank string.

This function initializes a string. It is responsability of the user free the memory allocated by this function using jasperserver_string_free()

Returns:
  a pointer to a new string

See also:
  jasperserver_string_free()

Definition at line 56 of file stringbuffer.c.

void jasperserver_string_set | ( | jasperserver_string_t * | jsstr,
|  | const xmlChar * | str |
| ) |  |  |

set the value of the string

Parameters:

  | jsstr | a pointer to a jasperserver_string
  | str | an xmlChar *, it can contain UTF cahracters

Definition at line 159 of file stringbuffer.c.