blob: 8d9c40c4cd957782c5cf5da3ee789b83a83edce0 [file] [log] [blame]
Václav Kubernát7edb5372019-12-13 12:40:49 +01001/*
2 * Copyright (C) 2019 CESNET, https://photonics.cesnet.cz/
3 *
4 * Written by Václav Kubernát <kubervac@fit.cvut.cz>
5 *
6*/
7#include "ast_values.hpp"
8
9enum_::enum_() = default;
10
11enum_::enum_(const std::string& value)
12 : m_value(value)
13{
14}
15
16identityRef_::identityRef_() = default;
17
18identityRef_::identityRef_(const std::string& value)
19 : m_value(value)
20{
21}
22
23identityRef_::identityRef_(const std::string& module, const std::string& value)
24 : m_prefix(module_{module})
25 , m_value(value)
26{
27}
28
29binary_::binary_() = default;
30
31binary_::binary_(const std::string& value)
32 : m_value(value)
33{
34}
35
36bool identityRef_::operator==(const identityRef_& b) const
37{
38 return this->m_prefix == b.m_prefix && this->m_value == b.m_value;
39}
40
41bool binary_::operator==(const binary_& b) const
42{
43 return this->m_value == b.m_value;
44}
45
46bool enum_::operator==(const enum_& b) const
47{
48 return this->m_value == b.m_value;
49}
50
Václav Kubernát144729d2020-01-08 15:20:35 +010051bool special_::operator==(const special_& b) const
52{
53 return this->m_value == b.m_value;
54}
55
56std::string specialValueToString(const special_& value)
57{
58 switch (value.m_value) {
59 case SpecialValue::Container:
60 return "(container)";
61 case SpecialValue::PresenceContainer:
62 return "(presence container)";
63 case SpecialValue::List:
64 return "(list)";
65 }
66
67 __builtin_unreachable();
68}