mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
[wpimath] Move unit formatters into units library (#5358)
This commit is contained in:
@@ -5,7 +5,6 @@
|
||||
#include "frc2/command/WaitCommand.h"
|
||||
|
||||
#include <fmt/format.h>
|
||||
#include <frc/fmt/Units.h>
|
||||
#include <wpi/sendable/SendableBuilder.h>
|
||||
|
||||
using namespace frc2;
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
#include "frc/RobotBase.h"
|
||||
#include "frc/SensorUtil.h"
|
||||
#include "frc/Solenoid.h"
|
||||
#include "frc/fmt/Units.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
#include "frc/TimesliceRobot.h"
|
||||
|
||||
#include "frc/Errors.h"
|
||||
#include "frc/fmt/Units.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@
|
||||
#include <locale>
|
||||
#include <string>
|
||||
#endif
|
||||
#if !defined(UNIT_LIB_DISABLE_FMT)
|
||||
#if __has_include(<fmt/format.h>) && !defined(UNIT_LIB_DISABLE_FMT)
|
||||
#include <locale>
|
||||
#include <string>
|
||||
#include <fmt/format.h>
|
||||
@@ -176,7 +176,7 @@ namespace units
|
||||
* @param abbrev - abbreviated unit name, e.g. 'm'
|
||||
* @note When UNIT_LIB_ENABLE_IOSTREAM isn't defined, the macro does not generate any code
|
||||
*/
|
||||
#if !defined(UNIT_LIB_DISABLE_FMT)
|
||||
#if __has_include(<fmt/format.h>) && !defined(UNIT_LIB_DISABLE_FMT)
|
||||
#define UNIT_ADD_IO(namespaceName, nameSingular, abbrev)\
|
||||
}\
|
||||
template <>\
|
||||
@@ -2875,7 +2875,7 @@ namespace units
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#if !defined(UNIT_LIB_DISABLE_FMT)
|
||||
#if __has_include(<fmt/format.h>) && !defined(UNIT_LIB_DISABLE_FMT)
|
||||
template <>
|
||||
struct fmt::formatter<units::dimensionless::dB_t> : fmt::formatter<double>
|
||||
{
|
||||
@@ -3440,6 +3440,6 @@ namespace units::literals {}
|
||||
using namespace units::literals;
|
||||
#endif // UNIT_HAS_LITERAL_SUPPORT
|
||||
|
||||
#if !defined(UNIT_LIB_DISABLE_FMT)
|
||||
#include "frc/fmt/Units.h"
|
||||
#if __has_include(<fmt/format.h>) && !defined(UNIT_LIB_DISABLE_FMT)
|
||||
#include "units/formatter.h"
|
||||
#endif
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
#include <fmt/format.h>
|
||||
|
||||
#include "frc/fmt/Eigen.h"
|
||||
#include "frc/fmt/Units.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include "units/velocity.h"
|
||||
|
||||
|
||||
@@ -1420,7 +1420,7 @@ TEST_F(UnitContainer, cout) {
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(UNIT_LIB_DISABLE_FMT)
|
||||
#if __has_include(<fmt/format.h>) && !defined(UNIT_LIB_DISABLE_FMT)
|
||||
TEST_F(UnitContainer, fmtlib) {
|
||||
testing::internal::CaptureStdout();
|
||||
fmt::print("{}", degree_t(349.87));
|
||||
|
||||
Reference in New Issue
Block a user