Václav Kubernát | 3a99f00 | 2020-03-31 02:27:41 +0200 | [diff] [blame] | 1 | /* |
| 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 | |
| 10 | namespace yang { |
| 11 | Enum::Enum(std::set<enum_>&& values) |
| 12 | : m_allowedValues(std::move(values)) |
| 13 | { |
| 14 | } |
| 15 | bool Enum::operator==(const Enum& other) const |
| 16 | { |
| 17 | return this->m_allowedValues == other.m_allowedValues; |
| 18 | } |
| 19 | IdentityRef::IdentityRef(std::set<identityRef_>&& values) |
| 20 | : m_allowedValues(std::move(values)) |
| 21 | { |
| 22 | } |
| 23 | bool 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 |
| 28 | LeafRef::LeafRef(const LeafRef& src) |
| 29 | : m_targetXPath(src.m_targetXPath) |
| 30 | , m_targetType(std::make_unique<LeafDataType>(*src.m_targetType)) |
| 31 | { |
| 32 | } |
| 33 | LeafRef::LeafRef(const std::string& xpath, std::unique_ptr<LeafDataType>&& type) |
| 34 | : m_targetXPath(xpath) |
| 35 | , m_targetType(std::move(type)) |
| 36 | { |
| 37 | } |
| 38 | bool LeafRef::operator==(const LeafRef& other) const |
| 39 | { |
| 40 | return this->m_targetXPath == other.m_targetXPath && *this->m_targetType == *other.m_targetType; |
| 41 | } |
| 42 | bool String::operator==(const String&) const |
| 43 | { |
| 44 | return true; |
| 45 | } |
| 46 | bool Decimal::operator==(const Decimal&) const |
| 47 | { |
| 48 | return true; |
| 49 | } |
| 50 | bool Bool::operator==(const Bool&) const |
| 51 | { |
| 52 | return true; |
| 53 | } |
| 54 | bool Int8::operator==(const Int8&) const |
| 55 | { |
| 56 | return true; |
| 57 | } |
| 58 | bool Uint8::operator==(const Uint8&) const |
| 59 | { |
| 60 | return true; |
| 61 | } |
| 62 | bool Int16::operator==(const Int16&) const |
| 63 | { |
| 64 | return true; |
| 65 | } |
| 66 | bool Uint16::operator==(const Uint16&) const |
| 67 | { |
| 68 | return true; |
| 69 | } |
| 70 | bool Int32::operator==(const Int32&) const |
| 71 | { |
| 72 | return true; |
| 73 | } |
| 74 | bool Uint32::operator==(const Uint32&) const |
| 75 | { |
| 76 | return true; |
| 77 | } |
| 78 | bool Int64::operator==(const Int64&) const |
| 79 | { |
| 80 | return true; |
| 81 | } |
| 82 | bool Uint64::operator==(const Uint64&) const |
| 83 | { |
| 84 | return true; |
| 85 | } |
| 86 | bool Binary::operator==(const Binary&) const |
| 87 | { |
| 88 | return true; |
| 89 | } |
| 90 | } |