mxml.h File Reference

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <errno.h>
Include dependency graph for mxml.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  mxml_attr_s
struct  mxml_element_s
struct  mxml_text_s
struct  mxml_custom_s
union  mxml_value_u
struct  mxml_node_s
struct  mxml_index_s

Defines

#define MXML_TAB   8
#define MXML_NO_CALLBACK   0
#define MXML_INTEGER_CALLBACK   mxml_integer_cb
#define MXML_OPAQUE_CALLBACK   mxml_opaque_cb
#define MXML_REAL_CALLBACK   mxml_real_cb
#define MXML_TEXT_CALLBACK   0
#define MXML_IGNORE_CALLBACK   mxml_ignore_cb
#define MXML_NO_PARENT   0
#define MXML_DESCEND   1
#define MXML_NO_DESCEND   0
#define MXML_DESCEND_FIRST   -1
#define MXML_WS_BEFORE_OPEN   0
#define MXML_WS_AFTER_OPEN   1
#define MXML_WS_BEFORE_CLOSE   2
#define MXML_WS_AFTER_CLOSE   3
#define MXML_ADD_BEFORE   0
#define MXML_ADD_AFTER   1
#define MXML_ADD_TO_PARENT   NULL

Typedefs

typedef enum mxml_sax_event_e mxml_sax_event_t
typedef enum mxml_type_e mxml_type_t
typedef void(* mxml_custom_destroy_cb_t )(void *)
typedef void(* mxml_error_cb_t )(const char *)
typedef struct mxml_attr_s mxml_attr_t
typedef struct mxml_element_s mxml_element_t
typedef struct mxml_text_s mxml_text_t
typedef struct mxml_custom_s mxml_custom_t
typedef union mxml_value_u mxml_value_t
typedef struct mxml_node_s mxml_node_t
typedef struct mxml_index_s mxml_index_t
typedef int(* mxml_custom_load_cb_t )(mxml_node_t *, const char *)
typedef char *(* mxml_custom_save_cb_t )(mxml_node_t *)
typedef mxml_type_t(* mxml_load_cb_t )(mxml_node_t *)
typedef const char *(* mxml_save_cb_t )(mxml_node_t *, int)
typedef void(* mxml_sax_cb_t )(mxml_node_t *, mxml_sax_event_t, void *)

Enumerations

enum  mxml_sax_event_e {
  MXML_SAX_CDATA, MXML_SAX_COMMENT, MXML_SAX_DATA, MXML_SAX_DIRECTIVE,
  MXML_SAX_ELEMENT_CLOSE, MXML_SAX_ELEMENT_OPEN
}
enum  mxml_type_e {
  MXML_IGNORE = -1, MXML_ELEMENT, MXML_INTEGER, MXML_OPAQUE,
  MXML_REAL, MXML_TEXT, MXML_CUSTOM
}

Functions

