Zorba
The XQuery Processor
Documentation
Live Demo
Modules
Download
Tools
Blog
Code
Main Page
Namespaces
Data Structures
Files
File List
Globals
include
zorba
options.h
Go to the documentation of this file.
1
/*
2
* Copyright 2006-2008 The FLWOR Foundation.
3
*
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
* you may not use this file except in compliance with the License.
6
* You may obtain a copy of the License at
7
*
8
* http://www.apache.org/licenses/LICENSE-2.0
9
*
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
15
*/
16
#ifndef ZORBA_OPTIONS_H
17
#define ZORBA_OPTIONS_H
18
#include <zorba/config.h>
19
20
#ifdef __cplusplus
21
#include <vector>
22
#include <zorba/zorba_string.h>
23
#endif
24
25
26
/** \brief The optimization level used for optimizing the query. */
27
typedef
enum
{
28
ZORBA_OPT_LEVEL_O0
,
/**< Don't use any optimization. */
29
ZORBA_OPT_LEVEL_O1
,
/**< Use basic optimizations
30
(e.g.\ removing sorting, removing duplicate elimination,
31
or constant folding). */
32
ZORBA_OPT_LEVEL_O2
/** Use basic optimizations (like O1) and some
33
* more optimizations (like not to generate an iterator
34
* for inlined functions) - call stacks in case of
35
* an exception are not generated.
36
*/
37
}
Zorba_opt_level_t
;
38
39
#if !defined(__cplusplus)
40
typedef
enum
{
false
= 0,
true
= 1 }
bool
;
41
#endif
42
43
/** \brief Set of hints that can be passed to the query compiler.
44
*
45
* An instance of this class can be passed to the compileQuery function
46
* of the Zorba class or the compile function of this class.
47
* The members of this class represent hints that are passed to the
48
* query compiler. For example, whether optimization of the query
49
* should be done (O1) or not (O0).
50
*
51
* example_6 in file \link simple.cpp \endlink shows an example
52
* how CompilerHints can be used.
53
*/
54
typedef
struct
Zorba_CompilerHints
55
{
56
/** \brief The optimization level that is used */
57
Zorba_opt_level_t
opt_level
;
58
/** \brief Treat the query as a library module */
59
bool
lib_module
;
60
61
/**
62
* \brief By default, this flag is set to false. Applications may set it to
63
* true if they plan to execute the query only via one of the methods that
64
* serialize the query result.
65
*/
66
bool
for_serialization_only
;
67
68
#ifdef __cplusplus
69
/** \brief Default constructor for CompilerHints which assigns default values to all hints (C++ only).
70
*
71
* Default values:
72
* - optimization level: O1
73
* - library module: false
74
*/
75
ZORBA_DLL_PUBLIC
Zorba_CompilerHints
();
76
#endif
77
}
Zorba_CompilerHints_t
;
78
79
80
typedef
enum
81
{
82
ZORBA_SERIALIZATION_METHOD_XML
,
83
ZORBA_SERIALIZATION_METHOD_HTML
,
84
ZORBA_SERIALIZATION_METHOD_XHTML
,
85
ZORBA_SERIALIZATION_METHOD_TEXT
,
86
ZORBA_SERIALIZATION_METHOD_BINARY
87
}
Zorba_serialization_method_t
;
88
89
90
typedef
enum
91
{
92
ZORBA_BYTE_ORDER_MARK_YES
,
93
ZORBA_BYTE_ORDER_MARK_NO
94
}
Zorba_byte_order_mark_t
;
95
96
97
typedef
enum
98
{
99
ZORBA_ESCAPE_URI_ATTRIBUTES_YES
,
100
ZORBA_ESCAPE_URI_ATTRIBUTES_NO
101
}
Zorba_escape_uri_attributes_t
;
102
103
typedef
enum
{
104
ZORBA_INCLUDE_CONTENT_TYPE_YES
,
105
ZORBA_INCLUDE_CONTENT_TYPE_NO
106
}
Zorba_include_content_type_t
;
107
108
typedef
enum
{
109
ZORBA_INDENT_YES
,
110
ZORBA_INDENT_NO
111
}
Zorba_indent_t
;
112
113
typedef
enum
{
114
ZORBA_NORMALIZATION_FORM_NFC
,
115
ZORBA_NORMALIZATION_FORM_NFD
,
116
ZORBA_NORMALIZATION_FORM_NFKC
,
117
ZORBA_NORMALIZATION_FORM_NFKD
,
118
ZORBA_NORMALIZATION_FORM_FULLY_normalized
,
119
ZORBA_NORMALIZATION_FORM_NONE
120
}
Zorba_normalization_form_t
;
121
122
typedef
enum
{
123
ZORBA_OMIT_XML_DECLARATION_YES
,
124
ZORBA_OMIT_XML_DECLARATION_NO
125
}
Zorba_omit_xml_declaration_t
;
126
127
typedef
enum
{
128
ZORBA_STANDALONE_YES
,
129
ZORBA_STANDALONE_NO
,
130
ZORBA_STANDALONE_OMIT
131
}
Zorba_standalone_t
;
132
133
typedef
enum
{
134
ZORBA_UNDECLARE_PREFIXES_YES
,
135
ZORBA_UNDECLARE_PREFIXES_NO
136
}
Zorba_undeclare_prefixes_t
;
137
138
typedef
enum
{
139
ZORBA_ENCODING_UTF8
,
140
ZORBA_ENCODING_UTF16
141
}
Zorba_encoding_t
;
142
143
typedef
enum
{
144
ZORBA_USE_BINARY_ARCHIVE
,
145
ZORBA_USE_XML_ARCHIVE
146
}
Zorba_binary_plan_format_t
;
147
148
typedef
enum
{
149
DONT_SAVE_UNUSED_FUNCTIONS
= 0,
150
SAVE_UNUSED_FUNCTIONS
= 1
151
}
Zorba_save_plan_options_t
;
152
/** \brief Options that configure the serialization process of a query result.
153
* See http://www.w3.org/TR/2005/CR-xslt-xquery-serialization-20051103/.
154
*
155
* This struct defines options that can be passed to the serialization process of a query
156
* result. An instance of this class can be passed to the serialize function.
157
*
158
* File \link serialization.cpp \endlink contains examples that show how to use
159
* the SerializerOptions.
160
*/
161
#ifdef __cplusplus
162
typedef
struct
ZORBA_DLL_PUBLIC Zorba_SerializerOptions
163
{
164
Zorba_serialization_method_t
ser_method;
165
Zorba_byte_order_mark_t
byte_order_mark;
166
Zorba_escape_uri_attributes_t
escape_uri_attributes;
167
Zorba_include_content_type_t
include_content_type;
168
Zorba_indent_t
indent;
169
Zorba_normalization_form_t
normalization_form;
170
Zorba_omit_xml_declaration_t
omit_xml_declaration;
171
Zorba_standalone_t
standalone;
172
Zorba_undeclare_prefixes_t
undeclare_prefixes;
173
Zorba_encoding_t
encoding;
174
175
zorba::String media_type;
176
zorba::String doctype_system;
177
zorba::String doctype_public;
178
zorba::String cdata_section_elements;
179
zorba::String version;
180
181
182
/** \brief Default constructor for SerializerOptions which assigns default values to all
183
* options (C++ only).
184
*
185
* Default values:
186
* - serialization method: XML
187
* - byte-order-mark: NO
188
* - esacpe-uri-attributes: NO
189
* - include-content-type: NO
190
* - indent: NO
191
* - normalization-form: none
192
* - omit-xml-declaration: NO
193
* - standalone: omit
194
* - undeclare-prefixes: NO
195
*/
196
197
Zorba_SerializerOptions();
198
199
/** \brief Helper function to set a serializer parameter value from a key / value string pair.
200
*
201
*
202
* \retval None
203
*/
204
void
SetSerializerOption(
const
char
* parameter,
const
char
* value);
205
206
/** \brief Helper function to create a Zorba_SerializerOptions from a vector of key / value
207
* string pairs
208
*
209
* \retval The created Zorba_SerializerOptions structure
210
*/
211
static
Zorba_SerializerOptions SerializerOptionsFromStringParams(
const
std::vector<std::pair<std::string,std::string> >& params);
212
213
}
Zorba_SerializerOptions_t
;
214
#endif
215
216
217
#ifndef __cplusplus
218
struct
Zorba_SerializerOptions;
219
typedef
struct
Zorba_SerializerOptions
Zorba_SerializerOptions_t
;
220
#endif
221
222
223
#ifdef __cplusplus
224
extern
"C"
{
225
#endif
226
227
/** \brief Helper function for C to set default values ComplilerHints struct.
228
*
229
* \retval Zorba_CompilerHints_t with default member values
230
*/
231
ZORBA_DLL_PUBLIC
void
Zorba_CompilerHints_default
(
Zorba_CompilerHints_t
*);
232
233
/** \brief Helper function to create a Zorba_SerializerOptions_t struct because
234
* of missing default constructor. C++ code can delete the
235
* returned Zorba_SerializerOptions_t* struct, while C code
236
* must call Zorba_SerializerOptions_free().
237
*
238
* \retval Zorba_CompilerHints_t with default member values
239
*/
240
ZORBA_DLL_PUBLIC
Zorba_SerializerOptions_t
*
Zorba_SerializerOptions_default
();
241
242
/** \brief Helper function to delete a Zorba_SerializerOptions_t struct
243
*
244
* \retval Zorba_CompilerHints_t with default member values
245
*/
246
ZORBA_DLL_PUBLIC
void
Zorba_SerializerOptions_free
(
Zorba_SerializerOptions_t
* serializerOptions);
247
248
/** \brief Helper function to set an option in a Zorba_SerializerOptions_t structure
249
*
250
* \param serializerOptions serializer options
251
* \param parameter the serializer parameter to be configured
252
* \param value the value to which the parameter should be set
253
* \retval Zorba_CompilerHints_t with default member values
254
*/
255
ZORBA_DLL_PUBLIC
void
Zorba_SerializerOptions_set
(
Zorba_SerializerOptions_t
* serializerOptions,
const
char
* parameter,
const
char
* value);
256
257
258
#ifdef __cplusplus
259
}
260
#endif
261
262
#endif
263
264
/* vim:set et sw=2 ts=2: */
Please enable JavaScript to view the
comments powered by Disqus.
blog comments powered by
Disqus