|
MythTV master
|
Definition for a single command line option. More...
#include <libmythbase/mythcommandlineparser.h>
Public Member Functions | |
| CommandLineArg (const QString &name, QMetaType::Type type, QVariant def, QString help, QString longhelp) | |
| Default constructor for CommandLineArg class. More... | |
| CommandLineArg (const QString &name, QMetaType::Type type, QVariant def) | |
| Reduced constructor for CommandLineArg class. More... | |
| CommandLineArg (const QString &name) | |
| Dummy constructor for CommandLineArg class. More... | |
| ~CommandLineArg () override=default | |
| CommandLineArg * | SetGroup (const QString &group) |
| void | AddKeyword (const QString &keyword) |
| QString | GetName (void) const |
| QString | GetUsedKeyword (void) const |
| int | GetKeywordLength (void) const |
| Return length of full keyword string for use in determining indent of help text. More... | |
| QString | GetHelpString (int off, const QString &group="", bool force=false) const |
| Return string containing help text with desired offset. More... | |
| QString | GetLongHelpString (QString keyword) const |
| Return string containing extended help text. More... | |
| bool | Set (const QString &opt) |
| Set option as provided on command line with no value. More... | |
| bool | Set (const QString &opt, const QByteArray &val) |
| Set option as provided on command line with value. More... | |
| void | Set (const QVariant &val) |
| CommandLineArg * | SetParent (const QString &opt) |
| Set argument as child of given parent. More... | |
| CommandLineArg * | SetParent (const QStringList &opts) |
| Set argument as child of multiple parents. More... | |
| CommandLineArg * | SetParentOf (const QString &opt) |
| Set argument as parent of given child. More... | |
| CommandLineArg * | SetParentOf (const QStringList &opts) |
| Set argument as parent of multiple children. More... | |
| CommandLineArg * | SetChild (const QString &opt) |
| Set argument as parent of given child. More... | |
| CommandLineArg * | SetChild (const QStringList &opt) |
| Set argument as parent of multiple children. More... | |
| CommandLineArg * | SetChildOf (const QString &opt) |
| Set argument as child of given parent. More... | |
| CommandLineArg * | SetChildOf (const QStringList &opts) |
| Set argument as child of multiple parents. More... | |
| CommandLineArg * | SetRequiredChild (const QString &opt) |
| Set argument as parent of given child and mark as required. More... | |
| CommandLineArg * | SetRequiredChild (const QStringList &opt) |
| Set argument as parent of multiple children and mark as required. More... | |
| CommandLineArg * | SetRequiredChildOf (const QString &opt) |
| Set argument as child required by given parent. More... | |
| CommandLineArg * | SetRequiredChildOf (const QStringList &opt) |
| Set argument as child required by multiple parents. More... | |
| CommandLineArg * | SetRequires (const QString &opt) |
| Set argument as requiring given option. More... | |
| CommandLineArg * | SetRequires (const QStringList &opts) |
| Set argument as requiring multiple options. More... | |
| CommandLineArg * | SetBlocks (const QString &opt) |
| Set argument as incompatible with given option. More... | |
| CommandLineArg * | SetBlocks (const QStringList &opts) |
| Set argument as incompatible with multiple options. More... | |
| CommandLineArg * | SetDeprecated (QString depstr="") |
| Set option as deprecated. More... | |
| CommandLineArg * | SetRemoved (QString remstr="", QString remver="") |
| Set option as removed. More... | |
| void | PrintVerbose (void) const |
| Internal use. More... | |
Public Member Functions inherited from ReferenceCounter | |
| ReferenceCounter (const QString &debugName, bool logDebug=true) | |
| Creates reference counter with an initial value of 1. More... | |
| virtual int | IncrRef (void) |
| Increments reference count. More... | |
| virtual int | DecrRef (void) |
| Decrements reference count and deletes on 0. More... | |
Static Public Member Functions | |
| static void | AllowOneOf (const QList< CommandLineArg * > &args) |
| Mark a list of arguments as mutually exclusive. More... | |
Static Public Member Functions inherited from ReferenceCounter | |
| static void | PrintDebug (void) |
| Print out any leaks if that level of debugging is enabled. More... | |
Private Member Functions | |
| QString | GetKeywordString (void) const |
| Return string containing all possible keyword triggers for this argument. More... | |
| void | SetParentOf (CommandLineArg *other, bool forward=true) |
| Internal use, set argument as parent of given child. More... | |
| void | SetChildOf (CommandLineArg *other, bool forward=true) |
| Internal use, set argument as child of given parent. More... | |
| void | SetRequires (CommandLineArg *other, bool forward=true) |
| Internal use, set argument as requiring given option. More... | |
| void | SetBlocks (CommandLineArg *other, bool forward=true) |
| Internal use, set argument as incompatible with given option. More... | |
| void | Convert (void) |
| Convert stored string value from QByteArray to QString. More... | |
| QString | GetPreferredKeyword (void) const |
| Return the longest keyword for the argument. More... | |
| bool | TestLinks (void) const |
| Test all related arguments to make sure specified requirements are fulfilled. More... | |
| void | CleanupLinks (void) |
| Clear out references to other arguments in preparation for deletion. More... | |
| void | PrintRemovedWarning (QString &keyword) const |
| Internal use. More... | |
| void | PrintDeprecatedWarning (QString &keyword) const |
| Internal use. More... | |
Private Attributes | |
| bool | m_given {false} |
| bool | m_converted {false} |
| QString | m_name |
| QString | m_group |
| QString | m_deprecated |
| QString | m_removed |
| QString | m_removedversion |
| QMetaType::Type | m_type {QMetaType::UnknownType} |
| QVariant | m_default |
| QVariant | m_stored |
| QStringList | m_keywords |
| QString | m_usedKeyword |
| QList< CommandLineArg * > | m_parents |
| QList< CommandLineArg * > | m_children |
| QList< CommandLineArg * > | m_requires |
| QList< CommandLineArg * > | m_requiredby |
| QList< CommandLineArg * > | m_blocks |
| QString | m_help |
| QString | m_longhelp |
Friends | |
| class | MythCommandLineParser |
Additional Inherited Members | |
Protected Member Functions inherited from ReferenceCounter | |
| virtual | ~ReferenceCounter (void) |
| Called on destruction, will warn if object deleted with references in place. More... | |
Protected Attributes inherited from ReferenceCounter | |
| bool | m_logDebug |
| This is used to suppress creating LoggingItem classes for LoggingItem reference count changes. More... | |
| QAtomicInt | m_referenceCount {1} |
Definition for a single command line option.
This class contains instructions for the command line parser about what options to process from the command line. Each instance can correspond to multiple argument keywords, and stores a default value, whether it has been supplied, help text, and optional interdependencies with other CommandLineArgs.
Definition at line 21 of file mythcommandlineparser.h.
| CommandLineArg::CommandLineArg | ( | const QString & | name, |
| QMetaType::Type | type, | ||
| QVariant | def, | ||
| QString | help, | ||
| QString | longhelp | ||
| ) |
Default constructor for CommandLineArg class.
This constructor is for use with command line parser, defining an option that can be used on the command line, and should be reported in –help printouts
Definition at line 288 of file mythcommandlineparser.cpp.
Referenced by SetBlocks(), SetChild(), SetChildOf(), SetParent(), SetParentOf(), SetRequiredChild(), SetRequiredChildOf(), and SetRequires().
| CommandLineArg::CommandLineArg | ( | const QString & | name, |
| QMetaType::Type | type, | ||
| QVariant | def | ||
| ) |
Reduced constructor for CommandLineArg class.
This constructor is for internal use within the command line parser. It is intended for use in supplementary data storage for information not supplied directly on the command line.
Definition at line 305 of file mythcommandlineparser.cpp.
|
explicit |
Dummy constructor for CommandLineArg class.
This constructor is for internal use within the command line parser. It is used as a placeholder for defining relations between different command line arguments, and is reconciled with the proper argument of the same name prior to parsing inputs.
Definition at line 321 of file mythcommandlineparser.cpp.
|
overridedefault |
|
inline |
Definition at line 32 of file mythcommandlineparser.h.
Referenced by MythCommandLineParser::add().
|
static |
Mark a list of arguments as mutually exclusive.
Definition at line 951 of file mythcommandlineparser.cpp.
Referenced by MythBackendCommandLineParser::LoadArguments(), MythCommFlagCommandLineParser::LoadArguments(), MythMetadataLookupCommandLineParser::LoadArguments(), MythShutdownCommandLineParser::LoadArguments(), and MythUtilCommandLineParser::LoadArguments().
|
private |
Clear out references to other arguments in preparation for deletion.
Definition at line 1136 of file mythcommandlineparser.cpp.
|
private |
Convert stored string value from QByteArray to QString.
This is a work around to delay string processing until after QApplication has been initialized, to allow the locale to be configured and unicode handling to work properly
Definition at line 979 of file mythcommandlineparser.cpp.
Referenced by MythCommandLineParser::toMap(), MythCommandLineParser::toString(), and MythCommandLineParser::toStringList().
| QString CommandLineArg::GetHelpString | ( | int | off, |
| const QString & | group = "", |
||
| bool | force = false |
||
| ) | const |
Return string containing help text with desired offset.
This function returns a string containing all usable keywords and the shortened help text, for use with the general help printout showing all options. It automatically accounts for terminal width, and wraps the text accordingly.
The group option acts as a filter, only returning text if the argument is part of the group the parser is currently printing options for.
Child arguments will not produce help text on their own, but only indented beneath each of the marked parent arguments. The force option specifies that the function is being called by the parent argument, and help should be output.
Definition at line 366 of file mythcommandlineparser.cpp.
| int CommandLineArg::GetKeywordLength | ( | void | ) | const |
Return length of full keyword string for use in determining indent of help text.
Definition at line 340 of file mythcommandlineparser.cpp.
|
private |
Return string containing all possible keyword triggers for this argument.
Definition at line 330 of file mythcommandlineparser.cpp.
Referenced by GetHelpString(), and GetKeywordLength().
| QString CommandLineArg::GetLongHelpString | ( | QString | keyword | ) | const |
Return string containing extended help text.
This function returns a longer version of the help text than that provided with the list of arguments, intended for more detailed, specific information. This also documents the type of argument it takes, default value, and any relational dependencies with other arguments it might have.
Definition at line 445 of file mythcommandlineparser.cpp.
|
inline |
Definition at line 34 of file mythcommandlineparser.h.
Referenced by MythCommandLineParser::Parse().
|
private |
Return the longest keyword for the argument.
This is used to determine which keyword to use when listing relations to other options. The longest keyword is presumed to be the most descriptive.
Definition at line 1043 of file mythcommandlineparser.cpp.
|
inline |
Definition at line 35 of file mythcommandlineparser.h.
|
private |
Internal use.
Print warning for deprecated option.
Definition at line 1263 of file mythcommandlineparser.cpp.
Referenced by GetLongHelpString(), and MythCommandLineParser::Parse().
|
private |
Internal use.
Print warning for removed option.
Definition at line 1247 of file mythcommandlineparser.cpp.
Referenced by GetLongHelpString(), and MythCommandLineParser::Parse().
| void CommandLineArg::PrintVerbose | ( | void | ) | const |
Internal use.
Print processed input in verbose mode.
Definition at line 1157 of file mythcommandlineparser.cpp.
| bool CommandLineArg::Set | ( | const QString & | opt | ) |
Set option as provided on command line with no value.
This specifies that an option is given, but there is no corresponding value, meaning this can only be used on a boolean, integer, and string arguments. All other will return false.
Definition at line 557 of file mythcommandlineparser.cpp.
Referenced by MythCommandLineParser::Parse(), and MythCommandLineParser::SetValue().
| bool CommandLineArg::Set | ( | const QString & | opt, |
| const QByteArray & | val | ||
| ) |
Set option as provided on command line with value.
Definition at line 590 of file mythcommandlineparser.cpp.
|
inline |
Definition at line 43 of file mythcommandlineparser.h.
|
private |
Internal use, set argument as incompatible with given option.
This option is intended for internal use only, as part of reconciling dummy options with their matched real counterparts.
Definition at line 926 of file mythcommandlineparser.cpp.
| CommandLineArg * CommandLineArg::SetBlocks | ( | const QString & | opt | ) |
Set argument as incompatible with given option.
Definition at line 800 of file mythcommandlineparser.cpp.
Referenced by MythCommandLineParser::addLogging(), MythCommandLineParser::addMouse(), MythFillDatabaseCommandLineParser::LoadArguments(), MythFrontendCommandLineParser::LoadArguments(), MythMetadataLookupCommandLineParser::LoadArguments(), MythTVSetupCommandLineParser::LoadArguments(), and SetBlocks().
| CommandLineArg * CommandLineArg::SetBlocks | ( | const QStringList & | opts | ) |
Set argument as incompatible with multiple options.
Definition at line 808 of file mythcommandlineparser.cpp.
| CommandLineArg * CommandLineArg::SetChild | ( | const QString & | opt | ) |
Set argument as parent of given child.
Definition at line 724 of file mythcommandlineparser.cpp.
| CommandLineArg * CommandLineArg::SetChild | ( | const QStringList & | opt | ) |
Set argument as parent of multiple children.
Definition at line 732 of file mythcommandlineparser.cpp.
|
private |
Internal use, set argument as child of given parent.
This option is intended for internal use only, as part of reconciling dummy options with their matched real counterparts.
Definition at line 869 of file mythcommandlineparser.cpp.
| CommandLineArg * CommandLineArg::SetChildOf | ( | const QString & | opt | ) |
Set argument as child of given parent.
Definition at line 707 of file mythcommandlineparser.cpp.
Referenced by MythAVTestCommandLineParser::LoadArguments(), MythMetadataLookupCommandLineParser::LoadArguments(), MythTranscodeCommandLineParser::LoadArguments(), MythUtilCommandLineParser::LoadArguments(), and SetParentOf().
| CommandLineArg * CommandLineArg::SetChildOf | ( | const QStringList & | opts | ) |
Set argument as child of multiple parents.
Definition at line 715 of file mythcommandlineparser.cpp.
| CommandLineArg * CommandLineArg::SetDeprecated | ( | QString | depstr = "" | ) |
Set option as deprecated.
Definition at line 817 of file mythcommandlineparser.cpp.
|
inline |
Definition at line 30 of file mythcommandlineparser.h.
Referenced by MythCommandLineParser::addLogging(), MythCommandLineParser::addMouse(), MythCommandLineParser::addWindowed(), MythCommFlagCommandLineParser::LoadArguments(), MythExternRecorderCommandLineParser::LoadArguments(), MythFileRecorderCommandLineParser::LoadArguments(), MythFillDatabaseCommandLineParser::LoadArguments(), MythFrontendCommandLineParser::LoadArguments(), MythTranscodeCommandLineParser::LoadArguments(), and MythUtilCommandLineParser::LoadArguments().
| CommandLineArg * CommandLineArg::SetParent | ( | const QString & | opt | ) |
Set argument as child of given parent.
Definition at line 690 of file mythcommandlineparser.cpp.
| CommandLineArg * CommandLineArg::SetParent | ( | const QStringList & | opts | ) |
Set argument as child of multiple parents.
Definition at line 698 of file mythcommandlineparser.cpp.
|
private |
Internal use, set argument as parent of given child.
This option is intended for internal use only, as part of reconciling dummy options with their matched real counterparts.
Definition at line 841 of file mythcommandlineparser.cpp.
| CommandLineArg * CommandLineArg::SetParentOf | ( | const QString & | opt | ) |
Set argument as parent of given child.
Definition at line 673 of file mythcommandlineparser.cpp.
Referenced by MythTVSetupCommandLineParser::LoadArguments(), and SetChildOf().
| CommandLineArg * CommandLineArg::SetParentOf | ( | const QStringList & | opts | ) |
Set argument as parent of multiple children.
Definition at line 681 of file mythcommandlineparser.cpp.
| CommandLineArg * CommandLineArg::SetRemoved | ( | QString | remstr = "", |
| QString | remver = "" |
||
| ) |
Set option as removed.
Definition at line 827 of file mythcommandlineparser.cpp.
Referenced by MythCommandLineParser::addLogging(), MythFillDatabaseCommandLineParser::LoadArguments(), MythLCDServerCommandLineParser::LoadArguments(), and MythShutdownCommandLineParser::LoadArguments().
| CommandLineArg * CommandLineArg::SetRequiredChild | ( | const QString & | opt | ) |
Set argument as parent of given child and mark as required.
Definition at line 741 of file mythcommandlineparser.cpp.
Referenced by MythAVTestCommandLineParser::LoadArguments().
| CommandLineArg * CommandLineArg::SetRequiredChild | ( | const QStringList & | opt | ) |
Set argument as parent of multiple children and mark as required.
Definition at line 750 of file mythcommandlineparser.cpp.
| CommandLineArg * CommandLineArg::SetRequiredChildOf | ( | const QString & | opt | ) |
Set argument as child required by given parent.
Definition at line 762 of file mythcommandlineparser.cpp.
Referenced by MythFillDatabaseCommandLineParser::LoadArguments(), and MythUtilCommandLineParser::LoadArguments().
| CommandLineArg * CommandLineArg::SetRequiredChildOf | ( | const QStringList & | opt | ) |
Set argument as child required by multiple parents.
Definition at line 771 of file mythcommandlineparser.cpp.
|
private |
Internal use, set argument as requiring given option.
This option is intended for internal use only, as part of reconciling dummy options with their matched real counterparts.
Definition at line 897 of file mythcommandlineparser.cpp.
| CommandLineArg * CommandLineArg::SetRequires | ( | const QString & | opt | ) |
Set argument as requiring given option.
Definition at line 783 of file mythcommandlineparser.cpp.
Referenced by MythCommandLineParser::addRecording(), MythFillDatabaseCommandLineParser::LoadArguments(), and MythTranscodeCommandLineParser::LoadArguments().
| CommandLineArg * CommandLineArg::SetRequires | ( | const QStringList & | opts | ) |
Set argument as requiring multiple options.
Definition at line 791 of file mythcommandlineparser.cpp.
|
private |
Test all related arguments to make sure specified requirements are fulfilled.
Definition at line 1065 of file mythcommandlineparser.cpp.
|
friend |
Definition at line 73 of file mythcommandlineparser.h.
|
private |
Definition at line 110 of file mythcommandlineparser.h.
Referenced by CleanupLinks(), GetLongHelpString(), SetBlocks(), and TestLinks().
|
private |
Definition at line 107 of file mythcommandlineparser.h.
Referenced by CleanupLinks(), GetHelpString(), GetLongHelpString(), SetChild(), SetParentOf(), and SetRequiredChild().
|
private |
Definition at line 93 of file mythcommandlineparser.h.
Referenced by CommandLineArg(), Convert(), MythCommandLineParser::toMap(), MythCommandLineParser::toString(), and MythCommandLineParser::toStringList().
|
private |
Definition at line 100 of file mythcommandlineparser.h.
Referenced by GetLongHelpString(), MythCommandLineParser::operator[](), Set(), MythCommandLineParser::toBool(), MythCommandLineParser::toDateTime(), MythCommandLineParser::toDouble(), MythCommandLineParser::toInt(), MythCommandLineParser::toLongLong(), MythCommandLineParser::toMap(), MythCommandLineParser::toSize(), MythCommandLineParser::toString(), MythCommandLineParser::toStringList(), and MythCommandLineParser::toUInt().
|
private |
Definition at line 96 of file mythcommandlineparser.h.
Referenced by GetHelpString(), GetLongHelpString(), MythCommandLineParser::Parse(), PrintDeprecatedWarning(), and SetDeprecated().
|
private |
Definition at line 92 of file mythcommandlineparser.h.
Referenced by Convert(), MythCommandLineParser::operator[](), PrintVerbose(), Set(), TestLinks(), MythCommandLineParser::toBool(), MythCommandLineParser::toDateTime(), MythCommandLineParser::toDouble(), MythCommandLineParser::toInt(), MythCommandLineParser::toLongLong(), MythCommandLineParser::toMap(), MythCommandLineParser::toSize(), MythCommandLineParser::toString(), MythCommandLineParser::toStringList(), and MythCommandLineParser::toUInt().
|
private |
Definition at line 95 of file mythcommandlineparser.h.
Referenced by GetHelpString().
|
private |
Definition at line 112 of file mythcommandlineparser.h.
Referenced by GetHelpString(), and GetLongHelpString().
|
private |
Definition at line 103 of file mythcommandlineparser.h.
Referenced by GetKeywordString(), GetLongHelpString(), and GetPreferredKeyword().
|
private |
Definition at line 113 of file mythcommandlineparser.h.
Referenced by GetLongHelpString().
|
private |
Definition at line 94 of file mythcommandlineparser.h.
Referenced by PrintVerbose(), SetBlocks(), SetChildOf(), SetParentOf(), and SetRequires().
|
private |
Definition at line 106 of file mythcommandlineparser.h.
Referenced by CleanupLinks(), GetHelpString(), GetKeywordLength(), GetLongHelpString(), SetChildOf(), SetParent(), SetRequiredChildOf(), and TestLinks().
|
private |
Definition at line 97 of file mythcommandlineparser.h.
Referenced by GetHelpString(), GetLongHelpString(), MythCommandLineParser::Parse(), PrintRemovedWarning(), and SetRemoved().
|
private |
Definition at line 98 of file mythcommandlineparser.h.
Referenced by PrintRemovedWarning(), and SetRemoved().
|
private |
Definition at line 109 of file mythcommandlineparser.h.
Referenced by CleanupLinks(), and SetRequiredChildOf().
|
private |
Definition at line 108 of file mythcommandlineparser.h.
Referenced by CleanupLinks(), GetLongHelpString(), SetRequiredChild(), SetRequires(), and TestLinks().
|
private |
Definition at line 101 of file mythcommandlineparser.h.
Referenced by Convert(), MythCommandLineParser::operator[](), MythCommandLineParser::Parse(), PrintVerbose(), Set(), MythCommandLineParser::toBool(), MythCommandLineParser::toDateTime(), MythCommandLineParser::toDouble(), MythCommandLineParser::toInt(), MythCommandLineParser::toLongLong(), MythCommandLineParser::toMap(), MythCommandLineParser::toSize(), MythCommandLineParser::toString(), MythCommandLineParser::toStringList(), and MythCommandLineParser::toUInt().
|
private |
Definition at line 99 of file mythcommandlineparser.h.
Referenced by CommandLineArg(), Convert(), GetLongHelpString(), PrintVerbose(), Set(), MythCommandLineParser::SetValue(), MythCommandLineParser::toBool(), and MythCommandLineParser::toStringList().
|
private |
Definition at line 104 of file mythcommandlineparser.h.
Referenced by Set(), and TestLinks().