mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2025-12-16 01:48:56 +08:00
31 lines
585 B
C++
31 lines
585 B
C++
#include "ftxui/dom/elements.hpp"
|
|
|
|
namespace ftxui {
|
|
|
|
Element nothing(Element element) {
|
|
return element;
|
|
}
|
|
|
|
Decorator compose(Decorator a, Decorator b) {
|
|
return [a = std::move(a), b = std::move(b)](Element element) {
|
|
return b(a(std::move(element)));
|
|
};
|
|
}
|
|
|
|
Decorator operator|(Decorator a, Decorator b) {
|
|
return compose(a, b);
|
|
}
|
|
|
|
Elements operator|(Elements es, Decorator d) {
|
|
Elements output;
|
|
for (auto& it : es)
|
|
output.push_back(std::move(it) | d);
|
|
return output;
|
|
}
|
|
|
|
Element operator|(Element e, Decorator d) {
|
|
return d(std::move(e));
|
|
}
|
|
|
|
} // namespace ftxui
|