args-parser 6.3.3
Loading...
Searching...
No Matches
Args::ArgIface Class Referenceabstract

Interface for arguments. More...

#include <arg_iface.hpp>

+ Inheritance diagram for Args::ArgIface:

Public Member Functions

 ArgIface ()
 
virtual ~ArgIface ()
 
virtual ArgType type () const =0
 
virtual String name () const =0
 
virtual bool isWithValue () const =0
 
virtual bool isRequired () const =0
 
virtual bool isDefined () const =0
 
virtual const Stringflag () const =0
 
virtual const StringargumentName () const =0
 
virtual const StringvalueSpecifier () const =0
 
virtual const Stringdescription () const =0
 
virtual const StringlongDescription () const =0
 
CmdLinecmdLine () const
 
virtual bool isMisspelledName (const String &name, StringList &possibleNames) const =0
 
virtual void clear ()=0
 Clear state of the argument.
 

Protected Member Functions

virtual ArgIfacefindArgument (const String &name)=0
 
virtual void process (Context &context)=0
 Process argument's staff, for example take values from context.
 
virtual void checkCorrectnessBeforeParsing (StringList &flags, StringList &names) const =0
 Check correctness of the argument before parsing.
 
virtual void checkCorrectnessAfterParsing () const =0
 Check correctness of the argument after parsing.
 
virtual void setCmdLine (CmdLine *cmdLine)
 Set command line parser.
 

Friends

class CmdLine
 
class GroupIface
 
class Command
 

Detailed Description

Interface for arguments.

Definition at line 51 of file arg_iface.hpp.

Constructor & Destructor Documentation

◆ ArgIface()

Args::ArgIface::ArgIface ( )
inline

Definition at line 58 of file arg_iface.hpp.

◆ ~ArgIface()

virtual Args::ArgIface::~ArgIface ( )
inlinevirtual

Definition at line 63 of file arg_iface.hpp.

Member Function Documentation

◆ argumentName()

virtual const String & Args::ArgIface::argumentName ( ) const
pure virtual
Returns
Argument name.

Implemented in Args::Arg, and Args::GroupIface.

◆ checkCorrectnessAfterParsing()

virtual void Args::ArgIface::checkCorrectnessAfterParsing ( ) const
protectedpure virtual

Check correctness of the argument after parsing.

Implemented in Args::Arg, Args::Command, Args::GroupIface, Args::OnlyOneGroup, and Args::AllOfGroup.

◆ checkCorrectnessBeforeParsing()

virtual void Args::ArgIface::checkCorrectnessBeforeParsing ( StringList flags,
StringList names 
) const
protectedpure virtual

Check correctness of the argument before parsing.

Implementation of this method must add his flag and name to the flags and names.

Parameters
flagsAll known flags.
namesAll known names.

Implemented in Args::Arg, Args::Command, Args::GroupIface, Args::OnlyOneGroup, Args::AllOfGroup, and Args::AtLeastOneGroup.

◆ clear()

virtual void Args::ArgIface::clear ( )
pure virtual

Clear state of the argument.

Implemented in Args::Arg, Args::Command, Args::GroupIface, and Args::MultiArg.

◆ cmdLine()

CmdLine * Args::ArgIface::cmdLine ( ) const
inline
Returns
Command line parser.

Definition at line 103 of file arg_iface.hpp.

◆ description()

virtual const String & Args::ArgIface::description ( ) const
pure virtual
Returns
Description of the argument.

Implemented in Args::Arg, Args::Command, and Args::GroupIface.

◆ findArgument()

virtual ArgIface * Args::ArgIface::findArgument ( const String name)
protectedpure virtual
Returns
Argument for the given name.
Return values
Pointerto the ArgIface if this argument handles argument with the given name.
nullptrif this argument doesn't know about argument with name.
Parameters
nameName of the argument. Can be for example "-t" or "--timeout".

Implemented in Args::Command, Args::Arg, and Args::GroupIface.

◆ flag()

virtual const String & Args::ArgIface::flag ( ) const
pure virtual
Returns
Flag.

Implemented in Args::Arg, and Args::GroupIface.

◆ isDefined()

virtual bool Args::ArgIface::isDefined ( ) const
pure virtual
Returns
Is this argument defined?

Implemented in Args::Arg, Args::Command, Args::OnlyOneGroup, Args::AllOfGroup, and Args::AtLeastOneGroup.

◆ isMisspelledName()

virtual bool Args::ArgIface::isMisspelledName ( const String name,
StringList possibleNames 
) const
pure virtual
Returns
Is given name a misspelled name of the argument.
Parameters
nameName to check (misspelled).
possibleNamesList of possible names for the given misspelled name.

Implemented in Args::Arg, Args::GroupIface, and Args::Command.

◆ isRequired()

virtual bool Args::ArgIface::isRequired ( ) const
pure virtual
Returns
Is this argument required?

Implemented in Args::Arg, and Args::GroupIface.

◆ isWithValue()

virtual bool Args::ArgIface::isWithValue ( ) const
pure virtual
Returns
Is this argument with value?

Implemented in Args::Arg, Args::Command, and Args::GroupIface.

◆ longDescription()

virtual const String & Args::ArgIface::longDescription ( ) const
pure virtual
Returns
Long description of the argument.

Implemented in Args::Arg, Args::Command, and Args::GroupIface.

◆ name()

virtual String Args::ArgIface::name ( ) const
pure virtual
Returns
Name of the argument.

If name is empty returned value should be a flag. I.e. for example "-t" or "--timeout"

Implemented in Args::Arg, and Args::GroupIface.

◆ process()

virtual void Args::ArgIface::process ( Context context)
protectedpure virtual

Process argument's staff, for example take values from context.

This method invokes exactly at that moment when parser has found this argument.

Parameters
contextContext of the command line.

Implemented in Args::GroupIface, Args::Arg, Args::Help, Args::MultiArg, and Args::Command.

◆ setCmdLine()

virtual void Args::ArgIface::setCmdLine ( CmdLine cmdLine)
inlineprotectedvirtual

Set command line parser.

Reimplemented in Args::GroupIface, and Args::Help.

Definition at line 159 of file arg_iface.hpp.

◆ type()

virtual ArgType Args::ArgIface::type ( ) const
pure virtual
Returns
Type of the argument.

Implemented in Args::Arg, Args::Command, Args::OnlyOneGroup, Args::AllOfGroup, Args::AtLeastOneGroup, and Args::MultiArg.

◆ valueSpecifier()

virtual const String & Args::ArgIface::valueSpecifier ( ) const
pure virtual
Returns
Value specifier.

Implemented in Args::Arg, Args::Command, and Args::GroupIface.

Friends And Related Symbol Documentation

◆ CmdLine

friend class CmdLine
friend

Definition at line 53 of file arg_iface.hpp.

◆ Command

friend class Command
friend

Definition at line 55 of file arg_iface.hpp.

◆ GroupIface

friend class GroupIface
friend

Definition at line 54 of file arg_iface.hpp.


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