summaryrefslogtreecommitdiffstats
path: root/katomic/atom.h
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commitc90c389a8a8d9d8661e9772ec4144c5cf2039f23 (patch)
tree6d8391395bce9eaea4ad78958617edb20c6a7573 /katomic/atom.h
downloadtdegames-c90c389a8a8d9d8661e9772ec4144c5cf2039f23.tar.gz
tdegames-c90c389a8a8d9d8661e9772ec4144c5cf2039f23.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdegames@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'katomic/atom.h')
-rw-r--r--katomic/atom.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/katomic/atom.h b/katomic/atom.h
new file mode 100644
index 00000000..19d9b087
--- /dev/null
+++ b/katomic/atom.h
@@ -0,0 +1,35 @@
+#ifndef ATOM_H
+#define ATOM_H
+
+#define MAX_CONNS_PER_ATOM 8
+
+class atom {
+ public:
+ char obj;
+ char conn[MAX_CONNS_PER_ATOM + 1];
+
+ bool operator==(const atom& rhs) const { return (rhs.obj == obj && !strcmp(rhs.conn,conn)); }
+ bool isEmpty() const { return (obj == 0 || obj == '.'); }
+};
+
+inline char int2atom(int i) {
+ if (!i)
+ return '.';
+ if (i == 254)
+ return '#';
+ if (i <= 9)
+ return i + '0';
+ return i + 'a' - 10;
+}
+
+inline int atom2int(char ch) {
+ if (ch == '.' || ch == 0)
+ return 0;
+ if (ch == '#')
+ return 254;
+ if (ch >= '0' && ch <= '9')
+ return ch - '0';
+ return ch - 'a' + 10;
+}
+
+#endif