mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-07-02 02:51:42 +00:00
Replace std::stringstream with llvm::raw_svector_ostream (#345)
A few locations were changed to use std::ostringstream.
This commit is contained in:
committed by
Peter Johnson
parent
7006672b06
commit
b433d98c02
@@ -7,11 +7,11 @@
|
||||
|
||||
#include "Error.h"
|
||||
|
||||
#include <sstream>
|
||||
|
||||
#include "DriverStation.h"
|
||||
#include "Timer.h"
|
||||
#include "Utility.h"
|
||||
#include "llvm/SmallString.h"
|
||||
#include "llvm/raw_ostream.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
@@ -64,7 +64,8 @@ void Error::Set(Code code, llvm::StringRef contextMessage,
|
||||
}
|
||||
|
||||
void Error::Report() {
|
||||
std::stringstream locStream;
|
||||
llvm::SmallString<128> buf;
|
||||
llvm::raw_svector_ostream locStream(buf);
|
||||
locStream << m_function << " [";
|
||||
|
||||
#if defined(_WIN32)
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
|
||||
#define WPI_ERRORS_DEFINE_STRINGS
|
||||
#include "WPIErrors.h"
|
||||
#include "llvm/SmallString.h"
|
||||
#include "llvm/raw_ostream.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
@@ -83,7 +85,8 @@ void ErrorBase::SetImaqError(int success, llvm::StringRef contextMessage,
|
||||
int lineNumber) const {
|
||||
// If there was an error
|
||||
if (success <= 0) {
|
||||
std::stringstream err;
|
||||
llvm::SmallString<128> buf;
|
||||
llvm::raw_svector_ostream err(buf);
|
||||
err << success << ": " << contextMessage;
|
||||
|
||||
// Set the current error information for this object.
|
||||
|
||||
@@ -8,8 +8,9 @@
|
||||
#include "LiveWindow/LiveWindow.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <sstream>
|
||||
|
||||
#include "llvm/SmallString.h"
|
||||
#include "llvm/raw_ostream.h"
|
||||
#include "networktables/NetworkTable.h"
|
||||
|
||||
using namespace frc;
|
||||
@@ -154,7 +155,8 @@ void LiveWindow::AddActuator(const std::string& subsystem,
|
||||
*/
|
||||
void LiveWindow::AddSensor(std::string type, int channel,
|
||||
LiveWindowSendable* component) {
|
||||
std::ostringstream oss;
|
||||
llvm::SmallString<128> buf;
|
||||
llvm::raw_svector_ostream oss(buf);
|
||||
oss << type << "[" << channel << "]";
|
||||
AddSensor("Ungrouped", oss.str(), component);
|
||||
std::shared_ptr<LiveWindowSendable> component_stl(
|
||||
@@ -169,7 +171,8 @@ void LiveWindow::AddSensor(std::string type, int channel,
|
||||
*/
|
||||
void LiveWindow::AddActuator(std::string type, int channel,
|
||||
LiveWindowSendable* component) {
|
||||
std::ostringstream oss;
|
||||
llvm::SmallString<128> buf;
|
||||
llvm::raw_svector_ostream oss(buf);
|
||||
oss << type << "[" << channel << "]";
|
||||
AddActuator("Ungrouped", oss.str(),
|
||||
std::shared_ptr<LiveWindowSendable>(component,
|
||||
@@ -181,7 +184,8 @@ void LiveWindow::AddActuator(std::string type, int channel,
|
||||
*/
|
||||
void LiveWindow::AddActuator(std::string type, int module, int channel,
|
||||
LiveWindowSendable* component) {
|
||||
std::ostringstream oss;
|
||||
llvm::SmallString<128> buf;
|
||||
llvm::raw_svector_ostream oss(buf);
|
||||
oss << type << "[" << module << "," << channel << "]";
|
||||
AddActuator("Ungrouped", oss.str(),
|
||||
std::shared_ptr<LiveWindowSendable>(component,
|
||||
|
||||
Reference in New Issue
Block a user