aboutsummaryrefslogtreecommitdiffstats
path: root/serd/serd.h
diff options
context:
space:
mode:
Diffstat (limited to 'serd/serd.h')
-rw-r--r--serd/serd.h51
1 files changed, 43 insertions, 8 deletions
diff --git a/serd/serd.h b/serd/serd.h
index 825726d6..4fa5a70d 100644
--- a/serd/serd.h
+++ b/serd/serd.h
@@ -70,6 +70,11 @@ typedef struct SerdWorldImpl SerdWorld;
typedef struct SerdStatementImpl SerdStatement;
/**
+ Cursor, the origin of a statement in a document.
+*/
+typedef struct SerdCursorImpl SerdCursor;
+
+/**
Environment.
Represents the state required to resolve a CURIE or relative URI, e.g. the
@@ -263,12 +268,10 @@ typedef struct {
An error description.
*/
typedef struct {
- SerdStatus status; /**< Error code */
- const char* filename; /**< File where error was encountered, or NULL */
- unsigned line; /**< Line where error was encountered, or 0 */
- unsigned col; /**< Column where error was encountered */
- const char* fmt; /**< Message format string (printf style) */
- va_list* args; /**< Arguments for fmt */
+ SerdStatus status; /**< Error code */
+ const SerdCursor* cursor; /**< Origin of error, or NULL */
+ const char* fmt; /**< Message format string (printf style) */
+ va_list* args; /**< Arguments for fmt */
} SerdError;
/**
@@ -1074,7 +1077,7 @@ serd_reader_start_stream(SerdReader* reader,
SerdReadFunc read_func,
SerdStreamErrorFunc error_func,
void* stream,
- const char* name,
+ const SerdNode* name,
size_t page_size);
/**
@@ -1082,7 +1085,9 @@ serd_reader_start_stream(SerdReader* reader,
*/
SERD_API
SerdStatus
-serd_reader_start_string(SerdReader* reader, const char* utf8);
+serd_reader_start_string(SerdReader* reader,
+ const char* utf8,
+ const SerdNode* name);
/**
Read a single "chunk" of data during an incremental read.
@@ -1265,6 +1270,36 @@ serd_statement_get_graph(const SerdStatement* statement);
/**
@}
+ @name Cursor
+ @{
+*/
+
+/**
+ Return the document name.
+
+ This is typically a file URI, but may be a descriptive string node for
+ statements that originate from streams.
+*/
+SERD_API
+const SerdNode*
+serd_cursor_get_name(const SerdCursor* cursor);
+
+/**
+ Return the one-relative line number in the document.
+*/
+SERD_API
+unsigned
+serd_cursor_get_line(const SerdCursor* cursor);
+
+/**
+ Return the zero-relative column number in the line.
+*/
+SERD_API
+unsigned
+serd_cursor_get_column(const SerdCursor* cursor);
+
+/**
+ @}
@}
*/