clang-format: copy latest and re-format
clang-format-16 has some backwards incompatible changes that require
additional settings for best compatibility and re-running the formatter.
Copy the latest .clang-format from the docs repository and reformat the
repository.
Change-Id: I5daa012bf76924eb7a7d22ed31b6b77ad2f723df
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
diff --git a/example/asio-example.cpp b/example/asio-example.cpp
index ee89a2f..906059e 100644
--- a/example/asio-example.cpp
+++ b/example/asio-example.cpp
@@ -217,26 +217,26 @@
iface->register_property("lessThan50", 23,
// custom set
[](const int& req, int& propertyValue) {
- if (req >= 50)
- {
- return false;
- }
- propertyValue = req;
- return true;
- });
+ if (req >= 50)
+ {
+ return false;
+ }
+ propertyValue = req;
+ return true;
+ });
iface->register_property(
"TrailTime", std::string("foo"),
// custom set
[](const std::string& req, std::string& propertyValue) {
- propertyValue = req;
- return true;
+ propertyValue = req;
+ return true;
},
// custom get
[](const std::string& property) {
- auto now = std::chrono::system_clock::now();
- auto timePoint = std::chrono::system_clock::to_time_t(now);
- return property + std::ctime(&timePoint);
- });
+ auto now = std::chrono::system_clock::now();
+ auto timePoint = std::chrono::system_clock::to_time_t(now);
+ return property + std::ctime(&timePoint);
+ });
// test method creation
iface->register_method("TestMethod", [](const int32_t& callCount) {
@@ -250,8 +250,8 @@
// so will be executed in coroutine context if called
iface->register_method("TestYieldFunction",
[conn](boost::asio::yield_context yield, int val) {
- return fooYield(yield, conn, val);
- });
+ return fooYield(yield, conn, val);
+ });
iface->register_method("TestMethodWithMessage", methodWithMessage);
@@ -324,16 +324,16 @@
conn->async_method_call(
[](boost::system::error_code ec, GetSubTreeType& subtree) {
- std::cout << "async_method_call callback\n";
- if (ec)
- {
- std::cerr << "error with async_method_call\n";
- return;
- }
- for (auto& item : subtree)
- {
- std::cout << item.first << "\n";
- }
+ std::cout << "async_method_call callback\n";
+ if (ec)
+ {
+ std::cerr << "error with async_method_call\n";
+ return;
+ }
+ for (auto& item : subtree)
+ {
+ std::cout << item.first << "\n";
+ }
},
"xyz.openbmc_project.ObjectMapper",
"/xyz/openbmc_project/object_mapper",
@@ -345,17 +345,16 @@
[nonConstCapture = std::move(nonConstCapture)](
boost::system::error_code ec,
const std::vector<std::string>& /*things*/) mutable {
- std::cout << "async_method_call callback\n";
- nonConstCapture += " stuff";
- if (ec)
- {
- std::cerr << "async_method_call expected failure: " << ec
- << "\n";
- }
- else
- {
- std::cerr << "async_method_call should have failed!\n";
- }
+ std::cout << "async_method_call callback\n";
+ nonConstCapture += " stuff";
+ if (ec)
+ {
+ std::cerr << "async_method_call expected failure: " << ec << "\n";
+ }
+ else
+ {
+ std::cerr << "async_method_call should have failed!\n";
+ }
},
"xyz.openbmc_project.ObjectMapper",
"/xyz/openbmc_project/object_mapper",
@@ -384,14 +383,14 @@
conn->async_method_call(
[](boost::system::error_code ec, int32_t testValue) {
- if (ec)
- {
- std::cerr << "TestYieldFunction returned error with "
- "async_method_call (ec = "
- << ec << ")\n";
- return;
- }
- std::cout << "TestYieldFunction return " << testValue << "\n";
+ if (ec)
+ {
+ std::cerr << "TestYieldFunction returned error with "
+ "async_method_call (ec = "
+ << ec << ")\n";
+ return;
+ }
+ std::cout << "TestYieldFunction return " << testValue << "\n";
},
"xyz.openbmc_project.asio-test", "/xyz/openbmc_project/test",
"xyz.openbmc_project.test", "TestYieldFunction", int32_t(41));
diff --git a/example/coroutine-example.cpp b/example/coroutine-example.cpp
index b402070..c077acd 100644
--- a/example/coroutine-example.cpp
+++ b/example/coroutine-example.cpp
@@ -32,29 +32,26 @@
for (auto& [property, value] :
co_await systemd.get_all_properties<variant_type>(ctx))
{
- std::cout
- << property << " is "
- << std::visit(
- // Convert the variant member to a string for printing.
- [](auto v) {
- if constexpr (std::is_same_v<
- std::remove_cvref_t<decltype(v)>,
+ std::cout << property << " is "
+ << std::visit(
+ // Convert the variant member to a string for printing.
+ [](auto v) {
+ if constexpr (std::is_same_v<std::remove_cvref_t<decltype(v)>,
std::vector<std::string>>)
- {
- return std::string{"Array"};
- }
- else if constexpr (std::is_same_v<
- std::remove_cvref_t<decltype(v)>,
+ {
+ return std::string{"Array"};
+ }
+ else if constexpr (std::is_same_v<std::remove_cvref_t<decltype(v)>,
std::string>)
- {
- return v;
- }
- else
- {
- return std::to_string(v);
- }
- },
- value)
+ {
+ return v;
+ }
+ else
+ {
+ return std::to_string(v);
+ }
+ },
+ value)
<< std::endl;
}
diff --git a/example/get-all-properties.cpp b/example/get-all-properties.cpp
index 428b322..711dd8b 100644
--- a/example/get-all-properties.cpp
+++ b/example/get-all-properties.cpp
@@ -33,8 +33,8 @@
demo_->register_property_rw<std::string>(
propertyGoodbyesName, sdbusplus::vtable::property_::emits_change,
[this](const auto& newPropertyValue, const auto&) {
- goodbyes_ = newPropertyValue;
- return true;
+ goodbyes_ = newPropertyValue;
+ return true;
},
[this](const auto&) { return goodbyes_; });
@@ -95,7 +95,7 @@
const bool success = sdbusplus::unpackPropertiesNoThrow(
[this](const sdbusplus::UnpackErrorReason reason,
const std::string& property) {
- logUnpackError(reason, property);
+ logUnpackError(reason, property);
},
properties, propertyGrettingName, greetings,
propertyGoodbyesName, goodbyes);
diff --git a/example/register-property.cpp b/example/register-property.cpp
index 3d2e86f..c22231a 100644
--- a/example/register-property.cpp
+++ b/example/register-property.cpp
@@ -24,18 +24,18 @@
demo_ = objServer_.add_unique_interface(
demoObjectPath, demoInterfaceName,
[this](sdbusplus::asio::dbus_interface& demo) {
- demo.register_property_r<std::string>(
- propertyGrettingName, sdbusplus::vtable::property_::const_,
- [this](const auto&) { return greetings_; });
+ demo.register_property_r<std::string>(
+ propertyGrettingName, sdbusplus::vtable::property_::const_,
+ [this](const auto&) { return greetings_; });
- demo.register_property_rw<std::string>(
- propertyGoodbyesName,
- sdbusplus::vtable::property_::emits_change,
- [this](const auto& newPropertyValue, const auto&) {
- goodbyes_ = newPropertyValue;
- return true;
- },
- [this](const auto&) { return goodbyes_; });
+ demo.register_property_rw<std::string>(
+ propertyGoodbyesName,
+ sdbusplus::vtable::property_::emits_change,
+ [this](const auto& newPropertyValue, const auto&) {
+ goodbyes_ = newPropertyValue;
+ return true;
+ },
+ [this](const auto&) { return goodbyes_; });
});
}
@@ -58,17 +58,17 @@
bus_, demoServiceName, demoObjectPath, demoInterfaceName,
propertyGrettingName,
[this](boost::system::error_code ec, uint32_t) {
- if (ec)
- {
- std::cout
- << "As expected failed to getProperty with wrong type: "
- << ec << "\n";
- return;
- }
+ if (ec)
+ {
+ std::cout
+ << "As expected failed to getProperty with wrong type: "
+ << ec << "\n";
+ return;
+ }
- std::cerr << "Error: it was expected to fail getProperty due "
- "to wrong type\n";
- ++fatalErrors_;
+ std::cerr << "Error: it was expected to fail getProperty due "
+ "to wrong type\n";
+ ++fatalErrors_;
});
}
@@ -78,24 +78,24 @@
bus_, demoServiceName, demoObjectPath, demoInterfaceName,
propertyGrettingName,
[this](boost::system::error_code ec, std::string value) {
- if (ec)
- {
- getFailed();
- return;
- }
- std::cout << "Greetings value is: " << value << "\n";
+ if (ec)
+ {
+ getFailed();
+ return;
+ }
+ std::cout << "Greetings value is: " << value << "\n";
});
sdbusplus::asio::getProperty<std::string>(
bus_, demoServiceName, demoObjectPath, demoInterfaceName,
propertyGoodbyesName,
[this](boost::system::error_code ec, std::string value) {
- if (ec)
- {
- getFailed();
- return;
- }
- std::cout << "Goodbyes value is: " << value << "\n";
+ if (ec)
+ {
+ getFailed();
+ return;
+ }
+ std::cout << "Goodbyes value is: " << value << "\n";
});
}
@@ -105,34 +105,31 @@
bus_, demoServiceName, demoObjectPath, demoInterfaceName,
propertyGrettingName, "Hi, hey, hello",
[this](const boost::system::error_code& ec) {
- if (ec)
- {
- std::cout
- << "As expected, failed to set greetings property: "
- << ec << "\n";
- return;
- }
+ if (ec)
+ {
+ std::cout << "As expected, failed to set greetings property: "
+ << ec << "\n";
+ return;
+ }
- std::cout
- << "Error: it was expected to fail to change greetings\n";
- ++fatalErrors_;
+ std::cout << "Error: it was expected to fail to change greetings\n";
+ ++fatalErrors_;
});
sdbusplus::asio::setProperty(
bus_, demoServiceName, demoObjectPath, demoInterfaceName,
propertyGoodbyesName, "Bye bye",
[this](const boost::system::error_code& ec) {
- if (ec)
- {
- std::cout
- << "Error: it supposed to be ok to change goodbyes "
- "property: "
- << ec << "\n";
- ++fatalErrors_;
- return;
- }
- std::cout << "Changed goodbyes property as expected\n";
- boost::asio::post(ioc_, [this] { asyncReadProperties(); });
+ if (ec)
+ {
+ std::cout << "Error: it supposed to be ok to change goodbyes "
+ "property: "
+ << ec << "\n";
+ ++fatalErrors_;
+ return;
+ }
+ std::cout << "Changed goodbyes property as expected\n";
+ boost::asio::post(ioc_, [this] { asyncReadProperties(); });
});
}