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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
49 // the internal representation. If |schema| is invalid then an invalid Schema | 49 // the internal representation. If |schema| is invalid then an invalid Schema |
50 // is returned and |error| contains a reason for the failure. | 50 // is returned and |error| contains a reason for the failure. |
51 static Schema Parse(const std::string& schema, std::string* error); | 51 static Schema Parse(const std::string& schema, std::string* error); |
52 | 52 |
53 // Returns true if this Schema is valid. Schemas returned by the methods below | 53 // Returns true if this Schema is valid. Schemas returned by the methods below |
54 // may be invalid, and in those cases the other methods must not be used. | 54 // may be invalid, and in those cases the other methods must not be used. |
55 bool valid() const { return node_ != NULL; } | 55 bool valid() const { return node_ != NULL; } |
56 | 56 |
57 base::Value::Type type() const; | 57 base::Value::Type type() const; |
58 | 58 |
59 // Returns true if |value| conforms to this Schema. | |
60 bool Matches(const base::Value& value) const; | |
dconnelly
2013/10/31 10:04:16
nit: I think the word "validate" is the generally
Joao da Silva
2013/10/31 13:34:56
Done.
| |
61 | |
59 // Used to iterate over the known properties of TYPE_DICTIONARY schemas. | 62 // Used to iterate over the known properties of TYPE_DICTIONARY schemas. |
60 class POLICY_EXPORT Iterator { | 63 class POLICY_EXPORT Iterator { |
61 public: | 64 public: |
62 Iterator(const scoped_refptr<const InternalStorage>& storage, | 65 Iterator(const scoped_refptr<const InternalStorage>& storage, |
63 const internal::PropertiesNode* node); | 66 const internal::PropertiesNode* node); |
64 Iterator(const Iterator& iterator); | 67 Iterator(const Iterator& iterator); |
65 ~Iterator(); | 68 ~Iterator(); |
66 | 69 |
67 Iterator& operator=(const Iterator& iterator); | 70 Iterator& operator=(const Iterator& iterator); |
68 | 71 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
114 Schema(const scoped_refptr<const InternalStorage>& storage, | 117 Schema(const scoped_refptr<const InternalStorage>& storage, |
115 const internal::SchemaNode* node); | 118 const internal::SchemaNode* node); |
116 | 119 |
117 scoped_refptr<const InternalStorage> storage_; | 120 scoped_refptr<const InternalStorage> storage_; |
118 const internal::SchemaNode* node_; | 121 const internal::SchemaNode* node_; |
119 }; | 122 }; |
120 | 123 |
121 } // namespace policy | 124 } // namespace policy |
122 | 125 |
123 #endif // COMPONENTS_POLICY_CORE_COMMON_SCHEMA_H_ | 126 #endif // COMPONENTS_POLICY_CORE_COMMON_SCHEMA_H_ |
OLD | NEW |