blob: 66f4522552881595959dbef718af2f24cc4bd1a8 [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>
13
14struct enum_;
15struct identityRef_;
16
17namespace yang {
18struct String {
19 bool operator==(const String&) const;
20};
21struct Decimal {
22 bool operator==(const Decimal&) const;
23};
24struct Bool {
25 bool operator==(const Bool&) const;
26};
27struct Int8 {
28 bool operator==(const Int8&) const;
29};
30struct Uint8 {
31 bool operator==(const Uint8&) const;
32};
33struct Int16 {
34 bool operator==(const Int16&) const;
35};
36struct Uint16 {
37 bool operator==(const Uint16&) const;
38};
39struct Int32 {
40 bool operator==(const Int32&) const;
41};
42struct Uint32 {
43 bool operator==(const Uint32&) const;
44};
45struct Int64 {
46 bool operator==(const Int64&) const;
47};
48struct Uint64 {
49 bool operator==(const Uint64&) const;
50};
51struct Binary {
52 bool operator==(const Binary&) const;
53};
54struct Enum {
55 Enum(std::set<enum_>&& values);
56 bool operator==(const Enum& other) const;
57 std::set<enum_> m_allowedValues;
58};
59struct IdentityRef {
60 IdentityRef(std::set<identityRef_>&& list);
61 bool operator==(const IdentityRef& other) const;
62 std::set<identityRef_> m_allowedValues;
63};
64struct LeafRef;
65using 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>;
82struct 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}