Use std::string_view and fmtlib across all libraries (#3402)

- Twine, StringRef, Format, and NativeFormatting have been removed
- Logging now uses fmtlib style formatting
- Nearly all uses of wpi::outs/errs have been replaced with fmt::print() or
std::puts()/std::fputs() (for unformatted strings).
- A wpi/fmt/raw_ostream.h header has been added to enable
fmt::print() with wpi::raw_ostream
This commit is contained in:
Peter Johnson
2021-06-06 16:13:58 -07:00
committed by GitHub
parent 4f1cecb8e7
commit b2c3b2dd8e
441 changed files with 5061 additions and 9749 deletions

View File

@@ -5,9 +5,9 @@
#pragma once
#include <memory>
#include <string_view>
#include <wpi/StringMap.h>
#include <wpi/StringRef.h>
#include <wpi/deprecated.h>
#include "frc/smartdashboard/SendableBuilder.h"
@@ -56,7 +56,7 @@ class SendableChooser : public SendableChooserBase {
* @param name the name of the option
* @param object the option
*/
void AddOption(wpi::StringRef name, T object);
void AddOption(std::string_view name, T object);
/**
* Add the given object to the list of options and marks it as the default.
@@ -67,7 +67,7 @@ class SendableChooser : public SendableChooserBase {
* @param name the name of the option
* @param object the option
*/
void SetDefaultOption(wpi::StringRef name, T object);
void SetDefaultOption(std::string_view name, T object);
/**
* Adds the given object to the list of options.
@@ -75,13 +75,13 @@ class SendableChooser : public SendableChooserBase {
* On the SmartDashboard on the desktop, the object will appear as the given
* name.
*
* @deprecated use AddOption(wpi::StringRef name, T object) instead.
* @deprecated use AddOption(std::string_view name, T object) instead.
*
* @param name the name of the option
* @param object the option
*/
WPI_DEPRECATED("use AddOption() instead")
void AddObject(wpi::StringRef name, T object) { AddOption(name, object); }
void AddObject(std::string_view name, T object) { AddOption(name, object); }
/**
* Add the given object to the list of options and marks it as the default.
@@ -89,13 +89,13 @@ class SendableChooser : public SendableChooserBase {
* Functionally, this is very close to AddOption() except that it will use
* this as the default option if none other is explicitly selected.
*
* @deprecated use SetDefaultOption(wpi::StringRef name, T object) instead.
* @deprecated use SetDefaultOption(std::string_view name, T object) instead.
*
* @param name the name of the option
* @param object the option
*/
WPI_DEPRECATED("use SetDefaultOption() instead")
void AddDefault(wpi::StringRef name, T object) {
void AddDefault(std::string_view name, T object) {
SetDefaultOption(name, object);
}