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

@@ -4,11 +4,11 @@
#include <thread>
#include <fmt/format.h>
#include <hal/DriverStation.h>
#include <hal/HALBase.h>
#include <hal/Main.h>
#include <hal/simulation/DIOData.h>
#include <wpi/raw_ostream.h>
#include <wpi/uv/Loop.h>
#include "HALSimWSServer.h"
@@ -55,8 +55,8 @@ TEST_F(WebServerIntegrationTest, DISABLED_DigitalOutput) {
return;
}
if (IsConnectedClientWS()) {
wpi::outs() << "***** Setting DIO value for pin " << PIN << " to "
<< (EXPECTED_VALUE ? "true" : "false") << "\n";
fmt::print("***** Setting DIO value for pin {} to {}\n", PIN,
(EXPECTED_VALUE ? "true" : "false"));
HALSIM_SetDIOValue(PIN, EXPECTED_VALUE);
done = true;
}
@@ -83,7 +83,7 @@ TEST_F(WebServerIntegrationTest, DISABLED_DigitalOutput) {
test_value = it.value();
}
} catch (wpi::json::exception& e) {
wpi::errs() << "Error with incoming message: " << e.what() << "\n";
fmt::print(stderr, "Error with incoming message: {}\n", e.what());
}
// Compare results
@@ -109,7 +109,7 @@ TEST_F(WebServerIntegrationTest, DISABLED_DigitalInput) {
wpi::json msg = {{"type", "DIO"},
{"device", std::to_string(PIN)},
{"data", {{"<>value", EXPECTED_VALUE}}}};
wpi::outs() << "***** Input JSON: " << msg.dump() << "\n";
fmt::print("***** Input JSON: {}\n", msg.dump());
m_webserverClient->SendMessage(msg);
done = true;
}
@@ -144,7 +144,7 @@ TEST_F(WebServerIntegrationTest, DriverStation) {
{"type", "DriverStation"},
{"device", ""},
{"data", {{">enabled", EXPECTED_VALUE}, {">new_data", true}}}};
wpi::outs() << "***** Input JSON: " << msg.dump() << "\n";
fmt::print("***** Input JSON: {}\n", msg.dump());
m_webserverClient->SendMessage(msg);
done = true;
}