# XQilla XQC API Documentation

# XQC_Implementation_s Struct Reference

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

`#include <xqc.h>`

List of all members.

## Public Attributes

void *(* | get_interface )(const XQC_Implementation *implementation, const char *name)
| Called to retrieve an implementation specific interface.
void(* | free )(XQC_Implementation *implementation)
| Called to free the resources associated with the XQC_Implementation.
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.
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.
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.
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.
Functions for parsing documents
XQC_Error(* | parse_document )(XQC_Implementation *implementation, const char *string, XQC_Sequence **sequence)
| XQC_PARSE_ERROR.
XQC_Error(* | parse_document_file )(XQC_Implementation *implementation, FILE *file, XQC_Sequence **sequence)
| XQC_PARSE_ERROR.
XQC_Error(* | parse_document_stream )(XQC_Implementation *implementation, XQC_InputStream *stream, XQC_Sequence **sequence)
| XQC_PARSE_ERROR.
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:

  | implementation | The XQC_Implementation that this function pointer is a member of
  `[out]` | context | The 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:

  | implementation | The 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:

  | implementation | The XQC_Implementation that this function pointer is a member of
  | name | The 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:

  | implementation | The XQC_Implementation that this function pointer is a member of.
  | string | The query to prepare as a UTF-8 string.
  | context | The initial static context for this query, or 0 to use the implementation defined default static context.
  `[out]` | expression | The 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:

  | implementation | The XQC_Implementation that this function pointer is a member of.
  | file | The file containing the query to prepare.
  | context | The initial static context for this query, or 0 to use the implementation defined default static context.
  `[out]` | expression | The 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:

  | implementation | The XQC_Implementation that this function pointer is a member of
  | stream | The stream returning the query to prepare.
  | context | The initial static context for this query, or 0 to use the implementation defined default static context.
  `[out]` | expression | The 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:

- xqc.h