Debian Codegraph @

src/internal/implemented-by.cpp

raw symbols SCIP
1 /*
2 * %injeqt copyright begin%
3 * Copyright 2014 Rafał Malinowski ([email protected])
4 * %injeqt copyright end%
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21 #include "implemented-by.h"
22
23 #include <injeqt/type.h>
24
25 #include "interfaces-utils.h"
26
27 #include <cassert>
28
29 namespace injeqt { namespace internal {
30
31 implemented_by::implemented_by(type interface_type, type implementation_type) :
32 _interface_type{std::move(interface_type)},
33 _implementation_type{std::move(implementation_type)}
34 {
35 assert(!_interface_type.is_empty());
36 assert(!_implementation_type.is_empty());
37 assert(implements(_implementation_type, _interface_type));
38 }
39
40 type implemented_by::interface_type() const
41 {
42 return _interface_type;
43 }
44
45 type implemented_by::implementation_type() const
46 {
47 return _implementation_type;
48 }
49
50 bool operator == (const implemented_by &x, const implemented_by &y)
51 {
52 if (x.interface_type() != y.interface_type())
53 return false;
54
55 if (x.implementation_type() != y.implementation_type())
56 return false;
57
58 return true;
59 }
60
61 bool operator != (const implemented_by &x, const implemented_by &y)
62 {
63 return !(x == y);
64 }
65
66 }}