summaryrefslogtreecommitdiff
path: root/chromium/ui/base/ime/grammar_fragment.h
blob: 6f0535aefeeddfd7cf883f5e0d8ea9a71b93967d (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
// Copyright (c) 2021 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.

#ifndef UI_BASE_IME_GRAMMAR_FRAGMENT_H_
#define UI_BASE_IME_GRAMMAR_FRAGMENT_H_

#include <string>

#include "base/component_export.h"
#include "ui/gfx/range/range.h"

namespace ui {

// A struct represents a fragment of grammar edit suggestion.
struct COMPONENT_EXPORT(UI_BASE_IME_TYPES) GrammarFragment {
  GrammarFragment(const gfx::Range& range,
                  const std::string& suggestion,
                  const std::string& original_text = std::string());
  GrammarFragment(const GrammarFragment& other);
  ~GrammarFragment();

  bool operator==(const GrammarFragment& other) const;
  bool operator!=(const GrammarFragment& other) const;

  // The range of the marker, visual indications such as underlining are
  // expected to show in this range.
  gfx::Range range;

  // The replacement text suggested by the grammar model.
  std::string suggestion;

  // The original text to be replaced.
  std::string original_text;
};

}  // namespace ui

#endif  // UI_BASE_IME_GRAMMAR_FRAGMENT_H_