aboutsummaryrefslogtreecommitdiff
path: root/include/quickmedia
diff options
context:
space:
mode:
authorAleksi Lindeman <dec05eba@protonmail.com>2019-05-25 03:58:20 +0200
committerAleksi Lindeman <dec05eba@protonmail.com>2019-05-25 03:58:23 +0200
commitc5f4811d0ba74715c8e128da133248cc399a6a6a (patch)
tree38c50f1a5c8be839d1101bb8b5b7fd13f16ee4a5 /include/quickmedia
parent9c52fc54400d706f8f7cdf82d3df2da733862819 (diff)
Allow reusing doc for multiple xpath searches
Diffstat (limited to 'include/quickmedia')
-rw-r--r--include/quickmedia/HtmlSearch.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/include/quickmedia/HtmlSearch.h b/include/quickmedia/HtmlSearch.h
index e3bea33..568e101 100644
--- a/include/quickmedia/HtmlSearch.h
+++ b/include/quickmedia/HtmlSearch.h
@@ -13,6 +13,10 @@ typedef struct {
void *text;
} QuickMediaHtmlNode;
+typedef struct {
+ const void *doc;
+} QuickMediaHtmlSearch;
+
/* Returns NULL if attribute doesn't exist or if it doesn't have any value */
const char* quickmedia_html_node_get_attribute_value(QuickMediaHtmlNode *self, const char *attribute_name);
@@ -22,7 +26,10 @@ const QuickMediaStringView quickmedia_html_node_get_text(QuickMediaHtmlNode *sel
/* @node is only valid within the callback function scope */
typedef void (*QuickMediaHtmlSearchResultCallback)(QuickMediaHtmlNode *node, void *userdata);
-int quickmedia_html_find_nodes_xpath(const char *html_source, const char *xpath, QuickMediaHtmlSearchResultCallback result_callback, void *userdata);
+int quickmedia_html_search_init(QuickMediaHtmlSearch *self, const char *html_source);
+void quickmedia_html_search_deinit(QuickMediaHtmlSearch *self);
+
+int quickmedia_html_find_nodes_xpath(QuickMediaHtmlSearch *self, const char *xpath, QuickMediaHtmlSearchResultCallback result_callback, void *userdata);
#ifdef __cplusplus
}