qsavefile.sip 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. // qsavefile.sip generated by MetaSIP
  2. //
  3. // This file is part of the QtCore Python extension module.
  4. //
  5. // Copyright (c) 2026 Riverbank Computing Limited <info@riverbankcomputing.com>
  6. //
  7. // This file is part of PyQt6.
  8. //
  9. // This file may be used under the terms of the GNU General Public License
  10. // version 3.0 as published by the Free Software Foundation and appearing in
  11. // the file LICENSE included in the packaging of this file. Please review the
  12. // following information to ensure the GNU General Public License version 3.0
  13. // requirements will be met: http://www.gnu.org/copyleft/gpl.html.
  14. //
  15. // If you do not wish to use this file under the terms of the GPL version 3.0
  16. // then you may purchase a commercial license. For more information contact
  17. // info@riverbankcomputing.com.
  18. //
  19. // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
  20. // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  21. class QSaveFile : public QFileDevice
  22. {
  23. %TypeHeaderCode
  24. #include <qsavefile.h>
  25. %End
  26. public:
  27. %If (Qt_6_11_0 -)
  28. QSaveFile(const QString &name, QObject *parent /TransferThis/ = 0);
  29. %End
  30. explicit QSaveFile(QObject *parent /TransferThis/ = 0);
  31. %If (- Qt_6_11_0)
  32. explicit QSaveFile(const QString &name);
  33. %End
  34. %If (- Qt_6_11_0)
  35. QSaveFile(const QString &name, QObject *parent /TransferThis/);
  36. %End
  37. virtual ~QSaveFile();
  38. virtual QString fileName() const;
  39. void setFileName(const QString &name);
  40. virtual bool open(QIODeviceBase::OpenMode flags) /ReleaseGIL/;
  41. bool commit();
  42. void cancelWriting();
  43. void setDirectWriteFallback(bool enabled);
  44. bool directWriteFallback() const;
  45. protected:
  46. virtual qint64 writeData(SIP_PYBUFFER) /ReleaseGIL/ [qint64 (const char *data, qint64 len)];
  47. %MethodCode
  48. sipBufferInfoDef bi;
  49. if (sipGetBufferInfo(a0, &bi) > 0)
  50. {
  51. Py_BEGIN_ALLOW_THREADS
  52. #if defined(SIP_PROTECTED_IS_PUBLIC)
  53. sipRes = sipSelfWasArg ?
  54. sipCpp->QSaveFile::writeData(reinterpret_cast<char *>(bi.bi_buf), bi.bi_len) :
  55. sipCpp->writeData(reinterpret_cast<char *>(bi.bi_buf), bi.bi_len);
  56. #else
  57. sipRes = sipCpp->sipProtectVirt_writeData(sipSelfWasArg, reinterpret_cast<char *>(bi.bi_buf),
  58. bi.bi_len);
  59. #endif
  60. Py_END_ALLOW_THREADS
  61. sipReleaseBufferInfo(&bi);
  62. }
  63. else
  64. {
  65. sipIsErr = 1;
  66. }
  67. %End
  68. private:
  69. virtual void close();
  70. };