aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Wellnhofer <wellnhofer@aevum.de>2015-01-20 18:11:23 +0100
committerNick Wellnhofer <wellnhofer@aevum.de>2015-01-20 18:12:28 +0100
commit4b5e43c4fa9e18b7a281063a98fbef0def5a1cbe (patch)
tree63dd5f72e5ca537df9e5841b51b91ed93ed82b5a
parent040def592d73c7babf4634a0990e51de1a68d635 (diff)
Accessor for iterator's root node
-rw-r--r--man/man3/cmark.38
-rw-r--r--src/cmark.h6
-rw-r--r--src/iterator.c6
3 files changed, 19 insertions, 1 deletions
diff --git a/man/man3/cmark.3 b/man/man3/cmark.3
index 1bffc5c..f889521 100644
--- a/man/man3/cmark.3
+++ b/man/man3/cmark.3
@@ -1,4 +1,4 @@
-.TH cmark 3 "January 19, 2015" "LOCAL" "Library Functions Manual"
+.TH cmark 3 "January 20, 2015" "LOCAL" "Library Functions Manual"
.SH
NAME
.PP
@@ -172,6 +172,12 @@ Returns the current node.
Returns the current event type.
.PP
+\fIcmark_node*\f[] \fBcmark_iter_get_root\f[](\fIcmark_iter *iter\f[])
+
+.PP
+Returns the root node.
+
+.PP
\fIvoid\f[] \fBcmark_iter_reset\f[](\fIcmark_iter *iter\f[], \fIcmark_node *current\f[], \fIcmark_event_type event_type\f[])
.PP
diff --git a/src/cmark.h b/src/cmark.h
index 74fa4c7..8177fa8 100644
--- a/src/cmark.h
+++ b/src/cmark.h
@@ -213,6 +213,12 @@ CMARK_EXPORT
cmark_event_type
cmark_iter_get_event_type(cmark_iter *iter);
+/** Returns the root node.
+ */
+CMARK_EXPORT
+cmark_node*
+cmark_iter_get_root(cmark_iter *iter);
+
/** Resets the iterator so that the current node is 'current' and
* the event type is 'event_type'. The new current node must be a
* descendant of the root node or the root node itself.
diff --git a/src/iterator.c b/src/iterator.c
index 4daec2d..eb7b49c 100644
--- a/src/iterator.c
+++ b/src/iterator.c
@@ -108,6 +108,12 @@ cmark_iter_get_event_type(cmark_iter *iter)
return iter->cur.ev_type;
}
+cmark_node*
+cmark_iter_get_root(cmark_iter *iter)
+{
+ return iter->root;
+}
+
void cmark_consolidate_text_nodes(cmark_node *root)
{