FTXUI/src/ftxui/component/util.cpp

35 lines
1.0 KiB
C++
Raw Normal View History

#include <functional> // for function
2022-03-14 01:51:46 +08:00
#include "ftxui/component/component.hpp" // for Renderer, ComponentDecorator, ElementDecorator, operator|, operator|=
#include "ftxui/component/component_base.hpp" // for Component
namespace ftxui {
2022-03-31 08:17:43 +08:00
// NOLINTNEXTLINE
Component operator|(Component component, ComponentDecorator decorator) {
2022-03-31 08:17:43 +08:00
return decorator(component); // NOLINT
}
2022-03-31 08:17:43 +08:00
// NOLINTNEXTLINE
Component operator|(Component component, ElementDecorator decorator) {
2022-03-31 08:17:43 +08:00
return component | Renderer(decorator); // NOLINT
}
2022-03-31 08:17:43 +08:00
// NOLINTNEXTLINE
Component& operator|=(Component& component, ComponentDecorator decorator) {
2022-03-31 08:17:43 +08:00
component = component | decorator; // NOLINT
return component;
}
2022-03-31 08:17:43 +08:00
// NOLINTNEXTLINE
Component& operator|=(Component& component, ElementDecorator decorator) {
2022-03-31 08:17:43 +08:00
component = component | decorator; // NOLINT
return component;
}
} // namespace ftxui
// 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.