aboutsummaryrefslogtreecommitdiffstats
path: root/serd
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2011-12-30 08:10:23 +0000
committerDavid Robillard <d@drobilla.net>2011-12-30 08:10:23 +0000
commit847e56d9e696b813d1cdf3da6d54df5e7b389eae (patch)
treec4492906739264f39a3cdd9a0cacc3c6a4d908c7 /serd
parente0f18e34021004a19709f0c627db51af1a27afcf (diff)
downloadserd-847e56d9e696b813d1cdf3da6d54df5e7b389eae.tar.gz
serd-847e56d9e696b813d1cdf3da6d54df5e7b389eae.tar.bz2
serd-847e56d9e696b813d1cdf3da6d54df5e7b389eae.zip
Add serd_node_new_blob and serd_base64_decode for handling arbitrary binary
data via base64 encoding. git-svn-id: http://svn.drobilla.net/serd/trunk@280 490d8e77-9747-427b-9fa3-0b8f29cee8a0
Diffstat (limited to 'serd')
-rw-r--r--serd/serd.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/serd/serd.h b/serd/serd.h
index 3e84c302..2380c03e 100644
--- a/serd/serd.h
+++ b/serd/serd.h
@@ -278,6 +278,20 @@ double
serd_strtod(const char* str, char** endptr);
/**
+ Decode a base64 string.
+ This function can be used to deserialise a blob node created with
+ serd_node_new_blob().
+
+ @param str Base64 string to decode.
+ @param len The length of @c str.
+ @param size Set to the size of the returned blob in bytes.
+ @return A newly allocated blob which must be freed with free().
+*/
+SERD_API
+void*
+serd_base64_decode(const uint8_t* str, size_t len, size_t* size);
+
+/**
@}
@name URI
@{
@@ -416,6 +430,18 @@ SerdNode
serd_node_new_integer(long i);
/**
+ Create a node by serialising @c buf into an xsd:base64Binary string.
+ This function can be used to make a serialisable node out of arbitrary
+ binary data, which can be decoded using serd_base64_decode().
+
+ @param wrap_lines If true lines are wrapped at 76 characters to conform
+ to RFC 2045.
+*/
+SERD_API
+SerdNode
+serd_node_new_blob(const void* buf, size_t size, bool wrap_lines);
+
+/**
Free any data owned by @c node.
Note that if @c node is itself dynamically allocated (which is not the case