diff options
| -rw-r--r-- | ui/addressindicator.h | 45 |
1 files changed, 44 insertions, 1 deletions
diff --git a/ui/addressindicator.h b/ui/addressindicator.h index 3288de35..4d7d8cf1 100644 --- a/ui/addressindicator.h +++ b/ui/addressindicator.h @@ -5,6 +5,31 @@ #include "menus.h" #include "uicontext.h" +//! Format for displaying offsets. +enum class OffsetFormat +{ + VirtualAddress, + FileStart, + SegmentStart, + SectionStart, + FunctionStart +}; + +//! Format for displaying an address range. +enum class RangeFormat +{ + StartOnly, + EndOnly, + StartAndLength, + StartAndEnd +}; + +//! Options for displaying an address or address range. +struct DisplayOptions +{ + OffsetFormat format = OffsetFormat::VirtualAddress; + RangeFormat rangeFormat = RangeFormat::StartAndEnd; +}; class BINARYNINJAUIAPI AddressIndicator : public MenuHelper { @@ -13,7 +38,25 @@ class BINARYNINJAUIAPI AddressIndicator : public MenuHelper uint64_t m_begin, m_end; BinaryViewRef m_view; - public: + DisplayOptions m_options; + + //! Format an offset as a string. + //! + //! \returns An empty string in case of failure. + QString formatOffset(uint64_t, OffsetFormat) const; + + //! Format an address range as a string. + //! + //! \returns An empty string in case of failure. + QString formatRange(uint64_t start, uint64_t end, RangeFormat, OffsetFormat) const; + + //! Create a QAction to copy a formatted offset/range. + void addActionForFormat(QMenu*, RangeFormat, OffsetFormat, QString help = ""); + + //! Refresh the text displayed in the status bar. + void updateDisplay(); + +public: AddressIndicator(QWidget* parent); void clear(); |
