mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-25 01:41:43 +00:00
Use Twine for error message inputs.
This commit is contained in:
@@ -14,7 +14,7 @@
|
||||
#include <thread>
|
||||
|
||||
#include <HAL/DriverStation.h>
|
||||
#include <llvm/StringRef.h>
|
||||
#include <llvm/Twine.h>
|
||||
#include <support/mutex.h>
|
||||
|
||||
#include "ErrorBase.h"
|
||||
@@ -35,10 +35,11 @@ class DriverStation : public ErrorBase, public RobotStateInterface {
|
||||
|
||||
~DriverStation() override;
|
||||
static DriverStation& GetInstance();
|
||||
static void ReportError(llvm::StringRef error);
|
||||
static void ReportWarning(llvm::StringRef error);
|
||||
static void ReportError(bool isError, int code, llvm::StringRef error,
|
||||
llvm::StringRef location, llvm::StringRef stack);
|
||||
static void ReportError(const llvm::Twine& error);
|
||||
static void ReportWarning(const llvm::Twine& error);
|
||||
static void ReportError(bool isError, int code, const llvm::Twine& error,
|
||||
const llvm::Twine& location,
|
||||
const llvm::Twine& stack);
|
||||
|
||||
static constexpr int kJoystickPorts = 6;
|
||||
|
||||
@@ -124,8 +125,8 @@ class DriverStation : public ErrorBase, public RobotStateInterface {
|
||||
private:
|
||||
DriverStation();
|
||||
|
||||
void ReportJoystickUnpluggedError(llvm::StringRef message);
|
||||
void ReportJoystickUnpluggedWarning(llvm::StringRef message);
|
||||
void ReportJoystickUnpluggedError(const llvm::Twine& message);
|
||||
void ReportJoystickUnpluggedWarning(const llvm::Twine& message);
|
||||
void Run();
|
||||
void UpdateControlWord(bool force, HAL_ControlWord& controlWord) const;
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include <string>
|
||||
|
||||
#include <llvm/StringRef.h>
|
||||
#include <llvm/Twine.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <Windows.h>
|
||||
@@ -46,8 +47,8 @@ class Error {
|
||||
const ErrorBase* GetOriginatingObject() const;
|
||||
double GetTimestamp() const;
|
||||
void Clear();
|
||||
void Set(Code code, llvm::StringRef contextMessage, llvm::StringRef filename,
|
||||
llvm::StringRef function, int lineNumber,
|
||||
void Set(Code code, const llvm::Twine& contextMessage,
|
||||
llvm::StringRef filename, llvm::StringRef function, int lineNumber,
|
||||
const ErrorBase* originatingObject);
|
||||
|
||||
private:
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <llvm/StringRef.h>
|
||||
#include <llvm/Twine.h>
|
||||
#include <support/mutex.h>
|
||||
|
||||
#include "Base.h"
|
||||
@@ -81,32 +82,33 @@ class ErrorBase {
|
||||
|
||||
virtual Error& GetError();
|
||||
virtual const Error& GetError() const;
|
||||
virtual void SetErrnoError(llvm::StringRef contextMessage,
|
||||
virtual void SetErrnoError(const llvm::Twine& contextMessage,
|
||||
llvm::StringRef filename, llvm::StringRef function,
|
||||
int lineNumber) const;
|
||||
virtual void SetImaqError(int success, llvm::StringRef contextMessage,
|
||||
virtual void SetImaqError(int success, const llvm::Twine& contextMessage,
|
||||
llvm::StringRef filename, llvm::StringRef function,
|
||||
int lineNumber) const;
|
||||
virtual void SetError(Error::Code code, llvm::StringRef contextMessage,
|
||||
virtual void SetError(Error::Code code, const llvm::Twine& contextMessage,
|
||||
llvm::StringRef filename, llvm::StringRef function,
|
||||
int lineNumber) const;
|
||||
virtual void SetErrorRange(Error::Code code, int32_t minRange,
|
||||
int32_t maxRange, int32_t requestedValue,
|
||||
llvm::StringRef contextMessage,
|
||||
const llvm::Twine& contextMessage,
|
||||
llvm::StringRef filename, llvm::StringRef function,
|
||||
int lineNumber) const;
|
||||
virtual void SetWPIError(llvm::StringRef errorMessage, Error::Code code,
|
||||
llvm::StringRef contextMessage,
|
||||
virtual void SetWPIError(const llvm::Twine& errorMessage, Error::Code code,
|
||||
const llvm::Twine& contextMessage,
|
||||
llvm::StringRef filename, llvm::StringRef function,
|
||||
int lineNumber) const;
|
||||
virtual void CloneError(const ErrorBase& rhs) const;
|
||||
virtual void ClearError() const;
|
||||
virtual bool StatusIsFatal() const;
|
||||
static void SetGlobalError(Error::Code code, llvm::StringRef contextMessage,
|
||||
static void SetGlobalError(Error::Code code,
|
||||
const llvm::Twine& contextMessage,
|
||||
llvm::StringRef filename, llvm::StringRef function,
|
||||
int lineNumber);
|
||||
static void SetGlobalWPIError(llvm::StringRef errorMessage,
|
||||
llvm::StringRef contextMessage,
|
||||
static void SetGlobalWPIError(const llvm::Twine& errorMessage,
|
||||
const llvm::Twine& contextMessage,
|
||||
llvm::StringRef filename,
|
||||
llvm::StringRef function, int lineNumber);
|
||||
static Error& GetGlobalError();
|
||||
|
||||
Reference in New Issue
Block a user