Skip to content

Commit

Permalink
Merge pull request rism-digital#3936 from rettinghaus/develop-inline
Browse files Browse the repository at this point in the history
Use inline
  • Loading branch information
lpugin authored Feb 3, 2025
2 parents f4bf7d9 + 64d68e5 commit fd96914
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 15 deletions.
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

0 comments on commit fd96914

Please sign in to comment.