Buffer.xcc

Benoit Dupont de Dinechin (Benoit.Dupont-de-Dinechin@st.com)

Copyright 2007 STMicroelectronics. Copyright 1995 - 1998 Commissariat a l'Energie Atomique.

This program is free software; you can redistribute it and/or modify it under the terms of either (at your option): the GNU Public License (GPL) version 2; the GNU Lesser General Public License (LGPL) version 2.1; any later version of these licences as published by the Free Software Foundation.

Buffer— Buffer for character data.
struct Buffer_ {
  //@args       Memory memory, size_t blockSize
  Memory MEMORY;
  size_t BLOCKSIZE;             // BufferBlock size.
  size_t LENGTH;                // Total length in bytes.
  struct BufferBlock_ *FIRST;   // First BufferBlock.
  struct BufferBlock_ *LAST;    // Last BufferBlock.
  char *START;                  // Start data pointer in the FIRST BufferBlock.
  char *PAST;                   // Past data pointer in the LAST BufferBlock.
  const char *INDENT;           // The indentation string.
  int16_t ILEVEL;               // The indentation level.
  int16_t ISIZE;                // The cached strlen(INDENT).
};
Buffer_empty— Empty this Buffer.
void
Buffer_empty(Buffer this);
Buffer_memory— This Buffer memory.
static inline Memory
Buffer_memory(const_Buffer this)
{
  return Buffer_MEMORY(this);
}
Buffer_length— This Buffer length.
static inline int32_t
Buffer_length(const_Buffer this)
{
  return Buffer_LENGTH(this);
}
Buffer_indent— This Buffer indent string.
static inline const char *
Buffer_indent(const_Buffer this)
{
  return Buffer_INDENT(this);
}
Buffer_setIndent— Set this Buffer indent string.
static inline void
Buffer_setIndent(Buffer this, const char *indent)
{
  *Buffer__INDENT(this) = indent;
  *Buffer__ISIZE(this) = strlen(indent);
  *Buffer__ILEVEL(this) = 0;
}
Buffer_moreIndent— Increment this Buffer indentation level.
static inline int
Buffer_moreIndent(Buffer this)
{
  return ++*Buffer__ILEVEL(this);
}
Buffer_lessIndent— Decrement this Buffer indentation level.
static inline int
Buffer_lessIndent(Buffer this)
{
  return --*Buffer__ILEVEL(this);
}
Buffer_appendIndent— Append the current indentation to this Buffer.
int32_t
Buffer_appendIndent(Buffer this);
Buffer_appendC— Append a char to this Buffer.
int32_t
Buffer_appendC(Buffer this, int c);
Buffer_appendD— Append a %lld to this Buffer.
int32_t
Buffer_appendD(Buffer this, int64_t lld);
Buffer_appendU— Append a %llu to this Buffer.
int32_t
Buffer_appendU(Buffer this, int64_t llu);
Buffer_appendX— Append a %llx to this Buffer.
int32_t
Buffer_appendX(Buffer this, int64_t llx);
Buffer_appendL— Append a literal string to this Buffer.
#define Buffer_appendL(this, literal) \
  Buffer_append(this, sizeof(literal) - 1, literal)
Buffer_appendS— Append a string to this Buffer.
#define Buffer_appendS(this, string) \
  Buffer_append(this, strlen(string), string)
Buffer_appendXML— Append XML data to this Buffer. (TODO)
#define Buffer_appendXML(this, string) \
  Buffer_append(this, strlen(string), string)