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 #ifndef CHROMEOS_IME_IBUS_TEXT_H_ |
| 6 #define CHROMEOS_IME_IBUS_TEXT_H_ |
| 7 |
| 8 #include <string> |
| 9 #include <vector> |
| 10 #include "base/basictypes.h" |
| 11 #include "chromeos/chromeos_export.h" |
| 12 |
| 13 namespace chromeos { |
| 14 |
| 15 class CHROMEOS_EXPORT IBusText { |
| 16 public: |
| 17 enum IBusTextUnderlineType { |
| 18 IBUS_TEXT_UNDERLINE_SINGLE = 1, |
| 19 IBUS_TEXT_UNDERLINE_DOUBLE = 2, |
| 20 IBUS_TEXT_UNDERLINE_ERROR = 4, |
| 21 }; |
| 22 |
| 23 struct UnderlineAttribute { |
| 24 IBusTextUnderlineType type; |
| 25 uint32 start_index; // The inclusive start index. |
| 26 uint32 end_index; // The exclusive end index. |
| 27 }; |
| 28 |
| 29 struct SelectionAttribute { |
| 30 uint32 start_index; // The inclusive start index. |
| 31 uint32 end_index; // The exclusive end index. |
| 32 }; |
| 33 |
| 34 // Accessors |
| 35 IBusText(); |
| 36 virtual ~IBusText(); |
| 37 |
| 38 const std::string& text() const { return text_; } |
| 39 void set_text(const std::string& text) { text_ = text; } |
| 40 |
| 41 const std::string& annotation() const { return annotation_; } |
| 42 void set_annotation(const std::string& annotation) { |
| 43 annotation_ = annotation; |
| 44 } |
| 45 |
| 46 const std::string& description_title() const { return description_title_; } |
| 47 void set_description_title(const std::string& title) { |
| 48 description_title_ = title; |
| 49 } |
| 50 |
| 51 const std::string& description_body() const { return description_body_; } |
| 52 void set_description_body(const std::string& body) { |
| 53 description_body_ = body; |
| 54 } |
| 55 |
| 56 const std::vector<UnderlineAttribute>& underline_attributes() const { |
| 57 return underline_attributes_; |
| 58 } |
| 59 |
| 60 std::vector<UnderlineAttribute>* mutable_underline_attributes() { |
| 61 return &underline_attributes_; |
| 62 } |
| 63 |
| 64 const std::vector<SelectionAttribute>& selection_attributes() const { |
| 65 return selection_attributes_; |
| 66 } |
| 67 std::vector<SelectionAttribute>* mutable_selection_attributes() { |
| 68 return &selection_attributes_; |
| 69 } |
| 70 |
| 71 void CopyFrom(const IBusText& obj); |
| 72 |
| 73 private: |
| 74 std::string text_; |
| 75 std::string annotation_; |
| 76 std::string description_title_; |
| 77 std::string description_body_; |
| 78 std::vector<UnderlineAttribute> underline_attributes_; |
| 79 std::vector<SelectionAttribute> selection_attributes_; |
| 80 |
| 81 DISALLOW_COPY_AND_ASSIGN(IBusText); |
| 82 }; |
| 83 |
| 84 } // namespace chromeos |
| 85 |
| 86 #endif // CHROMEOS_IME_IBUS_TEXT_H_ |
OLD | NEW |