From 2ec8f26f31d13bf3c3bbda24ea5e1cace6a819a2 Mon Sep 17 00:00:00 2001 From: Teddy Date: Mon, 5 Aug 2013 23:31:48 +0800 Subject: added support for string --- model.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'model.h') 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 Str2EvalObj; /** @class Environment * The environment of current evaluation, i.e. the local variable binding -- cgit v1.2.3