TTKMusicPlayer  3.7.0.0
TTKMusicPlayer imitates Kugou UI, the music player uses of qmmp core library based on Qt for windows and linux
Public Member Functions | Private Attributes | List of all members
TTKCommandLineParser Class Reference

The class of the command line parser. More...

#include <ttkcommandline.h>

Public Member Functions

 TTKCommandLineParser ()=default
 
void setDescription (const QString &description) noexcept
 
bool addOption (const TTKCommandLineOption &option)
 
bool addOptions (const QList< TTKCommandLineOption > &options)
 
void process ()
 
void process (const QStringList &arguments)
 
bool isSet (const TTKCommandLineOption &option) const
 
QString value (const TTKCommandLineOption &option) const
 
bool isEmpty () const noexcept
 
void showHelp () const
 

Private Attributes

QString m_description
 
QHash< QString, QString > m_commands
 
QList< TTKCommandLineOptionm_options
 

Detailed Description

The class of the command line parser.

Author
Greedysky greed.nosp@m.ysky.nosp@m.@163..nosp@m.com

Definition at line 88 of file ttkcommandline.h.

Constructor & Destructor Documentation

TTKCommandLineParser::TTKCommandLineParser ( )
default

Object constructor.

Member Function Documentation

bool TTKCommandLineParser::addOption ( const TTKCommandLineOption option)

Add command line option.

Definition at line 10 of file ttkcommandline.cpp.

References TTKCommandLineOption::first(), m_options, qAsConst, and TTK_ERROR_STREAM.

Referenced by addOptions(), MusicConsoleModule::initialize(), and MusicProcessServer::run().

bool TTKCommandLineParser::addOptions ( const QList< TTKCommandLineOption > &  options)

Add command line options.

Definition at line 31 of file ttkcommandline.cpp.

References addOption(), and qAsConst.

bool TTKCommandLineParser::isEmpty ( ) const
inlinenoexcept

Current input command is empty.

Definition at line 132 of file ttkcommandline.h.

Referenced by MusicConsoleModule::initialize().

bool TTKCommandLineParser::isSet ( const TTKCommandLineOption option) const

Check current option is set.

Definition at line 64 of file ttkcommandline.cpp.

References TTKCommandLineOption::first(), m_commands, and TTKCommandLineOption::second().

Referenced by MusicConsoleModule::initialize(), and MusicProcessServer::run().

void TTKCommandLineParser::process ( )

Process command line by input.

Definition at line 41 of file ttkcommandline.cpp.

Referenced by MusicConsoleModule::initialize(), and MusicProcessServer::run().

void TTKCommandLineParser::process ( const QStringList &  arguments)

Process command line by input.

Definition at line 46 of file ttkcommandline.cpp.

References m_commands, and qAsConst.

void TTKCommandLineParser::setDescription ( const QString &  description)
noexcept

Set application description.

Definition at line 5 of file ttkcommandline.cpp.

References description.

Referenced by MusicConsoleModule::initialize().

void TTKCommandLineParser::showHelp ( ) const

Show help text.

Definition at line 77 of file ttkcommandline.cpp.

References m_description, m_options, qAsConst, and TTK_LOG_STREAM.

Referenced by MusicConsoleModule::initialize(), and MusicProcessServer::run().

QString TTKCommandLineParser::value ( const TTKCommandLineOption option) const

Get command line option value.

Definition at line 70 of file ttkcommandline.cpp.

References TTKCommandLineOption::first(), m_commands, and TTKCommandLineOption::second().

Referenced by MusicConsoleModule::initialize(), and MusicProcessServer::run().

Member Data Documentation

QHash<QString, QString> TTKCommandLineParser::m_commands
private

Definition at line 141 of file ttkcommandline.h.

Referenced by isSet(), process(), and value().

QString TTKCommandLineParser::m_description
private

Definition at line 140 of file ttkcommandline.h.

Referenced by showHelp().

QList<TTKCommandLineOption> TTKCommandLineParser::m_options
private

Definition at line 142 of file ttkcommandline.h.

Referenced by addOption(), and showHelp().


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