wex v24.10.0
|
#include <set>
#include <string>
#include <vector>
Functions | |
bool | wex::auto_complete_text (const std::string &text, const std::vector< std::string > &v, std::string &s) |
Tries to auto_complete text from a vector of strings, result stored in the string. | |
bool | wex::browser (const std::string &url) |
Launch default browser. | |
bool | wex::browser_search (const std::string &text) |
Browse and search for text. | |
bool | wex::clipboard_add (const std::string &text) |
Adds data to the clipboard. | |
const std::string | wex::clipboard_get () |
Returns data from the clipboard. | |
const std::string | wex::ellipsed (const std::string &text, const std::string &control=std::string(), bool ellipse=true) |
Adds an ellipses after text. | |
const std::string | wex::find_after (const std::string &text, const std::string &sequence) |
Returns string after first occurrence of sequence Returns the whole string if seq is not found. | |
const std::string | wex::find_before (const std::string &text, const std::string &sequence) |
Returns string before first occurrence of sequence Returns the whole string if seq is not found. | |
const std::string | wex::find_tail (const std::string &text, size_t max_chars=15) |
If text length exceeds max_chars, returns an ellipse prefix followed by the last max_chars from the text, otherwise just returns the text. | |
int | wex::get_number_of_lines (const std::string &text, bool trimmed=false) |
Returns the number of lines in a (trimmed) string. | |
const std::string | wex::get_string_set (const std::set< std::string > &kset, size_t min_size=0, const std::string &prefix=std::string()) |
Returns string from set. | |
const std::string | wex::get_word (std::string &text) |
Returns a word from a string. | |
int | wex::icompare (const std::string &text1, const std::string &text2) |
Returns 0 if both texts are equal, ignoring case. | |
bool | wex::icontains (const std::string &text, const std::string &sequence) |
Returns true if text contains sequence, ignoring case. | |
bool | wex::is_brace (int c) |
Returns true if char is a brace open or close character. | |
bool | wex::is_codeword_separator (int c) |
Returns true if char is a code word separator. | |
bool | wex::matches_one_of (const std::string &fullname, const std::string &patterns, bool is_regex=false) |
Returns true if filename (fullname) matches one of the fields in the specified pattern. | |
const std::string | wex::quoted (const std::string &text) |
Returns quotes around the text. | |
const std::string | wex::quoted_find (const std::string &text, char c=' ') |
Returns double quotes around the text, otherwise returns text. | |
const std::string | wex::rfind_after (const std::string &text, const std::string &sequence) |
Returns string after last occurrence of sequence Returns the whole string if seq is not found. | |
const std::string | wex::rfind_before (const std::string &text, const std::string &sequence) |
Returns string before last occurrence of sequence Returns the whole string if seq is not found. | |
bool wex::auto_complete_text | ( | const std::string & | text, |
const std::vector< std::string > & | v, | ||
std::string & | s ) |
Tries to auto_complete text from a vector of strings, result stored in the string.
Returns true if a unique match was found.
text | text to be completed |
v | vector with completed text |
s | expansion of text to one of the strings from the vector |
bool wex::browser | ( | const std::string & | url | ) |
Launch default browser.
Returns false if no browser configured or url could not be opened.
bool wex::browser_search | ( | const std::string & | text | ) |
Browse and search for text.
Returns false if search engine is empty or browse returns false.
const std::string wex::ellipsed | ( | const std::string & | text, |
const std::string & | control = std::string(), | ||
bool | ellipse = true ) |
Adds an ellipses after text.
The control, if present is postfixed, after a tab character (for accels).
int wex::get_number_of_lines | ( | const std::string & | text, |
bool | trimmed = false ) |
Returns the number of lines in a (trimmed) string.
If text is empty, 0 is returned, otherwise at least 1.
bool wex::matches_one_of | ( | const std::string & | fullname, |
const std::string & | patterns, | ||
bool | is_regex = false ) |
Returns true if filename (fullname) matches one of the fields in the specified pattern.
fullname | the fullname |
patterns | the pattern to match, fields separated by ; sign |
is_regex | default the pattern is not a regex, but you can change it |