void mxmlAdd (mxml_node_t *parent, int where, mxml_node_t *child, mxml_node_t *node)
void mxmlDelete (mxml_node_t *node)
void mxmlElementDeleteAttr (mxml_node_t *node, const char *name)
const char * mxmlElementGetAttr (mxml_node_t *node, const char *name)
void mxmlElementSetAttr (mxml_node_t *node, const char *name, const char *value)
void mxmlElementSetAttrf (mxml_node_t *node, const char *name, const char *format,...)
int mxmlEntityAddCallback (int(*cb)(const char *name))
const char * mxmlEntityGetName (int val)
int mxmlEntityGetValue (const char *name)
void mxmlEntityRemoveCallback (int(*cb)(const char *name))
mxml_node_tmxmlFindElement (mxml_node_t *node, mxml_node_t *top, const char *name, const char *attr, const char *value, int descend)
void mxmlIndexDelete (mxml_index_t *ind)
mxml_node_tmxmlIndexEnum (mxml_index_t *ind)
mxml_node_tmxmlIndexFind (mxml_index_t *ind, const char *element, const char *value)
mxml_index_tmxmlIndexNew (mxml_node_t *node, const char *element, const char *attr)
mxml_node_tmxmlIndexReset (mxml_index_t *ind)
mxml_node_tmxmlLoadFd (mxml_node_t *top, int fd, mxml_type_t(*cb)(mxml_node_t *))
mxml_node_tmxmlLoadFile (mxml_node_t *top, FILE *fp, mxml_type_t(*cb)(mxml_node_t *))
mxml_node_tmxmlLoadString (mxml_node_t *top, const char *s, mxml_type_t(*cb)(mxml_node_t *))
mxml_node_tmxmlNewCDATA (mxml_node_t *parent, const char *string)
mxml_node_tmxmlNewCustom (mxml_node_t *parent, void *data, mxml_custom_destroy_cb_t destroy)
mxml_node_tmxmlNewElement (mxml_node_t *parent, const char *name)
mxml_node_tmxmlNewInteger (mxml_node_t *parent, int integer)
mxml_node_tmxmlNewOpaque (mxml_node_t *parent, const char *opaque)
mxml_node_tmxmlNewReal (mxml_node_t *parent, double real)
mxml_node_tmxmlNewText (mxml_node_t *parent, int whitespace, const char *string)
mxml_node_tmxmlNewTextf (mxml_node_t *parent, int whitespace, const char *format,...)
mxml_node_tmxmlNewXML (const char *version)
int mxmlRelease (mxml_node_t *node)
void mxmlRemove (mxml_node_t *node)
int mxmlRetain (mxml_node_t *node)
char * mxmlSaveAllocString (mxml_node_t *node, mxml_save_cb_t cb)
int mxmlSaveFd (mxml_node_t *node, int fd, mxml_save_cb_t cb)
int mxmlSaveFile (mxml_node_t *node, FILE *fp, mxml_save_cb_t cb)
int mxmlSaveString (mxml_node_t *node, char *buffer, int bufsize, mxml_save_cb_t cb)
mxml_node_tmxmlSAXLoadFd (mxml_node_t *top, int fd, mxml_type_t(*cb)(mxml_node_t *), mxml_sax_cb_t sax, void *sax_data)
mxml_node_tmxmlSAXLoadFile (mxml_node_t *top, FILE *fp, mxml_type_t(*cb)(mxml_node_t *), mxml_sax_cb_t sax, void *sax_data)
mxml_node_tmxmlSAXLoadString (mxml_node_t *top, const char *s, mxml_type_t(*cb)(mxml_node_t *), mxml_sax_cb_t sax, void *sax_data)
int mxmlSetCDATA (mxml_node_t *node, const char *data)
int mxmlSetCustom (mxml_node_t *node, void *data, mxml_custom_destroy_cb_t destroy)
void mxmlSetCustomHandlers (mxml_custom_load_cb_t load, mxml_custom_save_cb_t save)
int mxmlSetElement (mxml_node_t *node, const char *name)
void mxmlSetErrorCallback (mxml_error_cb_t cb)
int mxmlSetInteger (mxml_node_t *node, int integer)
int mxmlSetOpaque (mxml_node_t *node, const char *opaque)
int mxmlSetReal (mxml_node_t *node, double real)
int mxmlSetText (mxml_node_t *node, int whitespace, const char *string)
int mxmlSetTextf (mxml_node_t *node, int whitespace, const char *format,...)
void mxmlSetWrapMargin (int column)
mxml_node_tmxmlWalkNext (mxml_node_t *node, mxml_node_t *top, int descend)
mxml_node_tmxmlWalkPrev (mxml_node_t *node, mxml_node_t *top, int descend)
void mxml_error (const char *format,...)
mxml_type_t mxml_ignore_cb (mxml_node_t *node)
mxml_type_t mxml_integer_cb (mxml_node_t *node)
mxml_type_t mxml_opaque_cb (mxml_node_t *node)
mxml_type_t mxml_real_cb (mxml_node_t *node)

Define Documentation

#define MXML_ADD_AFTER   1

Definition at line 66 of file mxml.h.

Referenced by mxml_new(), and mxmlAdd().

#define MXML_ADD_BEFORE   0

Definition at line 65 of file mxml.h.

Referenced by mxmlAdd().

#define MXML_ADD_TO_PARENT   NULL

Definition at line 67 of file mxml.h.

Referenced by mxml_new().

#define MXML_DESCEND   1

Definition at line 56 of file mxml.h.

Referenced by mxmlFindElement(), and mxmlIndexNew().

