clang-tidy fixes: std::endl -> '\n'

This commit is contained in:
Robert Haschke 2024-12-21 22:40:04 +01:00
parent 45ea86c163
commit 8c0609a711
14 changed files with 23 additions and 23 deletions

View File

@ -62,24 +62,24 @@ printChildrenInterfaces(const ContainerBasePrivate& container, bool success, con
std::ostream& os = std::cerr) { std::ostream& os = std::cerr) {
static unsigned int id = 0; static unsigned int id = 0;
const unsigned int width = 10; // indentation of name const unsigned int width = 10; // indentation of name
os << std::endl << (success ? '+' : '-') << ' ' << creator.name() << ' '; os << '\n' << (success ? '+' : '-') << ' ' << creator.name() << ' ';
if (success) if (success)
os << ++id << ' '; os << ++id << ' ';
if (const auto conn = dynamic_cast<const ConnectingPrivate*>(creator.pimpl())) if (const auto conn = dynamic_cast<const ConnectingPrivate*>(creator.pimpl()))
os << conn->pendingPairsPrinter(); os << conn->pendingPairsPrinter();
os << std::endl; os << '\n';
for (const auto& child : container.children()) { for (const auto& child : container.children()) {
auto cimpl = child->pimpl(); auto cimpl = child->pimpl();
os << std::setw(width) << std::left << child->name(); os << std::setw(width) << std::left << child->name();
if (!cimpl->starts() && !cimpl->ends()) if (!cimpl->starts() && !cimpl->ends())
os << "" << std::endl; os << "\n";
if (cimpl->starts()) if (cimpl->starts())
os << "" << *child->pimpl()->starts() << std::endl; os << "" << *child->pimpl()->starts() << '\n';
if (cimpl->starts() && cimpl->ends()) if (cimpl->starts() && cimpl->ends())
os << std::setw(width) << " "; os << std::setw(width) << " ";
if (cimpl->ends()) if (cimpl->ends())
os << "" << *child->pimpl()->ends() << std::endl; os << "" << *child->pimpl()->ends() << '\n';
} }
} }
@ -459,7 +459,7 @@ void ContainerBase::explainFailure(std::ostream& os) const {
if (stage->numFailures()) { if (stage->numFailures()) {
os << stage->name() << " (0/" << stage->numFailures() << ")"; os << stage->name() << " (0/" << stage->numFailures() << ")";
stage->explainFailure(os); stage->explainFailure(os);
os << std::endl; os << '\n';
break; break;
} }
stage->explainFailure(os); // recursively process children stage->explainFailure(os); // recursively process children
@ -468,7 +468,7 @@ void ContainerBase::explainFailure(std::ostream& os) const {
std::ostream& operator<<(std::ostream& os, const ContainerBase& container) { std::ostream& operator<<(std::ostream& os, const ContainerBase& container) {
ContainerBase::StageCallback processor = [&os](const Stage& stage, unsigned int depth) -> bool { ContainerBase::StageCallback processor = [&os](const Stage& stage, unsigned int depth) -> bool {
os << std::string(2 * depth, ' ') << *stage.pimpl() << std::endl; os << std::string(2 * depth, ' ') << *stage.pimpl() << '\n';
return true; return true;
}; };
container.traverseRecursively(processor); container.traverseRecursively(processor);

View File

@ -171,7 +171,7 @@ void Introspection::publishAllSolutions(bool wait) {
publishSolution(*solution); publishSolution(*solution);
if (wait) { if (wait) {
std::cout << "Press <Enter> to continue ..." << std::endl; std::cout << "Press <Enter> to continue ...\n";
int ch = getchar(); int ch = getchar();
if (ch == 'q' || ch == 'Q') if (ch == 'q' || ch == 'Q')
break; break;

View File

@ -90,9 +90,9 @@ const char* InitStageException::what() const noexcept {
} }
std::ostream& operator<<(std::ostream& os, const InitStageException& e) { std::ostream& operator<<(std::ostream& os, const InitStageException& e) {
os << "Error initializing stage" << (e.errors_.size() > 1 ? "s" : "") << ":" << std::endl; os << "Error initializing stage" << (e.errors_.size() > 1 ? "s" : "") << ":\n ";
for (const auto& pair : e.errors_) for (const auto& pair : e.errors_)
os << pair.first->name() << ": " << pair.second << std::endl; os << pair.first->name() << ": " << pair.second << '\n';
return os; return os;
} }
@ -840,10 +840,10 @@ void ConnectingPrivate::newState(Interface::iterator it, Interface::UpdateFlags
os << (updated ? " !" : " +"); os << (updated ? " !" : " +");
else else
os << " "; os << " ";
os << d << " " << this->pullInterface(d) << ": " << *this->pullInterface(d) << std::endl; os << d << " " << this->pullInterface(d) << ": " << *this->pullInterface(d) << '\n';
} }
os << std::setw(15) << " "; os << std::setw(15) << " ";
os << pendingPairsPrinter() << std::endl; os << pendingPairsPrinter() << '\n';
#endif #endif
} }

View File

@ -179,7 +179,7 @@ TEST(PA10, pick) {
try { try {
t.plan(); t.plan();
} catch (const InitStageException& e) { } catch (const InitStageException& e) {
ADD_FAILURE() << "planning failed with exception" << std::endl << e << t; ADD_FAILURE() << "planning failed with exception\n" << e << t;
} }
auto solutions = t.solutions().size(); auto solutions = t.solutions().size();

View File

@ -77,7 +77,7 @@ TEST(PR2, pick) {
spawnObject(); spawnObject();
t.plan(); t.plan();
} catch (const InitStageException& e) { } catch (const InitStageException& e) {
ADD_FAILURE() << "planning failed with exception" << std::endl << e << t; ADD_FAILURE() << "planning failed with exception\n" << e << t;
} }
auto solutions = t.solutions().size(); auto solutions = t.solutions().size();

View File

@ -79,7 +79,7 @@ TEST(UR5, pick) {
spawnObject(); spawnObject();
t.plan(); t.plan();
} catch (const InitStageException& e) { } catch (const InitStageException& e) {
ADD_FAILURE() << "planning failed with exception" << std::endl << e << t; ADD_FAILURE() << "planning failed with exception\n" << e << t;
} }
auto solutions = t.solutions().size(); auto solutions = t.solutions().size();

View File

@ -625,7 +625,7 @@ TEST(Task, reuse) {
configure(t); configure(t);
EXPECT_TRUE(t.plan(1)); EXPECT_TRUE(t.plan(1));
} catch (const InitStageException& e) { } catch (const InitStageException& e) {
ADD_FAILURE() << "InitStageException:" << std::endl << e << t; ADD_FAILURE() << "InitStageException:\n" << e << t;
} }
} }

