SourceForge.net Logo
Public Attributes | List of all members
XQC_Implementation_s Struct Reference

The XQC_Implementation struct provides factory functions for preparing queries. More...

#include <xqc.h>

Public Attributes

void *(* get_interface )(const XQC_Implementation *implementation, const char *name)
 Called to retrieve an implementation specific interface. More...
 
void(* free )(XQC_Implementation *implementation)
 Called to free the resources associated with the XQC_Implementation. More...
 
Functions for preparing queries
XQC_Error(* create_context )(XQC_Implementation *implementation, XQC_StaticContext **context)
 Creates a static context suitable for use in the prepare(), prepare_file() and prepare_stream() functions. More...
 
XQC_Error(* prepare )(XQC_Implementation *implementation, const char *string, const XQC_StaticContext *context, XQC_Expression **expression)
 Prepares a query from a UTF-8 string, returning an XQC_Expression object. More...
 
XQC_Error(* prepare_file )(XQC_Implementation *implementation, FILE *file, const XQC_StaticContext *context, XQC_Expression **expression)
 Prepares a query from a FILE pointer, returning an XQC_Expression object. More...
 
XQC_Error(* prepare_stream )(XQC_Implementation *implementation, XQC_InputStream *stream, const XQC_StaticContext *context, XQC_Expression **expression)
 Prepares a query from an XQC_InputStream, returning an XQC_Expression object. More...
 
Functions for parsing documents
XQC_Error(* parse_document )(XQC_Implementation *implementation, const char *string, XQC_Sequence **sequence)
 XQC_PARSE_ERROR. More...
 
XQC_Error(* parse_document_file )(XQC_Implementation *implementation, FILE *file, XQC_Sequence **sequence)
 XQC_PARSE_ERROR. More...
 
XQC_Error(* parse_document_stream )(XQC_Implementation *implementation, XQC_InputStream *stream, XQC_Sequence **sequence)
 XQC_PARSE_ERROR. More...
 
Functions for creating sequences
XQC_Error(* create_empty_sequence )(XQC_Implementation *implementation, XQC_Sequence **sequence)
 
XQC_Error(* create_singleton_sequence )(XQC_Implementation *implementation, XQC_ItemType type, const char *value, XQC_Sequence **sequence)
 
XQC_Error(* create_string_sequence )(XQC_Implementation *implementation, const char *values[], unsigned int count, XQC_Sequence **sequence)
 
XQC_Error(* create_integer_sequence )(XQC_Implementation *implementation, int values[], unsigned int count, XQC_Sequence **sequence)
 
XQC_Error(* create_double_sequence )(XQC_Implementation *implementation, double values[], unsigned int count, XQC_Sequence **sequence)
 

Detailed Description

The XQC_Implementation struct provides factory functions for preparing queries.

An XQC_Implementation object is thread-safe and can be used by multiple threads of execution at the same time.

The method of creating an XQC_Implementation object is beyond the scope of this API, and will typically involve calling an implementation defined function. Once created, the user is responsible for freeing the object by calling the free() function. The XQC_Implementation object should not be freed before all objects created using it's functions have been freed - doing so may cause undefined behaviour.

Examples:
xqc-basic.c, and xqc-context-item.c.

Member Data Documentation

XQC_Error(* XQC_Implementation_s::create_context)(XQC_Implementation *implementation, XQC_StaticContext **context)

Creates a static context suitable for use in the prepare(), prepare_file() and prepare_stream() functions.

The user is responsible for freeing the XQC_StaticContext object returned by calling XQC_StaticContext::free().

Parameters
implementationThe XQC_Implementation that this function pointer is a member of
[out]contextThe newly created XQC_StaticContext object.
Return values
XQC_NO_ERROR
XQC_INTERNAL_ERROR
XQC_Error(* XQC_Implementation_s::create_double_sequence)(XQC_Implementation *implementation, double values[], unsigned int count, XQC_Sequence **sequence)
XQC_Error(* XQC_Implementation_s::create_empty_sequence)(XQC_Implementation *implementation, XQC_Sequence **sequence)
XQC_Error(* XQC_Implementation_s::create_integer_sequence)(XQC_Implementation *implementation, int values[], unsigned int count, XQC_Sequence **sequence)
XQC_Error(* XQC_Implementation_s::create_singleton_sequence)(XQC_Implementation *implementation, XQC_ItemType type, const char *value, XQC_Sequence **sequence)
XQC_Error(* XQC_Implementation_s::create_string_sequence)(XQC_Implementation *implementation, const char *values[], unsigned int count, XQC_Sequence **sequence)
void(* XQC_Implementation_s::free)(XQC_Implementation *implementation)

