From 64ebfde8bcd6408e3b6925624e8680c314db6efc Mon Sep 17 00:00:00 2001 From: Hannes Schulze Date: Thu, 6 Feb 2025 19:54:38 +0100 Subject: get rid of nasty stdlib --- lib/nes/app/ui/screen-browser.cc | 3 ++- lib/nes/app/ui/screen-error.hh | 7 ++++--- lib/nes/app/ui/screen-settings.cc | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) (limited to 'lib/nes/app/ui') diff --git a/lib/nes/app/ui/screen-browser.cc b/lib/nes/app/ui/screen-browser.cc index 1b515bd..50b0060 100644 --- a/lib/nes/app/ui/screen-browser.cc +++ b/lib/nes/app/ui/screen-browser.cc @@ -4,6 +4,7 @@ #include "nes/app/graphics/tiles/icons.hh" #include "nes/app/input/input-device-keyboard.hh" #include "nes/common/containers/path-view.hh" +#include "nes/common/utils.hh" namespace nes::app { @@ -152,6 +153,6 @@ namespace nes::app // Round up to get page count. auto const page_count = (count + (page_size - 1)) / page_size; // Always show at least one page. - selection_.set_page_count(std::max(u32{ 1 }, page_count)); + selection_.set_page_count(max(u32{ 1 }, page_count)); } } // namespace nes::app \ No newline at end of file diff --git a/lib/nes/app/ui/screen-error.hh b/lib/nes/app/ui/screen-error.hh index 4559942..53b6407 100644 --- a/lib/nes/app/ui/screen-error.hh +++ b/lib/nes/app/ui/screen-error.hh @@ -1,6 +1,7 @@ #pragma once #include "nes/app/ui/screen.hh" +#include "nes/common/containers/string-view.hh" namespace nes::app { @@ -10,17 +11,17 @@ namespace nes::app class screen_error final : public screen { input_device_keyboard& keyboard_; - std::string_view message_; + string_view message_; status error_{ status::success }; action action_{}; public: explicit screen_error(input_device_keyboard&); - auto get_message() const -> std::string_view { return message_; } + auto get_message() const -> string_view { return message_; } auto get_error() const -> status { return error_; } auto get_action() const -> action { return action_; } - auto set_message(std::string_view const v) -> void { message_ = v; } + auto set_message(string_view const v) -> void { message_ = v; } auto set_error(status const v) -> void { error_ = v; } auto set_action(action const& v) -> void { action_ = v; } diff --git a/lib/nes/app/ui/screen-settings.cc b/lib/nes/app/ui/screen-settings.cc index 98070d7..9ba4b50 100644 --- a/lib/nes/app/ui/screen-settings.cc +++ b/lib/nes/app/ui/screen-settings.cc @@ -7,7 +7,7 @@ namespace nes::app auto screen_settings::selection_impl::render_item( renderer& renderer, item const& item, i32 const x, i32 const y, u32 const width, color const c) const -> void { - auto const render = [&](std::string_view const label, std::string_view const value) + auto const render = [&](string_view const label, string_view const value) { auto const label_length = renderer.render_text(x, y, label, c); auto const value_attrs = text_attributes{} -- cgit v1.3.1