Renamed addressType to addressInputType for clarity on significance of add input type

This commit is contained in:
Nav
2022-01-16 19:19:44 +00:00
parent ae00ed8013
commit 9688d05a93
5 changed files with 16 additions and 16 deletions

View File

@@ -16,7 +16,7 @@ namespace Bloom
EXCLUDED,
};
enum class MemoryRegionAddressType: std::uint8_t
enum class MemoryRegionAddressInputType: std::uint8_t
{
ABSOLUTE,
RELATIVE,
@@ -41,7 +41,7 @@ namespace Bloom
* See RegionItem::convertRelativeToAbsoluteAddressRange()
* See RegionItem::convertAbsoluteToRelativeAddressRange()
*/
MemoryRegionAddressType addressRangeType = MemoryRegionAddressType::ABSOLUTE;
MemoryRegionAddressInputType addressRangeInputType = MemoryRegionAddressInputType::ABSOLUTE;
/**
* This address range will always be in absolute form. Regardless of the value of this->addressRangeType.

View File

@@ -40,7 +40,7 @@ void ExcludedRegionItem::applyChanges() {
this->startAddressInput->text().toUInt(nullptr, 16),
this->endAddressInput->text().toUInt(nullptr, 16)
);
this->memoryRegion.addressRangeType = this->getSelectedAddressType();
this->memoryRegion.addressRange = this->memoryRegion.addressRangeType == MemoryRegionAddressType::RELATIVE ?
this->memoryRegion.addressRangeInputType = this->getSelectedAddressInputType();
this->memoryRegion.addressRange = this->memoryRegion.addressRangeInputType == MemoryRegionAddressInputType::RELATIVE ?
this->convertRelativeToAbsoluteAddressRange(inputAddressRange) : inputAddressRange;
}

View File

@@ -40,8 +40,8 @@ void FocusedRegionItem::applyChanges() {
this->startAddressInput->text().toUInt(nullptr, 16),
this->endAddressInput->text().toUInt(nullptr, 16)
);
this->memoryRegion.addressRangeType = this->getSelectedAddressType();
this->memoryRegion.addressRange = this->memoryRegion.addressRangeType == MemoryRegionAddressType::RELATIVE ?
this->memoryRegion.addressRangeInputType = this->getSelectedAddressInputType();
this->memoryRegion.addressRange = this->memoryRegion.addressRangeInputType == MemoryRegionAddressInputType::RELATIVE ?
this->convertRelativeToAbsoluteAddressRange(inputAddressRange) : inputAddressRange;
auto selectedDataTypeOptionName = this->dataTypeInput->currentData().toString();

View File

@@ -96,7 +96,7 @@ QStringList RegionItem::getValidationFailures() const {
validationFailures.emplace_back("The start address exceeds the end address.");
}
auto addressType = this->getSelectedAddressType();
auto addressType = this->getSelectedAddressInputType();
const auto memoryAddressRange = this->memoryDescriptor.addressRange;
const auto memoryAddressRangeStr = QString(
@@ -104,7 +104,7 @@ QStringList RegionItem::getValidationFailures() const {
+ "0x" + QString::number(memoryAddressRange.endAddress, 16).toUpper()
);
const auto absoluteAddressRange = addressType == MemoryRegionAddressType::RELATIVE ?
const auto absoluteAddressRange = addressType == MemoryRegionAddressInputType::RELATIVE ?
this->convertRelativeToAbsoluteAddressRange(TargetMemoryAddressRange(startAddress, endAddress))
: TargetMemoryAddressRange(startAddress, endAddress);
@@ -143,7 +143,7 @@ void RegionItem::initFormInputs() {
this->addressTypeInput->addItem(option.text, optionName);
}
if (region.addressRangeType == MemoryRegionAddressType::RELATIVE) {
if (region.addressRangeInputType == MemoryRegionAddressInputType::RELATIVE) {
auto relativeAddressRange = this->convertAbsoluteToRelativeAddressRange(region.addressRange);
this->addressTypeInput->setCurrentText(RegionItem::addressRangeTypeOptionsByName.at("relative").text);
@@ -163,13 +163,13 @@ void RegionItem::initFormInputs() {
QObject::connect(this->nameInput, &QLineEdit::textEdited, this, &RegionItem::onNameInputChange);
}
MemoryRegionAddressType RegionItem::getSelectedAddressType() const {
MemoryRegionAddressInputType RegionItem::getSelectedAddressInputType() const {
auto selectedAddressTypeOptionName = this->addressTypeInput->currentData().toString();
if (RegionItem::addressRangeTypeOptionsByName.contains(selectedAddressTypeOptionName)) {
return RegionItem::addressRangeTypeOptionsByName.at(selectedAddressTypeOptionName).addressType;
}
return MemoryRegionAddressType::ABSOLUTE;
return MemoryRegionAddressInputType::ABSOLUTE;
}
TargetMemoryAddressRange RegionItem::convertAbsoluteToRelativeAddressRange(

View File

@@ -18,9 +18,9 @@ namespace Bloom::Widgets
struct AddressRangeTypeOption
{
QString text;
MemoryRegionAddressType addressType;
MemoryRegionAddressInputType addressType;
AddressRangeTypeOption(const QString& text, MemoryRegionAddressType addressType)
AddressRangeTypeOption(const QString& text, MemoryRegionAddressInputType addressType)
: text(text), addressType(addressType) {};
};
@@ -63,7 +63,7 @@ namespace Bloom::Widgets
TextInput* sizeInput = nullptr;
virtual void initFormInputs();
[[nodiscard]] MemoryRegionAddressType getSelectedAddressType() const;
[[nodiscard]] MemoryRegionAddressInputType getSelectedAddressInputType() const;
Targets::TargetMemoryAddressRange convertAbsoluteToRelativeAddressRange(
const Targets::TargetMemoryAddressRange& absoluteAddressRange
@@ -83,8 +83,8 @@ namespace Bloom::Widgets
static inline const std::map<QString, AddressRangeTypeOption> addressRangeTypeOptionsByName = std::map<
QString, AddressRangeTypeOption
>({
{"absolute", AddressRangeTypeOption("Absolute", MemoryRegionAddressType::ABSOLUTE)},
{"relative", AddressRangeTypeOption("Relative", MemoryRegionAddressType::RELATIVE)},
{"absolute", AddressRangeTypeOption("Absolute", MemoryRegionAddressInputType::ABSOLUTE)},
{"relative", AddressRangeTypeOption("Relative", MemoryRegionAddressInputType::RELATIVE)},
});
void onAddressRangeInputChange();