mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 09:07:35 +00:00
HexEditor: Prefer enum class to enum for FindDialog::OptionId
This commit is contained in:
parent
b330d83be4
commit
f742334b93
2 changed files with 9 additions and 9 deletions
|
@ -24,8 +24,8 @@ struct Option {
|
||||||
|
|
||||||
static constexpr Array<Option, 2> options = {
|
static constexpr Array<Option, 2> options = {
|
||||||
{
|
{
|
||||||
{ "ASCII String"sv, OPTION_ASCII_STRING, true, true },
|
{ "ASCII String"sv, OptionId::AsciiString, true, true },
|
||||||
{ "Hex value"sv, OPTION_HEX_VALUE, true, false },
|
{ "Hex value"sv, OptionId::HexValue, true, false },
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -77,9 +77,9 @@ ErrorOr<ByteBuffer> FindDialog::process_input(StringView text_value, OptionId op
|
||||||
VERIFY(!text_value.is_empty());
|
VERIFY(!text_value.is_empty());
|
||||||
|
|
||||||
switch (opt) {
|
switch (opt) {
|
||||||
case OPTION_ASCII_STRING:
|
case OptionId::AsciiString:
|
||||||
return ByteBuffer::copy(text_value.bytes());
|
return ByteBuffer::copy(text_value.bytes());
|
||||||
case OPTION_HEX_VALUE: {
|
case OptionId::HexValue: {
|
||||||
auto text_no_spaces = text_value.replace(" "sv, ""sv, ReplaceMode::All);
|
auto text_no_spaces = text_value.replace(" "sv, ""sv, ReplaceMode::All);
|
||||||
return decode_hex(text_no_spaces);
|
return decode_hex(text_no_spaces);
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,10 +11,10 @@
|
||||||
#include <AK/String.h>
|
#include <AK/String.h>
|
||||||
#include <LibGUI/Dialog.h>
|
#include <LibGUI/Dialog.h>
|
||||||
|
|
||||||
enum OptionId {
|
enum class OptionId {
|
||||||
OPTION_INVALID = -1,
|
Invalid = -1,
|
||||||
OPTION_ASCII_STRING,
|
AsciiString,
|
||||||
OPTION_HEX_VALUE
|
HexValue
|
||||||
};
|
};
|
||||||
|
|
||||||
class FindDialog : public GUI::Dialog {
|
class FindDialog : public GUI::Dialog {
|
||||||
|
@ -41,5 +41,5 @@ private:
|
||||||
|
|
||||||
bool m_find_all { false };
|
bool m_find_all { false };
|
||||||
String m_text_value;
|
String m_text_value;
|
||||||
OptionId m_selected_option { OPTION_INVALID };
|
OptionId m_selected_option { OptionId::Invalid };
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue