OLD | NEW |
| (Empty) |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_VALIDATE_PARAMS_H_ | |
6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_VALIDATE_PARAMS_H_ | |
7 | |
8 namespace mojo { | |
9 namespace internal { | |
10 | |
11 // Array type information needed for valdiation. | |
12 template <uint32_t in_expected_num_elements, | |
13 bool in_element_is_nullable, | |
14 typename InElementValidateParams> | |
15 class ArrayValidateParams { | |
16 public: | |
17 // Validation information for elements. It is either another specialization | |
18 // of ArrayValidateParams (if elements are arrays or maps), or | |
19 // NoValidateParams. In the case of maps, this is used to validate the value | |
20 // array. | |
21 typedef InElementValidateParams ElementValidateParams; | |
22 | |
23 // If |expected_num_elements| is not 0, the array is expected to have exactly | |
24 // that number of elements. | |
25 static const uint32_t expected_num_elements = in_expected_num_elements; | |
26 // Whether the elements are nullable. | |
27 static const bool element_is_nullable = in_element_is_nullable; | |
28 }; | |
29 | |
30 // NoValidateParams is used to indicate the end of an ArrayValidateParams chain. | |
31 class NoValidateParams {}; | |
32 | |
33 } // namespace internal | |
34 } // namespace mojo | |
35 | |
36 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_VALIDATE_PARAMS_H_ | |
OLD | NEW |