NetSurf
Functions
search.h File Reference

Interface to HTML searching. More...

#include <ctype.h>
#include <string.h>
#include "desktop/search.h"
Include dependency graph for search.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

struct search_contextsearch_create_context (struct content *c, content_type type, void *context)
 create a search_context More...
 
void search_destroy_context (struct search_context *context)
 Ends the search process, invalidating all state freeing the list of found boxes. More...
 
void search_step (struct search_context *context, search_flags_t flags, const char *string)
 Begins/continues the search process. More...
 
bool search_term_highlighted (struct content *c, unsigned start_offset, unsigned end_offset, unsigned *start_idx, unsigned *end_idx, struct search_context *context)
 Determines whether any portion of the given text box should be selected because it matches the current search string. More...
 

Detailed Description

Interface to HTML searching.

Definition in file search.h.

Function Documentation

◆ search_create_context()

struct search_context* search_create_context ( struct content c,
content_type  type,
void *  context 
)

create a search_context

Parameters
cThe content the search_context is connected to
typeThe content type of c
contextA context pointer passed to the provider routines.
Returns
A new search context or NULL on error.

Definition at line 80 of file search.c.

References search_context::c, CONTENT_HTML, CONTENT_TEXTPLAIN, search_context::current, list_entry::end_box, list_entry::end_idx, search_context::found, search_context::gui_p, search_context::is_html, search_context::newsearch, list_entry::next, list_entry::prev, search_context::prev_case_sens, list_entry::sel, list_entry::start_box, list_entry::start_idx, and search_context::string.

Referenced by html_search(), and textplain_search().

Here is the caller graph for this function:

◆ search_destroy_context()

void search_destroy_context ( struct search_context context)

Ends the search process, invalidating all state freeing the list of found boxes.

Definition at line 648 of file search.c.

References gui_search_table::add_recent, gui_search_table::back_state, gui_search_table::forward_state, free_matches(), search_context::gui_p, guit, netsurf_table::search, and search_context::string.

Referenced by html_close(), html_search(), html_search_clear(), textplain_close(), textplain_search(), and textplain_search_clear().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ search_step()

void search_step ( struct search_context context,
search_flags_t  flags,
const char *  string 
)

Begins/continues the search process.

Note
that this may be called many times for a single search.
Parameters
contextThe search context in use.
flagsThe flags forward/back etc
stringThe string to match

Definition at line 592 of file search.c.

References gui_search_table::add_recent, content_msg_data::area, gui_search_table::back_state, search_context::c, content_broadcast(), CONTENT_MSG_SCROLL, gui_search_table::forward_state, free_matches(), search_context::gui_p, guit, content_msg_data::scroll, netsurf_table::search, search_text(), gui_search_table::status, content_msg_data::x0, and content_msg_data::y0.

Referenced by html_search(), and textplain_search().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ search_term_highlighted()

bool search_term_highlighted ( struct content c,
unsigned  start_offset,
unsigned  end_offset,
unsigned *  start_idx,
unsigned *  end_idx,
struct search_context context 
)

Determines whether any portion of the given text box should be selected because it matches the current search string.

Parameters
cThe content to hilight within.
start_offsetbyte offset within text of string to be checked
end_offsetbyte offset within text
start_idxbyte offset within string of highlight start
end_idxbyte offset of highlight end
contextThe search context to hilight entries from.
Returns
true iff part of the box should be highlighted

Definition at line 626 of file search.c.

References search_context::c, search_context::found, list_entry::next, list_entry::sel, selection_defined, and selection_highlighted().

Referenced by text_draw(), text_redraw(), and textplain_redraw().

Here is the call graph for this function:
Here is the caller graph for this function: