OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Functions to help with verifying various |Mojo...Options| structs from the | 5 // Functions to help with verifying various |Mojo...Options| structs from the |
6 // (public, C) API. These are "extensible" structs, which all have |struct_size| | 6 // (public, C) API. These are "extensible" structs, which all have |struct_size| |
7 // as their first member. All fields (other than |struct_size|) are optional, | 7 // as their first member. All fields (other than |struct_size|) are optional, |
8 // but any |flags| specified must be known to the system (otherwise, an error of | 8 // but any |flags| specified must be known to the system (otherwise, an error of |
9 // |MOJO_RESULT_UNIMPLEMENTED| should be returned). | 9 // |MOJO_RESULT_UNIMPLEMENTED| should be returned). |
10 | 10 |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 // TODO(vtl): With C++11, use |sizeof(Options::member)| instead of (the | 93 // TODO(vtl): With C++11, use |sizeof(Options::member)| instead of (the |
94 // contortion below). We might also be able to pull out the type |Options| from | 94 // contortion below). We might also be able to pull out the type |Options| from |
95 // |reader| (using |decltype|) instead of requiring a parameter. | 95 // |reader| (using |decltype|) instead of requiring a parameter. |
96 #define OPTIONS_STRUCT_HAS_MEMBER(Options, member, reader) \ | 96 #define OPTIONS_STRUCT_HAS_MEMBER(Options, member, reader) \ |
97 reader.HasMember(offsetof(Options, member), sizeof(reader.options().member)) | 97 reader.HasMember(offsetof(Options, member), sizeof(reader.options().member)) |
98 | 98 |
99 } // namespace system | 99 } // namespace system |
100 } // namespace mojo | 100 } // namespace mojo |
101 | 101 |
102 #endif // MOJO_EDK_SYSTEM_OPTIONS_VALIDATION_H_ | 102 #endif // MOJO_EDK_SYSTEM_OPTIONS_VALIDATION_H_ |
OLD | NEW |