aboutsummaryrefslogtreecommitdiff
path: root/model.h
diff options
context:
space:
mode:
authorTeddy <ted.sybil@gmail.com>2013-08-05 23:31:48 +0800
committerTeddy <ted.sybil@gmail.com>2013-08-05 23:31:48 +0800
commit2ec8f26f31d13bf3c3bbda24ea5e1cace6a819a2 (patch)
treef623aaa220efa2993161997729dce9ff03d936ad /model.h
parent5dab7df6830018c5c28ebcc7cc3b242ccad2736b (diff)
added support for string
Diffstat (limited to 'model.h')
-rw-r--r--model.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/model.h b/model.h
index d402b2b..f883032 100644
--- a/model.h
+++ b/model.h
@@ -259,6 +259,10 @@ class BoolObj: public EvalObj {
BoolObj(bool); /**< Converts a C bool value to a BoolObj*/
bool is_true(); /**< Override EvalObj `is_true()` */
string ext_repr();
+ /** Try to construct an BoolObj object
+ * @return NULL if failed
+ */
+ static BoolObj *from_string(string repr);
};
/** @class NumObj
@@ -290,6 +294,23 @@ class NumObj: public EvalObj {
virtual bool eq(NumObj *r) = 0;
};
+/** @class StrObj
+ * String support
+ */
+class StrObj: public EvalObj {
+ public:
+ string str;
+
+ /** Construct a string object */
+ StrObj(string str);
+ /** Try to construct an StrObj object
+ * @return NULL if failed
+ */
+ static StrObj *from_string(string repr);
+ string ext_repr();
+};
+
+
typedef map<string, EvalObj*> Str2EvalObj;
/** @class Environment
* The environment of current evaluation, i.e. the local variable binding