Add method SetAttributeOrRemoveIf for VPLayoutFileWriter class.

This commit is contained in:
Roman Telezhynskyi 2021-05-26 10:01:50 +03:00
parent 66283709d1
commit 320ac40056

View file

@ -68,6 +68,10 @@ private:
template <size_t N>
void SetAttribute(const QString &name, const char (&value)[N]);
template <typename T>
void SetAttributeOrRemoveIf(const QString &name, const T &value,
const std::function<bool(const T&)> &removeCondition);
};
//---------------------------------------------------------------------------------------------------------------------
@ -107,4 +111,15 @@ inline void VPLayoutFileWriter::SetAttribute(const QString &name, const char (&v
writeAttribute(name, QString(value));
}
//---------------------------------------------------------------------------------------------------------------------
template <typename T>
inline void VPLayoutFileWriter::SetAttributeOrRemoveIf(const QString &name, const T &value,
const std::function<bool(const T&)> &removeCondition)
{
if (not removeCondition(value))
{
SetAttribute(name, value);
}
}
#endif // VPLAYOUTFILEWRITER_H