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 | |
| 8 | #pragma once |
| 9 | #include <memory> |
| 10 | #include <set> |
| 11 | #include <string> |
| 12 | #include <variant> |
| 13 | |
| 14 | struct enum_; |
| 15 | struct identityRef_; |
| 16 | |
| 17 | namespace yang { |
| 18 | struct String { |
| 19 | bool operator==(const String&) const; |
| 20 | }; |
| 21 | struct Decimal { |
| 22 | bool operator==(const Decimal&) const; |
| 23 | }; |
| 24 | struct Bool { |
| 25 | bool operator==(const Bool&) const; |
| 26 | }; |
| 27 | struct Int8 { |
| 28 | bool operator==(const Int8&) const; |
| 29 | }; |
| 30 | struct Uint8 { |
| 31 | bool operator==(const Uint8&) const; |
| 32 | }; |
| 33 | struct Int16 { |
| 34 | bool operator==(const Int16&) const; |
| 35 | }; |
| 36 | struct Uint16 { |
| 37 | bool operator==(const Uint16&) const; |
| 38 | }; |
| 39 | struct Int32 { |
| 40 | bool operator==(const Int32&) const; |
| 41 | }; |
| 42 | struct Uint32 { |
| 43 | bool operator==(const Uint32&) const; |
| 44 | }; |
| 45 | struct Int64 { |
| 46 | bool operator==(const Int64&) const; |
| 47 | }; |
| 48 | struct Uint64 { |
| 49 | bool operator==(const Uint64&) const; |
| 50 | }; |
| 51 | struct Binary { |
| 52 | bool operator==(const Binary&) const; |
| 53 | }; |
| 54 | struct Enum { |
| 55 | Enum(std::set<enum_>&& values); |
| 56 | bool operator==(const Enum& other) const; |
| 57 | std::set<enum_> m_allowedValues; |
| 58 | }; |
| 59 | struct IdentityRef { |
| 60 | IdentityRef(std::set<identityRef_>&& list); |
| 61 | bool operator==(const IdentityRef& other) const; |
| 62 | std::set<identityRef_> m_allowedValues; |
| 63 | }; |
| 64 | struct LeafRef; |
| 65 | using LeafDataType = std::variant< |
| 66 | yang::String, |
| 67 | yang::Decimal, |
| 68 | yang::Bool, |
| 69 | yang::Int8, |
| 70 | yang::Uint8, |
| 71 | yang::Int16, |
| 72 | yang::Uint16, |
| 73 | yang::Int32, |
| 74 | yang::Uint32, |
| 75 | yang::Int64, |
| 76 | yang::Uint64, |
| 77 | yang::Enum, |
| 78 | yang::Binary, |
| 79 | yang::IdentityRef, |
| 80 | yang::LeafRef |
| 81 | >; |
| 82 | struct LeafRef { |
| 83 | LeafRef(const LeafRef& src); |
| 84 | LeafRef(const std::string& xpath, std::unique_ptr<LeafDataType>&& type); |
| 85 | bool operator==(const LeafRef& other) const; |
| 86 | std::string m_targetXPath; |
| 87 | std::unique_ptr<LeafDataType> m_targetType; |
| 88 | }; |
| 89 | } |