diff options
author | 2020-11-13 22:14:48 +0000 | |
---|---|---|
committer | 2020-11-13 23:49:57 +0000 | |
commit | ed63f352075bf5826e43796a1ba02d97b1abd95f (patch) | |
tree | 31d44bd99d0bc24d4ffe96259be70a1f259e7664 | |
parent | 05f351cb838fbb8ba85769f9b4d2ca638e0211b9 (diff) |
libbinder: Status s/stringstream/ostream/
stringstream extends ostream, so this is just generally more useful.
I'm tired of having to lookup that I need to use 'Status::toString8' in
order to print it out.
Test: m camera_client_test (uses API, motived last change here)
Test: grep most internal prebuilts for
_ZN7android6binderlsERNSt3__118basic_stringstreamIcNS1_11char_traitsIcEENS1_9allocatorIcEEEERKNS0_6StatusE
Change-Id: I7ed88a3ecf8b560302697e4c5c2357acc05c20fa
-rw-r--r-- | libs/binder/Status.cpp | 5 | ||||
-rw-r--r-- | libs/binder/include/binder/Status.h | 8 |
2 files changed, 5 insertions, 8 deletions
diff --git a/libs/binder/Status.cpp b/libs/binder/Status.cpp index 64ab7a9d14..b5a078c4c0 100644 --- a/libs/binder/Status.cpp +++ b/libs/binder/Status.cpp @@ -245,10 +245,5 @@ String8 Status::toString8() const { return ret; } -std::stringstream& operator<< (std::stringstream& stream, const Status& s) { - stream << s.toString8().string(); - return stream; -} - } // namespace binder } // namespace android diff --git a/libs/binder/include/binder/Status.h b/libs/binder/include/binder/Status.h index 7d889b6b14..c30ae01d60 100644 --- a/libs/binder/include/binder/Status.h +++ b/libs/binder/include/binder/Status.h @@ -18,7 +18,8 @@ #define ANDROID_BINDER_STATUS_H #include <cstdint> -#include <sstream> +#include <sstream> // historical +#include <ostream> #include <binder/Parcel.h> #include <utils/String8.h> @@ -153,8 +154,9 @@ private: String8 mMessage; }; // class Status -// For gtest output logging -std::stringstream& operator<< (std::stringstream& stream, const Status& s); +static inline std::ostream& operator<< (std::ostream& o, const Status& s) { + return o << s.toString8(); +} } // namespace binder } // namespace android |