aboutsummaryrefslogtreecommitdiff
path: root/examples/cxx/hybrid/filter/people-custom-simpl.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'examples/cxx/hybrid/filter/people-custom-simpl.cxx')
-rw-r--r--examples/cxx/hybrid/filter/people-custom-simpl.cxx32
1 files changed, 32 insertions, 0 deletions
diff --git a/examples/cxx/hybrid/filter/people-custom-simpl.cxx b/examples/cxx/hybrid/filter/people-custom-simpl.cxx
new file mode 100644
index 0000000..3e7d9ff
--- /dev/null
+++ b/examples/cxx/hybrid/filter/people-custom-simpl.cxx
@@ -0,0 +1,32 @@
+// file : examples/cxx/hybrid/filter/people-custom-simpl.cxx
+// author : Boris Kolpackov <boris@codesynthesis.com>
+// copyright : not copyrighted - public domain
+
+// Include people-simpl.hxx (which includes people-custom-simpl.hxx)
+// instead of people-custom-simpl.hxx.
+//
+#include "people-simpl.hxx"
+
+void people_simpl::
+gender_filter (gender g)
+{
+ gender_ = g;
+}
+
+bool people_simpl::
+person_next ()
+{
+ // See if we have any more person records with the gender we
+ // are interested in.
+ //
+ people::person_const_iterator& i = people_base_simpl_state_.person_;
+ people::person_const_iterator& e = people_base_simpl_state_.person_end_;
+
+ for (; i != e; ++i)
+ {
+ if (i->gender () == gender_)
+ break;
+ }
+
+ return i != e;
+}