wex  v21.10.0
Public Member Functions | Static Public Member Functions | List of all members
wex::process Class Reference

Offers a process, capturing execution output. More...

#include <wex/process.h>

Inheritance diagram for wex::process:
Inheritance graph
[legend]

Public Member Functions

 process ()
 Other methods. More...
 
 ~process () override
 Destructor.
 
 process (const process &process)
 Copy constructor.
 
processoperator= (const process &p)
 Assignment operator.
 
virtual void show_output (const std::string &caption=std::string()) const
 Virtual interface. More...
 
auto * get_frame ()
 Returns the frame.
 
bool async_system (const std::string &exe=std::string(), const std::string &start_dir=std::string()) override
 Override methods. More...
 
bool write (const std::string &text) override
 Writes text to stdin of process. More...
 
- Public Member Functions inherited from wex::factory::process
 process ()
 Default constructor.
 
const auto & get_exe () const
 Other methods. More...
 
const auto & get_stderr () const
 Returns the stderr.
 
const auto & get_stdout () const
 Returns the stdout.
 
bool is_debug () const
 Is this a debug process.
 
bool is_running () const
 Is this process running.
 
void set_handler_dbg (wxEvtHandler *eh)
 Sets debug event handler.
 
void set_handler_out (wxEvtHandler *eh)
 Sets out event handler.
 
int system (const std::string &exe, const std::string &start_dir=std::string())
 Runs the sync process, collecting output in stdout and stderr. More...
 

Static Public Member Functions

static int config_dialog (const data::window &data=data::window())
 Static interface. More...
 
static auto * get_shell ()
 Returns the shell component (might be nullptr if prepare_output is not yet invoked).
 
static shellprepare_output (wxWindow *parent)
 Construct the shell component, and returns it.
 

Detailed Description

Offers a process, capturing execution output.

Constructor & Destructor Documentation

◆ process()

wex::process::process ( )

Other methods.

Default constructor.

Member Function Documentation

◆ async_system()

bool wex::process::async_system ( const std::string &  exe = std::string(),
const std::string &  start_dir = std::string() 
)
overridevirtual

Override methods.

See factory::process. Return value is false if process could not execute, or if config dialog was invoked and cancelled, or prepare_output not yet invoked.

Reimplemented from wex::factory::process.

◆ config_dialog()

static int wex::process::config_dialog ( const data::window data = data::window())
static

Static interface.

Shows a config dialog, allowing you to set the command and folder. Returns dialog return code.

◆ show_output()

virtual void wex::process::show_output ( const std::string &  caption = std::string()) const
virtual

Virtual interface.

Shows stdout or stderr from system on the shell component. You can override this method to e.g. prepare a lexer on get_shell before calling this base method.

Reimplemented in wex::vcs_entry.

◆ write()

bool wex::process::write ( const std::string &  text)
overridevirtual

Writes text to stdin of process.

The response stdout is collected in the shell.

Reimplemented from wex::factory::process.