diff --git a/libmei/addons/att.cpp b/libmei/addons/att.cpp index 74cb90d94d..aa1db04f77 100644 --- a/libmei/addons/att.cpp +++ b/libmei/addons/att.cpp @@ -158,6 +158,21 @@ data_BULGE Att::StrToBulge(const std::string &value, bool logWarning) const return bulge; } +std::string Att::DegreesToStr(data_DEGREES data) const +{ + return StringFormat("%f", data); +} + +data_DEGREES Att::StrToDegrees(const std::string &value, bool logWarning) const +{ + double degrees = atof(value.c_str()); + if ((degrees > 360.0) || (degrees < -360.0)) { + if (logWarning) LogWarning("Unsupported data.DEGREES '%s'", value.c_str()); + return 0; + } + return degrees; +} + std::string Att::DurationToStr(data_DURATION data) const { std::string value; diff --git a/libmei/addons/att.h b/libmei/addons/att.h index 5b4c696080..bcf7a75ca4 100644 --- a/libmei/addons/att.h +++ b/libmei/addons/att.h @@ -69,6 +69,9 @@ class Att : public AttConverterBase { std::string BulgeToStr(const data_BULGE &data) const; data_BULGE StrToBulge(const std::string &value, bool logWarning = true) const; + std::string DegreesToStr(data_DEGREES data) const; + data_DEGREES StrToDegrees(const std::string &value, bool logWarning = true) const; + std::string DurationToStr(data_DURATION data) const; data_DURATION StrToDuration(const std::string &value, bool = true) const;