Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup #306

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 6 additions & 13 deletions cpp-terminal/platforms/conversion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,19 +105,12 @@

bool is_valid_utf8_code_unit(const std::string& s)
{
static const constexpr int b1OOOOOOO{128};
static const constexpr int b11OOOOOO{192};
static const constexpr int b111OOOOO{224};
static const constexpr int b1111OOOO{240};
static const constexpr int b11111OOO{248};
switch(s.size())
{
case 1: return ((s[0] & b1OOOOOOO) == 0) ? true : false;
case 2: return ((s[0] & b111OOOOO) == b11OOOOOO) && ((s[1] & b11OOOOOO) == b1OOOOOOO) ? true : false;
case 3: return ((s[0] & b1111OOOO) == b111OOOOO) && ((s[1] & b11OOOOOO) == b1OOOOOOO) && ((s[2] & b11OOOOOO) == b1OOOOOOO) ? true : false;
case 4: return ((s[0] & b11111OOO) == b1111OOOO) && ((s[1] & b11OOOOOO) == b1OOOOOOO) && ((s[2] & b11OOOOOO) == b1OOOOOOO) && ((s[3] & b11OOOOOO) == b1OOOOOOO) ? true : false;
default: return false;
}
static constexpr const int b1OOOOOOO{128};

Check warning on line 108 in cpp-terminal/platforms/conversion.cpp

View workflow job for this annotation

GitHub Actions / msvc2022 win32 (c++14)

'int const `bool __cdecl Term::Private::is_valid_utf8_code_unit(std::basic_string<char,std::char_traits<char>,std::allocator<char> > const &)'::`2'::b1OOOOOOO': 'const' variable is not used [D:\a\cpp-terminal\cpp-terminal\build\cpp-terminal\platforms\cpp-terminal-platforms.vcxproj]

Check warning on line 108 in cpp-terminal/platforms/conversion.cpp

View workflow job for this annotation

GitHub Actions / msvc2022 win32 (c++20)

'int const `bool __cdecl Term::Private::is_valid_utf8_code_unit(std::basic_string<char,std::char_traits<char>,std::allocator<char> > const &)'::`2'::b1OOOOOOO': 'const' variable is not used [D:\a\cpp-terminal\cpp-terminal\build\cpp-terminal\platforms\cpp-terminal-platforms.vcxproj]

Check warning on line 108 in cpp-terminal/platforms/conversion.cpp

View workflow job for this annotation

GitHub Actions / msvc2022 win32 (c++11)

'int const `bool __cdecl Term::Private::is_valid_utf8_code_unit(std::basic_string<char,std::char_traits<char>,std::allocator<char> > const &)'::`2'::b1OOOOOOO': 'const' variable is not used [D:\a\cpp-terminal\cpp-terminal\build\cpp-terminal\platforms\cpp-terminal-platforms.vcxproj]

Check warning on line 108 in cpp-terminal/platforms/conversion.cpp

View workflow job for this annotation

GitHub Actions / msvc2022 win32 (c++17)

'int const `bool __cdecl Term::Private::is_valid_utf8_code_unit(std::basic_string<char,std::char_traits<char>,std::allocator<char> > const &)'::`2'::b1OOOOOOO': 'const' variable is not used [D:\a\cpp-terminal\cpp-terminal\build\cpp-terminal\platforms\cpp-terminal-platforms.vcxproj]

Check warning on line 108 in cpp-terminal/platforms/conversion.cpp

View workflow job for this annotation

GitHub Actions / msvc2022 x64 (c++11)

'int const `bool __cdecl Term::Private::is_valid_utf8_code_unit(std::basic_string<char,std::char_traits<char>,std::allocator<char> > const &)'::`2'::b1OOOOOOO': 'const' variable is not used [D:\a\cpp-terminal\cpp-terminal\build\cpp-terminal\platforms\cpp-terminal-platforms.vcxproj]

Check warning on line 108 in cpp-terminal/platforms/conversion.cpp

View workflow job for this annotation

GitHub Actions / msvc2022 x64 (c++17)

'int const `bool __cdecl Term::Private::is_valid_utf8_code_unit(std::basic_string<char,std::char_traits<char>,std::allocator<char> > const &)'::`2'::b1OOOOOOO': 'const' variable is not used [D:\a\cpp-terminal\cpp-terminal\build\cpp-terminal\platforms\cpp-terminal-platforms.vcxproj]

Check warning on line 108 in cpp-terminal/platforms/conversion.cpp

View workflow job for this annotation

GitHub Actions / msvc2022 x64 (c++14)

'int const `bool __cdecl Term::Private::is_valid_utf8_code_unit(std::basic_string<char,std::char_traits<char>,std::allocator<char> > const &)'::`2'::b1OOOOOOO': 'const' variable is not used [D:\a\cpp-terminal\cpp-terminal\build\cpp-terminal\platforms\cpp-terminal-platforms.vcxproj]

Check warning on line 108 in cpp-terminal/platforms/conversion.cpp

View workflow job for this annotation

GitHub Actions / msvc2022 x64 (c++20)

'int const `bool __cdecl Term::Private::is_valid_utf8_code_unit(std::basic_string<char,std::char_traits<char>,std::allocator<char> > const &)'::`2'::b1OOOOOOO': 'const' variable is not used [D:\a\cpp-terminal\cpp-terminal\build\cpp-terminal\platforms\cpp-terminal-platforms.vcxproj]
static constexpr const int b11OOOOOO{192};

Check warning on line 109 in cpp-terminal/platforms/conversion.cpp

View workflow job for this annotation

GitHub Actions / msvc2022 win32 (c++14)

'int const `bool __cdecl Term::Private::is_valid_utf8_code_unit(std::basic_string<char,std::char_traits<char>,std::allocator<char> > const &)'::`2'::b11OOOOOO': 'const' variable is not used [D:\a\cpp-terminal\cpp-terminal\build\cpp-terminal\platforms\cpp-terminal-platforms.vcxproj]

Check warning on line 109 in cpp-terminal/platforms/conversion.cpp

View workflow job for this annotation

GitHub Actions / msvc2022 win32 (c++20)

'int const `bool __cdecl Term::Private::is_valid_utf8_code_unit(std::basic_string<char,std::char_traits<char>,std::allocator<char> > const &)'::`2'::b11OOOOOO': 'const' variable is not used [D:\a\cpp-terminal\cpp-terminal\build\cpp-terminal\platforms\cpp-terminal-platforms.vcxproj]

Check warning on line 109 in cpp-terminal/platforms/conversion.cpp

View workflow job for this annotation

GitHub Actions / msvc2022 win32 (c++11)

'int const `bool __cdecl Term::Private::is_valid_utf8_code_unit(std::basic_string<char,std::char_traits<char>,std::allocator<char> > const &)'::`2'::b11OOOOOO': 'const' variable is not used [D:\a\cpp-terminal\cpp-terminal\build\cpp-terminal\platforms\cpp-terminal-platforms.vcxproj]

Check warning on line 109 in cpp-terminal/platforms/conversion.cpp

View workflow job for this annotation

GitHub Actions / msvc2022 win32 (c++17)

'int const `bool __cdecl Term::Private::is_valid_utf8_code_unit(std::basic_string<char,std::char_traits<char>,std::allocator<char> > const &)'::`2'::b11OOOOOO': 'const' variable is not used [D:\a\cpp-terminal\cpp-terminal\build\cpp-terminal\platforms\cpp-terminal-platforms.vcxproj]

Check warning on line 109 in cpp-terminal/platforms/conversion.cpp

View workflow job for this annotation

GitHub Actions / msvc2022 x64 (c++11)

'int const `bool __cdecl Term::Private::is_valid_utf8_code_unit(std::basic_string<char,std::char_traits<char>,std::allocator<char> > const &)'::`2'::b11OOOOOO': 'const' variable is not used [D:\a\cpp-terminal\cpp-terminal\build\cpp-terminal\platforms\cpp-terminal-platforms.vcxproj]

Check warning on line 109 in cpp-terminal/platforms/conversion.cpp

View workflow job for this annotation

GitHub Actions / msvc2022 x64 (c++17)

'int const `bool __cdecl Term::Private::is_valid_utf8_code_unit(std::basic_string<char,std::char_traits<char>,std::allocator<char> > const &)'::`2'::b11OOOOOO': 'const' variable is not used [D:\a\cpp-terminal\cpp-terminal\build\cpp-terminal\platforms\cpp-terminal-platforms.vcxproj]

Check warning on line 109 in cpp-terminal/platforms/conversion.cpp

View workflow job for this annotation

GitHub Actions / msvc2022 x64 (c++14)

'int const `bool __cdecl Term::Private::is_valid_utf8_code_unit(std::basic_string<char,std::char_traits<char>,std::allocator<char> > const &)'::`2'::b11OOOOOO': 'const' variable is not used [D:\a\cpp-terminal\cpp-terminal\build\cpp-terminal\platforms\cpp-terminal-platforms.vcxproj]

Check warning on line 109 in cpp-terminal/platforms/conversion.cpp

View workflow job for this annotation

GitHub Actions / msvc2022 x64 (c++20)

'int const `bool __cdecl Term::Private::is_valid_utf8_code_unit(std::basic_string<char,std::char_traits<char>,std::allocator<char> > const &)'::`2'::b11OOOOOO': 'const' variable is not used [D:\a\cpp-terminal\cpp-terminal\build\cpp-terminal\platforms\cpp-terminal-platforms.vcxproj]
static constexpr const int b111OOOOO{224};

Check warning on line 110 in cpp-terminal/platforms/conversion.cpp

View workflow job for this annotation

GitHub Actions / msvc2022 win32 (c++14)

'int const `bool __cdecl Term::Private::is_valid_utf8_code_unit(std::basic_string<char,std::char_traits<char>,std::allocator<char> > const &)'::`2'::b111OOOOO': 'const' variable is not used [D:\a\cpp-terminal\cpp-terminal\build\cpp-terminal\platforms\cpp-terminal-platforms.vcxproj]

Check warning on line 110 in cpp-terminal/platforms/conversion.cpp

View workflow job for this annotation

GitHub Actions / msvc2022 win32 (c++20)

'int const `bool __cdecl Term::Private::is_valid_utf8_code_unit(std::basic_string<char,std::char_traits<char>,std::allocator<char> > const &)'::`2'::b111OOOOO': 'const' variable is not used [D:\a\cpp-terminal\cpp-terminal\build\cpp-terminal\platforms\cpp-terminal-platforms.vcxproj]

Check warning on line 110 in cpp-terminal/platforms/conversion.cpp

View workflow job for this annotation

GitHub Actions / msvc2022 win32 (c++11)

'int const `bool __cdecl Term::Private::is_valid_utf8_code_unit(std::basic_string<char,std::char_traits<char>,std::allocator<char> > const &)'::`2'::b111OOOOO': 'const' variable is not used [D:\a\cpp-terminal\cpp-terminal\build\cpp-terminal\platforms\cpp-terminal-platforms.vcxproj]

Check warning on line 110 in cpp-terminal/platforms/conversion.cpp

View workflow job for this annotation

GitHub Actions / msvc2022 win32 (c++17)

'int const `bool __cdecl Term::Private::is_valid_utf8_code_unit(std::basic_string<char,std::char_traits<char>,std::allocator<char> > const &)'::`2'::b111OOOOO': 'const' variable is not used [D:\a\cpp-terminal\cpp-terminal\build\cpp-terminal\platforms\cpp-terminal-platforms.vcxproj]

Check warning on line 110 in cpp-terminal/platforms/conversion.cpp

View workflow job for this annotation

GitHub Actions / msvc2022 x64 (c++11)

'int const `bool __cdecl Term::Private::is_valid_utf8_code_unit(std::basic_string<char,std::char_traits<char>,std::allocator<char> > const &)'::`2'::b111OOOOO': 'const' variable is not used [D:\a\cpp-terminal\cpp-terminal\build\cpp-terminal\platforms\cpp-terminal-platforms.vcxproj]

Check warning on line 110 in cpp-terminal/platforms/conversion.cpp

View workflow job for this annotation

GitHub Actions / msvc2022 x64 (c++17)

'int const `bool __cdecl Term::Private::is_valid_utf8_code_unit(std::basic_string<char,std::char_traits<char>,std::allocator<char> > const &)'::`2'::b111OOOOO': 'const' variable is not used [D:\a\cpp-terminal\cpp-terminal\build\cpp-terminal\platforms\cpp-terminal-platforms.vcxproj]

Check warning on line 110 in cpp-terminal/platforms/conversion.cpp

View workflow job for this annotation

GitHub Actions / msvc2022 x64 (c++14)

'int const `bool __cdecl Term::Private::is_valid_utf8_code_unit(std::basic_string<char,std::char_traits<char>,std::allocator<char> > const &)'::`2'::b111OOOOO': 'const' variable is not used [D:\a\cpp-terminal\cpp-terminal\build\cpp-terminal\platforms\cpp-terminal-platforms.vcxproj]

Check warning on line 110 in cpp-terminal/platforms/conversion.cpp

View workflow job for this annotation

GitHub Actions / msvc2022 x64 (c++20)

'int const `bool __cdecl Term::Private::is_valid_utf8_code_unit(std::basic_string<char,std::char_traits<char>,std::allocator<char> > const &)'::`2'::b111OOOOO': 'const' variable is not used [D:\a\cpp-terminal\cpp-terminal\build\cpp-terminal\platforms\cpp-terminal-platforms.vcxproj]
static constexpr const int b1111OOOO{240};

Check warning on line 111 in cpp-terminal/platforms/conversion.cpp

View workflow job for this annotation

GitHub Actions / msvc2022 win32 (c++14)

'int const `bool __cdecl Term::Private::is_valid_utf8_code_unit(std::basic_string<char,std::char_traits<char>,std::allocator<char> > const &)'::`2'::b1111OOOO': 'const' variable is not used [D:\a\cpp-terminal\cpp-terminal\build\cpp-terminal\platforms\cpp-terminal-platforms.vcxproj]

Check warning on line 111 in cpp-terminal/platforms/conversion.cpp

View workflow job for this annotation

GitHub Actions / msvc2022 win32 (c++20)

'int const `bool __cdecl Term::Private::is_valid_utf8_code_unit(std::basic_string<char,std::char_traits<char>,std::allocator<char> > const &)'::`2'::b1111OOOO': 'const' variable is not used [D:\a\cpp-terminal\cpp-terminal\build\cpp-terminal\platforms\cpp-terminal-platforms.vcxproj]

Check warning on line 111 in cpp-terminal/platforms/conversion.cpp

View workflow job for this annotation

GitHub Actions / msvc2022 win32 (c++11)

'int const `bool __cdecl Term::Private::is_valid_utf8_code_unit(std::basic_string<char,std::char_traits<char>,std::allocator<char> > const &)'::`2'::b1111OOOO': 'const' variable is not used [D:\a\cpp-terminal\cpp-terminal\build\cpp-terminal\platforms\cpp-terminal-platforms.vcxproj]

Check warning on line 111 in cpp-terminal/platforms/conversion.cpp

View workflow job for this annotation

GitHub Actions / msvc2022 win32 (c++17)

'int const `bool __cdecl Term::Private::is_valid_utf8_code_unit(std::basic_string<char,std::char_traits<char>,std::allocator<char> > const &)'::`2'::b1111OOOO': 'const' variable is not used [D:\a\cpp-terminal\cpp-terminal\build\cpp-terminal\platforms\cpp-terminal-platforms.vcxproj]

Check warning on line 111 in cpp-terminal/platforms/conversion.cpp

View workflow job for this annotation

GitHub Actions / msvc2022 x64 (c++11)

'int const `bool __cdecl Term::Private::is_valid_utf8_code_unit(std::basic_string<char,std::char_traits<char>,std::allocator<char> > const &)'::`2'::b1111OOOO': 'const' variable is not used [D:\a\cpp-terminal\cpp-terminal\build\cpp-terminal\platforms\cpp-terminal-platforms.vcxproj]

Check warning on line 111 in cpp-terminal/platforms/conversion.cpp

View workflow job for this annotation

GitHub Actions / msvc2022 x64 (c++17)

'int const `bool __cdecl Term::Private::is_valid_utf8_code_unit(std::basic_string<char,std::char_traits<char>,std::allocator<char> > const &)'::`2'::b1111OOOO': 'const' variable is not used [D:\a\cpp-terminal\cpp-terminal\build\cpp-terminal\platforms\cpp-terminal-platforms.vcxproj]

Check warning on line 111 in cpp-terminal/platforms/conversion.cpp

View workflow job for this annotation

GitHub Actions / msvc2022 x64 (c++14)

'int const `bool __cdecl Term::Private::is_valid_utf8_code_unit(std::basic_string<char,std::char_traits<char>,std::allocator<char> > const &)'::`2'::b1111OOOO': 'const' variable is not used [D:\a\cpp-terminal\cpp-terminal\build\cpp-terminal\platforms\cpp-terminal-platforms.vcxproj]

Check warning on line 111 in cpp-terminal/platforms/conversion.cpp

View workflow job for this annotation

GitHub Actions / msvc2022 x64 (c++20)

'int const `bool __cdecl Term::Private::is_valid_utf8_code_unit(std::basic_string<char,std::char_traits<char>,std::allocator<char> > const &)'::`2'::b1111OOOO': 'const' variable is not used [D:\a\cpp-terminal\cpp-terminal\build\cpp-terminal\platforms\cpp-terminal-platforms.vcxproj]
static constexpr const int b11111OOO{248};

Check warning on line 112 in cpp-terminal/platforms/conversion.cpp

View workflow job for this annotation

GitHub Actions / msvc2022 win32 (c++14)

'int const `bool __cdecl Term::Private::is_valid_utf8_code_unit(std::basic_string<char,std::char_traits<char>,std::allocator<char> > const &)'::`2'::b11111OOO': 'const' variable is not used [D:\a\cpp-terminal\cpp-terminal\build\cpp-terminal\platforms\cpp-terminal-platforms.vcxproj]

Check warning on line 112 in cpp-terminal/platforms/conversion.cpp

View workflow job for this annotation

GitHub Actions / msvc2022 win32 (c++20)

'int const `bool __cdecl Term::Private::is_valid_utf8_code_unit(std::basic_string<char,std::char_traits<char>,std::allocator<char> > const &)'::`2'::b11111OOO': 'const' variable is not used [D:\a\cpp-terminal\cpp-terminal\build\cpp-terminal\platforms\cpp-terminal-platforms.vcxproj]

Check warning on line 112 in cpp-terminal/platforms/conversion.cpp

View workflow job for this annotation

GitHub Actions / msvc2022 win32 (c++11)

'int const `bool __cdecl Term::Private::is_valid_utf8_code_unit(std::basic_string<char,std::char_traits<char>,std::allocator<char> > const &)'::`2'::b11111OOO': 'const' variable is not used [D:\a\cpp-terminal\cpp-terminal\build\cpp-terminal\platforms\cpp-terminal-platforms.vcxproj]

Check warning on line 112 in cpp-terminal/platforms/conversion.cpp

View workflow job for this annotation

GitHub Actions / msvc2022 win32 (c++17)

'int const `bool __cdecl Term::Private::is_valid_utf8_code_unit(std::basic_string<char,std::char_traits<char>,std::allocator<char> > const &)'::`2'::b11111OOO': 'const' variable is not used [D:\a\cpp-terminal\cpp-terminal\build\cpp-terminal\platforms\cpp-terminal-platforms.vcxproj]

Check warning on line 112 in cpp-terminal/platforms/conversion.cpp

View workflow job for this annotation

GitHub Actions / msvc2022 x64 (c++11)

'int const `bool __cdecl Term::Private::is_valid_utf8_code_unit(std::basic_string<char,std::char_traits<char>,std::allocator<char> > const &)'::`2'::b11111OOO': 'const' variable is not used [D:\a\cpp-terminal\cpp-terminal\build\cpp-terminal\platforms\cpp-terminal-platforms.vcxproj]

Check warning on line 112 in cpp-terminal/platforms/conversion.cpp

View workflow job for this annotation

GitHub Actions / msvc2022 x64 (c++17)

'int const `bool __cdecl Term::Private::is_valid_utf8_code_unit(std::basic_string<char,std::char_traits<char>,std::allocator<char> > const &)'::`2'::b11111OOO': 'const' variable is not used [D:\a\cpp-terminal\cpp-terminal\build\cpp-terminal\platforms\cpp-terminal-platforms.vcxproj]

Check warning on line 112 in cpp-terminal/platforms/conversion.cpp

View workflow job for this annotation

GitHub Actions / msvc2022 x64 (c++14)

'int const `bool __cdecl Term::Private::is_valid_utf8_code_unit(std::basic_string<char,std::char_traits<char>,std::allocator<char> > const &)'::`2'::b11111OOO': 'const' variable is not used [D:\a\cpp-terminal\cpp-terminal\build\cpp-terminal\platforms\cpp-terminal-platforms.vcxproj]

Check warning on line 112 in cpp-terminal/platforms/conversion.cpp

View workflow job for this annotation

GitHub Actions / msvc2022 x64 (c++20)

'int const `bool __cdecl Term::Private::is_valid_utf8_code_unit(std::basic_string<char,std::char_traits<char>,std::allocator<char> > const &)'::`2'::b11111OOO': 'const' variable is not used [D:\a\cpp-terminal\cpp-terminal\build\cpp-terminal\platforms\cpp-terminal-platforms.vcxproj]
return ((s[0] & b1OOOOOOO) == 0) || (((s[0] & b111OOOOO) == b11OOOOOO) && ((s[1] & b11OOOOOO) == b1OOOOOOO)) || (((s[0] & b1111OOOO) == b111OOOOO) && ((s[1] & b11OOOOOO) == b1OOOOOOO) && ((s[2] & b11OOOOOO) == b1OOOOOOO)) || (((s[0] & b11111OOO) == b1111OOOO) && ((s[1] & b11OOOOOO) == b1OOOOOOO) && ((s[2] & b11OOOOOO) == b1OOOOOOO) && ((s[3] & b11OOOOOO) == b1OOOOOOO));
}

} // namespace Private
Expand Down
10 changes: 5 additions & 5 deletions cpp-terminal/platforms/input.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -273,30 +273,30 @@ void Term::Private::Input::read_raw()
{
case 0:
{
setButton(buttons, old_state.dwButtonState, state, 0);
setButton(buttons, static_cast<std::int32_t>(old_state.dwButtonState), state, 0);
break;
}
case MOUSE_MOVED:
{
setButton(buttons, old_state.dwButtonState, state, MOUSE_MOVED);
setButton(buttons, static_cast<std::int32_t>(old_state.dwButtonState), state, MOUSE_MOVED);
break;
}
case DOUBLE_CLICK:
{
setButton(buttons, old_state.dwButtonState, state, DOUBLE_CLICK);
setButton(buttons, static_cast<std::int32_t>(old_state.dwButtonState), state, DOUBLE_CLICK);
break;
}
case MOUSE_WHEELED:
{
setButton(buttons, old_state.dwButtonState, state, MOUSE_WHEELED);
setButton(buttons, static_cast<std::int32_t>(old_state.dwButtonState), state, MOUSE_WHEELED);
if(state > 0) buttons[static_cast<std::size_t>(Term::Button::Type::Wheel)] = Button(Term::Button::Type::Wheel, Term::Button::Action::RolledUp);
else
buttons[static_cast<std::size_t>(Term::Button::Type::Wheel)] = Button(Term::Button::Type::Wheel, Term::Button::Action::RolledDown);
break;
}
case MOUSE_HWHEELED:
{
setButton(buttons, old_state.dwButtonState, state, MOUSE_HWHEELED);
setButton(buttons, static_cast<std::int32_t>(old_state.dwButtonState), state, MOUSE_HWHEELED);
if(state > 0) buttons[static_cast<std::size_t>(Term::Button::Type::Wheel)] = Button(Term::Button::Type::Wheel, Term::Button::Action::ToRight);
else
buttons[static_cast<std::size_t>(Term::Button::Type::Wheel)] = Button(Term::Button::Type::Wheel, Term::Button::Action::ToLeft);
Expand Down
Loading