summaryrefslogtreecommitdiffstatshomepage
path: root/src/frontend/mame/info.cpp
diff options
context:
space:
mode:
author npwoods <npwoods@mess.org>2019-08-04 21:20:59 -0400
committer npwoods <npwoods@mess.org>2019-08-04 21:20:59 -0400
commit17e194de8f6ba0deb4d75ff683691ad605ff66df (patch)
treeab1da32e986d58498a63c8a4dfe492b501954f70 /src/frontend/mame/info.cpp
parentd3383c54ab9cb00e956e3f78dfb0cffa903fdfe7 (diff)
Follow up to previous listxml_refactor PR (nw)
Specifically, this simplifies that change by collapsing the newly introduced enum info_xml_creator::devices_disposition into a bool, more resembling what was there before. It occurred to me that having a tristate was unnecessary, because the need for filtering could be expressed by a null std::function for the filter
Diffstat (limited to 'src/frontend/mame/info.cpp')
-rw-r--r--src/frontend/mame/info.cpp19
1 files changed, 7 insertions, 12 deletions
diff --git a/src/frontend/mame/info.cpp b/src/frontend/mame/info.cpp
index 977ee7cbf4b..34eec500c60 100644
--- a/src/frontend/mame/info.cpp
+++ b/src/frontend/mame/info.cpp
@@ -222,11 +222,7 @@ void info_xml_creator::output(FILE *out, const std::vector<std::string> &pattern
if (patterns.empty())
{
// no patterns specified - show everything
- auto filter = [](const char *, bool &) -> bool
- {
- return true;
- };
- output(out, filter, devices_disposition::ALL);
+ output(out);
}
else
{
@@ -262,7 +258,7 @@ void info_xml_creator::output(FILE *out, const std::vector<std::string> &pattern
}
return result;
};
- output(out, filter, devices_disposition::FILTERED);
+ output(out, filter);
// throw an error if there were unmatched patterns
auto iter = std::find(matched.begin(), matched.end(), false);
@@ -280,11 +276,10 @@ void info_xml_creator::output(FILE *out, const std::vector<std::string> &pattern
// known (and filtered) machines
//-------------------------------------------------
-void info_xml_creator::output(FILE *out, const std::function<bool(const char *shortname, bool &done)> &filter, devices_disposition devdisp)
+void info_xml_creator::output(FILE *out, const std::function<bool(const char *shortname, bool &done)> &filter, bool include_devices)
{
// sanity checks
assert(out);
- assert(filter);
// set up output
m_output = out;
@@ -297,7 +292,7 @@ void info_xml_creator::output(FILE *out, const std::function<bool(const char *sh
// only keep a device set when we're asked to track it
std::unique_ptr<device_type_set> devfilter;
- if (devdisp == devices_disposition::FILTERED)
+ if (include_devices && filter)
devfilter = std::make_unique<device_type_set>();
// try enumerating drivers and outputting them
@@ -309,7 +304,7 @@ void info_xml_creator::output(FILE *out, const std::function<bool(const char *sh
// longer safe to call next(), so record that we're done
drivlist_done = true;
}
- else if (filter(drivlist.driver().name, filter_done))
+ else if (!filter || filter(drivlist.driver().name, filter_done))
{
// output the header if we have to
if (!header_outputted)
@@ -328,7 +323,7 @@ void info_xml_creator::output(FILE *out, const std::function<bool(const char *sh
{
for (device_type type : registered_device_types)
{
- if (filter(type.shortname(), filter_done))
+ if (!filter || filter(type.shortname(), filter_done))
devfilter->insert(&type);
if (filter_done)
@@ -337,7 +332,7 @@ void info_xml_creator::output(FILE *out, const std::function<bool(const char *sh
}
// output devices (both devices with roms and slot devices)
- if (devdisp != devices_disposition::NONE && (!devfilter || !devfilter->empty()))
+ if (include_devices && (!devfilter || !devfilter->empty()))
{
if (!header_outputted)
{