00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 #ifndef _DATAQUAY_NODE_H_
00035 #define _DATAQUAY_NODE_H_
00036
00037 #include <QString>
00038 #include <QUrl>
00039 #include <QVariant>
00040
00041 class QDataStream;
00042 class QTextStream;
00043
00044 namespace Dataquay
00045 {
00046
00052 class Node
00053 {
00054 public:
00058 enum Type { Nothing, URI, Literal, Blank };
00059
00064 Node() : type(Nothing), value() { }
00065
00079 Node(QUrl u) : type(URI), value(u.toString()) { }
00080
00085 Node(Type t, QString v) : type(t), value(v) { }
00086
00091 Node(Type t, QString v, QString dt) : type(t), value(v), datatype(dt) { }
00092
00093 ~Node() { }
00094
00116 static Node fromVariant(QVariant v);
00117
00128 QVariant toVariant() const;
00129
00130 Type type;
00131 QString value;
00132 QString datatype;
00133 };
00134
00138 typedef QList<Node> Nodes;
00139
00140 bool operator==(const Node &a, const Node &b);
00141 bool operator!=(const Node &a, const Node &b);
00142
00143 QDataStream &operator<<(QDataStream &out, const Node &);
00144 QDataStream &operator>>(QDataStream &in, Node &);
00145
00146 std::ostream &operator<<(std::ostream &out, const Node &);
00147 QTextStream &operator<<(QTextStream &out, const Node &);
00148
00149 }
00150
00151 #endif
00152