summaryrefslogtreecommitdiffstats
path: root/qtruby/rubylib/qtruby/marshall.h
diff options
context:
space:
mode:
Diffstat (limited to 'qtruby/rubylib/qtruby/marshall.h')
-rw-r--r--qtruby/rubylib/qtruby/marshall.h46
1 files changed, 46 insertions, 0 deletions
diff --git a/qtruby/rubylib/qtruby/marshall.h b/qtruby/rubylib/qtruby/marshall.h
new file mode 100644
index 00000000..cf20b86d
--- /dev/null
+++ b/qtruby/rubylib/qtruby/marshall.h
@@ -0,0 +1,46 @@
+#ifndef MARSHALL_H
+#define MARSHALL_H
+
+#include <smoke.h>
+#include <ruby.h>
+
+class SmokeType;
+
+class Marshall {
+public:
+ /**
+ * FromVALUE is used for virtual function return values and regular
+ * method arguments.
+ *
+ * ToVALUE is used for method return-values and virtual function
+ * arguments.
+ */
+ typedef void (*HandlerFn)(Marshall *);
+ enum Action { FromVALUE, ToVALUE };
+ virtual SmokeType type() = 0;
+ virtual Action action() = 0;
+ virtual Smoke::StackItem &item() = 0;
+ virtual VALUE * var() = 0;
+ virtual void unsupported() = 0;
+ virtual Smoke *smoke() = 0;
+ /**
+ * For return-values, next() does nothing.
+ * For FromRV, next() calls the method and returns.
+ * For ToRV, next() calls the virtual function and returns.
+ *
+ * Required to reset Marshall object to the state it was
+ * before being called when it returns.
+ */
+ virtual void next() = 0;
+ /**
+ * For FromSV, cleanup() returns false when the handler should free
+ * any allocated memory after next().
+ *
+ * For ToSV, cleanup() returns true when the handler should delete
+ * the pointer passed to it.
+ */
+ virtual bool cleanup() = 0;
+
+ virtual ~Marshall() {}
+};
+#endif