.TH "sratom" 3 "Thu Oct 8 2020" "Version 0.6.6" "Sratom" \" -*- nroff -*- .ad l .nh .SH NAME sratom \- Sratom .SH SYNOPSIS .br .PP .SH "Detailed Description" .PP A library for serialising LV2 Atoms\&. .SS "Typedefs" .in +1c .ti -1c .RI "typedef struct SratomImpl \fBSratom\fP" .br .in -1c .SS "Enumerations" .in +1c .ti -1c .RI "enum \fBSratomObjectMode\fP { \fBSRATOM_OBJECT_MODE_BLANK\fP, \fBSRATOM_OBJECT_MODE_BLANK_SUBJECT\fP }" .br .in -1c .SS "Functions" .in +1c .ti -1c .RI "\fBSratom\fP * \fBsratom_new\fP (LV2_URID_Map *map)" .br .ti -1c .RI "void \fBsratom_free\fP (\fBSratom\fP *sratom)" .br .ti -1c .RI "void \fBsratom_set_env\fP (\fBSratom\fP *sratom, SerdEnv *env)" .br .ti -1c .RI "void \fBsratom_set_sink\fP (\fBSratom\fP *sratom, const char *base_uri, SerdStatementSink sink, SerdEndSink end_sink, void *handle)" .br .ti -1c .RI "void \fBsratom_set_pretty_numbers\fP (\fBSratom\fP *sratom, bool pretty_numbers)" .br .ti -1c .RI "void \fBsratom_set_object_mode\fP (\fBSratom\fP *sratom, \fBSratomObjectMode\fP object_mode)" .br .ti -1c .RI "int \fBsratom_write\fP (\fBSratom\fP *sratom, LV2_URID_Unmap *unmap, uint32_t flags, const SerdNode *subject, const SerdNode *predicate, uint32_t type_urid, uint32_t size, const void *body)" .br .ti -1c .RI "void \fBsratom_read\fP (\fBSratom\fP *sratom, LV2_Atom_Forge *forge, SordWorld *world, SordModel *model, const SordNode *node)" .br .ti -1c .RI "char * \fBsratom_to_turtle\fP (\fBSratom\fP *sratom, LV2_URID_Unmap *unmap, const char *base_uri, const SerdNode *subject, const SerdNode *predicate, uint32_t type, uint32_t size, const void *body)" .br .ti -1c .RI "LV2_Atom * \fBsratom_from_turtle\fP (\fBSratom\fP *sratom, const char *base_uri, const SerdNode *subject, const SerdNode *predicate, const char *str)" .br .ti -1c .RI "LV2_Atom_Forge_Ref \fBsratom_forge_sink\fP (LV2_Atom_Forge_Sink_Handle handle, const void *buf, uint32_t size)" .br .ti -1c .RI "LV2_Atom * \fBsratom_forge_deref\fP (LV2_Atom_Forge_Sink_Handle handle, LV2_Atom_Forge_Ref ref)" .br .in -1c .SH "Typedef Documentation" .PP .SS "typedef struct SratomImpl \fBSratom\fP" .PP Atom serialiser\&. .SH "Enumeration Type Documentation" .PP .SS "enum \fBSratomObjectMode\fP" .PP Mode for reading resources to LV2 Objects\&. This affects how resources (which are either blank nodes or have URIs) are read by \fBsratom_read()\fP, since they may be read as simple references (a URI or blank node ID) or a complete description (an atom 'Object')\&. .PP Currently, blank nodes are always read as Objects, but support for reading blank node IDs may be added in the future\&. .PP \fBEnumerator\fP .in +1c .TP \fB\fISRATOM_OBJECT_MODE_BLANK \fP\fP Read blank nodes as Objects, and named resources as URIs\&. .TP \fB\fISRATOM_OBJECT_MODE_BLANK_SUBJECT \fP\fP 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 \fBsratom_read()\fP; if this is a resource it will be read as an Object, but all other named resources encountered will be read as URIs\&. .SH "Function Documentation" .PP .SS "\fBSratom\fP* sratom_new (LV2_URID_Map * map)" .PP Create a new Atom serialiser\&. .SS "void sratom_free (\fBSratom\fP * sratom)" .PP Free an Atom serialisation\&. .SS "void sratom_set_env (\fBSratom\fP * sratom, SerdEnv * env)" .PP Set the environment for reading or writing Turtle\&. This can be used to set namespace prefixes and a base URI for \fBsratom_to_turtle()\fP and \fBsratom_from_turtle()\fP\&. .SS "void sratom_set_sink (\fBSratom\fP * sratom, const char * base_uri, SerdStatementSink sink, SerdEndSink end_sink, void * handle)" .PP Set the sink(s) where sratom will write its output\&. This must be called before calling \fBsratom_write()\fP\&. .SS "void sratom_set_pretty_numbers (\fBSratom\fP * sratom, bool pretty_numbers)" .PP Write pretty numeric literals\&. If \fCpretty_numbers\fP 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\&. .SS "void sratom_set_object_mode (\fBSratom\fP * sratom, \fBSratomObjectMode\fP object_mode)" .PP Configure how resources will be read to form LV2 Objects\&. .SS "int sratom_write (\fBSratom\fP * sratom, LV2_URID_Unmap * unmap, uint32_t flags, const SerdNode * subject, const SerdNode * predicate, uint32_t type_urid, uint32_t size, const void * body)" .PP Write an Atom to RDF\&. The serialised atom is written to the sink set by \fBsratom_set_sink()\fP\&. .PP \fBReturns\fP .RS 4 0 on success, or a non-zero error code otherwise\&. .RE .PP .SS "void sratom_read (\fBSratom\fP * sratom, LV2_Atom_Forge * forge, SordWorld * world, SordModel * model, const SordNode * node)" .PP Read an Atom from RDF\&. The resulting atom will be written to \fCforge\fP\&. .SS "char* sratom_to_turtle (\fBSratom\fP * sratom, LV2_URID_Unmap * unmap, const char * base_uri, const SerdNode * subject, const SerdNode * predicate, uint32_t type, uint32_t size, const void * body)" .PP Serialise an Atom to a Turtle string\&. The returned string must be free()'d by the caller\&. .SS "LV2_Atom* sratom_from_turtle (\fBSratom\fP * sratom, const char * base_uri, const SerdNode * subject, const SerdNode * predicate, const char * str)" .PP Read an Atom from a Turtle string\&. The returned atom must be free()'d by the caller\&. .SS "LV2_Atom_Forge_Ref sratom_forge_sink (LV2_Atom_Forge_Sink_Handle handle, const void * buf, uint32_t size)" .PP A convenient resizing sink for LV2_Atom_Forge\&. The handle must point to an initialized SerdChunk\&. .SS "LV2_Atom* sratom_forge_deref (LV2_Atom_Forge_Sink_Handle handle, LV2_Atom_Forge_Ref ref)" .PP The corresponding deref function for sratom_forge_sink\&. .SH "Author" .PP Generated automatically by Doxygen for Sratom from the source code\&.