-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.hxx
42 lines (32 loc) · 681 Bytes
/
index.hxx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#ifndef PUSH_STREAM_H
#define PUSH_STREAM_H
#include <string>
#include <iostream>
#include <vector>
#include <any>
struct Stream {
bool ended = false;
bool aborted = false;
bool paused = false;
bool hasSink = false;
Stream* source;
Stream* sink;
virtual int write (const std::any& data) {
return 0;
};
virtual bool resume () {
return true;
};
virtual void pipe () {};
virtual bool end () {
return true;
};
};
Stream& operator | (Stream& source, Stream& sink) {
sink.source = dynamic_cast<Stream*>(&source);
source.sink = dynamic_cast<Stream*>(&sink);
sink.source->hasSink = true;
sink.source->pipe();
return sink;
}
#endif