diff --git a/src/app/puzzle/xml/vplayoutfilewriter.h b/src/app/puzzle/xml/vplayoutfilewriter.h index 287e6997e..04cb8e323 100644 --- a/src/app/puzzle/xml/vplayoutfilewriter.h +++ b/src/app/puzzle/xml/vplayoutfilewriter.h @@ -68,6 +68,10 @@ private: template void SetAttribute(const QString &name, const char (&value)[N]); + + template + void SetAttributeOrRemoveIf(const QString &name, const T &value, + const std::function &removeCondition); }; //--------------------------------------------------------------------------------------------------------------------- @@ -107,4 +111,15 @@ inline void VPLayoutFileWriter::SetAttribute(const QString &name, const char (&v writeAttribute(name, QString(value)); } +//--------------------------------------------------------------------------------------------------------------------- +template +inline void VPLayoutFileWriter::SetAttributeOrRemoveIf(const QString &name, const T &value, + const std::function &removeCondition) +{ + if (not removeCondition(value)) + { + SetAttribute(name, value); + } +} + #endif // VPLAYOUTFILEWRITER_H