blob: 815d0aa34ac17e3b10dd1c83e9433bcc977d092c [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}
42bool String::operator==(const String&) const
43{
44 return true;
45}
46bool Decimal::operator==(const Decimal&) const
47{
48 return true;
49}
50bool Bool::operator==(const Bool&) const
51{
52 return true;
53}
54bool Int8::operator==(const Int8&) const
55{
56 return true;
57}
58bool Uint8::operator==(const Uint8&) const
59{
60 return true;
61}
62bool Int16::operator==(const Int16&) const
63{
64 return true;
65}
66bool Uint16::operator==(const Uint16&) const
67{
68 return true;
69}
70bool Int32::operator==(const Int32&) const
71{
72 return true;
73}
74bool Uint32::operator==(const Uint32&) const
75{
76 return true;
77}
78bool Int64::operator==(const Int64&) const
79{
80 return true;
81}
82bool Uint64::operator==(const Uint64&) const
83{
84 return true;
85}
86bool Binary::operator==(const Binary&) const
87{
88 return true;
89}
90}