wex
v21.04.0
|
Offers a class to hold data for find replace functionality. More...
#include <wex/frd.h>
Public Member Functions | |
~find_replace_data () | |
Destructor, writes data to config. | |
wxFindReplaceData * | data () |
Access to data. | |
const std::string | get_find_string () const |
Other methods. More... | |
const auto & | get_find_strings () const |
Returns the find strings. | |
const std::string | get_replace_string () const |
Returns the replace string. | |
const auto & | get_replace_strings () const |
Returns the replace strings. | |
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. More... | |
int | regex_search (const std::string &text) const |
Finds the find string in text. More... | |
bool | search_down () const |
Returns true if the flags have search down set. | |
void | set_find_string (const std::string &value) |
Sets the find string. More... | |
void | set_find_strings (const std::list< std::string > &value) |
Sets the find strings. More... | |
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. More... | |
void | set_replace_string (const std::string &value) |
Sets the replace string. More... | |
void | set_replace_strings (const std::list< std::string > &value) |
Sets the replace strings. More... | |
void | set_search_down (bool value) |
Sets flags for search down. | |
Static Public Member Functions | |
static find_replace_data * | get (bool createOnDemand=true) |
Static interface. More... | |
static find_replace_data * | set (find_replace_data *frd) |
Sets the object as the current one, returns the pointer to the previous current object (both the parameter and returned value may be nullptr). | |
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. | |
Offers a class to hold data for find replace functionality.
|
static |
Static interface.
Returns the find replace data.
const std::string wex::find_replace_data::get_find_string | ( | ) | const |
Other methods.
Returns the find string.
int wex::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.
int wex::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.
void wex::find_replace_data::set_find_string | ( | const std::string & | value | ) |
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.
void wex::find_replace_data::set_find_strings | ( | const std::list< std::string > & | value | ) |
Sets the find strings.
Also moves the find string to the beginning of the find strings list.
void wex::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.
void wex::find_replace_data::set_replace_string | ( | const std::string & | value | ) |
Sets the replace string.
Also moves the replace string to the beginning of the replace strings list.
void wex::find_replace_data::set_replace_strings | ( | const std::list< std::string > & | value | ) |
Sets the replace strings.
Also moves the replace string to the beginning of the replace strings list.