mirror of
https://github.com/holub/mame
synced 2025-04-26 18:23:08 +03:00
Merge pull request #5441 from npwoods/infocpp_use_ostream
Changed info_xml_creator to use std::ostream
This commit is contained in:
commit
9c89109d15
@ -355,7 +355,7 @@ void cli_frontend::listxml(const std::vector<std::string> &args)
|
|||||||
{
|
{
|
||||||
// create the XML and print it to stdout
|
// create the XML and print it to stdout
|
||||||
info_xml_creator creator(m_options, m_options.bool_value(CLIOPTION_DTD));
|
info_xml_creator creator(m_options, m_options.bool_value(CLIOPTION_DTD));
|
||||||
creator.output(stdout, args);
|
creator.output(std::cout, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -35,44 +35,43 @@ public:
|
|||||||
info_xml_creator(emu_options const &options, bool dtd = true);
|
info_xml_creator(emu_options const &options, bool dtd = true);
|
||||||
|
|
||||||
// output
|
// output
|
||||||
void output(FILE *out, const std::vector<std::string> &patterns);
|
void output(std::ostream &out, const std::vector<std::string> &patterns);
|
||||||
void output(FILE *out, const std::function<bool(const char *shortname, bool &done)> &filter = { }, bool include_devices = true);
|
void output(std::ostream &out, const std::function<bool(const char *shortname, bool &done)> &filter = { }, bool include_devices = true);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
typedef std::unordered_set<std::add_pointer_t<device_type> > device_type_set;
|
typedef std::unordered_set<std::add_pointer_t<device_type> > device_type_set;
|
||||||
|
|
||||||
// internal helper
|
// internal helper
|
||||||
void output_header();
|
void output_header(std::ostream &out);
|
||||||
void output_footer();
|
void output_footer(std::ostream &out);
|
||||||
|
|
||||||
void output_one(driver_enumerator &drivlist, device_type_set *devtypes);
|
void output_one(std::ostream &out, driver_enumerator &drivlist, device_type_set *devtypes);
|
||||||
void output_sampleof(device_t &device);
|
void output_sampleof(std::ostream &out, device_t &device);
|
||||||
void output_bios(device_t const &device);
|
void output_bios(std::ostream &out, device_t const &device);
|
||||||
void output_rom(driver_enumerator *drivlist, const game_driver *driver, device_t &device);
|
void output_rom(std::ostream &out, driver_enumerator *drivlist, const game_driver *driver, device_t &device);
|
||||||
void output_device_refs(device_t &root);
|
void output_device_refs(std::ostream &out, device_t &root);
|
||||||
void output_sample(device_t &device);
|
void output_sample(std::ostream &out, device_t &device);
|
||||||
void output_chips(device_t &device, const char *root_tag);
|
void output_chips(std::ostream &out, device_t &device, const char *root_tag);
|
||||||
void output_display(device_t &device, machine_flags::type const *flags, const char *root_tag);
|
void output_display(std::ostream &out, device_t &device, machine_flags::type const *flags, const char *root_tag);
|
||||||
void output_sound(device_t &device);
|
void output_sound(std::ostream &out, device_t &device);
|
||||||
void output_ioport_condition(const ioport_condition &condition, unsigned indent);
|
void output_ioport_condition(std::ostream &out, const ioport_condition &condition, unsigned indent);
|
||||||
void output_input(const ioport_list &portlist);
|
void output_input(std::ostream &out, const ioport_list &portlist);
|
||||||
void output_switches(const ioport_list &portlist, const char *root_tag, int type, const char *outertag, const char *loctag, const char *innertag);
|
void output_switches(std::ostream &out, const ioport_list &portlist, const char *root_tag, int type, const char *outertag, const char *loctag, const char *innertag);
|
||||||
void output_ports(const ioport_list &portlist);
|
void output_ports(std::ostream &out, const ioport_list &portlist);
|
||||||
void output_adjusters(const ioport_list &portlist);
|
void output_adjusters(std::ostream &out, const ioport_list &portlist);
|
||||||
void output_driver(game_driver const &driver, device_t::feature_type unemulated, device_t::feature_type imperfect);
|
void output_driver(std::ostream &out, game_driver const &driver, device_t::feature_type unemulated, device_t::feature_type imperfect);
|
||||||
void output_features(device_type type, device_t::feature_type unemulated, device_t::feature_type imperfect);
|
void output_features(std::ostream &out, device_type type, device_t::feature_type unemulated, device_t::feature_type imperfect);
|
||||||
void output_images(device_t &device, const char *root_tag);
|
void output_images(std::ostream &out, device_t &device, const char *root_tag);
|
||||||
void output_slots(machine_config &config, device_t &device, const char *root_tag, device_type_set *devtypes);
|
void output_slots(std::ostream &out, machine_config &config, device_t &device, const char *root_tag, device_type_set *devtypes);
|
||||||
void output_software_list(device_t &root);
|
void output_software_list(std::ostream &out, device_t &root);
|
||||||
void output_ramoptions(device_t &root);
|
void output_ramoptions(std::ostream &out, device_t &root);
|
||||||
|
|
||||||
void output_one_device(machine_config &config, device_t &device, const char *devtag);
|
void output_one_device(std::ostream &out, machine_config &config, device_t &device, const char *devtag);
|
||||||
void output_devices(device_type_set const *filter);
|
void output_devices(std::ostream &out, device_type_set const *filter);
|
||||||
|
|
||||||
const char *get_merge_name(driver_enumerator &drivlist, const game_driver &driver, util::hash_collection const &romhashes);
|
const char *get_merge_name(driver_enumerator &drivlist, const game_driver &driver, util::hash_collection const &romhashes);
|
||||||
|
|
||||||
// internal state
|
// internal state
|
||||||
FILE * m_output; // FIXME: this is not reentrancy-safe
|
|
||||||
emu_options m_lookup_options;
|
emu_options m_lookup_options;
|
||||||
|
|
||||||
static const char s_dtd_string[];
|
static const char s_dtd_string[];
|
||||||
|
@ -25,6 +25,8 @@
|
|||||||
#include "ui/inifile.h"
|
#include "ui/inifile.h"
|
||||||
#include "ui/submenu.h"
|
#include "ui/submenu.h"
|
||||||
|
|
||||||
|
#include <fstream>
|
||||||
|
|
||||||
namespace ui {
|
namespace ui {
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
MENU HANDLERS
|
MENU HANDLERS
|
||||||
@ -585,10 +587,9 @@ void menu_export::handle()
|
|||||||
emu_file file(ui().options().ui_path(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS);
|
emu_file file(ui().options().ui_path(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS);
|
||||||
if (file.open(filename.c_str(), ".xml") == osd_file::error::NONE)
|
if (file.open(filename.c_str(), ".xml") == osd_file::error::NONE)
|
||||||
{
|
{
|
||||||
FILE *pfile;
|
|
||||||
std::string fullpath(file.fullpath());
|
std::string fullpath(file.fullpath());
|
||||||
file.close();
|
file.close();
|
||||||
pfile = fopen(fullpath.c_str(), "w");
|
std::ofstream pfile(fullpath);
|
||||||
|
|
||||||
// prepare a filter for the drivers we want to show
|
// prepare a filter for the drivers we want to show
|
||||||
std::unordered_set<const game_driver *> driver_list(m_list.begin(), m_list.end());
|
std::unordered_set<const game_driver *> driver_list(m_list.begin(), m_list.end());
|
||||||
@ -607,7 +608,6 @@ void menu_export::handle()
|
|||||||
// and do the dirty work
|
// and do the dirty work
|
||||||
info_xml_creator creator(machine().options());
|
info_xml_creator creator(machine().options());
|
||||||
creator.output(pfile, filter, include_devices);
|
creator.output(pfile, filter, include_devices);
|
||||||
fclose(pfile);
|
|
||||||
machine().popmessage(_("%s.xml saved under ui folder."), filename.c_str());
|
machine().popmessage(_("%s.xml saved under ui folder."), filename.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user