KCmdLineOptions
#include <kcmdlineargs.h>
Public Member Functions | |
KCmdLineOptions () | |
KCmdLineOptions (const KCmdLineOptions &options) | |
~KCmdLineOptions () | |
KCmdLineOptions & | add (const KCmdLineOptions &options) |
KCmdLineOptions & | add (const QByteArray &name, const KLocalizedString &description=KLocalizedString(), const QByteArray &defaultValue=QByteArray()) |
KCmdLineOptions & | operator= (const KCmdLineOptions &options) |
Detailed Description
Class that holds command line options.
This class is intended to be used with the KCmdLineArgs class, which provides convenient and powerful command line argument parsing and handling functionality.
- See also
- KCmdLineArgs for additional usage information
- Deprecated:
- since 5.0, port to QCommandLineParser in QtCore
Definition at line 53 of file kcmdlineargs.h.
Constructor & Destructor Documentation
◆ KCmdLineOptions() [1/2]
KCmdLineOptions::KCmdLineOptions | ( | ) |
Constructor.
Definition at line 116 of file kcmdlineargs.cpp.
◆ KCmdLineOptions() [2/2]
KCmdLineOptions::KCmdLineOptions | ( | const KCmdLineOptions & | options | ) |
Copy constructor.
Definition at line 125 of file kcmdlineargs.cpp.
◆ ~KCmdLineOptions()
KCmdLineOptions::~KCmdLineOptions | ( | ) |
Destructor.
Definition at line 120 of file kcmdlineargs.cpp.
Member Function Documentation
◆ add() [1/2]
KCmdLineOptions & KCmdLineOptions::add | ( | const KCmdLineOptions & | options | ) |
Add all options from another KCmdLineOptions object.
- Parameters
-
options options to add
Definition at line 148 of file kcmdlineargs.cpp.
◆ add() [2/2]
KCmdLineOptions & KCmdLineOptions::add | ( | const QByteArray & | name, |
const KLocalizedString & | description = KLocalizedString() , |
||
const QByteArray & | defaultValue = QByteArray() |
||
) |
Add command line option, by providing its name, description, and possibly a default value.
These will print out when myapp –help is called on the command line.
Note that a long option can only have one short (single character) alias
- Since
- 4.6 Note that the following does not apply to options that begin with "no" and expect a parameter, like "nooption4" in the example below.
Note that if the option name begin with "no" that you will need to test for the name without the "no" and the result will be the inverse of what is specified. i.e. if "nofoo" is the name of the option and myapp –nofoo is called:
Here are some more examples showing various features:
- Parameters
-
name option name description option description, made available for translation; can be left off defaultValue default option value, when the value is not specified on the command line; can be left off
Definition at line 138 of file kcmdlineargs.cpp.
◆ operator=()
KCmdLineOptions & KCmdLineOptions::operator= | ( | const KCmdLineOptions & | options | ) |
Assignment operator.
Definition at line 130 of file kcmdlineargs.cpp.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2023 The KDE developers.
Generated on Sat Sep 30 2023 03:56:38 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.