summaryrefslogtreecommitdiffstats
path: root/tools/json_schema_compiler/any.cc
blob: cd4e5c35c42058eb151c62879c98b074dd89d8e6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "tools/json_schema_compiler/any.h"

#include "base/logging.h"
#include "base/values.h"

namespace json_schema_compiler {
namespace any {

Any::Any() {}

Any::Any(scoped_ptr<base::Value> from_value)
    : value_(from_value.Pass()) {
}

Any::~Any() {}

void Any::Init(const base::Value& from_value) {
  CHECK(!value_.get());
  value_.reset(from_value.DeepCopy());
}

const base::Value& Any::value() const {
  CHECK(value_.get());
  return *value_;
}

}  // namespace any
}  // namespace json_schema_compiler