more conversions to std::string (nw)

This commit is contained in:
Miodrag Milanovic 2015-04-19 08:08:34 +02:00
parent 6540842bc7
commit 3c3ee1d177
16 changed files with 112 additions and 112 deletions

View File

@ -461,7 +461,7 @@ void a5200_cart_slot_device::get_default_card_software(std::string &result)
type = identify_cart_type(&head[0]);
astring info;
if (hashfile_extrainfo(*this, info) && info == "A13MIRRORING")
if (hashfile_extrainfo(*this, info) && info.cmp("A13MIRRORING")==0)
type = A5200_16K_2CHIPS;
}
if (type < A5200_4K)

View File

@ -358,7 +358,7 @@ public:
assemble_D_from_P_table(BITSn(word0,0x0020), BITSn(word0,0x001f), dString);
if (dString == "!!")
if (dString.cmp("!!")==0)
return false;
switch(BITSn(word1,0x1f00))
@ -1847,7 +1847,7 @@ public:
void disassemble(astring& retString) const
{
astring ts = m_sign;
if (ts != "-") ts = "";
if (ts.cmp("-") != 0) ts = "";
retString = "mac " +
ts +
regIdAsString(m_source) + "," +
@ -1941,7 +1941,7 @@ public:
void disassemble(astring& retString) const
{
astring ts = m_sign;
if (ts != "-") ts = "";
if (ts.cmp("-")!=0) ts = "";
retString = "macr " +
ts +
regIdAsString(m_source) + "," +
@ -2685,7 +2685,7 @@ public:
void disassemble(astring& retString) const
{
astring ts = m_sign;
if (ts != "-") ts = "";
if (ts.cmp("-")!=0) ts = "";
retString = "mpy " +
ts +
regIdAsString(m_source) + "," +
@ -2781,7 +2781,7 @@ public:
void disassemble(astring& retString) const
{
astring ts = m_sign;
if (ts != "-") ts = "";
if (ts.cmp("-") != 0) ts = "";
retString = "mpyr " +
ts +
regIdAsString(m_source) + "," +

View File

@ -831,45 +831,45 @@ astring opMnemonicAsString(const op_mnem& mnem)
reg_id stringAsRegID(const astring& str)
{
if (str == "X") return iX;
if (str == "X0") return iX0;
if (str == "X1") return iX1;
if (str == "Y") return iY;
if (str == "Y0") return iY0;
if (str == "Y1") return iY1;
if (str == "A") return iA;
if (str == "A0") return iA0;
if (str == "A1") return iA1;
if (str == "A2") return iA2;
if (str == "B") return iB;
if (str == "B0") return iB0;
if (str == "B1") return iB1;
if (str == "B2") return iB2;
if (str == "R0") return iR0;
if (str == "R1") return iR1;
if (str == "R2") return iR2;
if (str == "R3") return iR3;
if (str == "N0") return iN0;
if (str == "N1") return iN1;
if (str == "N2") return iN2;
if (str == "N3") return iN3;
if (str == "M0") return iM0;
if (str == "M1") return iM1;
if (str == "M2") return iM2;
if (str == "M3") return iM3;
if (str == "LC") return iLC;
if (str == "SR") return iSR;
if (str == "OMR") return iOMR;
if (str == "SP") return iSP;
if (str == "SSH") return iSSH;
if (str == "SSL") return iSSL;
if (str == "LA") return iLA;
if (str == "MR") return iMR;
if (str == "CCR") return iCCR;
if (str == "F") return iF;
if (str == "^F") return iFHAT;
if (str == "!!") return iINVALID;
if (str == "?") return iWEIRD;
if (str.cmp("X")==0) return iX;
if (str.cmp("X0") == 0) return iX0;
if (str.cmp("X1") == 0) return iX1;
if (str.cmp("Y") == 0) return iY;
if (str.cmp("Y0") == 0) return iY0;
if (str.cmp("Y1") == 0) return iY1;
if (str.cmp("A") == 0) return iA;
if (str.cmp("A0") == 0) return iA0;
if (str.cmp("A1") == 0) return iA1;
if (str.cmp("A2") == 0) return iA2;
if (str.cmp("B") == 0) return iB;
if (str.cmp("B0") == 0) return iB0;
if (str.cmp("B1") == 0) return iB1;
if (str.cmp("B2") == 0) return iB2;
if (str.cmp("R0") == 0) return iR0;
if (str.cmp("R1") == 0) return iR1;
if (str.cmp("R2") == 0) return iR2;
if (str.cmp("R3") == 0) return iR3;
if (str.cmp("N0") == 0) return iN0;
if (str.cmp("N1") == 0) return iN1;
if (str.cmp("N2") == 0) return iN2;
if (str.cmp("N3") == 0) return iN3;
if (str.cmp("M0") == 0) return iM0;
if (str.cmp("M1") == 0) return iM1;
if (str.cmp("M2") == 0) return iM2;
if (str.cmp("M3") == 0) return iM3;
if (str.cmp("LC") == 0) return iLC;
if (str.cmp("SR") == 0) return iSR;
if (str.cmp("OMR") == 0) return iOMR;
if (str.cmp("SP") == 0) return iSP;
if (str.cmp("SSH") == 0) return iSSH;
if (str.cmp("SSL") == 0) return iSSL;
if (str.cmp("LA") == 0) return iLA;
if (str.cmp("MR") == 0) return iMR;
if (str.cmp("CCR") == 0) return iCCR;
if (str.cmp("F") == 0) return iF;
if (str.cmp("^F") == 0) return iFHAT;
if (str.cmp("!!") == 0) return iINVALID;
if (str.cmp("?") == 0)return iWEIRD;
return iINVALID;
}

View File

@ -861,14 +861,14 @@ void parsed_expression::parse_symbol_or_number(parse_token &token, const char *&
{
// accumulate a lower-case version of the symbol
const char *stringstart = string;
astring buffer;
std::string buffer;
while (1)
{
static const char valid[] = "abcdefghijklmnopqrstuvwxyz0123456789_$#.:";
char val = tolower((UINT8)string[0]);
if (val == 0 || strchr(valid, val) == NULL)
break;
buffer.cat(&val, 1);
buffer.append(&val, 1);
string++;
}
@ -880,49 +880,49 @@ void parsed_expression::parse_symbol_or_number(parse_token &token, const char *&
}
// empty string is automatically invalid
if (!buffer)
if (buffer.empty())
throw expression_error(expression_error::INVALID_TOKEN, token.offset());
// check for wordy variants on standard operators
if (buffer == "bnot")
if (buffer.compare("bnot")==0)
{ token.configure_operator(TVL_NOT, 2); return; }
if (buffer == "plus")
if (buffer.compare("plus") == 0)
{ token.configure_operator(TVL_ADD, 4); return; }
if (buffer == "minus")
if (buffer.compare("minus") == 0)
{ token.configure_operator(TVL_SUBTRACT, 4); return; }
if (buffer == "times" || buffer == "mul")
if (buffer.compare("times") == 0 || buffer.compare("mul") == 0)
{ token.configure_operator(TVL_MULTIPLY, 3); return; }
if (buffer == "div")
if (buffer.compare("div") == 0)
{ token.configure_operator(TVL_DIVIDE, 3); return; }
if (buffer == "mod")
if (buffer.compare("mod") == 0)
{ token.configure_operator(TVL_MODULO, 3); return; }
if (buffer == "lt")
if (buffer.compare("lt") == 0)
{ token.configure_operator(TVL_LESS, 6); return; }
if (buffer == "le")
if (buffer.compare("le") == 0)
{ token.configure_operator(TVL_LESSOREQUAL, 6); return; }
if (buffer == "gt")
if (buffer.compare("gt") == 0)
{ token.configure_operator(TVL_GREATER, 6); return; }
if (buffer == "ge")
if (buffer.compare("ge") == 0)
{ token.configure_operator(TVL_GREATEROREQUAL, 6); return; }
if (buffer == "eq")
if (buffer.compare("eq") == 0)
{ token.configure_operator(TVL_EQUAL, 7); return; }
if (buffer == "ne")
if (buffer.compare("ne") == 0)
{ token.configure_operator(TVL_NOTEQUAL, 7); return; }
if (buffer == "not")
if (buffer.compare("not") == 0)
{ token.configure_operator(TVL_COMPLEMENT, 2); return; }
if (buffer == "and")
if (buffer.compare("and") == 0)
{ token.configure_operator(TVL_LAND, 8); return; }
if (buffer == "band")
if (buffer.compare("band") == 0)
{ token.configure_operator(TVL_BAND, 8); return; }
if (buffer == "or")
if (buffer.compare("or") == 0)
{ token.configure_operator(TVL_LOR, 12); return; }
if (buffer == "bor")
if (buffer.compare("bor") == 0)
{ token.configure_operator(TVL_BOR, 10); return; }
if (buffer == "bxor")
if (buffer.compare("bxor") == 0)
{ token.configure_operator(TVL_BXOR, 9); return; }
if (buffer == "lshift")
if (buffer.compare("lshift") == 0)
{ token.configure_operator(TVL_LSHIFT, 5); return; }
if (buffer == "rshift")
if (buffer.compare("rshift") == 0)
{ token.configure_operator(TVL_RSHIFT, 5); return; }
// if we have an 0x prefix, we must be a hex value

View File

@ -1171,18 +1171,18 @@ void device_image_interface::update_names(const device_type device_type, const c
// case.
//-------------------------------------------------
void device_image_interface::software_name_split(const char *swlist_swname, astring &swlist_name, astring &swname, astring &swpart)
void device_image_interface::software_name_split(const char *swlist_swname, std::string &swlist_name, std::string &swname, std::string &swpart)
{
// reset all output parameters
swlist_name.reset();
swname.reset();
swpart.reset();
swlist_name.clear();
swname.clear();
swpart.clear();
// if no colon, this is the swname by itself
const char *split1 = strchr(swlist_swname, ':');
if (split1 == NULL)
{
swname.cpy(swlist_swname);
swname.assign(swlist_swname);
return;
}
@ -1190,22 +1190,22 @@ void device_image_interface::software_name_split(const char *swlist_swname, astr
const char *split2 = strchr(split1 + 1, ':');
if (split2 == NULL)
{
swname.cpy(swlist_swname, split1 - swlist_swname);
swpart.cpy(split1 + 1);
swname.assign(swlist_swname, split1 - swlist_swname);
swpart.assign(split1 + 1);
return;
}
// if two colons present, split into 3 parts
swlist_name.cpy(swlist_swname, split1 - swlist_swname);
swname.cpy(split1 + 1, split2 - (split1 + 1));
swpart.cpy(split2 + 1);
swlist_name.assign(swlist_swname, split1 - swlist_swname);
swname.assign(split1 + 1, split2 - (split1 + 1));
swpart.assign(split2 + 1);
}
software_part *device_image_interface::find_software_item(const char *path, bool restrict_to_interface)
{
// split full software name into software list name and short software name
astring swlist_name, swinfo_name, swpart_name;
std::string swlist_name, swinfo_name, swpart_name;
software_name_split(path, swlist_name, swinfo_name, swpart_name);
// determine interface
@ -1217,7 +1217,7 @@ software_part *device_image_interface::find_software_item(const char *path, bool
software_list_device_iterator deviter(device().mconfig().root_device());
for (software_list_device *swlistdev = deviter.first(); swlistdev != NULL; swlistdev = deviter.next())
{
if (swlist_name == swlistdev->list_name() || !(swlist_name.len() > 0))
if (swlist_name.compare(swlistdev->list_name())==0 || !(swlist_name.length() > 0))
{
software_info *info = swlistdev->find(swinfo_name.c_str());
if (info != NULL)

View File

@ -234,7 +234,7 @@ public:
bool load_software(software_list_device &swlist, const char *swname, const rom_entry *entry);
int reopen_for_write(const char *path);
static void software_name_split(const char *swlist_swname, astring &swlist_name, astring &swname, astring &swpart);
static void software_name_split(const char *swlist_swname, std::string &swlist_name, std::string &swname, std::string &swpart);
protected:
bool load_internal(const char *path, bool is_create, int create_format, option_resolution *create_args, bool just_load);

View File

@ -484,10 +484,10 @@ const game_driver *emu_options::system() const
void emu_options::set_system_name(const char *name)
{
// remember the original system name
astring old_system_name(system_name());
std::string old_system_name(system_name());
// if the system name changed, fix up the device options
if (old_system_name != name)
if (old_system_name.compare(name)!=0)
{
// first set the new name
astring error;

View File

@ -862,7 +862,7 @@ ui_menu_control_floppy_image::~ui_menu_control_floppy_image()
void ui_menu_control_floppy_image::do_load_create()
{
floppy_image_device *fd = static_cast<floppy_image_device *>(image);
if(input_filename == "") {
if(input_filename.cmp("")==0) {
int err = fd->create(output_filename.c_str(), 0, NULL);
if (err != 0) {
popmessage("Error: %s", fd->error());
@ -871,7 +871,7 @@ void ui_menu_control_floppy_image::do_load_create()
fd->setup_write(output_format);
} else {
int err = fd->load(input_filename.c_str());
if(!err && output_filename != "")
if(!err && output_filename.cmp("")!=0)
err = fd->reopen_for_write(output_filename.c_str());
if(err != 0) {
popmessage("Error: %s", fd->error());

View File

@ -225,8 +225,8 @@ int machine_manager::execute()
// check the state of the machine
if (m_new_driver_pending)
{
astring old_system_name(m_options.system_name());
bool new_system = (old_system_name != m_new_driver_pending->name);
std::string old_system_name(m_options.system_name());
bool new_system = (old_system_name.compare(m_new_driver_pending->name)!=0);
// first: if we scheduled a new system, remove device options of the old system
// notice that, if we relaunch the same system, there is no effect on the emulation
if (new_system)

View File

@ -158,11 +158,11 @@ void ui_menu_device_config::populate()
int bios = 0;
if (dev->rom_region())
{
astring bios_str;
std::string bios_str;
// first loop through roms in search of default bios (shortname)
for (const rom_entry *rom = dev->rom_region(); !ROMENTRY_ISEND(rom); rom++)
if (ROMENTRY_ISDEFAULT_BIOS(rom))
bios_str.cpy(ROM_GETNAME(rom));
bios_str.assign(ROM_GETNAME(rom));
// then loop again to count bios options and to get the default bios complete name
for (const rom_entry *rom = dev->rom_region(); !ROMENTRY_ISEND(rom); rom++)
@ -170,8 +170,8 @@ void ui_menu_device_config::populate()
if (ROMENTRY_ISSYSTEM_BIOS(rom))
{
bios++;
if (bios_str == ROM_GETNAME(rom))
bios_str.cpy(ROM_GETHASHDATA(rom));
if (bios_str.compare(ROM_GETNAME(rom))==0)
bios_str.assign(ROM_GETHASHDATA(rom));
}
}

View File

@ -48,18 +48,18 @@ public:
friend astring operator+(const char *lhs, const astring &rhs) { return astring(lhs) += rhs; }
// comparison operators
bool operator==(const char *string) const { return (cmp(string) == 0); }
bool operator==(const astring &string) const { return (cmp(string) == 0); }
bool operator!=(const char *string) const { return (cmp(string) != 0); }
bool operator!=(const astring &string) const { return (cmp(string) != 0); }
bool operator<(const char *string) const { return (cmp(string) < 0); }
bool operator<(const astring &string) const { return (cmp(string) < 0); }
bool operator<=(const char *string) const { return (cmp(string) <= 0); }
bool operator<=(const astring &string) const { return (cmp(string) <= 0); }
bool operator>(const char *string) const { return (cmp(string) > 0); }
bool operator>(const astring &string) const { return (cmp(string) > 0); }
bool operator>=(const char *string) const { return (cmp(string) >= 0); }
bool operator>=(const astring &string) const { return (cmp(string) >= 0); }
// bool operator==(const char *string) const { return (cmp(string) == 0); }
// bool operator==(const astring &string) const { return (cmp(string) == 0); }
// bool operator!=(const char *string) const { return (cmp(string) != 0); }
// bool operator!=(const astring &string) const { return (cmp(string) != 0); }
// bool operator<(const char *string) const { return (cmp(string) < 0); }
// bool operator<(const astring &string) const { return (cmp(string) < 0); }
// bool operator<=(const char *string) const { return (cmp(string) <= 0); }
// bool operator<=(const astring &string) const { return (cmp(string) <= 0); }
// bool operator>(const char *string) const { return (cmp(string) > 0); }
// bool operator>(const astring &string) const { return (cmp(string) > 0); }
// bool operator>=(const char *string) const { return (cmp(string) >= 0); }
// bool operator>=(const astring &string) const { return (cmp(string) >= 0); }
// character access operators
char operator[](int index) const { return (index < len()) ? m_text[index] : 0; }

View File

@ -15,7 +15,7 @@
#include "osdcore.h"
#include "coretmpl.h"
#include "astring.h"
#include <string>
#ifdef MAME_DEBUG
#include "eminline.h"
#endif
@ -67,7 +67,7 @@ public:
m_object(object) { }
// accessors
const astring &tag() const { return m_tag; }
const std::string &tag() const { return m_tag; }
_ElementType object() const { return m_object; }
// setters
@ -81,7 +81,7 @@ public:
// internal state
entry_t * m_next;
UINT32 m_fullhash;
astring m_tag;
std::string m_tag;
_ElementType m_object;
};

View File

@ -47,7 +47,7 @@ bool osd_font_windows::open(const char *font_path, const char *_name, int &heigh
{
// accept qualifiers from the name
astring name(_name);
if (name == "default") name = "Tahoma";
if (name.cmp("default")==0) name = "Tahoma";
bool bold = (name.replace(0, "[B]", "") + name.replace(0, "[b]", "") > 0);
bool italic = (name.replace(0, "[I]", "") + name.replace(0, "[i]", "") > 0);

View File

@ -240,8 +240,8 @@ private:
// FIXME: should be elsewhere
osd_module *select_module_options(const core_options &opts, const astring &opt_name)
{
astring opt_val = opts.value(opt_name.c_str());
if (opt_val == "auto")
std::string opt_val = opts.value(opt_name.c_str());
if (opt_val.compare("auto")==0)
opt_val = "";
else if (!m_mod_man.type_has_name(opt_name.c_str(), opt_val.c_str()))
{

View File

@ -1075,7 +1075,7 @@ static void parse_compression(const parameters_t &params, chd_codec_type compres
return;
// special case: 'none'
if (*compression_str == "none")
if (compression_str->cmp("none")==0)
{
compression[0] = compression[1] = compression[2] = compression[3] = CHD_CODEC_NONE;
return;

View File

@ -833,7 +833,7 @@ static bool find_include_file(astring &srcincpath, int srcrootlen, int dstrootle
for (include_path *curpath = incpaths; curpath != NULL; curpath = curpath->next)
{
// a '.' include path is specially treated
if (curpath->path == ".")
if (curpath->path.cmp(".")==0)
srcincpath.cpysubstr(srcfile, 0, srcfile.rchr(0, PATH_SEPARATOR[0]));
else
srcincpath.cpysubstr(srcfile, 0, srcrootlen + 1).cat(curpath->path);
@ -845,7 +845,7 @@ static bool find_include_file(astring &srcincpath, int srcrootlen, int dstrootle
{
// handle .. by removing a chunk from the incpath
astring pathpart(filename, lastsepindex, sepindex - lastsepindex);
if (pathpart == "..")
if (pathpart.cmp("..")==0)
{
sepindex = srcincpath.rchr(0, PATH_SEPARATOR[0]);
if (sepindex != -1)