summaryrefslogtreecommitdiff
path: root/include/binder/TextOutput.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/binder/TextOutput.h')
-rw-r--r--include/binder/TextOutput.h41
1 files changed, 13 insertions, 28 deletions
diff --git a/include/binder/TextOutput.h b/include/binder/TextOutput.h
index 974a194d8c..0e9975a22c 100644
--- a/include/binder/TextOutput.h
+++ b/include/binder/TextOutput.h
@@ -21,6 +21,7 @@
#include <stdint.h>
#include <string.h>
+#include <sstream>
// ---------------------------------------------------------------------------
namespace android {
@@ -66,30 +67,26 @@ TextOutput& endl(TextOutput& to);
TextOutput& indent(TextOutput& to);
TextOutput& dedent(TextOutput& to);
-TextOutput& operator<<(TextOutput& to, const char* str);
-TextOutput& operator<<(TextOutput& to, char); // writes raw character
-TextOutput& operator<<(TextOutput& to, bool);
-TextOutput& operator<<(TextOutput& to, int);
-TextOutput& operator<<(TextOutput& to, long);
-TextOutput& operator<<(TextOutput& to, unsigned int);
-TextOutput& operator<<(TextOutput& to, unsigned long);
-TextOutput& operator<<(TextOutput& to, long long);
-TextOutput& operator<<(TextOutput& to, unsigned long long);
-TextOutput& operator<<(TextOutput& to, float);
-TextOutput& operator<<(TextOutput& to, double);
+template<typename T>
+TextOutput& operator<<(TextOutput& to, const T& val)
+{
+ std::stringstream strbuf;
+ strbuf << val;
+ std::string str = strbuf.str();
+ to.print(str.c_str(), str.size());
+ return to;
+}
+
TextOutput& operator<<(TextOutput& to, TextOutputManipFunc func);
-TextOutput& operator<<(TextOutput& to, const void*);
-TextOutput& operator<<(TextOutput& to, const String8& val);
-TextOutput& operator<<(TextOutput& to, const String16& val);
-class TypeCode
+class TypeCode
{
public:
inline TypeCode(uint32_t code);
inline ~TypeCode();
inline uint32_t typeCode() const;
-
+
private:
uint32_t mCode;
};
@@ -146,18 +143,6 @@ inline TextOutput& dedent(TextOutput& to)
return to;
}
-inline TextOutput& operator<<(TextOutput& to, const char* str)
-{
- to.print(str, strlen(str));
- return to;
-}
-
-inline TextOutput& operator<<(TextOutput& to, char c)
-{
- to.print(&c, 1);
- return to;
-}
-
inline TextOutput& operator<<(TextOutput& to, TextOutputManipFunc func)
{
return (*func)(to);