SCRIPT: wpiformat

This commit is contained in:
PJ Reiniger
2025-11-07 20:01:58 -05:00
committed by Peter Johnson
parent ae6bdc9d25
commit 2109161534
749 changed files with 5504 additions and 3936 deletions

View File

@@ -208,7 +208,8 @@ class StringSource : public DataSource {
return {buf.begin(), buf.end()};
}
wpi::util::sig::SignalBase<wpi::util::spinlock, std::string_view, int64_t> valueChanged;
wpi::util::sig::SignalBase<wpi::util::spinlock, std::string_view, int64_t>
valueChanged;
private:
std::string m_value;

View File

@@ -213,7 +213,8 @@ class Storage {
* @param toJson replacement for ToJson()
*/
void SetCustomJson(
std::function<bool(const wpi::util::json& json, const char* filename)> fromJson,
std::function<bool(const wpi::util::json& json, const char* filename)>
fromJson,
std::function<wpi::util::json()> toJson) {
m_fromJson = std::move(fromJson);
m_toJson = std::move(toJson);
@@ -230,7 +231,8 @@ class Storage {
private:
mutable ValueMap m_values;
std::shared_ptr<void> m_data;
std::function<bool(const wpi::util::json& json, const char* filename)> m_fromJson;
std::function<bool(const wpi::util::json& json, const char* filename)>
m_fromJson;
std::function<wpi::util::json()> m_toJson;
std::function<void()> m_clear;
std::function<void()> m_apply;

View File

@@ -54,6 +54,7 @@ class View {
* @param display Display function
* @return unique_ptr to View
*/
std::unique_ptr<View> MakeFunctionView(wpi::util::unique_function<void()> display);
std::unique_ptr<View> MakeFunctionView(
wpi::util::unique_function<void()> display);
} // namespace wpi::glass

View File

@@ -64,7 +64,8 @@ class WindowManager {
* @param display window contents display function
* @param defaultVisibility default window visibility
*/
Window* AddWindow(std::string_view id, wpi::util::unique_function<void()> display,
Window* AddWindow(std::string_view id,
wpi::util::unique_function<void()> display,
Window::Visibility defaultVisibility = Window::kShow);
/**

View File

@@ -25,7 +25,8 @@ class AnalogInputModel : public Model {
class AnalogInputsModel : public Model {
public:
virtual void ForEachAnalogInput(
wpi::util::function_ref<void(AnalogInputModel& model, int index)> func) = 0;
wpi::util::function_ref<void(AnalogInputModel& model, int index)>
func) = 0;
};
void DisplayAnalogInput(AnalogInputModel* model, int index);

View File

@@ -12,7 +12,7 @@
namespace wpi::util {
template <typename T>
class SmallVectorImpl;
} // namespace wpi
} // namespace wpi::util
namespace wpi::glass {
@@ -24,7 +24,8 @@ class LEDDisplayModel : public wpi::glass::Model {
uint8_t b;
};
virtual std::span<const Data> GetData(wpi::util::SmallVectorImpl<Data>& buf) = 0;
virtual std::span<const Data> GetData(
wpi::util::SmallVectorImpl<Data>& buf) = 0;
};
class LEDDisplaysModel : public wpi::glass::Model {
@@ -32,7 +33,8 @@ class LEDDisplaysModel : public wpi::glass::Model {
virtual size_t GetNumLEDDisplays() = 0;
virtual void ForEachLEDDisplay(
wpi::util::function_ref<void(LEDDisplayModel& model, int index)> func) = 0;
wpi::util::function_ref<void(LEDDisplayModel& model, int index)>
func) = 0;
};
void DisplayLEDDisplay(LEDDisplayModel* model, int index);

View File

@@ -11,7 +11,7 @@
namespace wpi::util {
template <typename T>
class SmallVectorImpl;
} // namespace wpi
} // namespace wpi::util
namespace wpi::glass {

View File

@@ -34,7 +34,8 @@ class Field2DModel : public Model {
virtual FieldObjectModel* AddFieldObject(std::string_view name) = 0;
virtual void RemoveFieldObject(std::string_view name) = 0;
virtual void ForEachFieldObject(
wpi::util::function_ref<void(FieldObjectModel& model, std::string_view name)>
wpi::util::function_ref<void(FieldObjectModel& model,
std::string_view name)>
func) = 0;
};

View File

@@ -15,8 +15,11 @@ namespace wpi::glass::expression {
template <typename V>
wpi::util::expected<V, std::string> TryParseExpr(const char* expr);
extern template wpi::util::expected<double, std::string> TryParseExpr(const char*);
extern template wpi::util::expected<float, std::string> TryParseExpr(const char*);
extern template wpi::util::expected<int64_t, std::string> TryParseExpr(const char*);
extern template wpi::util::expected<double, std::string> TryParseExpr(
const char*);
extern template wpi::util::expected<float, std::string> TryParseExpr(
const char*);
extern template wpi::util::expected<int64_t, std::string> TryParseExpr(
const char*);
} // namespace wpi::glass::expression