summaryrefslogtreecommitdiffstats
path: root/chromeos/ime/input_method_config.cc
blob: 657550dc1ab62f3051325851098b096393af4761 (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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// Copyright 2013 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 "chromeos/ime/input_method_config.h"

#include <sstream>

#include "base/logging.h"

namespace chromeos {
namespace input_method {

InputMethodConfigValue::InputMethodConfigValue()
    : type(kValueTypeString),
      int_value(0),
      bool_value(false) {
}

InputMethodConfigValue::~InputMethodConfigValue() {
}

std::string InputMethodConfigValue::ToString() const {
  std::stringstream stream;
  stream << "type=" << type;
  switch (type) {
    case kValueTypeString:
      stream << ", string_value=" << string_value;
      break;
    case kValueTypeInt:
      stream << ", int_value=" << int_value;
      break;
    case kValueTypeBool:
      stream << ", bool_value=" << (bool_value ? "true" : "false");
      break;
    case kValueTypeStringList:
      stream << ", string_list_value=";
      for (size_t i = 0; i < string_list_value.size(); ++i) {
        if (i)
          stream << ",";
        stream << string_list_value[i];
      }
      break;
  }
  return stream.str();
}

}  // namespace input_method
}  // namespace chromeos