summaryrefslogtreecommitdiff
path: root/content/textsearch.h
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2020-05-12 23:22:05 +0100
committerVincent Sanders <vince@kyllikki.org>2020-05-12 23:22:05 +0100
commitf4e50b45c834b644caa6a82bd044faa82f6f4860 (patch)
tree0b25cc743861a1f296bd4903324cac9dbf2f5990 /content/textsearch.h
parent68b9417a6bc8344f68f8a8206d2f2781079bd713 (diff)
downloadnetsurf-f4e50b45c834b644caa6a82bd044faa82f6f4860.tar.gz
netsurf-f4e50b45c834b644caa6a82bd044faa82f6f4860.tar.bz2
make free text search content handler agnostic
Diffstat (limited to 'content/textsearch.h')
-rw-r--r--content/textsearch.h27
1 files changed, 26 insertions, 1 deletions
diff --git a/content/textsearch.h b/content/textsearch.h
index c0a1acf9a..e30ebc452 100644
--- a/content/textsearch.h
+++ b/content/textsearch.h
@@ -28,7 +28,7 @@
struct textsearch_context;
struct content;
-
+struct box;
/**
* Ends the search process, invalidating all state freeing the list of
@@ -54,4 +54,29 @@ bool content_textsearch_ishighlighted(struct textsearch_context *textsearch,
unsigned *start_idx,
unsigned *end_idx);
+/**
+ * Find the first occurrence of 'match' in 'string' and return its index
+ *
+ * \param string the string to be searched (unterminated)
+ * \param s_len length of the string to be searched
+ * \param pattern the pattern for which we are searching (unterminated)
+ * \param p_len length of pattern
+ * \param case_sens true iff case sensitive match required
+ * \param m_len accepts length of match in bytes
+ * \return pointer to first match, NULL if none
+ */
+const char *content_textsearch_find_pattern(const char *string, int s_len, const char *pattern, int p_len, bool case_sens, unsigned int *m_len);
+
+/**
+ * Add a new entry to the list of matches
+ *
+ * \param context The search context to add the entry to.
+ * \param start_idx Offset of match start within textual representation
+ * \param end_idx Offset of match end
+ * \param start A pointer for the start
+ * \param end A pointer for the end
+ * \return NSERROR_OK on sucess else error code on faliure
+ */
+nserror content_textsearch_add_match(struct textsearch_context *context, unsigned start_idx, unsigned end_idx, struct box *start_ptr, struct box *end_ptr);
+
#endif