hydrogen 1.2.6
Parser Class Reference

Reusable parser for provided command line arguments. More...

#include <Parser.h>

Public Member Functions

 Parser ()
 
 ~Parser ()
 
const QString & getAudioDriver () const
 
const QString & getConfigFilePath () const
 
const QString & getDrumkitToLoad () const
 
const QString & getInstallDrumkitPath () const
 
bool getLogColors () const
 
const QString & getLogFile () const
 
unsigned getLogLevel () const
 
bool getLogTimestamps () const
 
bool getNoReporter () const
 
bool getNoSplashScreen () const
 
int getOscPort () const
 
const QString & getPlaylistFilename () const
 
const QString & getShotList () const
 
const QString & getSongFilename () const
 
const QString & getSysDataPath () const
 
const QString & getUiLayout () const
 
const QString & getUsrDataPath () const
 
bool parse (int argc, char *argv[])
 

Private Attributes

bool m_bLogColors
 
bool m_bLogTimestamps
 
bool m_bNoReporter
 
bool m_bNoSplashScreen
 
unsigned m_logLevel
 
int m_nOscPort
 
QString m_sAudioDriver
 
QString m_sConfigFilePath
 
QString m_sDrumkitToLoad
 
QString m_sInstallDrumkitPath
 
QString m_sLogFile
 
QString m_sPlaylistFilename
 
QString m_sShotList
 
QString m_sSongFilename
 
QString m_sSysDataPath
 
QString m_sUiLayout
 
QString m_sUsrDataPath
 

Detailed Description

Reusable parser for provided command line arguments.

In our current design we have to access the CLI arguments of the hydrogen program at two different points (h2cli and h2player have other CLI options and are not covered in here): 1. In Reporter and 2. in the main routine it spawns.

Some CLI args, like the path to a custom log file, are important for the Reporter as well. But it can not access them through the child process but has to retrieve it from the CLI args itself. Here it is crucial to a) perform the parsing in the same way in order to avoid inconsistencies and b) keep the parsing with the one in the main routine in sync as QCommandLineParser will complain about arguments unknown to it. That's why we abstract it in a separate class.

Note that this is not a H2_OBJECT. It get's invoked way ahead of H2Core::Logger::bootstrap() and H2Core::Base::bootstrap() and could not be used with our usual logging macros etc.

Definition at line 46 of file Parser.h.

Constructor & Destructor Documentation

◆ Parser()

Parser ( )

Definition at line 34 of file Parser.cpp.

◆ ~Parser()

~Parser ( )

Definition at line 37 of file Parser.cpp.

Member Function Documentation

◆ getAudioDriver()

const QString & getAudioDriver ( ) const
inline

Definition at line 54 of file Parser.h.

◆ getConfigFilePath()

const QString & getConfigFilePath ( ) const
inline

Definition at line 78 of file Parser.h.

◆ getDrumkitToLoad()

const QString & getDrumkitToLoad ( ) const
inline

Definition at line 60 of file Parser.h.

◆ getInstallDrumkitPath()

const QString & getInstallDrumkitPath ( ) const
inline

Definition at line 63 of file Parser.h.

◆ getLogColors()

bool getLogColors ( ) const
inline

Definition at line 72 of file Parser.h.

◆ getLogFile()

const QString & getLogFile ( ) const
inline

Definition at line 68 of file Parser.h.

◆ getLogLevel()

unsigned getLogLevel ( ) const
inline

Definition at line 66 of file Parser.h.

◆ getLogTimestamps()

bool getLogTimestamps ( ) const
inline

Definition at line 70 of file Parser.h.

◆ getNoReporter()

bool getNoReporter ( ) const
inline

Definition at line 90 of file Parser.h.

◆ getNoSplashScreen()

bool getNoSplashScreen ( ) const
inline

Definition at line 84 of file Parser.h.

◆ getOscPort()

int getOscPort ( ) const
inline

Definition at line 82 of file Parser.h.

◆ getPlaylistFilename()

const QString & getPlaylistFilename ( ) const
inline

Definition at line 56 of file Parser.h.

◆ getShotList()

const QString & getShotList ( ) const
inline

Definition at line 87 of file Parser.h.

◆ getSongFilename()

const QString & getSongFilename ( ) const
inline

Definition at line 58 of file Parser.h.

◆ getSysDataPath()

const QString & getSysDataPath ( ) const
inline

Definition at line 74 of file Parser.h.

◆ getUiLayout()

const QString & getUiLayout ( ) const
inline

Definition at line 80 of file Parser.h.

◆ getUsrDataPath()

const QString & getUsrDataPath ( ) const
inline

Definition at line 76 of file Parser.h.

◆ parse()

bool parse ( int argc,
char * argv[] )

Definition at line 40 of file Parser.cpp.

Field Documentation

◆ m_bLogColors

bool m_bLogColors
private

Definition at line 104 of file Parser.h.

◆ m_bLogTimestamps

bool m_bLogTimestamps
private

Definition at line 103 of file Parser.h.

◆ m_bNoReporter

bool m_bNoReporter
private

Definition at line 115 of file Parser.h.

◆ m_bNoSplashScreen

bool m_bNoSplashScreen
private

Definition at line 111 of file Parser.h.

◆ m_logLevel

unsigned m_logLevel
private

Definition at line 101 of file Parser.h.

◆ m_nOscPort

int m_nOscPort
private

Definition at line 110 of file Parser.h.

◆ m_sAudioDriver

QString m_sAudioDriver
private

Definition at line 94 of file Parser.h.

◆ m_sConfigFilePath

QString m_sConfigFilePath
private

Definition at line 108 of file Parser.h.

◆ m_sDrumkitToLoad

QString m_sDrumkitToLoad
private

Definition at line 97 of file Parser.h.

◆ m_sInstallDrumkitPath

QString m_sInstallDrumkitPath
private

Definition at line 99 of file Parser.h.

◆ m_sLogFile

QString m_sLogFile
private

Definition at line 102 of file Parser.h.

◆ m_sPlaylistFilename

QString m_sPlaylistFilename
private

Definition at line 95 of file Parser.h.

◆ m_sShotList

QString m_sShotList
private

Definition at line 113 of file Parser.h.

◆ m_sSongFilename

QString m_sSongFilename
private

Definition at line 96 of file Parser.h.

◆ m_sSysDataPath

QString m_sSysDataPath
private

Definition at line 106 of file Parser.h.

◆ m_sUiLayout

QString m_sUiLayout
private

Definition at line 109 of file Parser.h.

◆ m_sUsrDataPath

QString m_sUsrDataPath
private

Definition at line 107 of file Parser.h.