#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "ui/base/ime/character_composer.h"
#include <algorithm>
#include <iterator>
#include <optional>
#include <string>
#include "base/check.h"
#include "base/logging.h"
#include "base/notreached.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversion_utils.h"
#include "base/strings/utf_string_conversions.h"
#include "base/third_party/icu/icu_utf.h"
#include "ui/events/event.h"
#include "ui/events/keycodes/dom/dom_key.h"
#include "ui/events/keycodes/dom/keycode_converter.h"
#include "ui/events/keycodes/keyboard_codes.h"
namespace {
#include "ui/base/ime/character_composer_data.h"
bool CheckCharacterComposeTable(
const ui::CharacterComposer::ComposeBuffer& compose_sequence,
uint32_t* composed_character) { … }
bool UTF32CharacterToUTF16(uint32_t character, std::u16string* output) { … }
int KeycodeToHexDigit(unsigned int keycode) { … }
std::optional<char16_t> DeadKeyToNonCombiningCharacter(ui::DomKey dom_key) { … }
}
namespace ui {
CharacterComposer::CharacterComposer(PreeditStringMode mode)
: … { … }
CharacterComposer::~CharacterComposer() = default;
void CharacterComposer::Reset() { … }
bool CharacterComposer::FilterKeyPress(const ui::KeyEvent& event) { … }
bool CharacterComposer::FilterKeyPressSequenceMode(const KeyEvent& event) { … }
void CharacterComposer::UpdatePreeditStringSequenceMode() { … }
bool CharacterComposer::FilterKeyPressHexMode(const KeyEvent& event) { … }
void CharacterComposer::CommitHex() { … }
void CharacterComposer::UpdatePreeditStringHexMode() { … }
ComposeChecker::CheckSequenceResult TreeComposeChecker::CheckSequence(
const ui::CharacterComposer::ComposeBuffer& sequence,
uint32_t* composed_character) const { … }
bool TreeComposeChecker::Find(uint16_t index,
uint16_t size,
uint16_t key,
uint16_t* value) const { … }
}