Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(65)

Unified Diff: mojo/public/cpp/bindings/lib/bindings_internal.h

Issue 1618963006: Mojo C++ bindings: support enum validation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/public/cpp/bindings/lib/array_internal.h ('k') | mojo/public/cpp/bindings/lib/template_util.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/cpp/bindings/lib/bindings_internal.h
diff --git a/mojo/public/cpp/bindings/lib/bindings_internal.h b/mojo/public/cpp/bindings/lib/bindings_internal.h
index 6d2562f1b585fa710d9cf892776c721f9b29f4dc..969137678f12419c943f9e8a26e11697ae8a5b66 100644
--- a/mojo/public/cpp/bindings/lib/bindings_internal.h
+++ b/mojo/public/cpp/bindings/lib/bindings_internal.h
@@ -94,12 +94,32 @@ struct IsHandle {
template <typename T>
struct IsUnionDataType {
+ private:
template <typename U>
static YesType Test(const typename U::MojomUnionDataType*);
template <typename U>
static NoType Test(...);
+ EnsureTypeIsComplete<T> check_t_;
+
+ public:
+ static const bool value =
+ sizeof(Test<T>(0)) == sizeof(YesType) && !IsConst<T>::value;
+};
+
+template <typename T>
+struct IsEnumDataType {
+ private:
+ template <typename U>
+ static YesType Test(const typename U::MojomEnumDataType*);
+
+ template <typename U>
+ static NoType Test(...);
+
+ EnsureTypeIsComplete<T> check_t_;
+
+ public:
static const bool value =
sizeof(Test<T>(0)) == sizeof(YesType) && !IsConst<T>::value;
};
« no previous file with comments | « mojo/public/cpp/bindings/lib/array_internal.h ('k') | mojo/public/cpp/bindings/lib/template_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698