wex v26.10.0
util.h File Reference
#include <wex/common/path-match.h>
#include <wex/core/core.h>
#include <wex/core/types.h>
#include <wex/data/dir.h>
#include <wex/data/stc.h>
#include <wx/combobox.h>
#include <wx/listbox.h>
#include <optional>
#include <vector>
Include dependency graph for util.h:

Enumerations

enum class  wex::compare_t { USE_AS_PROVIDED , USE_NEWEST , USE_OLDEST }
 The kind of compare used by comparing files. More...

Functions

std::optional< auto_complete_filename_t > wex::auto_complete_filename (const std::string &text)
 Tries to auto complete filename, the result is stored as a auto_complete_filename_t.
template<typename T>
void wex::combobox_as (wxComboBox *cb, const T &t)
 Sets entries for a combobox from a container.
void wex::combobox_from_list (wxComboBox *cb, const strings_t &text)
 Sets entries for a combobox from a list with strings.
bool wex::compare_file (const path &file1, const path &file2, compare_t=compare_t::USE_NEWEST)
 Compares the files, using comparator set in the config.
bool wex::lexers_dialog (syntax::stc *stc)
 Shows a dialog with all lexers, allowing you to choose one.
template<typename T>
void wex::listbox_as (wxListBox *lb, const T &t)
 Sets entries for a listbox from a container.
strings_t wex::listbox_to_list (wxListBox *lb)
 Returns a strings_t from value of a listbox.
int wex::open_files (factory::frame *frame, const std::vector< path > &files, const data::stc &data=data::stc(), const data::dir::type_t &type=data::dir::type_t_def())
 Opens all files specified by files.
void wex::process_match (const path_match &m, wxEvtHandler *eh)
 Processes a match.
bool wex::shell_expansion (std::string &command)
 Executes all process between backquotes in command, and changes command with replaced match with output from process.
void wex::vcs_command_stc (const vcs_command &command, const lexer &lexer, syntax::stc *stc)
 Use specified vcs command to set lexer on stc document.
void wex::xml_error (const path &filename, const pugi::xml_parse_result *result, syntax::stc *stc=nullptr)
 Shows xml error.

Enumeration Type Documentation

◆ compare_t

enum class wex::compare_t
strong

The kind of compare used by comparing files.

Enumerator
USE_AS_PROVIDED 

use as provided

USE_NEWEST 

use newest as current

USE_OLDEST 

use oldest as current

Function Documentation

◆ auto_complete_filename()

std::optional< auto_complete_filename_t > wex::auto_complete_filename ( const std::string & text)

Tries to auto complete filename, the result is stored as a auto_complete_filename_t.

Parameters
texttext containing start of a filename

◆ compare_file()

bool wex::compare_file ( const path & file1,
const path & file2,
compare_t = compare_t::USE_NEWEST )

Compares the files, using comparator set in the config.

Returns true if comparing was done.

Parameters
file1first file
file2second file
-the compare type

◆ lexers_dialog()

bool wex::lexers_dialog ( syntax::stc * stc)

Shows a dialog with all lexers, allowing you to choose one.

Returns true and sets the lexer on the stc component if you selected one.

◆ open_files()

int wex::open_files ( factory::frame * frame,
const std::vector< path > & files,
const data::stc & data = data::stc(),
const data::dir::type_t & type = data::dir::type_t_def() )

Opens all files specified by files.

Returns number of files opened.

Parameters
frameframe on which open_file for each file is called, and open_file_dir for each dir
filesarray with files
datadata to be used with open_file
typeflags to be used with open_file_dir

◆ process_match()

void wex::process_match ( const path_match & m,
wxEvtHandler * eh )

Processes a match.

Parameters
mthe match path
ehthe event handler that will receive the match (ID_LIST_MATCH)

◆ shell_expansion()

bool wex::shell_expansion ( std::string & command)

Executes all process between backquotes in command, and changes command with replaced match with output from process.

Returns false if process could not be executed.

◆ vcs_command_stc()

void wex::vcs_command_stc ( const vcs_command & command,
const lexer & lexer,
syntax::stc * stc )

Use specified vcs command to set lexer on stc document.

Parameters
commandVCS command, used to check for diff or open command
lexerlexer to be used
stcstc on which lexer is set

◆ xml_error()

void wex::xml_error ( const path & filename,
const pugi::xml_parse_result * result,
syntax::stc * stc = nullptr )

Shows xml error.

Parameters
filenamexml filename that has error
resultresult of parsing describing the error
stcstc component containing the filename