mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-07-02 02:51:42 +00:00
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:
@@ -19,6 +19,8 @@
|
||||
#include <string>
|
||||
#include <thread>
|
||||
|
||||
#include <fmt/format.h>
|
||||
|
||||
#include "HALInternal.h"
|
||||
#include "hal/cpp/SerialHelper.h"
|
||||
#include "hal/handles/HandlesInternal.h"
|
||||
@@ -184,7 +186,7 @@ void HAL_SetSerialBaudRate(HAL_SerialPortHandle handle, int32_t baud,
|
||||
BAUDCASE(4000000)
|
||||
default:
|
||||
*status = PARAMETER_OUT_OF_RANGE;
|
||||
hal::SetLastError(status, "Invalid BaudRate: " + wpi::Twine(baud));
|
||||
hal::SetLastError(status, fmt::format("Invalid BaudRate: {}", baud));
|
||||
return;
|
||||
}
|
||||
int err = cfsetospeed(&port->tty, static_cast<speed_t>(port->baudRate));
|
||||
@@ -227,7 +229,7 @@ void HAL_SetSerialDataBits(HAL_SerialPortHandle handle, int32_t bits,
|
||||
break;
|
||||
default:
|
||||
*status = PARAMETER_OUT_OF_RANGE;
|
||||
hal::SetLastError(status, "Invalid data bits: " + wpi::Twine(bits));
|
||||
hal::SetLastError(status, fmt::format("Invalid data bits: {}", bits));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -275,7 +277,7 @@ void HAL_SetSerialParity(HAL_SerialPortHandle handle, int32_t parity,
|
||||
break;
|
||||
default:
|
||||
*status = PARAMETER_OUT_OF_RANGE;
|
||||
hal::SetLastError(status, "Invalid parity bits: " + wpi::Twine(parity));
|
||||
hal::SetLastError(status, fmt::format("Invalid parity bits: {}", parity));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -303,7 +305,7 @@ void HAL_SetSerialStopBits(HAL_SerialPortHandle handle, int32_t stopBits,
|
||||
break;
|
||||
default:
|
||||
*status = PARAMETER_OUT_OF_RANGE;
|
||||
hal::SetLastError(status, "Invalid stop bits: " + wpi::Twine(stopBits));
|
||||
hal::SetLastError(status, fmt::format("Invalid stop bits: {}", stopBits));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -339,7 +341,7 @@ void HAL_SetSerialFlowControl(HAL_SerialPortHandle handle, int32_t flow,
|
||||
break;
|
||||
default:
|
||||
*status = PARAMETER_OUT_OF_RANGE;
|
||||
hal::SetLastError(status, "Invalid fc bits: " + wpi::Twine(flow));
|
||||
hal::SetLastError(status, fmt::format("Invalid fc bits: {}", flow));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user