String8: operator<<

For parity with String16.

Bug: N/A
Test: N/A
Change-Id: I2d7d207138c96146814da31cf27a49cc310e5362
This commit is contained in:
Steven Moreland 2020-02-25 17:59:34 -08:00
parent 7ef2b1d853
commit b1d3161b7b
2 changed files with 8 additions and 2 deletions

View file

@ -197,7 +197,7 @@ public:
ANDROID_TRIVIAL_MOVE_TRAIT(String16)
static inline std::ostream& operator<<(std::ostream& os, const String16& str) {
os << String8(str).c_str();
os << String8(str);
return os;
}

View file

@ -17,7 +17,8 @@
#ifndef ANDROID_STRING8_H
#define ANDROID_STRING8_H
#include <string> // for std::string
#include <iostream>
#include <string>
#include <utils/Errors.h>
#include <utils/Unicode.h>
@ -241,6 +242,11 @@ private:
// require any change to the underlying SharedBuffer contents or reference count.
ANDROID_TRIVIAL_MOVE_TRAIT(String8)
static inline std::ostream& operator<<(std::ostream& os, const String8& str) {
os << str.c_str();
return os;
}
// ---------------------------------------------------------------------------
// No user servicable parts below.