1 | /* -*- Mode: c; c-basic-offset: 2 -*- |
2 | * |
3 | * rdf_serializer.h - RDF Serializer Factory / Serializer interfaces and definition |
4 | * |
5 | * Copyright (C) 2002-2009, David Beckett http://www.dajobe.org/ |
6 | * Copyright (C) 2002-2005, University of Bristol, UK http://www.bristol.ac.uk/ |
7 | * |
8 | * This package is Free Software and part of Redland http://librdf.org/ |
9 | * |
10 | * It is licensed under the following three licenses as alternatives: |
11 | * 1. GNU Lesser General Public License (LGPL) V2.1 or any newer version |
12 | * 2. GNU General Public License (GPL) V2 or any newer version |
13 | * 3. Apache License, V2.0 or any newer version |
14 | * |
15 | * You may not use this file except in compliance with at least one of |
16 | * the above three licenses. |
17 | * |
18 | * See LICENSE.html or LICENSE.txt at the top of this package for the |
19 | * complete terms and further detail along with the license texts for |
20 | * the licenses in COPYING.LIB, COPYING and LICENSE-2.0.txt respectively. |
21 | * |
22 | * |
23 | */ |
24 | |
25 | |
26 | |
27 | #ifndef LIBRDF_SERIALIZER_H |
28 | #define LIBRDF_SERIALIZER_H |
29 | |
30 | #ifdef LIBRDF_INTERNAL |
31 | #include <rdf_serializer_internal.h> |
32 | #endif |
33 | |
34 | |
35 | #ifdef __cplusplus |
36 | extern "C" { |
37 | #endif |
38 | |
39 | #include <raptor2.h> |
40 | |
41 | /* class methods */ |
42 | REDLAND_API |
43 | void librdf_serializer_register_factory(librdf_world *world, const char *name, const char *label, const char *mime_type, const unsigned char *uri_string, void (*factory) (librdf_serializer_factory*)); |
44 | |
45 | REDLAND_API REDLAND_DEPRECATED |
46 | int librdf_serializer_enumerate(librdf_world* world, const unsigned int counter, const char **name, const char **label); |
47 | REDLAND_API |
48 | const raptor_syntax_description* librdf_serializer_get_description(librdf_world* world, unsigned int counter); |
49 | REDLAND_API |
50 | int librdf_serializer_check_name(librdf_world* world, const char *name); |
51 | |
52 | /* constructor */ |
53 | REDLAND_API |
54 | librdf_serializer* librdf_new_serializer(librdf_world* world, const char *name, const char *mime_type, librdf_uri *type_uri); |
55 | REDLAND_API |
56 | librdf_serializer* librdf_new_serializer_from_factory(librdf_world* world, librdf_serializer_factory *factory); |
57 | |
58 | /* destructor */ |
59 | REDLAND_API |
60 | void librdf_free_serializer(librdf_serializer *serializer); |
61 | |
62 | |
63 | /* methods */ |
64 | REDLAND_API REDLAND_DEPRECATED |
65 | int librdf_serializer_serialize_model(librdf_serializer* serializer, FILE *handle, librdf_uri* base_uri, librdf_model* model); |
66 | REDLAND_API |
67 | int librdf_serializer_serialize_stream_to_file_handle(librdf_serializer* serializer, FILE *handle, librdf_uri* base_uri, librdf_stream *stream); |
68 | REDLAND_API |
69 | int librdf_serializer_serialize_model_to_file_handle(librdf_serializer* serializer, FILE *handle, librdf_uri* base_uri, librdf_model* model); |
70 | REDLAND_API |
71 | int librdf_serializer_serialize_stream_to_file(librdf_serializer* serializer, const char *name, librdf_uri* base_uri, librdf_stream* stream); |
72 | REDLAND_API |
73 | int librdf_serializer_serialize_model_to_file(librdf_serializer* serializer, const char *name, librdf_uri* base_uri, librdf_model* model); |
74 | REDLAND_API |
75 | unsigned char* librdf_serializer_serialize_stream_to_string(librdf_serializer* serializer, librdf_uri* base_uri, librdf_stream* stream); |
76 | REDLAND_API |
77 | unsigned char* librdf_serializer_serialize_model_to_string(librdf_serializer* serializer, librdf_uri* base_uri, librdf_model* model); |
78 | REDLAND_API |
79 | unsigned char* librdf_serializer_serialize_stream_to_counted_string(librdf_serializer* serializer, librdf_uri* base_uri, librdf_stream* stream, size_t *length_p); |
80 | REDLAND_API |
81 | unsigned char* librdf_serializer_serialize_model_to_counted_string(librdf_serializer* serializer, librdf_uri* base_uri, librdf_model* model, size_t *length_p); |
82 | REDLAND_API |
83 | int librdf_serializer_serialize_stream_to_iostream(librdf_serializer* serializer, librdf_uri* base_uri, librdf_stream *stream, raptor_iostream* iostr); |
84 | REDLAND_API |
85 | int librdf_serializer_serialize_model_to_iostream(librdf_serializer* serializer, librdf_uri* base_uri, librdf_model *model, raptor_iostream* iostr); |
86 | REDLAND_API |
87 | void librdf_serializer_set_error(librdf_serializer* serializer, void *user_data, void (*error_fn)(void *user_data, const char *msg, ...)); |
88 | REDLAND_API |
89 | void librdf_serializer_set_warning(librdf_serializer* serializer, void *user_data, void (*warning_fn)(void *user_data, const char *msg, ...)); |
90 | |
91 | REDLAND_API |
92 | librdf_node* librdf_serializer_get_feature(librdf_serializer* serializer, librdf_uri *feature); |
93 | REDLAND_API |
94 | int librdf_serializer_set_feature(librdf_serializer* serializer, librdf_uri *feature, librdf_node* value); |
95 | REDLAND_API |
96 | int librdf_serializer_set_namespace(librdf_serializer* serializer, librdf_uri *uri, const char *prefix); |
97 | |
98 | |
99 | #ifdef __cplusplus |
100 | } |
101 | #endif |
102 | |
103 | #endif |
104 | |