Add method SetAttributeOrRemoveIf for VPLayoutFileWriter class.
This commit is contained in:
parent
66283709d1
commit
320ac40056
|
@ -68,6 +68,10 @@ private:
|
||||||
|
|
||||||
template <size_t N>
|
template <size_t N>
|
||||||
void SetAttribute(const QString &name, const char (&value)[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));
|
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
|
#endif // VPLAYOUTFILEWRITER_H
|
||||||
|
|
Loading…
Reference in New Issue
Block a user