#define MXML_DESCEND_FIRST   -1

Definition at line 58 of file mxml.h.

Referenced by mxml_GetNode().

#define MXML_IGNORE_CALLBACK   mxml_ignore_cb

Definition at line 51 of file mxml.h.

#define MXML_INTEGER_CALLBACK   mxml_integer_cb

Definition at line 44 of file mxml.h.

#define MXML_NO_CALLBACK   0

Definition at line 43 of file mxml.h.

Referenced by MP_SaveTeamMultiplayer(), mxmlLoadFd(), mxmlLoadFile(), mxmlLoadString(), and SAV_GameSave().

#define MXML_NO_DESCEND   0

Definition at line 57 of file mxml.h.

Referenced by mxml_GetNextNode().

#define MXML_NO_PARENT   0

Definition at line 54 of file mxml.h.

#define MXML_OPAQUE_CALLBACK   mxml_opaque_cb

Definition at line 46 of file mxml.h.

#define MXML_REAL_CALLBACK   mxml_real_cb

Definition at line 48 of file mxml.h.

#define MXML_TAB   8

Definition at line 41 of file mxml.h.

Referenced by mxml_write_ws().

#define MXML_TEXT_CALLBACK   0

Definition at line 50 of file mxml.h.

#define MXML_WS_AFTER_CLOSE   3

Definition at line 63 of file mxml.h.

Referenced by mxml_write_node().

#define MXML_WS_AFTER_OPEN   1

Definition at line 61 of file mxml.h.

Referenced by mxml_write_node().

#define MXML_WS_BEFORE_CLOSE   2

Definition at line 62 of file mxml.h.

Referenced by mxml_write_node().

#define MXML_WS_BEFORE_OPEN   0

Definition at line 60 of file mxml.h.

Referenced by mxml_write_node().


Typedef Documentation

typedef struct mxml_attr_s mxml_attr_t
typedef void(* mxml_custom_destroy_cb_t)(void *)

Definition at line 95 of file mxml.h.

typedef int(* mxml_custom_load_cb_t)(mxml_node_t *, const char *)

Definition at line 158 of file mxml.h.

typedef char*(* mxml_custom_save_cb_t)(mxml_node_t *)

Definition at line 161 of file mxml.h.

typedef struct mxml_custom_s mxml_custom_t
typedef void(* mxml_error_cb_t)(const char *)

Definition at line 98 of file mxml.h.

typedef struct mxml_index_s mxml_index_t

Definition at line 164 of file mxml.h.

typedef struct mxml_node_s mxml_node_t
typedef const char*(* mxml_save_cb_t)(mxml_node_t *, int)

Definition at line 167 of file mxml.h.

typedef void(* mxml_sax_cb_t)(mxml_node_t *, mxml_sax_event_t, void *)

Definition at line 170 of file mxml.h.

typedef struct mxml_text_s mxml_text_t
typedef enum mxml_type_e mxml_type_t
typedef union mxml_value_u mxml_value_t

Enumeration Type Documentation

Enumerator:
MXML_SAX_CDATA 
MXML_SAX_COMMENT 
MXML_SAX_DATA 
MXML_SAX_DIRECTIVE 
MXML_SAX_ELEMENT_CLOSE 
MXML_SAX_ELEMENT_OPEN 

Definition at line 74 of file mxml.h.

Enumerator:
MXML_IGNORE 
MXML_ELEMENT 
MXML_INTEGER 
MXML_OPAQUE 
MXML_REAL 
MXML_TEXT 
MXML_CUSTOM 

Definition at line 84 of file mxml.h.


Function Documentation

void mxml_error ( const char *  format,
  ... 
)
mxml_type_t mxml_ignore_cb ( mxml_node_t node  ) 

Definition at line 81 of file mxml-private.c.

References MXML_IGNORE, and void().

mxml_type_t mxml_integer_cb ( mxml_node_t node  ) 

Definition at line 94 of file mxml-private.c.

References MXML_INTEGER, and void().

mxml_type_t mxml_opaque_cb ( mxml_node_t node  ) 

Definition at line 107 of file mxml-private.c.

References MXML_OPAQUE, and void().

mxml_type_t mxml_real_cb ( mxml_node_t node  ) 

