summaryrefslogtreecommitdiff
path: root/hscript/key.hh
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2019-10-05 20:14:40 -0500
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2019-10-05 20:14:40 -0500
commit3d976959ac21e14b3d729ee0c81cbebd3e520612 (patch)
treee908cbc956944416a2e41b8b85357b543d34fa99 /hscript/key.hh
parenta531cdb8c1e6c47e675f6c256012e61812ce0a44 (diff)
downloadhorizon-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.hh27
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;
}
}