• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #include "base/json/json_value_converter.h"
6 
7 namespace base {
8 namespace internal {
9 
Convert(const base::Value & value,int * field) const10 bool BasicValueConverter<int>::Convert(const base::Value& value,
11                                        int* field) const {
12   return value.GetAsInteger(field);
13 }
14 
Convert(const base::Value & value,std::string * field) const15 bool BasicValueConverter<std::string>::Convert(const base::Value& value,
16                                                std::string* field) const {
17   return value.GetAsString(field);
18 }
19 
Convert(const base::Value & value,std::u16string * field) const20 bool BasicValueConverter<std::u16string>::Convert(const base::Value& value,
21                                                   std::u16string* field) const {
22   return value.GetAsString(field);
23 }
24 
Convert(const base::Value & value,double * field) const25 bool BasicValueConverter<double>::Convert(const base::Value& value,
26                                           double* field) const {
27   return value.GetAsDouble(field);
28 }
29 
Convert(const base::Value & value,bool * field) const30 bool BasicValueConverter<bool>::Convert(const base::Value& value,
31                                         bool* field) const {
32   return value.GetAsBoolean(field);
33 }
34 
35 }  // namespace internal
36 }  // namespace base
37