diff options
author | 2020-12-08 21:19:17 -0500 | |
---|---|---|
committer | 2020-12-08 21:24:46 -0500 | |
commit | c22cb17f326b4939d8ff4219410909e32e70ab86 (patch) | |
tree | 8db68c201fa9673eeb6acab37a5d221c7a338ea6 /src/frontend/mame/ui/state.cpp | |
parent | 6172111b187c1dd66329adb2b9bba2a82a0ce116 (diff) |
C++17 string handling updates (without charconv so as not to break GCC 7)
- render.cpp, rendlay.cpp, ui/ui.cpp, ui/menu.cpp: Change argument types for text processing functions from const char * to std::string_view
- ui/menu.cpp: Add overloads of item_append omitting the frequently empty subtext argument
- cheat.cpp: Remove some c_str() calls that became unnecessary a while ago
Diffstat (limited to 'src/frontend/mame/ui/state.cpp')
-rw-r--r-- | src/frontend/mame/ui/state.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/frontend/mame/ui/state.cpp b/src/frontend/mame/ui/state.cpp index 6939401d566..3064fd654dd 100644 --- a/src/frontend/mame/ui/state.cpp +++ b/src/frontend/mame/ui/state.cpp @@ -82,7 +82,7 @@ menu_load_save_state_base::file_entry::file_entry(std::string &&file_name, std:: // ctor //------------------------------------------------- -menu_load_save_state_base::menu_load_save_state_base(mame_ui_manager &mui, render_container &container, const char *header, const char *footer, bool must_exist) +menu_load_save_state_base::menu_load_save_state_base(mame_ui_manager &mui, render_container &container, std::string_view header, std::string_view footer, bool must_exist) : menu(mui, container) , m_header(header) , m_footer(footer) @@ -200,7 +200,7 @@ void menu_load_save_state_base::populate(float &customtop, float &custombottom) // append the menu item void *const itemref = itemref_from_file_entry(*entry); - item_append(std::move(text), std::string(), 0, itemref); + item_append(std::move(text), 0, itemref); // is this item selected? if (entry->file_name() == s_last_file_selected) @@ -209,7 +209,7 @@ void menu_load_save_state_base::populate(float &customtop, float &custombottom) if (m_entries_vec.empty()) { - item_append(_("No save states found"), std::string(), 0, nullptr); + item_append(_("No save states found"), 0, nullptr); set_selection(nullptr); } item_append(menu_item_type::SEPARATOR); @@ -334,10 +334,10 @@ void menu_load_save_state_base::slot_selected(std::string &&name) void menu_load_save_state_base::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2) { - extra_text_render(top, bottom, origx1, origy1, origx2, origy2, m_header, nullptr); - if (m_footer) + extra_text_render(top, bottom, origx1, origy1, origx2, origy2, m_header, std::string_view()); + if (!m_footer.empty()) { - char const *const text[] = { m_footer }; + std::string_view const text[] = { m_footer }; draw_text_box( std::begin(text), std::end(text), origx1, origx2, origy2 + ui().box_tb_border(), origy2 + bottom, |