NetSurf
|
Interface to HTML searching. More...
#include "desktop/search.h"
Go to the source code of this file.
Functions | |
nserror | content_textsearch (struct hlcache_handle *h, void *context, search_flags_t flags, const char *string) |
Free text search a content. More... | |
nserror | content_textsearch_clear (struct hlcache_handle *h) |
Clear a search. More... | |
nserror | content_textsearch_destroy (struct textsearch_context *textsearch) |
Ends the search process, invalidating all state freeing the list of found boxes. More... | |
bool | content_textsearch_ishighlighted (struct textsearch_context *textsearch, unsigned start_offset, unsigned end_offset, unsigned *start_idx, unsigned *end_idx) |
Determines whether any portion of the given text box should be selected because it matches the current search string. More... | |
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) |
Find the first occurrence of 'match' in 'string' and return its index. More... | |
nserror | content_textsearch_add_match (struct textsearch_context *context, unsigned start_idx, unsigned end_idx, struct box *start_ptr, struct box *end_ptr) |
Add a new entry to the list of matches. More... | |
Interface to HTML searching.
Definition in file textsearch.h.
nserror content_textsearch | ( | struct hlcache_handle * | h, |
void * | context, | ||
search_flags_t | flags, | ||
const char * | string | ||
) |
Free text search a content.
[in] | h | Handle to content to search. |
[in] | context | The context passed to gui table search handlers |
[in] | flags | The flags that control the search |
[in] | The | string being searched for. \retun NSERROR_OK on success else error code on faliure |
Definition at line 682 of file textsearch.c.
References content_textsearch__clear(), content_textsearch_create(), content_textsearch_destroy(), content_textsearch_step(), content::context, hlcache_handle_get_content(), NSERROR_NOMEM, NSERROR_OK, content::string, and content::textsearch.
Referenced by browser_window_search().
nserror content_textsearch_add_match | ( | struct textsearch_context * | context, |
unsigned | start_idx, | ||
unsigned | end_idx, | ||
struct box * | start_ptr, | ||
struct box * | end_ptr | ||
) |
Add a new entry to the list of matches.
context | The search context to add the entry to. |
start_idx | Offset of match start within textual representation |
end_idx | Offset of match end |
start | A pointer for the start |
end | A pointer for the end |
Definition at line 586 of file textsearch.c.
References list_entry::end_box, list_entry::end_idx, textsearch_context::found, list_entry::next, NSERROR_NOMEM, NSERROR_OK, list_entry::prev, list_entry::sel, list_entry::start_box, and list_entry::start_idx.
Referenced by find_occurrences_html_box(), and textplain_textsearch_find().
nserror content_textsearch_clear | ( | struct hlcache_handle * | h | ) |
Clear a search.
[in] | h | Handle to content to clear search from. |
Definition at line 734 of file textsearch.c.
References content_textsearch__clear(), and hlcache_handle_get_content().
Referenced by browser_window_search_clear().
nserror content_textsearch_destroy | ( | struct textsearch_context * | textsearch | ) |
Ends the search process, invalidating all state freeing the list of found boxes.
Definition at line 647 of file textsearch.c.
References free_matches(), NSERROR_OK, textsearch_context::string, and textsearch_broadcast().
Referenced by content_close(), content_textsearch(), and content_textsearch__clear().
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 | ||
) |
Find the first occurrence of 'match' in 'string' and return its index.
string | the string to be searched (unterminated) |
s_len | length of the string to be searched |
pattern | the pattern for which we are searching (unterminated) |
p_len | length of pattern |
case_sens | true iff case sensitive match required |
m_len | accepts length of match in bytes |
Definition at line 475 of file textsearch.c.
References ascii_to_upper(), max, and NOF_ELEMENTS.
Referenced by find_occurrences_html_box(), and textplain_textsearch_find().
bool content_textsearch_ishighlighted | ( | struct textsearch_context * | textsearch, |
unsigned | start_offset, | ||
unsigned | end_offset, | ||
unsigned * | start_idx, | ||
unsigned * | end_idx | ||
) |
Determines whether any portion of the given text box should be selected because it matches the current search string.
textsearch | The search context to hilight entries from. |
c | The content to highlight within. |
start_offset | byte offset within text of string to be checked |
end_offset | byte offset within text |
start_idx | byte offset within string of highlight start |
end_idx | byte offset of highlight end |
Definition at line 623 of file textsearch.c.
References list_entry::end_idx, textsearch_context::found, list_entry::next, list_entry::sel, selection_highlighted(), and list_entry::start_idx.
Referenced by text_draw(), text_redraw(), and textplain_redraw().