HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
skeleton_top_node.hpp
1// Copyright Take Vos 2020.
2// Distributed under the Boost Software License, Version 1.0.
3// (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt)
4
5#pragma once
6
7#include "skeleton_node.hpp"
8
9namespace tt {
10
12 statement_vector children;
13
15 skeleton_node(std::move(location)), children() {}
16
19 bool append(std::unique_ptr<skeleton_node> x) noexcept override {
20 append_child(children, std::move(x));
21 return true;
22 }
23
24 void post_process(formula_post_process_context &context) override {
25 if (std::ssize(children) > 0) {
26 children.back()->left_align();
27 }
28
29 for (ttlet &child: children) {
30 child->post_process(context);
31 }
32 }
33
35 try {
36 return evaluate_children(context, children);
37
38 } catch (std::exception const &e) {
39 throw operation_error("{}: Could not evaluate.\n{}", location, e.what());
40 }
41 }
42
43 std::string string() const noexcept override {
44 ttlet children_str = transform<std::vector<std::string>>(children, [](ttlet &x) { return x->string(); });
45 return std::format("<top {}>", join(children_str));
46 }
47};
48
49}
Exception thrown during execution of a dynamic operation.
Definition exception.hpp:42
Definition formula_evaluation_context.hpp:16
Definition formula_post_process_context.hpp:19
Definition parse_location.hpp:17
Definition skeleton_node.hpp:16
Definition skeleton_top_node.hpp:11
datum evaluate(formula_evaluation_context &context) override
Evaluate the template.
Definition skeleton_top_node.hpp:34
bool append(std::unique_ptr< skeleton_node > x) noexcept override
Append a template-piece to the current template.
Definition skeleton_top_node.hpp:19
T move(T... args)
T what(T... args)