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

This class offers the ex command parser. More...

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

Public Types

enum class  address_t { NO_ADDR , ONE_ADDR , TWO_ADDR }
 The possible ex address types. More...
 
enum class  parse_t { PARSE , CHECK }
 The possible ex parse types. More...
 

Public Member Functions

 command_parser (ex *ex, const std::string &text=std::string(), parse_t type=parse_t::PARSE)
 Constructor.
 
auto & command () const
 The command.
 
bool is_ok () const
 Returns true if parsing was ok.
 
auto & range () const
 The range.
 
auto & text () const
 The text (rest), not the original supplied text.
 
auto type () const
 The type that is parsed.
 

Detailed Description

This class offers the ex command parser.

Member Enumeration Documentation

◆ address_t

enum class wex::command_parser::address_t
strong

The possible ex address types.

Enumerator
NO_ADDR 

not address related

ONE_ADDR 

one address related

TWO_ADDR 

two addresses related

◆ parse_t

enum class wex::command_parser::parse_t
strong

The possible ex parse types.

Enumerator
PARSE 

check and parse text

CHECK 

check only

Constructor & Destructor Documentation

◆ command_parser()

wex::command_parser::command_parser ( ex * ex,
const std::string & text = std::string(),
parse_t type = parse_t::PARSE )

Constructor.

Parameters
exthe ex component
textprovide the complete ex command (after colon), e.g. "5p".
  • if text not empty parses the text, and sets members
  • and if type is PARSE also invokes the address or addressrange parser
typespecify whether to parse text only (CHECK) or continue parsing address or addressrange (PARSE)

Member Function Documentation

◆ command()

auto & wex::command_parser::command ( ) const
inline

The command.

mostly a one letter string like "z" for adjust_window mostly a one letter string like "p" for print