Updating trunk VERSION from 2139.0 to 2140.0
[chromium-blink-merge.git] / chromeos / ime / composition_text.h
blobb79efd9b34ac51df41de7697a1c9ee7a70194b84
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.
5 #ifndef CHROMEOS_IME_COMPOSITION_TEXT_H_
6 #define CHROMEOS_IME_COMPOSITION_TEXT_H_
8 #include <string>
9 #include <vector>
11 #include "base/basictypes.h"
12 #include "base/strings/string16.h"
13 #include "chromeos/chromeos_export.h"
15 namespace chromeos {
17 class CHROMEOS_EXPORT CompositionText {
18 public:
19 enum UnderlineType {
20 COMPOSITION_TEXT_UNDERLINE_SINGLE = 1,
21 COMPOSITION_TEXT_UNDERLINE_DOUBLE = 2,
22 COMPOSITION_TEXT_UNDERLINE_ERROR = 4,
25 struct UnderlineAttribute {
26 UnderlineType type;
27 uint32 start_index; // The inclusive start index.
28 uint32 end_index; // The exclusive end index.
31 CompositionText();
32 virtual ~CompositionText();
34 // Accessors
35 const base::string16& text() const { return text_; }
36 void set_text(const base::string16& text) { text_ = text; }
38 const std::vector<UnderlineAttribute>& underline_attributes() const {
39 return underline_attributes_;
42 std::vector<UnderlineAttribute>* mutable_underline_attributes() {
43 return &underline_attributes_;
46 uint32 selection_start() const { return selection_start_; }
47 void set_selection_start(uint32 selection_start) {
48 selection_start_ = selection_start;
51 uint32 selection_end() const { return selection_end_; }
52 void set_selection_end(uint32 selection_end) {
53 selection_end_ = selection_end;
56 void CopyFrom(const CompositionText& obj);
58 private:
59 base::string16 text_;
60 std::vector<UnderlineAttribute> underline_attributes_;
61 uint32 selection_start_;
62 uint32 selection_end_;
64 DISALLOW_COPY_AND_ASSIGN(CompositionText);
67 } // namespace chromeos
69 #endif // CHROMEOS_IME_COMPOSITION_TEXT_H_