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:
Peter Johnson
2021-06-06 16:13:58 -07:00
committed by GitHub
parent 4f1cecb8e7
commit b2c3b2dd8e
441 changed files with 5061 additions and 9749 deletions

View File

@@ -8,6 +8,7 @@
#include <functional>
#include <memory>
#include <string>
#include <string_view>
#include "networktables/NetworkTableValue.h"
@@ -46,7 +47,7 @@ class Message {
// Message data accessors. Callers are responsible for knowing what data is
// actually provided for a particular message.
wpi::StringRef str() const { return m_str; }
std::string_view str() const { return m_str; }
std::shared_ptr<Value> value() const { return m_value; }
unsigned int id() const { return m_id; }
unsigned int flags() const { return m_flags; }
@@ -75,10 +76,10 @@ class Message {
}
// Create messages with data
static std::shared_ptr<Message> ClientHello(wpi::StringRef self_id);
static std::shared_ptr<Message> ClientHello(std::string_view self_id);
static std::shared_ptr<Message> ServerHello(unsigned int flags,
wpi::StringRef self_id);
static std::shared_ptr<Message> EntryAssign(wpi::StringRef name,
std::string_view self_id);
static std::shared_ptr<Message> EntryAssign(std::string_view name,
unsigned int id,
unsigned int seq_num,
std::shared_ptr<Value> value,
@@ -90,9 +91,9 @@ class Message {
unsigned int flags);
static std::shared_ptr<Message> EntryDelete(unsigned int id);
static std::shared_ptr<Message> ExecuteRpc(unsigned int id, unsigned int uid,
wpi::StringRef params);
std::string_view params);
static std::shared_ptr<Message> RpcResponse(unsigned int id, unsigned int uid,
wpi::StringRef result);
std::string_view result);
Message(const Message&) = delete;
Message& operator=(const Message&) = delete;