wex  v21.04.0
Public Types | Public Member Functions | List of all members
wex::ex_command Class Reference

Offers a command to be used by ex command. More...

#include <wex/ex-command.h>

Public Types

enum class  type_t {
  CALC , COMMAND , EXEC , FIND ,
  FIND_MARGIN , NONE , REPLACE , VI
}
 The type of ex command. More...
 

Public Member Functions

 ex_command ()
 Default constructor.
 
 ex_command (stc *stc)
 Constructor, sets stc component.
 
 ex_command (const std::string &text)
 Constructor, sets command text.
 
 ex_command (const ex_command &c)
 Copy constructor.
 
ex_commandoperator= (const ex_command &c)
 Assignment operator.
 
ex_commandappend (char c)
 Appends a char.
 
ex_commandappend (const std::string &s)
 Appends a string.
 
bool append_exec (char c)
 Appends a char and tries to execute.
 
auto back () const
 Returns last char of command.
 
void clear ()
 Clears command text.
 
const auto & command () const
 Returns the command text.
 
auto empty () const
 Returns true if command text is empty.
 
void erase (size_t pos, size_t len=1)
 Erases element(s) at position from command text.
 
bool exec () const
 Executes the command on the stc component if available.
 
auto front () const
 Returns front of command text.
 
auto * get_stc () const
 Returns stc component.
 
void handle (const wxTextEntry *te, int keycode)
 Handles keycode from textntry component.
 
void insert (size_t pos, char c)
 Inserts char at pos.
 
void insert (size_t pos, const std::string &s)
 Inserts string at pos.
 
void no_type ()
 Sets to no type.
 
void pop_back ()
 Removes last char of command text.
 
ex_commandreset (const std::string &text=std::string(), bool full=false)
 Resets command to text (but keeps type).
 
void restore (const ex_command &c)
 Restores values, if possible from original stc.
 
ex_commandset (const std::string &text)
 Sets command text. More...
 
void set (const ex_command &c)
 Sets new command, except original stc. More...
 
auto size () const
 Returns size of command.
 
std::string str () const
 Returns string type of command.
 
type_t type () const
 Returns type of command.
 

Detailed Description

Offers a command to be used by ex command.

Member Enumeration Documentation

◆ type_t

The type of ex command.

Enumerator
CALC 

a calculation command (control-r =)

COMMAND 

a normal command (:)

EXEC 

an exec command (!)

FIND 

a find command (/ or ?)

FIND_MARGIN 

a find command (/ or ?) entered on text margin

NONE 

an empty command

REPLACE 

a replace command

VI 

a vi command (no ex command)

Member Function Documentation

◆ set() [1/2]

void wex::ex_command::set ( const ex_command c)

Sets new command, except original stc.

This can be used in combination with restore.

◆ set() [2/2]

ex_command& wex::ex_command::set ( const std::string &  text)

Sets command text.

The text should start with a command prefix, like ':' to return the command type.