home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / kcmdlineargs.h < prev    next >
Encoding:
C/C++ Source or Header  |  2005-10-10  |  21.1 KB  |  691 lines

  1. /* This file is part of the KDE project
  2.    Copyright (C) 1999 Waldo Bastian <bastian@kde.org>
  3.  
  4.    This library is free software; you can redistribute it and/or
  5.    modify it under the terms of the GNU Library General Public
  6.    License version 2 as published by the Free Software Foundation.
  7.  
  8.    This library is distributed in the hope that it will be useful,
  9.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  10.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  11.    Library General Public License for more details.
  12.  
  13.    You should have received a copy of the GNU Library General Public License
  14.    along with this library; see the file COPYING.LIB.  If not, write to
  15.    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  16.    Boston, MA 02110-1301, USA.
  17. */
  18.  
  19. #ifndef _KCMDLINEARGS_H_
  20. #define _KCMDLINEARGS_H_
  21.  
  22. #include "kdelibs_export.h"
  23. #include <kurl.h>
  24.  
  25. #include <qptrlist.h>
  26. #include <qstring.h>
  27. #include <qvaluelist.h>
  28.  
  29. typedef QValueList<QCString> QCStringList;
  30.  
  31. /**
  32.  * @short Structure that holds command line options.
  33.  *
  34.  * This class is intended to be used with the KCmdLineArgs class, which
  35.  * provides convenient and powerful command line argument parsing and
  36.  * handling functionality.
  37.  *
  38.  * @see KCmdLineArgs for additional usage information
  39.  */
  40. struct KDECORE_EXPORT KCmdLineOptions
  41. {
  42.    /**
  43.     * The name of the argument as it should be called on the command line and
  44.     * appear in <i>myapp --help</i>.
  45.     *
  46.     * Note that if this option starts with "no" that you will need to test for
  47.     * the name without the "no" and the result will be the inverse of what is
  48.     * specified. i.e. if "nofoo" is the name of the option and
  49.     * <i>myapp --nofoo</i> is called:
  50.     *
  51.     * \code
  52.     * KCmdLineArgs::parsedArgs()->isSet("foo"); // false
  53.     * \endcode
  54.     */
  55.    const char *name;
  56.    /**
  57.     * The text description of the option as should appear in
  58.     * <i>myapp --help</i>.  This value should be wrapped with I18N_NOOP().
  59.     */
  60.    const char *description;
  61.    /**
  62.     * The default value for the option, if it is not specified on the
  63.     * command line.
  64.     */
  65.    const char *def; // Default
  66. };
  67.  
  68. #define KCmdLineLastOption { 0, 0, 0 }
  69.  
  70. class KCmdLineArgsList;
  71. class KApplication;
  72. class KUniqueApplication;
  73. class KCmdLineParsedOptions;
  74. class KCmdLineParsedArgs;
  75. class KAboutData;
  76. class KCmdLineArgsPrivate;
  77.  
  78. /**
  79.  *  @short A class for command-line argument handling.
  80.  *
  81.  *  KCmdLineArgs provides simple access to the command-line arguments
  82.  *  for an application. It takes into account Qt-specific options,
  83.  *  KDE-specific options and application specific options.
  84.  *
  85.  *  This class is used in %main() via the static method
  86.  *  init().
  87.  *
  88.  *  A typical %KDE application using %KCmdLineArgs should look like this:
  89.  *
  90.  *  \code
  91.  *  int main(int argc, char *argv[])
  92.  *  {
  93.  *     // Initialize command line args
  94.  *     KCmdLineArgs::init(argc, argv, appName, programName, description, version);
  95.  *
  96.  *     // Tell which options are supported
  97.  *     KCmdLineArgs::addCmdLineOptions( options );
  98.  *
  99.  *     // Add options from other components
  100.  *     KUniqueApplication::addCmdLineOptions();
  101.  *
  102.  *     ....
  103.  *
  104.  *     // Create application object without passing 'argc' and 'argv' again.
  105.  *     KUniqueApplication app;
  106.  *
  107.  *     ....
  108.  *
  109.  *     // Handle our own options/arguments
  110.  *     // A KApplication will usually do this in main but this is not
  111.  *     // necessary.
  112.  *     // A KUniqueApplication might want to handle it in newInstance().
  113.  *
  114.  *     KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
  115.  *
  116.  *     // A binary option (on / off)
  117.  *     if (args->isSet("some-option"))
  118.  *        ....
  119.  *
  120.  *     // An option which takes an additional argument
  121.  *     QCString anotherOptionArg = args->getOption("another-option");
  122.  *
  123.  *     // Arguments (e.g. files to open)
  124.  *     for(int i = 0; i < args->count(); i++) // Counting start at 0!
  125.  *     {
  126.  *        // don't forget to convert to Unicode!
  127.  *        openFile( QFile::decodeName( args->arg(i)));
  128.  *        // Or more convenient:
  129.  *        // openURL( args->url(i));
  130.  *
  131.  *     }
  132.  *
  133.  *     args->clear(); // Free up some memory.
  134.  *     ....
  135.  *  }
  136.  *  \endcode
  137.  *
  138.  *  The options that an application supports are configured using the
  139.  *  KCmdLineOptions class. An example is shown below:
  140.  *
  141.  *  \code
  142.  *  static const KCmdLineOptions options[] =
  143.  *  {
  144.  *     { "a", I18N_NOOP("A short binary option"), 0 },
  145.  *     { "b \<file>", I18N_NOOP("A short option which takes an argument"), 0 },
  146.  *     { "c \<speed>", I18N_NOOP("As above but with a default value"), "9600" },
  147.  *     { "option1", I18N_NOOP("A long binary option, off by default"), 0 },
  148.  *     { "nooption2", I18N_NOOP("A long binary option, on by default"), 0 },
  149.  *     { ":", I18N_NOOP("Extra options:"), 0 },
  150.  *     { "option3 \<file>", I18N_NOOP("A long option which takes an argument"), 0 },
  151.  *     { "option4 \<speed>", I18N_NOOP("A long option which takes an argument, defaulting to 9600"), "9600" },
  152.  *     { "d", 0, 0 },
  153.  *     { "option5", I18N_NOOP("A long option which has a short option as alias"), 0 },
  154.  *     { "e", 0, 0 },
  155.  *     { "nooption6", I18N_NOOP("Another long option with an alias"), 0 },
  156.  *     { "f", 0, 0 },
  157.  *     { "option7 \<speed>", I18N_NOOP("'--option7 speed' is the same as '-f speed'"), 0 },
  158.  *     { "!option8 \<cmd>", I18N_NOOP("All options following this one will be treated as arguments"), 0 },
  159.  *     { "+file", I18N_NOOP("A required argument 'file'"), 0 },
  160.  *     { "+[arg1]", I18N_NOOP("An optional argument 'arg1'"), 0 },
  161.  *     { "!+command", I18N_NOOP("A required argument 'command', that can contain multiple words, even starting with '-'"), 0 },
  162.  *     { "", I18N_NOOP("Additional help text not associated with any particular option") 0 },
  163.  *     KCmdLineLastOption // End of options.
  164.  *  };
  165.  *  \endcode
  166.  *
  167.  *  The I18N_NOOP macro is used to indicate that these strings should be
  168.  *  marked for translation. The actual translation is done by KCmdLineArgs.
  169.  *  You can't use i18n() here because we are setting up a static data
  170.  *  structure and can't do translations at compile time.
  171.  *
  172.  *  Note that a program should define the options before any arguments.
  173.  *
  174.  *  When a long option has a short option as an alias, a program should
  175.  *  only test for the long option.
  176.  *
  177.  *  With the above options a command line could look like:
  178.  *  \code
  179.  *     myapp -a -c 4800 --display localhost:0.0 --nooption5 -d /tmp/file
  180.  *  \endcode
  181.  *
  182.  *  Long binary options can be in the form 'option' and 'nooption'.
  183.  *  A command line may contain the same binary option multiple times,
  184.  *  the last option determines the outcome:
  185.  *  \code
  186.  *     myapp --nooption4 --option4 --nooption4
  187.  *  \endcode
  188.  *  is the same as:
  189.  *  \code
  190.  *     myapp --nooption4
  191.  *  \endcode
  192.  *
  193.  *  If an option value is provided multiple times, normally only the last
  194.  *  value is used:
  195.  *  \code
  196.  *     myapp -c 1200 -c 2400 -c 4800
  197.  *  \endcode
  198.  *  is usually the same as:
  199.  *  \code
  200.  *     myapp -c 4800
  201.  *  \endcode
  202.  *
  203.  *  However, an application can choose to use all values specified as well.
  204.  *  As an example of this, consider that you may wish to specify a
  205.  *  number of directories to use:
  206.  *  \code
  207.  *     myapp -I /usr/include -I /opt/kde/include -I /usr/X11/include
  208.  *  \endcode
  209.  *  When an application does this it should mention this in the description
  210.  *  of the option. To access these options, use getOptionList()
  211.  *
  212.  *  Tips for end-users:
  213.  *
  214.  *  @li Single char options like "-a -b -c" may be combined into "-abc"
  215.  *  @li The option "--foo bar" may also be written "--foo=bar"
  216.  *  @li The option "-P lp1" may also be written "-P=lp1" or "-Plp1"
  217.  *  @li The option "--foo bar" may also be written "-foo bar"
  218.  *
  219.  *  @author Waldo Bastian
  220.  *  @version 0.0.4
  221.  */
  222. class KDECORE_EXPORT KCmdLineArgs
  223. {
  224.   friend class KApplication;
  225.   friend class KUniqueApplication;
  226.   friend class QPtrList<KCmdLineArgs>;
  227. public:
  228.   // Static functions:
  229.  
  230.   /**
  231.    * Initialize class.
  232.    *
  233.    * This function should be called as the very first thing in
  234.    *  your application.
  235.    * @param _argc As passed to @p main(...).
  236.    * @param _argv As passed to @p main(...).
  237.    * @param _appname The untranslated name of your application. This should
  238.    *                match with @p argv[0].
  239.    * @param programName A program name string to be used for display
  240.    *        purposes. This string should be marked for
  241.    *        translation. Example: I18N_NOOP("KEdit")
  242.    * @param _description A short description of what your application is about.
  243.    * @param _version A version.
  244.    * @param noKApp Set this true to not add commandline options for
  245.    *        QApplication / KApplication
  246.    *
  247.    * @since 3.2
  248.    */
  249.    static void init(int _argc, char **_argv, const char *_appname,
  250.                     const char* programName, const char *_description,
  251.                     const char *_version, bool noKApp = false);
  252.    /**
  253.     * @deprecated
  254.     * You should convert any calls to this method to use the one
  255.     * above, by adding in the program name to be used for display
  256.     * purposes. Do not forget to mark it for translation using I18N_NOOP.
  257.     */
  258.   static void init(int _argc, char **_argv,
  259.                    const char *_appname, const char *_description,
  260.                    const char *_version, bool noKApp = false) KDE_DEPRECATED;
  261.  
  262.   /**
  263.    * Initialize class.
  264.    *
  265.    * This function should be called as the very first thing in
  266.    *  your application. It uses KAboutData to replace some of the
  267.    *  arguments that would otherwise be required.
  268.    *
  269.    * @param _argc As passed to @p main(...).
  270.    * @param _argv As passed to @p main(...).
  271.    * @param about A KAboutData object describing your program.
  272.    * @param noKApp Set this true to not add commandline options for
  273.    *        QApplication / KApplication
  274.    */
  275.   static void init(int _argc, char **_argv,
  276.                    const KAboutData *about, bool noKApp = false);
  277.  
  278.   /**
  279.    * Initialize Class
  280.    *
  281.    * This function should be called as the very first thing in your
  282.    * application. This method will rarely be used, since it doesn't
  283.    * provide any argument parsing. It does provide access to the
  284.    * KAboutData information.
  285.    * This method is exactly the same as calling
  286.    * init(0,0, const KAboutData *about, true).
  287.    *
  288.    * @param about the about data.
  289.    * \see KAboutData
  290.    */
  291.   static void init(const KAboutData *about);
  292.  
  293.   /**
  294.    * Add options to your application.
  295.    *
  296.    * You must make sure that all possible options have been added before
  297.    * any class uses the command line arguments.
  298.    *
  299.    * The list of options should look like this:
  300.    *
  301.    * \code
  302.    * static KCmdLineOptions options[] =
  303.    * {
  304.    *    { "option1 \<argument>", I18N_NOOP("Description 1"), "my_extra_arg" },
  305.    *    { "o", 0, 0 },
  306.    *    { "option2", I18N_NOOP("Description 2"), 0 },
  307.    *    { "nooption3", I18N_NOOP("Description 3"), 0 },
  308.    *    KCmdLineLastOption
  309.    * }
  310.    * \endcode
  311.    *
  312.    * @li "option1" is an option that requires an additional argument,
  313.    *     but if one is not provided, it uses "my_extra_arg".
  314.    * @li "option2" is an option that can be turned on. The default is off.
  315.    * @li "option3" is an option that can be turned off. The default is on.
  316.    * @li "o" does not have a description. It is an alias for the option
  317.    *     that follows. In this case "option2".
  318.    * @li "+file" specifies an argument. The '+' is removed. If your program
  319.    *     doesn't specify that it can use arguments your program will abort
  320.    *     when an argument is passed to it. Note that the reverse is not
  321.    *     true. If required, you must check yourself the number of arguments
  322.    *     specified by the user:
  323.    *     \code
  324.    *       KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
  325.    *       if (args->count() == 0) KCmdLineArgs::usage(i18n("No file specified!"));
  326.    *     \endcode
  327.    *
  328.    * In BNF:
  329.    * \code
  330.    * cmd = myapp [options] file
  331.    * options = (option)*
  332.    * option = --option1 \<argument> |
  333.    *          (-o | --option2 | --nooption2) |
  334.    *          ( --option3 | --nooption3 )
  335.    * \endcode
  336.    *
  337.    * Instead of "--option3" one may also use "-option3"
  338.    *
  339.    * Usage examples:
  340.    *
  341.    * @li "myapp --option1 test"
  342.    * @li "myapp" (same as "myapp --option1 my_extra_arg")
  343.    * @li "myapp --option2"
  344.    * @li "myapp --nooption2" (same as "myapp", since it is off by default)
  345.    * @li "myapp -o" (same as "myapp --option2")
  346.    * @li "myapp --nooption3"
  347.    * @li "myapp --option3 (same as "myapp", since it is on by default)
  348.    * @li "myapp --option2 --nooption2" (same as "myapp", because it
  349.    *     option2 is off by default, and the last usage applies)
  350.    * @li "myapp /tmp/file"
  351.    *
  352.    * @param options A list of options that your code supplies.
  353.    * @param name the name of the option, can be 0.
  354.    * @param id A name with which these options can be identified, can be 0.
  355.    * @param afterId The options are inserted after this set of options, can be 0.
  356.    */
  357.   static void addCmdLineOptions( const KCmdLineOptions *options,
  358.                  const char *name=0, const char *id = 0,
  359.                  const char *afterId=0);
  360.  
  361.   /**
  362.    * Access parsed arguments.
  363.    *
  364.    * This function returns all command line arguments that your code
  365.    * handles. If unknown command-line arguments are encountered the program
  366.    * is aborted and usage information is shown.
  367.    *
  368.    * @param id The name of the options you are interested in, can be 0.
  369.    */
  370.   static KCmdLineArgs *parsedArgs(const char *id=0);
  371.  
  372.   /**
  373.    * Get the CWD (Current Working Directory) associated with the
  374.    * current command line arguments.
  375.    *
  376.    * Typically this is needed in KUniqueApplication::newInstance()
  377.    * since the CWD of the process may be different from the CWD
  378.    * where the user started a second instance.
  379.    * @return the current working directory
  380.    **/
  381.   static QString cwd();
  382.  
  383.   /**
  384.    * Get the appname according to argv[0].
  385.    * @return the name of the application
  386.    **/
  387.   static const char *appName();
  388.  
  389.   /**
  390.    * Print the usage help to stdout and exit.
  391.    *
  392.    * @param id if 0, print all options. If id is set, only print the
  393.    *        option specified by id. The id is the value set by
  394.    *        addCmdLineOptions().
  395.    **/
  396.   static void usage(const char *id = 0);
  397.  
  398.   /**
  399.    * Print an error to stderr and the usage help to stdout and exit.
  400.    * @param error the error to print
  401.    **/
  402.   static void usage(const QString &error);
  403.  
  404.   /**
  405.    * Enable i18n to be able to print a translated error message.
  406.    *
  407.    * N.B.: This function leaks memory, therefore you are expected to exit
  408.    * afterwards (e.g., by calling usage()).
  409.    **/
  410.   static void enable_i18n();
  411.  
  412.   // Member functions:
  413.  
  414.  
  415.   /**
  416.    *  Read out a string option.
  417.    *
  418.    *  The option must have a corresponding KCmdLineOptions entry
  419.    *  of the form:
  420.    *  \code
  421.    *    { "option \<argument>", I18N_NOOP("Description"), "default" }
  422.    *  \endcode
  423.    *  You cannot test for the presence of an alias - you must always
  424.    *  test for the full option.
  425.    *
  426.    *  @param option The name of the option without '-'.
  427.    *
  428.    *  @return The value of the option. If the option was not
  429.    *          present on the command line the default is returned.
  430.    *          If the option was present more than the value of the
  431.    *          last occurrence is used.
  432.    */
  433.   QCString getOption(const char *option) const;
  434.  
  435.   /**
  436.    *  Read out all occurrences of a string option.
  437.    *
  438.    *  The option must have a corresponding KCmdLineOptions entry
  439.    *  of the form:
  440.    *  \code
  441.    *    { "option \<argument>", I18N_NOOP("Description"), "default" }
  442.    *  \endcode
  443.    *  You cannot test for the presence of an alias - you must always
  444.    *  test for the full option.
  445.    *
  446.    *  @param option The name of the option, without '-' or '-no'.
  447.    *
  448.    *  @return A list of all option values. If no option was present
  449.    *          on the command line, an empty list is returned.
  450.    */
  451.   QCStringList getOptionList(const char *option) const;
  452.  
  453.   /**
  454.    *  Read out a boolean option or check for the presence of string option.
  455.    *
  456.    *  @param option The name of the option without '-' or '-no'.
  457.    *
  458.    *  @return The value of the option. It will be true if the option
  459.    *  was specifically turned on in the command line, or if the option
  460.    *  is turned on by default (in the KCmdLineOptions list) and was
  461.    *  not specifically turned off in the command line. Equivalently,
  462.    *  it will be false if the option was specifically turned off in
  463.    *  the command line, or if the option is turned off by default (in
  464.    *  the KCmdLineOptions list) and was not specifically turned on in
  465.    *  the command line.
  466.    */
  467.   bool isSet(const char *option) const;
  468.  
  469.   /**
  470.    *  Read the number of arguments that aren't options (but,
  471.    *  for example, filenames).
  472.    *
  473.    *  @return The number of arguments that aren't options
  474.    */
  475.   int count() const;
  476.  
  477.   /**
  478.    *  Read out an argument.
  479.    *
  480.    *  @param n The argument to read. 0 is the first argument.
  481.    * count()-1 is the last argument.
  482.    *
  483.    *  @return A @p const @p char @p * pointer to the n'th argument.
  484.    */
  485.   const char *arg(int n) const;
  486.  
  487.   /**
  488.    *  Read out an argument representing a URL.
  489.    *
  490.    *  The argument can be
  491.    *  @li an absolute filename
  492.    *  @li a relative filename
  493.    *  @li a URL
  494.    *
  495.    *  @param n The argument to read. 0 is the first argument.
  496.    * count()-1 is the last argument.
  497.    *
  498.    *  @return a URL representing the n'th argument.
  499.    */
  500.   KURL url(int n) const;
  501.  
  502.   /**
  503.    * Used by url().
  504.    * Made public for apps that don't use KCmdLineArgs
  505.    * @param urlArg the argument
  506.    * @return the url.
  507.    */
  508.   static KURL makeURL( const char * urlArg );
  509.  
  510.   /**
  511.    * Made public for apps that don't use KCmdLineArgs
  512.    * To be done before makeURL, to set the current working
  513.    * directory in case makeURL needs it.
  514.    * @param cwd the new working directory
  515.    */
  516.   static void setCwd( char * cwd ) { mCwd = cwd; }
  517.  
  518.   /**
  519.    *  Clear all options and arguments.
  520.    */
  521.   void clear();
  522.  
  523.   /**
  524.    *  Reset all option definitions, i.e. cancel all addCmdLineOptions calls.
  525.    *  Note that KApplication's options are removed too, you might want to
  526.    *  call KApplication::addCmdLineOptions if you want them back.
  527.    *
  528.    *  You usually don't want to call this method.
  529.    */
  530.   static void reset();
  531.  
  532.   /**
  533.    * Load arguments from a stream.
  534.    */
  535.   static void loadAppArgs( QDataStream &);
  536.  
  537.   /**
  538.    * Add standard option --tempfile
  539.    * @since 3.4
  540.    */
  541.   static void addTempFileOption();
  542.  
  543.   // this avoids having to know the "id" used by addTempFileOption
  544.   // but this approach doesn't scale well, we can't have 50 standard options here...
  545.   /**
  546.    * @return true if --tempfile was set
  547.    * @since 3.4
  548.    */
  549.   static bool isTempFileSet();
  550.  
  551. protected:
  552.   /**
  553.    * @internal
  554.    *  Constructor.
  555.    */
  556.   KCmdLineArgs( const KCmdLineOptions *_options, const char *_name,
  557.                 const char *_id);
  558.  
  559.   /**
  560.    *  @internal use only.
  561.    *
  562.    *  Use clear() if you want to free up some memory.
  563.    *
  564.    *  Destructor.
  565.    */
  566.   ~KCmdLineArgs();
  567.  
  568. private:
  569.   /**
  570.    * @internal
  571.    *
  572.    * Checks what to do with a single option
  573.    */
  574.   static void findOption(const char *_opt, QCString opt, int &i, bool enabled, bool &moreOptions);
  575.  
  576.   /**
  577.    * @internal
  578.    *
  579.    * Parse all arguments, verify correct syntax and put all arguments
  580.    * where they belong.
  581.    */
  582.   static void parseAllArgs();
  583.  
  584.   /**
  585.    * @internal for KApplication only:
  586.    *
  587.    * Return argc
  588.    */
  589.   static int *qt_argc();
  590.  
  591.   /**
  592.    * @internal for KApplication only:
  593.    *
  594.    * Return argv
  595.    */
  596.  
  597.   static char ***qt_argv();
  598.  
  599.   /**
  600.    * @internal
  601.    *
  602.    * Remove named options.
  603.    *
  604.    * @param id The name of the options to be removed.
  605.    */
  606.   static void removeArgs(const char *id);
  607.  
  608.   /**
  609.    * @internal for KUniqueApplication only:
  610.    *
  611.    * Save all but the Qt and KDE arguments to a stream.
  612.    */
  613.   static void saveAppArgs( QDataStream &);
  614.  
  615.   /**
  616.    * @internal
  617.    *
  618.    *  Set a boolean option
  619.    */
  620.   void setOption(const QCString &option, bool enabled);
  621.  
  622.   /**
  623.    * @internal
  624.    *
  625.    *  Set a string option
  626.    */
  627.   void setOption(const QCString &option, const char *value);
  628.  
  629.   /**
  630.    * @internal
  631.    *
  632.    * Add an argument
  633.    */
  634.   void addArgument(const char *argument);
  635.  
  636.   /**
  637.    * @internal
  638.    *
  639.    * Save to a stream.
  640.    */
  641.   void save( QDataStream &) const;
  642.  
  643.   /**
  644.    * @internal
  645.    *
  646.    * Restore from a stream.
  647.    */
  648.   void load( QDataStream &);
  649.  
  650.   /**
  651.    * @internal for KApplication only
  652.    *
  653.    * Initialize class.
  654.    *
  655.    * This function should be called as the very first thing in
  656.    *  your application.
  657.    * @param argc As passed to @p main(...).
  658.    * @param argv As passed to @p main(...).
  659.    * @param appname The untranslated name of your application. This should
  660.    *                match with @p argv[0].
  661.    *
  662.    * This function makes KCmdLineArgs ignore all unknown options as well as
  663.    * all arguments.
  664.    */
  665.   static void initIgnore(int _argc, char **_argv, const char *_appname);
  666.  
  667.   static void printQ(const QString &msg);
  668.  
  669.   const KCmdLineOptions *options;
  670.   const char *name;
  671.   const char *id;
  672.   KCmdLineParsedOptions *parsedOptionList;
  673.   KCmdLineParsedArgs *parsedArgList;
  674.   bool isQt;
  675.  
  676.   static KCmdLineArgsList *argsList; // All options.
  677.   static const KAboutData *about;
  678.  
  679.   static int argc; // The original argc
  680.   static char **argv; // The original argv
  681.   static bool parsed; // Whether we have parsed the arguments since calling init
  682.   static bool ignoreUnknown; // Ignore unknown options and arguments
  683.   static char *mCwd; // Current working directory. Important for KUnqiueApp!
  684.   static bool parseArgs;
  685.  
  686.   KCmdLineArgsPrivate *d;
  687. };
  688.  
  689. #endif
  690.  
  691.