aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken6/tests/libsample/polygon.h
blob: 2424ddd519d0b8aa9f954e195a8def1bf242350e (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
// 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 POLYGON_H
#define POLYGON_H

#include "libsamplemacros.h"
#include "point.h"

#include <list>

class LIBSAMPLE_API Polygon // should be moveable
{
public:
    using PointList = std::list<Point>;

    Polygon() noexcept = default;
    Polygon(double x, double y);
    Polygon(Point point);
    Polygon(PointList points);

    void addPoint(Point point);

    inline const PointList &points() const { return m_points; }

    // This method intentionally receives and returns copies of a Polygon object.
    static Polygon doublePolygonScale(Polygon polygon);

    // This method invalidates the argument to be used for Polygon(Point) implicit conversion.
    static void stealOwnershipFromPython(Point *point);

    // This method invalidates the argument to be used in a call to doublePolygonScale(Polygon).
    static void stealOwnershipFromPython(Polygon *polygon);

private:
    PointList m_points;
};

#endif // POLYGON_H