OLD | NEW |
---|---|
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_H_ | 5 #ifndef COMPONENTS_POLICY_CORE_COMMON_SCHEMA_H_ |
6 #define COMPONENTS_POLICY_CORE_COMMON_SCHEMA_H_ | 6 #define COMPONENTS_POLICY_CORE_COMMON_SCHEMA_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
141 // otherwise invalid memory will be read. A CHECK is currently enforcing this. | 141 // otherwise invalid memory will be read. A CHECK is currently enforcing this. |
142 | 142 |
143 // Returns an iterator that goes over the named properties of this schema. | 143 // Returns an iterator that goes over the named properties of this schema. |
144 // The returned iterator is at the beginning. | 144 // The returned iterator is at the beginning. |
145 Iterator GetPropertiesIterator() const; | 145 Iterator GetPropertiesIterator() const; |
146 | 146 |
147 // Returns the Schema for the property named |key|. If |key| is not a known | 147 // Returns the Schema for the property named |key|. If |key| is not a known |
148 // property name then the returned Schema is not valid. | 148 // property name then the returned Schema is not valid. |
149 Schema GetKnownProperty(const std::string& key) const; | 149 Schema GetKnownProperty(const std::string& key) const; |
150 | 150 |
151 // Returns the Schema for pattern properties. If there are no matched | |
152 // pattern properties for |key| then the returned Schema is not valid. | |
153 Schema GetPatternProperty(const std::string& key) const; | |
Joao da Silva
2014/03/21 12:58:12
This should return a vector of Schemas, with all t
binjin
2014/04/01 12:29:36
Done.
| |
154 | |
151 // Returns the Schema for additional properties. If additional properties are | 155 // Returns the Schema for additional properties. If additional properties are |
152 // not allowed for this Schema then the Schema returned is not valid. | 156 // not allowed for this Schema then the Schema returned is not valid. |
153 Schema GetAdditionalProperties() const; | 157 Schema GetAdditionalProperties() const; |
154 | 158 |
155 // Returns the Schema for |key| if it is a known property, otherwise returns | 159 // Returns the Schema for |key| if it is a known property, otherwise returns |
156 // the Schema for additional properties. | 160 // the Schema for additional properties. |
157 Schema GetProperty(const std::string& key) const; | 161 Schema GetProperty(const std::string& key) const; |
158 | 162 |
159 // Returns the Schema for items of an array. | 163 // Returns the Schema for items of an array. |
160 // This method should be called only if type() == TYPE_LIST, | 164 // This method should be called only if type() == TYPE_LIST, |
161 // otherwise invalid memory will be read. A CHECK is currently enforcing this. | 165 // otherwise invalid memory will be read. A CHECK is currently enforcing this. |
162 Schema GetItems() const; | 166 Schema GetItems() const; |
163 | 167 |
164 private: | 168 private: |
165 // Builds a schema pointing to the inner structure of |storage|, | 169 // Builds a schema pointing to the inner structure of |storage|, |
166 // rooted at |node|. | 170 // rooted at |node|. |
167 Schema(const scoped_refptr<const InternalStorage>& storage, | 171 Schema(const scoped_refptr<const InternalStorage>& storage, |
168 const internal::SchemaNode* node); | 172 const internal::SchemaNode* node); |
169 | 173 |
170 bool ValidateIntegerRestriction(int index, int value) const; | 174 bool ValidateIntegerRestriction(int index, int value) const; |
171 bool ValidateStringRestriction(int index, const char* str) const; | 175 bool ValidateStringRestriction(int index, const char* str) const; |
172 | 176 |
173 scoped_refptr<const InternalStorage> storage_; | 177 scoped_refptr<const InternalStorage> storage_; |
174 const internal::SchemaNode* node_; | 178 const internal::SchemaNode* node_; |
175 }; | 179 }; |
176 | 180 |
177 } // namespace policy | 181 } // namespace policy |
178 | 182 |
179 #endif // COMPONENTS_POLICY_CORE_COMMON_SCHEMA_H_ | 183 #endif // COMPONENTS_POLICY_CORE_COMMON_SCHEMA_H_ |
OLD | NEW |