diff options
Diffstat (limited to 'sources/shiboken6/tests/libsample/mapuser.cpp')
-rw-r--r-- | sources/shiboken6/tests/libsample/mapuser.cpp | 71 |
1 files changed, 23 insertions, 48 deletions
diff --git a/sources/shiboken6/tests/libsample/mapuser.cpp b/sources/shiboken6/tests/libsample/mapuser.cpp index e2a0f7181..40059bbcd 100644 --- a/sources/shiboken6/tests/libsample/mapuser.cpp +++ b/sources/shiboken6/tests/libsample/mapuser.cpp @@ -1,69 +1,44 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of Qt for Python. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// 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 <iostream> #include "mapuser.h" -using namespace std; +#include <iostream> -std::map<std::string, std::pair<Complex, int> > -MapUser::callCreateMap() +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> > MapUser::createMap() { std::map<std::string, std::pair<Complex, int> > retval; - std::pair<std::string, std::pair<Complex, int> > - item0("zero", std::pair<Complex, int>(Complex(1.2, 3.4), 2)); - retval.insert(item0); + std::pair<Complex, int> value{Complex(1.2, 3.4), 2}; + retval.insert({"zero", value}); - std::pair<std::string, std::pair<Complex, int> > - item1("one", std::pair<Complex, int>(Complex(5.6, 7.8), 3)); - retval.insert(item1); + value = {Complex(5.6, 7.8), 3}; + retval.insert({"one", value}); - std::pair<std::string, std::pair<Complex, int> > - item2("two", std::pair<Complex, int>(Complex(9.1, 2.3), 5)); - retval.insert(item2); + value = {Complex(9.1, 2.3), 5}; + retval.insert({"two", value}); return retval; } -void -MapUser::showMap(std::map<std::string, int> mapping) +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> &) { - cout << __FUNCTION__ << endl; - for (auto it = mapping.begin(), end = mapping.end(); it != end; ++it) - cout << (*it).first << " => " << (*it).second << endl; } std::map<int, std::list<std::list<double> > > MapUser::foo() const |