[wpilibc] Shuffleboard SimpleWidget: Return pointer instead of reference (#4703)

Based on beta test feedback, returning a pointer is more intuitive, as
typically the return value is late bound to an instance variable.
This commit is contained in:
Peter Johnson
2022-11-24 09:05:37 -08:00
committed by GitHub
parent e15200068d
commit 34ec89c041
5 changed files with 35 additions and 33 deletions

View File

@@ -14,19 +14,19 @@ SimpleWidget::SimpleWidget(ShuffleboardContainer& parent,
std::string_view title)
: ShuffleboardValue(title), ShuffleboardWidget(parent, title), m_entry() {}
nt::GenericEntry& SimpleWidget::GetEntry() {
nt::GenericEntry* SimpleWidget::GetEntry() {
if (!m_entry) {
ForceGenerate();
}
return m_entry;
return &m_entry;
}
nt::GenericEntry& SimpleWidget::GetEntry(std::string_view typeString) {
nt::GenericEntry* SimpleWidget::GetEntry(std::string_view typeString) {
if (!m_entry) {
m_typeString = typeString;
ForceGenerate();
}
return m_entry;
return &m_entry;
}
void SimpleWidget::BuildInto(std::shared_ptr<nt::NetworkTable> parentTable,