[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [pykde5] /: Added karchive.
From: Simon Edwards <simon () simonzone ! com>
Date: 2014-01-25 23:10:10
Message-ID: E1W7CMc-00039O-MJ () scm ! kde ! org
[Download RAW message or body]
Git commit 46a21349a5402008af6009dedda81a30b03d39cd by Simon Edwards.
Committed on 25/01/2014 at 23:09.
Pushed by sedwards into branch 'master'.
Added karchive.
M +7 -2 CMakeLists.txt
A +50 -0 sip/karchive/k7zip.sip
A +59 -0 sip/karchive/kar.sip
A +117 -0 sip/karchive/karchive.sip
A +36 -0 sip/karchive/karchivemod.sip
A +49 -0 sip/karchive/kcompressiondevice.sip
A +61 -0 sip/karchive/kfilterbase.sip
A +29 -0 sip/karchive/kfilterdev.sip
A +61 -0 sip/karchive/ktar.sip
A +99 -0 sip/karchive/kzip.sip
A +40 -0 sip/typedefs.sip
http://commits.kde.org/pykde5/46a21349a5402008af6009dedda81a30b03d39cd
diff --git a/CMakeLists.txt b/CMakeLists.txt
index bfe3aad..7e40194 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -20,7 +20,7 @@ include(PythonMacros)
include(FeatureSummary)
include(ECMSetupVersion)
-find_package(KF5 CONFIG REQUIRED Auth ItemModels ItemViews)
+find_package(KF5 CONFIG REQUIRED Auth ItemModels ItemViews Archive)
#option(PYKDEUIC4_ALTINSTALL "Enable parallel-installation of the PyKDE4 tools" FALSE)
@@ -113,7 +113,12 @@ file(GLOB kitemviews_files_sip sip/kitemviews/*.sip)
set(SIP_EXTRA_FILES_DEPEND ${kitemviews_files_sip})
add_sip_python_module(PyKDE5.kitemviews sip/kitemviews/kitemviewsmod.sip KF5::ItemViews)
-set(PYKDE_MODULES "kitemmodels kitemviews")
+# karchive
+file(GLOB karchive_files_sip sip/karchive/*.sip)
+set(SIP_EXTRA_FILES_DEPEND ${karchive_files_sip})
+add_sip_python_module(PyKDE5.karchive sip/karchive/karchivemod.sip KF5::Archive)
+
+set(PYKDE_MODULES "kitemmodels kitemviews karchive")
###############################################################################
diff --git a/sip/karchive/k7zip.sip b/sip/karchive/k7zip.sip
new file mode 100644
index 0000000..0e46e0c
--- /dev/null
+++ b/sip/karchive/k7zip.sip
@@ -0,0 +1,50 @@
+// Copyright 2014 Simon Edwards <simon@simonzone.com>
+
+// Generated by twine2
+
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU Library General Public License as
+// published by the Free Software Foundation; either version 2, or
+// (at your option) any later version.
+
+// This program 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 Library General Public
+// License along with this program; if not, write to the
+// Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+class K7Zip : KArchive
+{
+%TypeHeaderCode
+#include <k7zip.h>
+%End
+
+public:
+ explicit K7Zip (const QString& filename);
+ explicit K7Zip (QIODevice* dev);
+ virtual ~K7Zip ();
+protected:
+ bool doWriteSymLink (const QString& name, const QString& target, const QString& \
user, const QString& group, mode_t perm, const QDateTime& atime, const QDateTime& mtime, const QDateTime& \
ctime); + bool doWriteDir (const QString& name, const QString& user, const QString& \
group, mode_t perm, const QDateTime& atime, const QDateTime& mtime, const QDateTime& ctime); + bool \
doPrepareWriting (const QString& name, const QString& user, const QString& group, qint64 size, mode_t \
perm, const QDateTime& atime, const QDateTime& mtime, const QDateTime& ctime); + bool \
doFinishWriting (qint64 size); + bool writeData (const char* data, qint64 size);
+ bool openArchive (QIODevice::OpenMode mode);
+ bool closeArchive ();
+ void virtual_hook (int id, void* data);
+%ConvertToSubClassCode
+ // CTSCC for subclasses of 'K7Zip'
+ sipType = NULL;
+
+ if (dynamic_cast<K7Zip*>(sipCpp))
+ sipType = sipType_K7Zip;
+%End
+};
+%ModuleHeaderCode
+//ctscc
+#include <k7zip.h>
+%End
diff --git a/sip/karchive/kar.sip b/sip/karchive/kar.sip
new file mode 100644
index 0000000..09b0e02
--- /dev/null
+++ b/sip/karchive/kar.sip
@@ -0,0 +1,59 @@
+// Copyright 2014 Simon Edwards <simon@simonzone.com>
+
+// Generated by twine2
+
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU Library General Public License as
+// published by the Free Software Foundation; either version 2, or
+// (at your option) any later version.
+
+// This program 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 Library General Public
+// License along with this program; if not, write to the
+// Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+class KAr : KArchive
+{
+%TypeHeaderCode
+#include <kar.h>
+%End
+
+public:
+ KAr (const QString& filename);
+ KAr (QIODevice* dev);
+ virtual ~KAr ();
+protected:
+ bool doPrepareWriting (const QString& name, const QString& user, const QString& \
group, qint64 size, mode_t perm, const QDateTime& atime, const QDateTime& mtime, const QDateTime& ctime); \
+ bool doFinishWriting (qint64 size); + bool doWriteDir \
(const QString& name, const QString& user, const QString& group, mode_t perm, const QDateTime& atime, \
const QDateTime& mtime, const QDateTime& ctime); + bool doWriteSymLink (const \
QString& name, const QString& target, const QString& user, const QString& group, mode_t perm, const \
QDateTime& atime, const QDateTime& mtime, const QDateTime& ctime); + bool \
openArchive (QIODevice::OpenMode mode); + bool closeArchive ();
+ void virtual_hook (int id, void* data);
+%ConvertToSubClassCode
+ // CTSCC for subclasses of 'KArchive'
+ sipType = NULL;
+
+ if (dynamic_cast<K7Zip*>(sipCpp))
+ sipType = sipType_K7Zip;
+ else if (dynamic_cast<KAr*>(sipCpp))
+ sipType = sipType_KAr;
+ else if (dynamic_cast<KTar*>(sipCpp))
+ sipType = sipType_KTar;
+ else if (dynamic_cast<KZip*>(sipCpp))
+ sipType = sipType_KZip;
+%End
+};
+%ModuleHeaderCode
+//ctscc
+#include <k7zip.h>
+#include <kar.h>
+#include <karchive.h>
+#include <ktar.h>
+#include <kzip.h>
+%End
diff --git a/sip/karchive/karchive.sip b/sip/karchive/karchive.sip
new file mode 100644
index 0000000..bdf5d5a
--- /dev/null
+++ b/sip/karchive/karchive.sip
@@ -0,0 +1,117 @@
+// Copyright 2014 Simon Edwards <simon@simonzone.com>
+
+// Generated by twine2
+
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU Library General Public License as
+// published by the Free Software Foundation; either version 2, or
+// (at your option) any later version.
+
+// This program 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 Library General Public
+// License along with this program; if not, write to the
+// Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+class KArchive
+{
+%TypeHeaderCode
+#include <karchive.h>
+%End
+
+protected:
+ KArchive (const QString& fileName);
+ KArchive (QIODevice* dev);
+public:
+ virtual ~KArchive ();
+ virtual bool open (QIODevice::OpenMode mode);
+ virtual bool close ();
+ bool isOpen () const;
+ QIODevice::OpenMode mode () const;
+ QIODevice* device () const;
+ QString fileName () const;
+ const KArchiveDirectory* directory () const;
+ bool addLocalFile (const QString& fileName, const QString& destName);
+ bool addLocalDirectory (const QString& path, const QString& destName);
+ bool writeDir (const QString& name, const QString& user = QString(), const \
QString& group = QString(), mode_t perm = 040755, const QDateTime& atime = QDateTime(), const QDateTime& \
mtime = QDateTime(), const QDateTime& ctime = QDateTime()); + bool writeSymLink \
(const QString& name, const QString& target, const QString& user = QString(), const QString& group = \
QString(), mode_t perm = 0120755, const QDateTime& atime = QDateTime(), const QDateTime& mtime = \
QDateTime(), const QDateTime& ctime = QDateTime()); + bool writeFile (const \
QString& name, const QByteArray& data, mode_t perm = 0100644, const QString& user = QString(), const \
QString& group = QString(), const QDateTime& atime = QDateTime(), const QDateTime& mtime = QDateTime(), \
const QDateTime& ctime = QDateTime()); + bool prepareWriting (const QString& name, \
const QString& user, const QString& group, qint64 size, mode_t perm = 0100644, const QDateTime& atime = \
QDateTime(), const QDateTime& mtime = QDateTime(), const QDateTime& ctime = QDateTime()); + virtual \
bool writeData (const char* data, qint64 size); + bool finishWriting \
(qint64 size); +protected:
+ virtual bool openArchive (QIODevice::OpenMode mode)=0;
+ virtual bool closeArchive ()=0;
+ virtual KArchiveDirectory* rootDir ();
+ virtual bool doWriteDir (const QString& name, const QString& user, const QString& group, \
mode_t perm, const QDateTime& atime, const QDateTime& mtime, const QDateTime& ctime)=0; + virtual bool \
doWriteSymLink (const QString& name, const QString& target, const QString& user, const QString& group, \
mode_t perm, const QDateTime& atime, const QDateTime& mtime, const QDateTime& ctime)=0; + virtual bool \
doPrepareWriting (const QString& name, const QString& user, const QString& group, qint64 size, mode_t \
perm, const QDateTime& atime, const QDateTime& mtime, const QDateTime& ctime)=0; + virtual bool \
doFinishWriting (qint64 size)=0; + KArchiveDirectory* findOrCreate (const QString& path);
+ virtual bool createDevice (QIODevice::OpenMode mode);
+ void setDevice (QIODevice* dev);
+ void setRootDir (KArchiveDirectory* rootDir);
+ virtual void virtual_hook (int id, void* data);
+};
+class KArchiveEntry
+{
+%TypeHeaderCode
+#include <karchive.h>
+%End
+
+public:
+ KArchiveEntry (KArchive* archive, const QString& name, int access, const \
QDateTime& date, const QString& user, const QString& group, const QString& symlink); + virtual \
~KArchiveEntry (); + QDateTime date () const;
+ QString name () const;
+ mode_t permissions () const;
+ QString user () const;
+ QString group () const;
+ QString symLinkTarget () const;
+ virtual bool isFile () const;
+ virtual bool isDirectory () const;
+protected:
+ KArchive* archive () const;
+ virtual void virtual_hook (int id, void* data);
+};
+class KArchiveFile : KArchiveEntry
+{
+%TypeHeaderCode
+#include <karchive.h>
+%End
+
+public:
+ KArchiveFile (KArchive* archive, const QString& name, int access, const \
QDateTime& date, const QString& user, const QString& group, const QString& symlink, qint64 pos, qint64 \
size); + virtual ~KArchiveFile ();
+ qint64 position () const;
+ qint64 size () const;
+ void setSize (qint64 s);
+ virtual QByteArray data () const;
+ virtual QIODevice* createDevice () const;
+ virtual bool isFile () const;
+ bool copyTo (const QString& dest) const;
+protected:
+ virtual void virtual_hook (int id, void* data);
+};
+class KArchiveDirectory : KArchiveEntry
+{
+%TypeHeaderCode
+#include <karchive.h>
+%End
+
+public:
+ KArchiveDirectory (KArchive* archive, const QString& name, int access, const \
QDateTime& date, const QString& user, const QString& group, const QString& symlink); + virtual \
~KArchiveDirectory (); + QStringList entries () const;
+ const KArchiveEntry* entry (const QString& name) const;
+ void addEntry (KArchiveEntry*);
+ void removeEntry (KArchiveEntry*);
+ virtual bool isDirectory () const;
+ bool copyTo (const QString& dest, bool recursive = 1) const;
+protected:
+ virtual void virtual_hook (int id, void* data);
+};
diff --git a/sip/karchive/karchivemod.sip b/sip/karchive/karchivemod.sip
new file mode 100644
index 0000000..d3f7915
--- /dev/null
+++ b/sip/karchive/karchivemod.sip
@@ -0,0 +1,36 @@
+// Copyright 2014 Simon Edwards <simon@simonzone.com>
+
+// Generated by twine2
+
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU Library General Public License as
+// published by the Free Software Foundation; either version 2, or
+// (at your option) any later version.
+
+// This program 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 Library General Public
+// License along with this program; if not, write to the
+// Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+%Module PyKDE5.karchive
+
+%ModuleHeaderCode
+#pragma GCC visibility push(default)
+%End
+
+%Import typedefs.sip
+%Import QtCore/QtCoremod.sip
+
+%Include k7zip.sip
+%Include kar.sip
+%Include karchive.sip
+%Include kcompressiondevice.sip
+%Include kfilterbase.sip
+%Include kfilterdev.sip
+%Include ktar.sip
+%Include kzip.sip
diff --git a/sip/karchive/kcompressiondevice.sip b/sip/karchive/kcompressiondevice.sip
new file mode 100644
index 0000000..62c4d82
--- /dev/null
+++ b/sip/karchive/kcompressiondevice.sip
@@ -0,0 +1,49 @@
+// Copyright 2014 Simon Edwards <simon@simonzone.com>
+
+// Generated by twine2
+
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU Library General Public License as
+// published by the Free Software Foundation; either version 2, or
+// (at your option) any later version.
+
+// This program 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 Library General Public
+// License along with this program; if not, write to the
+// Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+class KCompressionDevice : QIODevice
+{
+%TypeHeaderCode
+#include <kcompressiondevice.h>
+%End
+
+public:
+ enum CompressionType
+ {
+ GZip,
+ BZip2,
+ Xz,
+ None
+ };
+ KCompressionDevice (QIODevice* inputDevice, bool autoDeleteInputDevice, \
KCompressionDevice::CompressionType type); + KCompressionDevice (const \
QString& fileName, KCompressionDevice::CompressionType type); + virtual ~KCompressionDevice ();
+ KCompressionDevice::CompressionType compressionType () const;
+ virtual bool open (QIODevice::OpenMode mode);
+ virtual void close ();
+ void setOrigFileName (const QByteArray& fileName);
+ void setSkipHeaders ();
+ virtual bool seek (qint64);
+ virtual bool atEnd () const;
+ static KFilterBase* filterForCompressionType (KCompressionDevice::CompressionType type);
+protected:
+ virtual qint64 readData (char* data, qint64 maxlen);
+ virtual qint64 writeData (const char* data, qint64 len);
+ KFilterBase* filterBase ();
+};
diff --git a/sip/karchive/kfilterbase.sip b/sip/karchive/kfilterbase.sip
new file mode 100644
index 0000000..d2cf81c
--- /dev/null
+++ b/sip/karchive/kfilterbase.sip
@@ -0,0 +1,61 @@
+// Copyright 2014 Simon Edwards <simon@simonzone.com>
+
+// Generated by twine2
+
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU Library General Public License as
+// published by the Free Software Foundation; either version 2, or
+// (at your option) any later version.
+
+// This program 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 Library General Public
+// License along with this program; if not, write to the
+// Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+class KFilterBase /NoDefaultCtors/
+{
+%TypeHeaderCode
+#include <kfilterbase.h>
+%End
+
+public:
+ KFilterBase ();
+ virtual ~KFilterBase ();
+ void setDevice (QIODevice* dev, bool autodelete = 0);
+ QIODevice* device ();
+ virtual bool init (int mode)=0;
+ virtual int mode () const=0;
+ virtual bool terminate ();
+ virtual void reset ();
+ virtual bool readHeader ()=0;
+ virtual bool writeHeader (const QByteArray& filename)=0;
+ virtual void setOutBuffer (char* data, uint maxlen)=0;
+ virtual void setInBuffer (const char* data, uint size)=0;
+ virtual bool inBufferEmpty () const;
+ virtual int inBufferAvailable () const=0;
+ virtual bool outBufferFull () const;
+ virtual int outBufferAvailable () const=0;
+ enum Result
+ {
+ Ok,
+ End,
+ Error
+ };
+ virtual KFilterBase::Result uncompress ()=0;
+ virtual KFilterBase::Result compress (bool finish)=0;
+ enum FilterFlags
+ {
+ NoHeaders,
+ WithHeaders,
+ ZlibHeaders
+ };
+ void setFilterFlags (KFilterBase::FilterFlags flags);
+ KFilterBase::FilterFlags filterFlags () const;
+protected:
+ virtual void virtual_hook (int id, void* data);
+};
diff --git a/sip/karchive/kfilterdev.sip b/sip/karchive/kfilterdev.sip
new file mode 100644
index 0000000..e658a8d
--- /dev/null
+++ b/sip/karchive/kfilterdev.sip
@@ -0,0 +1,29 @@
+// Copyright 2014 Simon Edwards <simon@simonzone.com>
+
+// Generated by twine2
+
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU Library General Public License as
+// published by the Free Software Foundation; either version 2, or
+// (at your option) any later version.
+
+// This program 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 Library General Public
+// License along with this program; if not, write to the
+// Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+class KFilterDev : KCompressionDevice
+{
+%TypeHeaderCode
+#include <kfilterdev.h>
+%End
+
+public:
+ KFilterDev (const QString& fileName);
+ static KCompressionDevice::CompressionType compressionTypeForMimeType (const QString& mimetype);
+};
diff --git a/sip/karchive/ktar.sip b/sip/karchive/ktar.sip
new file mode 100644
index 0000000..a3f4359
--- /dev/null
+++ b/sip/karchive/ktar.sip
@@ -0,0 +1,61 @@
+// Copyright 2014 Simon Edwards <simon@simonzone.com>
+
+// Generated by twine2
+
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU Library General Public License as
+// published by the Free Software Foundation; either version 2, or
+// (at your option) any later version.
+
+// This program 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 Library General Public
+// License along with this program; if not, write to the
+// Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+class KTar : KArchive
+{
+%TypeHeaderCode
+#include <ktar.h>
+%End
+
+public:
+ explicit KTar (const QString& filename, const QString& mimetype = QString());
+ explicit KTar (QIODevice* dev);
+ virtual ~KTar ();
+ void setOrigFileName (const QByteArray& fileName);
+protected:
+ bool doWriteSymLink (const QString& name, const QString& target, const QString& \
user, const QString& group, mode_t perm, const QDateTime& atime, const QDateTime& mtime, const QDateTime& \
ctime); + bool doWriteDir (const QString& name, const QString& user, const QString& \
group, mode_t perm, const QDateTime& atime, const QDateTime& mtime, const QDateTime& ctime); + bool \
doPrepareWriting (const QString& name, const QString& user, const QString& group, qint64 size, mode_t \
perm, const QDateTime& atime, const QDateTime& mtime, const QDateTime& ctime); + bool \
doFinishWriting (qint64 size); + bool openArchive (QIODevice::OpenMode mode);
+ bool closeArchive ();
+ bool createDevice (QIODevice::OpenMode mode);
+ void virtual_hook (int id, void* data);
+%ConvertToSubClassCode
+ // CTSCC for subclasses of 'KArchive'
+ sipType = NULL;
+
+ if (dynamic_cast<K7Zip*>(sipCpp))
+ sipType = sipType_K7Zip;
+ else if (dynamic_cast<KAr*>(sipCpp))
+ sipType = sipType_KAr;
+ else if (dynamic_cast<KTar*>(sipCpp))
+ sipType = sipType_KTar;
+ else if (dynamic_cast<KZip*>(sipCpp))
+ sipType = sipType_KZip;
+%End
+};
+%ModuleHeaderCode
+//ctscc
+#include <k7zip.h>
+#include <kar.h>
+#include <karchive.h>
+#include <ktar.h>
+#include <kzip.h>
+%End
diff --git a/sip/karchive/kzip.sip b/sip/karchive/kzip.sip
new file mode 100644
index 0000000..a06cdbc
--- /dev/null
+++ b/sip/karchive/kzip.sip
@@ -0,0 +1,99 @@
+// Copyright 2014 Simon Edwards <simon@simonzone.com>
+
+// Generated by twine2
+
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU Library General Public License as
+// published by the Free Software Foundation; either version 2, or
+// (at your option) any later version.
+
+// This program 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 Library General Public
+// License along with this program; if not, write to the
+// Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+class KZip : KArchive
+{
+%TypeHeaderCode
+#include <kzip.h>
+%End
+
+public:
+ KZip (const QString& filename);
+ KZip (QIODevice* dev);
+ virtual ~KZip ();
+ enum ExtraField
+ {
+ NoExtraField,
+ ModificationTime,
+ DefaultExtraField
+ };
+ void setExtraField (KZip::ExtraField ef);
+ KZip::ExtraField extraField () const;
+ enum Compression
+ {
+ NoCompression,
+ DeflateCompression
+ };
+ void setCompression (KZip::Compression c);
+ KZip::Compression compression () const;
+ bool writeData (const char* data, qint64 size);
+protected:
+ bool doWriteSymLink (const QString& name, const QString& target, const QString& \
user, const QString& group, mode_t perm, const QDateTime& atime, const QDateTime& mtime, const QDateTime& \
ctime); + bool doPrepareWriting (const QString& name, const QString& user, const \
QString& group, qint64 size, mode_t perm, const QDateTime& atime, const QDateTime& mtime, const \
QDateTime& creationTime); + bool doFinishWriting (qint64 size);
+ bool openArchive (QIODevice::OpenMode mode);
+ bool closeArchive ();
+ bool doWriteDir (const QString& name, const QString& user, const QString& group, \
mode_t perm, const QDateTime& atime, const QDateTime& mtime, const QDateTime& ctime); + void \
virtual_hook (int id, void* data); +%ConvertToSubClassCode
+ // CTSCC for subclasses of 'KZip'
+ sipType = NULL;
+
+ if (dynamic_cast<KZip*>(sipCpp))
+ sipType = sipType_KZip;
+%End
+};
+class KZipFileEntry : KArchiveFile
+{
+%TypeHeaderCode
+#include <kzip.h>
+%End
+
+public:
+ KZipFileEntry (KZip* zip, const QString& name, int access, const QDateTime& \
date, const QString& user, const QString& group, const QString& symlink, const QString& path, qint64 \
start, qint64 uncompressedSize, int encoding, qint64 compressedSize); + ~KZipFileEntry ();
+ int encoding () const;
+ qint64 compressedSize () const;
+ void setCompressedSize (qint64 compressedSize);
+ void setHeaderStart (qint64 headerstart);
+ qint64 headerStart () const;
+ unsigned long crc32 () const;
+ void setCRC32 (unsigned long crc32);
+ const QString& path () const;
+ QByteArray data () const;
+ QIODevice* createDevice () const;
+%ConvertToSubClassCode
+ // CTSCC for subclasses of 'KArchiveEntry'
+ sipType = NULL;
+
+ if (dynamic_cast<KArchiveDirectory*>(sipCpp))
+ sipType = sipType_KArchiveDirectory;
+ else if (dynamic_cast<KArchiveFile*>(sipCpp))
+ {
+ sipType = sipType_KArchiveFile;
+ if (dynamic_cast<KZipFileEntry*>(sipCpp))
+ sipType = sipType_KZipFileEntry;
+ }
+%End
+};
+%ModuleHeaderCode
+//ctscc
+#include <karchive.h>
+#include <kzip.h>
+%End
diff --git a/sip/typedefs.sip b/sip/typedefs.sip
new file mode 100644
index 0000000..a1d2375
--- /dev/null
+++ b/sip/typedefs.sip
@@ -0,0 +1,40 @@
+// Copyright 2014 Simon Edwards <simon@simonzone.com>
+
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU Library General Public License as
+// published by the Free Software Foundation; either version 2, or
+// (at your option) any later version.
+
+// This program 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 Library General Public
+// License along with this program; if not, write to the
+// Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+%Module PyKDE5.typedefs
+
+typedef uint mode_t;
+
+typedef long time_t;
+
+typedef ulong size_t;
+
+typedef int ssize_t;
+
+typedef int pid_t;
+
+typedef ulong Window;
+
+typedef bool Bool;
+
+typedef uint WFlags;
+
+typedef long off_t;
+
+typedef uint uid_t;
+
+typedef uint gid_t;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic