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

Side by Side Diff: components/policy/core/common/schema_internal.h

Issue 2539363004: Make base::Value::TYPE a scoped enum. (Closed)
Patch Set: Rebase Created 4 years 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 #ifndef COMPONENTS_POLICY_CORE_COMMON_SCHEMA_INTERNAL_H_ 5 #ifndef COMPONENTS_POLICY_CORE_COMMON_SCHEMA_INTERNAL_H_
6 #define COMPONENTS_POLICY_CORE_COMMON_SCHEMA_INTERNAL_H_ 6 #define COMPONENTS_POLICY_CORE_COMMON_SCHEMA_INTERNAL_H_
7 7
8 #include "base/values.h" 8 #include "base/values.h"
9 #include "components/policy/policy_export.h" 9 #include "components/policy/policy_export.h"
10 10
11 namespace policy { 11 namespace policy {
12 namespace internal { 12 namespace internal {
13 13
14 // These types are used internally by the SchemaOwner parser, and by the 14 // These types are used internally by the SchemaOwner parser, and by the
15 // compile-time code generator. They shouldn't be used directly. 15 // compile-time code generator. They shouldn't be used directly.
16 16
17 // Represents the type of one policy, or an item of a list policy, or a 17 // Represents the type of one policy, or an item of a list policy, or a
18 // property of a map policy. 18 // property of a map policy.
19 struct POLICY_EXPORT SchemaNode { 19 struct POLICY_EXPORT SchemaNode {
20 // The policy type. 20 // The policy type.
21 base::Value::Type type; 21 base::Value::Type type;
22 22
23 // If |type| is TYPE_DICTIONARY then |extra| is an offset into 23 // If |type| is Type::DICTIONARY then |extra| is an offset into
24 // SchemaData::properties_nodes that indexes the PropertiesNode describing 24 // SchemaData::properties_nodes that indexes the PropertiesNode describing
25 // the entries of this dictionary. 25 // the entries of this dictionary.
26 // 26 //
27 // If |type| is TYPE_LIST then |extra| is an offset into 27 // If |type| is Type::LIST then |extra| is an offset into
28 // SchemaData::schema_nodes that indexes the SchemaNode describing the items 28 // SchemaData::schema_nodes that indexes the SchemaNode describing the items
29 // of this list. 29 // of this list.
30 // 30 //
31 // If |type| is TYPE_INTEGER or TYPE_STRING, and contains corresponding 31 // If |type| is Type::INTEGER or Type::STRING, and contains corresponding
32 // restriction (enumeration of possible values, or range for integer), then 32 // restriction (enumeration of possible values, or range for integer), then
33 // |extra| is an offset into SchemaData::restriction_nodes that indexes the 33 // |extra| is an offset into SchemaData::restriction_nodes that indexes the
34 // RestrictionNode describing the restriction on the value. 34 // RestrictionNode describing the restriction on the value.
35 // 35 //
36 // Otherwise extra is -1 and is invalid. 36 // Otherwise extra is -1 and is invalid.
37 int extra; 37 int extra;
38 }; 38 };
39 39
40 // Represents an entry of a map policy. 40 // Represents an entry of a map policy.
41 struct POLICY_EXPORT PropertyNode { 41 struct POLICY_EXPORT PropertyNode {
(...skipping 29 matching lines...) Expand all
71 int pattern_end; 71 int pattern_end;
72 72
73 // If this map policy supports keys with any value (besides the well-known 73 // If this map policy supports keys with any value (besides the well-known
74 // values described in the range [begin, end)) then |additional| is an offset 74 // values described in the range [begin, end)) then |additional| is an offset
75 // into SchemaData::schema_nodes that indexes the SchemaNode describing the 75 // into SchemaData::schema_nodes that indexes the SchemaNode describing the
76 // structure of the values for those keys. Otherwise |additional| is -1 and 76 // structure of the values for those keys. Otherwise |additional| is -1 and
77 // is invalid. 77 // is invalid.
78 int additional; 78 int additional;
79 }; 79 };
80 80
81 // Represents the restriction on TYPE_INTEGER or TYPE_STRING instance of 81 // Represents the restriction on Type::INTEGER or Type::STRING instance of
82 // base::Value. 82 // base::Value.
83 union POLICY_EXPORT RestrictionNode { 83 union POLICY_EXPORT RestrictionNode {
84 // Offsets into SchemaData::int_enums or SchemaData::string_enums, the 84 // Offsets into SchemaData::int_enums or SchemaData::string_enums, the
85 // entry of which describes the enumeration of all possible values of 85 // entry of which describes the enumeration of all possible values of
86 // corresponding integer or string value. |offset_begin| being strictly less 86 // corresponding integer or string value. |offset_begin| being strictly less
87 // than |offset_end| is assumed. 87 // than |offset_end| is assumed.
88 struct EnumerationRestriction { 88 struct EnumerationRestriction {
89 int offset_begin; 89 int offset_begin;
90 int offset_end; 90 int offset_end;
91 } enumeration_restriction; 91 } enumeration_restriction;
(...skipping 27 matching lines...) Expand all
119 const RestrictionNode* restriction_nodes; 119 const RestrictionNode* restriction_nodes;
120 120
121 const int* int_enums; 121 const int* int_enums;
122 const char** string_enums; 122 const char** string_enums;
123 }; 123 };
124 124
125 } // namespace internal 125 } // namespace internal
126 } // namespace policy 126 } // namespace policy
127 127
128 #endif // COMPONENTS_POLICY_CORE_COMMON_SCHEMA_INTERNAL_H_ 128 #endif // COMPONENTS_POLICY_CORE_COMMON_SCHEMA_INTERNAL_H_
OLDNEW
« no previous file with comments | « components/policy/core/common/schema.cc ('k') | components/policy/core/common/schema_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698