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

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

Issue 611633002: mojom: Add associative arrays to the mojom language. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Moved test classes to their own shared file. Created 6 years, 2 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/map_serialization.h ('k') | mojo/public/cpp/bindings/lib/validation_errors.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/cpp/bindings/lib/validate_params.h
diff --git a/mojo/public/cpp/bindings/lib/validate_params.h b/mojo/public/cpp/bindings/lib/validate_params.h
new file mode 100644
index 0000000000000000000000000000000000000000..25bd98cb79e69ab33d7dff79c223f47adb77c321
--- /dev/null
+++ b/mojo/public/cpp/bindings/lib/validate_params.h
@@ -0,0 +1,36 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_VALIDATE_PARAMS_H_
+#define MOJO_PUBLIC_CPP_BINDINGS_LIB_VALIDATE_PARAMS_H_
+
+namespace mojo {
+namespace internal {
+
+// Array type information needed for valdiation.
+template <uint32_t in_expected_num_elements,
+ bool in_element_is_nullable,
+ typename InElementValidateParams>
+class ArrayValidateParams {
+ public:
+ // Validation information for elements. It is either another specialization
+ // of ArrayValidateParams (if elements are arrays or maps), or
+ // NoValidateParams. In the case of maps, this is used to validate the value
+ // array.
+ typedef InElementValidateParams ElementValidateParams;
+
+ // If |expected_num_elements| is not 0, the array is expected to have exactly
+ // that number of elements.
+ static const uint32_t expected_num_elements = in_expected_num_elements;
+ // Whether the elements are nullable.
+ static const bool element_is_nullable = in_element_is_nullable;
+};
+
+// NoValidateParams is used to indicate the end of an ArrayValidateParams chain.
+class NoValidateParams {};
+
+} // namespace internal
+} // namespace mojo
+
+#endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_VALIDATE_PARAMS_H_
« no previous file with comments | « mojo/public/cpp/bindings/lib/map_serialization.h ('k') | mojo/public/cpp/bindings/lib/validation_errors.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698