80da24ecf8
We were using std::basic_string_view as a stand-in for std::span so that
we could change over all at once when C++20 dropped with full span
support. That day's not here yet, but as of 54a7fce3e
we're using GSL 3,
whose span is C++20-compliant.
This commit replaces every instance of basic_string_view that was not
referring to an actual string with a span of the appropriate type.
I moved the `const` qualifier into span's `T` because while
`basic_string_view.at()` returns `const T&`, `span.at()` returns `T&`
(without the const). I wanted to maintain the invariant that members of
the span were immutable.
* Mechanical Changes
* `sv.at(x)` -> `gsl::at(sp, x)`
* `sv.c{begin,end}` -> `sp.{begin,end}` (span's iterators are const)
I had to replace a `std::basic_string<>` with a `std::vector<>` in
ConImeInfo, and I chose to replace a manual array walk in
ScreenInfoUiaProviderBase with a ranged-for. Please review those
specifically.
This will almost certainly cause a code size regression in Windows
because I'm blowing out all the PGO counts. Whoops.
Related: #3956, #975.
59 lines
1.6 KiB
C++
59 lines
1.6 KiB
C++
/*++
|
|
|
|
Copyright (c) Microsoft Corporation.
|
|
Licensed under the MIT license.
|
|
|
|
Module Name:
|
|
|
|
conime.h
|
|
|
|
Abstract:
|
|
|
|
This module contains the internal structures and definitions used
|
|
by the console IME.
|
|
|
|
Author:
|
|
|
|
v-HirShi Jul.4.1995
|
|
|
|
Revision History:
|
|
|
|
--*/
|
|
|
|
#pragma once
|
|
|
|
constexpr unsigned short CONIME_ATTRCOLOR_SIZE = 8;
|
|
|
|
constexpr BYTE CONIME_CURSOR_RIGHT = 0x10;
|
|
constexpr BYTE CONIME_CURSOR_LEFT = 0x20;
|
|
|
|
[[nodiscard]] HRESULT ImeStartComposition();
|
|
|
|
[[nodiscard]] HRESULT ImeEndComposition();
|
|
|
|
[[nodiscard]] HRESULT ImeComposeData(std::wstring_view text,
|
|
gsl::span<const BYTE> attributes,
|
|
gsl::span<const WORD> colorArray);
|
|
|
|
[[nodiscard]] HRESULT ImeClearComposeData();
|
|
|
|
[[nodiscard]] HRESULT ImeComposeResult(std::wstring_view text);
|
|
|
|
// Default composition color attributes
|
|
#define DEFAULT_COMP_ENTERED \
|
|
(FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED | \
|
|
COMMON_LVB_UNDERSCORE)
|
|
#define DEFAULT_COMP_ALREADY_CONVERTED \
|
|
(FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED | \
|
|
BACKGROUND_BLUE)
|
|
#define DEFAULT_COMP_CONVERSION \
|
|
(FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED | \
|
|
COMMON_LVB_UNDERSCORE)
|
|
#define DEFAULT_COMP_YET_CONVERTED \
|
|
(FOREGROUND_BLUE | \
|
|
BACKGROUND_BLUE | BACKGROUND_GREEN | BACKGROUND_RED | \
|
|
COMMON_LVB_UNDERSCORE)
|
|
#define DEFAULT_COMP_INPUT_ERROR \
|
|
(FOREGROUND_RED | \
|
|
COMMON_LVB_UNDERSCORE)
|