Molybden
Loading...
Searching...
No Matches
text_finder.hpp
1// Copyright (c) 2000-2023 TeamDev Ltd. All rights reserved.
2// TeamDev PROPRIETARY and CONFIDENTIAL.
3// Use is subject to license terms.
4
5#ifndef MOLYBDEN_TEXT_FINDER_HPP
6#define MOLYBDEN_TEXT_FINDER_HPP
7
8#include <string>
9
10namespace molybden {
11
12class Browser;
13
21 bool is_search_backward = false;
22
26 bool match_case = false;
27};
28
32struct FindResult {
36 int32_t selected_match = 0;
37
41 int32_t number_of_matches = 0;
42
46 bool is_searching = false;
47};
48
53 public:
59 virtual void onResultFound(const FindResult& result) = 0;
60};
61
66 public:
67 virtual ~TextFinder() = default;
68
72 virtual std::shared_ptr<Browser> browser() = 0;
73
99 virtual void find(const std::string& text, FindResultsConsumer* consumer) = 0;
100
133 virtual void find(const std::string& text,
134 const FindOptions& options,
135 FindResultsConsumer* consumer) = 0;
139 virtual void stopFindingAndKeepSelection() = 0;
140
145};
146
147} // namespace molybden
148
149#endif // MOLYBDEN_TEXT_FINDER_HPP
An interface to get the results from the find text request.
Definition text_finder.hpp:52
virtual void onResultFound(const FindResult &result)=0
Invoked when the search result has been found.
Allows finding text on the loaded web page.
Definition text_finder.hpp:65
virtual void find(const std::string &text, FindResultsConsumer *consumer)=0
Performs search of the given text, highlights all matches and selects the first match on the currentl...
virtual std::shared_ptr< Browser > browser()=0
Returns the browser instance of this text finder.
virtual void find(const std::string &text, const FindOptions &options, FindResultsConsumer *consumer)=0
Performs search of the given text with the given options, highlights all matches and selects the firs...
virtual void stopFindingAndClearSelection()=0
Stops finding and clears the highlighting of the found matches.
virtual void stopFindingAndKeepSelection()=0
Stops finding and keeps the currently highlighted match selected.
The parameters of the text find request.
Definition text_finder.hpp:17
bool is_search_backward
Indicates whether the search is performed backward.
Definition text_finder.hpp:21
bool match_case
Indicates whether the search is case-sensitive.
Definition text_finder.hpp:26
A result of the text search.
Definition text_finder.hpp:32
int32_t number_of_matches
The number of the matches found at the moment or -1 when no matches found.
Definition text_finder.hpp:41
bool is_searching
Indicates whether the search is still in progress.
Definition text_finder.hpp:46
int32_t selected_match
The index of the currently selected match or -1 when there are no matches.
Definition text_finder.hpp:36