1 // Copyright 2013 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.
5 #ifndef CHROMEOS_IME_IBUS_TEXT_H_
6 #define CHROMEOS_IME_IBUS_TEXT_H_
10 #include "base/basictypes.h"
11 #include "chromeos/chromeos_export.h"
15 class CHROMEOS_EXPORT IBusText {
17 enum IBusTextUnderlineType {
18 IBUS_TEXT_UNDERLINE_SINGLE = 1,
19 IBUS_TEXT_UNDERLINE_DOUBLE = 2,
20 IBUS_TEXT_UNDERLINE_ERROR = 4,
23 struct UnderlineAttribute {
24 IBusTextUnderlineType type;
25 uint32 start_index; // The inclusive start index.
26 uint32 end_index; // The exclusive end index.
33 const std::string& text() const { return text_; }
34 void set_text(const std::string& text) { text_ = text; }
36 const std::vector<UnderlineAttribute>& underline_attributes() const {
37 return underline_attributes_;
40 std::vector<UnderlineAttribute>* mutable_underline_attributes() {
41 return &underline_attributes_;
44 uint32 selection_start() const { return selection_start_; }
45 void set_selection_start(uint32 selection_start) {
46 selection_start_ = selection_start;
49 uint32 selection_end() const { return selection_end_; }
50 void set_selection_end(uint32 selection_end) {
51 selection_end_ = selection_end;
54 void CopyFrom(const IBusText& obj);
58 std::vector<UnderlineAttribute> underline_attributes_;
59 uint32 selection_start_;
60 uint32 selection_end_;
62 DISALLOW_COPY_AND_ASSIGN(IBusText);
65 } // namespace chromeos
67 #endif // CHROMEOS_IME_IBUS_TEXT_H_