Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qlazilyallocated_p.h
Go to the documentation of this file.
1// Copyright (C) 2020 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QLAZILYALLOCATED_P_H
5#define QLAZILYALLOCATED_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtCore/private/qglobal_p.h>
19#include <QtCore/qtaggedpointer.h>
20
22
23template<typename T, typename Tag = typename QtPrivate::TagInfo<T>::TagType>
25public:
28
29 inline bool isAllocated() const;
30
31 inline T *operator->() const;
32
33 inline T &value();
34 inline const T &value() const;
35
36 inline Tag tag() const;
37 inline void setTag(Tag t);
38private:
39 mutable QTaggedPointer<T, Tag> d;
40};
41
42template<typename T, typename Tag>
46
47template<typename T, typename Tag>
52
53template<typename T, typename Tag>
55{
56 return !d.isNull();
57}
58
59template<typename T, typename Tag>
61{
62 if (d.isNull()) d = new T;
63 return *d;
64}
65
66template<typename T, typename Tag>
68{
69 if (d.isNull()) d = new T;
70 return *d;
71}
72
73template<typename T, typename Tag>
75{
76 return d.data();
77}
78
79template<typename T, typename Tag>
81{
82 return d.tag();
83}
84
85template<typename T, typename Tag>
87{
88 d.setTag(t);
89}
90
92
93#endif // QLAZILYALLOCATED_P_H
const T & value() const
bool isAllocated() const
Combined button and popup list for selecting options.
quint32 Tag
GLdouble GLdouble t
Definition qopenglext.h:243