Main Page | Modules | File List | Globals

XaintParser


Typedefs

typedef XaintParser_type XaintParser
typedef void(* XaintParserEventFunc )(XaintParser *xaintpr, XaintChar *data, XaintType type)
typedef void(* XaintParserDataRequestFunc )(XaintParser *xaintpr)

Functions

XAINT_API XaintParserXaintParser_new (void)
XAINT_API void XaintParser_delete (XaintParser *xaintpr)
XAINT_API void XaintParser_setEvent (XaintParser *xaintpr, XaintParserEventFunc event)
XAINT_API XaintParserEventFunc XaintParser_getEvent (XaintParser *xaintpr)
XAINT_API void XaintParser_setDataRequest (XaintParser *xaintpr, XaintParserDataRequestFunc dataRequest)
XAINT_API XaintParserDataRequestFunc XaintParser_getDataRequest (XaintParser *xaintpr)
XAINT_API void XaintParser_setUserData (XaintParser *xaintpr, XaintUnknown userData)
XAINT_API XaintUnknown XaintParser_getUserData (XaintParser *xaintpr)
XAINT_API XaintErr XaintParser_getLastError (XaintParser *xaintpr)
XAINT_API XaintNum XaintParser_getRowNum (XaintParser *xaintpr)
XAINT_API XaintNum XaintParser_getColNum (XaintParser *xaintpr)
XAINT_API void XaintParser_feedData (XaintParser *xaintpr, XaintChar *data, XaintNum size)
XAINT_API XaintBool XaintParser_parse (XaintParser *xaintpr)
XAINT_API XaintBool XaintParser_parseString (XaintParser *xaintpr, XaintChar *string)


Typedef Documentation

typedef struct XaintParser_type XaintParser
 

The XaintParser class.

Definition at line 129 of file xaint.h.

typedef void(* XaintParserDataRequestFunc)(XaintParser *xaintpr)
 

A type definition for the data request callback of the XaintParser.

Definition at line 131 of file xaint.h.

typedef void(* XaintParserEventFunc)(XaintParser *xaintpr, XaintChar *data, XaintType type)
 

A type definition for the event callback of the XaintParser.

Definition at line 130 of file xaint.h.


Function Documentation

XAINT_API void XaintParser_delete XaintParser xaintpr  ) 
 

Delete an XaintParser from memory.

XAINT_API void XaintParser_feedData XaintParser xaintpr,
XaintChar data,
XaintNum  size
 

Used to feed more data to the XaintParser during the /a XaintParserDataRequestFunc callback.

XAINT_API XaintNum XaintParser_getColNum XaintParser xaintpr  ) 
 

Gets the current column position.

XAINT_API XaintParserDataRequestFunc XaintParser_getDataRequest XaintParser xaintpr  ) 
 

Gets the data request callback event for the XaintParser.

XAINT_API XaintParserEventFunc XaintParser_getEvent XaintParser xaintpr  ) 
 

Gets the event property of the XaintParser.

XAINT_API XaintErr XaintParser_getLastError XaintParser xaintpr  ) 
 

Gets the last parsing error.

XAINT_API XaintNum XaintParser_getRowNum XaintParser xaintpr  ) 
 

Gets the current row position.

XAINT_API XaintUnknown XaintParser_getUserData XaintParser xaintpr  ) 
 

Gets the custom UserData property.

XAINT_API XaintParser* XaintParser_new void   ) 
 

Creates a new XaintParser into memory.

Example:

This example contains all XaintParser functions.

#include <stdio.h> #include <xaint.h> static void request(XaintParser *parser) { FILE *f; char buffer[50]; size_t bytesRead; f = (FILE*)XaintParser_getUserData(parser); bytesRead = fread(buffer, 1, sizeof(buffer), f); XaintParser_feedData(parser, buffer, bytesRead); } static void event(XaintParser *parser, XaintChar *data, XaintType type) { printf("(%d) Event [%s] type: '%c'\n", parser, data, type); } int main() { FILE *f; XaintParser *parser; f = fopen("note.xnt", "rb"); if (!f) { printf("ERROR: could not open file.\n"); return 1; } parser = XaintParser_new(); XaintParser_setUserData(parser, f); XaintParser_setDataRequest(parser, request); XaintParser_setEvent(parser, event); printf("Parsing file\n"); printf("\tUserData: (%d)\n", XaintParser_getUserData(parser)); printf("\tDataRequest: (%d)\n", XaintParser_getDataRequest(parser)); printf("\tEvent: (%d)\n", XaintParser_getEvent(parser)); printf("\n"); if (!XaintParser_parse(parser)) { printf("error: #%d, (col %d, row %d)\n", XaintParser_getLastError(parser), XaintParser_getColNum(parser), XaintParser_getRowNum(parser)); return 1; } printf("\nFinished\n"); fclose(f); XaintParser_delete(parser); return 0; }

XAINT_API XaintBool XaintParser_parse XaintParser xaintpr  ) 
 

Begins the parsing.

XAINT_API XaintBool XaintParser_parseString XaintParser xaintpr,
XaintChar string
 

Parses a string and returns immediately.

XAINT_API void XaintParser_setDataRequest XaintParser xaintpr,
XaintParserDataRequestFunc  dataRequest
 

Sets the data request callback event for the XaintParser.

XAINT_API void XaintParser_setEvent XaintParser xaintpr,
XaintParserEventFunc  event
 

Sets the event property of the XaintParser.

XAINT_API void XaintParser_setUserData XaintParser xaintpr,
XaintUnknown  userData
 

Sets the custom UserData property.


Generated on Sun Apr 25 11:36:04 2004 for Xaint by doxygen 1.3.6