FTXUI/src/ftxui/dom/util.cpp

34 lines
597 B
C++
Raw Normal View History

2019-01-03 05:33:59 +08:00
#include "ftxui/dom/elements.hpp"
namespace ftxui {
2019-01-03 05:33:59 +08:00
Element nothing(Element element) {
return element;
2019-01-03 05:33:59 +08:00
}
2019-01-03 07:35:59 +08:00
Decorator compose(Decorator a, Decorator b) {
return [
a = std::move(a),
b = std::move(b)
](Element element) {
return b(a(std::move(element)));
2019-01-03 07:35:59 +08:00
};
}
Decorator operator|(Decorator a, Decorator b) {
return compose(a, b);
}
2019-01-27 04:52:55 +08:00
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