| 1234567891011121314151617181920212223242526272829303132333435363738 |
- //
- // json_direct_tuple_binder.hpp
- // json
- //
- // Created by Sam Jaffe on 2/26/17.
- //
- #pragma once
- namespace json { namespace binder {
- template <typename T, std::size_t I>
- class get_binder : public binder_impl<T> {
- public:
- using value_type = typename std::remove_reference<decltype(std::get<I>(std::declval<T>()))>::type;
-
- get_binder(binder<value_type> val_binder)
- : impl(std::move(val_binder)) {
-
- }
-
- get_binder(binder_impl<value_type> const & val_binder = value_binder<value_type>())
- : impl(val_binder) {
-
- }
-
- virtual binder_impl<T>* clone() const override { return new get_binder(*this); }
-
- virtual void parse(T& object, char const*& data, parser::options opts) const override {
- impl.parse(std::get<I>(object), data, opts);
- }
-
- virtual void write(T const& val, std::ostream & data) const override {
- impl.write(std::get<I>(val), data);
- }
- private:
- binder<value_type> impl;
- };
- } }
|