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.
715 lines
15 KiB
715 lines
15 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.
|
|
|
|
%ModuleHeaderCode
|
|
#include <tdeio/global.h>
|
|
%End
|
|
|
|
namespace TDEIO
|
|
{
|
|
typedef long long fileoffset_t;
|
|
typedef unsigned long long filesize_t;
|
|
TQString convertSize (TDEIO::filesize_t);
|
|
|
|
%If ( KDE_3_5_0 - )
|
|
TQString convertSizeWithBytes (TDEIO::filesize_t);
|
|
%End
|
|
|
|
TQString number (TDEIO::filesize_t);
|
|
TQString convertSizeFromKB (TDEIO::filesize_t);
|
|
|
|
%If ( KDE_3_4_0 - )
|
|
uint calculateRemainingSeconds (TDEIO::filesize_t, TDEIO::filesize_t, TDEIO::filesize_t);
|
|
TQString convertSeconds (uint);
|
|
%End
|
|
|
|
TQTime calculateRemaining (TDEIO::filesize_t, TDEIO::filesize_t, TDEIO::filesize_t);
|
|
TQString itemsSummaryString (uint, uint, uint, TDEIO::filesize_t, bool);
|
|
TQString encodeFileName (const TQString&);
|
|
TQString decodeFileName (const TQString&);
|
|
|
|
%If ( KDE_3_2_0 - )
|
|
|
|
enum Command
|
|
{
|
|
CMD_HOST,
|
|
CMD_CONNECT,
|
|
CMD_DISCONNECT,
|
|
CMD_SLAVE_STATUS,
|
|
CMD_SLAVE_CONNECT,
|
|
CMD_SLAVE_HOLD,
|
|
CMD_NONE,
|
|
CMD_TESTDIR,
|
|
CMD_GET,
|
|
CMD_PUT,
|
|
CMD_STAT,
|
|
CMD_MIMETYPE,
|
|
CMD_LISTDIR,
|
|
CMD_MKDIR,
|
|
CMD_RENAME,
|
|
CMD_COPY,
|
|
CMD_DEL,
|
|
CMD_CHMOD,
|
|
CMD_SPECIAL,
|
|
CMD_USERPASS,
|
|
CMD_REPARSECONFIGURATION,
|
|
CMD_META_DATA,
|
|
CMD_SYMLINK,
|
|
CMD_SUBURL,
|
|
CMD_MESSAGEBOXANSWER,
|
|
CMD_RESUMEANSWER,
|
|
CMD_CONFIG,
|
|
CMD_MULTI_GET
|
|
};
|
|
|
|
%End
|
|
|
|
|
|
%If ( KDE_3_1_0 - )
|
|
|
|
enum Error
|
|
{
|
|
ERR_CANNOT_OPEN_FOR_READING,
|
|
ERR_CANNOT_OPEN_FOR_WRITING,
|
|
ERR_CANNOT_LAUNCH_PROCESS,
|
|
ERR_INTERNAL,
|
|
ERR_MALFORMED_URL,
|
|
ERR_UNSUPPORTED_PROTOCOL,
|
|
ERR_NO_SOURCE_PROTOCOL,
|
|
ERR_UNSUPPORTED_ACTION,
|
|
ERR_IS_DIRECTORY,
|
|
ERR_IS_FILE,
|
|
ERR_DOES_NOT_EXIST,
|
|
ERR_FILE_ALREADY_EXIST,
|
|
ERR_DIR_ALREADY_EXIST,
|
|
ERR_UNKNOWN_HOST,
|
|
ERR_ACCESS_DENIED,
|
|
ERR_WRITE_ACCESS_DENIED,
|
|
ERR_CANNOT_ENTER_DIRECTORY,
|
|
ERR_PROTOCOL_IS_NOT_A_FILESYSTEM,
|
|
ERR_CYCLIC_LINK,
|
|
ERR_USER_CANCELED,
|
|
ERR_CYCLIC_COPY,
|
|
ERR_COULD_NOT_CREATE_SOCKET,
|
|
ERR_COULD_NOT_CONNECT,
|
|
ERR_CONNECTION_BROKEN,
|
|
ERR_NOT_FILTER_PROTOCOL,
|
|
ERR_COULD_NOT_MOUNT,
|
|
ERR_COULD_NOT_UNMOUNT,
|
|
ERR_COULD_NOT_READ,
|
|
ERR_COULD_NOT_WRITE,
|
|
ERR_COULD_NOT_BIND,
|
|
ERR_COULD_NOT_LISTEN,
|
|
ERR_COULD_NOT_ACCEPT,
|
|
ERR_COULD_NOT_LOGIN,
|
|
ERR_COULD_NOT_STAT,
|
|
ERR_COULD_NOT_CLOSEDIR,
|
|
ERR_COULD_NOT_MKDIR,
|
|
ERR_COULD_NOT_RMDIR,
|
|
ERR_CANNOT_RESUME,
|
|
ERR_CANNOT_RENAME,
|
|
ERR_CANNOT_CHMOD,
|
|
ERR_CANNOT_DELETE,
|
|
ERR_SLAVE_DIED,
|
|
ERR_OUT_OF_MEMORY,
|
|
ERR_UNKNOWN_PROXY_HOST,
|
|
ERR_COULD_NOT_AUTHENTICATE,
|
|
ERR_ABORTED,
|
|
ERR_INTERNAL_SERVER,
|
|
ERR_SERVER_TIMEOUT,
|
|
ERR_SERVICE_NOT_AVAILABLE,
|
|
ERR_UNKNOWN,
|
|
ERR_UNKNOWN_INTERRUPT,
|
|
ERR_CANNOT_DELETE_ORIGINAL,
|
|
ERR_CANNOT_DELETE_PARTIAL,
|
|
ERR_CANNOT_RENAME_ORIGINAL,
|
|
ERR_CANNOT_RENAME_PARTIAL,
|
|
ERR_NEED_PASSWD,
|
|
ERR_CANNOT_SYMLINK,
|
|
ERR_NO_CONTENT,
|
|
ERR_DISK_FULL,
|
|
ERR_IDENTICAL_FILES,
|
|
ERR_SLAVE_DEFINED,
|
|
ERR_UPGRADE_REQUIRED,
|
|
ERR_POST_DENIED
|
|
};
|
|
|
|
%End
|
|
|
|
TQString buildErrorString (int, const TQString&);
|
|
//ig TQString buildHTMLErrorString (int, const TQString&, const KURL* = 0, int = -1);
|
|
TQByteArray rawErrorDetail (int, const TQString&, const KURL* = 0, int = -1);
|
|
|
|
%If ( KDE_3_2_0 - )
|
|
TQString unsupportedActionErrorString (const TQString&, int);
|
|
|
|
%If ( KDE_3_5_1 - )
|
|
|
|
enum UDSAtomTypes
|
|
{
|
|
UDS_STRING,
|
|
UDS_LONG,
|
|
UDS_TIME,
|
|
UDS_SIZE,
|
|
UDS_SIZE_LARGE,
|
|
UDS_USER,
|
|
UDS_ICON_NAME,
|
|
UDS_GROUP,
|
|
UDS_EXTRA,
|
|
UDS_NAME,
|
|
UDS_LOCAL_PATH,
|
|
UDS_HIDDEN,
|
|
UDS_EXTENDED_ACL,
|
|
UDS_ACL_STRING,
|
|
UDS_DEFAULT_ACL_STRING,
|
|
UDS_ACCESS,
|
|
UDS_MODIFICATION_TIME,
|
|
UDS_ACCESS_TIME,
|
|
UDS_CREATION_TIME,
|
|
UDS_FILE_TYPE,
|
|
UDS_LINK_DEST,
|
|
UDS_URL,
|
|
UDS_MIME_TYPE,
|
|
UDS_GUESSED_MIME_TYPE,
|
|
UDS_XML_PROPERTIES
|
|
};
|
|
|
|
%End
|
|
|
|
%End
|
|
|
|
|
|
%If ( KDE_3_0_1 - )
|
|
|
|
enum CacheControl
|
|
{
|
|
CC_CacheOnly,
|
|
CC_Cache,
|
|
CC_Verify,
|
|
CC_Refresh,
|
|
CC_Reload
|
|
};
|
|
|
|
%End
|
|
|
|
TDEIO::CacheControl parseCacheControl (const TQString&);
|
|
TQString getCacheControlString (TDEIO::CacheControl);
|
|
TQString findDeviceMountPoint (const TQString&);
|
|
TQString findPathMountPoint (const TQString&);
|
|
bool probably_slow_mounted (const TQString&);
|
|
|
|
%If ( KDE_3_1_0 - )
|
|
bool manually_mounted (const TQString&);
|
|
|
|
%If ( KDE_3_2_0 - )
|
|
|
|
enum FileSystemFlag
|
|
{
|
|
SupportsChmod,
|
|
SupportsChown,
|
|
SupportsUTime,
|
|
SupportsSymlinks,
|
|
CaseInsensitive
|
|
};
|
|
|
|
bool testFileSystemFlag (const TQString&, TDEIO::FileSystemFlag);
|
|
%End
|
|
|
|
%End
|
|
|
|
|
|
class UDSAtom
|
|
{
|
|
%TypeHeaderCode
|
|
#include <global.h>
|
|
%End
|
|
|
|
|
|
public:
|
|
TQString m_str;
|
|
long m_long;
|
|
uint m_uds;
|
|
|
|
}; // class UDSAtom
|
|
|
|
//ig typedef TQValueList<TDEIO::UDSAtom> UDSEntry;
|
|
//ig typedef TQValueList<TDEIO::UDSEntry> UDSEntryList;
|
|
//ig typedef TQValueListIterator<UDSEntry> UDSEntryListIterator;
|
|
//ig typedef TQValueListConstIterator<UDSEntry> UDSEntryListConstIterator;
|
|
|
|
%If ( KDE_3_4_0 - KDE_3_5_1 )
|
|
|
|
enum UDSAtomTypes
|
|
{
|
|
UDS_STRING,
|
|
UDS_LONG,
|
|
UDS_TIME,
|
|
UDS_SIZE,
|
|
UDS_SIZE_LARGE,
|
|
UDS_USER,
|
|
UDS_ICON_NAME,
|
|
UDS_GROUP,
|
|
UDS_EXTRA,
|
|
UDS_NAME,
|
|
UDS_LOCAL_PATH,
|
|
UDS_ACCESS,
|
|
UDS_MODIFICATION_TIME,
|
|
UDS_ACCESS_TIME,
|
|
UDS_CREATION_TIME,
|
|
UDS_FILE_TYPE,
|
|
UDS_LINK_DEST,
|
|
UDS_URL,
|
|
UDS_MIME_TYPE,
|
|
UDS_GUESSED_MIME_TYPE,
|
|
UDS_XML_PROPERTIES
|
|
};
|
|
|
|
%End
|
|
|
|
|
|
%If ( KDE_3_2_0 - KDE_3_4_0 )
|
|
|
|
enum UDSAtomTypes
|
|
{
|
|
UDS_STRING,
|
|
UDS_LONG,
|
|
UDS_TIME,
|
|
UDS_SIZE,
|
|
UDS_SIZE_LARGE,
|
|
UDS_USER,
|
|
UDS_ICON_NAME,
|
|
UDS_GROUP,
|
|
UDS_EXTRA,
|
|
UDS_NAME,
|
|
UDS_ACCESS,
|
|
UDS_MODIFICATION_TIME,
|
|
UDS_ACCESS_TIME,
|
|
UDS_CREATION_TIME,
|
|
UDS_FILE_TYPE,
|
|
UDS_LINK_DEST,
|
|
UDS_URL,
|
|
UDS_MIME_TYPE,
|
|
UDS_GUESSED_MIME_TYPE,
|
|
UDS_XML_PROPERTIES
|
|
};
|
|
|
|
%End
|
|
|
|
|
|
%If ( KDE_3_1_0 - KDE_3_2_0 )
|
|
|
|
enum UDSAtomTypes
|
|
{
|
|
UDS_STRING,
|
|
UDS_LONG,
|
|
UDS_TIME,
|
|
UDS_SIZE,
|
|
UDS_SIZE_LARGE,
|
|
UDS_USER,
|
|
UDS_GROUP,
|
|
UDS_NAME,
|
|
UDS_ACCESS,
|
|
UDS_MODIFICATION_TIME,
|
|
UDS_ACCESS_TIME,
|
|
UDS_CREATION_TIME,
|
|
UDS_FILE_TYPE,
|
|
UDS_LINK_DEST,
|
|
UDS_URL,
|
|
UDS_MIME_TYPE,
|
|
UDS_GUESSED_MIME_TYPE,
|
|
UDS_XML_PROPERTIES
|
|
};
|
|
|
|
%End
|
|
|
|
|
|
%If ( - KDE_3_1_0 )
|
|
|
|
enum UDSAtomTypes
|
|
{
|
|
UDS_STRING,
|
|
UDS_LONG,
|
|
UDS_TIME,
|
|
UDS_SIZE,
|
|
UDS_SIZE_LARGE,
|
|
UDS_USER,
|
|
UDS_GROUP,
|
|
UDS_NAME,
|
|
UDS_ACCESS,
|
|
UDS_MODIFICATION_TIME,
|
|
UDS_ACCESS_TIME,
|
|
UDS_CREATION_TIME,
|
|
UDS_FILE_TYPE,
|
|
UDS_LINK_DEST,
|
|
UDS_URL,
|
|
UDS_MIME_TYPE,
|
|
UDS_GUESSED_MIME_TYPE
|
|
};
|
|
|
|
|
|
enum Error
|
|
{
|
|
ERR_CANNOT_OPEN_FOR_READING,
|
|
ERR_CANNOT_OPEN_FOR_WRITING,
|
|
ERR_CANNOT_LAUNCH_PROCESS,
|
|
ERR_INTERNAL,
|
|
ERR_MALFORMED_URL,
|
|
ERR_UNSUPPORTED_PROTOCOL,
|
|
ERR_NO_SOURCE_PROTOCOL,
|
|
ERR_UNSUPPORTED_ACTION,
|
|
ERR_IS_DIRECTORY,
|
|
ERR_IS_FILE,
|
|
ERR_DOES_NOT_EXIST,
|
|
ERR_FILE_ALREADY_EXIST,
|
|
ERR_DIR_ALREADY_EXIST,
|
|
ERR_UNKNOWN_HOST,
|
|
ERR_ACCESS_DENIED,
|
|
ERR_WRITE_ACCESS_DENIED,
|
|
ERR_CANNOT_ENTER_DIRECTORY,
|
|
ERR_PROTOCOL_IS_NOT_A_FILESYSTEM,
|
|
ERR_CYCLIC_LINK,
|
|
ERR_USER_CANCELED,
|
|
ERR_CYCLIC_COPY,
|
|
ERR_COULD_NOT_CREATE_SOCKET,
|
|
ERR_COULD_NOT_CONNECT,
|
|
ERR_CONNECTION_BROKEN,
|
|
ERR_NOT_FILTER_PROTOCOL,
|
|
ERR_COULD_NOT_MOUNT,
|
|
ERR_COULD_NOT_UNMOUNT,
|
|
ERR_COULD_NOT_READ,
|
|
ERR_COULD_NOT_WRITE,
|
|
ERR_COULD_NOT_BIND,
|
|
ERR_COULD_NOT_LISTEN,
|
|
ERR_COULD_NOT_ACCEPT,
|
|
ERR_COULD_NOT_LOGIN,
|
|
ERR_COULD_NOT_STAT,
|
|
ERR_COULD_NOT_CLOSEDIR,
|
|
ERR_COULD_NOT_MKDIR,
|
|
ERR_COULD_NOT_RMDIR,
|
|
ERR_CANNOT_RESUME,
|
|
ERR_CANNOT_RENAME,
|
|
ERR_CANNOT_CHMOD,
|
|
ERR_CANNOT_DELETE,
|
|
ERR_SLAVE_DIED,
|
|
ERR_OUT_OF_MEMORY,
|
|
ERR_UNKNOWN_PROXY_HOST,
|
|
ERR_COULD_NOT_AUTHENTICATE,
|
|
ERR_ABORTED,
|
|
ERR_INTERNAL_SERVER,
|
|
ERR_SERVER_TIMEOUT,
|
|
ERR_SERVICE_NOT_AVAILABLE,
|
|
ERR_UNKNOWN,
|
|
ERR_UNKNOWN_INTERRUPT,
|
|
ERR_CANNOT_DELETE_ORIGINAL,
|
|
ERR_CANNOT_DELETE_PARTIAL,
|
|
ERR_CANNOT_RENAME_ORIGINAL,
|
|
ERR_CANNOT_RENAME_PARTIAL,
|
|
ERR_NEED_PASSWD,
|
|
ERR_CANNOT_SYMLINK,
|
|
ERR_NO_CONTENT,
|
|
ERR_DISK_FULL,
|
|
ERR_IDENTICAL_FILES,
|
|
ERR_SLAVE_DEFINED
|
|
};
|
|
|
|
|
|
%If ( - KDE_3_0_1 )
|
|
|
|
enum CacheControl
|
|
{
|
|
CC_CacheOnly,
|
|
CC_Cache,
|
|
CC_Verify,
|
|
CC_Reload
|
|
};
|
|
|
|
%End
|
|
|
|
%End
|
|
|
|
//force
|
|
//ig typedef TQMap<TQString,TQString> MetaData;
|
|
//end
|
|
}; // namespace TDEIO
|
|
|
|
//force
|
|
TDEIO::UDSEntry testTDEIOUDSEntry (TDEIO::UDSEntry);
|
|
%MethodCode
|
|
//takes list | (_TDEIO.UDSEntry)
|
|
//returns (_TDEIO.UDSEntry)
|
|
sipRes = a0;
|
|
%End
|
|
|
|
TDEIO::UDSEntryList testTDEIOUDSEntryList (TDEIO::UDSEntryList);
|
|
%MethodCode
|
|
//takes list | (_TDEIO.UDSEntryList)
|
|
//returns (_TDEIO.UDSEntryList)
|
|
sipRes = a0;
|
|
%End
|
|
|
|
%ModuleHeaderCode
|
|
#include <tqmap.h>
|
|
%End
|
|
|
|
TDEIO::MetaData testTDEIOMetaData (TDEIO::MetaData);
|
|
%MethodCode
|
|
//takes dict | (_TDEIO.MetaData)
|
|
//returns (_TDEIO.MetaData)
|
|
sipRes = a0;
|
|
%End
|
|
|
|
//end
|
|
|
|
|
|
%MappedType TDEIO::UDSEntry
|
|
//converts a Python list of _TDEIO.UDSAtom
|
|
{
|
|
%TypeHeaderCode
|
|
#include <tqvaluelist.h>
|
|
#include <global.h>
|
|
%End
|
|
|
|
%ConvertFromTypeCode
|
|
if (!sipCpp)
|
|
return PyList_New(0);
|
|
|
|
// Create the list
|
|
PyObject *pylist;
|
|
if ((pylist = PyList_New(0)) == NULL)
|
|
return NULL;
|
|
|
|
TQValueList<TDEIO::UDSAtom> *cpplist = (TQValueList<TDEIO::UDSAtom> *)sipCpp;
|
|
PyObject *inst;
|
|
|
|
// Get it.
|
|
TQValueList<TDEIO::UDSAtom>::Iterator it;
|
|
for( it = cpplist->begin(); it != cpplist->end(); ++it )
|
|
{
|
|
if (((inst = sipConvertFromNewType(new TDEIO::UDSAtom(*it), sipType_TDEIO_UDSAtom, NULL)) == NULL)
|
|
|| PyList_Append (pylist, inst) < 0)
|
|
{
|
|
Py_DECREF (pylist);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return pylist;
|
|
%End
|
|
|
|
|
|
%ConvertToTypeCode
|
|
if (sipIsErr == NULL)
|
|
return PyList_Check(sipPy);
|
|
|
|
TQValueList<TDEIO::UDSAtom> *cpplist = new TQValueList<TDEIO::UDSAtom>;
|
|
|
|
PyObject *elem;
|
|
TDEIO::UDSAtom *cpp;
|
|
int iserr = 0;
|
|
|
|
for (int i = 0; i < PyList_Size (sipPy); i++)
|
|
{
|
|
elem = PyList_GET_ITEM (sipPy, i);
|
|
cpp = (TDEIO::UDSAtom *)sipForceConvertToType(elem, sipType_TDEIO_UDSAtom, sipTransferObj, SIP_NOT_NONE|SIP_NO_CONVERTORS, NULL, &iserr);
|
|
|
|
if (iserr)
|
|
{
|
|
*sipIsErr = 1;
|
|
delete cpplist;
|
|
return 0;
|
|
}
|
|
|
|
cpplist->append (*cpp);
|
|
}
|
|
|
|
*sipCppPtr = cpplist;
|
|
|
|
return 1;
|
|
%End
|
|
};
|
|
|
|
|
|
%MappedType TDEIO::UDSEntryList
|
|
//converts a Python list of _TDEIO.UDSEntry
|
|
{
|
|
%TypeHeaderCode
|
|
#include <tqvaluelist.h>
|
|
#include <global.h>
|
|
%End
|
|
|
|
%ConvertFromTypeCode
|
|
if (!sipCpp)
|
|
return PyList_New(0);
|
|
|
|
// Create the list
|
|
PyObject *pylist;
|
|
if ((pylist = PyList_New(0)) == NULL)
|
|
return NULL;
|
|
|
|
TQValueList<TDEIO::UDSEntry> *cpplist = (TQValueList<TDEIO::UDSEntry> *)sipCpp;
|
|
PyObject *inst;
|
|
|
|
// Get it.
|
|
TQValueList<TDEIO::UDSEntry>::Iterator it;
|
|
for( it = cpplist->begin(); it != cpplist->end(); ++it )
|
|
{
|
|
TDEIO::UDSEntry cpp = *it;
|
|
inst = sipConvertFromType(&cpp, sipType_TDEIO_UDSEntry, sipTransferObj);
|
|
|
|
if (PyList_Append (pylist, inst) < 0)
|
|
{
|
|
Py_DECREF (pylist);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return pylist;
|
|
%End
|
|
|
|
|
|
%ConvertToTypeCode
|
|
if (sipIsErr == NULL)
|
|
return PyList_Check(sipPy);
|
|
|
|
TQValueList<TDEIO::UDSEntry> *cpplist = new TQValueList<TDEIO::UDSEntry>;
|
|
|
|
PyObject *elem;
|
|
TDEIO::UDSEntry *cpp;
|
|
int iserr = 0;
|
|
|
|
for (int i = 0; i < PyList_Size (sipPy); i++)
|
|
{
|
|
elem = PyList_GET_ITEM (sipPy, i);
|
|
cpp = (TDEIO::UDSEntry *)sipForceConvertToType(elem, sipType_TDEIO_UDSEntry, sipTransferObj, SIP_NOT_NONE|SIP_NO_CONVERTORS, NULL, &iserr);
|
|
|
|
if (iserr)
|
|
{
|
|
*sipIsErr = 1;
|
|
delete cpplist;
|
|
return 0;
|
|
}
|
|
|
|
cpplist->append (*cpp);
|
|
}
|
|
|
|
*sipCppPtr = cpplist;
|
|
|
|
return 1;
|
|
%End
|
|
};
|
|
|
|
|
|
%MappedType TDEIO::MetaData
|
|
//converts a Python dict of TQString, TQString
|
|
{
|
|
%TypeHeaderCode
|
|
#include <tqmap.h>
|
|
#include <global.h>
|
|
%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,TQString> cppmap = *sipCpp;
|
|
TQMap<TQString,TQString>::ConstIterator it;
|
|
|
|
for (it = cppmap.begin (); it != cppmap.end (); ++it)
|
|
{
|
|
TQString acpp = it.key ();
|
|
TQString bcpp = it.data ();
|
|
PyObject *ainst;
|
|
PyObject *binst;
|
|
if (((ainst = sipConvertFromNewType(new TQString(acpp), sipType_TQString, sipTransferObj)) == NULL)
|
|
|| ((binst = sipConvertFromNewType(new TQString(bcpp), sipType_TQString, sipTransferObj)) == NULL)
|
|
|| (PyDict_SetItem (dict, ainst, binst) < 0))
|
|
{
|
|
Py_XDECREF (ainst);
|
|
Py_XDECREF (binst);
|
|
Py_DECREF (dict);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return dict;
|
|
%End
|
|
|
|
|
|
%ConvertToTypeCode
|
|
// Convert a Python dictionary to a TQMap on the heap.
|
|
|
|
if (sipIsErr == NULL)
|
|
return PyDict_Check(sipPy);
|
|
|
|
|
|
TQMap<TQString,TQString> *cppmap = new TQMap<TQString,TQString>;
|
|
|
|
PyObject *aelem, *belem;
|
|
SIP_SSIZE_T pos = 0;
|
|
TQString *acpp;
|
|
TQString *bcpp;
|
|
|
|
while (PyDict_Next(sipPy, &pos, &aelem, &belem))
|
|
{
|
|
int iserr = 0, acpp_state, bcpp_state;
|
|
|
|
acpp = (TQString *)sipForceConvertToType(aelem, sipType_TQString, sipTransferObj, SIP_NOT_NONE, &acpp_state, &iserr);
|
|
bcpp = (TQString *)sipForceConvertToType(belem, sipType_TQString, sipTransferObj, SIP_NOT_NONE, &bcpp_state, &iserr);
|
|
|
|
if (iserr)
|
|
{
|
|
if (acpp)
|
|
sipReleaseType(acpp, sipType_TQString, acpp_state);
|
|
|
|
*sipIsErr = 1;
|
|
delete cppmap;
|
|
return 0;
|
|
}
|
|
|
|
cppmap->insert (*acpp, *bcpp);
|
|
|
|
sipReleaseType(acpp, sipType_TQString, acpp_state);
|
|
sipReleaseType(bcpp, sipType_TQString, bcpp_state);
|
|
}
|
|
|
|
*sipCppPtr = (TDEIO::MetaData *)cppmap;
|
|
|
|
return 1;
|
|
%End
|
|
};
|
|
|
|
|