Called to free the resources associated with the XQC_Implementation.

Parameters
implementationThe XQC_Implementation that this function pointer is a member of
Examples:
xqc-basic.c, and xqc-context-item.c.
void*(* XQC_Implementation_s::get_interface)(const XQC_Implementation *implementation, const char *name)

Called to retrieve an implementation specific interface.

Parameters
implementationThe XQC_Implementation that this function pointer is a member of
nameThe name that identifies the interface to return
Returns
A pointer to the interface, or 0 if the name is not recognized by this implementation of XQC.
XQC_Error(* XQC_Implementation_s::parse_document)(XQC_Implementation *implementation, const char *string, XQC_Sequence **sequence)

XQC_PARSE_ERROR.

Examples:
xqc-context-item.c.
XQC_Error(* XQC_Implementation_s::parse_document_file)(XQC_Implementation *implementation, FILE *file, XQC_Sequence **sequence)

XQC_PARSE_ERROR.

XQC_Error(* XQC_Implementation_s::parse_document_stream)(XQC_Implementation *implementation, XQC_InputStream *stream, XQC_Sequence **sequence)

XQC_PARSE_ERROR.

XQC_Error(* XQC_Implementation_s::prepare)(XQC_Implementation *implementation, const char *string, const XQC_StaticContext *context, XQC_Expression **expression)

Prepares a query from a UTF-8 string, returning an XQC_Expression object.

The user remains responsible for closing the file after preparation. The user is responsible for freeing the XQC_Expression object returned by calling XQC_Expression::free().

Parameters
implementationThe XQC_Implementation that this function pointer is a member of.
stringThe query to prepare as a UTF-8 string.
contextThe initial static context for this query, or 0 to use the implementation defined default static context.
[out]expressionThe resulting prepared expression.
Return values
XQC_NO_ERROR
XQC_INTERNAL_ERROR
XQC_STATIC_ERROR
XQC_TYPE_ERROR
XQC_DYNAMIC_ERROR
Examples:
xqc-basic.c, and xqc-context-item.c.
XQC_Error(* XQC_Implementation_s::prepare_file)(XQC_Implementation *implementation, FILE *file, const XQC_StaticContext *context, XQC_Expression **expression)

Prepares a query from a FILE pointer, returning an XQC_Expression object.

The encoding of the query in the file is determined by the implementation. The user remains responsible for closing the file after preparation. The user is responsible for freeing the XQC_Expression object returned by calling XQC_Expression::free().

Parameters
implementationThe XQC_Implementation that this function pointer is a member of.
fileThe file containing the query to prepare.
contextThe initial static context for this query, or 0 to use the implementation defined default static context.
[out]expressionThe resulting prepared expression.
Return values
XQC_NO_ERROR
XQC_INTERNAL_ERROR
XQC_UNRECOGNIZED_ENCODING
XQC_STATIC_ERROR
XQC_TYPE_ERROR
XQC_DYNAMIC_ERROR
XQC_Error(* XQC_Implementation_s::prepare_stream)(XQC_Implementation *implementation, XQC_InputStream *stream, const XQC_StaticContext *context, XQC_Expression **expression)

Prepares a query from an XQC_InputStream, returning an XQC_Expression object.

The encoding of the stream is determined by looking at XQC_InputStream::encoding, or by the implementation if XQC_InputStream::encoding is 0. The implementation is responsible for freeing the XQC_InputStream using the XQC_InputStream::free() function after it has finished with using it. The user is responsible for freeing the XQC_Expression object returned by calling XQC_Expression::free().

Parameters
implementationThe XQC_Implementation that this function pointer is a member of
streamThe stream returning the query to prepare.
contextThe initial static context for this query, or 0 to use the implementation defined default static context.
[out]expressionThe resulting prepared expression
Return values
XQC_NO_ERROR
XQC_INTERNAL_ERROR
XQC_UNRECOGNIZED_ENCODING
XQC_STATIC_ERROR
XQC_TYPE_ERROR
XQC_DYNAMIC_ERROR

The documentation for this struct was generated from the following file: