aboutsummaryrefslogtreecommitdiff
path: root/xmpp-vala/src/module/util.vala
diff options
context:
space:
mode:
authorfiaxh <git@mx.ax.lt>2017-03-11 23:04:58 +0100
committerfiaxh <git@mx.ax.lt>2017-03-11 23:09:57 +0100
commitf40a34bdc1995e656b09cc1252a8dcce685e373f (patch)
treed56684122d0a2f0e13ee9d94e6e8675bae1b4c52 /xmpp-vala/src/module/util.vala
parent0ea4ac7e20674e3e6a8d1b3d4b53702dace72907 (diff)
downloaddino-f40a34bdc1995e656b09cc1252a8dcce685e373f.tar.gz
dino-f40a34bdc1995e656b09cc1252a8dcce685e373f.zip
Use delegates + object storage instead of listener objects
Diffstat (limited to 'xmpp-vala/src/module/util.vala')
-rw-r--r--xmpp-vala/src/module/util.vala40
1 files changed, 40 insertions, 0 deletions
diff --git a/xmpp-vala/src/module/util.vala b/xmpp-vala/src/module/util.vala
index 7051307a..7e1bb2b3 100644
--- a/xmpp-vala/src/module/util.vala
+++ b/xmpp-vala/src/module/util.vala
@@ -18,4 +18,44 @@ namespace Xmpp {
UUID.unparse_upper(rand, str);
return (string) str;
}
+
+ public class Tuple<A,B> : Object {
+ public A a { get; private set; }
+ public B b { get; private set; }
+
+ public Tuple(A a, B b) {
+ this.a = a;
+ this.b = b;
+ }
+
+ public static Tuple<A,B> create<A,B>(A a, B b) {
+ return new Tuple<A,B>(a,b);
+ }
+ }
+
+ public class Triple<A,B,C> : Tuple<A,B> {
+ public C c { get; private set; }
+
+ public Triple(A a, B b, C c) {
+ base(a, b);
+ this.c = c;
+ }
+
+ public static new Triple<A,B,C> create<A,B,C>(A a, B b, C c) {
+ return new Triple<A,B,C>(a, b, c);
+ }
+ }
+
+ public class Quadruple<A,B,C,D> : Triple<A,B,C> {
+ public D d { get; private set; }
+
+ public Quadruple(A a, B b, C c, D d) {
+ base (a, b, c);
+ this.d = d;
+ }
+
+ public static new Quadruple<A,B,C,D> create<A,B,C,D>(A a, B b, C c, D d) {
+ return new Quadruple<A,B,C,D>(a, b, c, d);
+ }
+ }
} \ No newline at end of file