blob: a86691bfdccf38a3faf60d0073b227868692a334 [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
8#pragma once
9#include <memory>
10#include <set>
11#include <string>
12#include <variant>
Václav Kubernát2984f442020-02-20 17:43:35 +010013#include <vector>
Václav Kubernát3a99f002020-03-31 02:27:41 +020014
15struct enum_;
16struct identityRef_;
17
18namespace yang {
19struct String {
20 bool operator==(const String&) const;
21};
22struct Decimal {
23 bool operator==(const Decimal&) const;
24};
25struct Bool {
26 bool operator==(const Bool&) const;
27};
28struct Int8 {
29 bool operator==(const Int8&) const;
30};
31struct Uint8 {
32 bool operator==(const Uint8&) const;
33};
34struct Int16 {
35 bool operator==(const Int16&) const;
36};
37struct Uint16 {
38 bool operator==(const Uint16&) const;
39};
40struct Int32 {
41 bool operator==(const Int32&) const;
42};
43struct Uint32 {
44 bool operator==(const Uint32&) const;
45};
46struct Int64 {
47 bool operator==(const Int64&) const;
48};
49struct Uint64 {
50 bool operator==(const Uint64&) const;
51};
52struct Binary {
53 bool operator==(const Binary&) const;
54};
55struct Enum {
56 Enum(std::set<enum_>&& values);
57 bool operator==(const Enum& other) const;
58 std::set<enum_> m_allowedValues;
59};
60struct IdentityRef {
61 IdentityRef(std::set<identityRef_>&& list);
62 bool operator==(const IdentityRef& other) const;
63 std::set<identityRef_> m_allowedValues;
64};
65struct LeafRef;
Václav Kubernát2984f442020-02-20 17:43:35 +010066struct Union;
Václav Kubernát3a99f002020-03-31 02:27:41 +020067using LeafDataType = std::variant<
68 yang::String,
69 yang::Decimal,
70 yang::Bool,
71 yang::Int8,
72 yang::Uint8,
73 yang::Int16,
74 yang::Uint16,
75 yang::Int32,
76 yang::Uint32,
77 yang::Int64,
78 yang::Uint64,
79 yang::Enum,
80 yang::Binary,
81 yang::IdentityRef,
Václav Kubernát2984f442020-02-20 17:43:35 +010082 yang::LeafRef,
83 yang::Union
Václav Kubernát3a99f002020-03-31 02:27:41 +020084>;
85struct LeafRef {
86 LeafRef(const LeafRef& src);
87 LeafRef(const std::string& xpath, std::unique_ptr<LeafDataType>&& type);
88 bool operator==(const LeafRef& other) const;
89 std::string m_targetXPath;
90 std::unique_ptr<LeafDataType> m_targetType;
91};
Václav Kubernát2984f442020-02-20 17:43:35 +010092
93struct Union {
94 bool operator==(const Union& other) const;
95 std::vector<LeafDataType> m_unionTypes;
96};
Václav Kubernát3a99f002020-03-31 02:27:41 +020097}