swift
Classes | Public Member Functions | Static Public Member Functions | List of all members
swift::misc::CSimpleCommandParser Class Reference

Utility methods for simple line parsing used with the command line. More...

Classes

struct  CommandHtmlHelp
 Help info. More...
 

Public Member Functions

 CSimpleCommandParser (const QStringList &knownCommands)
 Constructor.
 
bool isKnownCommand () const
 Known command?
 
void parse (const QString &commandLine)
 Parse.
 
bool matchesCommand (const QString &checkCommand, const QString &alias1="", const QString &alias2="")
 Is given command current command of command line.
 
bool commandStartsWith (const QString &startPattern) const
 Command starting with pattern?
 
bool commandEndsWith (const QString &endPattern) const
 Command ending with pattern?
 
const QString & part (int index) const
 Get part, 0 is command itself.
 
QString partAndRemainingStringAfter (int index) const
 Part and remaing string after. More...
 
int countParts () const
 Count parts.
 
bool hasPart (int index) const
 Existing part.
 
int countPartsWithoutCommand () const
 Count parts, command excluded.
 
bool isInt (int index) const
 Is part an integer?
 
bool isDouble (int index) const
 Is part a double?
 
int toInt (int index, int def=-1) const
 Part as integer.
 
bool toBool (int index, bool def=false) const
 Part as bool.
 
double toDouble (int index, double def=-1.0) const
 Part as double.
 
bool matchesPart (int index, const QString &toMatch, Qt::CaseSensitivity cs=Qt::CaseInsensitive) const
 Matches given part.
 

Static Public Member Functions

static void registerCommand (const CommandHtmlHelp &command)
 Register a command.
 
static bool registered (const QString &helpContext)
 Help already registered.
 
static QString commandsHtmlHelp ()
 HTML commands HELP.
 

Detailed Description

Utility methods for simple line parsing used with the command line.

Remarks
case insensitive parsing, commands start with . as ".msg"

Definition at line 20 of file simplecommandparser.h.

Member Function Documentation

◆ partAndRemainingStringAfter()

QString swift::misc::CSimpleCommandParser::partAndRemainingStringAfter ( int  index) const

Part and remaing string after.

Remarks
trimmed and simlified

Definition at line 55 of file simplecommandparser.cpp.


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