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/schema.h | 28 ++++++++++++++++++++++++++++
1 files changed, 28 insertions(+), 0 deletions(-)
diff --git a/VisitFace/RtspNativeCodec/app/libs/capnproto/include/capnp/schema.h b/VisitFace/RtspNativeCodec/app/libs/capnproto/include/capnp/schema.h
index d59fa75..cd859f2 100644
--- a/VisitFace/RtspNativeCodec/app/libs/capnproto/include/capnp/schema.h
+++ b/VisitFace/RtspNativeCodec/app/libs/capnproto/include/capnp/schema.h
@@ -599,6 +599,8 @@
template <typename T>
inline static Type from();
+ template <typename T>
+ inline static Type from(T&& value);
inline schema::Type::Which which() const;
@@ -679,6 +681,9 @@
}
void requireUsableAs(Type expected) const;
+
+ template <typename T, Kind k>
+ struct FromValueImpl;
friend class ListSchema; // only for requireUsableAs()
};
@@ -899,6 +904,29 @@
template <typename T>
inline Type Type::from() { return Type(Schema::from<T>()); }
+template <typename T, Kind k>
+struct Type::FromValueImpl {
+ template <typename U>
+ static inline Type type(U&& value) {
+ return Type::from<T>();
+ }
+};
+
+template <typename T>
+struct Type::FromValueImpl<T, Kind::OTHER> {
+ template <typename U>
+ static inline Type type(U&& value) {
+ // All dynamic types have getSchema().
+ return value.getSchema();
+ }
+};
+
+template <typename T>
+inline Type Type::from(T&& value) {
+ typedef FromAny<kj::Decay<T>> Base;
+ return Type::FromValueImpl<Base, kind<Base>()>::type(kj::fwd<T>(value));
+}
+
inline bool Type::isVoid () const { return baseType == schema::Type::VOID && listDepth == 0; }
inline bool Type::isBool () const { return baseType == schema::Type::BOOL && listDepth == 0; }
inline bool Type::isInt8 () const { return baseType == schema::Type::INT8 && listDepth == 0; }
--
Gitblit v1.8.0