summaryrefslogtreecommitdiffstats
path: root/src/network/kernel/qhostinfo.h
Commit message (Collapse)AuthorAgeFilesLines
* QHostInfo: fix lookupHost() signature immediatelyMarc Mutz2024-01-231-1/+4
| | | | | | | | | | | | | | | ... and not just for Qt 7. Found in API-Review. Amends dd50d58af267bd3b79d1ca31b920d72b925d5a37. [ChangeLog][QtNetwork][QHostInfo] The lookupHost() static function now takes const QObject* receivers (was: (non-const) QObject*). Pick-to: 6.7 Change-Id: I22b11e06cfba4e96975239cabed8b379cf3f4fa4 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QHostInfo: add a Qt 7 noteGiuseppe D'Angelo2023-09-061-1/+1
| | | | | Change-Id: I45ee4eba1f7ded358acaccf678e4e12a006b91b6 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QHostInfo::lookupHost: enable QT_NO_CONTEXTLESS_CONNECTGiuseppe D'Angelo2023-09-051-0/+2
| | | | | | | | | | | | QHostInfo::lookupHost uses some QObject private APIs in order to have a invoke a slot/function when the lookup is finished. The overload that simply takes a function (and not a context object) was still available even under QT_NO_CONTEXTLESS_CONNECT, because indeed the implementation bypasses the public QObject::connect API. Hence, explicitly the overload that doesn't take a context object. Change-Id: Ibf5b0efc49b7f9c8d045862ae061f4e05ee1b769 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Rename QFunctorSlotObject to QCallableObjectVolker Hilsheimer2023-05-101-1/+1
| | | | | | | | | | | | | | After the recent changes we only have a single implementation of QSlotObjectBase, which can handle free functions, member functions, functors, and lambdas. Rename it to callable, and explicitly hide the static implementation function so that it doesn't become a symbol of static libraries using Qt. Also rename makeSlotObject to makeCallableObject, and polish coding style and comments in the qobjectdefs_impl header a bit. Change-Id: Id19107cedfe9c624f807cd8089beb80e9eb99f50 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Add a helper for better error messages when functor is incompatibleVolker Hilsheimer2023-04-281-0/+1
| | | | | | | | | | | | Amends 207aae5560aa2865ec55ddb9ecbb50048060c0c0 to make it easy to create human-friendly error messages. Since the functor-accepting member functions are not removed from the API, the first compile error will be that there is no suitable overload of the makeSlotObject helper, which. With the assert helper, the first error message is easier to understand. Change-Id: I4878ec35a44ddfa5dc9d9e358d81c3fd40389c0c Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Support free functions and const functors as callbacksVolker Hilsheimer2023-04-281-4/+4
| | | | | | | | | | | | | | | | | | Amend 207aae5560aa2865ec55ddb9ecbb50048060c0c0, as code checker complained that we std::move'd a potential lvalue. This warning was valid if the public API did not accept the functor parameter by value. Fix this by consistently std::forward'ing the parameters through the call stack, and add a compile-time test. Writing that test revealed that the helper API didn't work with free functions, so fix that as well. It also revealed that QFunctorSlotObject couldn't work with a const functor, which is also fixed by this change. We cannot support move-only functors with that change, as it requires a change to QFunctorSlotObject that breaks the QMetaObject test. Change-Id: Iafd747baf4cb0213ecedb391ed46b4595388182b Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Simplify the creation of APIs that take a callbackVolker Hilsheimer2023-04-261-43/+11
| | | | | | | | | | | | | | | | | | | | | | | Functions in Qt that take a callback need to support callables with or without context objects, and member functions of an object. The implementation of those overloads follows a pattern that ultimately results in a QSlotObjectBase implementation being created and passed to an implementation helper that takes care of the logic. Factor that common pattern into a new helper template in QtPrivate that returns a suitable QSlotObjectBase after checking that the functor is compatible with the specified argument types. Use that new helper template in the implementation of QCoreApplication::requestPermission and QHostInfo::lookupHost. The only disadvantage of centralizing this logic is that we cannot print a more detailed error message indicating which argument types the caller expects. However, that information is visible from the detailed compiler errors anyway. Change-Id: I24cf0b2442217857b96ffc4d2d6c997c4fae34e0 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Replace usages of Q_CLANG_QDOC with Q_QDOCLuca Di Sera2022-10-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | | To allow the user to customize the C++ code that QDoc sees, so as to be able to work-around some limitations on QDoc itself, QDoc defines two symbols: Q_QDOC and Q_CLANG_QDOC, both of which are "true" during an entire execution of QDoc. At a certain point in time, QDoc allowed the user the choice between a custom C++ parser and a Clang based one. The Q_QDOC symbol would always be defined while the Q_CLANG_QDOC symbol would be defined only when the Clang based parser was chosen. In more recent times, QDoc always uses a Clang based parser, such that both Q_CLANG_QDOC and Q_QDOC are always defined, making them equivalent. To avoid using different symbols, and the possible confusion and fragmentation that derives from it, all usages of Q_CLANG_QDOC are now replaced by the equivalent usages of Q_QDOC. Change-Id: I5810abb9ad1016a4c5bbea99acd03381b8514b3f Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* Replace qExchange calls with std::exchangeFabian Kosmale2022-09-281-1/+1
| | | | | | | | | | | | | | | | | | | | | qExchange is one of the few remaining functionalities that have not been moved out of qglobal. Given that std::exchange exists in the standard, we can simply move to it everywhere... ...if it weren't for the fact that std::exchange is only constexpr in C++20, and only has its noexceptness specified in (most likely) C++23. Still, we want to move to the existing std functionality where possible, to allow the removal of qglobal includes in lieu of something more fine-grained in the future. So leave any constexpr calls[1] alone for now (and observe that none of our current usages cares about the conditional noexceptness), but replace everything else. [1] QScopedValueRollback' ctor and QExplicitlySharedDataPointerV2::take Task-number: QTBUG-99313 Change-Id: I599cb9846cf319c7ffd3457130938347a75aad25 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Use SPDX license identifiersLucie Gérard2022-05-161-38/+2
| | | | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Task-number: QTBUG-67283 Change-Id: Id880c92784c40f3bbde861c0d93f58151c18b9f1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* QtNetwork: sweep Q_DECLARE_METATYPE → QT_DECL_METATYPE_EXTERN [1/2]: ↵Marc Mutz2022-04-051-1/+1
| | | | | | | | | | | | | | public API It's one of our best tools to improve compile times. Can't backport to Qt 6.3 or 6.2 because this change introduces new exported symbols. Task-number: QTBUG-102206 Change-Id: I6bfa532be34ca847d3b9034d16c94efed3d602c3 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* QtNetwork: compile-optimize inline swap functionsMarc Mutz2022-03-171-1/+1
| | | | | | | | | | | | | | | | | | Instead of using the overly-generic qSwap() monster, use - qt_ptr_swap() for swapping raw pointers - member-swap for swapping smart pointers - std::swap() for swapping scalars In QtCore, this has proven to give a nice reduction in compile time for Qt users, cf. b1b0c2970e480ef460a61f37fa430dc443390358. Pick-to: 6.3 6.2 Task-number: QTBUG-97601 Change-Id: I26586da1f158fe6b18314abd8cf9bb040bc9cad1 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QHostInfo: address a Qt 6 todoMårten Nordheim2020-08-241-3/+7
| | | | | | | | Merged the two functions, required adding a friend declaration Change-Id: I86265da19e4b5f53d9e2dc54de3e252f0364225b Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Port Q_STATIC_ASSERT(_X) to static_assertGiuseppe D'Angelo2020-06-191-4/+4
| | | | | | | | | | | | | | | | | There is no reason for keep using our macro now that we have C++17. The macro itself is left in for the moment being, as well as its detection logic, because it's needed for C code (not everything supports C11 yet). A few more cleanups will arrive in the next few patches. Note that this is a mere search/replace; some places were using double braces to work around the presence of commas in a macro, no attempt has been done to fix those. tst_qglobal had just some minor changes to keep testing the macro. Change-Id: I1c1c397d9f3e63db3338842bf350c9069ea57639 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Sweep Q_DECLARE_SHARED_NOT_MOVABLE_UNTIL_QT6 -> Q_DECLARE_SHAREDMarc Mutz2020-05-191-1/+1
| | | | | | | | | | | | This is Qt 6, so Q_DECLARE_SHARED_NOT_MOVABLE_UNTIL_QT6 is the same as Q_DECLARE_SHARED. Let's hope we'll collectively get better at detecting missing Q_DECLARE_SHARED so we won't need a Q_DECLARE_SHARED_NOT_MOVABLE_UNTIL_QT7 in the future. Change-Id: I3da9faff4c66b64a3b257309012a2a10a6c6d027 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QHostInfo: add nothrow move constructorMarc Mutz2019-07-181-2/+4
| | | | | | | | | | | | | | QHostInfo isn't implicitly shared. The more important to optimize away copies by providing a move constructor. Port from QScopedPointer to Q_DECLARE_PRIVATE, as otherwise the move ctor can't be inline, and we don't implement move ctors out-of-line in Qt. [ChangeLog][QtNetwork][QHostInfo] Added move contructor. Change-Id: I6b63a04e36f63e299205830fdc590ff7e2af338b Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Remove remaining Q_DECL_NOEXCEPT/Q_DECL_NOTHROW usageAllan Sandfeld Jensen2019-04-041-2/+2
| | | | | Change-Id: I91ac9e714a465cab226b211812aa46e8fe5ff2ab Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* doc: Fix all clang parse errors in QtBase during PCH buildMartin Smith2018-11-051-5/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This update eliminates ALL parsing errors when clang parses the Qt headers to build the precompiled header qdoc needs. These errors are often cases where an old use of Q_QDOC no longer works because clang sees the enclosed fake declarations as erroneous. In a few cases, clang reported errors because two dummy function declartations under the Q_CLANG_QDOC guard were indistinguishable, so one of them was removed, and the documentation was patched accordingly. Using the macro Q_DECLARE_INTERFACE(...) causes clang to report errors because the class parametewr is abstract. These uses of the macro are not needed, so they are removed with #ifndef Q_CLANG_QDOC. Some declarations of default GL types that had been provided for qdoc were no longer needed, so they are removed. Now there are some member function signatures in QDBusPendingReply and QDBusPendingCall that have very long template clauses and qualifiers in their signatures. These unwieldy signatures will be unnecessary in the documentation and will look bad there, but for now they are correct. The ultimate solution will be to add a metacommand to qdoc, something like \simplify-signature to tell qdoc to generate the documentation for these member functions without the long template caluses and qualifiers. Change-Id: I012cf17a544fbba2ebc71002f31bdc865119bb8e Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Topi Reiniö <topi.reinio@qt.io> Reviewed-by: Martin Smith <martin.smith@qt.io>
* doc: Add template clauses in qhostinfo.cppMartin Smith2018-01-121-1/+1
| | | | | | | | | | A few \fn commands were missing the template clause now required by clang-qdoc. This update adds the template clauses. It also changes an instance of Q_QDOC to Q_CLANG_QDOC. Change-Id: I2850d43d98debb80e01c36a524e0c00651a89298 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* Add swap and move operator to QHostInfoJesus Fernandez2017-05-161-0/+5
| | | | | | | | | | Also mark as shared-come-qt6, [ChangeLog][QtNetwork][QHostInfo] Added swap() and move operator. Change-Id: I8f422868f0487a37aeba3bc74685dc4912e9b3a4 Coverity-Id: 168204 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* Add a few std::move in functions accepting slotsOlivier Goffart2017-04-291-2/+2
| | | | | | | | This allows the use of move-only function objects Task-number: QTBUG-60339 Change-Id: If3595fca338cf7f3039eb566cc02e4e73cd04c86 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Add QHostInfo::lookupHost overload with modern connect syntaxJesus Fernandez2017-01-241-0/+63
| | | | | | Task-number: QTBUG-56424 Change-Id: I49053ac2859e6c6c07e4a704b8b5f0d6a2d0b8a4 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Add qtnetworkglobal.h and qtnetworkglobal_p.hLars Knoll2016-07-031-0/+1
| | | | | | | | | | | | | The new modular configuration system requires one global header per module, that is included by all other files in this module. That header will later on #include the configuration file for Qt Network. For now it defines the Q_NETWORK_EXPORT macro for this library. Change-Id: I9c45d425baf881c431ed71fd457c7feb2c123855 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
* Updated license headersJani Heikkinen2016-01-151-14/+20
| | | | | | | | | | | From Qt 5.7 -> LGPL v2.1 isn't an option anymore, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new LGPL header instead of LGPL21 one (in those files which will be under LGPL v3) Change-Id: I046ec3e47b1876cd7b4b0353a576b352e3a946d9 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Update copyright headersJani Heikkinen2015-02-111-7/+7
| | | | | | | | | | | | | | | | | | Qt copyrights are now in The Qt Company, so we could update the source code headers accordingly. In the same go we should also fix the links to point to qt.io. Outdated header.LGPL removed (use header.LGPL21 instead) Old header.LGPL3 renamed to header.LGPL3-COMM to match actual licensing combination. New header.LGPL-COMM taken in the use file which were using old header.LGPL3 (src/plugins/platforms/android/extract.cpp) Added new header.LGPL3 containing Commercial + LGPLv3 + GPLv2 license combination Change-Id: I6f49b819a8a20cc4f88b794a8f6726d975e8ffbe Reviewed-by: Matti Paaso <matti.paaso@theqtcompany.com>
* Update license headers and add new license filesMatti Paaso2014-09-241-19/+11
| | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 - Removed LICENSE.GPL Change-Id: Iec3406e3eb3f133be549092015cefe33d259a3f2 Reviewed-by: Iikka Eklund <iikka.eklund@digia.com>
* Remove QT_{BEGIN,END}_HEADER macro usageSergio Ahumada2013-01-291-4/+0
| | | | | | | | | | | The macro was made empty in ba3dc5f3b56d1fab6fe37fe7ae08096d7dc68bcb and is no longer necessary or used. Discussed-on: http://lists.qt-project.org/pipermail/development/2013-January/009284.html Change-Id: Id2bb2e2cabde059305d4af5f12593344ba30f001 Reviewed-by: Laszlo Papp <lpapp@kde.org> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com> Reviewed-by: hjk <hjk121@nokiamail.com>
* Update copyright year in Digia's license headersSergio Ahumada2013-01-181-1/+1
| | | | | Change-Id: Ic804938fc352291d011800d21e549c10acac66fb Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Change copyrights from Nokia to DigiaIikka Eklund2012-09-221-24/+24
| | | | | | | | Change copyrights and license headers from Nokia to Digia Change-Id: If1cc974286d29fd01ec6c19dd4719a67f4c3f00e Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
* QtNetwork: use nullary version of qRegisterMetaType<T>("T")Marc Mutz2012-07-251-0/+2
| | | | | | | | | | | | | | | | | Using the nullary version has the advantage that multiple calls during a program run are much more efficient, since an inlined atomic is used to store the result. It also ensures that Q_DECLARE_METATYPE(T) has been used, whereas qRegisterMetaType<T>("T") will happily register anything. So I've added the macro where it was missing, or moved it to a central place when it existed hidden. In tst_qnetworkreply, this became a bit tricky, because a private header is conditionally included, so moved the Q_DECLARE_METATYPE() into a conditional section, too. Change-Id: I71484523e4277f4697b7d4b2ddc3505375162727 Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
* QtNetwork: make some constructors explicitMarc Mutz2012-03-141-1/+1
| | | | | | | | | | This is a semi-automatic search, so I'm reasonably sure that all the exported ones have been caught. Change-Id: Ia00eb9194a5f64002bd7e7b894abf6333d1b825e Reviewed-by: Jonas Gastal <jgastal@profusion.mobi> Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
* Remove "All rights reserved" line from license headers.Jason McDonald2012-01-301-1/+1
| | | | | | | | | | As in the past, to avoid rewriting various autotests that contain line-number information, an extra blank line has been inserted at the end of the license text to ensure that this commit does not change the total number of lines in the license header. Change-Id: I311e001373776812699d6efc045b5f742890c689 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Remove use of QT_MODULE from libraryGunnar Sletta2012-01-251-1/+0
| | | | | | | | | | These defines were there to aid in the commercial licensing scheme we used long ago, and are no longer needed. Keep a QT_MODULE(x) define so other modules continue compiling. Change-Id: I8fd76cd5270df8f14aee746b6cf32ebf7c23fec7 Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Update contact information in license headers.Jason McDonald2012-01-231-1/+1
| | | | | | | Replace Nokia contact email address with Qt Project website. Change-Id: I431bbbf76d7c27d8b502f87947675c116994c415 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Update copyright year in license headers.Jason McDonald2012-01-051-1/+1
| | | | | Change-Id: I02f2c620296fcd91d4967d58767ea33fc4e1e7dc Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Update licenseheader text in source files for qtbase Qt moduleJyri Tahtela2011-05-241-17/+17
| | | | | | | Updated version of LGPL and FDL licenseheaders. Apply release phase licenseheaders for all source files. Reviewed-by: Trust Me
* Initial import from the monolithic Qt.Qt by Nokia2011-04-271-0/+102
This is the beginning of revision history for this module. If you want to look at revision history older than this, please refer to the Qt Git wiki for how to use Git history grafting. At the time of writing, this wiki is located here: http://qt.gitorious.org/qt/pages/GitIntroductionWithQt If you have already performed the grafting and you don't see any history beyond this commit, try running "git log" with the "--follow" argument. Branched from the monolithic repo, Qt master branch, at commit 896db169ea224deb96c59ce8af800d019de63f12