options.h

Go to the documentation of this file.
00001 /*
00002  * Copyright 2006-2008 The FLWOR Foundation.
00003  *
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  * 
00008  * http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 #ifndef ZORBA_OPTIONS_H
00017 #define ZORBA_OPTIONS_H
00018 
00019 /** \brief The optimization level used for optimizing the query. */
00020 typedef enum {
00021   ZORBA_OPT_LEVEL_O0, /**< Don't use any optimization. */
00022   ZORBA_OPT_LEVEL_O1  /**< Use basic optimizations 
00023                            (e.g.\ removing sorting, removing duplicate elimination, 
00024                            or constant folding). */
00025 } Zorba_opt_level_t;
00026 
00027 /** \brief Set of hints that can be passed to the query compiler.
00028  *
00029  * An instance of this class can be passed to the compileQuery function
00030  * of the Zorba class or the compile function of this class.
00031  * The members of this class represent hints that are passed to the
00032  * query compiler. For example, whether optimization of the query
00033  * should be done (O1) or not (O0).
00034  *
00035  * example_6 in file \link simple.cpp \endlink shows an example
00036  * how CompilerHints can be used.
00037  */
00038 typedef struct Zorba_CompilerHints {
00039   /** \brief The optimization level that is used */
00040   Zorba_opt_level_t opt_level;
00041 #ifdef __cplusplus
00042   /** \brief Default constructor for CompilerHints which assigns default values to all hints (C++ only).
00043    *
00044    * Default values:
00045    *   - optimization level: O1 
00046    */
00047   Zorba_CompilerHints();
00048 #endif
00049 } Zorba_CompilerHints_t;
00050 
00051 typedef enum {
00052   ZORBA_SERIALIZATION_METHOD_XML, 
00053   ZORBA_SERIALIZATION_METHOD_HTML,
00054   ZORBA_SERIALIZATION_METHOD_TEXT
00055 } Zorba_serialization_method_t;
00056 
00057 typedef enum {
00058   ZORBA_BYTE_ORDER_MARK_YES, 
00059   ZORBA_BYTE_ORDER_MARK_NO
00060 } Zorba_byte_order_mark_t;
00061 
00062 typedef enum {
00063   ZORBA_ESCAPE_URI_ATTRIBUTES_YES, 
00064   ZORBA_ESCAPE_URI_ATTRIBUTES_NO
00065 } Zorba_escape_uri_attributes_t;
00066 
00067 typedef enum {
00068   ZORBA_INCLUDE_CONTENT_TYPE_YES, 
00069   ZORBA_INCLUDE_CONTENT_TYPE_NO
00070 } Zorba_include_content_type_t;
00071 
00072 typedef enum {
00073   ZORBA_INDENT_YES, 
00074   ZORBA_INDENT_NO
00075 } Zorba_indent_t;
00076 
00077 typedef enum {
00078   ZORBA_NORMALIZATION_FORM_NFC, 
00079   ZORBA_NORMALIZATION_FORM_NFD, 
00080   ZORBA_NORMALIZATION_FORM_NFKC, 
00081   ZORBA_NORMALIZATION_FORM_NFKD, 
00082   ZORBA_NORMALIZATION_FORM_FULLY_normalized, 
00083   ZORBA_NORMALIZATION_FORM_NONE
00084 } Zorba_normalization_form_t;
00085 
00086 typedef enum {
00087   ZORBA_OMIT_XML_DECLARATION_YES, 
00088   ZORBA_OMIT_XML_DECLARATION_NO
00089 } Zorba_omit_xml_declaration_t;
00090 
00091 typedef enum {
00092   ZORBA_STANDALONE_YES, 
00093   ZORBA_STANDALONE_NO, 
00094   ZORBA_STANDALONE_OMIT
00095 } Zorba_standalone_t;
00096 
00097 typedef enum {
00098   ZORBA_UNDECLARE_PREFIXES_YES, 
00099   ZORBA_UNDECLARE_PREFIXES_NO
00100 } Zorba_undeclare_prefixes_t;
00101 
00102 /** \brief Options that configure the serialization process of a query result.
00103 *         See http://www.w3.org/TR/2005/CR-xslt-xquery-serialization-20051103/.
00104 *
00105 * This struct defines options that can be passed to the serialization process of a query
00106 * result. An instance of this class can be passed to the serialize function.
00107 *
00108 * File \link serialization.cpp \endlink contains examples that show how to use
00109 * the SerializerOptions.
00110 */
00111 typedef struct Zorba_SerializerOptions {
00112   Zorba_serialization_method_t  ser_method;
00113   Zorba_byte_order_mark_t       byte_order_mark;
00114   Zorba_escape_uri_attributes_t escape_uri_attributes;
00115   Zorba_include_content_type_t  include_content_type;
00116   Zorba_indent_t                indent;
00117   Zorba_normalization_form_t    normalization_form;
00118   Zorba_omit_xml_declaration_t  omit_xml_declaration;
00119   Zorba_standalone_t            standalone; 
00120   Zorba_undeclare_prefixes_t    undeclare_prefixes;
00121 
00122   /** \brief Default constructor for SerializerOptions which assigns default values to all 
00123    *         options (C++ only).
00124    *
00125    * Default values:
00126    *   - serialization method: XML
00127    *   - byte-order-mark: NO
00128    *   - esacpe-uri-attributes: NO
00129    *   - include-content-type: NO
00130    *   - indent: NO
00131    *   - normalization-form: none
00132    *   - omit-xml-declaration: NO
00133    *   - standalone: omit
00134    *   - undeclare-prefixes: NO
00135    */
00136 #ifdef __cplusplus
00137   Zorba_SerializerOptions();
00138 #endif
00139 } Zorba_SerializerOptions_t;
00140 
00141 
00142 
00143 #ifdef __cplusplus
00144 extern "C" {
00145 #endif
00146 
00147 /** \brief Helper function for C to create a Zorba_CompilerHints_t struct 
00148  *         because of missing default constructor. 
00149  *
00150  * \retval Zorba_CompilerHints_t with default member values 
00151  */
00152 Zorba_CompilerHints_t Zorba_CompilerHints_default();
00153 
00154 /** \brief Helper function for C to create a Zorba_SerializerOptions_t struct 
00155  *         because of missing default constructor. 
00156  *
00157  * \retval Zorba_CompilerHints_t with default member values 
00158  */
00159 Zorba_SerializerOptions_t Zorba_SerializerOptions_default();
00160 
00161 #ifdef __cplusplus
00162 }
00163 #endif
00164 
00165 #endif
00166