summaryrefslogtreecommitdiff
path: root/Rx/v2/examples
diff options
context:
space:
mode:
authorGrigoriy Chudnov <g.chudnov@gmail.com>2016-04-14 17:04:20 +0300
committerGrigoriy Chudnov <g.chudnov@gmail.com>2016-04-14 17:04:20 +0300
commitde3a5d1aeb8f0456dbfc01e2a3189a9197d1a120 (patch)
tree75938009c00b0e4e021cdd3ffbde503a1e67a7c6 /Rx/v2/examples
parentad2ad40437fa41af503af89cb6a9d26ebab8bb2f (diff)
downloadRxCpp-de3a5d1aeb8f0456dbfc01e2a3189a9197d1a120.tar.gz
add all operator
Diffstat (limited to 'Rx/v2/examples')
-rw-r--r--Rx/v2/examples/doxygen/all.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/Rx/v2/examples/doxygen/all.cpp b/Rx/v2/examples/doxygen/all.cpp
new file mode 100644
index 0000000..a5adb30
--- /dev/null
+++ b/Rx/v2/examples/doxygen/all.cpp
@@ -0,0 +1,29 @@
+#include "rxcpp/rx.hpp"
+
+#include "rxcpp/rx-test.hpp"
+#include "catch.hpp"
+
+SCENARIO("all sample") {
+ printf("//! [all sample]\n");
+ auto values = rxcpp::observable<>::from(1, 2, 3, 4, 5).all([](int n) { return n < 6; });
+ values.
+ subscribe(
+ [](bool v) { printf("OnNext: %s\n", v ? "true" : "false"); },
+ []() { printf("OnCompleted\n"); });
+ printf("//! [all sample]\n");
+}
+
+SCENARIO("all - operator syntax sample") {
+ using namespace rxcpp;
+ using namespace rxcpp::sources;
+ using namespace rxcpp::operators;
+
+ printf("//! [all - operator syntax sample]\n");
+ auto values = range(1, 10)
+ | all([](int n) { return n < 100; });
+ values.
+ subscribe(
+ [](bool v) { printf("OnNext: %s\n", v ? "true" : "false"); },
+ []() { printf("OnCompleted\n"); });
+ printf("//! [all - operator syntax sample]\n");
+} \ No newline at end of file