fb22eae072
If a class has a constructor which can be called with a single argument, then this constructor becomes conversion constructor because such a constructor allows conversion of the single argument to the class being constructed. To ensure these constructors are passed the argument of its type, I labeled them explicit. In some header files, there were constructors that took a value that could involve implicit conversions, so I added explicit to ensure that does not happen.
34 lines
780 B
C++
34 lines
780 B
C++
/*++
|
|
|
|
Copyright (c) Microsoft Corporation.
|
|
Licensed under the MIT license.
|
|
|
|
Module Name:
|
|
|
|
ConsoleInputReader.h
|
|
|
|
Abstract:
|
|
|
|
This file contains a class whose sole purpose is to
|
|
abstract away a bunch of details you usually need to
|
|
know to read VT from a console input handle.
|
|
|
|
--*/
|
|
|
|
class ConsoleInputReader
|
|
{
|
|
public:
|
|
explicit ConsoleInputReader(HANDLE handle);
|
|
void SetWindowSizeChangedCallback(std::function<void()> callback);
|
|
std::optional<std::wstring_view> Read();
|
|
|
|
private:
|
|
static constexpr size_t BufferSize{ 128 };
|
|
|
|
HANDLE _handle;
|
|
std::wstring _convertedString;
|
|
std::vector<INPUT_RECORD> _buffer;
|
|
std::optional<wchar_t> _highSurrogate;
|
|
std::function<void()> _windowSizeChangedCallback;
|
|
};
|