Definition at line 120 of file mxml-private.c.

References MXML_REAL, and void().

void mxmlAdd ( mxml_node_t parent,
int  where,
mxml_node_t child,
mxml_node_t node 
)
void mxmlDelete ( mxml_node_t node  ) 
void mxmlElementDeleteAttr ( mxml_node_t node,
const char *  name 
)
const char* mxmlElementGetAttr ( mxml_node_t node,
const char *  name 
)
void mxmlElementSetAttr ( mxml_node_t node,
const char *  name,
const char *  value 
)
void mxmlElementSetAttrf ( mxml_node_t node,
const char *  name,
const char *  format,
  ... 
)
int mxmlEntityAddCallback ( int(*)(const char *name cb  ) 
const char* mxmlEntityGetName ( int  val  ) 

Definition at line 73 of file mxml-entity.c.

Referenced by mxml_write_name(), and mxml_write_string().

int mxmlEntityGetValue ( const char *  name  ) 

Definition at line 103 of file mxml-entity.c.

References _mxml_global(), _mxml_global_s::entity_cbs, i, and _mxml_global_s::num_entity_cbs.

Referenced by mxml_get_entity().

void mxmlEntityRemoveCallback ( int(*)(const char *name cb  ) 
mxml_node_t* mxmlFindElement ( mxml_node_t node,
mxml_node_t top,
const char *  name,
const char *  attr,
const char *  value,
int  descend 
)
void mxmlIndexDelete ( mxml_index_t ind  ) 

Definition at line 55 of file mxml-index.c.

References mxml_index_s::alloc_nodes, mxml_index_s::attr, and mxml_index_s::nodes.

Referenced by mxmlIndexNew().

mxml_node_t* mxmlIndexEnum ( mxml_index_t ind  ) 

Definition at line 85 of file mxml-index.c.

References mxml_index_s::cur_node, mxml_index_s::nodes, and mxml_index_s::num_nodes.

Referenced by mxmlIndexFind().

mxml_node_t* mxmlIndexFind ( mxml_index_t ind,
const char *  element,
const char *  value 
)
mxml_index_t* mxmlIndexNew ( mxml_node_t node,
const char *  element,
const char *  attr 
)
mxml_node_t* mxmlIndexReset ( mxml_index_t ind  ) 
mxml_node_t* mxmlLoadFd ( mxml_node_t top,
int  fd,
mxml_type_t(*)(mxml_node_t *)  cb 
)
mxml_node_t* mxmlLoadFile ( mxml_node_t top,
FILE *  fp,
mxml_type_t(*)(mxml_node_t *)  cb 
)
mxml_node_t* mxmlLoadString ( mxml_node_t top,
const char *  s,
mxml_type_t(*)(mxml_node_t *)  cb 
)
mxml_node_t* mxmlNewCDATA ( mxml_node_t parent,
const char *  string 
)
mxml_node_t* mxmlNewCustom ( mxml_node_t parent,
void *  data,
mxml_custom_destroy_cb_t  destroy 
)
mxml_node_t* mxmlNewElement ( mxml_node_t parent,
const char *  name 
)
mxml_node_t* mxmlNewInteger ( mxml_node_t parent,
int  integer 
)

Definition at line 408 of file mxml-node.c.

References mxml_value_u::integer, MXML_INTEGER, mxml_new(), and mxml_node_s::value.

Referenced by mxml_load_data().

mxml_node_t* mxmlNewOpaque ( mxml_node_t parent,
const char *  opaque 
)

Definition at line 439 of file mxml-node.c.

References mxml_new(), MXML_OPAQUE, mxml_value_u::opaque, and mxml_node_s::value.

Referenced by mxml_load_data().

mxml_node_t* mxmlNewReal ( mxml_node_t parent,
double  real 
)

Definition at line 477 of file mxml-node.c.

References mxml_new(), MXML_REAL, mxml_value_u::real, and mxml_node_s::value.

Referenced by mxml_load_data().

mxml_node_t* mxmlNewText ( mxml_node_t parent,
int  whitespace,
const char *  string 
)
mxml_node_t* mxmlNewTextf ( mxml_node_t parent,
int  whitespace,
const char *  format,
  ... 
)
mxml_node_t* mxmlNewXML ( const char *  version  ) 

Definition at line 669 of file mxml-node.c.

References mxmlNewElement().

Referenced by MP_SaveTeamMultiplayer(), and SAV_GameSave().

int mxmlRelease ( mxml_node_t node  ) 

Definition at line 691 of file mxml-node.c.

References mxmlDelete(), and mxml_node_s::ref_count.

Referenced by mxml_load_data().

void mxmlRemove ( mxml_node_t node  ) 
int mxmlRetain ( mxml_node_t node  ) 

Definition at line 715 of file mxml-node.c.

References mxml_node_s::ref_count.

char* mxmlSaveAllocString ( mxml_node_t node,
mxml_save_cb_t  cb 
)

Definition at line 253 of file mxml-file.c.

References mxmlSaveString().

int mxmlSaveFd ( mxml_node_t node,
int  fd,
mxml_save_cb_t  cb 
)
int mxmlSaveFile ( mxml_node_t node,
FILE *  fp,
mxml_save_cb_t  cb 
)

Definition at line 358 of file mxml-file.c.

References _mxml_global(), mxml_file_putc(), and mxml_write_node().

int mxmlSaveString ( mxml_node_t node,
char *  buffer,
int  bufsize,
mxml_save_cb_t  cb 
)
mxml_node_t* mxmlSAXLoadFd ( mxml_node_t top,
int  fd,
mxml_type_t(*)(mxml_node_t *)  cb,
mxml_sax_cb_t  sax,
void *  sax_data 
)
mxml_node_t* mxmlSAXLoadFile ( mxml_node_t top,
FILE *  fp,
mxml_type_t(*)(mxml_node_t *)  cb,
mxml_sax_cb_t  sax,
void *  sax_data 
)
mxml_node_t* mxmlSAXLoadString ( mxml_node_t top,
const char *  s,
mxml_type_t(*)(mxml_node_t *)  cb,
mxml_sax_cb_t  sax,
void *  sax_data 
)
int mxmlSetCDATA ( mxml_node_t node,
const char *  data 
)
int mxmlSetCustom ( mxml_node_t node,
void *  data,
mxml_custom_destroy_cb_t  destroy 
)
void mxmlSetCustomHandlers ( mxml_custom_load_cb_t  load,
mxml_custom_save_cb_t  save 
)
int mxmlSetElement ( mxml_node_t node,
const char *  name 
)
void mxmlSetErrorCallback ( mxml_error_cb_t  cb  ) 

Definition at line 596 of file mxml-file.c.

References _mxml_global(), and _mxml_global_s::error_cb.

int mxmlSetInteger ( mxml_node_t node,
int  integer 
)

Definition at line 143 of file mxml-set.c.

References mxml_value_u::integer, MXML_INTEGER, mxml_node_s::type, and mxml_node_s::value.

int mxmlSetOpaque ( mxml_node_t node,
const char *  opaque 
)

Definition at line 170 of file mxml-set.c.

References MXML_OPAQUE, mxml_value_u::opaque, mxml_node_s::type, and mxml_node_s::value.

int mxmlSetReal ( mxml_node_t node,
double  real 
)

Definition at line 200 of file mxml-set.c.

References MXML_REAL, mxml_value_u::real, mxml_node_s::type, and mxml_node_s::value.

int mxmlSetText ( mxml_node_t node,
int  whitespace,
const char *  string 
)
int mxmlSetTextf ( mxml_node_t node,
int  whitespace,
const char *  format,
  ... 
)
void mxmlSetWrapMargin ( int  column  ) 

Definition at line 615 of file mxml-file.c.

References _mxml_global(), and _mxml_global_s::wrap.

mxml_node_t* mxmlWalkNext ( mxml_node_t node,
mxml_node_t top,
int  descend 
)

Definition at line 130 of file mxml-search.c.

References mxml_node_s::child, mxml_node_s::next, and mxml_node_s::parent.

Referenced by mxmlFindElement().

mxml_node_t* mxmlWalkPrev ( mxml_node_t node,
mxml_node_t top,
int  descend 
)

Definition at line 168 of file mxml-search.c.

References mxml_node_s::last_child, mxml_node_s::parent, and mxml_node_s::prev.


Generated by  doxygen 1.6.2