You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
pytde/sip/tdecore/tdecmdlineargs.sip

265 lines
7.0 KiB

//
// Copyright 2006 Jim Bublitz <jbublitz@nwinternet.com>
// Earlier copyrights 1998 - 2005 Jim Bublitz and/or Phil Thompson
// may also apply
// Generated by preSip
// module tdecore version KDE 3.5.3
// This software is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License as
// published by the Free Software Foundation; either version 2 of
// the License, or (at your option) any later version.
//
// This software is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public
// License along with this library; see the file COPYING.
// If not, write to the Free Software Foundation, Inc.,
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class TDECmdLineOptions
{
%TypeHeaderCode
#include <tdecmdlineargs.h>
extern char **pyArgvToC(PyObject *argvlist,int *argcp);
extern void updatePyArgv(PyObject *argvlist,int argc,char **argv);
%End
public:
const char* name;
const char* description;
%If ( KDE_3_5_3 - )
// def is a Python keyword - use /PyName=/
//pykwd const char* def;
%End
}; // class TDECmdLineOptions
class TDECmdLineArgs
{
%TypeHeaderCode
#include <tdecmdlineargs.h>
#include <tqapplication.h>
%End
public:
%If ( KDE_3_2_0 - )
static void init (SIP_PYLIST, const char*, const char*, const char*, const char*, bool = 0) [void (int, char**, const char*, const char*, const char*, const char*, bool = 0)];
%MethodCode
//takes _argc | (int) | _argv | (char) | _appname | (char) | programName | (char) | _description | (char) | _version | (char) | noKApp | (bool = 0)
int argc, nargc;
char **argv;
// Convert the list.
if ((argv = pyArgvToC(a0, &argc)) == NULL)
return NULL;
// Create it now the arguments are right.
nargc = argc;
Py_BEGIN_ALLOW_THREADS
TDECmdLineArgs::init (nargc,argv, a1, a2, a3, a4, a5);
Py_END_ALLOW_THREADS
// Now modify the original list.
updatePyArgv (a0, argc, argv);
%End
%End
static void init (SIP_PYLIST, const char*, const char*, const char*, bool = 0) [void (int, char**, const char*, const char*, const char*, bool = 0)];
%MethodCode
//takes _argv | (a Python list of strings which may be modified) | _appname | (char) | _description | (char) | _version | (char) | noKApp | (bool = False)
int argc, nargc;
char **argv;
// Convert the list.
if ((argv = pyArgvToC(a0, &argc)) == NULL)
return NULL;
// Create it now the arguments are right.
nargc = argc;
Py_BEGIN_ALLOW_THREADS
TDECmdLineArgs::init (nargc,argv, a1, a2, a3, a4);
Py_END_ALLOW_THREADS
// Now modify the original list.
updatePyArgv (a0, argc, argv);
%End
static void init (SIP_PYLIST, const TDEAboutData*, bool = 0) [void (int, char**, const TDEAboutData*, bool = 0)];
%MethodCode
//takes _argv | (a Python list of strings which may be modified) | about | (TDEAboutData) | noKApp | (bool = 0)
int argc, nargc; //, iserr = 0;
char **argv;
// Convert the list.
if ((argv = pyArgvToC (a0, &argc)) == NULL)
return NULL;
// Create it now the arguments are right.
nargc = argc;
Py_BEGIN_ALLOW_THREADS
TDECmdLineArgs::init (nargc, argv, a1, a2);
Py_END_ALLOW_THREADS
// Now modify the original list.
updatePyArgv (a0, argc, argv);
%End
static void init (const TDEAboutData*);
static void addCmdLineOptions (SIP_PYLIST, const char* = 0, const char* = 0, const char* = 0) [void (const TDECmdLineOptions*, const char* = 0, const char* = 0, const char* = 0)];
%MethodCode
//takes options | (a Python list of tuples) | name | (char = 0) | id | (char = 0) | afterId | (char = 0)
//doc
// A Pytbon list of tuples (name, description, default) is the first parameter
// instead of a TDECmdLineOptions object (TDECmdLineOptions is not used);
13 years ago
// NULL (or None) parameters to mark the end of the list are not required
//end
int n;
if ((n = PyList_Size (a0)) == 0)
return NULL;
// opts is persistent
TDECmdLineOptions *opts;
Py_BEGIN_ALLOW_THREADS
opts = new TDECmdLineOptions [n + 1];
Py_END_ALLOW_THREADS
int i, tsz;
for (i = 0; i < n; i++)
{
PyObject *tuple;
if ((tuple = PyList_GetItem (a0, i)) != NULL)
{
tsz = PyTuple_Size (tuple);
PyObject *member;
if (tsz == 0)
goto errorExit;
member = PyTuple_GET_ITEM (tuple, 0);
if (PyString_Check (member))
opts [i].name = PyString_AS_STRING (member);
else
goto errorExit;
if (tsz > 1)
{
member = PyTuple_GET_ITEM (tuple, 1);
if PyString_Check (member)
opts [i].description = PyString_AS_STRING (member);
else
goto errorExit;
}
else
opts [i].description = NULL;
if (tsz > 2)
{
member = PyTuple_GET_ITEM (tuple, 2);
if PyString_Check (member)
opts [i].def = PyString_AS_STRING (member);
else
goto errorExit;
}
else
opts [i].def = NULL;
}
else
goto errorExit;
}
// mark the end of the list
opts [n].name = NULL;
opts [n].description = NULL;
opts [n].def = NULL;
Py_BEGIN_ALLOW_THREADS
TDECmdLineArgs::addCmdLineOptions (opts, a1, a2, a3);
Py_END_ALLOW_THREADS
Py_INCREF (Py_None);
return Py_None;
errorExit:
delete opts;
return NULL;
%End
static TDECmdLineArgs* parsedArgs (const char* = 0);
static TQString cwd ();
static const char* appName ();
static void usage (const char* = 0);
static void usage (const TQString&);
static void enable_i18n ();
TQCString getOption (const char*);
%If ( KDE_3_1_4 - )
13 years ago
QCStringList getOptionList (const char*) const;
%End
bool isSet (const char*);
int count ();
const char* arg (int);
KURL url (int);
static KURL makeURL (const char*);
static void setCwd (char*);
void clear ();
%If ( KDE_3_2_0 - )
static void reset ();
static void loadAppArgs (TQDataStream&);
%If ( KDE_3_4_0 - )
static void addTempFileOption ();
static bool isTempFileSet ();
%End
%End
protected:
TDECmdLineArgs (const TDECmdLineOptions*, const char*, const char*);
~TDECmdLineArgs ();
public:
%If ( - KDE_3_1_3 )
TQValueList<TQCString> getOptionList (const char*);
%End
}; // class TDECmdLineArgs