1 | /* -*- Mode: c; c-basic-offset: 2 -*- |
2 | * |
3 | * rdf_parser.h - RDF Parser Factory / Parser interfaces and definition |
4 | * |
5 | * Copyright (C) 2000-2009, David Beckett http://www.dajobe.org/ |
6 | * Copyright (C) 2000-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_PARSER_H |
28 | #define LIBRDF_PARSER_H |
29 | |
30 | #ifdef LIBRDF_INTERNAL |
31 | #include <rdf_parser_internal.h> |
32 | #endif |
33 | |
34 | #ifdef __cplusplus |
35 | extern "C" { |
36 | #endif |
37 | |
38 | /* class methods */ |
39 | REDLAND_API |
40 | void librdf_parser_register_factory(librdf_world *world, const char *name, const char *label, const char *mime_type, const unsigned char *uri_string, void (*factory) (librdf_parser_factory*)); |
41 | |
42 | REDLAND_API REDLAND_DEPRECATED |
43 | int librdf_parser_enumerate(librdf_world* world, const unsigned int counter, const char **name, const char **label); |
44 | REDLAND_API |
45 | const raptor_syntax_description* librdf_parser_get_description(librdf_world* world, unsigned int counter); |
46 | REDLAND_API |
47 | int librdf_parser_check_name(librdf_world* world, const char *name); |
48 | |
49 | /* constructor */ |
50 | REDLAND_API |
51 | librdf_parser* librdf_new_parser(librdf_world* world, const char *name, const char *mime_type, librdf_uri *type_uri); |
52 | REDLAND_API |
53 | librdf_parser* librdf_new_parser_from_factory(librdf_world* world, librdf_parser_factory *factory); |
54 | |
55 | /* destructor */ |
56 | REDLAND_API |
57 | void librdf_free_parser(librdf_parser *parser); |
58 | |
59 | |
60 | /* methods */ |
61 | REDLAND_API |
62 | librdf_stream* librdf_parser_parse_as_stream(librdf_parser* parser, librdf_uri* uri, librdf_uri* base_uri); |
63 | REDLAND_API |
64 | int librdf_parser_parse_into_model(librdf_parser* parser, librdf_uri* uri, librdf_uri* base_uri, librdf_model* model); |
65 | REDLAND_API |
66 | librdf_stream* librdf_parser_parse_string_as_stream(librdf_parser* parser, const unsigned char* string, librdf_uri* base_uri); |
67 | REDLAND_API |
68 | int librdf_parser_parse_string_into_model(librdf_parser* parser, const unsigned char *string, librdf_uri* base_uri, librdf_model* model); |
69 | REDLAND_API |
70 | librdf_stream* librdf_parser_parse_iostream_as_stream(librdf_parser* parser, raptor_iostream *iostream, librdf_uri* base_uri); |
71 | REDLAND_API |
72 | int librdf_parser_parse_iostream_into_model(librdf_parser* parser, raptor_iostream *iostream, librdf_uri* base_uri, librdf_model* model); |
73 | REDLAND_API |
74 | librdf_stream* librdf_parser_parse_file_handle_as_stream(librdf_parser* parser, FILE* fh, int close_fh, librdf_uri* base_uri); |
75 | REDLAND_API |
76 | int librdf_parser_parse_file_handle_into_model(librdf_parser* parser, FILE *fh, int close_fh, librdf_uri* base_uri, librdf_model* model); |
77 | REDLAND_API REDLAND_DEPRECATED |
78 | void librdf_parser_set_error(librdf_parser* parser, void *user_data, void (*error_fn)(void *user_data, const char *msg, ...)); |
79 | REDLAND_API REDLAND_DEPRECATED |
80 | void librdf_parser_set_warning(librdf_parser* parser, void *user_data, void (*warning_fn)(void *user_data, const char *msg, ...)); |
81 | REDLAND_API |
82 | librdf_stream* librdf_parser_parse_counted_string_as_stream(librdf_parser* parser, const unsigned char *string, size_t length, librdf_uri* base_uri); |
83 | REDLAND_API |
84 | int librdf_parser_parse_counted_string_into_model(librdf_parser* parser, const unsigned char *string, size_t length, librdf_uri* base_uri, librdf_model* model); |
85 | REDLAND_API |
86 | void librdf_parser_set_uri_filter(librdf_parser* parser, librdf_uri_filter_func filter, void* user_data); |
87 | REDLAND_API |
88 | librdf_uri_filter_func librdf_parser_get_uri_filter(librdf_parser* parser, void** user_data_p); |
89 | |
90 | /** |
91 | * LIBRDF_PARSER_FEATURE_ERROR_COUNT: |
92 | * |
93 | * Parser feature URI string for getting the error count of the last parse. |
94 | */ |
95 | #define LIBRDF_PARSER_FEATURE_ERROR_COUNT "http://feature.librdf.org/parser-error-count" |
96 | |
97 | /** |
98 | * LIBRDF_PARSER_FEATURE_WARNING_COUNT: |
99 | * |
100 | * Parser feature URI string for getting the warning count of the last parse. |
101 | */ |
102 | #define LIBRDF_PARSER_FEATURE_WARNING_COUNT "http://feature.librdf.org/parser-warning-count" |
103 | |
104 | REDLAND_API |
105 | librdf_node* librdf_parser_get_feature(librdf_parser* parser, librdf_uri *feature); |
106 | REDLAND_API |
107 | int librdf_parser_set_feature(librdf_parser* parser, librdf_uri* feature, librdf_node* value); |
108 | REDLAND_API |
109 | char* (librdf_parser* parser); |
110 | REDLAND_API REDLAND_DEPRECATED |
111 | const char* librdf_parser_guess_name(const char *mime_type, const unsigned char *buffer, const unsigned char *identifier); |
112 | REDLAND_API |
113 | const char* librdf_parser_guess_name2(librdf_world* world, const char *mime_type, const unsigned char *buffer, const unsigned char *identifier); |
114 | REDLAND_API |
115 | const char* librdf_parser_get_namespaces_seen_prefix(librdf_parser* parser, int offset); |
116 | REDLAND_API |
117 | librdf_uri* librdf_parser_get_namespaces_seen_uri(librdf_parser* parser, int offset); |
118 | REDLAND_API |
119 | int librdf_parser_get_namespaces_seen_count(librdf_parser* parser); |
120 | |
121 | #ifdef __cplusplus |
122 | } |
123 | #endif |
124 | |
125 | #endif |
126 | |