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

@@ -23,11 +23,11 @@ std::ostream& operator<<(std::ostream& os, const Base64TestParam& param) {
class Base64Test : public ::testing::TestWithParam<Base64TestParam> {
protected:
StringRef GetPlain() {
std::string_view GetPlain() {
if (GetParam().plain_len < 0) {
return StringRef(GetParam().plain);
return GetParam().plain;
} else {
return StringRef(GetParam().plain, GetParam().plain_len);
return std::string_view(GetParam().plain, GetParam().plain_len);
}
}
};
@@ -51,7 +51,7 @@ TEST_P(Base64Test, EncodeSmallString) {
TEST_P(Base64Test, DecodeStdString) {
std::string s;
StringRef encoded = GetParam().encoded;
std::string_view encoded = GetParam().encoded;
EXPECT_EQ(encoded.size(), Base64Decode(encoded, &s));
ASSERT_EQ(GetPlain(), s);
@@ -62,9 +62,9 @@ TEST_P(Base64Test, DecodeStdString) {
TEST_P(Base64Test, DecodeSmallString) {
SmallString<128> buf;
StringRef encoded = GetParam().encoded;
std::string_view encoded = GetParam().encoded;
size_t len;
StringRef plain = Base64Decode(encoded, &len, buf);
std::string_view plain = Base64Decode(encoded, &len, buf);
EXPECT_EQ(encoded.size(), len);
ASSERT_EQ(GetPlain(), plain);