Add 'type' to MetaData

This commit is contained in:
Paddle
2023-07-30 07:12:57 +02:00
committed by Chris Hennes
parent ed7427330e
commit 5cd2fa71da
2 changed files with 17 additions and 0 deletions

View File

@@ -172,6 +172,11 @@ std::string Metadata::name() const
return _name;
}
std::string Metadata::type() const
{
return _type;
}
Meta::Version Metadata::version() const
{
return _version;
@@ -291,6 +296,11 @@ void Metadata::setName(const std::string& name)
_name = name;
}
void Metadata::setType(const std::string& type)
{
_type = type;
}
void Metadata::setVersion(const Meta::Version& version)
{
_version = version;
@@ -726,6 +736,7 @@ bool Metadata::supportsCurrentFreeCAD() const
void Metadata::appendToElement(DOMElement* root) const
{
appendSimpleXMLNode(root, "name", _name);
appendSimpleXMLNode(root, "type", _type);
appendSimpleXMLNode(root, "description", _description);
if (_version != Meta::Version()) {
// Only append version if it's not 0.0.0
@@ -864,6 +875,9 @@ void Metadata::parseVersion1(const DOMNode* startNode)
if (tagString == "name") {
_name = StrXUTF8(element->getTextContent()).str;
}
else if (tagString == "type") {
_type = StrXUTF8(element->getTextContent()).str;
}
else if (tagString == "version") {
_version = Meta::Version(StrXUTF8(element->getTextContent()).str);
}

View File

@@ -219,6 +219,7 @@ public:
//////////////////////////////////////////////////////////////
std::string name() const; //< A short name for this package, often used as a menu entry.
std::string type() const; //< The type for this package.
Meta::Version version() const;//< Version string in semantic triplet format, e.g. "1.2.3".
std::string date()
const;//< Date string -- currently arbitrary (when C++20 is well-supported we can revisit)
@@ -285,6 +286,7 @@ public:
// Setters
void setName(const std::string& name);
void setType(const std::string& type);
void setVersion(const Meta::Version& version);
void setDate(const std::string& date);
void setDescription(const std::string& description);
@@ -348,6 +350,7 @@ public:
private:
std::string _name;
std::string _type;
Meta::Version _version;
std::string _date;
std::string _description;