Add a Producer/Consumer system.

It allow you to create the two end of a pipe: A producer and consumer.
The producer can be moved into another thread.
Several producer can be created if necessary.

This will ease merging:
https://github.com/ArthurSonzogni/FTXUI/pull/11
This commit is contained in:
ArthurSonzogni
2020-03-24 23:26:55 +01:00
parent 6de8c63907
commit 09a1b16613
7 changed files with 244 additions and 66 deletions

View File

@@ -5,6 +5,7 @@
#include <functional>
#include <string>
#include <vector>
#include <ftxui/component/producer_consumer.hpp>
namespace ftxui {
@@ -20,7 +21,7 @@ struct Event {
static Event Character(const std::string&);
static Event Special(const std::string&);
static Event GetEvent(std::function<char()> getchar);
static void Convert(Consumer<char>& in, Producer<Event>& out, char c);
// --- Arrow ---
static Event ArrowLeft;