pupene  0.2.0
pup-pupper.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "pupper.h"
4 #include "traits.h"
5 
6 /** \file
7  * All functions pass their arguments directly to puppers.
8  */
9 namespace pupene::fns {
10  /**
11  * Called when a new object is encountered; an object is any type
12  * which is not floating point, integer or std::string.
13  *
14  * Forwards to Pupper::begin(). If the Pupper returns
15  * PupPolicy::consume_object, the Pupper deals with the object
16  * without invoking its associated `pup` function(s).
17  *
18  * @param value Passed to pupper.
19  * @return PupPolicy::pup_object or PupPolicy::consume_object
20  */
21  template <typename P, typename T>
23  T& value,
24  const Meta& meta) {
25 
26  return p.begin_impl(value, meta);
27  }
28 
29  /**
30  * Forwards value to the Pupper.
31  *
32  * @tparam T Matches std::string, integer and floating point types.
33  * @param value Passed to pupper.
34  * @see enable_if_puppable
35  */
36  template <typename P,
37  typename T,
38  typename = enable_if_puppable<T>>
39  void pup(Pupper<P>& p, T& value, const Meta& meta) {
40  p.pup_impl(value, meta);
41  }
42 
43  /**
44  * The opposite of pupene::fns::begin(p, value, meta). The `meta` object is
45  * the same as was sent in when the corresponding `begin(Pupper<P>, T&, Meta&)`.
46  */
47  template <typename P>
48  void end(Pupper<P>& p, const Meta& meta) {
49  p.end_impl(meta);
50  }
51 }
void end(Pupper< P > &p, const Meta &meta)
The opposite of pupene::fns::begin(p, value, meta).
Definition: pup-pupper.h:48
Definition: debug.cpp:4
void pup(Pupper< P > &p, T &value, const Meta &meta)
Forwards value to the Pupper.
Definition: pup-pupper.h:39
Holds name and type of objects.
Definition: traits.h:7
PupPolicy begin(Pupper< P > &p, T &value, const Meta &meta)
Called when a new object is encountered; an object is any type which is not floating point...
Definition: pup-pupper.h:22
PupPolicy
Controls an object&#39;s pup() behavior.
Definition: pupper.h:17
Base class for working with puppable types.
Definition: pupper.h:83