wex  v21.10.0
Enumerations | Functions
core.h File Reference
#include <bitset>
#include <set>
#include <vector>
Include dependency graph for core.h:

Enumerations

enum  { wex::FIRST_OF_AFTER_FROM_BEGIN = 0 , wex::FIRST_OF_BEFORE = 1 , wex::FIRST_OF_FROM_END = 2 }
 

Functions

const std::string wex::after (const std::string &text, char c, bool first=true)
 Returns string after first or last occurrence of c Returns the whole string if c is not found.
 
std::tuple< bool, const std::string, const std::vector< std::string > > wex::auto_complete_filename (const std::string &text)
 Tries to auto_complete filename, the result is stored in the tuple. More...
 
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. More...
 
const std::string wex::before (const std::string &text, char c, bool first=true)
 Returns string before first or last occurrence of c Returns the whole string if c is not found.
 
bool wex::browser (const std::string &url)
 Launch default browser. More...
 
bool wex::browser_search (const std::string &text)
 Browse and search for text. More...
 
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. More...
 
const std::string wex::first_of (const std::string &text, const std::string &chars, const size_t start_pos=0, first_of_t flags=first_of_t().set(FIRST_OF_AFTER_FROM_BEGIN))
 Returns substring after (or before) first occurrence of one of specified chars. More...
 
const std::string wex::get_endoftext (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.
 
const std::string wex::get_find_result (const std::string &find_text, bool find_next, bool recursive)
 Returns a search result, that might be shown in the statusbar.
 
int wex::get_iconid (const path &filename)
 Returns the icon index for this filename (uses the file extension to get it). More...
 
int wex::get_number_of_lines (const std::string &text, bool trimmed=false)
 Returns the number of lines in a (trimmed) string. More...
 
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.
 
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)
 Returns true if filename (fullname) matches one of the fields in specified pattern (fields separated by ; sign).
 
bool wex::one_letter_after (const std::string &text, const std::string &letter)
 Returns whether there is one letter after.
 
const std::string wex::quoted (const std::string &text)
 Returns quotes around the text.
 
bool wex::regafter (const std::string &text, const std::string &letter)
 Returns true if a register is specified after letter in text.
 
bool wex::single_choice_dialog (wxWindow *parent, const std::string &title, const std::vector< std::string > &v, std::string &selection)
 Presents a dialog to choose one string out of an array.
 
const std::string wex::translate (const std::string &text, int pageNum, int numPages)
 This takes care of the translation.
 

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
FIRST_OF_AFTER_FROM_BEGIN 

substring after match, from begin

FIRST_OF_BEFORE 

substring before match

FIRST_OF_FROM_END 

substring from end

Function Documentation

◆ auto_complete_filename()

std::tuple< bool, const std::string, const std::vector<std::string> > wex::auto_complete_filename ( const std::string &  text)

Tries to auto_complete filename, the result is stored in the tuple.

Parameters
texttext containing start of a filename

◆ auto_complete_text()

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.

Parameters
texttext to be completed
vvector with completed text
sexpansion of text to one of the strings from the vector

◆ browser()

bool wex::browser ( const std::string &  url)

Launch default browser.

Returns false if no browser configured.

◆ browser_search()

bool wex::browser_search ( const std::string &  text)

Browse and search for text.

Returns false if search engine is empty.

◆ ellipsed()

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).

◆ first_of()

const std::string wex::first_of ( const std::string &  text,
const std::string &  chars,
const size_t  start_pos = 0,
first_of_t  flags = first_of_t().set(FIRST_OF_AFTER_FROM_BEGIN) 
)

Returns substring after (or before) first occurrence of one of specified chars.

Parameters
texttext to be searched
charschars to be found
start_posstart pos (from start or end of text, depending on flags)
flagsstart searching at begin, or at end

◆ get_iconid()

int wex::get_iconid ( const path filename)

Returns the icon index for this filename (uses the file extension to get it).

The return value is an index in wxTheFileIconsTable. You can use this index as a bitmap using: wxTheFileIconsTable->GetSmallImageList()->GetBitmap(get_iconid(file))

◆ get_number_of_lines()

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.