Merge pull request #1165 from npwoods/diimage_add_format

Created device_image_interface::add_format() protected member and made device_image_interface::m_formatlist be private
This commit is contained in:
Vas Crabb 2016-07-31 22:54:28 +10:00 committed by GitHub
commit c703235246
7 changed files with 32 additions and 8 deletions

View File

@ -61,7 +61,7 @@ void cdrom_image_device::device_config_complete()
{
m_extension_list = "chd,cue,toc,nrg,gdi,iso,cdr";
m_formatlist.push_back(std::make_unique<image_device_format>("chdcd", "CD-ROM drive", m_extension_list, cd_option_spec));
add_format("chdcd", "CD-ROM drive", m_extension_list, cd_option_spec);
// set brief and instance name
update_names();

View File

@ -56,7 +56,7 @@ diablo_image_device::~diablo_image_device()
void diablo_image_device::device_config_complete()
{
m_formatlist.push_back(std::make_unique<image_device_format>("chd", "CHD Hard drive", "chd,dsk", dsk_option_spec));
add_format("chd", "CHD Hard drive", "chd,dsk", dsk_option_spec);
// set brief and instance name
update_names();

View File

@ -825,7 +825,7 @@ void legacy_floppy_image_device::device_config_complete()
// only add if creatable
if (floppy_options[i].param_guidelines) {
// allocate a new format and append it to the list
m_formatlist.push_back(std::make_unique<image_device_format>(floppy_options[i].name, floppy_options[i].description, floppy_options[i].extensions, floppy_options[i].param_guidelines));
add_format(floppy_options[i].name, floppy_options[i].description, floppy_options[i].extensions, floppy_options[i].param_guidelines);
}
image_specify_extension( m_extension_list, 256, floppy_options[i].extensions );
}

View File

@ -242,7 +242,7 @@ void floppy_image_device::set_formats(const floppy_format_type *formats)
else
fif_list->append(fif);
m_formatlist.push_back(std::make_unique<image_device_format>(fif->name(), fif->description(), fif->extensions(), ""));
add_format(fif->name(), fif->description(), fif->extensions(), "");
image_specify_extension( extension_list, 256, fif->extensions() );
}

View File

@ -79,7 +79,7 @@ harddisk_image_device::~harddisk_image_device()
void harddisk_image_device::device_config_complete()
{
m_formatlist.push_back(std::make_unique<image_device_format>("chd", "CHD Hard drive", "chd,hd", hd_option_spec));
add_format("chd", "CHD Hard drive", "chd,hd", hd_option_spec);
// set brief and instance name
update_names();

View File

@ -237,6 +237,27 @@ const image_device_format *device_image_interface::device_get_named_creatable_fo
}
//-------------------------------------------------
// add_format
//-------------------------------------------------
void device_image_interface::add_format(std::unique_ptr<image_device_format> &&format)
{
m_formatlist.push_back(std::move(format));
}
//-------------------------------------------------
// add_format
//-------------------------------------------------
void device_image_interface::add_format(std::string &&name, std::string &&description, std::string &&extensions, std::string &&optspec)
{
auto format = std::make_unique<image_device_format>(std::move(name), std::move(description), std::move(extensions), std::move(optspec));
add_format(std::move(format));
}
/****************************************************************************
ERROR HANDLING
****************************************************************************/

View File

@ -273,6 +273,9 @@ protected:
bool load_software_part(const char *path, const software_part *&swpart);
std::string software_get_default_slot(const char *default_card_slot) const;
void add_format(std::unique_ptr<image_device_format> &&format);
void add_format(std::string &&name, std::string &&description, std::string &&extensions, std::string &&optspec);
// derived class overrides
// configuration
@ -320,9 +323,6 @@ protected:
std::string m_brief_instance_name;
std::string m_instance_name;
// creation info
formatlist_type m_formatlist;
// in the case of arcade cabinet with fixed carts inserted,
// we want to disable command line cart loading...
bool m_user_loadable;
@ -331,6 +331,9 @@ protected:
private:
static image_error_t image_error_from_file_error(osd_file::error filerr);
// creation info
formatlist_type m_formatlist;
};
// iterator