mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-30 02:31:44 +00:00
Use StringRef instead of NT_String in various places.
Change-Id: Ibd11e0e1c3157eb8647211797ef8b4aa63f58eb8
This commit is contained in:
@@ -13,6 +13,8 @@
|
||||
|
||||
#include "ntcore.h"
|
||||
|
||||
#include "llvm/StringRef.h"
|
||||
|
||||
namespace ntimpl {
|
||||
|
||||
/* Encodes native data for network transmission.
|
||||
@@ -89,7 +91,10 @@ class WireEncoder {
|
||||
|
||||
void WriteType(NT_Type type);
|
||||
void WriteValue(const NT_Value& value);
|
||||
void WriteString(const NT_String& str);
|
||||
void WriteString(const NT_String& str) {
|
||||
WriteString(llvm::StringRef(str.str, str.len));
|
||||
}
|
||||
void WriteString(llvm::StringRef str);
|
||||
|
||||
/* Utility function to get the written size of a value (without actually
|
||||
* writing it).
|
||||
@@ -99,7 +104,10 @@ class WireEncoder {
|
||||
/* Utility function to get the written size of a string (without actually
|
||||
* writing it).
|
||||
*/
|
||||
std::size_t GetStringSize(const NT_String& str) const;
|
||||
std::size_t GetStringSize(const NT_String& str) const {
|
||||
return GetStringSize(llvm::StringRef(str.str, str.len));
|
||||
}
|
||||
std::size_t GetStringSize(llvm::StringRef str) const;
|
||||
|
||||
WireEncoder(const WireEncoder&) = delete;
|
||||
WireEncoder& operator=(const WireEncoder&) = delete;
|
||||
|
||||
Reference in New Issue
Block a user