OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 TOOLS_JSON_SCHEMA_COMPILER_ANY_H__ | 5 #ifndef TOOLS_JSON_SCHEMA_COMPILER_ANY_H__ |
6 #define TOOLS_JSON_SCHEMA_COMPILER_ANY_H__ | 6 #define TOOLS_JSON_SCHEMA_COMPILER_ANY_H__ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 | 10 |
11 namespace base { | 11 namespace base { |
12 class Value; | 12 class Value; |
13 } | 13 } |
14 | 14 |
15 namespace json_schema_compiler { | 15 namespace json_schema_compiler { |
16 namespace any { | 16 namespace any { |
17 | 17 |
18 // Represents an "any" type in JSON schema as a wrapped Value. | 18 // Represents an "any" type in JSON schema as a wrapped Value. |
19 class Any { | 19 class Any { |
20 public: | 20 public: |
21 Any(); | 21 Any(); |
| 22 explicit Any(scoped_ptr<base::Value> from_value); |
22 ~Any(); | 23 ~Any(); |
23 | 24 |
24 // Initializes the Value in this Any. Fails if already initialized. | 25 // Initializes the Value in this Any. Fails if already initialized. |
25 void Init(const base::Value& from_value); | 26 void Init(const base::Value& from_value); |
26 | 27 |
27 // Get the Value from this Any. | 28 // Get the Value from this Any. |
28 const base::Value& value() const; | 29 const base::Value& value() const; |
29 | 30 |
30 private: | 31 private: |
31 scoped_ptr<base::Value> value_; | 32 scoped_ptr<base::Value> value_; |
32 | 33 |
33 DISALLOW_COPY_AND_ASSIGN(Any); | 34 DISALLOW_COPY_AND_ASSIGN(Any); |
34 }; | 35 }; |
35 | 36 |
36 } // namespace any | 37 } // namespace any |
37 } // namespace json_schema_compiler | 38 } // namespace json_schema_compiler |
38 | 39 |
39 #endif // TOOLS_JSON_SCHEMA_COMPILER_ANY_H__ | 40 #endif // TOOLS_JSON_SCHEMA_COMPILER_ANY_H__ |
OLD | NEW |