adaptive: replace struct Attribute with class

Attribute is a class not a struct, this fixes the following warning in
a number of places:

  warning: struct 'Attribute' was previously declared as a class;
  this is valid, but may result in linker errors under the Microsoft
  C++ ABI [-Wmismatched-tags]
This commit is contained in:
Marvin Scholz 2024-04-08 17:34:21 +02:00 committed by Steve Lhomme
parent 4615108661
commit c9afd0cfa3
2 changed files with 4 additions and 4 deletions

View File

@ -81,7 +81,7 @@ bool Node::hasAttribute(const std::string& name) const
bool Node::hasAttribute(const std::string& name, const std::string &ns) const
{
auto it = std::find_if(attributes.cbegin(),attributes.cend(),
[name, ns](const struct Attribute &a)
[name, ns](const class Attribute &a)
{return a.name == name && ns == *a.ns;});
return it != attributes.cend();
}
@ -94,7 +94,7 @@ const std::string& Node::getAttributeValue(const std::string& key) const
const std::string& Node::getAttributeValue(const std::string& key, const std::string &ns) const
{
auto it = std::find_if(attributes.cbegin(),attributes.cend(),
[key, ns](const struct Attribute &a)
[key, ns](const class Attribute &a)
{return a.name == key && ns == *a.ns;});
if (it != attributes.cend())
return (*it).value;
@ -103,7 +103,7 @@ const std::string& Node::getAttributeValue(const std::string& key, const std::st
void Node::addAttribute(const std::string& key, Namespaces::Ptr ns, const std::string& value)
{
struct Attribute attr;
class Attribute attr;
attr.name = key;
attr.ns = ns;
attr.value = value;

View File

@ -46,7 +46,7 @@ namespace adaptive
bool matches(const std::string &name, const std::string &ns) const;
};
using Attributes = std::vector<struct Attribute>;
using Attributes = std::vector<class Attribute>;
Node () = delete;
Node(std::unique_ptr<std::string>, Namespaces::Ptr);