diff options
author | David Robillard <d@drobilla.net> | 2011-02-10 22:40:09 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2011-02-10 22:40:09 +0000 |
commit | 05a25de591ed61bb4c60c9c93d56fb6ad78a2141 (patch) | |
tree | 799a8aed334a51c28f7037ec0447669e0573a8f0 | |
parent | 05ea9fdadeeb3973998e4c00f5de4834dc2432d3 (diff) | |
download | serd-05a25de591ed61bb4c60c9c93d56fb6ad78a2141.tar.gz serd-05a25de591ed61bb4c60c9c93d56fb6ad78a2141.tar.bz2 serd-05a25de591ed61bb4c60c9c93d56fb6ad78a2141.zip |
Add serd_node_new_uri_from_string.
git-svn-id: http://svn.drobilla.net/serd/trunk@98 490d8e77-9747-427b-9fa3-0b8f29cee8a0
-rw-r--r-- | serd/serd.h | 15 | ||||
-rw-r--r-- | src/node.c | 11 |
2 files changed, 18 insertions, 8 deletions
diff --git a/serd/serd.h b/serd/serd.h index 7a7d0bb3..98064bac 100644 --- a/serd/serd.h +++ b/serd/serd.h @@ -190,19 +190,20 @@ SERD_API SerdNode serd_node_copy(const SerdNode* node); -/** Create a new node by resolving @a uri_node into a new node and parsed URI. - * This is a basic wrapper of serd_node_new_uri which first parses @a uri_node. - * @param uri_node The URI node to parse, resolve, and serialise. - * @param base Base URI to resolve @a uri_node against (or NULL). - * @param out (Output) set to the parsing of the new URI (i.e. points only to - * memory owned by the new returned node). - */ +/** Simple wrapper for serd_node_new_uri to resolve a URI node. */ SERD_API SerdNode serd_node_new_uri_from_node(const SerdNode* uri_node, const SerdURI* base, SerdURI* out); +/** Simple wrapper for serd_node_new_uri to resolve a URI string. */ +SERD_API +SerdNode +serd_node_new_uri_from_string(const uint8_t* str, + const SerdURI* base, + SerdURI* out); + /** Create a new node by serialising @a uri into a new string. * @param uri The URI to parse and serialise. * @param base Base URI to resolve @a uri against (or NULL for no resolution). @@ -76,9 +76,18 @@ serd_node_new_uri_from_node(const SerdNode* uri_node, const SerdURI* base, SerdURI* out) { + return serd_node_new_uri_from_string(uri_node->buf, base, out); +} + +SERD_API +SerdNode +serd_node_new_uri_from_string(const uint8_t* str, + const SerdURI* base, + SerdURI* out) +{ // Parse (possibly relative) URI SerdURI uri; - if (serd_uri_parse(uri_node->buf, &uri)) { + if (serd_uri_parse(str, &uri)) { return serd_node_new_uri(&uri, base, out); } return SERD_NODE_NULL; |