Cursor¶
-
SerdCursor *
serd_cursor_new(const SerdNode *name, unsigned line, unsigned col)¶ Create a new cursor.
Note that, to minimise model overhead, the cursor does not own the name node, so
namemust have a longer lifetime than the cursor for it to be valid. That is,serd_cursor_name()will return exactly the pointername, not a copy. For cursors from models, this is the lifetime of the model. For user-created cursors, the simplest way to handle this is to useSerdNodes.- Parameters
name – The name of the document or stream (usually a file URI)
line – The line number in the document (1-based)
col – The column number in the document (1-based)
- Returns
A new cursor that must be freed with
serd_cursor_free()
-
SerdCursor *
serd_cursor_copy(const SerdCursor *cursor)¶ Return a copy of
cursor
-
void
serd_cursor_free(SerdCursor *cursor)¶ Free
cursor
-
bool
serd_cursor_equals(const SerdCursor *lhs, const SerdCursor *rhs)¶ Return true iff
lhsis equal torhs
-
const SerdNode *
serd_cursor_name(const SerdCursor *cursor)¶ Return the document name.
This is typically a file URI, but may be a descriptive string node for statements that originate from streams.
-
unsigned
serd_cursor_line(const SerdCursor *cursor)¶ Return the one-relative line number in the document.
-
unsigned
serd_cursor_column(const SerdCursor *cursor)¶ Return the zero-relative column number in the line.