Loading...
Searching...
No Matches
util.cpp
Go to the documentation of this file.
// Copyright 2022 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <functional> // for function
#include "ftxui/component/component.hpp" // for Renderer, ComponentDecorator, ElementDecorator, operator|, operator|=
#include "ftxui/component/component_base.hpp" // for Component
namespace ftxui {
// NOLINTNEXTLINE
Component operator|(Component component, ComponentDecorator decorator) {
return decorator(component); // NOLINT
}
// NOLINTNEXTLINE
Component operator|(Component component, ElementDecorator decorator) {
return component | Renderer(decorator); // NOLINT
}
// NOLINTNEXTLINE
Component& operator|=(Component& component, ComponentDecorator decorator) {
component = component | decorator; // NOLINT
return component;
}
// NOLINTNEXTLINE
Component& operator|=(Component& component, ElementDecorator decorator) {
component = component | decorator; // NOLINT
return component;
}
} // namespace ftxui
component.hpp
component_base.hpp
ftxui
Definition animation.hpp:10
ftxui::Make
std::shared_ptr< T > Make(Args &&... args)
Definition component.hpp:26
ftxui::ElementDecorator
std::function< Element(Element)> ElementDecorator
Definition component.hpp:32
ftxui::Component
std::shared_ptr< ComponentBase > Component
Definition component_base.hpp:24
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 renderer.cpp:61
ftxui::operator|
Component operator|(Component component, ComponentDecorator decorator)
Definition util.cpp:12
ftxui::operator|=
Component & operator|=(Component &component, ComponentDecorator decorator)
Definition util.cpp:22
ftxui::ComponentDecorator
std::function< Component(Component)> ComponentDecorator
Definition component.hpp:31