From c4019f7916b6e148e3f9a0e3c7dece422d78c342 Mon Sep 17 00:00:00 2001 From: pans <pans@454eff88-639b-444f-9e54-f578c98de674> Date: 星期三, 09 八月 2017 12:35:20 +0800 Subject: [PATCH] update capnp --- VisitFace/RtspNativeCodec/app/libs/capnproto/include/capnp/compat/json.h | 20 +++++++++++++++++++- 1 files changed, 19 insertions(+), 1 deletions(-) diff --git a/VisitFace/RtspNativeCodec/app/libs/capnproto/include/capnp/compat/json.h b/VisitFace/RtspNativeCodec/app/libs/capnproto/include/capnp/compat/json.h index 7fa815e..47ba910 100644 --- a/VisitFace/RtspNativeCodec/app/libs/capnproto/include/capnp/compat/json.h +++ b/VisitFace/RtspNativeCodec/app/libs/capnproto/include/capnp/compat/json.h @@ -193,6 +193,20 @@ void addFieldHandler(StructSchema::Field field, Handler<T>& handler); // Matches only the specific field. T can be a dynamic type. T must match the field's type. + // --------------------------------------------------------------------------- + // Hack to support string literal parameters + + template <size_t size, typename... Params> + auto decode(const char (&input)[size], Params&&... params) const + -> decltype(decode(kj::arrayPtr(input, size), kj::fwd<Params>(params)...)) { + return decode(kj::arrayPtr(input, size - 1), kj::fwd<Params>(params)...); + } + template <size_t size, typename... Params> + auto decodeRaw(const char (&input)[size], Params&&... params) const + -> decltype(decodeRaw(kj::arrayPtr(input, size), kj::fwd<Params>(params)...)) { + return decodeRaw(kj::arrayPtr(input, size - 1), kj::fwd<Params>(params)...); + } + private: class HandlerBase; struct Impl; @@ -210,10 +224,14 @@ // ======================================================================================= // inline implementation details +template <bool isDynamic> +struct EncodeImpl; + template <typename T> kj::String JsonCodec::encode(T&& value) { + Type type = Type::from(value); typedef FromAny<kj::Decay<T>> Base; - return encode(DynamicValue::Reader(ReaderFor<Base>(kj::fwd<T>(value))), Type::from<Base>()); + return encode(DynamicValue::Reader(ReaderFor<Base>(kj::fwd<T>(value))), type); } template <typename T> -- Gitblit v1.8.0