XMLGen.xcc
Laura Hernandez de la Puerta (lauhp09gmail.com) Benoit Dupont de Dinechin (Benoit.Dupont-de-Dinechinst.com)
Copyright 2008 STMicroelectronics.
This program is free software; you can redistribute it and/or modify it under the terms of either (at your option): the GNU General 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.
UTF-8 strings
typedef char *UTF8; typedef const char *const_UTF8; int escape;
XMLGenWriter_rec -- XML Generator object.
struct XMLGenWriter_rec_;
XMLGen -- XML Generator object.
struct XMLGen_;
isLetter
static int isLetter(int c) { if (c < 0 || c > 0xffff) return 0; else return 1; }
isNameChar
static int isNameChar(int c) { if (c < 0 || c > 0xffff) return 0; else return 1; }
isXMLChar
static int isXMLChar(int c);
NextUnicodeChar
int NextUnicodeChar(const_UTF8 *sp);
checkNCName
static XMLGenStatus checkNCName(const_UTF8 name);
checkText
XMLGenStatus checkText( const_UTF8 s);
initCollector
static XMLGenStatus initCollector(XMLGenWriter_rec w, collector * c);
growCollector
static XMLGenStatus growCollector(XMLGenWriter_rec w, collector * c, int size);
startCollect
static void startCollect(collector * c);
endCollect
static void endCollect(collector * c);
collectString
static XMLGenStatus collectString(XMLGenWriter_rec w, collector * c, const_UTF8 string);
#define collectPiece(w,c,d,size) {if (((c)->used+(size))>=(c)->space){if (((w)->status=growCollector(w,c,(c)->used+(size)))!=XMLGenStatus_OK) return (w)->status;}strncpy((char *)(c)->buf+(c)->used,d,size);(c)->used+=size;}
initPlist
static XMLGenStatus initPlist(XMLGenWriter_rec w, plist * pl);
initElemList
static XMLGenStatus initElemList(XMLGenWriter_rec w, plist * pl);
XMLGen_new— Make a new XMLGen.
XMLGen XMLGen_new(Memory parent);
XMLGen_dispose
void XMLGen_dispose(XMLGenWriter_rec_ *writer);
XMLGen_delete— Delete this XMLGen.
XMLGen XMLGen_delete(XMLGen this);
allocate
static void * allocate(XMLGenWriter_rec w, int bytes);
deallocate
static void deallocate(XMLGenWriter_rec w, void * data);
copy
static UTF8 copy(XMLGenWriter_rec w, const_UTF8 from);
checkExpand -- make room in a plist
static int checkExpand(plist * pl);
listAppend
static XMLGenStatus listAppend(plist * pl, void * pointer);
findElement
static int findElement(plist * pl, const_UTF8 type);
findAttribute
static int findAttribute(plist * pl, const_UTF8 name);
XMLGen_declareElement— Make a XMLGenElement.
XMLGenElement XMLGen_declareElement(XMLGen this, const_UTF8 type);
XMLGen_declareAttribute— Make a XMLGenAttribute.
XMLGenAttribute XMLGen_declareAttribute(XMLGen this, const_UTF8 name);
XMLGen_addAttribute— Add an attribute to the current element.
XMLGenStatus XMLGen_addAttribute(XMLGen this, XMLGenAttribute attribute, const_UTF8 value);
XMLGen_PI
XMLGenStatus XMLGen_PI(XMLGen this, const_UTF8 target, const_UTF8 text);
XMLGen_startDocFile— Start a new document.
XMLGenStatus XMLGen_startDocFile(XMLGen this, int escapeOpt);
XMLGen_endDocument— End a document.
XMLGenStatus XMLGen_endDocument(XMLGen this, FILE *file);
XMLGen_startElement— Start an element.
XMLGenStatus XMLGen_startElement(XMLGen this, XMLGenElement element);
XMLGen_startElementLiteral— Start an element.
XMLGenStatus XMLGen_startElementLiteral(XMLGen this, const_UTF8 type);
XMLGen_addAttributeLiteral— Add an attribute to the current element.
XMLGenStatus XMLGen_addAttributeLiteral(XMLGen this, const_UTF8 name, const_UTF8 value);
XMLGen_addText— Add text to the current element.
XMLGenStatus XMLGen_addText(XMLGen this, const_UTF8 start);
XMLGen_comment -- Inserts a comment with the text provided
XMLGenStatus XMLGen_comment(XMLGen this, const_UTF8 text);
addEscape
static int addEscape(XMLGen this, int c);
XMLGen_addCharacter— Add unicode character to the current element.
XMLGenStatus XMLGen_addCharacter(XMLGen this, int c);
writeTag
XMLGenStatus writeTag (XMLGen this, int empty);
XMLGen_endEmptyElement— End the current element.
XMLGenStatus XMLGen_endEmptyElement(XMLGen this);
XMLGen_endElement— End the current element.
XMLGenStatus XMLGen_endElement(XMLGen this);