Sratom  0.2.0
sratom.h
1 /*
2  Copyright 2012 David Robillard <http://drobilla.net>
3 
4  Permission to use, copy, modify, and/or distribute this software for any
5  purpose with or without fee is hereby granted, provided that the above
6  copyright notice and this permission notice appear in all copies.
7 
8  THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9  WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10  MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11  ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13  ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14  OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
16 
21 #ifndef SRATOM_SRATOM_H
22 #define SRATOM_SRATOM_H
23 
24 #include <stdint.h>
25 
26 #include "lv2/lv2plug.in/ns/ext/urid/urid.h"
27 #include "lv2/lv2plug.in/ns/ext/atom/atom.h"
28 #include "lv2/lv2plug.in/ns/ext/atom/forge.h"
29 #include "serd/serd.h"
30 #include "sord/sord.h"
31 
32 #ifdef SRATOM_SHARED
33 # ifdef _WIN32
34 # define SRATOM_LIB_IMPORT __declspec(dllimport)
35 # define SRATOM_LIB_EXPORT __declspec(dllexport)
36 # else
37 # define SRATOM_LIB_IMPORT __attribute__((visibility("default")))
38 # define SRATOM_LIB_EXPORT __attribute__((visibility("default")))
39 # endif
40 # ifdef SRATOM_INTERNAL
41 # define SRATOM_API SRATOM_LIB_EXPORT
42 # else
43 # define SRATOM_API SRATOM_LIB_IMPORT
44 # endif
45 #else
46 # define SRATOM_API
47 #endif
48 
49 #ifdef __cplusplus
50 extern "C" {
51 #endif
52 
62 typedef struct SratomImpl Sratom;
63 
67 SRATOM_API
68 Sratom*
69 sratom_new(LV2_URID_Map* map);
70 
74 SRATOM_API
75 void
76 sratom_free(Sratom* sratom);
77 
83 SRATOM_API
84 void
85 sratom_set_sink(Sratom* sratom,
86  const char* base_uri,
87  SerdStatementSink sink,
88  SerdEndSink end_sink,
89  void* handle);
90 
98 SRATOM_API
99 void
101  bool pretty_numbers);
102 
108 SRATOM_API
109 int
110 sratom_write(Sratom* sratom,
111  LV2_URID_Unmap* unmap,
112  uint32_t flags,
113  const SerdNode* subject,
114  const SerdNode* predicate,
115  uint32_t type,
116  uint32_t size,
117  const void* body);
118 
123 SRATOM_API
124 void
125 sratom_read(Sratom* sratom,
126  LV2_Atom_Forge* forge,
127  SordWorld* world,
128  SordModel* model,
129  const SordNode* node);
130 
135 SRATOM_API
136 char*
137 sratom_to_turtle(Sratom* sratom,
138  LV2_URID_Unmap* unmap,
139  const char* base_uri,
140  const SerdNode* subject,
141  const SerdNode* predicate,
142  uint32_t type,
143  uint32_t size,
144  const void* body);
145 
150 SRATOM_API
151 LV2_Atom*
152 sratom_from_turtle(Sratom* sratom,
153  const char* base_uri,
154  const SerdNode* subject,
155  const SerdNode* predicate,
156  const char* str);
157 
162 SRATOM_API
163 LV2_Atom_Forge_Ref
164 sratom_forge_sink(LV2_Atom_Forge_Sink_Handle handle,
165  const void* buf,
166  uint32_t size);
167 
171 SRATOM_API
172 LV2_Atom*
173 sratom_forge_deref(LV2_Atom_Forge_Sink_Handle handle,
174  LV2_Atom_Forge_Ref ref);
175 
180 #ifdef __cplusplus
181 } /* extern "C" */
182 #endif
183 
184 #endif /* SRATOM_SRATOM_H */