blob: 7dc3e0069b3fee8be812b93dfdea140ef3972da2 (
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
41
42
|
// 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>
#include <memory>
// These classes simulate a situation found in QWebEngineHistoryItem.
class OnlyCopyPrivate;
class LIBSAMPLE_API OnlyCopy
{
public:
LIBMINIMAL_DEFAULT_COPY_MOVE(OnlyCopy)
~OnlyCopy();
int value() const;
static int getValue(OnlyCopy onlyCopy) { return onlyCopy.value(); }
static int getValueFromReference(const OnlyCopy &onlyCopy) { return onlyCopy.value(); }
private:
friend class FriendOfOnlyCopy;
explicit OnlyCopy(int value);
std::shared_ptr<OnlyCopyPrivate> d;
};
class LIBSAMPLE_API FriendOfOnlyCopy
{
public:
static OnlyCopy createOnlyCopy(int value);
static std::list<OnlyCopy> createListOfOnlyCopy(int quantity);
};
#endif // ONLYCOPYCLASS_H
|