53 lines
894 B
C++
Raw Permalink Normal View History

2023-02-28 14:50:28 +08:00
#pragma once
#include <QtCore/QString>
#include "Export.hpp"
namespace QtNodes
{
struct NodeDataType
{
QString id;
/**
* \brief
*/
QString name;
friend bool operator<(QtNodes::NodeDataType const& d1,
QtNodes::NodeDataType const& d2)
{
return d1.id < d2.id;
}
friend bool operator==(const QtNodes::NodeDataType& d1,
const QtNodes::NodeDataType& d2) noexcept
{
return d1.id == d2.id;
}
};
/// Class represents data transferred between nodes.
/// @param type is used for comparing the types
/// The actual data is stored in subtypes
class NodeData
{
public:
virtual ~NodeData() = default;
virtual bool sameType(NodeData const& nodeData) const
{
return (this->type().id == nodeData.type().id);
}
/**
* \brief
* \return
*/
virtual NodeDataType type() const = 0;
};
}