Sratom  0.2.0
sratom.h
00001 /*
00002   Copyright 2012 David Robillard <http://drobilla.net>
00003 
00004   Permission to use, copy, modify, and/or distribute this software for any
00005   purpose with or without fee is hereby granted, provided that the above
00006   copyright notice and this permission notice appear in all copies.
00007 
00008   THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
00009   WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
00010   MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
00011   ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
00012   WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
00013   ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
00014   OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
00015 */
00016 
00021 #ifndef SRATOM_SRATOM_H
00022 #define SRATOM_SRATOM_H
00023 
00024 #include <stdint.h>
00025 
00026 #include "lv2/lv2plug.in/ns/ext/urid/urid.h"
00027 #include "lv2/lv2plug.in/ns/ext/atom/atom.h"
00028 #include "lv2/lv2plug.in/ns/ext/atom/forge.h"
00029 #include "serd/serd.h"
00030 #include "sord/sord.h"
00031 
00032 #ifdef SRATOM_SHARED
00033 #    ifdef _WIN32
00034 #        define SRATOM_LIB_IMPORT __declspec(dllimport)
00035 #        define SRATOM_LIB_EXPORT __declspec(dllexport)
00036 #    else
00037 #        define SRATOM_LIB_IMPORT __attribute__((visibility("default")))
00038 #        define SRATOM_LIB_EXPORT __attribute__((visibility("default")))
00039 #    endif
00040 #    ifdef SRATOM_INTERNAL
00041 #        define SRATOM_API SRATOM_LIB_EXPORT
00042 #    else
00043 #        define SRATOM_API SRATOM_LIB_IMPORT
00044 #    endif
00045 #else
00046 #    define SRATOM_API
00047 #endif
00048 
00049 #ifdef __cplusplus
00050 extern "C" {
00051 #endif
00052 
00062 typedef struct SratomImpl Sratom;
00063 
00067 SRATOM_API
00068 Sratom*
00069 sratom_new(LV2_URID_Map* map);
00070 
00074 SRATOM_API
00075 void
00076 sratom_free(Sratom* sratom);
00077 
00083 SRATOM_API
00084 void
00085 sratom_set_sink(Sratom*           sratom,
00086                 const char*       base_uri,
00087                 SerdStatementSink sink,
00088                 SerdEndSink       end_sink,
00089                 void*             handle);
00090 
00098 SRATOM_API
00099 void
00100 sratom_set_pretty_numbers(Sratom* sratom,
00101                           bool    pretty_numbers);
00102 
00108 SRATOM_API
00109 int
00110 sratom_write(Sratom*         sratom,
00111              LV2_URID_Unmap* unmap,
00112              uint32_t        flags,
00113              const SerdNode* subject,
00114              const SerdNode* predicate,
00115              uint32_t        type,
00116              uint32_t        size,
00117              const void*     body);
00118 
00123 SRATOM_API
00124 void
00125 sratom_read(Sratom*         sratom,
00126             LV2_Atom_Forge* forge,
00127             SordWorld*      world,
00128             SordModel*      model,
00129             const SordNode* node);
00130 
00135 SRATOM_API
00136 char*
00137 sratom_to_turtle(Sratom*         sratom,
00138                  LV2_URID_Unmap* unmap,
00139                  const char*     base_uri,
00140                  const SerdNode* subject,
00141                  const SerdNode* predicate,
00142                  uint32_t        type,
00143                  uint32_t        size,
00144                  const void*     body);
00145 
00150 SRATOM_API
00151 LV2_Atom*
00152 sratom_from_turtle(Sratom*         sratom,
00153                    const char*     base_uri,
00154                    const SerdNode* subject,
00155                    const SerdNode* predicate,
00156                    const char*     str);
00157 
00162 SRATOM_API
00163 LV2_Atom_Forge_Ref
00164 sratom_forge_sink(LV2_Atom_Forge_Sink_Handle handle,
00165                   const void*                buf,
00166                   uint32_t                   size);
00167 
00171 SRATOM_API
00172 LV2_Atom*
00173 sratom_forge_deref(LV2_Atom_Forge_Sink_Handle handle,
00174                    LV2_Atom_Forge_Ref         ref);
00175 
00180 #ifdef __cplusplus
00181 }  /* extern "C" */
00182 #endif
00183 
00184 #endif  /* SRATOM_SRATOM_H */