summaryrefslogtreecommitdiff
path: root/hscript/script.hh
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2019-10-06 13:07:52 -0500
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2019-10-06 13:07:52 -0500
commit0b85e832aa2b050b91b9a3d948dff1984554bcd8 (patch)
treed640941d335bfcdf25381d214e9b60b34a6b7819 /hscript/script.hh
parent128c67fd16af66219a98470265a1ff842c345041 (diff)
downloadhorizon-0b85e832aa2b050b91b9a3d948dff1984554bcd8.tar.gz
horizon-0b85e832aa2b050b91b9a3d948dff1984554bcd8.tar.bz2
horizon-0b85e832aa2b050b91b9a3d948dff1984554bcd8.tar.xz
horizon-0b85e832aa2b050b91b9a3d948dff1984554bcd8.zip
More API stuff
Diffstat (limited to 'hscript/script.hh')
-rw-r--r--hscript/script.hh28
1 files changed, 24 insertions, 4 deletions
diff --git a/hscript/script.hh b/hscript/script.hh
index 2abadd9..a2c2551 100644
--- a/hscript/script.hh
+++ b/hscript/script.hh
@@ -10,12 +10,30 @@
* SPDX-License-Identifier: AGPL-3.0-only
*/
+#ifndef __HSCRIPT_SCRIPT_HH_
+#define __HSCRIPT_SCRIPT_HH_
+
#include <string>
#include <vector>
#include <memory>
namespace Horizon {
+/**** Script option flags ****/
+
+/*! Don't stop after the first error. */
+#define SCRIPT_KEEP_GOING 0x0001
+/*! Ensure network resources are available. */
+#define SCRIPT_USE_NETWORK 0x0002
+/*! Treat warnings as errors. */
+#define SCRIPT_STRICT_MODE 0x0004
+/*! This is an Installation Environment - validate more keys */
+#define SCRIPT_INSTALL_ENV 0x0008
+
+
+typedef uint32_t ScriptOptions;
+
+
/*! Defines the Script class, which represents a HorizonScript. */
class Script {
public:
@@ -24,17 +42,17 @@ public:
/*! Load a HorizonScript from the specified path.
* @param path The path to load from.
+ * @param options Options to use for parsing, validation, and execution.
* @return true if the Script could be loaded; false otherwise.
*/
- bool load(std::string path);
+ static const Script *load(std::string path, ScriptOptions options = 0);
/*! Load a HorizonScript from the specified stream.
* @param stream The stream to load from.
+ * @param options Options to use for parsing, validation, and execution.
* @return true if the Script could be loaded; false otherwise.
*/
- bool load(std::istream &stream);
+ static const Script *load(std::istream &stream, ScriptOptions options = 0);
- /*! Parses the HorizonScript. */
- bool parse();
/*! Determines if the HorizonScript is valid. */
bool validate();
@@ -45,3 +63,5 @@ private:
};
}
+
+#endif /* !__HSCRIPT_SCRIPT_HH_ */