Library Editor: Load/save <warn> elements
This commit is contained in:
parent
8db72994fb
commit
e2b859bf42
|
@ -145,11 +145,16 @@ static CppcheckLibraryData::Function loadFunction(QXmlStreamReader &xmlReader, c
|
|||
function.formatstr.secure = xmlReader.attributes().value("secure").toString();
|
||||
} else if (elementName == "arg")
|
||||
function.args.append(loadFunctionArg(xmlReader));
|
||||
else if (elementName == "warn") {
|
||||
function.warn.severity = xmlReader.attributes().value("severity").toString();
|
||||
function.warn.reason = xmlReader.attributes().value("reason").toString();
|
||||
function.warn.alternatives = xmlReader.attributes().value("alternatives").toString();
|
||||
function.warn.msg = xmlReader.readElementText();
|
||||
}
|
||||
}
|
||||
return function;
|
||||
}
|
||||
|
||||
|
||||
static CppcheckLibraryData::MemoryResource loadMemoryResource(QXmlStreamReader &xmlReader)
|
||||
{
|
||||
CppcheckLibraryData::MemoryResource memoryresource;
|
||||
|
@ -329,6 +334,25 @@ static void writeFunction(QXmlStreamWriter &xmlWriter, const CppcheckLibraryData
|
|||
|
||||
xmlWriter.writeEndElement();
|
||||
}
|
||||
|
||||
if (!function.warn.isEmpty()) {
|
||||
xmlWriter.writeStartElement("warn");
|
||||
|
||||
if (!function.warn.severity.isEmpty())
|
||||
xmlWriter.writeAttribute("severity", function.warn.severity);
|
||||
|
||||
if (!function.warn.reason.isEmpty())
|
||||
xmlWriter.writeAttribute("reason", function.warn.reason);
|
||||
|
||||
if (!function.warn.alternatives.isEmpty())
|
||||
xmlWriter.writeAttribute("alternatives", function.warn.alternatives);
|
||||
|
||||
if (!function.warn.msg.isEmpty())
|
||||
xmlWriter.writeCharacters(function.warn.msg);
|
||||
|
||||
xmlWriter.writeEndElement();
|
||||
}
|
||||
|
||||
xmlWriter.writeEndElement();
|
||||
}
|
||||
|
||||
|
|
|
@ -97,6 +97,20 @@ public:
|
|||
QList<struct MinSize> minsizes;
|
||||
};
|
||||
QList<struct Arg> args;
|
||||
|
||||
struct {
|
||||
QString severity;
|
||||
QString reason;
|
||||
QString alternatives;
|
||||
QString msg;
|
||||
|
||||
bool isEmpty() const {
|
||||
return severity.isEmpty() &&
|
||||
reason.isEmpty() &&
|
||||
alternatives.isEmpty() &&
|
||||
msg.isEmpty();
|
||||
}
|
||||
} warn;
|
||||
};
|
||||
|
||||
struct MemoryResource {
|
||||
|
|
Loading…
Reference in New Issue