126#include <SingleList.h>
137#define SlException_INIT(ex) setjmp(ex.buf)
138void SlException_set(SlException* o,
int err);
139#define SlException_assert(o, expr) \
140 if( !(expr) ) SlException_set(o, 1)
141#define SlException_assertE(o, expr, errCode) \
142 if( !(expr) ) SlException_set(o, errCode)
149 SXmlErrT_ExpectedEndElem,
150 SXmlErrT_NameNotFound,
152 SXmlErrT_ExpectedElement,
174#define SXmlNode_getNs(o, r) (o->ns?SXmlRoot_dOffs2Str(r,o->ns):"")
175#define SXmlNode_getNsId(o) ((unsigned int)o->ns)
176#define SXmlNode_childNodes(o) ((unsigned int)o->childNodes)
177#define SXmlNode_getName(o, r) SXmlRoot_dOffs2Str(r,o->name)
178#define SXmlNode_getData(o, r) (o->data?SXmlRoot_dOffs2Str(r,o->data):0)
179#define SXmlNode_getNoOfAttr(o) ((unsigned int)o->attributes[0])
180#define SXmlNode_getAttr(o) (o->attributes[0]?o->attributes+1:0)
181#define SXmlNode_next(o, r) (o->next?SXmlRoot_eOffs2Elem(r,o->next):0)
182#define SXmlNode_firstChild(o, r) \
183 (o->firstChild?SXmlRoot_eOffs2Elem(r,o->firstChild):0)
184void SXmlNode_unlinkChild(SXmlNode* o, SXmlNode* child,
struct SXmlRoot* r);
186typedef U16* SXmlAttr;
187#define SXmlAttr_getNs(o, r, n) (o[3*n]?SXmlRoot_dOffs2Str(r,o[3*n]):"")
188#define SXmlAttr_getNsId(o, n) o[3*n]
189#define SXmlAttr_getName(o, r, n) SXmlRoot_dOffs2Str(r,o[1+(3*n)])
190#define SXmlAttr_getValue(o, r, n) SXmlRoot_dOffs2Str(r,o[2+(3*n)])
199#define SXmlNsNode_getNs(o, r) SXmlRoot_dOffs2Str(r,o->ns)
200#define SXmlNsNode_getNsId(o) ((unsigned int)o->ns)
201#define SXmlNsNode_next(o, r) (o->next?SXmlRoot_eOffs2SXmlNsNode(r, o->next):0)
204typedef struct SXmlRoot
212 U16 xmlElemBufNextPos;
225 U8* xmlData,
U16 dataSize,
U16 elemBufStartSize,
229void SXmlRoot_destructor(SXmlRoot* o);
231 SXmlRoot* o,
U8* xmlData,
U16 dataSize,
U16 elemBufStartSize);
232U16 SXmlRoot_childNodes(SXmlRoot* o);
233SXmlNode* SXmlRoot_firstChild(SXmlRoot* o);
234SXmlNsNode* SXmlRoot_firstNsNode(SXmlRoot* o);
240#define SXmlRoot_eOffs2Xmlns(o, offs) ((Xmlns*)((o)->xmlElemBuf+offs))
241#define SXmlRoot_eOffs2SXmlNsNode(o, offs) ((SXmlNsNode*)((o)->xmlElemBuf+offs))
242#define SXmlRoot_eOffs2Elem(o, offs) ((SXmlNode*)((o)->xmlElemBuf+offs))
243#define SXmlRoot_ePtr2Offs(o, ptr) (U16)(((U8*)ptr) - (o)->xmlElemBuf)
249#define SXmlRoot_dOffs2Str(o, offs) ((char*)((o)->xmlData+offs))
257 SingleList nsTreeNodeList;
260 unsigned int nextNsId;
263void NsTree_addNs(NsTree* o, SXmlNode* n, SXmlRoot* r);
264void NsTree_addAllNs(NsTree* o, SXmlNode* n, SXmlRoot* r);
265unsigned int NsTree_getNsId(NsTree* o,
const char* ns);
266void NsTree_printNsAttrList(NsTree* o,
const char nsprfx,
BufPrint* out);
267struct SerializeSXml* NsTree_createSerializer(
268 NsTree* o,
const char nsprfx,
BufPrint* bp);
269void NsTree_constructor(NsTree* o,
AllocatorIntf* alloc, SlException* ex);
270void NsTree_destructor(NsTree* o);
272typedef struct SerializeSXml
280void SerializeSXml_printNode(
281 SerializeSXml* o,SXmlNode* n,SXmlRoot* r,
BaBool all);
282#define SerializeSXml_constructor(o,nsprfx,bp) \
283 SerializeSXml_constructor2(o,nsprfx,bp,0)
284void SerializeSXml_constructor2(
285 SerializeSXml* o,
const char nsprfx,
BufPrint* bp, NsTree* nst);
286#define SerializeSXml_printNsAttrList(o) (o)->printNsAttrList=TRUE
uint16_t U16
Unsigned 16-bit integer.
Definition: GenPrimT.h:91
uint8_t U8
Unsigned 8-bit integer.
Definition: GenPrimT.h:89
U8 BaBool
Boolean stored in an unsigned byte; FALSE is zero and TRUE is one.
Definition: GenPrimT.h:118
Memory allocation and deallocation Interface class.
Definition: AllocatorIntf.h:98
The BufPrint class, which implements a compact printf-style formatter, is a base class used by severa...
Definition: BufPrint.h:132
Self-adjusting tree of caller-owned nodes, with unique keys.
Definition: SplayTree.h:109