6 template<class P> class property
12 Tree d = t->getProperty(fKey);
13 return d ? (P*)(d->node().getPointer()) : 0;
18 property () : fKey(tree(Node(unique("property_")))) {}
20 property (const char* keyname) : fKey(tree(Node(keyname))) {}
22 void set(Tree t, const P& data)
28 t->setProperty(fKey, tree(Node(new P(data))));
32 bool get(Tree t, P& data)
47 t->clearProperty(fKey);
52 template<> class property<Tree>
58 property () : fKey(tree(Node(unique("property_")))) {}
60 property (const char* keyname) : fKey(tree(Node(keyname))) {}
62 void set(Tree t, Tree data)
64 t->setProperty(fKey, data);
67 bool get(Tree t, Tree& data)
69 Tree d = t->getProperty(fKey);
80 t->clearProperty(fKey);
85 template<> class property<int>
91 property () : fKey(tree(Node(unique("property_")))) {}
93 property (const char* keyname) : fKey(tree(Node(keyname))) {}
95 void set(Tree t, int i)
97 t->setProperty(fKey, tree(Node(i)));
100 bool get(Tree t, int& i)
102 Tree d = t->getProperty(fKey);
104 i = d->node().getInt();
113 t->clearProperty(fKey);
118 template<> class property<double>
124 property () : fKey(tree(Node(unique("property_")))) {}
126 property (const char* keyname) : fKey(tree(Node(keyname))) {}
128 void set(Tree t, double x)
130 t->setProperty(fKey, tree(Node(x)));
133 bool get(Tree t, double& x)
135 Tree d = t->getProperty(fKey);
137 x = d->node().getDouble();
146 t->clearProperty(fKey);