37#ifndef WORKSHEETSEARCH_H
38#define WORKSHEETSEARCH_H
47namespace WorksheetSearch {
60 virtual bool Matches(wxString text)
const = 0;
69 : m_str(str), m_ignoreCase(ignoreCase) {}
70 bool Matches(wxString text)
const override;
82 : m_pattern(pattern), m_regex(pattern) {}
84 bool IsValid()
const {
return m_regex.IsValid(); }
85 bool Matches(wxString text)
const override;
105 bool Found()
const {
return m_group !=
nullptr; }
137 const Matcher &matcher,
bool searchInInput,
138 bool searchInOutput);
SearchTarget FindNextTarget(GroupCell *tree, GroupCell *last, const SearchStart &start, bool down, const Matcher &matcher, bool searchInInput, bool searchInOutput)
Find the next match, walking the group cells with wrap-around.
Definition: WorksheetSearch.cpp:185
MatchPart
Which part of a group cell a search match was found in.
Definition: WorksheetSearch.h:94
The base class all cell types the worksheet can consist of are derived from.
Definition: Cell.h:141
This class defines what the user sees as input cell.
Definition: EditorCell.h:59
A cell grouping input (and, if there is one, also the output) cell to a foldable item.
Definition: GroupCell.h:87
Matches a search expression against worksheet text.
Definition: WorksheetSearch.h:56
virtual bool Matches(wxString text) const =0
Does this text contain a match?
virtual bool FindInEditor(EditorCell *editor, bool down) const =0
Search inside an editor, continuing that editor's previous search.
Regular-expression search.
Definition: WorksheetSearch.h:79
bool FindInEditor(EditorCell *editor, bool down) const override
Search inside an editor, continuing that editor's previous search.
Definition: WorksheetSearch.cpp:57
bool Matches(wxString text) const override
Does this text contain a match?
Definition: WorksheetSearch.cpp:53
bool IsValid() const
False if the pattern did not compile; searching would find nothing.
Definition: WorksheetSearch.h:84
Substring search, optionally case-insensitive.
Definition: WorksheetSearch.h:66
bool Matches(wxString text) const override
Does this text contain a match?
Definition: WorksheetSearch.cpp:37
bool FindInEditor(EditorCell *editor, bool down) const override
Search inside an editor, continuing that editor's previous search.
Definition: WorksheetSearch.cpp:46
Where a search starts: a group plus what the cursor is doing there.
Definition: WorksheetSearch.h:113
bool m_inEditor
True if this group's editor holds the cursor or the previous match.
Definition: WorksheetSearch.h:117
GroupCell * m_group
The group the search starts in; null = nowhere to search.
Definition: WorksheetSearch.h:115
Cell * m_atCell
The previously matched prompt or output cell in this group, if any.
Definition: WorksheetSearch.h:119
A search match: the group it is in and the matching part.
Definition: WorksheetSearch.h:97
Cell * m_cell
The matching prompt or output cell; null for an editor match.
Definition: WorksheetSearch.h:102
bool m_wrapped
True if the search passed the document end and started over.
Definition: WorksheetSearch.h:104
GroupCell * m_group
The group holding the match; null if nothing was found.
Definition: WorksheetSearch.h:99