diff options
author | A. Wilcox <AWilcox@Wilcox-Tech.com> | 2019-10-05 20:14:40 -0500 |
---|---|---|
committer | A. Wilcox <AWilcox@Wilcox-Tech.com> | 2019-10-05 20:14:40 -0500 |
commit | 3d976959ac21e14b3d729ee0c81cbebd3e520612 (patch) | |
tree | e908cbc956944416a2e41b8b85357b543d34fa99 /hscript/key.hh | |
parent | a531cdb8c1e6c47e675f6c256012e61812ce0a44 (diff) | |
download | horizon-3d976959ac21e14b3d729ee0c81cbebd3e520612.tar.gz horizon-3d976959ac21e14b3d729ee0c81cbebd3e520612.tar.bz2 horizon-3d976959ac21e14b3d729ee0c81cbebd3e520612.tar.xz horizon-3d976959ac21e14b3d729ee0c81cbebd3e520612.zip |
More API drafting
Diffstat (limited to 'hscript/key.hh')
-rw-r--r-- | hscript/key.hh | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/hscript/key.hh b/hscript/key.hh index 06d34f8..7c398ca 100644 --- a/hscript/key.hh +++ b/hscript/key.hh @@ -28,18 +28,31 @@ public: void setData(std::string data); /*! Determines if the data associated with the Key is valid. */ - bool isValid(); + bool validate(); + /*! Executes the action associated with this Key. + * Will always return `false` if `validate` is `false`. + */ + bool execute(); +}; + +/*! Describes a Key class. */ +typedef struct KeyDesc { + /*! The name of the Key. */ + std::string name; /*! Determines if the Key is required to be present for the HorizonScript * to be considered valid. */ - static bool isRequired(); - + bool required; /*! Determines how many times this Key can be repeated. - * If this function returns 0, it can be repeated an unlimited number of times. - * If this function returns 1, it can only be present once per HorizonScript. + * If this value is 0, it can be repeated an unlimited number of times. + * If this value is 1, it can only be present once per HorizonScript. */ - static int maxCount(); -}; + int repeat; + /*! Order of the Key. Determines when the Key will be executed. */ + int order; + /*! The function used to create a new Key of this type. */ + Key*(*key_create_fn)(void); +} key_desc_t; } } |