Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use inline #3936

Merged
merged 3 commits into from
Feb 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 1 addition & 11 deletions libmei/addons/att.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -644,11 +644,6 @@ data_PERCENT Att::StrToPercent(const std::string &value, bool logWarning) const
return atof(value.substr(0, value.find("%")).c_str());
}

std::string Att::PercentLimitedToStr(data_PERCENT_LIMITED data) const
{
return DblToStr(data) + "%";
}

data_PERCENT_LIMITED Att::StrToPercentLimited(const std::string &value, bool logWarning) const
{
static const std::regex test("[0-9]+(\\.?[0-9]*)?%");
Expand All @@ -659,16 +654,11 @@ data_PERCENT_LIMITED Att::StrToPercentLimited(const std::string &value, bool log
return atof(value.substr(0, value.find("%")).c_str());
}

std::string Att::PercentLimitedSignedToStr(data_PERCENT_LIMITED_SIGNED data) const
{
return DblToStr(data) + "%";
}

data_PERCENT_LIMITED_SIGNED Att::StrToPercentLimitedSigned(const std::string &value, bool logWarning) const
{
static const std::regex test("(+|-)?[0-9]+(\\.?[0-9]*)?%");
if (!std::regex_match(value, test)) {
if (logWarning) LogWarning("Unsupported data.PERCENT.LIMITED.SIGNEd '%s'", value.c_str());
if (logWarning) LogWarning("Unsupported data.PERCENT.LIMITED.SIGNED '%s'", value.c_str());
return 0;
}
return atof(value.substr(0, value.find("%")).c_str());
Expand Down
11 changes: 7 additions & 4 deletions libmei/addons/att.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,11 @@ class Att : public AttConverterBase {
std::string MeasurementsignedToStr(data_MEASUREMENTSIGNED data) const;
data_MEASUREMENTSIGNED StrToMeasurementsigned(const std::string &value, bool logWarning = true) const;

std::string MeasurementunsignedToStr(data_MEASUREMENTUNSIGNED data) const { return MeasurementsignedToStr(data); }
data_MEASUREMENTUNSIGNED StrToMeasurementunsigned(const std::string &value, bool logWarning = true) const
inline std::string MeasurementunsignedToStr(data_MEASUREMENTUNSIGNED data) const
{
return MeasurementsignedToStr(data);
}
inline data_MEASUREMENTUNSIGNED StrToMeasurementunsigned(const std::string &value, bool logWarning = true) const
{
return StrToMeasurementsigned(value, logWarning);
}
Expand Down Expand Up @@ -132,10 +135,10 @@ class Att : public AttConverterBase {
std::string PercentToStr(data_PERCENT data) const;
data_PERCENT StrToPercent(const std::string &value, bool logWarning = true) const;

std::string PercentLimitedToStr(data_PERCENT_LIMITED_SIGNED data) const;
inline std::string PercentLimitedToStr(data_PERCENT_LIMITED_SIGNED data) const { return PercentToStr(data); }
data_PERCENT_LIMITED StrToPercentLimited(const std::string &value, bool logWarning = true) const;

std::string PercentLimitedSignedToStr(data_PERCENT_LIMITED data) const;
inline std::string PercentLimitedSignedToStr(data_PERCENT_LIMITED data) const { return PercentToStr(data); }
data_PERCENT_LIMITED_SIGNED StrToPercentLimitedSigned(const std::string &value, bool logWarning = true) const;

std::string PitchnameToStr(data_PITCHNAME data) const;
Expand Down