kcmdlineargs.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
#ifndef _KCMDLINEARGS_H_
00020
#define _KCMDLINEARGS_H_
00021
00022
#include "kdemacros.h"
00023
#include <kurl.h>
00024
00025
#include <qptrlist.h>
00026
#include <qstring.h>
00027
#include <qvaluelist.h>
00028
00029
typedef QValueList<QCString> QCStringList;
00030
00040 struct KCmdLineOptions
00041 {
00055 const char *
name;
00060 const char *
description;
00065 const char *
def;
00066 };
00067
00068
#define KCmdLineLastOption { 0, 0, 0 }
00069
00070
class KCmdLineArgsList;
00071
class KApplication;
00072
class KUniqueApplication;
00073
class KCmdLineParsedOptions;
00074
class KCmdLineParsedArgs;
00075
class KAboutData;
00076
class KCmdLineArgsPrivate;
00077
00222 class KCmdLineArgs
00223 {
00224
friend class KApplication;
00225
friend class KUniqueApplication;
00226
friend class QPtrList<KCmdLineArgs>;
00227
public:
00228
00229
00247
static void init(
int _argc,
char **_argv,
const char *_appname,
00248
const char* programName,
const char *_description,
00249
const char *_version,
bool noKApp =
false);
00256
static void init(
int _argc,
char **_argv,
00257
const char *_appname,
const char *_description,
00258
const char *_version,
bool noKApp =
false) KDE_DEPRECATED;
00259
00273
static void init(
int _argc,
char **_argv,
00274
const KAboutData *about,
bool noKApp =
false);
00275
00289
static void init(
const KAboutData *about);
00290
00355
static void addCmdLineOptions(
const KCmdLineOptions *options,
00356
const char *name=0,
const char *
id = 0,
00357
const char *afterId=0);
00358
00368
static KCmdLineArgs *
parsedArgs(
const char *
id=0);
00369
00379
static QString cwd();
00380
00385
static const char *
appName();
00386
00394
static void usage(
const char *
id = 0);
00395
00400
static void usage(
const QString &error);
00401
00408
static void enable_i18n();
00409
00410
00411
00412
00431
QCString getOption(
const char *option)
const;
00432
00449 QCStringList
getOptionList(
const char *option)
const;
00450
00465
bool isSet(
const char *option)
const;
00466
00473
int count()
const;
00474
00483
const char *
arg(
int n)
const;
00484
00498
KURL url(
int n)
const;
00499
00506
static KURL makeURL(
const char * urlArg );
00507
00514 static void setCwd(
char * cwd ) { mCwd = cwd; }
00515
00519
void clear();
00520
00528
static void reset();
00529
00533
static void loadAppArgs(
QDataStream &);
00534
00535
protected:
00540
KCmdLineArgs(
const KCmdLineOptions *_options,
const char *_name,
00541
const char *_id);
00542
00550
~KCmdLineArgs();
00551
00552
private:
00558
static void findOption(
const char *_opt,
QCString opt,
int &i,
bool enabled,
bool &moreOptions);
00559
00566
static void parseAllArgs();
00567
00573
static int *qt_argc();
00574
00581
static char ***qt_argv();
00582
00590
static void removeArgs(
const char *
id);
00591
00597
static void saveAppArgs(
QDataStream &);
00598
00604
void setOption(
const QCString &option,
bool enabled);
00605
00611
void setOption(
const QCString &option,
const char *value);
00612
00618
void addArgument(
const char *argument);
00619
00625
void save(
QDataStream &) const;
00626
00632
void load(
QDataStream &);
00633
00649 static
void initIgnore(
int _argc,
char **_argv, const
char *_appname);
00650
00651 static
void printQ(const
QString &msg);
00652
00653 const
KCmdLineOptions *options;
00654 const
char *name;
00655 const
char *
id;
00656 KCmdLineParsedOptions *parsedOptionList;
00657 KCmdLineParsedArgs *parsedArgList;
00658
bool isQt;
00659
00660 static KCmdLineArgsList *argsList;
00661 static const
KAboutData *about;
00662
00663 static
int argc;
00664 static
char **argv;
00665 static
bool parsed;
00666 static
bool ignoreUnknown;
00667 static
char *mCwd;
00668 static
bool parseArgs;
00669
00670 KCmdLineArgsPrivate *d;
00671 };
00672
00673 #endif
00674
This file is part of the documentation for kdecore Library Version 3.2.3.