diff options
author | Teddy <ted.sybil@gmail.com> | 2013-08-05 23:31:48 +0800 |
---|---|---|
committer | Teddy <ted.sybil@gmail.com> | 2013-08-05 23:31:48 +0800 |
commit | 2ec8f26f31d13bf3c3bbda24ea5e1cace6a819a2 (patch) | |
tree | f623aaa220efa2993161997729dce9ff03d936ad /model.h | |
parent | 5dab7df6830018c5c28ebcc7cc3b242ccad2736b (diff) |
added support for string
Diffstat (limited to 'model.h')
-rw-r--r-- | model.h | 21 |
1 files changed, 21 insertions, 0 deletions
@@ -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 |