| 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 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 | 23 |
| 24 } // namespace internal | 24 } // namespace internal |
| 25 | 25 |
| 26 // Describes the expected type of one policy. Also recursively describes the | 26 // Describes the expected type of one policy. Also recursively describes the |
| 27 // types of inner elements, for structured types. | 27 // types of inner elements, for structured types. |
| 28 // Objects of this class refer to external, immutable data and are cheap to | 28 // Objects of this class refer to external, immutable data and are cheap to |
| 29 // copy. | 29 // copy. |
| 30 // Use the SchemaOwner class to parse a schema and get Schema objects. | 30 // Use the SchemaOwner class to parse a schema and get Schema objects. |
| 31 class POLICY_EXPORT Schema { | 31 class POLICY_EXPORT Schema { |
| 32 public: | 32 public: |
| 33 // Builds an empty, invalid schema. |
| 34 Schema(); |
| 35 |
| 36 // Builds a schema pointing to the inner structure of |schema|. If |schema| |
| 37 // is NULL then this Schema instance will be invalid. |
| 38 // Does not take ownership of |schema|. |
| 33 explicit Schema(const internal::SchemaNode* schema); | 39 explicit Schema(const internal::SchemaNode* schema); |
| 40 |
| 34 Schema(const Schema& schema); | 41 Schema(const Schema& schema); |
| 35 | 42 |
| 36 Schema& operator=(const Schema& schema); | 43 Schema& operator=(const Schema& schema); |
| 37 | 44 |
| 38 // Returns true if this Schema is valid. Schemas returned by the methods below | 45 // Returns true if this Schema is valid. Schemas returned by the methods below |
| 39 // may be invalid, and in those cases the other methods must not be used. | 46 // may be invalid, and in those cases the other methods must not be used. |
| 40 bool valid() const { return schema_ != NULL; } | 47 bool valid() const { return schema_ != NULL; } |
| 41 | 48 |
| 42 base::Value::Type type() const; | 49 base::Value::Type type() const; |
| 43 | 50 |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 std::vector<internal::PropertyNode*> property_nodes_; | 148 std::vector<internal::PropertyNode*> property_nodes_; |
| 142 ScopedVector<internal::PropertiesNode> properties_nodes_; | 149 ScopedVector<internal::PropertiesNode> properties_nodes_; |
| 143 ScopedVector<std::string> keys_; | 150 ScopedVector<std::string> keys_; |
| 144 | 151 |
| 145 DISALLOW_COPY_AND_ASSIGN(SchemaOwner); | 152 DISALLOW_COPY_AND_ASSIGN(SchemaOwner); |
| 146 }; | 153 }; |
| 147 | 154 |
| 148 } // namespace policy | 155 } // namespace policy |
| 149 | 156 |
| 150 #endif // COMPONENTS_POLICY_CORE_COMMON_SCHEMA_H_ | 157 #endif // COMPONENTS_POLICY_CORE_COMMON_SCHEMA_H_ |
| OLD | NEW |