Home | History | Annotate | Download | only in doxygen
      1 #include "rxcpp/rx.hpp"
      2 
      3 #include "rxcpp/rx-test.hpp"
      4 #include "catch.hpp"
      5 
      6 SCENARIO("any sample") {
      7     printf("//! [any sample]\n");
      8     auto values = rxcpp::observable<>::from(1, 2, 3, 4, 5).any([](int n) { return n > 3; });
      9     values.
     10             subscribe(
     11             [](bool v) { printf("OnNext: %s\n", v ? "true" : "false"); },
     12             []() { printf("OnCompleted\n"); });
     13     printf("//! [any sample]\n");
     14 }
     15 
     16 SCENARIO("any - operator syntax sample") {
     17     using namespace rxcpp;
     18     using namespace rxcpp::sources;
     19     using namespace rxcpp::operators;
     20 
     21     printf("//! [any - operator syntax sample]\n");
     22     auto values = range(1, 10)
     23         | any([](int n) { return n == 1; });
     24     values.
     25             subscribe(
     26             [](bool v) { printf("OnNext: %s\n", v ? "true" : "false"); },
     27             []() { printf("OnCompleted\n"); });
     28     printf("//! [any - operator syntax sample]\n");
     29 }