gfxEngine_documentation
|
Data Structures | |
struct | simplexml_value_buffer |
struct | simplexml_user_data |
struct | simplexml_parser_state |
Macros | |
#define | FAIL 0 |
#define | SUCCESS 1 |
#define | NO_ERROR 0 |
#define | NOT_PARSED 1 |
#define | OUT_OF_MEMORY 2 |
#define | EARLY_TERMINATION 3 |
#define | ILLEGAL_AMPERSAND 4 |
#define | NO_UNICODE_SUPPORT 5 |
#define | GREATER_THAN_EXPECTED 6 |
#define | QUOTE_EXPECTED 7 |
#define | ILLEGAL_HANDLER 8 |
#define | NOT_INITIALIZED 9 |
#define | NO_DOCUMENT_TAG 10 |
#define | MISMATCHED_END_TAG 11 |
#define | ATTRIBUTE_EXPECTED 12 |
#define | EQUAL_SIGN_EXPECTED 13 |
#define | TAG_BEGIN_OPENING 0 |
#define | TAG_BEGIN_CLOSING 1 |
#define | TAG_END 2 |
#define | PROCESSING_INSTRUCTION 3 |
#define | DOCTYPE 4 |
#define | COMMENT 5 |
#define | ATTRIBUTE 6 |
#define | CONTENT 7 |
#define | UNKNOWN 8 |
#define | SPACE ' ' |
#define | LF '\xa' |
#define | CR '\xd' |
Typedefs | |
typedef struct simplexml_value_buffer | TSimpleXmlValueBuffer |
typedef struct simplexml_value_buffer * | SimpleXmlValueBuffer |
typedef struct simplexml_user_data | TSimpleXmlUserData |
typedef struct simplexml_user_data * | SimpleXmlUserData |
typedef struct simplexml_parser_state | TSimpleXmlParserState |
typedef struct simplexml_parser_state * | SimpleXmlParserState |
#define ATTRIBUTE 6 |
#define ATTRIBUTE_EXPECTED 12 |
#define COMMENT 5 |
#define CONTENT 7 |
#define CR '\xd' |
#define DOCTYPE 4 |
#define EARLY_TERMINATION 3 |
#define EQUAL_SIGN_EXPECTED 13 |
#define FAIL 0 |
#define GREATER_THAN_EXPECTED 6 |
#define ILLEGAL_AMPERSAND 4 |
#define ILLEGAL_HANDLER 8 |
#define LF '\xa' |
#define MISMATCHED_END_TAG 11 |
#define NO_DOCUMENT_TAG 10 |
#define NO_ERROR 0 |
#define NO_UNICODE_SUPPORT 5 |
#define NOT_INITIALIZED 9 |
#define NOT_PARSED 1 |
#define OUT_OF_MEMORY 2 |
#define PROCESSING_INSTRUCTION 3 |
#define QUOTE_EXPECTED 7 |
#define SPACE ' ' |
#define SUCCESS 1 |
#define TAG_BEGIN_CLOSING 1 |
#define TAG_BEGIN_OPENING 0 |
#define TAG_END 2 |
#define UNKNOWN 8 |
typedef struct simplexml_parser_state * SimpleXmlParserState |
typedef struct simplexml_user_data * SimpleXmlUserData |
typedef struct simplexml_value_buffer * SimpleXmlValueBuffer |
typedef struct simplexml_parser_state TSimpleXmlParserState |
SimpleXmlParser internal state.
This structure holds all data necessary for the simple xml parser to operate.
This struct describes the internal representation of a SimpleXmlParserState.
typedef struct simplexml_user_data TSimpleXmlUserData |
User data stack. This structure is a simple stack for user data.
typedef struct simplexml_value_buffer TSimpleXmlValueBuffer |
Value buffer. This structure resembles a string buffer that grows automatically when inserting data.
int addNextTokenCharValue | ( | SimpleXmlParserState | parser, |
char | c | ||
) |
Appends a character to the next token value string.
parser | the parser whose next token value string is to be modified. |
c | the character to append. |
int addNextTokenStringValue | ( | SimpleXmlParserState | parser, |
char * | szInput | ||
) |
Appends a zero terminated string to the next token value string.
parser | the parser whose next token value string is to be modified. |
szInput | the zero terminated string to append. |
int appendCharToSimpleXmlValueBuffer | ( | SimpleXmlValueBuffer | vb, |
char | c | ||
) |
Appends a character to the value buffer.
vb | the value buffer to append to. |
c | the character to append. |
int appendStringToSimpleXmlValueBuffer | ( | SimpleXmlValueBuffer | vb, |
const char * | szInput | ||
) |
Appends a zero terminated string to the value buffer.
vb | the value buffer to append to. |
szInput | the input string to append. |
int clearSimpleXmlValueBuffer | ( | SimpleXmlValueBuffer | vb | ) |
Resets the append location of the value buffer.
vb | the value buffer to clear. |
SimpleXmlParserState createSimpleXmlParser | ( | const char * | sData, |
long | nDataSize | ||
) |
Creates a new simple xml parser for the specified input data.
sData | the input data to parse (must no be NULL). |
nDataSize | the size of the input data buffer (sData) to parse (must be greater than 0). |
SimpleXmlValueBuffer createSimpleXmlValueBuffer | ( | long | nInitialSize | ) |
Creates a new value buffer of the specified size.
The value buffer automatically grows when appending characters if it is not large enough.
The value buffer uses 'malloc' to allocate buffer space. The user is responsible for freeing the value buffer created using destroySimpleXmlValueBuffer.
nInitialSize | the initial size of the value buffer in chars. |
void destroySimpleXmlParser | ( | SimpleXmlParserState | parser | ) |
Destroys the specified simple xml parser.
parser | the parser to destroy (must have been created using createSimpleXmlParser). |
void destroySimpleXmlValueBuffer | ( | SimpleXmlValueBuffer | vb | ) |
Destroys a value buffer created using createSimpleXmlValueBuffer.
vb | the value buffer to destroy. |
char * getInternalSimpleXmlValueBufferContents | ( | SimpleXmlValueBuffer | vb | ) |
Returns the zero terminated internal string buffer of the value buffer specified.
Warning: Modifying the array returned modifies the internal data of the value buffer!
vb | the value buffer whose string buffer should be returned. |
char * getSimpleXmlParseErrorDescription | ( | SimpleXmlParserState | parser | ) |
Returns a description of the error that occured during parsing.
parser | the parser for which to get the error description. |
int getSimpleXmlValueBufferContentLength | ( | SimpleXmlValueBuffer | vb | ) |
Returns the content length of the value buffer (including a trailing zero termination character).
vb | the value buffer whose content length should be determined. |
int getSimpleXmlValueBufferContents | ( | SimpleXmlValueBuffer | vb, |
char * | szOutput, | ||
long | nMaxLen | ||
) |
Retrieves the buffer content and stores it to the specified output array.
vb | the value buffer whose content should be retrieved. |
szOutput | the output character array to store it to, the output array is in any case zero terminated! |
nMaxLen | the maximum number of characters to write to the output array. |
int growSimpleXmlValueBuffer | ( | SimpleXmlValueBuffer | vb | ) |
Grows the internal data buffer of the value buffer.
vb | the value buffer to grow. |
int initializeSimpleXmlParser | ( | SimpleXmlParserState | parser, |
const char * | sData, | ||
long | nDataSize | ||
) |
Reinitializes the specified simple xml parser for parsing the specified input data.
parser | the parser to initialize. |
sData | the input data to parse (must no be NULL). |
nDataSize | the size of the input data buffer (sData) to parse (must be greater than 0). |
0 if the parser was initialized successfully.
int parseOneTag | ( | SimpleXmlParserState | parser, |
SimpleXmlTagHandler | parentHandler | ||
) |
Parses exactly one tag.
int parseSimpleXml | ( | SimpleXmlParserState | parser, |
SimpleXmlTagHandler | handler | ||
) |
Starts an initialized (or newly created) xml parser with the specified document tag handler.
parser | the parser to start. |
handler | the handler to use for the document tag. |
0 if there was an error.
char peekInputChar | ( | SimpleXmlParserState | parser | ) |
Peeks at the current input character at the read cursor position of the specified parser.
parser | the parser for which to peek. |
char peekInputCharAt | ( | SimpleXmlParserState | parser, |
int | nOffset | ||
) |
Peeks at the character with the specified offset from the cursor (i.e. the last character read).
Note: To peek at the next character that will be read use and offset of 0.
parser | the parser for which to peek. |
nOffset | the peek offset relative to the position of the last char read. |
int readChar | ( | SimpleXmlParserState | parser | ) |
Reads the next character from the input data and appends it to the next token value buffer of the parser.
Note: This method does not support unicode and 8-bit characters are read using the default platform encoding.
parser | the parser for which to read the next input character. |
char readInputChar | ( | SimpleXmlParserState | parser | ) |
Reads the next input character from the specified parser and returns it.
Note: If an error is encountered '\0' is returned and the nError flag of the parser is set to EARLY_TERMINATION.
parser | the parser from which to read the next input character. |
int readNextContentToken | ( | SimpleXmlParserState | parser | ) |
Scanner that reads the next token type and sets the nNextToken type and the value buffer of the parser. Must not be invoked when the last token read was a TAG_BEGIN (use readNextTagToken in such a case).
The following token types are supported:
Type | ValueBuffer | Example --------------------—+----------—+----------— TAG_BEGIN_OPENING | foo | <foo TAG_END | foo | </foo> CONTENT | foo | foo PROCESSING_INSTRUCTION | XML | <?XML?> UNKNOWN | WHATEVER | <!WHATEVER> COMMENT | foo | DOCTYPE | foo | <!DOCTYPEfoo>
parser | the parser for which to read the next token. |
int readNextTagToken | ( | SimpleXmlParserState | parser | ) |
Scanner that reads the contents of a tag and sets the nNextToken type and the value buffer of the parser. Must not be invoked unless the last token read was a TAG_BEGIN (see readNextContentToken in such a case).
The following token types are supported:
Type | ValueBuffer | Example --------------------—+----------—+----------— TAG_END | <unchanged> | /> TAG_BEGIN_CLOSING | <unchanged> | > ATTRIBUTE | bar | foo="bar"
Note: The name of an attribute (e.g. foo in the above example) is stored in the attribute name field of the parser (szAttributeName).
parser | the parser for which to read the next token. |
SimpleXmlParser simpleXmlCreateParser | ( | const char * | sData, |
long | nDataSize | ||
) |
Creates a new simple xml parser for the specified input data.
The input data may be parsed with simpleXmlParse and the parser returned by this function as parameter.
Note: The parser will not copy the input data or in any way modify it. However any modifications of the input data in a callback handler while parsing will have an undefined result!
sData | the input data to parse (must no be NULL). |
nDataSize | the size of the input data buffer (sData) to parse (must be greater than 0). |
void simpleXmlDestroyParser | ( | SimpleXmlParser | parser | ) |
Destroys the specified simple xml parser.
parser | the parser to destroy (must have been created using simpleXmlCreateParser). |
char* simpleXmlGetErrorDescription | ( | SimpleXmlParser | parser | ) |
Returns a description of the error that occured during parsing.
parser | the parser for which to get the error description. |
long simpleXmlGetLineNumber | ( | SimpleXmlParser | parser | ) |
Returns the line number of the current input line that the parser has read.
In case of an error this method will return the line number on which the error was encountered after a call to simpleXmlParse.
If called from a handler during parsing this function will return the current line number.
If called after a successfull simpleXmlParse run this function will return the line number of the last line parsed in the xml data.
void* simpleXmlGetUserData | ( | SimpleXmlParser | parser | ) |
Peeks at the top of the user data stack.
The last pointer pushed on the user data stack is returned.
Note: This function does not modify the stack.
This function is a convenience function for simpleXmlGetUserDataAt(parser, 0);
parser | the parser from which to get the user data pointer. |
void* simpleXmlGetUserDataAt | ( | SimpleXmlParser | parser, |
int | nLevel | ||
) |
Peeks at a specified location from to the top of the user data stack.
The level indicates the level from the top of the stack that is inspected.
Note: This method does not modify the stack.
parser | the parser from which to get the user data pointer. |
nLevel | the level (from the top of the stack) to inspect. |
int simpleXmlInitializeParser | ( | SimpleXmlParser | parser, |
const char * | sData, | ||
long | nDataSize | ||
) |
Reinitializes the specified simple xml parser for parsing the specified input data.
parser | the parser to initialize. |
sData | the input data to parse (must no be NULL). |
nDataSize | the size of the input data buffer (sData) to parse (must be greater than 0). |
void* simpleXmlNopHandler | ( | SimpleXmlParser | parser, |
SimpleXmlEvent | event, | ||
const char * | szName, | ||
const char * | szAttribute, | ||
const char * | szValue | ||
) |
No operation handler (used internally).
int simpleXmlParse | ( | SimpleXmlParser | parser, |
SimpleXmlTagHandler | handler | ||
) |
Starts an initialized (or newly created) xml parser with the specified document tag handler.
Note: This function may only be called once after creation or initialization of a parser. To reuse the parser it has to be freshly initialized (using simpleXmlInitializeParser) prior to calling the function again.
parser | the parser to start. |
handler | the handler to use for the document tag. |
void simpleXmlParseAbort | ( | SimpleXmlParser | parser, |
int | nErrorCode | ||
) |
Causes the simple xml parser to abort parsing of the input data.
This method may only be called from a tag handler.
The active simpleXmlParse run will be aborted and the simpleXmlParse function will return with the specified error code.
nErrorCode | the error code with which to abort (the error code must be >= SIMPLE_XML_USER_ERROR else the abort request is ignored!) |
void* simpleXmlPopUserData | ( | SimpleXmlParser | parser | ) |
Pops the last pointer pushed on the user data stack of the parser.
parser | the parser on which to pop the user data pointer. |
int simpleXmlPushUserData | ( | SimpleXmlParser | parser, |
void * | pData | ||
) |
Pushes the specified pointer on the user data stack of the parser.
parser | the parser on which to push the user data pointer. |
pData | pointer to the user data to set (NULL is not a valid value). |
void skipInputChar | ( | SimpleXmlParserState | parser | ) |
Skips the current input read character.
parser | the parser whose read cursor should be incremented. |
void skipInputChars | ( | SimpleXmlParserState | parser, |
int | nAmount | ||
) |
Moves the read cursor of the specified parser by the specified amount.
parser | the parser whose read cursor is to be moved. |
nAmount | the amount by which to move the cursor (> 0). |
int skipWhitespace | ( | SimpleXmlParserState | parser | ) |
Skips any whitespace at the cursor position of the parser specified.
Note: All characters smaller than the space character are considered to be whitespace.
parser | the parser for which to skip whitespace. |
int zeroTerminateSimpleXmlValueBuffer | ( | SimpleXmlValueBuffer | vb | ) |
Zero terminates the internal buffer without appending any characters (i.e. the append location is not modified).
vb | the value buffer to zero terminate. |