View File

@ -126,7 +126,7 @@ TYPED_TEST(OrderedTest, sorting) {
template <typename ValueType, typename CostType> template <typename ValueType, typename CostType>
std::ostream& operator<<(std::ostream& os, const cost_ordered<ValueType, CostType>& queue) { std::ostream& operator<<(std::ostream& os, const cost_ordered<ValueType, CostType>& queue) {
for (const auto& pair : queue.sorted()) for (const auto& pair : queue.sorted())
os << pair.cost() << ": " << pair.value() << std::endl; os << pair.cost() << ": " << pair.value() << '\n';
return os; return os;
} }

View File

@ -201,7 +201,7 @@ TEST(Task, taskMoveConstructor) {
t.init(); t.init();
EXPECT_TRUE(t.plan(1)); EXPECT_TRUE(t.plan(1));
} catch (const InitStageException& e) { } catch (const InitStageException& e) {
ADD_FAILURE() << "InitStageException:" << std::endl << e << t; ADD_FAILURE() << "InitStageException:\n" << e << t;
} }
} }

View File

@ -73,7 +73,7 @@ int main(int argc, char** argv) {
try { try {
t.plan(0); t.plan(0);
} catch (const InitStageException& e) { } catch (const InitStageException& e) {
std::cout << e << std::endl; std::cout << e << '\n';
} }
ros::spin(); ros::spin();

View File

@ -142,7 +142,7 @@ int main(int argc, char** argv) {
if (task.plan()) if (task.plan())
task.introspection().publishSolution(*task.solutions().front()); task.introspection().publishSolution(*task.solutions().front());
} catch (const InitStageException& ex) { } catch (const InitStageException& ex) {
std::cerr << "planning failed with exception" << std::endl << ex << task; std::cerr << "planning failed with exception\n" << ex << task;
} }
ros::waitForShutdown(); // keep alive for interactive inspection in rviz ros::waitForShutdown(); // keep alive for interactive inspection in rviz

View File

@ -123,7 +123,7 @@ int main(int argc, char** argv) {
try { try {
t.plan(); t.plan();
} catch (const InitStageException& e) { } catch (const InitStageException& e) {
std::cout << e << std::endl; std::cout << e << '\n';
} }
ros::waitForShutdown(); ros::waitForShutdown();

View File

@ -68,7 +68,7 @@ int main(int argc, char** argv) {
try { try {
t.plan(0); t.plan(0);
} catch (const InitStageException& e) { } catch (const InitStageException& e) {
std::cout << e << std::endl; std::cout << e << '\n';
} }
ros::waitForShutdown(); ros::waitForShutdown();

View File

@ -121,7 +121,7 @@ int main(int argc, char** argv) {
if (task.plan()) if (task.plan())
task.introspection().publishSolution(*task.solutions().front()); task.introspection().publishSolution(*task.solutions().front());
} catch (const InitStageException& ex) { } catch (const InitStageException& ex) {
std::cerr << "planning failed with exception" << std::endl << ex << task; std::cerr << "planning failed with exception\n" << ex << task;
} }
ros::waitForShutdown(); // keep alive for interactive inspection in rviz ros::waitForShutdown(); // keep alive for interactive inspection in rviz