Commit 012c6a96 authored by EXT Arnaud Clère's avatar EXT Arnaud Clère

Fixed potentially implicit bool conversions from fluent interface

parent 40d873d9
......@@ -259,7 +259,7 @@ public:
explicit QValueStatus(QAbstractValue* i) : impl(i) { Q_ASSERT(impl); }
QValueMode mode() const noexcept { return impl ? impl->mode() : QValueMode::Invalid; }
operator bool() const noexcept { return impl && impl->isValid(); } //!< Drives QTransmogrifier<T>::bind() traversal
explicit operator bool() const noexcept { return impl && impl->isValid(); } //!< Drives QTransmogrifier<T>::bind() traversal
QValueStatus* operator ->() noexcept { return this; }
QVal<QValueStatus> value() noexcept ;
......@@ -332,7 +332,7 @@ public:
Q_ENABLE_MOVE_DEFAULT(QVal)
explicit QVal(T_&& out) noexcept { std::swap(outer, out); }
operator bool() const noexcept { return outer.operator bool(); } //!< Drives QTransmogrifier<T>::bind() traversal
explicit operator bool() const noexcept { return outer.operator bool(); } //!< Drives QTransmogrifier<T>::bind() traversal
QValueStatus* operator->() noexcept { return outer.operator ->(); }
QVal<T_> meta (QIdentifierLiteral& n, QAsciiData& m) { outer->_meta(n,m); return std::move(*this); }
......@@ -381,7 +381,7 @@ public:
Q_ENABLE_MOVE_DEFAULT(QSeq)
explicit QSeq(T_&& out) noexcept { std::swap(outer, out); }
operator bool() const noexcept { return outer.operator bool(); } //!< Drives QTransmogrifier<T>::bind() traversal
explicit operator bool() const noexcept { return outer.operator bool(); } //!< Drives QTransmogrifier<T>::bind() traversal
QValueStatus* operator->() noexcept { return outer.operator ->(); }
operator QValueStatus() { return out(); /* calls T_::operator QValueStatus() if T_ != QValueStatus */ }
......@@ -426,7 +426,7 @@ public:
Q_ENABLE_MOVE_DEFAULT(QRec)
explicit QRec(T_&& out) noexcept { std::swap(outer, out); }
operator bool() const noexcept { return outer.operator bool(); } //!< Drives QTransmogrifier<T>::bind() traversal
explicit operator bool() const noexcept { return outer.operator bool(); } //!< Drives QTransmogrifier<T>::bind() traversal
QValueStatus* operator->() noexcept { return outer.operator ->(); }
operator QValueStatus() { return out(); /* calls T_::operator QValueStatus() if T_ != QValueStatus */ }
......@@ -479,7 +479,7 @@ struct QTransmogrifier {
};
template<class T>
bool QValueStatus::tryBind(BindGeneric, T&& t) { return QTransmogrifier<RemoveCvRef<T>>::zap(QValue(_unsafeCopy()),std::forward<T>(t)); }
bool QValueStatus::tryBind(BindGeneric, T&& t) { return bool(QTransmogrifier<RemoveCvRef<T>>::zap(QValue(_unsafeCopy()),std::forward<T>(t))); }
// //////////////////////////////////////////////////////////////////////////
// Base QAbstractValue implementations for Read and Write QValueMode
......@@ -937,9 +937,6 @@ struct QTransmogrifier<QDefaultValue<T>> {
return r;
}
}
static QValueStatus zap(QValue&& v, QDefaultValue<T>& t) {
return bind(std::move(v),std::move(t));
}
};
template<typename T>
......
......@@ -46,7 +46,7 @@
// Extensible set of QAbstractValue implementations providing concrete syntax to the logical data structure in a specific Mode among Write, Read, ...
#include "QJson_impl.h" // QJsonWriter, QJsonReader, QJsonBuilder, QJsonVisitor and QTransmogrifier<QJsonValue,_> support
#include "QJson_impl.h" // QJsonWriter, QJsonReader, QJsonBuilder, QJsonVisitor and QTransmogrifier<QJsonValue> support
#include "QCbor_impl.h" // QCborWriter demonstrating the performance potential of the approach
#include "QData_impl.h" // QDataReader, QDataWriter demonstrating a QDataStream with implicit types for benchmarking
#include "QVariant_impl.h" // QVariantBuilder, QVariantVisitor and QTransmogrifier<QVariant,_> support
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment