blob: 9bb7f7798faf1901d4a64c1b370f4354d4186e9a (
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "listuser.h"
#include <numeric>
#include <cstdlib>
std::list<int> ListUser::callCreateList()
{
return createList();
}
ListUser::ListUser() = default;
ListUser::ListUser(const ListUser &other) = default;
ListUser::ListUser(ListUser &&other) noexcept = default;
ListUser &ListUser::operator=(const ListUser &other) = default;
ListUser &ListUser::operator=(ListUser &&other) noexcept = default;
ListUser::~ListUser() = default;
std::list<int> ListUser::createList()
{
std::list<int> retval;
for (int i = 0; i < 4; i++)
retval.push_front(rand());
return retval;
}
std::list<Complex> ListUser::createComplexList(Complex cpx0, Complex cpx1)
{
std::list<Complex> retval;
retval.push_back(cpx0);
retval.push_back(cpx1);
return retval;
}
double ListUser::sumList(std::list<int> vallist)
{
return std::accumulate(vallist.begin(), vallist.end(), 0.0);
}
double ListUser::sumList(std::list<double> vallist)
{
return std::accumulate(vallist.begin(), vallist.end(), 0.0);
}
ListUser::ListOfSomething ListUser::listOfPoints(const std::list<Point> &)
{
return ListOfPoint;
}
ListUser::ListOfSomething ListUser::listOfPoints(const std::list<PointF> &)
{
return ListOfPointF;
}
void ListUser::multiplyPointList(PointList &points, double multiplier)
{
for (auto *point : points) {
point->setX(point->x() * multiplier);
point->setY(point->y() * multiplier);
}
}
|