wex v24.10.0
Public Types | Public Member Functions | Static Public Member Functions | List of all members
wex::ex_command Class Reference

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

#include <wex/factory/ex-command.h>

Public Types

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

Public Member Functions

 ex_command (factory::stc *stc=nullptr)
 Default constructor, sets stc component.
 
 ex_command (const std::string &text)
 Constructor, sets command text.
 
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.
 
bool append_exec (const std::string &s)
 Appends a string 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.
 
bool exec () const
 Executes the command on the stc component if available.
 
bool exec_finish (bool user_input) const
 Finishes the execute.
 
auto front () const
 Returns front of command text.
 
auto * get_stc () const
 Returns stc component.
 
void no_type ()
 Sets to no type.
 
void pop_back ()
 Removes last char of command text.
 
ex_commandreset (const std::string &text=std::string())
 Resets command to text (but keeps type).
 
ex_commandset (const std::string &text)
 Sets command text.
 
void set_stc (wex::factory::stc *stc)
 Sets stc component.
 
auto size () const
 Returns size of command.
 
std::string str () const
 Returns string type of command.
 
type_t type () const
 Returns type of command.
 

Static Public Member Functions

static const std::string selection_range ()
 Returns string used to retrieve addressrange for selection.
 

Detailed Description

Offers a command to be used by ex command.

Member Enumeration Documentation

◆ type_t

enum class wex::ex_command::type_t
strong

The type of ex command.

Enumerator
COMMAND 

a normal (ex) command (:)

COMMAND_RANGE 

a normal (ex) command on a range (:'<,'>)

CALC 

a calculation command (control-r =)

COMMAND_EX 

a normal (ex) command, entered in explicit ex mode (:)

ESCAPE 

an escape command (!)

ESCAPE_RANGE 

an escape command on a range (:'<,'>!)

FIND_MARGIN 

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

NONE 

an empty command

FIND 

a find command (/ or ?)

REPLACE 

a replace command (no ex command)

VI 

a vi command (no ex command)

Member Function Documentation

◆ set()

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.