senf::console::ParseCommandInfo Class Reference

Single parsed console command. More...

#include <senf/Utils/Console/Parse.hh>

Classes

class  ArgumentIterator
 Iterator parsing argument groups. More...
 

Public Types

enum  BuiltinCommand {
  NoBuiltin, BuiltinCD, BuiltinLS, BuiltinLL,
  BuiltinLR, BuiltinPUSHD, BuiltinPOPD, BuiltinEXIT,
  BuiltinHELP, BuiltinECHO
}
 
typedef CommandPath::const_iterator path_iterator
 
typedef Tokens::const_iterator token_iterator
 
typedef ArgumentIterator argument_iterator
 
typedef Tokens::size_type size_type
 
typedef boost::iterator_range< path_iteratorCommandPathRange
 
typedef boost::iterator_range< argument_iteratorArgumentsRange
 
typedef boost::iterator_range< token_iteratorTokensRange
 

Public Member Functions

 ParseCommandInfo ()
 
BuiltinCommand builtin () const
 Command type. More...
 
TokensRange commandPath () const
 Command path. More...
 
ArgumentsRange arguments () const
 Command arguments. More...
 
TokensRange tokens () const
 All argument tokens. More...
 
void clear ()
 Clear all data members. More...
 
bool empty ()
 true, if the data is empty More...
 
void builtin (BuiltinCommand builtin)
 Assign builtin command. More...
 
void command (std::vector< Token > &commandPath)
 Assign non-builtin command. More...
 
void addToken (Token const &token)
 Add argument token. More...
 

Detailed Description

Single parsed console command.

Every command parsed is returned in a ParseCommandInfo instance. This information is purely taken from the parser, no semantic information is attached at this point, the config/console node tree is not involved in any way. ParseCommandInfo consist of

  • the type of command: built-in or normal command represented by a possibly relative path into the command tree.
  • the command
  • the arguments. Every argument consists of a range of Token instances.

Definition at line 363 of file Parse.hh.

Member Typedef Documentation

◆ argument_iterator

◆ ArgumentsRange

Definition at line 377 of file Parse.hh.

◆ CommandPathRange

Definition at line 376 of file Parse.hh.

◆ path_iterator

◆ size_type

typedef Tokens::size_type senf::console::ParseCommandInfo::size_type

Definition at line 374 of file Parse.hh.

◆ token_iterator

◆ TokensRange

Definition at line 378 of file Parse.hh.

Member Enumeration Documentation

◆ BuiltinCommand

Enumerator
NoBuiltin 
BuiltinCD 
BuiltinLS 
BuiltinLL 
BuiltinLR 
BuiltinPUSHD 
BuiltinPOPD 
BuiltinEXIT 
BuiltinHELP 
BuiltinECHO 

Definition at line 380 of file Parse.hh.

Constructor & Destructor Documentation

◆ ParseCommandInfo()

senf::console::ParseCommandInfo::ParseCommandInfo ( )

Member Function Documentation

◆ addToken()

void senf::console::ParseCommandInfo::addToken ( Token const &  token)

Add argument token.

You must ensure, that the resulting argument tokens are properly nested regarding '()' groups, otherwise interpreting arguments using the arguments() call will crash the program.

◆ arguments()

ArgumentsRange senf::console::ParseCommandInfo::arguments ( ) const

Command arguments.

The returned range contains one TokensRange for each argument.

◆ builtin() [1/2]

BuiltinCommand senf::console::ParseCommandInfo::builtin ( ) const

Command type.

Returns
NoBuiltin, if the command is an ordinary command, otherwise the id of the built-in command

◆ builtin() [2/2]

void senf::console::ParseCommandInfo::builtin ( BuiltinCommand  builtin)

Assign builtin command.

◆ clear()

void senf::console::ParseCommandInfo::clear ( )

Clear all data members.

◆ command()

void senf::console::ParseCommandInfo::command ( std::vector< Token > &  commandPath)

Assign non-builtin command.

◆ commandPath()

TokensRange senf::console::ParseCommandInfo::commandPath ( ) const

Command path.

This is the path to the command if it is not a built-in command. Every element of the returned range constitutes one path element. If the first element is empty, the path is an absolute path, otherwise it is relative. If the last element is an empty string, the path ends with a '/' char.

◆ empty()

bool senf::console::ParseCommandInfo::empty ( )

true, if the data is empty

◆ tokens()

TokensRange senf::console::ParseCommandInfo::tokens ( ) const

All argument tokens.

The returned range contains all argument tokens in a single range not divided into separate arguments.


The documentation for this class was generated from the following file: