summaryrefslogtreecommitdiff
path: root/docs/data/core/branch.json
blob: d30c42f458582042511a9709b5baae9a6b87641f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
{
	"format": 1,
	"id": "saw-branch",
	"kind": "class",
	"name": "branch",
	"namespace": "saw",
	"module": "core",
	"header": "modules/core/c++/tree.hpp",
	"brief_description": "Container with a simplistic approach to a branch.",
	"detailed_description": [
		[
			"The edge in a",
			{"name": "tree_container", "id": "saw-tree_container"},
			"It holds either a leaf value or a whole sub tree, as a variant of the two, so the recursion lives in the data rather than in a pointer chain."
		],
		[
			"Access comes in two flavours: get asserts what is held, while extract and replace hand the content out or swap it and report a mismatch as an error instead."
		]
	],
	"templates": [
		{"name": "T", "kind": "type", "brief_description": "Leaf value type."},
		{"name": "Tree", "kind": "type", "brief_description": "Sub tree type."}
	],
	"aliases": {
		"saw-branch-type": {
			"id": "saw-branch-type",
			"name": "type",
			"type": ["std::variant< Tree, T >"],
			"brief_description": "Either a sub tree or a leaf."
		}
	},
	"functions": {
		"saw-branch-is": {
			"id": "saw-branch-is",
			"name": "is",
			"type": ["bool"],
			"const": true,
			"brief_description": "Whether the branch holds the given alternative.",
			"templates": [
				{"name": "NT", "kind": "type"}
			]
		},
		"saw-branch-is_tree": {
			"id": "saw-branch-is_tree",
			"name": "is_tree",
			"type": ["bool"],
			"const": true,
			"brief_description": "Whether the branch continues into a sub tree."
		},
		"saw-branch-is_value": {
			"id": "saw-branch-is_value",
			"name": "is_value",
			"type": ["bool"],
			"const": true,
			"brief_description": "Whether the branch ends in a leaf."
		},
		"saw-branch-get_tree": {
			"id": "saw-branch-get_tree",
			"name": "get_tree",
			"type": ["Tree &"],
			"brief_description": "The sub tree. Only valid if is_tree."
		},
		"saw-branch-get_value": {
			"id": "saw-branch-get_value",
			"name": "get_value",
			"type": ["T &"],
			"brief_description": "The leaf. Only valid if is_value."
		},
		"saw-branch-extract_tree": {
			"id": "saw-branch-extract_tree",
			"name": "extract_tree",
			"type": ["error_or< Tree >"],
			"brief_description": "Takes the sub tree out, failing if the branch holds a leaf."
		},
		"saw-branch-extract_value": {
			"id": "saw-branch-extract_value",
			"name": "extract_value",
			"type": ["error_or< T >"],
			"brief_description": "Takes the leaf out, failing if the branch holds a sub tree."
		},
		"saw-branch-replace_tree": {
			"id": "saw-branch-replace_tree",
			"name": "replace_tree",
			"type": ["error_or< Tree >"],
			"brief_description": "Swaps in new content and returns the sub tree which was there.",
			"parameters": [
				{"name": "nd", "type": ["type"]}
			]
		},
		"saw-branch-replace_value": {
			"id": "saw-branch-replace_value",
			"name": "replace_value",
			"type": ["error_or< T >"],
			"brief_description": "Swaps in new content and returns the leaf which was there.",
			"parameters": [
				{"name": "nd", "type": ["type"]}
			]
		}
	},
	"notes": [
		"Copy is forbidden, move is allowed."
	]
}