blob: 8048efad21c2ca55c5e9c002e939508939de2c9a [file] [log] [blame]
Václav Kubernát3a99f002020-03-31 02:27:41 +02001/*
2 * Copyright (C) 2020 CESNET, https://photonics.cesnet.cz/
3 *
4 * Written by Václav Kubernát <kubernat@cesnet.cz>
5 *
6*/
7#include "ast_values.hpp"
8#include "leaf_data_type.hpp"
9
10namespace yang {
11Enum::Enum(std::set<enum_>&& values)
12 : m_allowedValues(std::move(values))
13{
14}
15bool Enum::operator==(const Enum& other) const
16{
17 return this->m_allowedValues == other.m_allowedValues;
18}
19IdentityRef::IdentityRef(std::set<identityRef_>&& values)
20 : m_allowedValues(std::move(values))
21{
22}
23bool IdentityRef::operator==(const IdentityRef& other) const
24{
25 return this->m_allowedValues == other.m_allowedValues;
26}
27// Copy constructor needed, because unique_ptr is not copy-constructible
28LeafRef::LeafRef(const LeafRef& src)
29 : m_targetXPath(src.m_targetXPath)
30 , m_targetType(std::make_unique<LeafDataType>(*src.m_targetType))
31{
32}
33LeafRef::LeafRef(const std::string& xpath, std::unique_ptr<LeafDataType>&& type)
34 : m_targetXPath(xpath)
35 , m_targetType(std::move(type))
36{
37}
38bool LeafRef::operator==(const LeafRef& other) const
39{
40 return this->m_targetXPath == other.m_targetXPath && *this->m_targetType == *other.m_targetType;
41}
Václav Kubernát2984f442020-02-20 17:43:35 +010042bool Union::operator==(const Union& other) const
43{
44 return this->m_unionTypes == other.m_unionTypes;
45}
Václav Kubernát3a99f002020-03-31 02:27:41 +020046bool String::operator==(const String&) const
47{
48 return true;
49}
50bool Decimal::operator==(const Decimal&) const
51{
52 return true;
53}
54bool Bool::operator==(const Bool&) const
55{
56 return true;
57}
58bool Int8::operator==(const Int8&) const
59{
60 return true;
61}
62bool Uint8::operator==(const Uint8&) const
63{
64 return true;
65}
66bool Int16::operator==(const Int16&) const
67{
68 return true;
69}
70bool Uint16::operator==(const Uint16&) const
71{
72 return true;
73}
74bool Int32::operator==(const Int32&) const
75{
76 return true;
77}
78bool Uint32::operator==(const Uint32&) const
79{
80 return true;
81}
82bool Int64::operator==(const Int64&) const
83{
84 return true;
85}
86bool Uint64::operator==(const Uint64&) const
87{
88 return true;
89}
90bool Binary::operator==(const Binary&) const
91{
92 return true;
93}
94}