diff options
Diffstat (limited to 'hscript/key.hh')
-rw-r--r-- | hscript/key.hh | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/hscript/key.hh b/hscript/key.hh index 1045592..44cbdf2 100644 --- a/hscript/key.hh +++ b/hscript/key.hh @@ -64,8 +64,8 @@ public: */ class BooleanKey : public Key { protected: - BooleanKey(int _line, bool my_value) : Key(_line), value(my_value) {} bool value; + BooleanKey(int _line, bool my_value) : Key(_line), value(my_value) {} /*! Parse a string into a boolean. * @param what The string to attempt parsing. @@ -86,6 +86,23 @@ public: bool validate() const override; }; + +/*! Base Key class that parses and handles single string values. */ +class StringKey : public Key { +protected: + std::string _value; + StringKey(int _line, std::string my_str) : Key(_line), _value(my_str) {} + +public: + /*! Retrieve the value of this key. */ + const std::string value() const { return this->_value; } + + /*! By default, key will be considered valid since it parsed. + * This method should be overridden when further consideration is needed. + */ + bool validate() const override; +}; + } } |