mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
cscore: Use Twine instead of StringRef in API (#1244)
This commit is contained in:
@@ -9,18 +9,18 @@
|
||||
|
||||
using namespace cs;
|
||||
|
||||
PropertyImpl::PropertyImpl(wpi::StringRef name_) : name{name_} {}
|
||||
PropertyImpl::PropertyImpl(wpi::StringRef name_, CS_PropertyKind kind_,
|
||||
PropertyImpl::PropertyImpl(const wpi::Twine& name_) : name{name_.str()} {}
|
||||
PropertyImpl::PropertyImpl(const wpi::Twine& name_, CS_PropertyKind kind_,
|
||||
int step_, int defaultValue_, int value_)
|
||||
: name{name_},
|
||||
: name{name_.str()},
|
||||
propKind{kind_},
|
||||
step{step_},
|
||||
defaultValue{defaultValue_},
|
||||
value{value_} {}
|
||||
PropertyImpl::PropertyImpl(wpi::StringRef name_, CS_PropertyKind kind_,
|
||||
PropertyImpl::PropertyImpl(const wpi::Twine& name_, CS_PropertyKind kind_,
|
||||
int minimum_, int maximum_, int step_,
|
||||
int defaultValue_, int value_)
|
||||
: name{name_},
|
||||
: name{name_.str()},
|
||||
propKind{kind_},
|
||||
hasMinimum{true},
|
||||
hasMaximum{true},
|
||||
@@ -43,10 +43,11 @@ void PropertyImpl::SetValue(int v) {
|
||||
if (!wasValueSet || value != oldValue) changed();
|
||||
}
|
||||
|
||||
void PropertyImpl::SetValue(wpi::StringRef v) {
|
||||
void PropertyImpl::SetValue(const wpi::Twine& v) {
|
||||
bool valueChanged = false;
|
||||
if (valueStr != v) {
|
||||
valueStr = v;
|
||||
std::string vStr = v.str();
|
||||
if (valueStr != vStr) {
|
||||
valueStr = vStr;
|
||||
valueChanged = true;
|
||||
}
|
||||
bool wasValueSet = valueSet;
|
||||
|
||||
Reference in New Issue
Block a user