OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "chrome/browser/chromeos/input_method/input_method_config.h" | |
6 | |
7 #include <sstream> | |
8 | |
9 #include "base/logging.h" | |
10 | |
11 namespace chromeos { | |
12 namespace input_method { | |
13 | |
14 InputMethodConfigValue::InputMethodConfigValue() | |
15 : type(kValueTypeString), | |
16 int_value(0), | |
17 bool_value(false) { | |
18 } | |
19 | |
20 InputMethodConfigValue::~InputMethodConfigValue() { | |
21 } | |
22 | |
23 std::string InputMethodConfigValue::ToString() const { | |
24 std::stringstream stream; | |
25 stream << "type=" << type; | |
26 switch (type) { | |
27 case kValueTypeString: | |
28 stream << ", string_value=" << string_value; | |
29 break; | |
30 case kValueTypeInt: | |
31 stream << ", int_value=" << int_value; | |
32 break; | |
33 case kValueTypeBool: | |
34 stream << ", bool_value=" << (bool_value ? "true" : "false"); | |
35 break; | |
36 case kValueTypeStringList: | |
37 stream << ", string_list_value="; | |
38 for (size_t i = 0; i < string_list_value.size(); ++i) { | |
39 if (i) | |
40 stream << ","; | |
41 stream << string_list_value[i]; | |
42 } | |
43 break; | |
44 } | |
45 return stream.str(); | |
46 } | |
47 | |
48 } // namespace input_method | |
49 } // namespace chromeos | |
OLD | NEW |