mirror of
https://github.com/markdavidlong/AppleSAWS.git
synced 2026-04-19 14:16:45 +00:00
Further cleanup of the jumplines code
This commit is contained in:
@@ -108,6 +108,7 @@ set(SOURCES
|
||||
src/ui/diskexplorer/DiskExplorerMapWidget.cxx
|
||||
src/applesoftfile/ApplesoftRetokenizer.cxx
|
||||
src/binaryfile/JumpLine.cxx
|
||||
src/binaryfile/JumpLines.cxx
|
||||
src/binaryfile/JumpLineManager.cxx
|
||||
src/ui/widgets/FlowLineTextBrowser.cxx
|
||||
src/util/OpCodes.cxx
|
||||
@@ -174,6 +175,7 @@ set(HEADERS
|
||||
src/applesoftfile/ApplesoftRetokenizer.h
|
||||
src/util/AppleColors.h
|
||||
src/binaryfile/JumpLine.h
|
||||
src/binaryfile/JumpLines.h
|
||||
src/binaryfile/JumpLineManager.h
|
||||
src/ui/widgets/FlowLineTextBrowser.h
|
||||
src/ui/widgets/AsciiInfoDialog.h
|
||||
|
||||
@@ -158,16 +158,3 @@ bool JumpLineManager::isLineWithinRange(quint16 line, JumpLine::TJump& jm) const
|
||||
|
||||
return (line > min && line < max);
|
||||
}
|
||||
|
||||
QList<JumpLine> JumpLines::jumpLinesAtAddress(quint16 addrs) const
|
||||
{
|
||||
QList<JumpLine> list;
|
||||
foreach (const JumpLine& jl, jumpLines)
|
||||
{
|
||||
if (addrs >= jl.min() && addrs <= jl.max())
|
||||
{
|
||||
list.append(jl);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
#include "Util.h"
|
||||
#include "JumpLine.h"
|
||||
#include "JumpLines.h"
|
||||
|
||||
#include <QPair>
|
||||
#include <QMap>
|
||||
@@ -11,36 +12,6 @@
|
||||
|
||||
//////////////////
|
||||
|
||||
class JumpLines
|
||||
{
|
||||
public:
|
||||
// Type aliases for compatibility with existing code
|
||||
using TJump = JumpLine::TJump;
|
||||
using JumpType = JumpLine::JumpType;
|
||||
using JumpMap = JumpLine::JumpMap;
|
||||
|
||||
// Legacy enum values for backward compatibility
|
||||
static constexpr JumpType IsUnknownJump = JumpType::Unknown;
|
||||
static constexpr JumpType IsJMP = JumpType::JMP;
|
||||
static constexpr JumpType IsBranch = JumpType::Branch;
|
||||
static constexpr JumpType IsJSR = JumpType::JSR;
|
||||
static constexpr JumpType IsBRA = JumpType::BRA;
|
||||
|
||||
JumpLines() : m_maxChannel(0) {}
|
||||
|
||||
[[nodiscard]] QList<int> channelsAtAddress(quint16 address) const {
|
||||
return m_channelsAtAddress.value(address);
|
||||
}
|
||||
|
||||
[[nodiscard]] QList<JumpLine> jumpLinesAtAddress(quint16 addrs) const;
|
||||
|
||||
QList<JumpLine> jumpLines;
|
||||
int m_maxChannel;
|
||||
QMap<quint16, QList<int>> m_channelsAtAddress;
|
||||
};
|
||||
|
||||
//////////////////
|
||||
|
||||
class JumpLineManager
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
#include "JumpLines.h"
|
||||
|
||||
QList<JumpLine> JumpLines::jumpLinesAtAddress(quint16 addrs) const
|
||||
{
|
||||
QList<JumpLine> list;
|
||||
foreach (const JumpLine& jl, jumpLines)
|
||||
{
|
||||
if (addrs >= jl.min() && addrs <= jl.max())
|
||||
{
|
||||
list.append(jl);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
#pragma once
|
||||
|
||||
#include "JumpLine.h"
|
||||
|
||||
#include <QList>
|
||||
#include <QMap>
|
||||
|
||||
class JumpLines
|
||||
{
|
||||
public:
|
||||
// Type aliases for convenience and compatibility
|
||||
using TJump = JumpLine::TJump;
|
||||
using JumpType = JumpLine::JumpType;
|
||||
using JumpMap = JumpLine::JumpMap;
|
||||
|
||||
constexpr JumpLines() noexcept : m_maxChannel(0) {}
|
||||
|
||||
[[nodiscard]] QList<int> channelsAtAddress(quint16 address) const {
|
||||
return m_channelsAtAddress.value(address);
|
||||
}
|
||||
|
||||
[[nodiscard]] QList<JumpLine> jumpLinesAtAddress(quint16 addrs) const;
|
||||
|
||||
// Public data members (maintaining existing interface)
|
||||
QList<JumpLine> jumpLines;
|
||||
int m_maxChannel;
|
||||
QMap<quint16, QList<int>> m_channelsAtAddress;
|
||||
|
||||
// Additional utility methods
|
||||
[[nodiscard]] bool isEmpty() const noexcept { return jumpLines.isEmpty(); }
|
||||
[[nodiscard]] int count() const noexcept { return jumpLines.count(); }
|
||||
void clear() noexcept {
|
||||
jumpLines.clear();
|
||||
m_channelsAtAddress.clear();
|
||||
m_maxChannel = 0;
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user