Emit toString functions for all types.
* toString() is mainly for debugging purposes only.
* For HIDL internal types (hidl_string, hidl_vec, etc.)
toString() is found in ::android::hardware::details.
* For a user defined type
android.hardware.foo@1.0::IFoo.Type,
toString() is found in ::android::hardware::foo::V1_0.
* For bitfield<::anroid::hardware::foo::V1_0::T>
that gets translated to the underlying
numeric type of T, it doesn't make sense to override toString().
A templated toString() function for each user-defined HIDL enum \
is introduced into the same namespace; call it with
using namespace ::android::hardware::foo::V1_0;
toString<IFoo::MyEnumType>(value);
Test: hidl_test and look at the output of logcat
Bug: 33459772
Change-Id: I70eee018e31d700bf1376334276dbd343af5615f
diff --git a/ScalarType.cpp b/ScalarType.cpp
index fbd127c..9b6c0c3 100644
--- a/ScalarType.cpp
+++ b/ScalarType.cpp
@@ -211,6 +211,13 @@
handleError(out, mode);
}
+void ScalarType::emitHexDump(
+ Formatter &out,
+ const std::string &streamName,
+ const std::string &name) const {
+ out << streamName << " += toHexString(" << name << ");\n";
+}
+
void ScalarType::emitJavaFieldReaderWriter(
Formatter &out,
size_t /* depth */,