wex v24.10.0
Public Member Functions | Static Public Member Functions | List of all members
wex::factory::find_replace_data Class Reference

Offers a class to hold data for find replace functionality. More...

#include <wex/factory/frd.h>

Inheritance diagram for wex::factory::find_replace_data:
Inheritance graph
[legend]

Public Member Functions

 find_replace_data ()
 Default constructor.
 
 ~find_replace_data ()
 Destructor, writes data to config.
 
virtual void set_find_string (const std::string &value)
 Sets the find string.
 
virtual void set_replace_string (const std::string &value)
 Sets the replace string.
 
wxFindReplaceData * data ()
 Access to data.
 
const std::string get_find_string () const
 Returns the find string.
 
const std::string get_replace_string () const
 Returns the replace string.
 
bool is_regex () const
 Returns true if find text is used as a regular expression.
 
bool match_case () const
 Returns true if the flags have match case set.
 
bool match_word () const
 Returns true if the flags have whole word set.
 
int regex_replace (std::string &text) const
 Replaces all occurrences of the find string as regular expression in text by the replace string.
 
int regex_search (const std::string &text) const
 Finds the find string in text.
 
bool search_down () const
 Returns true if the flags have search down set.
 
void set_match_case (bool value)
 Sets flags for match case.
 
void set_match_word (bool value)
 Sets flags for match word.
 
void set_regex (bool value)
 Sets using regular expression for find text.
 
void set_search_down (bool value)
 Sets flags for search down.
 
auto * wx () const
 Returns wx frd.
 

Static Public Member Functions

static const auto & text_find ()
 Returns text.
 
static const auto & text_match_case ()
 Returns text.
 
static const auto & text_match_word ()
 Returns text.
 
static const auto & text_regex ()
 Returns text.
 
static const auto & text_replace_with ()
 Returns text.
 
static const auto & text_search_down ()
 Returns text.
 

Detailed Description

Offers a class to hold data for find replace functionality.

Member Function Documentation

◆ regex_replace()

int wex::factory::find_replace_data::regex_replace ( std::string & text) const

Replaces all occurrences of the find string as regular expression in text by the replace string.

Returns number of replacements done in text.

◆ regex_search()

int wex::factory::find_replace_data::regex_search ( const std::string & text) const

Finds the find string in text.

Returns -1 if find string as regular expression does not match text, otherwise the start pos of the match.

◆ set_find_string()

virtual void wex::factory::find_replace_data::set_find_string ( const std::string & value)
virtual

Sets the find string.

If use_regex also sets the regular expression. This string is used for tool find in files and replace in files. Also moves the find string to the beginning of the find strings list.

Reimplemented in wex::find_replace_data.

◆ set_regex()

void wex::factory::find_replace_data::set_regex ( bool value)

Sets using regular expression for find text.

If get_find_string does not contain a valid regular expression the use member is not set.

◆ set_replace_string()

virtual void wex::factory::find_replace_data::set_replace_string ( const std::string & value)
virtual

Sets the replace string.

Also moves the replace string to the beginning of the replace strings list.

Reimplemented in wex::find_replace_data.