blob: bd414ec347d1ef9baa18b40ccbe87b12e97aaff5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef ONLYCOPYCLASS_H
#define ONLYCOPYCLASS_H
#include "libsamplemacros.h"
#include <list>
// These classes simulate a situation found in QWebEngineHistoryItem.
class OnlyCopyPrivate;
class LIBSAMPLE_API OnlyCopy
{
public:
OnlyCopy(const OnlyCopy &other);
OnlyCopy &operator=(const OnlyCopy &other);
~OnlyCopy();
int value() const;
static int getValue(OnlyCopy onlyCopy) { return onlyCopy.value(); }
static int getValueFromReference(const OnlyCopy &onlyCopy) { return onlyCopy.value(); }
private:
OnlyCopyPrivate *d;
explicit OnlyCopy(int value);
explicit OnlyCopy(OnlyCopyPrivate *d); // rejected due to unknown OnlyCopyPrivate
friend class FriendOfOnlyCopy;
};
class LIBSAMPLE_API FriendOfOnlyCopy
{
public:
static OnlyCopy createOnlyCopy(int value);
static std::list<OnlyCopy> createListOfOnlyCopy(int quantity);
};
#endif // ONLYCOPYCLASS_H
|