Sratom
0.2.0
|
Opaque Types | |
typedef struct SratomImpl | Sratom |
Functions | |
Sratom * | sratom_new (LV2_URID_Map *map) |
void | sratom_free (Sratom *sratom) |
void | sratom_set_sink (Sratom *sratom, const char *base_uri, SerdStatementSink sink, SerdEndSink end_sink, void *handle) |
void | sratom_set_pretty_numbers (Sratom *sratom, bool pretty_numbers) |
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) |
void | sratom_read (Sratom *sratom, LV2_Atom_Forge *forge, SordWorld *world, SordModel *model, const SordNode *node) |
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) |
LV2_Atom * | sratom_from_turtle (Sratom *sratom, const char *base_uri, const SerdNode *subject, const SerdNode *predicate, const char *str) |
LV2_Atom_Forge_Ref | sratom_forge_sink (LV2_Atom_Forge_Sink_Handle handle, const void *buf, uint32_t size) |
LV2_Atom * | sratom_forge_deref (LV2_Atom_Forge_Sink_Handle handle, LV2_Atom_Forge_Ref ref) |
An LV2 Atom RDF serialisation library.
typedef struct SratomImpl Sratom |
Atom serialiser.
Sratom* sratom_new | ( | LV2_URID_Map * | map | ) |
Create a new Atom serialiser.
void sratom_free | ( | Sratom * | sratom | ) |
Free an Atom serialisation.
void sratom_set_sink | ( | Sratom * | sratom, |
const char * | base_uri, | ||
SerdStatementSink | sink, | ||
SerdEndSink | end_sink, | ||
void * | handle | ||
) |
Set the sink(s) where sratom will write its output.
This must be called before calling sratom_write().
void sratom_set_pretty_numbers | ( | Sratom * | sratom, |
bool | pretty_numbers | ||
) |
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.
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 | ||
) |
Write an Atom to RDF.
The serialised atom is written to the sink set by sratom_set_sink().
void sratom_read | ( | Sratom * | sratom, |
LV2_Atom_Forge * | forge, | ||
SordWorld * | world, | ||
SordModel * | model, | ||
const SordNode * | node | ||
) |
Read an Atom from RDF.
The resulting atom will be written to forge
.
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 | ||
) |
Serialise an Atom to a Turtle string.
The returned string must be free()'d by the caller.
LV2_Atom* sratom_from_turtle | ( | Sratom * | sratom, |
const char * | base_uri, | ||
const SerdNode * | subject, | ||
const SerdNode * | predicate, | ||
const char * | str | ||
) |
Read an Atom from a Turtle string.
The returned atom must be free()'d by the caller.
LV2_Atom_Forge_Ref sratom_forge_sink | ( | LV2_Atom_Forge_Sink_Handle | handle, |
const void * | buf, | ||
uint32_t | size | ||
) |
A convenient resizing sink for LV2_Atom_Forge.
The handle must point to an initialized SerdChunk.
LV2_Atom* sratom_forge_deref | ( | LV2_Atom_Forge_Sink_Handle | handle, |
LV2_Atom_Forge_Ref | ref | ||
) |
The corresponding deref function for sratom_forge_sink.