More conversion to brace syntax.

This commit is contained in:
Stephen Anthony 2020-12-20 18:14:28 -03:30
parent 60c991e171
commit 11241b9871
44 changed files with 83 additions and 87 deletions

View File

@ -25,7 +25,7 @@ AtariVox::AtariVox(Jack jack, const Event& event, const System& system,
const string& portname, const FilesystemNode& eepromfile,
const onMessageCallback& callback)
: SaveKey(jack, event, system, eepromfile, callback, Controller::Type::AtariVox),
mySerialPort(MediaFactory::createSerialPort())
mySerialPort{MediaFactory::createSerialPort()}
{
if(mySerialPort->openPort(portname))
{

View File

@ -28,7 +28,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Cartridge::Cartridge(const Settings& settings, const string& md5)
: mySettings(settings)
: mySettings{settings}
{
auto to_uInt32 = [](const string& s, uInt32 pos) {
return uInt32(std::stoul(s.substr(pos, 8), nullptr, 16));

View File

@ -66,7 +66,6 @@ class Cartridge3F : public CartridgeEnhanced
*/
void install(System& system) override;
/**
Get a descriptor for the device name (used in error checking).

View File

@ -24,8 +24,8 @@
Cartridge4A50::Cartridge4A50(const ByteBuffer& image, size_t size,
const string& md5, const Settings& settings)
: Cartridge(settings, md5),
myImage(make_unique<uInt8[]>(128_KB)),
mySize(size)
myImage{make_unique<uInt8[]>(128_KB)},
mySize{size}
{
// Copy the ROM image into my buffer
// Supported file sizes are 32/64/128K, which are duplicated if necessary

View File

@ -24,7 +24,7 @@
CartridgeAR::CartridgeAR(const ByteBuffer& image, size_t size,
const string& md5, const Settings& settings)
: Cartridge(settings, md5),
mySize(std::max<size_t>(size, 8448))
mySize{std::max<size_t>(size, 8448)}
{
// Create a load image buffer and copy the given image
myLoadImages = make_unique<uInt8[]>(mySize);

View File

@ -44,7 +44,7 @@
CartridgeBUS::CartridgeBUS(const ByteBuffer& image, size_t size,
const string& md5, const Settings& settings)
: Cartridge(settings, md5),
myImage(make_unique<uInt8[]>(32_KB))
myImage{make_unique<uInt8[]>(32_KB)}
{
// Copy the ROM image into my buffer
std::copy_n(image.get(), std::min(32_KB, size), myImage.get());
@ -71,8 +71,8 @@ CartridgeBUS::CartridgeBUS(const ByteBuffer& image, size_t size,
0x00000800,
0x00000808,
0x40001FDC,
devSettings ? settings.getBool("dev.thumb.trapfatal") : false,
Thumbulator::ConfigureFor::BUS,
devSettings ? settings.getBool("dev.thumb.trapfatal") : false,
Thumbulator::ConfigureFor::BUS,
this);
setInitialState();

View File

@ -66,7 +66,7 @@ namespace {
CartridgeCDF::CartridgeCDF(const ByteBuffer& image, size_t size,
const string& md5, const Settings& settings)
: Cartridge(settings, md5),
myImage(make_unique<uInt8[]>(512_KB))
myImage{make_unique<uInt8[]>(512_KB)}
{
// Copy the ROM image into my buffer
std::fill_n(myImage.get(), 512_KB, 0);

View File

@ -24,7 +24,7 @@
CartridgeCM::CartridgeCM(const ByteBuffer& image, size_t size,
const string& md5, const Settings& settings)
: Cartridge(settings, md5),
myImage(make_unique<uInt8[]>(16_KB))
myImage{make_unique<uInt8[]>(16_KB)}
{
// Copy the ROM image into my buffer
std::copy_n(image.get(), std::min(16_KB, size), myImage.get());

View File

@ -25,7 +25,7 @@
CartridgeCTY::CartridgeCTY(const ByteBuffer& image, size_t size,
const string& md5, const Settings& settings)
: Cartridge(settings, md5),
myImage(make_unique<uInt8[]>(32_KB))
myImage{make_unique<uInt8[]>(32_KB)}
{
// Copy the ROM image into my buffer
std::copy_n(image.get(), std::min(32_KB, size), myImage.get());

View File

@ -29,8 +29,8 @@
CartridgeDPCPlus::CartridgeDPCPlus(const ByteBuffer& image, size_t size,
const string& md5, const Settings& settings)
: Cartridge(settings, md5),
myImage(make_unique<uInt8[]>(32_KB)),
mySize(std::min(size, 32_KB))
myImage{make_unique<uInt8[]>(32_KB)},
mySize{std::min(size, 32_KB)}
{
// Image is always 32K, but in the case of ROM < 32K, the image is
// copied to the end of the buffer

View File

@ -22,7 +22,7 @@
CartridgeMNetwork::CartridgeMNetwork(const ByteBuffer& image, size_t size,
const string& md5, const Settings& settings)
: Cartridge(settings, md5),
mySize(size)
mySize{size}
{
}

View File

@ -23,7 +23,7 @@ CartridgeUA::CartridgeUA(const ByteBuffer& image, size_t size,
const string& md5, const Settings& settings,
bool swapHotspots)
: CartridgeEnhanced(image, size, md5, settings, 8_KB),
mySwappedHotspots(swapHotspots)
mySwappedHotspots{swapHotspots}
{
}

View File

@ -168,7 +168,7 @@ class CartridgeWD : public CartridgeEnhanced
// The arrangement of banks to use on each hotspot read
struct BankOrg {
uInt8 zero, one, two, three;
uInt8 zero{0}, one{0}, two{0}, three{0};
};
static const std::array<BankOrg, 8> ourBankOrg;

View File

@ -23,8 +23,8 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CompuMate::CompuMate(const Console& console, const Event& event,
const System& system)
: myConsole(console),
myEvent(event)
: myConsole{console},
myEvent{event}
{
// These controller pointers will be retrieved by the Console, which will
// also take ownership of them

View File

@ -86,7 +86,7 @@ class CompuMate
CMControl(class CompuMate& handler, Controller::Jack jack, const Event& event,
const System& system)
: Controller(jack, event, system, Controller::Type::CompuMate),
myHandler(handler) { }
myHandler{handler} { }
~CMControl() override = default;
public:

View File

@ -116,11 +116,11 @@ namespace {
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Console::Console(OSystem& osystem, unique_ptr<Cartridge>& cart,
const Properties& props, AudioSettings& audioSettings)
: myOSystem(osystem),
myEvent(osystem.eventHandler().event()),
myProperties(props),
myCart(std::move(cart)),
myAudioSettings(audioSettings)
: myOSystem{osystem},
myEvent{osystem.eventHandler().event()},
myProperties{props},
myCart{std::move(cart)},
myAudioSettings{audioSettings}
{
// Create subsystems for the console
my6502 = make_unique<M6502>(myOSystem.settings());

View File

@ -74,14 +74,9 @@ class Console : public Serializable, public ConsoleIO
*/
Console(OSystem& osystem, unique_ptr<Cartridge>& cart,
const Properties& props, AudioSettings& audioSettings);
/**
Destructor
*/
~Console() override;
public:
/**
Sets the left and right controllers for the console.
*/

View File

@ -23,10 +23,10 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Controller::Controller(Jack jack, const Event& event, const System& system,
Type type)
: myJack(jack),
myEvent(event),
mySystem(system),
myType(type)
: myJack{jack},
myEvent{event},
mySystem{system},
myType{type}
{
}

View File

@ -29,9 +29,9 @@ namespace {
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
EmulationTiming::EmulationTiming(FrameLayout frameLayout, ConsoleTiming consoleTiming) :
myFrameLayout(frameLayout),
myConsoleTiming(consoleTiming)
EmulationTiming::EmulationTiming(FrameLayout frameLayout, ConsoleTiming consoleTiming)
: myFrameLayout{frameLayout},
myConsoleTiming{consoleTiming}
{
recalculate();
}

View File

@ -71,7 +71,7 @@ using namespace std::placeholders;
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
EventHandler::EventHandler(OSystem& osystem)
: myOSystem(osystem)
: myOSystem{osystem}
{
}

View File

@ -20,7 +20,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FilesystemNode::FilesystemNode(const AbstractFSNodePtr& realNode)
: _realNode(realNode)
: _realNode{realNode}
{
}

View File

@ -60,7 +60,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FrameBuffer::FrameBuffer(OSystem& osystem)
: myOSystem(osystem)
: myOSystem{osystem}
{
}

View File

@ -24,7 +24,7 @@
KidVid::KidVid(Jack jack, const Event& event, const System& system,
const string& romMd5)
: Controller(jack, event, system, Controller::Type::KidVid),
myEnabled(myJack == Jack::Right)
myEnabled{myJack == Jack::Right}
{
// Right now, there are only two games that use the KidVid
if(romMd5 == "ee6665683ebdb539e89ba620981cb0f6")

View File

@ -29,7 +29,7 @@
Lightgun::Lightgun(Jack jack, const Event& event, const System& system,
const string& romMd5, const FrameBuffer& frameBuffer)
: Controller(jack, event, system, Controller::Type::Lightgun),
myFrameBuffer(frameBuffer)
myFrameBuffer{frameBuffer}
{
// Right now, there are only three games and a test ROM that use the light gun
if (romMd5 == "8da51e0c4b6b46f7619425119c7d018e" ||

View File

@ -47,7 +47,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
M6502::M6502(const Settings& settings)
: mySettings(settings)
: mySettings{settings}
{
}

View File

@ -27,8 +27,8 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
M6532::M6532(const ConsoleIO& console, const Settings& settings)
: myConsole(console),
mySettings(settings)
: myConsole{console},
mySettings{settings}
{
}

View File

@ -45,9 +45,9 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
MT24LC256::MT24LC256(const FilesystemNode& eepromfile, const System& system,
const Controller::onMessageCallback& callback)
: mySystem(system),
myCallback(callback),
myDataFile(eepromfile)
: mySystem{system},
myCallback{callback},
myDataFile{eepromfile}
{
// Load the data from an external file (if it exists)
bool fileValid = false;

View File

@ -62,7 +62,6 @@ class Paddles : public Controller
static constexpr int MIN_MOUSE_RANGE = 1;
static constexpr int MAX_MOUSE_RANGE = 100;
/**
Update the entire digital and analog pin state according to the
events currently set.

View File

@ -29,7 +29,7 @@ PointingDevice::PointingDevice(Jack jack, const Event& event,
const System& system, Controller::Type type,
float sensitivity)
: Controller(jack, event, system, type),
mySensitivity(sensitivity)
mySensitivity{sensitivity}
{
// The code in ::read() is set up to always return IOPortA values in
// the lower 4 bits data value

View File

@ -56,7 +56,7 @@ namespace {
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ProfilingRunner::ProfilingRunner(int argc, char* argv[])
: profilingRuns(std::max(argc - 2, 0))
: profilingRuns{std::max<size_t>(argc - 2, 0)}
{
for (int i = 2; i < argc; i++) {
ProfilingRun& run(profilingRuns[i-2]);

View File

@ -30,11 +30,12 @@
#include "QuadTari.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
QuadTari::QuadTari(Jack jack, const OSystem& osystem, const System& system, const Properties& properties)
QuadTari::QuadTari(Jack jack, const OSystem& osystem, const System& system,
const Properties& properties)
: Controller(jack, osystem.eventHandler().event(), system,
Controller::Type::QuadTari),
myOSystem(osystem),
myProperties(properties)
myOSystem{osystem},
myProperties{properties}
{
Controller::Type firstType = Controller::Type::Joystick,
secondType = Controller::Type::Joystick;

View File

@ -25,7 +25,7 @@ SaveKey::SaveKey(Jack jack, const Event& event, const System& system,
const FilesystemNode& eepromfile, const onMessageCallback& callback,
Type type)
: Controller(jack, event, system, type),
myEEPROM(make_unique<MT24LC256>(eepromfile, system, callback))
myEEPROM{make_unique<MT24LC256>(eepromfile, system, callback)}
{
setPin(DigitalPin::One, true);
setPin(DigitalPin::Two, true);

View File

@ -33,7 +33,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Settings::Settings()
: myRespository(make_shared<KeyValueRepositoryNoop>())
: myRespository{make_shared<KeyValueRepositoryNoop>()}
{
// If no version is recorded with the persisted settings, we set it to zero
setPermanent(SETTINGS_VERSION_KEY, 0);

View File

@ -23,7 +23,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Switches::Switches(const Event& event, const Properties& properties,
const Settings& settings)
: myEvent(event)
: myEvent{event}
{
if(properties.get(PropType::Console_RightDiff) == "B")
{

View File

@ -29,11 +29,11 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
System::System(Random& random, M6502& m6502, M6532& m6532,
TIA& mTIA, Cartridge& mCart)
: myRandom(random),
myM6502(m6502),
myM6532(m6532),
myTIA(mTIA),
myCart(mCart)
: myRandom{random},
myM6502{m6502},
myM6532{m6532},
myTIA{mTIA},
myCart{mCart}
{
// Initialize page access table
PageAccess access(&myNullDevice, System::PageAccessType::READ);

View File

@ -293,7 +293,7 @@ class System : public Serializable
// Constructors
PageAccess() = default;
PageAccess(Device* dev, PageAccessType access) : device(dev), type(access) { }
PageAccess(Device* dev, PageAccessType access) : device{dev}, type{access} { }
};
/**

View File

@ -46,8 +46,8 @@ namespace {
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
TIASurface::TIASurface(OSystem& system)
: myOSystem(system),
myFB(system.frameBuffer())
: myOSystem{system},
myFB{system.frameBuffer()}
{
// Load NTSC filter settings
myNTSCFilter.loadConfig(myOSystem.settings());

View File

@ -57,15 +57,15 @@ Thumbulator::Thumbulator(const uInt16* rom_ptr, uInt16* ram_ptr, uInt32 rom_size
const uInt32 c_base, const uInt32 c_start, const uInt32 c_stack,
bool traponfatal, Thumbulator::ConfigureFor configurefor,
Cartridge* cartridge)
: rom(rom_ptr),
romSize(rom_size),
cBase(c_base),
cStart(c_start),
cStack(c_stack),
decodedRom(make_unique<Op[]>(romSize / 2)), // NOLINT
ram(ram_ptr),
configuration(configurefor),
myCartridge(cartridge)
: rom{rom_ptr},
romSize{rom_size},
cBase{c_base},
cStart{c_start},
cStack{c_stack},
decodedRom{make_unique<Op[]>(romSize / 2)}, // NOLINT
ram{ram_ptr},
configuration{configurefor},
myCartridge{cartridge}
{
for(uInt32 i = 0; i < romSize / 2; ++i)
decodedRom[i] = decodeInstructionWord(CONV_RAMROM(rom[i]));

View File

@ -20,7 +20,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Ball::Ball(uInt32 collisionMask)
: myCollisionMaskDisabled(collisionMask)
: myCollisionMaskDisabled{collisionMask}
{
}

View File

@ -21,7 +21,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Missile::Missile(uInt32 collisionMask)
: myCollisionMaskDisabled(collisionMask)
: myCollisionMaskDisabled{collisionMask}
{
}

View File

@ -21,7 +21,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Player::Player(uInt32 collisionMask)
: myCollisionMaskDisabled(collisionMask)
: myCollisionMaskDisabled{collisionMask}
{
}

View File

@ -20,7 +20,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Playfield::Playfield(uInt32 collisionMask)
: myCollisionMaskDisabled(collisionMask)
: myCollisionMaskDisabled{collisionMask}
{
}

View File

@ -66,15 +66,15 @@ static constexpr uInt8 resxLateHblankThreshold = TIAConstants::H_CYCLES - 3;
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
TIA::TIA(ConsoleIO& console, const ConsoleTimingProvider& timingProvider,
Settings& settings)
: myConsole(console),
myTimingProvider(timingProvider),
mySettings(settings),
myPlayfield(~CollisionMask::playfield & 0x7FFF),
myMissile0(~CollisionMask::missile0 & 0x7FFF),
myMissile1(~CollisionMask::missile1 & 0x7FFF),
myPlayer0(~CollisionMask::player0 & 0x7FFF),
myPlayer1(~CollisionMask::player1 & 0x7FFF),
myBall(~CollisionMask::ball & 0x7FFF)
: myConsole{console},
myTimingProvider{timingProvider},
mySettings{settings},
myPlayfield{~CollisionMask::playfield & 0x7FFF},
myMissile0{~CollisionMask::missile0 & 0x7FFF},
myMissile1{~CollisionMask::missile1 & 0x7FFF},
myPlayer0{~CollisionMask::player0 & 0x7FFF},
myPlayer1{~CollisionMask::player1 & 0x7FFF},
myBall{~CollisionMask::ball & 0x7FFF}
{
myBackground.setTIA(this);
myPlayfield.setTIA(this);

View File

@ -435,6 +435,7 @@ void LauncherDialog::updateUI()
loadRomInfo();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
size_t LauncherDialog::matchWithJoker(const string& str, const string& pattern)
{
if(str.length() >= pattern.length())
@ -460,6 +461,7 @@ size_t LauncherDialog::matchWithJoker(const string& str, const string& pattern)
return string::npos;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool LauncherDialog::matchWithWildcards(const string& str, const string& pattern)
{
string pat = pattern;