diff options
-rw-r--r-- | hscript/key.cc | 5 | ||||
-rw-r--r-- | hscript/key.hh | 19 | ||||
-rw-r--r-- | hscript/user.cc | 0 |
3 files changed, 23 insertions, 1 deletions
diff --git a/hscript/key.cc b/hscript/key.cc index b5bbe31..bc71517 100644 --- a/hscript/key.cc +++ b/hscript/key.cc @@ -36,3 +36,8 @@ bool Horizon::Keys::BooleanKey::validate() const { /* Key will fail init if it is not valid, so this is always a no-op. */ return true; } + +bool Horizon::Keys::StringKey::validate() const { + /* Key will fail init if it is not valid, so this is always a no-op. */ + return true; +} 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; +}; + } } diff --git a/hscript/user.cc b/hscript/user.cc new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/hscript/user.cc |