Chromium Code Reviews| 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 of | |
| 18 // ArrayValidateParams (if elements are arrays) or NoValidateParams. | |
|
yzshen1
2014/10/08 21:58:33
Elements may be maps, too.
| |
| 19 typedef InElementValidateParams ElementValidateParams; | |
| 20 | |
| 21 // If |expected_num_elements| is not 0, the array is expected to have exactly | |
| 22 // that number of elements. | |
| 23 static const uint32_t expected_num_elements = in_expected_num_elements; | |
| 24 // Whether the elements are nullable. | |
| 25 static const bool element_is_nullable = in_element_is_nullable; | |
| 26 }; | |
| 27 | |
| 28 // NoValidateParams is used to indicate the end of an ArrayValidateParams chain. | |
| 29 class NoValidateParams {}; | |
| 30 | |
| 31 } // namespace internal | |
| 32 } // namespace mojo | |
| 33 | |
| 34 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_VALIDATE_PARAMS_H_ | |
| OLD | NEW |