[LLDB][GUI] Add Arch Field

This patch adds an Arch field that inputs and validates an arch spec.

Differential Revision: https://reviews.llvm.org/D106564
This commit is contained in:
Omar Emara 2021-07-26 14:21:57 -07:00 committed by Greg Clayton
parent fed25ddc1c
commit ed5b4dbd39
1 changed files with 27 additions and 0 deletions

View File

@ -1374,6 +1374,25 @@ protected:
bool m_need_to_exist;
};
class ArchFieldDelegate : public TextFieldDelegate {
public:
ArchFieldDelegate(const char *label, const char *content, bool required)
: TextFieldDelegate(label, content, required) {}
void FieldDelegateExitCallback() override {
TextFieldDelegate::FieldDelegateExitCallback();
if (!IsSpecified())
return;
if (!GetArchSpec().IsValid())
SetError("Not a valid arch!");
}
const std::string &GetArchString() { return m_content; }
ArchSpec GetArchSpec() { return ArchSpec(GetArchString()); }
};
class BooleanFieldDelegate : public FieldDelegate {
public:
BooleanFieldDelegate(const char *label, bool content)
@ -1989,6 +2008,14 @@ public:
return delegate;
}
ArchFieldDelegate *AddArchField(const char *label, const char *content,
bool required) {
ArchFieldDelegate *delegate =
new ArchFieldDelegate(label, content, required);
m_fields.push_back(FieldDelegateUP(delegate));
return delegate;
}
IntegerFieldDelegate *AddIntegerField(const char *label, int content,
bool required) {
IntegerFieldDelegate *delegate =