summaryrefslogtreecommitdiff
path: root/src/cat/TPTSTypes.h
diff options
context:
space:
mode:
authorSimon Robertshaw <simon@hardwired.org.uk>2012-02-05 16:37:36 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2012-02-05 16:37:36 (GMT)
commit7ae5eaab79a41f31b633ca6f1bfb0dbae2fccb90 (patch)
treeb76fc14cca5e19c5482209f34131973ad1f80e6a /src/cat/TPTSTypes.h
parent8024caec55ff1b93eefe50663d4ddf63934f8d63 (diff)
downloadpowder-7ae5eaab79a41f31b633ca6f1bfb0dbae2fccb90.zip
powder-7ae5eaab79a41f31b633ca6f1bfb0dbae2fccb90.tar.gz
Started intrepreter for tpt script and various things for console
Diffstat (limited to 'src/cat/TPTSTypes.h')
-rw-r--r--src/cat/TPTSTypes.h80
1 files changed, 80 insertions, 0 deletions
diff --git a/src/cat/TPTSTypes.h b/src/cat/TPTSTypes.h
new file mode 100644
index 0000000..ad08f0b
--- /dev/null
+++ b/src/cat/TPTSTypes.h
@@ -0,0 +1,80 @@
+/*
+ * TPTSTypes.h
+ *
+ * Created on: Feb 4, 2012
+ * Author: Simon
+ */
+
+#ifndef TPTSTYPES_H_
+#define TPTSTYPES_H_
+
+#include <string>
+#include "interface/Point.h"
+
+enum ValueType { TypeNumber, TypePoint, TypeString, TypeNull, TypeFunction };
+
+class GeneralException
+{
+protected:
+ std::string exception;
+public:
+ GeneralException(std::string message){
+ exception = message;
+ }
+ std::string GetExceptionMessage() {
+ return exception;
+ }
+};
+
+class InvalidConversionException: public GeneralException
+{
+private:
+ ValueType from;
+ ValueType to;
+public:
+ InvalidConversionException(ValueType from_, ValueType to_): GeneralException("Invalid conversion"), from(from_), to(to_) {
+ }
+};
+
+class NumberType;
+class StringType;
+class PointType;
+
+class AnyType
+{
+protected:
+ ValueType type;
+ void * value;
+public:
+ AnyType(ValueType type_, void * value_);
+ AnyType(const AnyType & v);
+ operator NumberType();
+ operator StringType();
+ operator PointType();
+ ValueType GetType();
+ ~AnyType();
+};
+
+class NumberType: public AnyType
+{
+public:
+ NumberType(int number);
+ int Value();
+};
+
+class StringType: public AnyType
+{
+public:
+ StringType(std::string string);
+ std::string Value();
+};
+
+class PointType: public AnyType
+{
+public:
+ PointType(ui::Point point);
+ PointType(int pointX, int pointY);
+ ui::Point Value();
+};
+
+#endif /* TPTSTYPES_H_ */