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

@@ -9,9 +9,9 @@
#include <functional>
#include <memory>
#include <string_view>
#include "wpi/Signal.h"
#include "wpi/Twine.h"
#include "wpi/uv/Request.h"
namespace wpi::uv {
@@ -105,7 +105,7 @@ inline void GetNameInfo(const std::shared_ptr<Loop>& loop,
* @param flags Optional flags to modify the behavior of `getnameinfo`.
*/
void GetNameInfo4(Loop& loop, const std::shared_ptr<GetNameInfoReq>& req,
const Twine& ip, unsigned int port, int flags = 0);
std::string_view ip, unsigned int port, int flags = 0);
/**
* Asynchronous IPv4 getnameinfo(3). HandleResolvedName() is called on the
@@ -120,7 +120,8 @@ void GetNameInfo4(Loop& loop, const std::shared_ptr<GetNameInfoReq>& req,
*/
inline void GetNameInfo4(const std::shared_ptr<Loop>& loop,
const std::shared_ptr<GetNameInfoReq>& req,
const Twine& ip, unsigned int port, int flags = 0) {
std::string_view ip, unsigned int port,
int flags = 0) {
return GetNameInfo4(*loop, req, ip, port, flags);
}
@@ -136,7 +137,7 @@ inline void GetNameInfo4(const std::shared_ptr<Loop>& loop,
*/
void GetNameInfo4(Loop& loop,
std::function<void(const char*, const char*)> callback,
const Twine& ip, unsigned int port, int flags = 0);
std::string_view ip, unsigned int port, int flags = 0);
/**
* Asynchronous IPv4 getnameinfo(3). The callback is called when the resolution
@@ -151,7 +152,8 @@ void GetNameInfo4(Loop& loop,
*/
inline void GetNameInfo4(const std::shared_ptr<Loop>& loop,
std::function<void(const char*, const char*)> callback,
const Twine& ip, unsigned int port, int flags = 0) {
std::string_view ip, unsigned int port,
int flags = 0) {
return GetNameInfo4(*loop, callback, ip, port, flags);
}
@@ -167,7 +169,7 @@ inline void GetNameInfo4(const std::shared_ptr<Loop>& loop,
* @param flags Optional flags to modify the behavior of `getnameinfo`.
*/
void GetNameInfo6(Loop& loop, const std::shared_ptr<GetNameInfoReq>& req,
const Twine& ip, unsigned int port, int flags = 0);
std::string_view ip, unsigned int port, int flags = 0);
/**
* Asynchronous IPv6 getnameinfo(3). HandleResolvedName() is called on the
@@ -182,7 +184,8 @@ void GetNameInfo6(Loop& loop, const std::shared_ptr<GetNameInfoReq>& req,
*/
inline void GetNameInfo6(const std::shared_ptr<Loop>& loop,
const std::shared_ptr<GetNameInfoReq>& req,
const Twine& ip, unsigned int port, int flags = 0) {
std::string_view ip, unsigned int port,
int flags = 0) {
GetNameInfo6(*loop, req, ip, port, flags);
}
@@ -199,7 +202,7 @@ inline void GetNameInfo6(const std::shared_ptr<Loop>& loop,
*/
void GetNameInfo6(Loop& loop,
std::function<void(const char*, const char*)> callback,
const Twine& ip, unsigned int port, int flags = 0);
std::string_view ip, unsigned int port, int flags = 0);
/**
* Asynchronous IPv6 getnameinfo(3). The callback is called when the resolution
@@ -214,7 +217,8 @@ void GetNameInfo6(Loop& loop,
*/
inline void GetNameInfo6(const std::shared_ptr<Loop>& loop,
std::function<void(const char*, const char*)> callback,
const Twine& ip, unsigned int port, int flags = 0) {
std::string_view ip, unsigned int port,
int flags = 0) {
return GetNameInfo6(*loop, callback, ip, port, flags);
}