knowL: Knowledge Libraries
Loading...
Searching...
No Matches
BlankNode.h
1#ifndef _KNOWCORE_RDF_BLANKNODE_H_
2#define _KNOWCORE_RDF_BLANKNODE_H_
3
4#include <QHash>
5#include <QSharedDataPointer>
6
7#include <knowCore/Forward.h>
8#include <knowCore/Formatter.h>
9
10class QUuid;
11
12namespace knowRDF
13{
23 {
24 friend uint qHash(const BlankNode &key, uint seed);
25 friend struct fmt::formatter<BlankNode>;
27 public:
31 BlankNode();
35 BlankNode(const QString& _label);
39 BlankNode(const QUuid& _uuid, const QString& _label = QString());
40 BlankNode(const BlankNode& _rhs);
41 BlankNode& operator=(const BlankNode& _rhs);
42 ~BlankNode();
46 QString label() const;
47 bool operator==(const BlankNode& _rhs) const;
48 bool operator!=(const BlankNode& _rhs) const { return not (*this == _rhs); }
49 bool operator<(const BlankNode& _rhs) const;
50 QUuid uuid() const;
51 private:
52 const void* displayId() const;
53 struct Private;
54 QSharedDataPointer<Private> d;
55 };
56 inline uint qHash(const BlankNode &key, uint seed = 0)
57 {
58 return ::qHash(key.d.constData(), seed);
59 }
60
61 uint qHash(const BlankNode &key, uint seed);
62}
63
64KNOWCORE_CORE_DECLARE_FORMATTER(knowRDF::BlankNode)
65{
66 QString ret;
67 if(p.label().isEmpty())
68 {
69 ret = "EmptyBlankNode";
70 } else {
71 ret = "?" + p.label();
72 }
73 return format_to(ctx.out(), "{}({},{})", ret, p.displayId(), p.uuid());
74}
75
76#include <knowCore/MetaType.h>
77
78KNOWCORE_DECLARE_FULL_METATYPE(knowRDF, BlankNode)
79
80#endif
Definition MetaType.h:314
Definition BlankNode.h:23
QString label() const
Definition BlankNode.cpp:46
BlankNode()
Definition BlankNode.cpp:14