qBittorrent
anonymous_namespace{cmdoptions.cpp}::Option Class Reference
Inheritance diagram for anonymous_namespace{cmdoptions.cpp}::Option:

Static Public Member Functions

static QString padUsageText (const QString &usage)
 

Protected Member Functions

constexpr Option (const char *name, char shortcut=0)
 
QString fullParameter () const
 
QString shortcutParameter () const
 
bool hasShortcut () const
 
QString envVarName () const
 

Private Attributes

const char * m_name
 
const char m_shortcut
 

Detailed Description

Definition at line 59 of file cmdoptions.cpp.

Constructor & Destructor Documentation

◆ Option()

constexpr anonymous_namespace{cmdoptions.cpp}::Option::Option ( const char *  name,
char  shortcut = 0 
)
inlineexplicitconstexprprotected

Definition at line 62 of file cmdoptions.cpp.

63  : m_name {name}
64  , m_shortcut {shortcut}
65  {
66  }

Member Function Documentation

◆ envVarName()

QString anonymous_namespace{cmdoptions.cpp}::Option::envVarName ( ) const
inlineprotected

Definition at line 83 of file cmdoptions.cpp.

84  {
85  return QLatin1String("QBT_")
86  + QString::fromLatin1(m_name).toUpper().replace(QLatin1Char('-'), QLatin1Char('_'));
87  }

◆ fullParameter()

QString anonymous_namespace{cmdoptions.cpp}::Option::fullParameter ( ) const
inlineprotected

Definition at line 68 of file cmdoptions.cpp.

69  {
70  return QLatin1String("--") + QLatin1String(m_name);
71  }

◆ hasShortcut()

bool anonymous_namespace{cmdoptions.cpp}::Option::hasShortcut ( ) const
inlineprotected

Definition at line 78 of file cmdoptions.cpp.

79  {
80  return m_shortcut != 0;
81  }

◆ padUsageText()

static QString anonymous_namespace{cmdoptions.cpp}::Option::padUsageText ( const QString &  usage)
inlinestatic

Definition at line 90 of file cmdoptions.cpp.

91  {
92  QString res = QString(USAGE_INDENTATION, ' ') + usage;
93 
94  if ((USAGE_TEXT_COLUMN - usage.length() - 4) > 0)
95  return res + QString(USAGE_TEXT_COLUMN - usage.length() - 4, ' ');
96 
97  return res;
98  }

References anonymous_namespace{cmdoptions.cpp}::USAGE_INDENTATION, and anonymous_namespace{cmdoptions.cpp}::USAGE_TEXT_COLUMN.

◆ shortcutParameter()

QString anonymous_namespace{cmdoptions.cpp}::Option::shortcutParameter ( ) const
inlineprotected

Definition at line 73 of file cmdoptions.cpp.

74  {
75  return QLatin1String("-") + QLatin1Char(m_shortcut);
76  }

Member Data Documentation

◆ m_name

const char* anonymous_namespace{cmdoptions.cpp}::Option::m_name
private

Definition at line 101 of file cmdoptions.cpp.

◆ m_shortcut

const char anonymous_namespace{cmdoptions.cpp}::Option::m_shortcut
private

Definition at line 102 of file cmdoptions.cpp.


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