[wpilibc] Use std::string_view instead of Twine (#3380)

Use fmtlib where needed for string formatting into std::string_view.
This commit is contained in:
Peter Johnson
2021-05-26 17:44:18 -07:00
committed by GitHub
parent 50915cb7ed
commit 4e2c3051be
76 changed files with 387 additions and 419 deletions

View File

@@ -6,8 +6,8 @@
#include <memory>
#include <string>
#include <string_view>
#include <wpi/Twine.h>
#include <wpi/deprecated.h>
#include "frc/smartdashboard/SendableRegistry.h"
@@ -61,7 +61,7 @@ class SendableHelper {
* @param name name
*/
WPI_DEPRECATED("use SendableRegistry::SetName()")
void SetName(const wpi::Twine& name) {
void SetName(std::string_view name) {
SendableRegistry::GetInstance().SetName(static_cast<Derived*>(this), name);
}
@@ -74,7 +74,7 @@ class SendableHelper {
* @param name device name
*/
WPI_DEPRECATED("use SendableRegistry::SetName()")
void SetName(const wpi::Twine& subsystem, const wpi::Twine& name) {
void SetName(std::string_view subsystem, std::string_view name) {
SendableRegistry::GetInstance().SetName(static_cast<Derived*>(this),
subsystem, name);
}
@@ -100,7 +100,7 @@ class SendableHelper {
* @param subsystem subsystem name
*/
WPI_DEPRECATED("use SendableRegistry::SetSubsystem()")
void SetSubsystem(const wpi::Twine& subsystem) {
void SetSubsystem(std::string_view subsystem) {
SendableRegistry::GetInstance().SetSubsystem(static_cast<Derived*>(this),
subsystem);
}
@@ -142,7 +142,7 @@ class SendableHelper {
* @param channel The channel number the device is plugged into
*/
WPI_DEPRECATED("use SendableRegistry::SetName()")
void SetName(const wpi::Twine& moduleType, int channel) {
void SetName(std::string_view moduleType, int channel) {
SendableRegistry::GetInstance().SetName(static_cast<Derived*>(this),
moduleType, channel);
}
@@ -159,7 +159,7 @@ class SendableHelper {
* PWM)
*/
WPI_DEPRECATED("use SendableRegistry::SetName()")
void SetName(const wpi::Twine& moduleType, int moduleNumber, int channel) {
void SetName(std::string_view moduleType, int moduleNumber, int channel) {
SendableRegistry::GetInstance().SetName(static_cast<Derived*>(this),
moduleType, moduleNumber, channel);
}