qurl.sip 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. // qurl.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 QUrl
  22. {
  23. %TypeHeaderCode
  24. #include <qurl.h>
  25. %End
  26. %TypeCode
  27. #include <QHash>
  28. %End
  29. public:
  30. enum ParsingMode
  31. {
  32. TolerantMode,
  33. StrictMode,
  34. DecodedMode,
  35. };
  36. QUrl();
  37. QUrl(const QString &url, QUrl::ParsingMode mode = QUrl::TolerantMode);
  38. QUrl(const QUrl &copy);
  39. ~QUrl();
  40. Py_hash_t __hash__() const;
  41. %MethodCode
  42. sipRes = qHash(*sipCpp);
  43. %End
  44. SIP_PYOBJECT __repr__() const /TypeHint="str"/;
  45. %MethodCode
  46. PyObject *uni = qpycore_PyObject_FromQString(sipCpp->toString());
  47. if (uni)
  48. {
  49. sipRes = PyUnicode_FromFormat("PyQt6.QtCore.QUrl(%R)", uni);
  50. Py_DECREF(uni);
  51. }
  52. %End
  53. enum UrlFormattingOption /BaseType=IntFlag/
  54. {
  55. None,
  56. RemoveScheme,
  57. RemovePassword,
  58. RemoveUserInfo,
  59. RemovePort,
  60. RemoveAuthority,
  61. RemovePath,
  62. RemoveQuery,
  63. RemoveFragment,
  64. PreferLocalFile,
  65. StripTrailingSlash,
  66. RemoveFilename,
  67. NormalizePathSegments,
  68. };
  69. typedef QFlags<QUrl::UrlFormattingOption> FormattingOptions;
  70. enum ComponentFormattingOption /BaseType=IntFlag/
  71. {
  72. PrettyDecoded,
  73. EncodeSpaces,
  74. EncodeUnicode,
  75. EncodeDelimiters,
  76. EncodeReserved,
  77. DecodeReserved,
  78. FullyEncoded,
  79. FullyDecoded,
  80. };
  81. typedef QFlags<QUrl::ComponentFormattingOption> ComponentFormattingOptions;
  82. QString url(QUrl::FormattingOptions options = QUrl::FormattingOptions(QUrl::PrettyDecoded)) const;
  83. void setUrl(const QString &url, QUrl::ParsingMode mode = QUrl::TolerantMode);
  84. bool isValid() const;
  85. bool isEmpty() const;
  86. void clear();
  87. void setScheme(const QString &scheme);
  88. QString scheme() const;
  89. void setAuthority(const QString &authority, QUrl::ParsingMode mode = QUrl::TolerantMode);
  90. QString authority(QUrl::ComponentFormattingOptions options = QUrl::PrettyDecoded) const;
  91. void setUserInfo(const QString &userInfo, QUrl::ParsingMode mode = QUrl::TolerantMode);
  92. QString userInfo(QUrl::ComponentFormattingOptions options = QUrl::PrettyDecoded) const;
  93. void setUserName(const QString &userName, QUrl::ParsingMode mode = QUrl::DecodedMode);
  94. QString userName(QUrl::ComponentFormattingOptions options = QUrl::FullyDecoded) const;
  95. void setPassword(const QString &password, QUrl::ParsingMode mode = QUrl::DecodedMode);
  96. QString password(QUrl::ComponentFormattingOptions options = QUrl::FullyDecoded) const;
  97. void setHost(const QString &host, QUrl::ParsingMode mode = QUrl::DecodedMode);
  98. QString host(QUrl::ComponentFormattingOptions = QUrl::FullyDecoded) const;
  99. void setPort(int port);
  100. int port(int defaultPort = -1) const;
  101. void setPath(const QString &path, QUrl::ParsingMode mode = QUrl::DecodedMode);
  102. QString path(QUrl::ComponentFormattingOptions options = QUrl::FullyDecoded) const;
  103. void setFragment(const QString &fragment, QUrl::ParsingMode mode = QUrl::TolerantMode);
  104. QString fragment(QUrl::ComponentFormattingOptions options = QUrl::PrettyDecoded) const;
  105. QUrl resolved(const QUrl &relative) const;
  106. bool isRelative() const;
  107. bool isParentOf(const QUrl &url) const;
  108. static QUrl fromLocalFile(const QString &localfile);
  109. QString toLocalFile() const;
  110. QString toString(QUrl::FormattingOptions options = QUrl::FormattingOptions(QUrl::PrettyDecoded)) const;
  111. QString toString(QUrl::ComponentFormattingOptions options) const;
  112. QByteArray toEncoded(QUrl::FormattingOptions options = QUrl::FullyEncoded) const;
  113. QByteArray toEncoded(QUrl::ComponentFormattingOptions options) const;
  114. %If (Qt_6_7_0 -)
  115. static QUrl fromEncoded(QByteArrayView input, QUrl::ParsingMode mode = QUrl::TolerantMode);
  116. %End
  117. %If (- Qt_6_7_0)
  118. static QUrl fromEncoded(const QByteArray &u, QUrl::ParsingMode mode = QUrl::TolerantMode);
  119. %End
  120. void detach();
  121. bool isDetached() const;
  122. %If (- Qt_6_8_0)
  123. bool operator<(const QUrl &url) const;
  124. %End
  125. %If (- Qt_6_8_0)
  126. bool operator==(const QUrl &url) const;
  127. %End
  128. %If (- Qt_6_8_0)
  129. bool operator!=(const QUrl &url) const;
  130. %End
  131. static QString fromPercentEncoding(const QByteArray &);
  132. static QByteArray toPercentEncoding(const QString &input, const QByteArray &exclude = QByteArray(), const QByteArray &include = QByteArray());
  133. bool hasQuery() const;
  134. bool hasFragment() const;
  135. QString errorString() const;
  136. %If (Qt_6_3_0 -)
  137. static QString fromAce(const QByteArray &domain, QUrl::AceProcessingOptions options = {});
  138. %End
  139. %If (- Qt_6_3_0)
  140. static QString fromAce(const QByteArray &);
  141. %End
  142. %If (Qt_6_3_0 -)
  143. static QByteArray toAce(const QString &domain, QUrl::AceProcessingOptions options = {});
  144. %End
  145. %If (- Qt_6_3_0)
  146. static QByteArray toAce(const QString &);
  147. %End
  148. static QStringList idnWhitelist();
  149. static void setIdnWhitelist(const QStringList &);
  150. static QUrl fromUserInput(const QString &userInput, const QString &workingDirectory = QString(), QUrl::UserInputResolutionOptions options = QUrl::DefaultResolution);
  151. void swap(QUrl &other /Constrained/);
  152. bool isLocalFile() const;
  153. QString toDisplayString(QUrl::FormattingOptions options = QUrl::FormattingOptions(QUrl::PrettyDecoded)) const;
  154. QString toDisplayString(QUrl::ComponentFormattingOptions options) const;
  155. void setQuery(const QString &query, QUrl::ParsingMode mode = QUrl::TolerantMode);
  156. void setQuery(const QUrlQuery &query);
  157. QString query(QUrl::ComponentFormattingOptions options = QUrl::PrettyDecoded) const;
  158. static QStringList toStringList(const QList<QUrl> &uris, QUrl::FormattingOptions options = QUrl::FormattingOptions(QUrl::PrettyDecoded));
  159. static QList<QUrl> fromStringList(const QStringList &uris, QUrl::ParsingMode mode = QUrl::TolerantMode);
  160. QUrl adjusted(QUrl::FormattingOptions options) const;
  161. QString fileName(QUrl::ComponentFormattingOptions options = QUrl::FullyDecoded) const;
  162. bool matches(const QUrl &url, QUrl::FormattingOptions options) const;
  163. enum UserInputResolutionOption /BaseType=Flag/
  164. {
  165. DefaultResolution,
  166. AssumeLocalFile,
  167. };
  168. typedef QFlags<QUrl::UserInputResolutionOption> UserInputResolutionOptions;
  169. %If (Qt_6_3_0 -)
  170. enum AceProcessingOption /BaseType=Flag/
  171. {
  172. IgnoreIDNWhitelist,
  173. AceTransitionalProcessing,
  174. };
  175. %End
  176. %If (Qt_6_3_0 -)
  177. typedef QFlags<QUrl::AceProcessingOption> AceProcessingOptions;
  178. %End
  179. };
  180. QDataStream &operator<<(QDataStream &, const QUrl &) /ReleaseGIL/;
  181. QDataStream &operator>>(QDataStream &, QUrl & /Constrained/) /ReleaseGIL/;
  182. %If (Qt_6_8_0 -)
  183. bool operator>=(const QUrl &lhs, const QUrl &rhs);
  184. %End
  185. %If (Qt_6_8_0 -)
  186. bool operator<=(const QUrl &lhs, const QUrl &rhs);
  187. %End
  188. %If (Qt_6_8_0 -)
  189. bool operator>(const QUrl &lhs, const QUrl &rhs);
  190. %End
  191. %If (Qt_6_8_0 -)
  192. bool operator<(const QUrl &lhs, const QUrl &rhs);
  193. %End
  194. %If (Qt_6_8_0 -)
  195. bool operator!=(const QUrl &lhs, const QUrl &rhs);
  196. %End
  197. %If (Qt_6_8_0 -)
  198. bool operator==(const QUrl &lhs, const QUrl &rhs);
  199. %End