Definition for a single command line option. More...
#include <mythcommandlineparser.h>
Public Member Functions | |
| CommandLineArg (QString name, QVariant::Type type, QVariant def, QString help, QString longhelp) | |
| Default constructor for CommandLineArg class. | |
| CommandLineArg (QString name, QVariant::Type type, QVariant def) | |
| Reduced constructor for CommandLineArg class. | |
| CommandLineArg (QString name) | |
| Dummy constructor for CommandLineArg class. | |
| ~CommandLineArg () | |
| CommandLineArg * | SetGroup (QString group) |
| void | AddKeyword (QString keyword) |
| QString | GetName (void) const |
| int | GetKeywordLength (void) const |
| Return length of full keyword string for use in determining indent of help text. | |
| QString | GetHelpString (int off, QString group="", bool force=false) const |
| Return string containing help text with desired offset. | |
| QString | GetLongHelpString (QString keyword) const |
| Return string containing extended help text. | |
| bool | Set (QString opt) |
| Set option as provided on command line with no value. | |
| bool | Set (QString opt, QByteArray val) |
| Set option as provided on command line with value. | |
| void | Set (QVariant val) |
| CommandLineArg * | SetParent (QString opt) |
| Set argument as child of given parent. | |
| CommandLineArg * | SetParent (QStringList opts) |
| Set argument as child of multiple parents. | |
| CommandLineArg * | SetParentOf (QString opt) |
| Set argument as parent of given child. | |
| CommandLineArg * | SetParentOf (QStringList opts) |
| Set argument as parent of multiple children. | |
| CommandLineArg * | SetChild (QString opt) |
| Set argument as parent of given child. | |
| CommandLineArg * | SetChild (QStringList opt) |
| Set argument as parent of multiple children. | |
| CommandLineArg * | SetChildOf (QString opt) |
| Set argument as child of given parent. | |
| CommandLineArg * | SetChildOf (QStringList opts) |
| Set argument as child of multiple parents. | |
| CommandLineArg * | SetRequiredChild (QString opt) |
| Set argument as parent of given child and mark as required. | |
| CommandLineArg * | SetRequiredChild (QStringList opt) |
| Set argument as parent of multiple children and mark as required. | |
| CommandLineArg * | SetRequiredChildOf (QString opt) |
| Set argument as child required by given parent. | |
| CommandLineArg * | SetRequiredChildOf (QStringList opt) |
| Set argument as child required by multiple parents. | |
| CommandLineArg * | SetRequires (QString opt) |
| Set argument as requiring given option. | |
| CommandLineArg * | SetRequires (QStringList opts) |
| Set argument as requiring multiple options. | |
| CommandLineArg * | SetBlocks (QString opt) |
| Set argument as incompatible with given option. | |
| CommandLineArg * | SetBlocks (QStringList opts) |
| Set argument as incompatible with multiple options. | |
| CommandLineArg * | SetDeprecated (QString depstr="") |
| Set option as deprecated. | |
| CommandLineArg * | SetRemoved (QString remstr="", QString remver="") |
| Set option as removed. | |
| void | PrintVerbose (void) const |
| Internal use. | |
Static Public Member Functions | |
| static void | AllowOneOf (QList< CommandLineArg * > args) |
| Mark a list of arguments as mutually exclusive. | |
Private Member Functions | |
| QString | GetKeywordString (void) const |
| Return string containing all possible keyword triggers for this argument. | |
| void | SetParentOf (CommandLineArg *other, bool forward=true) |
| Internal use, set argument as parent of given child. | |
| void | SetChildOf (CommandLineArg *other, bool forward=true) |
| Internal use, set argument as child of given parent. | |
| void | SetRequires (CommandLineArg *other, bool forward=true) |
| Internal use, set argument as requiring given option. | |
| void | SetBlocks (CommandLineArg *other, bool forward=true) |
| Internal use, set argument as incompatible with given option. | |
| void | Convert (void) |
| Convert stored string value from QByteArray to QString. | |
| QString | GetPreferredKeyword (void) const |
| Return the longest keyword for the argument. | |
| bool | TestLinks (void) const |
| Test all related arguments to make sure specified requirements are fulfilled. | |
| void | CleanupLinks (void) |
| Clear out references to other arguments in preparation for deletion. | |
| void | PrintRemovedWarning (QString &keyword) const |
| Internal use. | |
| void | PrintDeprecatedWarning (QString &keyword) const |
| Internal use. | |
Private Attributes | |
| bool | m_given |
| bool | m_converted |
| QString | m_name |
| QString | m_group |
| QString | m_deprecated |
| QString | m_removed |
| QString | m_removedversion |
| QVariant::Type | m_type |
| 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 |
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 18 of file mythcommandlineparser.h.
| CommandLineArg::CommandLineArg | ( | QString | name, | |
| QVariant::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 144 of file mythcommandlineparser.cpp.
Referenced by SetBlocks(), SetChild(), SetChildOf(), SetParent(), SetParentOf(), SetRequiredChild(), SetRequiredChildOf(), and SetRequires().
| CommandLineArg::CommandLineArg | ( | QString | name, | |
| QVariant::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 161 of file mythcommandlineparser.cpp.
| CommandLineArg::CommandLineArg | ( | QString | name | ) |
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 178 of file mythcommandlineparser.cpp.
| CommandLineArg::~CommandLineArg | ( | ) | [inline] |
Definition at line 25 of file mythcommandlineparser.h.
| CommandLineArg* CommandLineArg::SetGroup | ( | QString | group | ) | [inline] |
Definition at line 27 of file mythcommandlineparser.h.
Referenced by MythCommandLineParser::addDisplay(), MythCommandLineParser::addGeometry(), MythCommandLineParser::addLogging(), MythCommandLineParser::addMouse(), MythCommandLineParser::addWindowed(), MythUtilCommandLineParser::LoadArguments(), MythTranscodeCommandLineParser::LoadArguments(), MythFrontendCommandLineParser::LoadArguments(), MythFillDatabaseCommandLineParser::LoadArguments(), MythCommFlagCommandLineParser::LoadArguments(), and MythAVTestCommandLineParser::LoadArguments().
| void CommandLineArg::AddKeyword | ( | QString | keyword | ) | [inline] |
Definition at line 29 of file mythcommandlineparser.h.
Referenced by MythCommandLineParser::add().
| QString CommandLineArg::GetName | ( | void | ) | const [inline] |
Definition at line 31 of file mythcommandlineparser.h.
Referenced by MythCommandLineParser::Parse().
| int CommandLineArg::GetKeywordLength | ( | void | ) | const |
Return length of full keyword string for use in determining indent of help text.
Definition at line 198 of file mythcommandlineparser.cpp.
| QString CommandLineArg::GetHelpString | ( | int | off, | |
| 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 224 of file mythcommandlineparser.cpp.
| 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 283 of file mythcommandlineparser.cpp.
| bool CommandLineArg::Set | ( | 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 386 of file mythcommandlineparser.cpp.
Referenced by MythCommandLineParser::Parse(), and MythCommandLineParser::SetValue().
| bool CommandLineArg::Set | ( | QString | opt, | |
| QByteArray | val | |||
| ) |
Set option as provided on command line with value.
Definition at line 419 of file mythcommandlineparser.cpp.
| void CommandLineArg::Set | ( | QVariant | val | ) | [inline] |
Definition at line 39 of file mythcommandlineparser.h.
| CommandLineArg * CommandLineArg::SetParent | ( | QString | opt | ) |
Set argument as child of given parent.
Definition at line 520 of file mythcommandlineparser.cpp.
| CommandLineArg * CommandLineArg::SetParent | ( | QStringList | opts | ) |
Set argument as child of multiple parents.
Definition at line 528 of file mythcommandlineparser.cpp.
| CommandLineArg * CommandLineArg::SetParentOf | ( | QString | opt | ) |
Set argument as parent of given child.
Definition at line 502 of file mythcommandlineparser.cpp.
Referenced by MythTVSetupCommandLineParser::LoadArguments(), and SetChildOf().
| CommandLineArg * CommandLineArg::SetParentOf | ( | QStringList | opts | ) |
Set argument as parent of multiple children.
Definition at line 510 of file mythcommandlineparser.cpp.
| CommandLineArg * CommandLineArg::SetChild | ( | QString | opt | ) |
Set argument as parent of given child.
Definition at line 556 of file mythcommandlineparser.cpp.
| CommandLineArg * CommandLineArg::SetChild | ( | QStringList | opt | ) |
Set argument as parent of multiple children.
Definition at line 564 of file mythcommandlineparser.cpp.
| CommandLineArg * CommandLineArg::SetChildOf | ( | QString | opt | ) |
Set argument as child of given parent.
Definition at line 538 of file mythcommandlineparser.cpp.
Referenced by MythUtilCommandLineParser::LoadArguments(), MythTranscodeCommandLineParser::LoadArguments(), MythMetadataLookupCommandLineParser::LoadArguments(), MythAVTestCommandLineParser::LoadArguments(), and SetParentOf().
| CommandLineArg * CommandLineArg::SetChildOf | ( | QStringList | opts | ) |
Set argument as child of multiple parents.
Definition at line 546 of file mythcommandlineparser.cpp.
| CommandLineArg * CommandLineArg::SetRequiredChild | ( | QString | opt | ) |
Set argument as parent of given child and mark as required.
Definition at line 574 of file mythcommandlineparser.cpp.
Referenced by MythAVTestCommandLineParser::LoadArguments().
| CommandLineArg * CommandLineArg::SetRequiredChild | ( | QStringList | opt | ) |
Set argument as parent of multiple children and mark as required.
Definition at line 583 of file mythcommandlineparser.cpp.
| CommandLineArg * CommandLineArg::SetRequiredChildOf | ( | QString | opt | ) |
Set argument as child required by given parent.
Definition at line 596 of file mythcommandlineparser.cpp.
Referenced by MythUtilCommandLineParser::LoadArguments(), and MythFillDatabaseCommandLineParser::LoadArguments().
| CommandLineArg * CommandLineArg::SetRequiredChildOf | ( | QStringList | opt | ) |
Set argument as child required by multiple parents.
Definition at line 605 of file mythcommandlineparser.cpp.
| CommandLineArg * CommandLineArg::SetRequires | ( | QString | opt | ) |
Set argument as requiring given option.
Definition at line 618 of file mythcommandlineparser.cpp.
Referenced by MythCommandLineParser::addRecording(), MythTranscodeCommandLineParser::LoadArguments(), and MythFillDatabaseCommandLineParser::LoadArguments().
| CommandLineArg * CommandLineArg::SetRequires | ( | QStringList | opts | ) |
Set argument as requiring multiple options.
Definition at line 626 of file mythcommandlineparser.cpp.
| CommandLineArg * CommandLineArg::SetBlocks | ( | QString | opt | ) |
Set argument as incompatible with given option.
Definition at line 636 of file mythcommandlineparser.cpp.
Referenced by MythCommandLineParser::addMouse(), MythCommandLineParser::addWindowed(), MythTVSetupCommandLineParser::LoadArguments(), MythMetadataLookupCommandLineParser::LoadArguments(), MythFrontendCommandLineParser::LoadArguments(), MythFillDatabaseCommandLineParser::LoadArguments(), and SetBlocks().
| CommandLineArg * CommandLineArg::SetBlocks | ( | QStringList | opts | ) |
Set argument as incompatible with multiple options.
Definition at line 644 of file mythcommandlineparser.cpp.
| CommandLineArg * CommandLineArg::SetDeprecated | ( | QString | depstr = "" |
) |
Set option as deprecated.
Definition at line 654 of file mythcommandlineparser.cpp.
Referenced by MythFillDatabaseCommandLineParser::LoadArguments().
| CommandLineArg * CommandLineArg::SetRemoved | ( | QString | remstr = "", |
|
| QString | remver = "" | |||
| ) |
Set option as removed.
Definition at line 664 of file mythcommandlineparser.cpp.
Referenced by MythCommandLineParser::addLogging(), MythShutdownCommandLineParser::LoadArguments(), MythLCDServerCommandLineParser::LoadArguments(), MythFrontendCommandLineParser::LoadArguments(), MythFillDatabaseCommandLineParser::LoadArguments(), MythCommFlagCommandLineParser::LoadArguments(), and MythBackendCommandLineParser::LoadArguments().
| void CommandLineArg::AllowOneOf | ( | QList< CommandLineArg * > | args | ) | [static] |
Mark a list of arguments as mutually exclusive.
Definition at line 792 of file mythcommandlineparser.cpp.
Referenced by MythUtilCommandLineParser::LoadArguments(), MythShutdownCommandLineParser::LoadArguments(), MythMetadataLookupCommandLineParser::LoadArguments(), MythCommFlagCommandLineParser::LoadArguments(), and MythBackendCommandLineParser::LoadArguments().
| void CommandLineArg::PrintVerbose | ( | void | ) | const |
Internal use.
Print processed input in verbose mode.
Definition at line 990 of file mythcommandlineparser.cpp.
| QString CommandLineArg::GetKeywordString | ( | void | ) | const [private] |
Return string containing all possible keyword triggers for this argument.
Definition at line 188 of file mythcommandlineparser.cpp.
Referenced by GetHelpString(), and GetKeywordLength().
| void CommandLineArg::SetParentOf | ( | CommandLineArg * | other, | |
| bool | forward = true | |||
| ) | [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 678 of file mythcommandlineparser.cpp.
| void CommandLineArg::SetChildOf | ( | CommandLineArg * | other, | |
| bool | forward = true | |||
| ) | [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 707 of file mythcommandlineparser.cpp.
| void CommandLineArg::SetRequires | ( | CommandLineArg * | other, | |
| bool | forward = true | |||
| ) | [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 736 of file mythcommandlineparser.cpp.
| void CommandLineArg::SetBlocks | ( | CommandLineArg * | other, | |
| bool | forward = true | |||
| ) | [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 766 of file mythcommandlineparser.cpp.
| void CommandLineArg::Convert | ( | void | ) | [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 821 of file mythcommandlineparser.cpp.
Referenced by MythCommandLineParser::toMap(), MythCommandLineParser::toString(), and MythCommandLineParser::toStringList().
| QString CommandLineArg::GetPreferredKeyword | ( | void | ) | const [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 879 of file mythcommandlineparser.cpp.
| bool CommandLineArg::TestLinks | ( | void | ) | const [private] |
Test all related arguments to make sure specified requirements are fulfilled.
Definition at line 901 of file mythcommandlineparser.cpp.
| void CommandLineArg::CleanupLinks | ( | void | ) | [private] |
Clear out references to other arguments in preparation for deletion.
Definition at line 969 of file mythcommandlineparser.cpp.
| void CommandLineArg::PrintRemovedWarning | ( | QString & | keyword | ) | const [private] |
Internal use.
Print warning for removed option.
Definition at line 1083 of file mythcommandlineparser.cpp.
Referenced by GetLongHelpString(), and MythCommandLineParser::Parse().
| void CommandLineArg::PrintDeprecatedWarning | ( | QString & | keyword | ) | const [private] |
Internal use.
Print warning for deprecated option.
Definition at line 1099 of file mythcommandlineparser.cpp.
Referenced by GetLongHelpString(), and MythCommandLineParser::Parse().
friend class MythCommandLineParser [friend] |
Definition at line 69 of file mythcommandlineparser.h.
bool CommandLineArg::m_given [private] |
Definition at line 88 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().
bool CommandLineArg::m_converted [private] |
Definition at line 89 of file mythcommandlineparser.h.
Referenced by CommandLineArg(), Convert(), MythCommandLineParser::toMap(), MythCommandLineParser::toString(), and MythCommandLineParser::toStringList().
QString CommandLineArg::m_name [private] |
Definition at line 90 of file mythcommandlineparser.h.
Referenced by PrintVerbose(), SetBlocks(), SetChildOf(), SetParentOf(), and SetRequires().
QString CommandLineArg::m_group [private] |
Definition at line 91 of file mythcommandlineparser.h.
Referenced by GetHelpString().
QString CommandLineArg::m_deprecated [private] |
Definition at line 92 of file mythcommandlineparser.h.
Referenced by GetHelpString(), GetLongHelpString(), MythCommandLineParser::Parse(), PrintDeprecatedWarning(), and SetDeprecated().
QString CommandLineArg::m_removed [private] |
Definition at line 93 of file mythcommandlineparser.h.
Referenced by GetHelpString(), GetLongHelpString(), MythCommandLineParser::Parse(), PrintRemovedWarning(), and SetRemoved().
QString CommandLineArg::m_removedversion [private] |
Definition at line 94 of file mythcommandlineparser.h.
Referenced by PrintRemovedWarning(), and SetRemoved().
QVariant::Type CommandLineArg::m_type [private] |
Definition at line 95 of file mythcommandlineparser.h.
Referenced by CommandLineArg(), Convert(), GetLongHelpString(), PrintVerbose(), Set(), MythCommandLineParser::SetValue(), MythCommandLineParser::toBool(), and MythCommandLineParser::toStringList().
QVariant CommandLineArg::m_default [private] |
Definition at line 96 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().
QVariant CommandLineArg::m_stored [private] |
Definition at line 97 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().
QStringList CommandLineArg::m_keywords [private] |
Definition at line 99 of file mythcommandlineparser.h.
Referenced by GetKeywordString(), GetLongHelpString(), and GetPreferredKeyword().
QString CommandLineArg::m_usedKeyword [private] |
Definition at line 100 of file mythcommandlineparser.h.
Referenced by Set(), and TestLinks().
QList<CommandLineArg*> CommandLineArg::m_parents [private] |
Definition at line 102 of file mythcommandlineparser.h.
Referenced by CleanupLinks(), GetHelpString(), GetKeywordLength(), GetLongHelpString(), SetChildOf(), SetParent(), SetRequiredChildOf(), and TestLinks().
QList<CommandLineArg*> CommandLineArg::m_children [private] |
Definition at line 103 of file mythcommandlineparser.h.
Referenced by CleanupLinks(), GetHelpString(), GetLongHelpString(), SetChild(), SetParentOf(), and SetRequiredChild().
QList<CommandLineArg*> CommandLineArg::m_requires [private] |
Definition at line 104 of file mythcommandlineparser.h.
Referenced by CleanupLinks(), GetLongHelpString(), SetRequiredChild(), SetRequires(), and TestLinks().
QList<CommandLineArg*> CommandLineArg::m_requiredby [private] |
Definition at line 105 of file mythcommandlineparser.h.
Referenced by CleanupLinks(), and SetRequiredChildOf().
QList<CommandLineArg*> CommandLineArg::m_blocks [private] |
Definition at line 106 of file mythcommandlineparser.h.
Referenced by CleanupLinks(), GetLongHelpString(), SetBlocks(), and TestLinks().
QString CommandLineArg::m_help [private] |
Definition at line 108 of file mythcommandlineparser.h.
Referenced by GetHelpString(), and GetLongHelpString().
QString CommandLineArg::m_longhelp [private] |
Definition at line 109 of file mythcommandlineparser.h.
Referenced by GetLongHelpString().
1.6.3