Rename KCmd to avoid conflicts with KDE4

r14.0.x
Timothy Pearson 13 years ago
parent dca4b260f0
commit 5075b3a008

@ -46,7 +46,7 @@ bool CLI::isProperty(const TQString &s)
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
const KCmdLineOptions STANDARD_OPTIONS[] = { const TDECmdLineOptions STANDARD_OPTIONS[] = {
{ "c", 0, 0 }, { "c", 0, 0 },
{ "command <name>", I18N_NOOP("Perform the requested command."), 0 }, { "command <name>", I18N_NOOP("Perform the requested command."), 0 },
{ "command-list", I18N_NOOP("Return the list of recognized commands."), 0 }, { "command-list", I18N_NOOP("Return the list of recognized commands."), 0 },
@ -55,19 +55,19 @@ const KCmdLineOptions STANDARD_OPTIONS[] = {
{ "max-debug", I18N_NOOP("Display all debug messages."), 0 }, { "max-debug", I18N_NOOP("Display all debug messages."), 0 },
{ "lowlevel-debug", I18N_NOOP("Display low level debug messages."), 0 }, { "lowlevel-debug", I18N_NOOP("Display low level debug messages."), 0 },
{ "quiet", I18N_NOOP("Do not display messages."), 0 }, { "quiet", I18N_NOOP("Do not display messages."), 0 },
KCmdLineLastOption TDECmdLineLastOption
}; };
const KCmdLineOptions FORCE_OPTIONS[] = { const TDECmdLineOptions FORCE_OPTIONS[] = {
{ "f", 0, 0 }, { "f", 0, 0 },
{ "force", I18N_NOOP("Overwrite files and answer \"yes\" to questions."), 0 }, { "force", I18N_NOOP("Overwrite files and answer \"yes\" to questions."), 0 },
KCmdLineLastOption TDECmdLineLastOption
}; };
const KCmdLineOptions INTERACTIVE_OPTIONS[] = { const TDECmdLineOptions INTERACTIVE_OPTIONS[] = {
{ "i", 0, 0 }, { "i", 0, 0 },
{ "cli", I18N_NOOP("Interactive mode"), 0 }, { "cli", I18N_NOOP("Interactive mode"), 0 },
KCmdLineLastOption TDECmdLineLastOption
}; };
CLI::OptionList::OptionList(Properties properties) CLI::OptionList::OptionList(Properties properties)
@ -75,7 +75,7 @@ CLI::OptionList::OptionList(Properties properties)
init(properties); init(properties);
} }
CLI::OptionList::OptionList(Properties properties, const KCmdLineOptions *options) CLI::OptionList::OptionList(Properties properties, const TDECmdLineOptions *options)
{ {
init(properties); init(properties);
for (uint i=0; options[i].name; i++) append(options[i]); for (uint i=0; options[i].name; i++) append(options[i]);
@ -131,7 +131,7 @@ void CLI::MainBase::init()
CLI::OptionList CLI::MainBase::optionList(const char *fileDescription) const CLI::OptionList CLI::MainBase::optionList(const char *fileDescription) const
{ {
OptionList list(_properties, OPTIONS); OptionList list(_properties, OPTIONS);
KCmdLineOptions opt; TDECmdLineOptions opt;
for (uint i=0; PROPERTY_DATA[i].name; i++) { for (uint i=0; PROPERTY_DATA[i].name; i++) {
opt.description = 0; opt.description = 0;
opt.def = 0; opt.def = 0;

@ -20,7 +20,7 @@ enum Property { NoProperty = 0, HasForce = 1, HasInteractiveMode = 2 };
TQ_DECLARE_FLAGS(Properties, Property) TQ_DECLARE_FLAGS(Properties, Property)
TQ_DECLARE_OPERATORS_FOR_FLAGS(Properties) TQ_DECLARE_OPERATORS_FOR_FLAGS(Properties)
extern const KCmdLineOptions OPTIONS[]; extern const TDECmdLineOptions OPTIONS[];
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
struct CommandData { struct CommandData {
const char *name; const char *name;
@ -48,7 +48,7 @@ class OptionList : public Piklab::OptionList
{ {
public: public:
OptionList(Properties properties); OptionList(Properties properties);
OptionList(Properties properties, const KCmdLineOptions *options); OptionList(Properties properties, const TDECmdLineOptions *options);
private: private:
void init(Properties properties); void init(Properties properties);

@ -22,16 +22,16 @@ const char * const Piklab::URLS[Nb_UrlTypes] = {
}; };
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
Piklab::OptionList::OptionList(const KCmdLineOptions *options) Piklab::OptionList::OptionList(const TDECmdLineOptions *options)
: _options(0) : _options(0)
{ {
for (uint i=0; options[i].name; i++) append(options[i]); for (uint i=0; options[i].name; i++) append(options[i]);
} }
const KCmdLineOptions *Piklab::OptionList::ptr() const const TDECmdLineOptions *Piklab::OptionList::ptr() const
{ {
delete[] _options; delete[] _options;
_options = new KCmdLineOptions[count()+1]; _options = new TDECmdLineOptions[count()+1];
for (uint i=0; i<uint(count()); i++) { for (uint i=0; i<uint(count()); i++) {
_options[i] = *at(i); _options[i] = *at(i);
Q_ASSERT( _options[i].name ); Q_ASSERT( _options[i].name );
@ -41,7 +41,7 @@ const KCmdLineOptions *Piklab::OptionList::ptr() const
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void Piklab::init(TDEAboutData *about, int argc, char **argv, bool gui, const KCmdLineOptions *options) void Piklab::init(TDEAboutData *about, int argc, char **argv, bool gui, const TDECmdLineOptions *options)
{ {
Q_ASSERT(about); Q_ASSERT(about);
#if defined(NO_KDE) #if defined(NO_KDE)

@ -14,22 +14,22 @@
namespace Piklab namespace Piklab
{ {
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
class OptionList : public TQValueList<KCmdLineOptions> class OptionList : public TQValueList<TDECmdLineOptions>
{ {
public: public:
OptionList() : _options(0) {} OptionList() : _options(0) {}
OptionList(const KCmdLineOptions *options); OptionList(const TDECmdLineOptions *options);
virtual ~OptionList() { delete[] _options; } virtual ~OptionList() { delete[] _options; }
const KCmdLineOptions *ptr() const; const TDECmdLineOptions *ptr() const;
private: private:
mutable KCmdLineOptions *_options; mutable TDECmdLineOptions *_options;
}; };
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
enum UrlType { Homepage = 0, Support, BugReport, Nb_UrlTypes }; enum UrlType { Homepage = 0, Support, BugReport, Nb_UrlTypes };
extern const char * const URLS[Nb_UrlTypes]; extern const char * const URLS[Nb_UrlTypes];
extern void init(TDEAboutData *about, int argc, char **argv, bool gui, const KCmdLineOptions *options); extern void init(TDEAboutData *about, int argc, char **argv, bool gui, const TDECmdLineOptions *options);
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
class AboutData : public TDEAboutData class AboutData : public TDEAboutData

@ -73,14 +73,14 @@
template class TQAsciiDict<TQCString>; template class TQAsciiDict<TQCString>;
template class TQPtrList<TDECmdLineArgs>; template class TQPtrList<TDECmdLineArgs>;
class KCmdLineParsedOptions : public TQAsciiDict<TQCString> class TDECmdLineParsedOptions : public TQAsciiDict<TQCString>
{ {
public: public:
KCmdLineParsedOptions() TDECmdLineParsedOptions()
: TQAsciiDict<TQCString>( 7 ) { } : TQAsciiDict<TQCString>( 7 ) { }
// WABA: Huh? // WABA: Huh?
// The compiler doesn't find KCmdLineParsedOptions::write(s) by itself ??? // The compiler doesn't find TDECmdLineParsedOptions::write(s) by itself ???
// WABA: No, because there is another write function that hides the // WABA: No, because there is another write function that hides the
// write function in the base class even though this function has a // write function in the base class even though this function has a
// different signature. (obscure C++ feature) // different signature. (obscure C++ feature)
@ -108,10 +108,10 @@ protected:
}; };
class KCmdLineParsedArgs : public TQStrList class TDECmdLineParsedArgs : public TQStrList
{ {
public: public:
KCmdLineParsedArgs() TDECmdLineParsedArgs()
: TQStrList( true ) { } : TQStrList( true ) { }
TQDataStream& save( TQDataStream &s) const TQDataStream& save( TQDataStream &s) const
{ return TQGList::write(s); } { return TQGList::write(s); }
@ -220,7 +220,7 @@ const char * TDECmdLineArgs::appName()
} }
void void
TDECmdLineArgs::addCmdLineOptions( const KCmdLineOptions *options, const char *name, TDECmdLineArgs::addCmdLineOptions( const TDECmdLineOptions *options, const char *name,
const char *id, const char *afterId) const char *id, const char *afterId)
{ {
if (!argsList) if (!argsList)
@ -367,7 +367,7 @@ void TDECmdLineArgs::removeArgs(const char *id)
* +4 - no more options follow // !fork * +4 - no more options follow // !fork
*/ */
static int static int
findOption(const KCmdLineOptions *options, TQCString &opt, findOption(const TDECmdLineOptions *options, TQCString &opt,
const char *&opt_name, const char *&def, bool &enabled) const char *&opt_name, const char *&def, bool &enabled)
{ {
int result; int result;
@ -574,7 +574,7 @@ TDECmdLineArgs::parseAllArgs()
TDECmdLineArgs *appOptions = argsList->last(); TDECmdLineArgs *appOptions = argsList->last();
if (!appOptions->id) if (!appOptions->id)
{ {
const KCmdLineOptions *option = appOptions->options; const TDECmdLineOptions *option = appOptions->options;
while(option && option->name) while(option && option->name)
{ {
if (option->name[0] == '+') if (option->name[0] == '+')
@ -823,7 +823,7 @@ TDECmdLineArgs::usage(const char *id)
TDECmdLineArgs *appOptions = argsList->last(); TDECmdLineArgs *appOptions = argsList->last();
if (!appOptions->id) if (!appOptions->id)
{ {
const KCmdLineOptions *option = appOptions->options; const TDECmdLineOptions *option = appOptions->options;
while(option && option->name) while(option && option->name)
{ {
if (option->name[0] == '+') if (option->name[0] == '+')
@ -886,7 +886,7 @@ TDECmdLineArgs::usage(const char *id)
while (args) while (args)
{ {
const KCmdLineOptions *option = args->options; const TDECmdLineOptions *option = args->options;
TQCString opt = ""; TQCString opt = "";
// //
while(option && option->name) while(option && option->name)
@ -1012,7 +1012,7 @@ TDECmdLineArgs::usage(const char *id)
* *
* The given arguments are assumed to be constants. * The given arguments are assumed to be constants.
*/ */
TDECmdLineArgs::TDECmdLineArgs( const KCmdLineOptions *_options, TDECmdLineArgs::TDECmdLineArgs( const TDECmdLineOptions *_options,
const char *_name, const char *_id) const char *_name, const char *_id)
: options(_options), name(_name), id(_id) : options(_options), name(_name), id(_id)
{ {
@ -1071,8 +1071,8 @@ TDECmdLineArgs::save( TQDataStream &ds) const
void void
TDECmdLineArgs::load( TQDataStream &ds) TDECmdLineArgs::load( TQDataStream &ds)
{ {
if (!parsedOptionList) parsedOptionList = new KCmdLineParsedOptions; if (!parsedOptionList) parsedOptionList = new TDECmdLineParsedOptions;
if (!parsedArgList) parsedArgList = new KCmdLineParsedArgs; if (!parsedArgList) parsedArgList = new TDECmdLineParsedArgs;
parsedOptionList->load( ds ); parsedOptionList->load( ds );
parsedArgList->load( ds ); parsedArgList->load( ds );
@ -1102,7 +1102,7 @@ TDECmdLineArgs::setOption(const TQCString &opt, bool enabled)
addArgument(arg); addArgument(arg);
} }
if (!parsedOptionList) { if (!parsedOptionList) {
parsedOptionList = new KCmdLineParsedOptions; parsedOptionList = new TDECmdLineParsedOptions;
parsedOptionList->setAutoDelete(true); parsedOptionList->setAutoDelete(true);
} }
@ -1132,7 +1132,7 @@ TDECmdLineArgs::setOption(const TQCString &opt, const char *value)
#endif #endif
} }
if (!parsedOptionList) { if (!parsedOptionList) {
parsedOptionList = new KCmdLineParsedOptions; parsedOptionList = new TDECmdLineParsedOptions;
parsedOptionList->setAutoDelete(true); parsedOptionList->setAutoDelete(true);
} }
@ -1303,15 +1303,15 @@ void
TDECmdLineArgs::addArgument(const char *argument) TDECmdLineArgs::addArgument(const char *argument)
{ {
if (!parsedArgList) if (!parsedArgList)
parsedArgList = new KCmdLineParsedArgs; parsedArgList = new TDECmdLineParsedArgs;
parsedArgList->append(argument); parsedArgList->append(argument);
} }
static const KCmdLineOptions kde_tempfile_option[] = static const TDECmdLineOptions kde_tempfile_option[] =
{ {
{ "tempfile", I18N_NOOP("The files/URLs opened by the application will be deleted after use"), 0}, { "tempfile", I18N_NOOP("The files/URLs opened by the application will be deleted after use"), 0},
KCmdLineLastOption TDECmdLineLastOption
}; };
void void

@ -48,7 +48,7 @@ typedef TQValueList<TQCString> QCStringList;
* *
* @see TDECmdLineArgs for additional usage information * @see TDECmdLineArgs for additional usage information
*/ */
struct TDECORE_EXPORT KCmdLineOptions struct TDECORE_EXPORT TDECmdLineOptions
{ {
/** /**
* The name of the argument as it should be called on the command line and * The name of the argument as it should be called on the command line and
@ -76,13 +76,13 @@ struct TDECORE_EXPORT KCmdLineOptions
const char *def; // Default const char *def; // Default
}; };
#define KCmdLineLastOption { 0, 0, 0 } #define TDECmdLineLastOption { 0, 0, 0 }
class TDECmdLineArgsList; class TDECmdLineArgsList;
class TDEApplication; class TDEApplication;
class KUniqueApplication; class KUniqueApplication;
class KCmdLineParsedOptions; class TDECmdLineParsedOptions;
class KCmdLineParsedArgs; class TDECmdLineParsedArgs;
class TDEAboutData; class TDEAboutData;
class TDECmdLineArgsPrivate; class TDECmdLineArgsPrivate;
@ -147,10 +147,10 @@ class TDECmdLineArgsPrivate;
* \endcode * \endcode
* *
* The options that an application supports are configured using the * The options that an application supports are configured using the
* KCmdLineOptions class. An example is shown below: * TDECmdLineOptions class. An example is shown below:
* *
* \code * \code
* static const KCmdLineOptions options[] = * static const TDECmdLineOptions options[] =
* { * {
* { "a", I18N_NOOP("A short binary option"), 0 }, * { "a", I18N_NOOP("A short binary option"), 0 },
* { "b \<file>", I18N_NOOP("A short option which takes an argument"), 0 }, * { "b \<file>", I18N_NOOP("A short option which takes an argument"), 0 },
@ -171,7 +171,7 @@ class TDECmdLineArgsPrivate;
* { "+[arg1]", I18N_NOOP("An optional argument 'arg1'"), 0 }, * { "+[arg1]", I18N_NOOP("An optional argument 'arg1'"), 0 },
* { "!+command", I18N_NOOP("A required argument 'command', that can contain multiple words, even starting with '-'"), 0 }, * { "!+command", I18N_NOOP("A required argument 'command', that can contain multiple words, even starting with '-'"), 0 },
* { "", I18N_NOOP("Additional help text not associated with any particular option") 0 }, * { "", I18N_NOOP("Additional help text not associated with any particular option") 0 },
* KCmdLineLastOption // End of options. * TDECmdLineLastOption // End of options.
* }; * };
* \endcode * \endcode
* *
@ -310,13 +310,13 @@ public:
* The list of options should look like this: * The list of options should look like this:
* *
* \code * \code
* static KCmdLineOptions options[] = * static TDECmdLineOptions options[] =
* { * {
* { "option1 \<argument>", I18N_NOOP("Description 1"), "my_extra_arg" }, * { "option1 \<argument>", I18N_NOOP("Description 1"), "my_extra_arg" },
* { "o", 0, 0 }, * { "o", 0, 0 },
* { "option2", I18N_NOOP("Description 2"), 0 }, * { "option2", I18N_NOOP("Description 2"), 0 },
* { "nooption3", I18N_NOOP("Description 3"), 0 }, * { "nooption3", I18N_NOOP("Description 3"), 0 },
* KCmdLineLastOption * TDECmdLineLastOption
* } * }
* \endcode * \endcode
* *
@ -365,7 +365,7 @@ public:
* @param id A name with which these options can be identified, can be 0. * @param id A name with which these options can be identified, can be 0.
* @param afterId The options are inserted after this set of options, can be 0. * @param afterId The options are inserted after this set of options, can be 0.
*/ */
static void addCmdLineOptions( const KCmdLineOptions *options, static void addCmdLineOptions( const TDECmdLineOptions *options,
const char *name=0, const char *id = 0, const char *name=0, const char *id = 0,
const char *afterId=0); const char *afterId=0);
@ -426,7 +426,7 @@ public:
/** /**
* Read out a string option. * Read out a string option.
* *
* The option must have a corresponding KCmdLineOptions entry * The option must have a corresponding TDECmdLineOptions entry
* of the form: * of the form:
* \code * \code
* { "option \<argument>", I18N_NOOP("Description"), "default" } * { "option \<argument>", I18N_NOOP("Description"), "default" }
@ -446,7 +446,7 @@ public:
/** /**
* Read out all occurrences of a string option. * Read out all occurrences of a string option.
* *
* The option must have a corresponding KCmdLineOptions entry * The option must have a corresponding TDECmdLineOptions entry
* of the form: * of the form:
* \code * \code
* { "option \<argument>", I18N_NOOP("Description"), "default" } * { "option \<argument>", I18N_NOOP("Description"), "default" }
@ -468,11 +468,11 @@ public:
* *
* @return The value of the option. It will be true if the option * @return The value of the option. It will be true if the option
* was specifically turned on in the command line, or if the option * was specifically turned on in the command line, or if the option
* is turned on by default (in the KCmdLineOptions list) and was * is turned on by default (in the TDECmdLineOptions list) and was
* not specifically turned off in the command line. Equivalently, * not specifically turned off in the command line. Equivalently,
* it will be false if the option was specifically turned off in * it will be false if the option was specifically turned off in
* the command line, or if the option is turned off by default (in * the command line, or if the option is turned off by default (in
* the KCmdLineOptions list) and was not specifically turned on in * the TDECmdLineOptions list) and was not specifically turned on in
* the command line. * the command line.
*/ */
bool isSet(const char *option) const; bool isSet(const char *option) const;
@ -564,7 +564,7 @@ protected:
* @internal * @internal
* Constructor. * Constructor.
*/ */
TDECmdLineArgs( const KCmdLineOptions *_options, const char *_name, TDECmdLineArgs( const TDECmdLineOptions *_options, const char *_name,
const char *_id); const char *_id);
/** /**
@ -677,11 +677,11 @@ private:
static void printQ(const TQString &msg); static void printQ(const TQString &msg);
const KCmdLineOptions *options; const TDECmdLineOptions *options;
const char *name; const char *name;
const char *id; const char *id;
KCmdLineParsedOptions *parsedOptionList; TDECmdLineParsedOptions *parsedOptionList;
KCmdLineParsedArgs *parsedArgList; TDECmdLineParsedArgs *parsedArgList;
bool isTQt; bool isTQt;
static TDECmdLineArgsList *argsList; // All options. static TDECmdLineArgsList *argsList; // All options.

@ -17,8 +17,8 @@
#include "coff/base/coff_archive.h" #include "coff/base/coff_archive.h"
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
const KCmdLineOptions OPTIONS[] = { const TDECmdLineOptions OPTIONS[] = {
KCmdLineLastOption TDECmdLineLastOption
}; };
const CLI::CommandData CLI::NORMAL_COMMAND_DATA[] = { const CLI::CommandData CLI::NORMAL_COMMAND_DATA[] = {
@ -39,8 +39,8 @@ const CLI::PropertyData CLI::PROPERTY_DATA[] = {
{ 0, 0, 0, 0, 0, 0 } { 0, 0, 0, 0, 0, 0 }
}; };
const KCmdLineOptions CLI::OPTIONS[] = { const TDECmdLineOptions CLI::OPTIONS[] = {
KCmdLineLastOption TDECmdLineLastOption
}; };
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------

@ -17,8 +17,8 @@
#include "common/global/about.h" #include "common/global/about.h"
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
const KCmdLineOptions OPTIONS[] = { const TDECmdLineOptions OPTIONS[] = {
KCmdLineLastOption TDECmdLineLastOption
}; };
const CLI::CommandData CLI::NORMAL_COMMAND_DATA[] = { const CLI::CommandData CLI::NORMAL_COMMAND_DATA[] = {
@ -40,8 +40,8 @@ const CLI::PropertyData CLI::PROPERTY_DATA[] = {
{ 0, 0, 0, 0, 0, 0 } { 0, 0, 0, 0, 0, 0 }
}; };
const KCmdLineOptions CLI::OPTIONS[] = { const TDECmdLineOptions CLI::OPTIONS[] = {
KCmdLineLastOption TDECmdLineLastOption
}; };
const CLI::FillOptions CLI::FILL_OPTIONS[] = { const CLI::FillOptions CLI::FILL_OPTIONS[] = {

@ -52,11 +52,11 @@ const CLI::CommandData CLI::NORMAL_COMMAND_DATA[] = {
{ 0, NoCommandProperty, 0 } { 0, NoCommandProperty, 0 }
}; };
const KCmdLineOptions CLI::OPTIONS[] = { const TDECmdLineOptions CLI::OPTIONS[] = {
{ "r", 0, 0 }, { "r", 0, 0 },
{ "range <name>", I18N_NOOP("Memory range to operate on."), 0 }, { "range <name>", I18N_NOOP("Memory range to operate on."), 0 },
{ "range-list", I18N_NOOP("Return the list of memory ranges."), 0 }, { "range-list", I18N_NOOP("Return the list of memory ranges."), 0 },
KCmdLineLastOption TDECmdLineLastOption
}; };
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------

@ -48,7 +48,7 @@ bool DeviceTest::execute()
Piklab::OptionList DeviceTest::optionList() const Piklab::OptionList DeviceTest::optionList() const
{ {
Piklab::OptionList optionList; Piklab::OptionList optionList;
const KCmdLineOptions OPTION = { "+[device]", "Only check the specified device", 0 }; const TDECmdLineOptions OPTION = { "+[device]", "Only check the specified device", 0 };
optionList.append(OPTION); optionList.append(OPTION);
return optionList; return optionList;
} }

@ -11,7 +11,7 @@
#include "common/global/about.h" #include "common/global/about.h"
#include "libgui/likeback.h" #include "libgui/likeback.h"
const KCmdLineOptions OPTIONS[] = { const TDECmdLineOptions OPTIONS[] = {
{ "+[file]", I18N_NOOP("Optional filenames to be opened upon startup."), 0 }, { "+[file]", I18N_NOOP("Optional filenames to be opened upon startup."), 0 },
{ 0, 0, 0} { 0, 0, 0}
}; };

Loading…
Cancel
Save