From d7c75ee005cc73bb74f0efe1171c7d3c08328fb1 Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Mon, 8 Jun 2020 16:47:08 +0200 Subject: Q(E)SDP: add get() [ChangeLog][QtCore][QSharedDataPointer] Added get() for STL compatibility. [ChangeLog][QtCore][QExplicitlySharedDataPointer] Added get() for STL compatibility. Change-Id: I1acb3b4f4bd70842ed53f6437be10404b67d9909 Reviewed-by: Marc Mutz --- src/corelib/tools/qshareddata.cpp | 18 ++++++++++++++++++ src/corelib/tools/qshareddata.h | 3 +++ 2 files changed, 21 insertions(+) (limited to 'src/corelib/tools') diff --git a/src/corelib/tools/qshareddata.cpp b/src/corelib/tools/qshareddata.cpp index 2748f9d95f..187bfa7a5d 100644 --- a/src/corelib/tools/qshareddata.cpp +++ b/src/corelib/tools/qshareddata.cpp @@ -285,11 +285,23 @@ QT_BEGIN_NAMESPACE \sa constData() */ +/*! \fn template T* QSharedDataPointer::get() + \since 6.0 + + Same as data(). This function is provided for STL compatibility. +*/ + /*! \fn template const T* QSharedDataPointer::data() const Returns a pointer to the shared data object. This function does \e not call detach(). */ +/*! \fn template const T* QSharedDataPointer::get() const + \since 6.0 + + Same as data(). This function is provided for STL compatibility. +*/ + /*! \fn template const T* QSharedDataPointer::constData() const Returns a const pointer to the shared data object. This function does \e not call detach(). @@ -457,6 +469,12 @@ QT_BEGIN_NAMESPACE Returns a pointer to the shared data object. */ +/*! \fn template T* QExplicitlySharedDataPointer::get() const + \since 6.0 + + Same as data(). This function is provided for STL compatibility. +*/ + /*! \fn template const T* QExplicitlySharedDataPointer::constData() const Returns a const pointer to the shared data object. diff --git a/src/corelib/tools/qshareddata.h b/src/corelib/tools/qshareddata.h index ef3e689e92..38b6d61efa 100644 --- a/src/corelib/tools/qshareddata.h +++ b/src/corelib/tools/qshareddata.h @@ -83,7 +83,9 @@ public: inline operator T *() { detach(); return d; } inline operator const T *() const { return d; } inline T *data() { detach(); return d; } + inline T *get() { detach(); return d; } inline const T *data() const { return d; } + inline const T *get() const { return d; } inline const T *constData() const { return d; } inline bool operator==(const QSharedDataPointer &other) const { return d == other.d; } @@ -160,6 +162,7 @@ public: inline T *operator->() { return d; } inline T *operator->() const { return d; } inline T *data() const { return d; } + inline T *get() const { return d; } inline const T *constData() const { return d; } inline T *take() { T *x = d; d = nullptr; return x; } -- cgit v1.2.3