Make better use of modern c++

Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
This commit is contained in:
Adrian Conlon 2020-05-02 11:36:43 +01:00
parent 44c6a8c3d1
commit 5eedbe1225
13 changed files with 11 additions and 23 deletions

View File

@ -8,7 +8,7 @@ namespace EightBit {
class BigEndianProcessor : public Processor {
public:
~BigEndianProcessor() = default;
virtual ~BigEndianProcessor() = default;
register16_t peekWord(register16_t address) final;
void pokeWord(register16_t address, register16_t value) final;

View File

@ -66,9 +66,9 @@ namespace EightBit {
[[nodiscard]] static constexpr auto promoteNibble(const int value) { return value << 4; }
[[nodiscard]] static constexpr auto demoteNibble(const int value) { return highNibble(value); }
virtual ~Chip();
virtual ~Chip() = default;
protected:
Chip();
Chip() = default;
};
}

View File

@ -7,7 +7,7 @@
namespace EightBit {
class ClockedChip : public Chip {
public:
~ClockedChip() {};
virtual ~ClockedChip() = default;
Signal<EventArgs> Ticked;

View File

@ -72,13 +72,13 @@ namespace EightBit {
static void match(PinLevel& line, bool condition) noexcept { condition ? raise(line) : lower(line); }
static void match(PinLevel& out, PinLevel in) noexcept { out = in; }
virtual ~Device() {};
virtual ~Device() = default;
[[nodiscard]] bool powered() noexcept { return raised(POWER()); }
DECLARE_PIN_INPUT(POWER)
protected:
Device() noexcept {};
Device() noexcept = default;
};
}

View File

@ -11,8 +11,6 @@ namespace EightBit {
public:
enum class AccessType { Unknown, Reading, Writing };
InputOutput() = default;
[[nodiscard]] size_t size() const noexcept override;
[[nodiscard]] uint8_t peek(uint16_t address) const override;

View File

@ -9,7 +9,7 @@
#include <utility>
namespace EightBit {
class IntelHexFile {
class IntelHexFile final {
public:
IntelHexFile(std::string path);

View File

@ -34,7 +34,7 @@ namespace EightBit {
}
};
~IntelProcessor() = default;
virtual ~IntelProcessor() = default;
[[nodiscard]] const auto& getDecodedOpcode(const size_t i) const noexcept {
return m_decodedOpcodes.at(i);

View File

@ -8,7 +8,7 @@ namespace EightBit {
class LittleEndianProcessor : public Processor {
public:
~LittleEndianProcessor() = default;
virtual ~LittleEndianProcessor() = default;
register16_t peekWord(register16_t address) final;
void pokeWord(register16_t address, register16_t value) final;

View File

@ -7,7 +7,7 @@ namespace EightBit {
class Memory;
struct MemoryMapping {
struct MemoryMapping final {
enum class AccessLevel { Unknown, ReadOnly, WriteOnly, ReadWrite };

View File

@ -15,7 +15,7 @@ namespace EightBit {
// x: sign extend this b-bit number to r
[[nodiscard]] static int8_t signExtend(int b, uint8_t x) noexcept;
~Processor() = default;
virtual ~Processor() = default;
[[nodiscard]] auto& PC() noexcept { return m_pc; }

View File

@ -1,6 +0,0 @@
#include "stdafx.h"
#include "Chip.h"
EightBit::Chip::Chip() {}
EightBit::Chip::~Chip() {}

View File

@ -178,7 +178,6 @@
<ItemGroup>
<ClCompile Include="BigEndianProcessor.cpp" />
<ClCompile Include="Bus.cpp" />
<ClCompile Include="Chip.cpp" />
<ClCompile Include="Device.cpp" />
<ClCompile Include="EventArgs.cpp" />
<ClCompile Include="InputOutput.cpp" />

View File

@ -103,9 +103,6 @@
<ClCompile Include="BigEndianProcessor.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Chip.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Rom.cpp">
<Filter>Source Files</Filter>
</ClCompile>