From 0a568e9420feb75aa006a134ca78ec4238358552 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Wed, 16 Mar 2016 12:18:57 +0100 Subject: [PATCH] QUrl documentation: fix clang parsing QUrl::FormattingOptions need to be declared with Q_DECLARE_FLAGS for documentation purposes. But it's actually a QUrlTwoFlags and need to be so in order to get the default arguments parsed without errors. So hack it by introducing a fake internal QFlags specific to QUrl Change-Id: I851aca2ab3fd4c10d9cb2dc4d6a0f236813d20ad Reviewed-by: Martin Smith --- src/corelib/io/qurl.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/corelib/io/qurl.h b/src/corelib/io/qurl.h index d9d4fd906a..a6dc66d457 100644 --- a/src/corelib/io/qurl.h +++ b/src/corelib/io/qurl.h @@ -164,6 +164,12 @@ public: }; Q_DECLARE_FLAGS(ComponentFormattingOptions, ComponentFormattingOption) #ifdef Q_QDOC +private: + // We need to let qdoc think that FormattingOptions is a normal QFlags, but + // it needs to be a QUrlTwoFlags for compiling default arguments of somme functions. + template struct QFlags : QUrlTwoFlags + { using QUrlTwoFlags::QUrlTwoFlags; }; +public: Q_DECLARE_FLAGS(FormattingOptions, UrlFormattingOption) #else typedef QUrlTwoFlags FormattingOptions; @@ -372,6 +378,7 @@ Q_DECLARE_SHARED(QUrl) Q_DECLARE_OPERATORS_FOR_FLAGS(QUrl::ComponentFormattingOptions) //Q_DECLARE_OPERATORS_FOR_FLAGS(QUrl::FormattingOptions) +#ifndef Q_QDOC Q_DECL_CONSTEXPR inline QUrl::FormattingOptions operator|(QUrl::UrlFormattingOption f1, QUrl::UrlFormattingOption f2) { return QUrl::FormattingOptions(f1) | f2; } Q_DECL_CONSTEXPR inline QUrl::FormattingOptions operator|(QUrl::UrlFormattingOption f1, QUrl::FormattingOptions f2) @@ -399,6 +406,7 @@ Q_DECL_CONSTEXPR inline QUrl::FormattingOptions operator|(QUrl::ComponentFormatt //inline QUrl::UrlFormattingOption &operator=(const QUrl::UrlFormattingOption &i, QUrl::ComponentFormattingOptions f) //{ i = int(f); f; } +#endif // Q_QDOC #ifndef QT_NO_DATASTREAM Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QUrl &);