Molybden API
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:
54 using FindResultCallback = std::function<void(const FindResult&)>;
55
56 virtual ~TextFinder() = default;
57
61 virtual std::shared_ptr<Browser> browser() = 0;
62
88 virtual void find(const std::string& text, FindResultCallback callback) = 0;
89
122 virtual void find(const std::string& text,
123 const FindOptions& options,
124 FindResultCallback callback) = 0;
125
129 virtual void stopFindingAndKeepSelection() = 0;
130
135};
136
137} // namespace molybden
138
139#endif // MOLYBDEN_TEXT_FINDER_HPP
Allows finding text on the loaded web page.
Definition text_finder.hpp:52
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, FindResultCallback callback)=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 find(const std::string &text, FindResultCallback callback)=0
Performs search of the given text, highlights all matches and selects the first match on the currentl...
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