summaryrefslogtreecommitdiffstats
path: root/src/Term.vala
diff options
context:
space:
mode:
Diffstat (limited to 'src/Term.vala')
-rw-r--r--src/Term.vala71
1 files changed, 71 insertions, 0 deletions
diff --git a/src/Term.vala b/src/Term.vala
new file mode 100644
index 0000000..2a9cca8
--- /dev/null
+++ b/src/Term.vala
@@ -0,0 +1,71 @@
+namespace Eva {
+ public interface Term : Object {
+ public abstract string to_string();
+
+ public abstract void encode(Erl.Buffer buffer);
+ }
+
+ public class Long : Object, Term {
+ public long value {get; construct;}
+
+ public Long(long v) {
+ Object(value: v);
+ }
+
+ public string to_string() {
+ return value.to_string();
+ }
+
+ public void encode(Erl.Buffer buffer) {
+ buffer.encode_long(value);
+ }
+ }
+
+ public class ULong : Object, Term {
+ public ulong value {get; construct;}
+
+ public ULong(ulong v) {
+ Object(value: v);
+ }
+
+ public string to_string() {
+ return value.to_string();
+ }
+
+ public void encode(Erl.Buffer buffer) {
+ buffer.encode_ulong(value);
+ }
+ }
+
+ public class Double : Object, Term {
+ public double value {get; construct;}
+
+ public Double(double v) {
+ Object(value: v);
+ }
+
+ public string to_string() {
+ return value.to_string();
+ }
+
+ public void encode(Erl.Buffer buffer) {
+ buffer.encode_double(value);
+ }
+ }
+
+ public class Atom : Object, Term {
+ public string value {get; construct;}
+
+ public Atom(string v) {
+ Object(value: v);
+ }
+
+ public string to_string() {
+ return value.to_string();
+ }
+
+ public void encode(Erl.Buffer buffer) {
+ buffer.encode_atom(value.to_utf8());
+ }
+ }
+}