File tree Expand file tree Collapse file tree 3 files changed +22
-0
lines changed Expand file tree Collapse file tree 3 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,8 @@ this...
1010
1111``` c++
1212int main () {
13+ // ...
14+
1315 source | through | sink;
1416 return 0;
1517}
Original file line number Diff line number Diff line change 1+ #ifndef PUSH_STREAM_H
2+ #define PUSH_STREAM_H
3+
14#include < string>
25#include < iostream>
36#include < vector>
@@ -35,3 +38,5 @@ Stream& operator | (Stream& source, Stream& sink) {
3538 sink.source ->pipe ();
3639 return sink;
3740}
41+
42+ #endif
Original file line number Diff line number Diff line change @@ -14,6 +14,9 @@ using Buffer = std::vector<String>;
1414
1515using namespace Hyper ::Util;
1616
17+ //
18+ // A source stream implementation
19+ //
1720struct Source : Stream {
1821 Buffer buf { " paper" , " clips" , " for" , " sale" };
1922 size_t i = 0 ;
@@ -40,6 +43,9 @@ struct Source : Stream {
4043 }
4144};
4245
46+ //
47+ // A sink stream implementation
48+ //
4349struct Sink : Stream {
4450 Buffer buf;
4551
@@ -55,6 +61,9 @@ struct Sink : Stream {
5561 }
5662};
5763
64+ //
65+ // A through/transform stream implementation
66+ //
5867struct Through : Stream {
5968 using Callback = std::function<String(String)>;
6069 Callback callback;
@@ -94,6 +103,9 @@ struct Through : Stream {
94103 }
95104};
96105
106+ //
107+ // An async source stream implementation
108+ //
97109struct SourceAsync : Stream {
98110 std::ifstream file;
99111
@@ -151,6 +163,9 @@ struct SourceAsync : Stream {
151163 }
152164};
153165
166+ //
167+ // Tests!
168+ //
154169int main () {
155170 TAP::Test t;
156171
You can’t perform that action at this time.
0 commit comments