Skip to content

Commit

Permalink
DPL: use idiomatic C++ to get rid of whitespaces
Browse files Browse the repository at this point in the history
  • Loading branch information
ktf committed May 14, 2024
1 parent 08fd30a commit 2f440e5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 21 deletions.
2 changes: 0 additions & 2 deletions Framework/Core/include/Framework/DataOutputDirector.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@ struct DataOutputDescriptor {
private:
std::string mfilenameBase;
std::string* mfilenameBasePtr = nullptr;

std::string remove_ws(const std::string& s);
};

struct DataOutputDirector {
Expand Down
24 changes: 5 additions & 19 deletions Framework/Core/src/DataOutputDirector.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@

namespace fs = std::filesystem;

namespace o2
{
namespace framework
namespace o2::framework
{
using namespace rapidjson;

Expand All @@ -39,7 +37,7 @@ DataOutputDescriptor::DataOutputDescriptor(std::string inString)
// the 1st part is used to create a DataDescriptorMatcher
// the other parts are used to fill treename, colnames, and filename
// remove all spaces
auto cleanString = remove_ws(inString);
inString.erase(std::remove_if(inString.begin(), inString.end(), isspace), inString.end());

// reset
treename = "";
Expand All @@ -49,8 +47,8 @@ DataOutputDescriptor::DataOutputDescriptor(std::string inString)
// analyze the parts of the input string
static const std::regex delim1(":");
std::sregex_token_iterator end;
std::sregex_token_iterator iter1(cleanString.begin(),
cleanString.end(),
std::sregex_token_iterator iter1(inString.begin(),
inString.end(),
delim1,
-1);

Expand Down Expand Up @@ -134,17 +132,6 @@ void DataOutputDescriptor::printOut()
}
}

std::string DataOutputDescriptor::remove_ws(const std::string& s)
{
std::string s_wns;
for (auto c : s) {
if (!std::isspace(c)) {
s_wns += c;
}
}
return s_wns;
}

DataOutputDirector::DataOutputDirector()
{
mfilenameBase = std::string("");
Expand Down Expand Up @@ -637,5 +624,4 @@ void DataOutputDirector::setMaximumFileSize(float maxfs)
{
mmaxfilesize = maxfs;
}
} // namespace framework
} // namespace o2
} // namespace o2::framework

0 comments on commit 2f440e5

Please sign in to comment.