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

ObjectTypeOperators::ObjectTypeOperators(const std::string key) : m_key(key)
{
}

bool ObjectTypeOperators::operator==(const ObjectTypeOperators &other) const
{
    return m_key == other.m_key;
}

const ObjectTypeOperators &ObjectTypeOperators::operator<(const ObjectTypeOperators &other) const
{
    return m_key < other.m_key ? *this : other;
}

bool operator==(const ObjectTypeOperators *obj, const std::string &str)
{
    return obj->key() == str;
}

bool operator==(const std::string &str, const ObjectTypeOperators *obj)
{
    return str == obj->key();
}

std::string operator+(const ObjectTypeOperators *obj, const std::string &str)
{
    return obj->key() + str;
}

std::string operator+(const std::string &str, const ObjectTypeOperators *obj)
{
    return str + obj->key();
}