diff options
author | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2020-06-08 16:47:08 +0200 |
---|---|---|
committer | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2020-06-10 00:08:12 +0200 |
commit | d7c75ee005cc73bb74f0efe1171c7d3c08328fb1 (patch) | |
tree | 1bb9abac58c2bdad7446fdbf2eaedf77a965ce26 /src/corelib/tools | |
parent | 2a767ab4bb7de8c29d2a8365212244ed944e9aeb (diff) |
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 <marc.mutz@kdab.com>
Diffstat (limited to 'src/corelib/tools')
-rw-r--r-- | src/corelib/tools/qshareddata.cpp | 18 | ||||
-rw-r--r-- | src/corelib/tools/qshareddata.h | 3 |
2 files changed, 21 insertions, 0 deletions
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 <class T> T* QSharedDataPointer<T>::get() + \since 6.0 + + Same as data(). This function is provided for STL compatibility. +*/ + /*! \fn template <class T> const T* QSharedDataPointer<T>::data() const Returns a pointer to the shared data object. This function does \e not call detach(). */ +/*! \fn template <class T> const T* QSharedDataPointer<T>::get() const + \since 6.0 + + Same as data(). This function is provided for STL compatibility. +*/ + /*! \fn template <class T> const T* QSharedDataPointer<T>::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 <class T> T* QExplicitlySharedDataPointer<T>::get() const + \since 6.0 + + Same as data(). This function is provided for STL compatibility. +*/ + /*! \fn template <class T> const T* QExplicitlySharedDataPointer<T>::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<T> &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; } |