libexplain  1.4.D001
Data Structures | Defines | Typedefs | Functions
libexplain/string_buffer.h File Reference
#include <libexplain/ac/stdarg.h>
#include <libexplain/ac/stddef.h>
#include <libexplain/gcc_attributes.h>

Go to the source code of this file.

Data Structures

struct  explain_string_buffer_t

Defines

#define i18n(x)   x

Typedefs

typedef struct
explain_string_buffer_t 
explain_string_buffer_t

Functions

void explain_string_buffer_init (explain_string_buffer_t *sb, char *message, int message_size)
void explain_string_buffer_putc (explain_string_buffer_t *sb, int c)
void explain_string_buffer_putc_quoted (explain_string_buffer_t *sb, int c)
void explain_string_buffer_putc_escaped (explain_string_buffer_t *sb, int c, int delimiter)
void explain_string_buffer_puts (explain_string_buffer_t *sb, const char *s)
void explain_string_buffer_putsu (explain_string_buffer_t *sb, const unsigned char *s)
void explain_string_buffer_puts_quoted (explain_string_buffer_t *sb, const char *s)
void explain_string_buffer_puts_shell_quoted (explain_string_buffer_t *sb, const char *s)
void explain_string_buffer_putsu_quoted (explain_string_buffer_t *sb, const unsigned char *s)
void explain_string_buffer_puts_quoted_n (explain_string_buffer_t *sb, const char *s, size_t n)
void explain_string_buffer_putsu_quoted_n (explain_string_buffer_t *sb, const unsigned char *s, size_t n)
void explain_string_buffer_printf (explain_string_buffer_t *sb, const char *fmt,...) LIBEXPLAIN_FORMAT_PRINTF(2
void void explain_string_buffer_printf_gettext (explain_string_buffer_t *sb, const char *fmt,...) LIBEXPLAIN_FORMAT_PRINTF(2
void void void explain_string_buffer_vprintf (explain_string_buffer_t *sb, const char *fmt, va_list ap)
void explain_string_buffer_copy (explain_string_buffer_t *dst, const explain_string_buffer_t *src)
void explain_string_buffer_path_join (explain_string_buffer_t *sb, const char *s)
int explain_string_buffer_full (const explain_string_buffer_t *sb)
void explain_string_buffer_write (explain_string_buffer_t *sb, const char *data, size_t data_size)
void explain_string_buffer_truncate (explain_string_buffer_t *sb, long new_position)
void explain_string_buffer_rewind (explain_string_buffer_t *sb)

Define Documentation

#define i18n (   x)    x

Definition at line 29 of file string_buffer.h.


Typedef Documentation

The explain_string_buffer_t struct is used to represent a piece of memory which is building a C string. This does not require the use of dynamic memory.

Definition at line 37 of file string_buffer.h.


Function Documentation

Definition at line 24 of file copy.c.

The explain_string_buffer_full functionmay be used to determine whether or not a string buffer is full (has no more room for additional characters).

Parameters:
sbThe string buffer to test.

Definition at line 24 of file full.c.

void explain_string_buffer_init ( explain_string_buffer_t sb,
char *  message,
int  message_size 
)

The explain_string_buffer_init function may be used to prespare a string buffer for use in building a C string.

Parameters:
sbThe string buffer to be initialised.
messageThe array which is to contain the string being constructed by the string buffer.
message_sizeThe size (in bytes) of the array which is to contain the string being constructed by the string buffer.

Definition at line 24 of file string_buffer.c.

void explain_string_buffer_path_join ( explain_string_buffer_t sb,
const char *  s 
)

Definition at line 24 of file path_join.c.

void explain_string_buffer_printf ( explain_string_buffer_t sb,
const char *  fmt,
  ... 
)

The explain_string_buffer_printf function is used to print a formatted string into a string buffer.

Parameters:
sbThe string buffer to print into
fmtThe format string controling the types of the remaining arguments. See printf(3) for more information.
void void explain_string_buffer_printf_gettext ( explain_string_buffer_t sb,
const char *  fmt,
  ... 
)

The explain_string_buffer_printf function is used to print a formatted string into a string buffer, translating the formatting text.

Parameters:
sbThe string buffer to print into
fmtThe format string controling the types of the remaining arguments. See printf(3) for more information on the content of this string. It will be passed through explain_gettext for translation before it is used.

Definition at line 24 of file putc.c.

void explain_string_buffer_putc_escaped ( explain_string_buffer_t sb,
int  c,
int  delimiter 
)

The explain_string_buffer_putc_escaped function is used to print a character with C escaping. This can be used for the contents of "string" and 'character' constants.

Parameters:
sbThe string buffer to be initialised.
cThe character to be printed if possible, and C escaped if not.
delimiterThe delimiter character; single quote for character constants, double quote for string constants

Definition at line 27 of file putc_escaped.c.

The explain_string_buffer_putc_quoted function is used to print a C character constant (i.e., including the single quotes), with escaping if necessary.

Parameters:
sbThe string buffer to be initialised.
cThe character to be printed as a C character constant.

Definition at line 23 of file putc_quoted.c.

void explain_string_buffer_puts ( explain_string_buffer_t sb,
const char *  s 
)

Definition at line 26 of file puts.c.

void explain_string_buffer_puts_quoted ( explain_string_buffer_t sb,
const char *  s 
)

Definition at line 24 of file puts_quoted.c.

void explain_string_buffer_puts_quoted_n ( explain_string_buffer_t sb,
const char *  s,
size_t  n 
)

Definition at line 23 of file puts_quoted_n.c.

Definition at line 27 of file puts_shell_quoted.c.

void explain_string_buffer_putsu ( explain_string_buffer_t sb,
const unsigned char *  s 
)

Definition at line 41 of file puts.c.

void explain_string_buffer_putsu_quoted ( explain_string_buffer_t sb,
const unsigned char *  s 
)

Definition at line 84 of file puts_quoted.c.

void explain_string_buffer_putsu_quoted_n ( explain_string_buffer_t sb,
const unsigned char *  s,
size_t  n 
)

Definition at line 86 of file puts_quoted_n.c.

The explain_string_buffer_rewind function is used to trim a string buffer back to empty.

Parameters:
sbThe string buffer to shorten

Definition at line 24 of file rewind.c.

void explain_string_buffer_truncate ( explain_string_buffer_t sb,
long  new_position 
)

The explain_string_buffer_truncate function is used to trim a string buffer back to the given size.

Parameters:
sbThe string buffer to shorten
new_positionThe newer shorter position (ignored of longer)

Definition at line 24 of file truncate.c.

void void void explain_string_buffer_vprintf ( explain_string_buffer_t sb,
const char *  fmt,
va_list  ap 
)

Definition at line 27 of file vprintf.c.

void explain_string_buffer_write ( explain_string_buffer_t sb,
const char *  data,
size_t  data_size 
)

The explain_string_buffer_write function may be used to append a run of bytes to the end of a string buffer. They do not need to be NUL terminated; indeed, they shall not contain any NUL characters.

Parameters:
sbThe string buffer to print into
dataPointer to the base of the array of characters to be written into the string buffer.
data_sizeThe size in bytes (printable characters could be multi-byte sequences) the size in bytes of the array of bytes to write into the string buffer.

Definition at line 26 of file write.c.