aboutsummaryrefslogtreecommitdiff
path: root/examples/cxx/hybrid/filter/people-custom-pimpl.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'examples/cxx/hybrid/filter/people-custom-pimpl.cxx')
-rw-r--r--examples/cxx/hybrid/filter/people-custom-pimpl.cxx26
1 files changed, 26 insertions, 0 deletions
diff --git a/examples/cxx/hybrid/filter/people-custom-pimpl.cxx b/examples/cxx/hybrid/filter/people-custom-pimpl.cxx
new file mode 100644
index 0000000..e8a096f
--- /dev/null
+++ b/examples/cxx/hybrid/filter/people-custom-pimpl.cxx
@@ -0,0 +1,26 @@
+// file : examples/cxx/hybrid/filter/people-custom-pimpl.cxx
+// author : Boris Kolpackov <boris@codesynthesis.com>
+// copyright : not copyrighted - public domain
+
+// Include people-pimpl.hxx (which includes people-custom-pimpl.hxx)
+// instead of people-custom-pimpl.hxx.
+//
+#include "people-pimpl.hxx"
+
+void people_pimpl::
+age_filter (unsigned short min, unsigned short max)
+{
+ min_age_ = min;
+ max_age_ = max;
+}
+
+void people_pimpl::
+person (const ::person& p)
+{
+ // Check if the age constraints are met.
+ //
+ unsigned short age = p.age ();
+
+ if (age >= min_age_ && age <= max_age_)
+ people_base_pimpl::person (p);
+}