aboutsummaryrefslogtreecommitdiffstats
path: root/serd/serd.h
diff options
context:
space:
mode:
Diffstat (limited to 'serd/serd.h')
-rw-r--r--serd/serd.h97
1 files changed, 40 insertions, 57 deletions
diff --git a/serd/serd.h b/serd/serd.h
index 8f56ef02..6be31a2b 100644
--- a/serd/serd.h
+++ b/serd/serd.h
@@ -467,18 +467,11 @@ serd_uri_serialise_relative(const SerdURI* uri,
*/
/**
- Create a new node from `str`.
+ Create a new plain literal string node from `str`.
*/
SERD_API
SerdNode*
-serd_node_new_string(SerdType type, const char* str);
-
-/**
- Create a new node from a prefix of `str`.
-*/
-SERD_API
-SerdNode*
-serd_node_new_substring(SerdType type, const char* str, size_t len);
+serd_node_new_string(const char* str);
/**
Create a new literal node from `str`.
@@ -494,15 +487,19 @@ serd_node_new_literal(const char* str,
/**
Create a new blank node.
-
- Note this function measures `str`, which is a common bottleneck.
- Use sord_node_from_serd_node() instead if `str` is already measured.
*/
SERD_API
SerdNode*
serd_node_new_blank(const char* str);
/**
+ Create a new CURIE node.
+*/
+SERD_API
+SerdNode*
+serd_node_new_curie(const char* str);
+
+/**
Return a deep copy of `node`.
*/
SERD_API
@@ -517,72 +514,60 @@ bool
serd_node_equals(const SerdNode* a, const SerdNode* b);
/**
- Simple wrapper for serd_node_new_uri() to resolve a URI node.
+ Create a new URI from a string.
*/
SERD_API
SerdNode*
-serd_node_new_uri_from_node(const SerdNode* uri_node,
- const SerdURI* base,
- SerdURI* out);
+serd_node_new_uri(const char* str);
/**
- Simple wrapper for serd_node_new_uri() to resolve a URI string.
+ Create a new URI from a string, resolved against a base URI.
*/
SERD_API
SerdNode*
-serd_node_new_uri_from_string(const char* str,
- const SerdURI* base,
- SerdURI* out);
+serd_node_new_resolved_uri(const char* str, const SerdNode* base);
/**
- Create a new file URI node from a file system path and optional hostname.
+ Resolve `node` against `base`.
- Backslashes in Windows paths will be converted and '%' will always be
- percent encoded. If `escape` is true, all other invalid characters will be
- percent encoded as well.
-
- If `path` is relative, `hostname` is ignored.
- If `out` is not NULL, it will be set to the parsed URI.
+ If `node` is not a relative URI, an equivalent new node is returned.
*/
SERD_API
SerdNode*
-serd_node_new_file_uri(const char* path,
- const char* hostname,
- SerdURI* out,
- bool escape);
+serd_node_resolve(const SerdNode* node, const SerdNode* base);
/**
- Create a new node by serialising `uri` into a new string.
-
- @param uri The URI to serialise.
+ Create a new file URI node from a file system path and optional hostname.
- @param base Base URI to resolve `uri` against (or NULL for no resolution).
+ Backslashes in Windows paths will be converted and '%' will always be
+ percent encoded. If `escape` is true, all other invalid characters will be
+ percent encoded as well.
- @param out Set to the parsing of the new URI (i.e. points only to
- memory owned by the new returned node).
+ If `path` is relative, `hostname` is ignored.
+ If `out` is not NULL, it will be set to the parsed URI.
*/
SERD_API
SerdNode*
-serd_node_new_uri(const SerdURI* uri, const SerdURI* base, SerdURI* out);
+serd_node_new_file_uri(const char* path, const char* hostname, bool escape);
/**
- Create a new node by serialising `uri` into a new relative URI.
+ Create a new URI from a string, relative to a base URI.
- @param uri The URI to serialise.
+ @param str URI string.
- @param base Base URI to make `uri` relative to, if possible.
+ @param base Base URI to make `str` relative to, if possible.
- @param root Root URI for resolution (see serd_uri_serialise_relative()).
+ @param root Optional root URI for resolution.
- @param out Set to the parsing of the new URI (i.e. points only to
- memory owned by the new returned node).
+ The URI is made relative iff if it a child of `base` and `root`. The
+ optional `root` parameter must be a prefix of `base` and can be used keep
+ up-references ("../") within a certain namespace.
*/
SERD_API
SerdNode*
-serd_node_new_relative_uri(const SerdURI* uri,
- const SerdURI* base,
- const SerdURI* root,
- SerdURI* out);
+serd_node_new_relative_uri(const char* str,
+ const SerdNode* base,
+ const SerdNode* root);
/**
Create a new node by serialising `d` into an xsd:decimal string.
@@ -800,8 +785,7 @@ serd_env_free(SerdEnv* env);
*/
SERD_API
const SerdNode*
-serd_env_get_base_uri(const SerdEnv* env,
- SerdURI* out);
+serd_env_get_base_uri(const SerdEnv* env);
/**
Set the current base URI.
@@ -998,13 +982,12 @@ serd_reader_free(SerdReader* reader);
*/
SERD_API
SerdWriter*
-serd_writer_new(SerdWorld* world,
- SerdSyntax syntax,
- SerdStyle style,
- SerdEnv* env,
- const SerdURI* base_uri,
- SerdWriteFunc ssink,
- void* stream);
+serd_writer_new(SerdWorld* world,
+ SerdSyntax syntax,
+ SerdStyle style,
+ SerdEnv* env,
+ SerdWriteFunc ssink,
+ void* stream);
/**
Free `writer`.