[wpdev-commits] wolfpack/python global.cpp,1.92,1.93
Brought to you by:
rip,
thiagocorrea
|
From: <thi...@us...> - 2003-09-19 20:41:14
|
Update of /cvsroot/wpdev/wolfpack/python
In directory sc8-pr-cvs1:/tmp/cvs-serv12900/python
Modified Files:
global.cpp
Log Message:
reworked Preferences class, nearly complete rewrite.
some fixes, and some cosmetic changes.
Index: global.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/python/global.cpp,v
retrieving revision 1.92
retrieving revision 1.93
diff -C2 -d -r1.92 -r1.93
*** global.cpp 13 Sep 2003 13:08:41 -0000 1.92
--- global.cpp 19 Sep 2003 20:41:08 -0000 1.93
***************
*** 1417,1504 ****
/*!
! Reads a boolean value from wolfpack.xml
! */
static PyObject *wpSettingsGetBool( PyObject* self, PyObject* args )
{
Q_UNUSED(self);
! if( !checkArgStr( 0 ) && !checkArgStr( 1 ) && !checkArgInt( 2 ) )
! {
! PyErr_BadArgument();
return 0;
- }
! return PyInt_FromLong( SrvParams->getBool( getArgStr(0), getArgStr(1), getArgInt(2) ) );
}
/*!
! Writes a boolean value to wolfpack.xml
*/
static PyObject *wpSettingsSetBool( PyObject* self, PyObject* args )
{
Q_UNUSED(self);
! if ( !checkArgStr(0) && !checkArgStr( 1 ) && !checkArgInt( 2 ) )
! {
! PyErr_BadArgument();
! return PyFalse;
! }
! SrvParams->setBool( getArgStr(0), getArgStr(1), getArgInt(2) );
return PyTrue;
}
/*!
! Reads a numeric value from wolfpack.xml
! */
static PyObject *wpSettingsGetNumber( PyObject* self, PyObject* args )
{
Q_UNUSED(self);
! if( !checkArgStr( 0 ) && !checkArgStr( 1 ) && !checkArgInt( 2 ) )
! {
! PyErr_BadArgument();
return 0;
! }
! return PyInt_FromLong( SrvParams->getNumber( getArgStr(0), getArgStr(1), getArgInt(2) ) );
}
/*!
! Writes a boolean value to wolfpack.xml
*/
static PyObject *wpSettingsSetNumber( PyObject* self, PyObject* args )
{
Q_UNUSED(self);
! if ( !checkArgStr(0) && !checkArgStr( 1 ) && !checkArgInt( 2 ) )
! {
! PyErr_BadArgument();
! return PyFalse;
! }
! SrvParams->setNumber( getArgStr(0), getArgStr(1), getArgInt(2) );
return PyTrue;
}
/*!
! Reads a numeric value from wolfpack.xml
! */
static PyObject *wpSettingsGetString( PyObject* self, PyObject* args )
{
Q_UNUSED(self);
! if( !checkArgStr( 0 ) && !checkArgStr( 1 ) && !checkArgStr( 2 ) )
! {
! PyErr_BadArgument();
return 0;
! }
! return PyString_FromString( SrvParams->getString( getArgStr(0), getArgStr(1), getArgStr(2) ) );
}
/*!
! Writes a boolean value to wolfpack.xml
*/
static PyObject *wpSettingsSetString( PyObject* self, PyObject* args )
{
Q_UNUSED(self);
! if ( !checkArgStr(0) && !checkArgStr( 1 ) && !checkArgStr( 2 ) )
! {
! PyErr_BadArgument();
! return PyFalse;
! }
! SrvParams->setString( getArgStr(0), getArgStr(1), getArgStr(2) );
return PyTrue;
}
--- 1417,1520 ----
/*!
! Reads the boolean entry specified by key and group.
! The key is created if it doesn't exist, using the default argument.
! If an error occurs the settings are left unchanged and FALSE is returned;
! otherwise TRUE is returned
! */
static PyObject *wpSettingsGetBool( PyObject* self, PyObject* args )
{
Q_UNUSED(self);
! char *pyGroup, *pyKey, pyDef, create = 0;
! if ( !PyArg_ParseTuple(args, "ssb|b:getBool(group, key, default, create)", &pyGroup, &pyKey, &pyDef, &create ) )
return 0;
! return SrvParams->getBool( pyGroup, pyKey, pyDef, create ) ? PyTrue : PyFalse;
}
/*!
! Writes the boolean entry value into specified key and group.
! The key is created if it doesn't exist. Any previous value is overwritten by value.
! If an error occurs the settings are left unchanged and FALSE is returned;
! otherwise TRUE is returned
*/
static PyObject *wpSettingsSetBool( PyObject* self, PyObject* args )
{
Q_UNUSED(self);
! char *pyGroup, *pyKey, pyValue;
! if ( !PyArg_ParseTuple(args, "ssb:setBool(group, key, value)", &pyGroup, &pyKey, &pyValue ) )
! return 0;
!
! SrvParams->setBool( pyGroup, pyKey, pyValue );
return PyTrue;
}
/*!
! Reads the numeric entry specified by key and group.
! The key is created if it doesn't exist using the default argument, provided
! that \a create argument is true.
! If an error occurs the settings are left unchanged and FALSE is returned;
! otherwise TRUE is returned
! */
static PyObject *wpSettingsGetNumber( PyObject* self, PyObject* args )
{
Q_UNUSED(self);
! char *pyGroup, *pyKey, create = 0;
! int pyDef;
! if ( !PyArg_ParseTuple(args, "ssi|b:getNumber(group, key, default, create)", &pyGroup, &pyKey, &pyDef, &create ) )
return 0;
!
! return PyInt_FromLong( SrvParams->getNumber( pyGroup, pyKey, pyDef, create ) );
}
/*!
! Writes the numeric entry value into specified key and group.
! The key is created if it doesn't exist. Any previous value is overwritten by value.
! If an error occurs the settings are left unchanged and FALSE is returned;
! otherwise TRUE is returned
*/
static PyObject *wpSettingsSetNumber( PyObject* self, PyObject* args )
{
Q_UNUSED(self);
! char *pyGroup, *pyKey;
! int pyValue;
! if ( !PyArg_ParseTuple(args, "ssi:setNumber(group, key, value)", &pyGroup, &pyKey, &pyValue ) )
! return 0;
!
! SrvParams->setNumber( pyGroup, pyKey, pyValue );
return PyTrue;
}
/*!
! getString( group, key, default, create )
! Reads the string entry specified by key and group.
! The key is created if it doesn't exist using the default argument, provided that
! \a create argument is true.
! If an error occurs the settings are left unchanged and FALSE is returned;
! otherwise TRUE is returned
! */
static PyObject *wpSettingsGetString( PyObject* self, PyObject* args )
{
Q_UNUSED(self);
! char *pyGroup, *pyKey, *pyDef, create = 0;
! if ( !PyArg_ParseTuple(args, "sss|b:getString(group, key, default, create)", &pyGroup, &pyKey, &pyDef, &create ) )
return 0;
!
! return PyString_FromString( SrvParams->getString( pyGroup, pyKey, pyDef, create ) );
}
/*!
! Writes the string entry value into specified key and group.
! The key is created if it doesn't exist. Any previous value is overwritten by value.
! If an error occurs the settings are left unchanged and FALSE is returned;
! otherwise TRUE is returned
*/
static PyObject *wpSettingsSetString( PyObject* self, PyObject* args )
{
Q_UNUSED(self);
! char *pyGroup, *pyKey, *pyValue;
! if ( !PyArg_ParseTuple(args, "sss:setString(group, key, value)", &pyGroup, &pyKey, &pyValue ) )
! return 0;
!
! SrvParams->setString( pyGroup, pyKey, pyValue );
return PyTrue;
}
|