File indexing completed on 2024-04-21 14:55:31

0001 /* This file is part of the KDE project
0002    Copyright (C) 1999 Waldo Bastian <bastian@kde.org>
0003 
0004    This library is free software; you can redistribute it and/or
0005    modify it under the terms of the GNU Library General Public
0006    License version 2 as published by the Free Software Foundation.
0007 
0008    This library is distributed in the hope that it will be useful,
0009    but WITHOUT ANY WARRANTY; without even the implied warranty of
0010    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0011    Library General Public License for more details.
0012 
0013    You should have received a copy of the GNU Library General Public License
0014    along with this library; see the file COPYING.LIB.  If not, write to
0015    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0016    Boston, MA 02110-1301, USA.
0017 */
0018 
0019 #ifndef KCMDLINEARGS_H
0020 #define KCMDLINEARGS_H
0021 
0022 #include <kdelibs4support_export.h>
0023 
0024 #ifdef KDELIBS4SUPPORT_NO_DEPRECATED_NOISE
0025 #warning "This file is deprecated."
0026 #endif
0027 
0028 #include <klocalizedstring.h>
0029 
0030 template <class T> class QList;
0031 class QString;
0032 class QStringList;
0033 class QByteArray;
0034 class QDataStream;
0035 class QUrl;
0036 
0037 class KCmdLineArgs;
0038 class KCmdLineArgsPrivate;
0039 class KCmdLineArgsStatic;
0040 class KCmdLineOptionsPrivate;
0041 
0042 /**
0043  * @short Class that holds command line options.
0044  *
0045  * This class is intended to be used with the KCmdLineArgs class, which
0046  * provides convenient and powerful command line argument parsing and
0047  * handling functionality.
0048  *
0049  * @see KCmdLineArgs for additional usage information
0050  *
0051  * @deprecated since 5.0, port to QCommandLineParser in QtCore
0052  */
0053 class KDELIBS4SUPPORT_DEPRECATED_EXPORT_NOISE KCmdLineOptions
0054 {
0055     friend class KCmdLineArgs;
0056     friend class KCmdLineArgsStatic;
0057 
0058 public:
0059     /**
0060      * Constructor.
0061      */
0062     KCmdLineOptions();
0063 
0064     /**
0065      * Copy constructor.
0066      */
0067     KCmdLineOptions(const KCmdLineOptions &options);
0068 
0069     /**
0070      * Assignment operator.
0071      */
0072     KCmdLineOptions &operator= (const KCmdLineOptions &options);
0073 
0074     /**
0075      * Destructor.
0076      */
0077     ~KCmdLineOptions();
0078 
0079     /**
0080      * Add command line option, by providing its name, description, and
0081      * possibly a default value. These will print out when <i>myapp --help</i>
0082      * is called on the command line.
0083      *
0084      * Note that a long option can only have one short (single character) alias
0085      *
0086      * @since 4.6 Note that the following does not apply to options that begin
0087      * with "no" and expect a parameter, like "nooption4" in the example below.
0088      *
0089      * Note that if the option name begin with "no" that you will need to test
0090      * for the name without the "no" and the result will be the inverse of what
0091      * is specified. i.e. if "nofoo" is the name of the option and
0092      * <i>myapp --nofoo</i> is called:
0093      *
0094      * @code
0095      * KCmdLineArgs::parsedArgs()->isSet("foo"); // false
0096      * @endcode
0097      *
0098      * Here are some more examples showing various features:
0099      *
0100      * @code
0101      *  KCmdLineOptions options;
0102      *  options.add("a", ki18n("A short binary option"));
0103      *  options.add("b \<file>", ki18n("A short option which takes an argument"));
0104      *  options.add("c \<speed>", ki18n("As above but with a default value"), "9600");
0105      *  options.add("option1", ki18n("A long binary option, off by default"));
0106      *  options.add("nooption2", ki18n("A long binary option, on by default"));
0107      *  options.add(":", ki18n("Extra options:"));
0108      *  options.add("option3 \<file>", ki18n("A long option which takes an argument"));
0109      *  options.add("nooption4 \<speed>", ki18n("A long option which takes an argument, defaulting to 9600"), "9600");
0110      *  options.add("d").add("option5", ki18n("A long option which has a short option as alias"));
0111      *  options.add("e").add("nooption6", ki18n("Another long option with an alias"));
0112      *  options.add("f").add("option7 \<speed>", ki18n("'--option7 speed' is the same as '-f speed'"));
0113      *  options.add("!option8 \<cmd>", ki18n("All options following this one will be treated as arguments"));
0114      *  options.add("+file", ki18n("A required argument 'file'"));
0115      *  options.add("+[arg1]", ki18n("An optional argument 'arg1'"));
0116      *  options.add("!+command", ki18n("A required argument 'command', that can contain multiple words, even starting with '-'"));
0117      *  options.add("", ki18n("Additional help text not associated with any particular option"));
0118      * @endcode
0119      *
0120      * @param name option name
0121      * @param description option description, made available for translation;
0122      *                    can be left off
0123      * @param defaultValue default option value, when the value is not specified
0124      *                     on the command line; can be left off
0125      */
0126     KCmdLineOptions &add(const QByteArray &name,
0127                          const KLocalizedString &description = KLocalizedString(),
0128                          const QByteArray &defaultValue = QByteArray());
0129 
0130     /**
0131      * Add all options from another KCmdLineOptions object.
0132      *
0133      * @param options options to add
0134      */
0135     KCmdLineOptions &add(const KCmdLineOptions &options);
0136 
0137 private:
0138 
0139     KCmdLineOptionsPrivate *d; //krazy:exclude=dpointer (for operator=)
0140 };
0141 
0142 class KCmdLineArgsList;
0143 class KApplication;
0144 class K4AboutData;
0145 
0146 /**
0147  *  @short A class for command-line argument handling.
0148  *
0149  *  KCmdLineArgs provides simple access to the command-line arguments
0150  *  for an application. It takes into account Qt-specific options,
0151  *  KDE-specific options and application specific options.
0152  *
0153  *  This class is used in %main() via the static method
0154  *  init().
0155  *
0156  *  A typical %KDE application using %KCmdLineArgs should look like this:
0157  *
0158  *  @code
0159  *  int main(int argc, char *argv[])
0160  *  {
0161  *     // Initialize command line args
0162  *     KCmdLineArgs::init(argc, argv, appName, programName, version, description);
0163  *
0164  *     // Define the command line options using KCmdLineOptions
0165  *     KCmdLineOptions options;
0166  *     ....
0167  *
0168  *     // Register the supported options
0169  *     KCmdLineArgs::addCmdLineOptions( options );
0170  *
0171  *     // Add options from other components
0172  *     KUniqueApplication::addCmdLineOptions();
0173  *
0174  *     ....
0175  *
0176  *     // Create application object without passing 'argc' and 'argv' again.
0177  *     KUniqueApplication app;
0178  *
0179  *     ....
0180  *
0181  *     // Handle our own options/arguments
0182  *     // A KApplication will usually do this in main but this is not
0183  *     // necessary.
0184  *     // A KUniqueApplication might want to handle it in newInstance().
0185  *
0186  *     KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
0187  *
0188  *     // A binary option (on / off)
0189  *     if (args->isSet("some-option"))
0190  *        ....
0191  *
0192  *     // An option which takes an additional argument
0193  *     QString anotherOptionArg = args->getOption("another-option");
0194  *
0195  *     // Arguments (e.g. files to open)
0196  *     for(int i = 0; i < args->count(); i++) // Counting start at 0!
0197  *     {
0198  *        openFile( args->arg(i));
0199  *        // Or more convenient:
0200  *        // openUrl( args->url(i));
0201  *
0202  *     }
0203  *
0204  *     args->clear(); // Free up some memory.
0205  *     ....
0206  *  }
0207  *  @endcode
0208  *
0209  *  The options that an application supports are configured using the
0210  *  KCmdLineOptions class. An example is shown below:
0211  *
0212  *  @code
0213  *  KCmdLineOptions options;
0214  *  options.add("a", ki18n("A short binary option"));
0215  *  options.add("b \<file>", ki18n("A short option which takes an argument"));
0216  *  options.add("c \<speed>", ki18n("As above but with a default value"), "9600");
0217  *  options.add("option1", ki18n("A long binary option, off by default"));
0218  *  options.add("nooption2", ki18n("A long binary option, on by default"));
0219  *  options.add(":", ki18n("Extra options:"));
0220  *  options.add("option3 \<file>", ki18n("A long option which takes an argument"));
0221  *  options.add("option4 \<speed>", ki18n("A long option which takes an argument, defaulting to 9600"), "9600");
0222  *  options.add("d").add("option5", ki18n("A long option which has a short option as alias"));
0223  *  options.add("e").add("nooption6", ki18n("Another long option with an alias"));
0224  *  options.add("f").add("option7 \<speed>", ki18n("'--option7 speed' is the same as '-f speed'"));
0225  *  options.add("!option8 \<cmd>", ki18n("All options following this one will be treated as arguments"));
0226  *  options.add("+file", ki18n("A required argument 'file'"));
0227  *  options.add("+[arg1]", ki18n("An optional argument 'arg1'"));
0228  *  options.add("!+command", ki18n("A required argument 'command', that can contain multiple words, even starting with '-'"));
0229  *  options.add("", ki18n("Additional help text not associated with any particular option"));
0230  *  @endcode
0231  *
0232  *  The ki18n calls are used for translation instead of the more usual i18n
0233  *  calls, because the translation needs to be delayed until after the
0234  *  message catalogs have been initialized.
0235  *
0236  *  Note that a program should define the options before any arguments.
0237  *
0238  *  When a long option has a short option as an alias, a program should
0239  *  only test for the long option.
0240  *
0241  *  With the above options a command line could look like:
0242  *  @code
0243  *     myapp -a -c 4800 --display localhost:0.0 --nooption5 -d /tmp/file
0244  *  @endcode
0245  *
0246  *  Long binary options can be in the form 'option' and 'nooption'.
0247  *  A command line may contain the same binary option multiple times,
0248  *  the last option determines the outcome:
0249  *  @code
0250  *     myapp --nooption4 --option4 --nooption4
0251  *  @endcode
0252  *  is the same as:
0253  *  @code
0254  *     myapp --nooption4
0255  *  @endcode
0256  *
0257  *  If an option value is provided multiple times, normally only the last
0258  *  value is used:
0259  *  @code
0260  *     myapp -c 1200 -c 2400 -c 4800
0261  *  @endcode
0262  *  is usually the same as:
0263  *  @code
0264  *     myapp -c 4800
0265  *  @endcode
0266  *
0267  *  However, an application can choose to use all values specified as well.
0268  *  As an example of this, consider that you may wish to specify a
0269  *  number of directories to use:
0270  *  @code
0271  *     myapp -I /usr/include -I /opt/kde/include -I /usr/X11/include
0272  *  @endcode
0273  *  When an application does this it should mention this in the description
0274  *  of the option. To access these options, use getOptionList()
0275  *
0276  *  Tips for end-users:
0277  *
0278  *  @li Single char options like "-a -b -c" may be combined into "-abc"
0279  *  @li The option "--foo bar" may also be written "--foo=bar"
0280  *  @li The option "-P lp1" may also be written "-P=lp1" or "-Plp1"
0281  *  @li The option "--foo bar" may also be written "-foo bar"
0282  *
0283  *  @author Waldo Bastian
0284  *  @version 0.0.4
0285  */
0286 class KDELIBS4SUPPORT_DEPRECATED_EXPORT KCmdLineArgs
0287 {
0288     friend class KApplication;
0289     friend class KCmdLineArgsList;
0290     friend class KCmdLineArgsStatic;
0291 public:
0292     // Static functions:
0293 
0294     enum StdCmdLineArg {
0295         CmdLineArgQt = 0x01,
0296         CmdLineArgKDE = 0x02,
0297         CmdLineArgsMask = 0x03,
0298         CmdLineArgNone = 0x00,
0299         Reserved = 0xff
0300     };
0301     Q_DECLARE_FLAGS(StdCmdLineArgs, StdCmdLineArg)
0302     /**
0303      * Initialize class.
0304      *
0305      * This function should be called as the very first thing in
0306      *  your application.
0307      * @param argc As passed to @p main(...).
0308      * @param argv As passed to @p main(...).
0309      * @param appname The untranslated name of your application. This should
0310      *                match with @p argv[0].
0311      * @param catalog Translation catalog name, if empty @p appname will be used.
0312      * @param programName A program name string to be used for display
0313      *        purposes. This string should be marked for translation.
0314      *        Example: ki18n("KEdit")
0315      * @param version A version.
0316      * @param description A short description of what your application is about.
0317      *                    Also marked for translation.
0318      * @param stdargs KDE/Qt or no default parameters
0319      */
0320     static void init(int argc, char **argv,
0321                      const QByteArray &appname,
0322                      const QByteArray &catalog,
0323                      const KLocalizedString &programName,
0324                      const QByteArray &version,
0325                      const KLocalizedString &description = KLocalizedString(),
0326                      StdCmdLineArgs stdargs = StdCmdLineArgs(CmdLineArgQt | CmdLineArgKDE));
0327 
0328     /**
0329      * Initialize class.
0330      *
0331      * This function should be called as the very first thing in
0332      *  your application. It uses K4AboutData to replace some of the
0333      *  arguments that would otherwise be required.
0334      *
0335      * @param _argc As passed to @p main(...).
0336      * @param _argv As passed to @p main(...).
0337      * @param about A K4AboutData object describing your program.
0338      * @param stdargs KDE/Qt or no default parameters
0339      */
0340     static void init(int _argc,
0341                      char **_argv,
0342                      const K4AboutData *about,
0343                      StdCmdLineArgs stdargs = StdCmdLineArgs(CmdLineArgQt | CmdLineArgKDE));
0344     /**
0345      * Initialize Class
0346      *
0347      * This function should be called as the very first thing in your
0348      * application. This method will rarely be used, since it doesn't
0349      * provide any argument parsing. It does provide access to the
0350      * K4AboutData information.
0351      * This method is exactly the same as calling
0352      * init(0,0, const K4AboutData *about, CmdLineArgNone).
0353      *
0354      * @param about the about data.
0355      * @see K4AboutData
0356      */
0357     static void init(const K4AboutData *about);
0358 
0359     /**
0360      * add standard Qt/KDE command-line args
0361      */
0362     static void addStdCmdLineOptions(StdCmdLineArgs stdargs = StdCmdLineArgs(CmdLineArgQt | CmdLineArgKDE));
0363 
0364     /**
0365      * Add options to your application.
0366      *
0367      * You must make sure that all possible options have been added before
0368      * any class uses the command line arguments.
0369      *
0370      * The list of options should look like this:
0371      *
0372      * @code
0373      * KCmdLineOptions options;
0374      * options.add("option1 \<argument>", ki18n("Description 1"), "my_extra_arg");
0375      * options.add("o");
0376      * options.add("option2", ki18n("Description 2"));
0377      * options.add("nooption3", ki18n("Description 3"));
0378      * options.add("+file", ki18n("A required argument 'file'"));
0379      * @endcode
0380      *
0381      * @li "option1" is an option that requires an additional argument,
0382      *     but if one is not provided, it uses "my_extra_arg".
0383      * @li "option2" is an option that can be turned on. The default is off.
0384      * @li "option3" is an option that can be turned off. The default is on.
0385      * @li "o" does not have a description. It is an alias for the option
0386      *     that follows. In this case "option2".
0387      * @li "+file" specifies an argument. The '+' is removed. If your program
0388      *     doesn't specify that it can use arguments your program will abort
0389      *     when an argument is passed to it. Note that the reverse is not
0390      *     true. If required, you must check yourself the number of arguments
0391      *     specified by the user:
0392      *     @code
0393      *       KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
0394      *       if (args->count() == 0) KCmdLineArgs::usage(i18n("No file specified"));
0395      *     @endcode
0396      *
0397      * In BNF:
0398      * @code
0399      * cmd = myapp [options] file
0400      * options = (option)*
0401      * option = --option1 \<argument> |
0402      *          (-o | --option2 | --nooption2) |
0403      *          ( --option3 | --nooption3 )
0404      * @endcode
0405      *
0406      * Instead of "--option3" one may also use "-option3"
0407      *
0408      * Usage examples:
0409      *
0410      * @li "myapp --option1 test"
0411      * @li "myapp" (same as "myapp --option1 my_extra_arg")
0412      * @li "myapp --option2"
0413      * @li "myapp --nooption2" (same as "myapp", since it is off by default)
0414      * @li "myapp -o" (same as "myapp --option2")
0415      * @li "myapp --nooption3"
0416      * @li "myapp --option3 (same as "myapp", since it is on by default)
0417      * @li "myapp --option2 --nooption2" (same as "myapp", because it
0418      *     option2 is off by default, and the last usage applies)
0419      * @li "myapp /tmp/file"
0420      *
0421      * @param options A list of options that your code supplies.
0422      * @param name the name of the option list, as displayed by
0423      *             the help output. Can be empty.
0424      * @param id A name with which these options can be identified, can be empty.
0425      * @param afterId The options are inserted after this set of options, can be empty.
0426      */
0427     static void addCmdLineOptions(const KCmdLineOptions &options,
0428                                   const KLocalizedString &name = KLocalizedString(),
0429                                   const QByteArray &id = QByteArray(),
0430                                   const QByteArray &afterId = QByteArray());
0431 
0432     /**
0433      * Access parsed arguments.
0434      *
0435      * This function returns all command line arguments that your code
0436      * handles. If unknown command-line arguments are encountered the program
0437      * is aborted and usage information is shown.
0438      *
0439      * @param id The name of the options you are interested in, can be empty.
0440      */
0441     static KCmdLineArgs *parsedArgs(const QByteArray &id = QByteArray());
0442 
0443     /**
0444      * Get the CWD (Current Working Directory) associated with the
0445      * current command line arguments.
0446      *
0447      * Typically this is needed in KUniqueApplication::newInstance()
0448      * since the CWD of the process may be different from the CWD
0449      * where the user started a second instance.
0450      * @return the current working directory
0451      **/
0452     static QString cwd();
0453 
0454     /**
0455      * Get the appname according to argv[0].
0456      * @return the name of the application
0457      **/
0458     static QString appName();
0459 
0460     /**
0461      * Print the usage help to stdout and exit.
0462      *
0463      * @param id if empty, print all options. If id is set, only print the
0464      *        option specified by id. The id is the value set by
0465      *        addCmdLineOptions().
0466      **/
0467     static void usage(const QByteArray &id = QByteArray());
0468 
0469     /**
0470      * Print an error to stderr and the usage help to stdout and exit.
0471      * @param error the error to print
0472      **/
0473     static void usageError(const QString &error);
0474 
0475     /**
0476      * Enable i18n to be able to print a translated error message.
0477      *
0478      * N.B.: This function leaks memory, therefore you are expected to exit
0479      * afterwards (e.g., by calling usage()).
0480      **/
0481     static void enable_i18n();
0482 
0483     // Member functions:
0484 
0485     /**
0486      *  Read out a string option.
0487      *
0488      *  The option must have a corresponding KCmdLineOptions entry
0489      *  of the form:
0490      *  @code
0491      *    options.add("option \<argument>", ki18n("Description"), "default");
0492      *  @endcode
0493      *  You cannot test for the presence of an alias - you must always
0494      *  test for the full option.
0495      *
0496      *  @param option The name of the option without '-'.
0497      *
0498      *  @return The value of the option. If the option was not
0499      *          present on the command line the default is returned.
0500      *          If the option was present more than once, the value of the
0501      *          last occurrence is used.
0502      */
0503     QString getOption(const QByteArray &option) const;
0504 
0505     /**
0506      *  Read out all occurrences of a string option.
0507      *
0508      *  The option must have a corresponding KCmdLineOptions entry
0509      *  of the form:
0510      *  @code
0511      *    options.add("option \<argument>", ki18n("Description"), "default");
0512      *  @endcode
0513      *  You cannot test for the presence of an alias - you must always
0514      *  test for the full option.
0515      *
0516      *  @param option The name of the option, without '-' or '-no'.
0517      *
0518      *  @return A list of all option values. If no option was present
0519      *          on the command line, an empty list is returned.
0520      */
0521     QStringList getOptionList(const QByteArray &option) const;
0522 
0523     /**
0524      *  Read out a boolean option or check for the presence of string option.
0525      *
0526      *  @param option The name of the option without '-' or '-no'.
0527      *
0528      *  @return The value of the option. It will be true if the option
0529      *  was specifically turned on in the command line, or if the option
0530      *  is turned on by default (in the KCmdLineOptions list) and was
0531      *  not specifically turned off in the command line. Equivalently,
0532      *  it will be false if the option was specifically turned off in
0533      *  the command line, or if the option is turned off by default (in
0534      *  the KCmdLineOptions list) and was not specifically turned on in
0535      *  the command line.
0536      */
0537     bool isSet(const QByteArray &option) const;
0538 
0539     /**
0540      *  Read the number of arguments that aren't options (but,
0541      *  for example, filenames).
0542      *
0543      *  @return The number of arguments that aren't options
0544      */
0545     int count() const;
0546 
0547     /**
0548      *  Read out an argument.
0549      *
0550      *  @param n The argument to read. 0 is the first argument.
0551      *           count()-1 is the last argument.
0552      *
0553      *  @return n-th argument
0554      */
0555     QString arg(int n) const;
0556 
0557     /**
0558      *  Read out an argument representing a URL.
0559      *
0560      *  The argument can be
0561      *  @li an absolute filename
0562      *  @li a relative filename
0563      *  @li a URL
0564      *
0565      *  @param n The argument to read. 0 is the first argument.
0566      * count()-1 is the last argument.
0567      *
0568      *  @return a URL representing the n'th argument.
0569      */
0570     QUrl url(int n) const;
0571 
0572     /**
0573      * Used by url().
0574      * Made public for apps that don't use KCmdLineArgs
0575      * @param urlArg the argument
0576      * @return the url.
0577      */
0578     static QUrl makeURL(const QByteArray &urlArg);
0579 
0580     /**
0581      * Made public for apps that don't use KCmdLineArgs
0582      * To be done before makeURL, to set the current working
0583      * directory in case makeURL needs it.
0584      * @param cwd the new working directory
0585      */
0586     static void setCwd(const QByteArray &cwd);
0587 
0588     /**
0589      *  Clear all options and arguments.
0590      */
0591     void clear();
0592 
0593     /**
0594      *  Reset all option definitions, i.e. cancel all addCmdLineOptions calls.
0595      *  Note that KApplication's options are removed too, you might want to
0596      *  call KApplication::addCmdLineOptions if you want them back.
0597      *
0598      *  You usually don't want to call this method.
0599      */
0600     static void reset();
0601 
0602     /**
0603      * Load arguments from a stream.
0604      */
0605     static void loadAppArgs(QDataStream &);
0606 
0607     /**
0608      * @internal for KUniqueApplication only:
0609      *
0610      * Save all but the Qt and KDE arguments to a stream.
0611      */
0612     static void saveAppArgs(QDataStream &);
0613 
0614     /**
0615      * Add standard option --tempfile
0616      */
0617     static void addTempFileOption();
0618 
0619     // this avoids having to know the "id" used by addTempFileOption
0620     // but this approach doesn't scale well, we can't have 50 standard options here...
0621     /**
0622      * @return true if --tempfile was set
0623      */
0624     static bool isTempFileSet();
0625 
0626     /**
0627      * Returns the number of arguments returned by qtArgv()
0628      *
0629      * @see qtArgv
0630      */
0631     static int &qtArgc();
0632 
0633     /**
0634      * Returns command line options for consumption by Qt after parsing them in a way that
0635      * is consistent with KDE's general command line handling. In particular this ensures
0636      * that Qt command line options can be specified as either -option or --option and that
0637      * any options specified after '--' will be ignored.
0638      *
0639      * @see qt_argc
0640      */
0641     static char **qtArgv();
0642 
0643     /**
0644      * Returns the list of command-line arguments.
0645      * @since 4.6
0646      */
0647     static QStringList allArguments();
0648 
0649     /**
0650      * Returns the K4AboutData for consumption by KComponentData
0651      */
0652     static const K4AboutData *aboutData();
0653 
0654 protected:
0655     /**
0656      * @internal
0657      *  Constructor.
0658      */
0659     KCmdLineArgs(const KCmdLineOptions &_options, const KLocalizedString &_name,
0660                  const QByteArray &_id);
0661 
0662     /**
0663      *  @internal use only.
0664      *
0665      *  Use clear() if you want to free up some memory.
0666      *
0667      *  Destructor.
0668      */
0669     ~KCmdLineArgs();
0670 
0671 private:
0672 
0673     /**
0674      * @internal for KApplication only
0675      *
0676      * Initialize class.
0677      *
0678      * This function should be called as the very first thing in
0679      *  your application.
0680      * @param argc As passed to @p main(...).
0681      * @param argv As passed to @p main(...).
0682      * @param appname The untranslated name of your application. This should
0683      *                match with @p argv[0].
0684      *
0685      * This function makes KCmdLineArgs ignore all unknown options as well as
0686      * all arguments.
0687      */
0688     static void initIgnore(int _argc, char **_argv, const QByteArray &_appname);
0689 
0690     KCmdLineArgsPrivate *const d;
0691 };
0692 
0693 Q_DECLARE_OPERATORS_FOR_FLAGS(KCmdLineArgs::StdCmdLineArgs)
0694 
0695 #endif
0696