cqlutil.c File Reference

Implements CQL tree node utilities. More...

#include <stdlib.h>
#include <string.h>
#include <yaz/cql.h>

Go to the source code of this file.

Functions

void cql_fputs (const char *buf, void *client_data)
 stream handle for file (used by cql_to_xml_stdio)
struct cql_nodecql_node_dup (NMEM nmem, struct cql_node *cp)
struct cql_nodecql_node_mk_sc (NMEM nmem, const char *index, const char *relation, const char *term)
 creates a search clause node (st).
struct cql_nodecql_node_mk_boolean (NMEM nmem, const char *op)
 creates a boolean node.
const char * cql_uri (void)
 returns the standard CQL context set URI.
struct cql_nodecql_apply_prefix (NMEM nmem, struct cql_node *n, const char *prefix, const char *uri)
 applies a prefix+uri to "unresolved" index and relation URIs. "unresolved" URIs are those nodes where member index_uri / relation_uri is NULL.
void cql_node_destroy (struct cql_node *cn)
 destroys a node and its children.
int cql_strcmp (const char *s1, const char *s2)
 compares two CQL strings (ala strcmp)
int cql_strncmp (const char *s1, const char *s2, size_t n)
 compares two CQL strings (ala strncmp)

Detailed Description

Implements CQL tree node utilities.

Definition in file cqlutil.c.


Function Documentation

struct cql_node* cql_apply_prefix ( NMEM  nmem,
struct cql_node n,
const char *  prefix,
const char *  uri 
) [read]

applies a prefix+uri to "unresolved" index and relation URIs. "unresolved" URIs are those nodes where member index_uri / relation_uri is NULL.

Definition at line 89 of file cqlutil.c.

References cql_node::boolean, cql_apply_prefix(), CQL_NODE_BOOL, CQL_NODE_ST, cql_strncmp(), nmem_strdup(), cql_node::st, cql_node::u, and cql_node::which.

Referenced by cql_apply_prefix(), cql_transform(), and yyparse().

void cql_fputs ( const char *  buf,
void *  client_data 
)

stream handle for file (used by cql_to_xml_stdio)

Definition at line 16 of file cqlutil.c.

Referenced by cql_to_xml_stdio(), and cql_transform_FILE().

void cql_node_destroy ( struct cql_node cn  ) 

destroys a node and its children.

Definition at line 132 of file cqlutil.c.

References cql_node::boolean, CQL_NODE_BOOL, cql_node_destroy(), CQL_NODE_ST, cql_node::st, cql_node::u, and cql_node::which.

Referenced by cql_node_destroy(), cql_parser_destroy(), cql_parser_stream(), and yyparse().

struct cql_node* cql_node_dup ( NMEM  nmem,
struct cql_node cp 
) [read]

duplicates a node (returns a copy of supplied node) .

Definition at line 22 of file cqlutil.c.

References cql_node::boolean, CQL_NODE_BOOL, cql_node_dup(), cql_node_mk_boolean(), cql_node_mk_sc(), CQL_NODE_ST, nmem_strdup(), cql_node::st, cql_node::u, and cql_node::which.

Referenced by cql_node_dup(), and yyparse().

struct cql_node* cql_node_mk_boolean ( NMEM  nmem,
const char *  op 
) [read]

creates a boolean node.

Definition at line 71 of file cqlutil.c.

References cql_node::boolean, CQL_NODE_BOOL, nmem_malloc(), nmem_strdup(), cql_node::u, and cql_node::which.

Referenced by cql_node_dup(), and yyparse().

struct cql_node* cql_node_mk_sc ( NMEM  nmem,
const char *  index,
const char *  relation,
const char *  term 
) [read]

creates a search clause node (st).

Definition at line 48 of file cqlutil.c.

References CQL_NODE_ST, nmem_malloc(), nmem_strdup(), cql_node::st, cql_node::u, and cql_node::which.

Referenced by cql_node_dup(), and yyparse().

int cql_strcmp ( const char *  s1,
const char *  s2 
)

compares two CQL strings (ala strcmp)

Parameters:
s1 string 1
s2 string 2
Returns:
comparison value Compares two CQL strings (for relations, operators, etc) (unfortunately defined as case-insensitive unlike XML etc)

Definition at line 148 of file cqlutil.c.

Referenced by cql_lookup_property(), cql_transform(), cql_transform_r(), and yylex().

int cql_strncmp ( const char *  s1,
const char *  s2,
size_t  n 
)

compares two CQL strings (ala strncmp)

Parameters:
s1 string 1
s2 string 2
n size
Returns:
comparison value Compares two CQL strings at most n bytes (unfortunately defined as case-insensitive unlike XML etc)

Definition at line 164 of file cqlutil.c.

Referenced by cql_apply_prefix(), and cql_transform().

const char* cql_uri ( void   ) 

returns the standard CQL context set URI.

Returns:
CQL URI string

Definition at line 84 of file cqlutil.c.

Referenced by cql_transform_r().

Generated on Tue Aug 17 13:13:19 2010 for YAZ by  doxygen 1.6.3