Mon, 23 Mar 2015 15:48:45 +0100
added missing stuff to davql types
/* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. * * Copyright 2015 Olaf Wintermann. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ #ifndef DAVQLPARSER_H #define DAVQLPARSER_H #ifdef __cplusplus extern "C" { #endif #include "ucx/string.h" #include "ucx/list.h" /** * Enumeration of possible statement types. */ typedef enum {GET, PUT} davqltype_t; /** * Enumeration of possible expression types. */ typedef enum { LITERAL, IDENTIFIER, UNARY, BINARY, LOGICAL, FUNCCALL } davqlexprtype_t; /** * Enumeration of possible expression operators. */ typedef enum { ADD, SUB, MUL, DIV, AND, OR, XOR, NEG, NOT, LAND, LOR, EQ, NEQ, LT, GT, LE, GE } davqloperator_t; /** * An expression within a DAVQL query. */ typedef struct _davqlexpr DavQLExpression; /** * The structure for type DavQLExpression. */ struct _davqlexpr { /** * The original expression text. * Contains the literal value, if type is LITERAL. */ sstr_t srctext; /** * The expression type. */ davqlexprtype_t type; /** * Operator. * */ davqloperator_t op; /** * Left or single operand. * <code>NULL</code> for literals or identifiers. */ DavQLExpression *expr1; /** * Right operand. * <code>NULL</code> for literals, identifiers or unary expressions. */ DavQLExpression *expr2; }; /** * Query statement object. * Contains the binary information about the parsed query. * * The grammar for a DavQLStatement is: * * <b>GET:</b> * document it so * * <b>PUT:</b> * make it so * */ typedef struct { /** * The original query text. */ sstr_t srctext; /** * The statement type. */ davqltype_t type; /** * The list of field expressions. * <ul> * <li> * GET: the list of queried fields (may contain arbitrary expressions) * </li> * <li> * PUT: the list of DAV properties that shall receive new values * (must be a list of IDENTIFIER expressions) * </li> * </ul> * This may be <code>NULL</code> for GET queries, to request all properties. */ UcxList* fields; /** * The list of DavQLExpressions for the new DAV property values. * This is <code>NULL</code> for GET queries. */ UcxList* putvalues; /** * A DavQLExpression that denotes the queried path. */ DavQLExpression from; /** * Logical expression for selection. * <code>NULL</code>, if there is no where clause. */ DavQLExpression* where; /** * The recursion depth for the statement. * Defaults to SIZE_MAX (unbound recursion). */ size_t depth; } DavQLStatement; #ifdef __cplusplus } #endif #endif /* DAVQLPARSER_H */