FTXUI 6.1.9 C++ functional terminal UI.

Loading...
Searching...
No Matches
component/util.cpp
Go to the documentation of this file.
1// Copyright 2022 Arthur Sonzogni. All rights reserved.
2// Use of this source code is governed by the MIT license that can be found in
3// the LICENSE file.
4#include <functional> // for function
5
6#include "ftxui/component/component.hpp" // for Renderer, ComponentDecorator, ElementDecorator, operator|, operator|=
7#include "ftxui/component/component_base.hpp" // for Component
8
9 namespace ftxui {
10
11// NOLINTNEXTLINE
12 Component operator|(Component component, ComponentDecorator decorator) {
13 return decorator(component); // NOLINT
14}
15
16// NOLINTNEXTLINE
17 Component operator|(Component component, ElementDecorator decorator) {
18 return component | Renderer(decorator); // NOLINT
19}
20
21// NOLINTNEXTLINE
22 Component& operator|=(Component& component, ComponentDecorator decorator) {
23 component = component | decorator; // NOLINT
24 return component;
25}
26
27// NOLINTNEXTLINE
28 Component& operator|=(Component& component, ElementDecorator decorator) {
29 component = component | decorator; // NOLINT
30 return component;
31}
32
33} // namespace ftxui
component.hpp
component_base.hpp
ftxui::Renderer
Component Renderer(Component child, std::function< Element()>)
Return a new Component, similar to |child|, but using |render| as the Component::Render() event.
Definition src/ftxui/component/renderer.cpp:61
ftxui
The FTXUI ftxui:: namespace.
Definition animation.hpp:10
ftxui::ElementDecorator
std::function< Element(Element)> ElementDecorator
Definition component.hpp:32
ftxui::operator|
Component operator|(Component component, ComponentDecorator decorator)
Definition component/util.cpp:12
ftxui::operator|=
Component & operator|=(Component &component, ComponentDecorator decorator)
Definition component/util.cpp:22
ftxui::ComponentDecorator
std::function< Component(Component)> ComponentDecorator
Definition component.hpp:31
ftxui::Component
std::shared_ptr< ComponentBase > Component
Definition component_base.hpp:24