wex  v20.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  type_t {
  type_t::CALC, type_t::COMMAND, type_t::EXEC, type_t::FIND,
  type_t::FIND_MARGIN, type_t::NONE, type_t::REPLACE, type_t::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.
 
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 pop_back ()
 Removes last char of command text.
 
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.
 
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.