Ion C
C library for Ion
ion_writer.h
Go to the documentation of this file.
1 /*
2  * Copyright 2009-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.
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  * A copy of the License is located at:
7  *
8  * http://aws.amazon.com/apache2.0/
9  *
10  * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific
12  * language governing permissions and limitations under the License.
13  */
14 
17 #ifndef ION_WRITER_H_
18 #define ION_WRITER_H_
19 
20 #include "ion_types.h"
21 #include "ion_platform_config.h"
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 typedef struct _ion_writer_options
28 {
29  BOOL output_as_binary;
30 
35 
40 
45 
50 
55 
60 
65 
70 
75 
80 
85 
89  ION_CATALOG *pcatalog;
90 
100 
109  decContext *decimal_context;
110 
117 
122 
124 
125 
132 
139 
145 ION_API_EXPORT iERR ion_writer_options_add_shared_imports_symbol_tables(ION_WRITER_OPTIONS *options, ION_SYMBOL_TABLE **imports, SIZE imports_count);
146 
152 
161 ION_API_EXPORT iERR ion_writer_open_buffer (hWRITER *p_hwriter
162  ,BYTE *buffer
163  ,SIZE buf_length
164  ,ION_WRITER_OPTIONS *p_options);
165 
166 
176 ION_API_EXPORT iERR ion_writer_open_stream (hWRITER *p_hwriter
177  ,ION_STREAM_HANDLER fn_output_handler
178  ,void *handler_state
179  ,ION_WRITER_OPTIONS *p_options);
180 
181 ION_API_EXPORT iERR ion_writer_open (hWRITER *p_hwriter
182  ,ION_STREAM *p_stream
183  ,ION_WRITER_OPTIONS *p_options);
184 
185 ION_API_EXPORT iERR ion_writer_get_depth (hWRITER hwriter, SIZE *p_depth);
186 
187 ION_API_EXPORT iERR ion_writer_set_catalog (hWRITER hwriter, hCATALOG hcatalog);
188 ION_API_EXPORT iERR ion_writer_get_catalog (hWRITER hwriter, hCATALOG *p_hcatalog);
189 
198 ION_API_EXPORT iERR ion_writer_set_symbol_table (hWRITER hwriter, hSYMTAB hsymtab);
199 ION_API_EXPORT iERR ion_writer_get_symbol_table (hWRITER hwriter, hSYMTAB *p_hsymtab);
200 
217 ION_API_EXPORT iERR ion_writer_add_imported_tables (hWRITER hwriter, ION_COLLECTION *imports);
218 
223 ION_API_EXPORT iERR ion_writer_write_field_name (hWRITER hwriter, iSTRING name);
224 
229 ION_API_EXPORT iERR ion_writer_write_field_name_symbol(hWRITER hwriter, ION_SYMBOL *field_name);
230 
231 ION_API_EXPORT iERR ion_writer_clear_field_name (hWRITER hwriter);
232 
236 ION_API_EXPORT iERR ion_writer_add_annotation (hWRITER hwriter, iSTRING annotation);
237 
238 ION_API_EXPORT iERR ion_writer_add_annotation_symbol(hWRITER hwriter, ION_SYMBOL *annotation);
239 ION_API_EXPORT iERR ion_writer_write_annotations (hWRITER hwriter, iSTRING p_annotations, SIZE count);
240 ION_API_EXPORT iERR ion_writer_write_annotation_symbols(hWRITER hwriter, ION_SYMBOL *annotations, SIZE count);
241 ION_API_EXPORT iERR ion_writer_clear_annotations (hWRITER hwriter);
242 
243 ION_API_EXPORT iERR ion_writer_write_null (hWRITER hwriter);
244 ION_API_EXPORT iERR ion_writer_write_typed_null (hWRITER hwriter, ION_TYPE type);
245 ION_API_EXPORT iERR ion_writer_write_bool (hWRITER hwriter, BOOL value);
246 ION_API_EXPORT iERR ion_writer_write_int (hWRITER hwriter, int value);
247 ION_API_EXPORT iERR ion_writer_write_int32 (hWRITER hwriter, int32_t value);
248 ION_API_EXPORT iERR ion_writer_write_int64 (hWRITER hwriter, int64_t value);
249 ION_API_EXPORT iERR ion_writer_write_long (hWRITER hwriter, long value);
250 ION_API_EXPORT iERR ion_writer_write_ion_int (hWRITER hwriter, ION_INT *value);
251 ION_API_EXPORT iERR ion_writer_write_double (hWRITER hwriter, double value);
252 ION_API_EXPORT iERR ion_writer_write_float (hWRITER hwriter, float value);
253 
257 ION_API_EXPORT iERR ion_writer_write_decimal (hWRITER hwriter, decQuad *value);
258 ION_API_EXPORT iERR ion_writer_write_ion_decimal (hWRITER hwriter, ION_DECIMAL *value);
259 ION_API_EXPORT iERR ion_writer_write_timestamp (hWRITER hwriter, iTIMESTAMP value);
260 ION_API_EXPORT iERR ion_writer_write_symbol (hWRITER hwriter, iSTRING p_value);
261 ION_API_EXPORT iERR ion_writer_write_ion_symbol (hWRITER hwriter, ION_SYMBOL *symbol);
262 ION_API_EXPORT iERR ion_writer_write_string (hWRITER hwriter, iSTRING p_value);
263 ION_API_EXPORT iERR ion_writer_write_clob (hWRITER hwriter, BYTE *p_buf, SIZE length);
264 ION_API_EXPORT iERR ion_writer_write_blob (hWRITER hwriter, BYTE *p_buf, SIZE length);
265 
266 ION_API_EXPORT iERR ion_writer_start_lob (hWRITER hwriter, ION_TYPE lob_type);
267 ION_API_EXPORT iERR ion_writer_append_lob (hWRITER hwriter, BYTE *p_buf, SIZE length);
268 ION_API_EXPORT iERR ion_writer_finish_lob (hWRITER hwriter);
269 ION_API_EXPORT iERR ion_writer_start_container (hWRITER hwriter, ION_TYPE container_type);
270 ION_API_EXPORT iERR ion_writer_finish_container (hWRITER hwriter);
271 
272 ION_API_EXPORT iERR ion_writer_write_one_value (hWRITER hwriter, hREADER hreader);
273 ION_API_EXPORT iERR ion_writer_write_all_values (hWRITER hwriter, hREADER hreader);
274 
281 ION_API_EXPORT iERR ion_writer_flush (hWRITER hwriter, SIZE *p_bytes_flushed);
282 
289 ION_API_EXPORT iERR ion_writer_finish (hWRITER hwriter, SIZE *p_bytes_flushed);
290 
296 ION_API_EXPORT iERR ion_writer_close (hWRITER hwriter);
297 
298 #ifdef __cplusplus
299 }
300 #endif
301 
302 
303 #endif
struct ion_type * ION_TYPE
Definition: ion_types.h:69
ION_API_EXPORT iERR ion_writer_options_close_shared_imports(ION_WRITER_OPTIONS *options)
ION_API_EXPORT iERR ion_writer_options_add_shared_imports(ION_WRITER_OPTIONS *options, ION_COLLECTION *imports)
ION_API_EXPORT iERR ion_writer_open_buffer(hWRITER *p_hwriter, BYTE *buffer, SIZE buf_length, ION_WRITER_OPTIONS *p_options)
ION_API_EXPORT iERR ion_writer_options_add_shared_imports_symbol_tables(ION_WRITER_OPTIONS *options, ION_SYMBOL_TABLE **imports, SIZE imports_count)
ION_API_EXPORT iERR ion_writer_close(hWRITER hwriter)
ION_API_EXPORT iERR ion_writer_finish(hWRITER hwriter, SIZE *p_bytes_flushed)
ION_API_EXPORT iERR ion_writer_add_imported_tables(hWRITER hwriter, ION_COLLECTION *imports)
ION_API_EXPORT iERR ion_writer_flush(hWRITER hwriter, SIZE *p_bytes_flushed)
ION_API_EXPORT iERR ion_writer_open_stream(hWRITER *p_hwriter, ION_STREAM_HANDLER fn_output_handler, void *handler_state, ION_WRITER_OPTIONS *p_options)
ION_API_EXPORT iERR ion_writer_options_initialize_shared_imports(ION_WRITER_OPTIONS *options)
ION_API_EXPORT iERR ion_writer_add_annotation(hWRITER hwriter, iSTRING annotation)
ION_API_EXPORT iERR ion_writer_write_field_name(hWRITER hwriter, iSTRING name)
ION_API_EXPORT iERR ion_writer_write_decimal(hWRITER hwriter, decQuad *value)
ION_API_EXPORT iERR ion_writer_set_symbol_table(hWRITER hwriter, hSYMTAB hsymtab)
ION_API_EXPORT iERR ion_writer_write_field_name_symbol(hWRITER hwriter, ION_SYMBOL *field_name)
Definition: ion_collection.h:72
Definition: ion_decimal.h:89
Definition: ion_int.h:100
Definition: ion_string.h:40
Definition: ion_symbol_table.h:34
Definition: ion_timestamp.h:47
Definition: ion_writer.h:28
ION_CATALOG * pcatalog
Definition: ion_writer.h:89
BOOL indent_with_tabs
Definition: ion_writer.h:44
BOOL pretty_print
Definition: ion_writer.h:39
BOOL compact_floats
Definition: ion_writer.h:116
SIZE temp_buffer_size
Definition: ion_writer.h:79
BOOL json_downconvert
Definition: ion_writer.h:121
BOOL small_containers_in_line
Definition: ion_writer.h:54
SIZE max_container_depth
Definition: ion_writer.h:69
SIZE max_annotation_count
Definition: ion_writer.h:74
decContext * decimal_context
Definition: ion_writer.h:109
BOOL flush_every_value
Definition: ion_writer.h:64
SIZE indent_size
Definition: ion_writer.h:49
BOOL supress_system_values
Definition: ion_writer.h:59
BOOL escape_all_non_ascii
Definition: ion_writer.h:34
SIZE allocation_page_size
Definition: ion_writer.h:84
ION_COLLECTION encoding_psymbol_table
Definition: ion_writer.h:99