qbitarray.sip 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. // qbitarray.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 QBitArray
  22. {
  23. %TypeHeaderCode
  24. #include <qbitarray.h>
  25. %End
  26. %TypeCode
  27. // This is needed by __hash__().
  28. #include <qhash.h>
  29. %End
  30. public:
  31. QBitArray();
  32. QBitArray(qsizetype size, bool value = false);
  33. QBitArray(const QBitArray &other);
  34. qsizetype size() const;
  35. qsizetype count() const /__len__/;
  36. qsizetype count(bool on) const;
  37. bool isEmpty() const;
  38. bool isNull() const;
  39. void resize(qsizetype size);
  40. void detach();
  41. bool isDetached() const;
  42. void clear();
  43. QBitArray &operator&=(const QBitArray &);
  44. QBitArray &operator|=(const QBitArray &);
  45. QBitArray &operator^=(const QBitArray &);
  46. %If (- Qt_6_7_0)
  47. // This was changed to be a global operator in Qt v6.7 but this isn't supported by SIP v6.8.
  48. QBitArray operator~() const;
  49. %End
  50. %If (- Qt_6_8_0)
  51. bool operator==(const QBitArray &a) const;
  52. %End
  53. %If (- Qt_6_8_0)
  54. bool operator!=(const QBitArray &a) const;
  55. %End
  56. void fill(bool val, qsizetype first, qsizetype last);
  57. bool fill(bool val, qsizetype size = -1);
  58. void truncate(qsizetype pos);
  59. bool testBit(qsizetype i) const;
  60. void setBit(qsizetype i);
  61. void setBit(qsizetype i, bool val);
  62. void clearBit(qsizetype i);
  63. bool toggleBit(qsizetype i);
  64. bool operator[](qsizetype i) const;
  65. bool at(qsizetype i) const;
  66. Py_hash_t __hash__() const;
  67. %MethodCode
  68. sipRes = qHash(*sipCpp);
  69. %End
  70. void swap(QBitArray &other /Constrained/);
  71. SIP_PYOBJECT bits() const /TypeHint="bytes"/;
  72. %MethodCode
  73. return PyBytes_FromStringAndSize(sipCpp->bits(), (sipCpp->size() + 7) / 8);
  74. %End
  75. static QBitArray fromBits(const char *data /Encoding="None"/, Py_ssize_t len) [QBitArray (const char *data, qsizetype len)];
  76. quint32 toUInt32(QSysInfo::Endian endianness, bool *ok = 0) const;
  77. };
  78. QBitArray operator&(const QBitArray &, const QBitArray &);
  79. QBitArray operator|(const QBitArray &, const QBitArray &);
  80. QBitArray operator^(const QBitArray &, const QBitArray &);
  81. QDataStream &operator<<(QDataStream &, const QBitArray &) /ReleaseGIL/;
  82. QDataStream &operator>>(QDataStream &, QBitArray & /Constrained/) /ReleaseGIL/;
  83. %If (Qt_6_8_0 -)
  84. bool operator!=(const QBitArray &lhs, const QBitArray &rhs);
  85. %End
  86. %If (Qt_6_8_0 -)
  87. bool operator==(const QBitArray &lhs, const QBitArray &rhs);
  88. %End