/usr/include/sratom-0/sratom/sratom.h is in libsratom-dev 0.4.6~dfsg0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 | /*
Copyright 2012 David Robillard <http://drobilla.net>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/**
@file sratom.h API for Sratom, an LV2 Atom RDF serialisation library.
*/
#ifndef SRATOM_SRATOM_H
#define SRATOM_SRATOM_H
#include <stdint.h>
#include "lv2/lv2plug.in/ns/ext/urid/urid.h"
#include "lv2/lv2plug.in/ns/ext/atom/atom.h"
#include "lv2/lv2plug.in/ns/ext/atom/forge.h"
#include "serd/serd.h"
#include "sord/sord.h"
#ifdef SRATOM_SHARED
# ifdef _WIN32
# define SRATOM_LIB_IMPORT __declspec(dllimport)
# define SRATOM_LIB_EXPORT __declspec(dllexport)
# else
# define SRATOM_LIB_IMPORT __attribute__((visibility("default")))
# define SRATOM_LIB_EXPORT __attribute__((visibility("default")))
# endif
# ifdef SRATOM_INTERNAL
# define SRATOM_API SRATOM_LIB_EXPORT
# else
# define SRATOM_API SRATOM_LIB_IMPORT
# endif
#else
# define SRATOM_API
#endif
#ifdef __cplusplus
extern "C" {
#endif
/**
@defgroup sratom Sratom
An LV2 Atom RDF serialisation library.
@{
*/
/**
Atom serialiser.
*/
typedef struct SratomImpl Sratom;
/**
Mode for reading resources to LV2 Objects.
This affects how resources (which are either blank nodes or have URIs) are
read by sratom_read(), since they may be read as simple references (a URI or
blank node ID) or a complete description (an atom "Object").
Currently, blank nodes are always read as Objects, but support for reading
blank node IDs may be added in the future.
*/
typedef enum {
/**
Read blank nodes as Objects, and named resources as URIs.
*/
SRATOM_OBJECT_MODE_BLANK,
/**
Read blank nodes and the main subject as Objects, and any other named
resources as URIs. The "main subject" is the subject parameter passed
to sratom_read(); if this is a resource it will be read as an Object,
but all other named resources encountered will be read as URIs.
*/
SRATOM_OBJECT_MODE_BLANK_SUBJECT,
} SratomObjectMode;
/**
Create a new Atom serialiser.
*/
SRATOM_API
Sratom*
sratom_new(LV2_URID_Map* map);
/**
Free an Atom serialisation.
*/
SRATOM_API
void
sratom_free(Sratom* sratom);
/**
Set the sink(s) where sratom will write its output.
This must be called before calling sratom_write().
*/
SRATOM_API
void
sratom_set_sink(Sratom* sratom,
const char* base_uri,
SerdStatementSink sink,
SerdEndSink end_sink,
void* handle);
/**
Write pretty numeric literals.
If `pretty_numbers` is true, numbers will be written as pretty Turtle
literals, rather than string literals with precise types. The cost of this
is that the types might get fudged on a round-trip to RDF and back.
*/
SRATOM_API
void
sratom_set_pretty_numbers(Sratom* sratom,
bool pretty_numbers);
/**
Configure how resources will be read to form LV2 Objects.
*/
SRATOM_API
void
sratom_set_object_mode(Sratom* sratom,
SratomObjectMode object_mode);
/**
Write an Atom to RDF.
The serialised atom is written to the sink set by sratom_set_sink().
@return 0 on success, or a non-zero error code otherwise.
*/
SRATOM_API
int
sratom_write(Sratom* sratom,
LV2_URID_Unmap* unmap,
uint32_t flags,
const SerdNode* subject,
const SerdNode* predicate,
uint32_t type,
uint32_t size,
const void* body);
/**
Read an Atom from RDF.
The resulting atom will be written to `forge`.
*/
SRATOM_API
void
sratom_read(Sratom* sratom,
LV2_Atom_Forge* forge,
SordWorld* world,
SordModel* model,
const SordNode* subject);
/**
Serialise an Atom to a Turtle string.
The returned string must be free()'d by the caller.
*/
SRATOM_API
char*
sratom_to_turtle(Sratom* sratom,
LV2_URID_Unmap* unmap,
const char* base_uri,
const SerdNode* subject,
const SerdNode* predicate,
uint32_t type,
uint32_t size,
const void* body);
/**
Read an Atom from a Turtle string.
The returned atom must be free()'d by the caller.
*/
SRATOM_API
LV2_Atom*
sratom_from_turtle(Sratom* sratom,
const char* base_uri,
const SerdNode* subject,
const SerdNode* predicate,
const char* str);
/**
A convenient resizing sink for LV2_Atom_Forge.
The handle must point to an initialized SerdChunk.
*/
SRATOM_API
LV2_Atom_Forge_Ref
sratom_forge_sink(LV2_Atom_Forge_Sink_Handle handle,
const void* buf,
uint32_t size);
/**
The corresponding deref function for sratom_forge_sink.
*/
SRATOM_API
LV2_Atom*
sratom_forge_deref(LV2_Atom_Forge_Sink_Handle handle,
LV2_Atom_Forge_Ref ref);
/**
@}
*/
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* SRATOM_SRATOM_H */
|