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/tdeio/authinfo.sip

211 lines
4.9 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 tdeio 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.
namespace TDEIO
{
class AuthInfo
{
%TypeHeaderCode
#include <authinfo.h>
%End
public:
AuthInfo ();
AuthInfo (const TDEIO::AuthInfo&);
bool isModified () const;
void setModified (bool);
KURL url;
TQString username;
TQString password;
TQString prompt;
TQString caption;
TQString comment;
TQString commentLabel;
TQString realmValue;
TQString digestInfo;
bool verifyPath;
bool readOnly;
bool keepPassword;
protected:
}; // class AuthInfo
%If ( KDE_3_1_4 - )
//igx TQDataStream& operator << (TQDataStream&, const TDEIO::AuthInfo&);
//igx TQDataStream& operator >> (TQDataStream&, TDEIO::AuthInfo&);
%End
class NetRC
{
%TypeHeaderCode
#include <authinfo.h>
%End
public:
enum LookUpMode
{
exactOnly,
defaultOnly,
presetOnly
};
class AutoLogin
{
public:
TQString type;
TQString machine;
TQString login;
TQString password;
KStringListMap macdef;
}; // class AutoLogin
public:
static TDEIO::NetRC* self ();
bool lookup (const KURL&, TDEIO::NetRC::AutoLogin&, bool = 0, TQString = TQString ::null , int = 6);
void reload ();
protected:
//ig TQString extract (const char*, const char*, int&);
int openf (const TQString&);
%If ( KDE_3_2_0 - )
bool parse (int);
%End
private:
NetRC ();
~NetRC ();
protected:
%If ( - KDE_3_2_0 )
void parse (int);
%End
}; // class NetRC
}; // namespace TDEIO
%MappedType KStringListMap
{
//converts a Python dict of TQString:TQStringList
%TypeHeaderCode
#include <tqmap.h>
typedef TQMap<TQString, TQStringList> KStringListMap;
%End
%ConvertFromTypeCode
// Convert to a Python dict.
if (!sipCpp)
return PyDict_New();
PyObject *dict;
// Create the dictionary.
if ((dict = PyDict_New()) == NULL)
return NULL;
// Get it.
const TQMap<TQString, TQStringList> map = *sipCpp;
TQMap<TQString, TQStringList>::ConstIterator it;
for (it = map.begin (); it != map.end (); ++it)
{
PyObject *sKey = PyBytes_FromString ((const char *)((TQString)it.key ()));
PyObject *sData = sipConvertFromInstance ((void *)&it.data (), sipClass_TQStringList, sipTransferObj);
if ((sKey == NULL) || (sData == NULL) || (PyDict_SetItem (dict, sKey, sData) < 0))
{
Py_XDECREF (sKey);
Py_XDECREF (sData);
Py_DECREF (dict);
return NULL;
}
}
return dict;
%End
%ConvertToTypeCode
if (sipIsErr == NULL)
return PyDict_Check(sipPy);
TQMap<TQString, TQStringList> *map = new TQMap<TQString, TQStringList>;
PyObject *key, *value;
SIP_SSIZE_T pos = 0;
TQString *sKey;
TQStringList *sData;
while (PyDict_Next(sipPy, &pos, &key, &value))
{
int iserr = 0, sKey_state, sData_state;
sKey = (TQString *)sipForceConvertToType(key, sipType_TQString, sipTransferObj, SIP_NOT_NONE, &sKey_state, &iserr);
sData = (TQStringList *)sipForceConvertToType(value, sipType_TQStringList, sipTransferObj, SIP_NOT_NONE, &sData_state, &iserr);
if (iserr)
{
if (sKey)
sipReleaseType(sKey, sipType_TQString, sKey_state);
*sipIsErr = 1;
delete map;
return 0;
}
map->insert (*sKey, *sData);
sipReleaseType(sKey, sipType_TQString, sKey_state);
sipReleaseType(sData, sipType_TQStringList, sData_state);
}
*sipCppPtr = map;
return 1;
%End
};