blob: f7afd12904daf10193574d72bb4d759178df3f89 (
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
43
44
45
46
|
// Copyright (C) 2022 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#ifndef TRUCK_H
#define TRUCK_H
#include "icecream.h"
#include "macros.h"
#include <memory>
#include <vector>
class BINDINGS_API Truck
{
public:
explicit Truck(bool leaveOnDestruction = false);
Truck(const Truck &other);
Truck& operator=(const Truck &other);
Truck(Truck &&other);
Truck& operator=(Truck &&other);
~Truck();
void addIcecreamFlavor(Icecream *icecream);
void printAvailableFlavors() const;
bool deliver() const;
void arrive() const;
void leave() const;
void setLeaveOnDestruction(bool value);
void setArrivalMessage(const std::string &message);
std::string getArrivalMessage() const;
private:
using IcecreamPtr = std::shared_ptr<Icecream>;
void assign(const Truck &other);
bool m_leaveOnDestruction = false;
std::string m_arrivalMessage = "A new icecream truck has arrived!\n";
std::vector<IcecreamPtr> m_flavors;
};
#endif // TRUCK_H
|