Doomseeker
Wadseeker
Download
Tracker
Git
Docs
Main Page
Plugin API
Related Pages
Modules
Classes
Files
File List
File Members
All
Classes
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Groups
Pages
src
core
dptr.h
1
//------------------------------------------------------------------------------
2
// dptr.h
3
//------------------------------------------------------------------------------
4
//
5
// This library is free software; you can redistribute it and/or
6
// modify it under the terms of the GNU Lesser General Public
7
// License as published by the Free Software Foundation; either
8
// version 2.1 of the License, or (at your option) any later version.
9
//
10
// This library is distributed in the hope that it will be useful,
11
// but WITHOUT ANY WARRANTY; without even the implied warranty of
12
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
// Lesser General Public License for more details.
14
//
15
// You should have received a copy of the GNU Lesser General Public
16
// License along with this library; if not, write to the Free Software
17
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18
// 02110-1301 USA
19
//
20
//------------------------------------------------------------------------------
21
// Copyright (C) 2015 Braden "Blzut3" Obrzut <admin@maniacsvault.net>
22
//------------------------------------------------------------------------------
23
#ifndef id91044119_93C0_4719_829DE83410DDE660
24
#define id91044119_93C0_4719_829DE83410DDE660
25
26
#include <QScopedPointer>
27
31
template
<
class
T>
class
PrivData
;
35
#define DClass template<> class PrivData
36
53
template
<
class
T>
54
class
DPtr
:
public
QScopedPointer<PrivData<T> >
55
{
56
public
:
57
DPtr
();
58
DPtr
(
const
DPtr
&other);
59
const
DPtr
&operator=(
const
DPtr
&other);
60
~
DPtr
();
61
};
62
66
#define DPointeredNoCopy(cls) \
67
template<> \
68
DPtr<cls>::DPtr() : QScopedPointer<PrivData<cls> >(new PrivData<cls>) {} \
69
template<> \
70
DPtr<cls>::~DPtr() {}
71
75
#define DPointered(cls) DPointeredNoCopy(cls) \
76
template<> \
77
DPtr<cls>::DPtr(const DPtr<cls> &other) : QScopedPointer<PrivData<cls> >(new PrivData<cls>) \
78
{ \
79
*(this->data()) = *(other.data()); \
80
} \
81
template<> \
82
const DPtr<cls> &DPtr<cls>::operator=(const DPtr<cls> &other) \
83
{ \
84
if (this->data() != other.data()) \
85
*(this->data()) = *(other.data()); \
86
return *this; \
87
}
88
89
#endif
Doomseeker © 2009-2023 The Doomseeker Team