aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken6/tests/libsample/mapuser.cpp
blob: 40059bbcd1a1e61f0fbaf654ce71b7bc8d1f69e2 (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
// 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 "mapuser.h"

#include <iostream>

std::map<std::string, std::pair<Complex, int> > MapUser::callCreateMap()
{
    return createMap();
}

std::map<std::string, std::pair<Complex, int> > MapUser::createMap()
{
    std::map<std::string, std::pair<Complex, int> > retval;

    std::pair<Complex, int> value{Complex(1.2, 3.4), 2};
    retval.insert({"zero", value});

    value = {Complex(5.6, 7.8), 3};
    retval.insert({"one", value});

    value = {Complex(9.1, 2.3), 5};
    retval.insert({"two", value});

    return retval;
}

void MapUser::showMap(std::map<std::string, int> mapping)
{
    std::cout << __FUNCTION__ << std::endl;
    for (const auto &p : mapping)
        std::cout << p.first << " => " << p.second << std::endl;
}

void MapUser::pointerToMap(std::map<std::string, std::string> *)
{
}

void MapUser::referenceToMap(std::map<std::string, std::string> &)
{
}

std::map<int, std::list<std::list<double> > > MapUser::foo() const
{
    std::map<int, std::list<std::list<double> > > result;
    return result;
}