diff options
author | 2016-04-18 18:53:28 -0400 | |
---|---|---|
committer | 2016-04-18 18:53:28 -0400 | |
commit | 084d3654ca14a79d9ec173bad4ddf00ad0fb5a7f (patch) | |
tree | 197ae37b68f3169048fb3cadf6947353315f3608 /src/emu/ui/info_pty.cpp | |
parent | 55d3e544e013174880c8f208264683aac6d711f9 (diff) |
Iterate over devices C++11 style
Replace the old device_iterator and its specialized versions with functionally equivalent classes that use standard operators to yield references to devices/interfaces rather than pointers. With range-based for loops, they no longer have to be stored in named variables, though they can also be reused concurrently since the iteration state is now maintained by a subclass.
Add a few more typical getters to device_t::subdevice_list.
Diffstat (limited to 'src/emu/ui/info_pty.cpp')
-rw-r--r-- | src/emu/ui/info_pty.cpp | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/emu/ui/info_pty.cpp b/src/emu/ui/info_pty.cpp index 563b77dbff5..267f8b1c5b9 100644 --- a/src/emu/ui/info_pty.cpp +++ b/src/emu/ui/info_pty.cpp @@ -26,14 +26,13 @@ void ui_menu_pty_info::populate() item_append(_("Pseudo terminals"), nullptr, MENU_FLAG_DISABLE, nullptr); item_append("", nullptr, MENU_FLAG_DISABLE, nullptr); - pty_interface_iterator iter(machine().root_device()); - for (device_pty_interface *pty = iter.first(); pty != nullptr; pty = iter.next()) { - const char *port_name = pty->device().owner()->tag() + 1; - if (pty->is_open()) { - item_append(port_name , pty->slave_name() , MENU_FLAG_DISABLE , nullptr); - } else { - item_append(port_name , _("[failed]") , MENU_FLAG_DISABLE , nullptr); - } + for (device_pty_interface &pty : pty_interface_iterator(machine().root_device())) + { + const char *port_name = pty.device().owner()->tag() + 1; + if (pty.is_open()) + item_append(port_name, pty.slave_name(), MENU_FLAG_DISABLE, nullptr); + else + item_append(port_name, _("[failed]"), MENU_FLAG_DISABLE, nullptr); item_append("", nullptr, MENU_FLAG_DISABLE, nullptr); } } |