MCPcopy Create free account
hub / github.com/andreasfertig/cppinsights / RemoveIndent

Method RemoveIndent

OutputFormatHelper.cpp:72–86  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

70//-----------------------------------------------------------------------------
71
72void OutputFormatHelper::RemoveIndent()
73{
74 /* After a newline we are already indented by one level to much. Try to decrease it. */
75 if(0 != mDefaultIndent) {
76 // go the string backwards and find the first non-whitespace character
77 const auto res = std::find_if(
78 std::rbegin(mOutput), std::rbegin(mOutput) + SCOPE_INDENT, [](const char& c) { return ' ' != c; });
79
80 // check if the string did end with at least one whitespace
81 if(const auto& end = std::rbegin(mOutput); res != end) {
82 // remove the whitespaces at the end of the string
83 mOutput.resize(mOutput.size() - std::distance(end, res));
84 }
85 }
86}
87//-----------------------------------------------------------------------------
88
89} // namespace clang::insights

Callers

nothing calls this directly

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected