Inline QPropertyBindingDataPointer

The only non-inline function of that class was observerCount() which
would use two of the inline functions defined in the header file, so
we can safely inline observerCount() and make the whole class contain
only inline methods

Consequently, inline class doesn't have to be exported in Windows

Change-Id: I41d144d9a50420bbc0091992b36cc36ac2567704
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
This commit is contained in:
Andrei Golubev 2021-10-29 16:20:28 +02:00
parent 7cb2159388
commit b01f08033b
2 changed files with 12 additions and 11 deletions

View File

@ -608,13 +608,6 @@ QPropertyBindingData::NotificationResult QPropertyBindingData::notifyObserver_he
return Evaluated;
}
int QPropertyBindingDataPointer::observerCount() const
{
int count = 0;
for (auto observer = firstObserver(); observer; observer = observer.nextObserver())
++count;
return count;
}
QPropertyObserver::QPropertyObserver(ChangeHandler changeHandler)
{

View File

@ -68,7 +68,7 @@ namespace QtPrivate {
// we need to allow the compiler to inline where it makes sense.
// This is a helper "namespace"
struct Q_AUTOTEST_EXPORT QPropertyBindingDataPointer
struct QPropertyBindingDataPointer
{
const QtPrivate::QPropertyBindingData *ptr = nullptr;
@ -85,10 +85,10 @@ struct Q_AUTOTEST_EXPORT QPropertyBindingDataPointer
}
static void fixupAfterMove(QtPrivate::QPropertyBindingData *ptr);
void Q_ALWAYS_INLINE addObserver(QPropertyObserver *observer);
void setFirstObserver(QPropertyObserver *observer);
QPropertyObserverPointer firstObserver() const;
inline void setFirstObserver(QPropertyObserver *observer);
inline QPropertyObserverPointer firstObserver() const;
int observerCount() const;
inline int observerCount() const;
template <typename T>
static QPropertyBindingDataPointer get(QProperty<T> &property)
@ -442,6 +442,14 @@ inline QPropertyObserverPointer QPropertyBindingDataPointer::firstObserver() con
return { reinterpret_cast<QPropertyObserver *>(ptr->d()) };
}
inline int QPropertyBindingDataPointer::observerCount() const
{
int count = 0;
for (auto observer = firstObserver(); observer; observer = observer.nextObserver())
++count;
return count;
}
namespace QtPrivate {
Q_CORE_EXPORT bool isPropertyInBindingWrapper(const QUntypedPropertyData *property);
void Q_CORE_EXPORT initBindingStatusThreadId();