Rename indentBlock to indent.
No reason to add "block" to the name.
Test: compiles
Change-Id: I8a930cb8d9bb7d03d302c0b9c308ab6d40045260
diff --git a/CompoundType.cpp b/CompoundType.cpp
index a07882d..92748a6 100644
--- a/CompoundType.cpp
+++ b/CompoundType.cpp
@@ -132,7 +132,7 @@
<< name
<< " == nullptr) {\n";
- out.indentBlock([&]{
+ out.indent([&]{
out << "_hidl_err = ::android::UNKNOWN_ERROR;\n";
handleError2(out, mode);
});
@@ -306,7 +306,7 @@
out << "writeEmbeddedReferenceToParcel(\n";
}
- out.indentBlock(2, [&]{
+ out.indent(2, [&]{
if (isReader) {
out << "const_cast<"
<< fullName()
diff --git a/EnumType.cpp b/EnumType.cpp
index 706fefb..f7a5e49 100644
--- a/EnumType.cpp
+++ b/EnumType.cpp
@@ -207,7 +207,7 @@
<< (rhsIsEnum ? fullName() : storageType)
<< " rhs) {\n";
- out.indentBlock([&] {
+ out.indent([&] {
out << "return static_cast<"
<< storageType
<< ">(";
@@ -244,7 +244,7 @@
out << "constexpr " << storageType << " &operator" << op << "=("
<< storageType << "& v, const " << fullName() << " e) {\n";
- out.indentBlock([&] {
+ out.indent([&] {
out << "v " << op << "= static_cast<" << storageType << ">(e);\n";
out << "return v;\n";
});
diff --git a/Interface.cpp b/Interface.cpp
index 4117177..9276839 100644
--- a/Interface.cpp
+++ b/Interface.cpp
@@ -314,7 +314,7 @@
out.indent();
out << "::android::sp<::android::hardware::IBinder> _hidl_binder = "
<< "::android::hardware::toBinder<\n";
- out.indentBlock(2, [&] {
+ out.indent(2, [&] {
out << fqName().cppName()
<< ", "
<< getProxyName().cppName()
@@ -323,13 +323,13 @@
<< ");\n";
});
out << "if (_hidl_binder.get() != nullptr) {\n";
- out.indentBlock([&] {
+ out.indent([&] {
out << "_hidl_err = "
<< parcelObjDeref
<< "writeStrongBinder(_hidl_binder);\n";
});
out << "} else {\n";
- out.indentBlock([&] {
+ out.indent([&] {
out << "_hidl_err = ::android::UNKNOWN_ERROR;\n";
});
out << "}\n";
diff --git a/generateCpp.cpp b/generateCpp.cpp
index ad56735..0ef61e1 100644
--- a/generateCpp.cpp
+++ b/generateCpp.cpp
@@ -785,13 +785,13 @@
out << "int I"
<< iface->getBaseName()
<< "::hidlStaticBlock = []() -> int {\n";
- out.indentBlock([&] {
+ out.indent([&] {
out << "::android::hardware::gBnConstructorMap[I"
<< iface->getBaseName()
<< "::descriptor]\n";
- out.indentBlock(2, [&] {
+ out.indent(2, [&] {
out << "= [](void *iIntf) -> ::android::sp<::android::hardware::IBinder> {\n";
- out.indentBlock([&] {
+ out.indent([&] {
out << "return new Bn"
<< iface->getBaseName()
<< "(reinterpret_cast<I"
@@ -1620,7 +1620,7 @@
<< "\"), mImpl(impl) {";
if (iface->hasOnewayMethods()) {
out << "\n";
- out.indentBlock([&] {
+ out.indent([&] {
out << "mOnewayQueue.setLimit(3000 /* similar limit to binderized */);\n";
});
}
diff --git a/main.cpp b/main.cpp
index b7cf4fd..39d0b5a 100644
--- a/main.cpp
+++ b/main.cpp
@@ -807,11 +807,11 @@
Formatter out(file);
out << "cc_library_shared {\n";
- out.indentBlock([&] {
+ out.indent([&] {
out << "name: \"" << libraryName << "\",\n"
<< "relative_install_path: \"hw\",\n"
<< "srcs: [\n";
- out.indentBlock([&] {
+ out.indent([&] {
for (const auto &fqName : packageInterfaces) {
if (fqName.name() == "types") {
continue;
@@ -821,7 +821,7 @@
});
out << "],\n"
<< "shared_libs: [\n";
- out.indentBlock([&] {
+ out.indent([&] {
out << "\"libhidlbase\",\n"
<< "\"libhidltransport\",\n"
<< "\"libhwbinder\",\n"
diff --git a/utils/Formatter.cpp b/utils/Formatter.cpp
index 4aab8a5..404c0c6 100644
--- a/utils/Formatter.cpp
+++ b/utils/Formatter.cpp
@@ -42,14 +42,14 @@
mIndentDepth -= level;
}
-void Formatter::indentBlock(size_t level, std::function<void(void)> func) {
+void Formatter::indent(size_t level, std::function<void(void)> func) {
this->indent(level);
func();
this->unindent(level);
}
-void Formatter::indentBlock(std::function<void(void)> func) {
- this->indentBlock(1, func);
+void Formatter::indent(std::function<void(void)> func) {
+ this->indent(1, func);
}
void Formatter::setLinePrefix(const std::string &prefix) {
diff --git a/utils/include/hidl-util/Formatter.h b/utils/include/hidl-util/Formatter.h
index 1e7e03b..6264159 100644
--- a/utils/include/hidl-util/Formatter.h
+++ b/utils/include/hidl-util/Formatter.h
@@ -32,14 +32,14 @@
void indent(size_t level = 1);
void unindent(size_t level = 1);
- // out.indentBlock(2, [&] {
+ // out.indent(2, [&] {
// out << "Meow\n";
// });
- void indentBlock(size_t level, std::function<void(void)> func);
- // out.indentBlock([&] {
+ void indent(size_t level, std::function<void(void)> func);
+ // out.indent([&] {
// out << "Meow\n";
// });
- void indentBlock(std::function<void(void)> func);
+ void indent(std::function<void(void)> func);
Formatter &operator<<(const std::string &out);
Formatter &operator<<(size_t n);