MacroLibrary.h header
#include <ew/app/MacroLibrary.h>
Namespace ew::app
ScriptMacro struct
struct ew::app::ScriptMacro
A saved Script Console macro: a display name and the JavaScript source it runs against the world bridge (see ScriptWorld / ScriptHost). Distinct from an AI PromptCommand (an instruction sent to a model): a macro is code the user runs locally to read and automate the project.
Members
QString ew::app::ScriptMacro::name
The macro's display name, shown in the Script Console's macro picker.
QString ew::app::ScriptMacro::script
The JavaScript source the macro runs.
bool operator==(const ScriptMacro &, const ScriptMacro &)=default
Macros compare equal when both fields match.
Functions
std::vector< ScriptMacro > ew::app::builtInScriptMacros()
The example macros offered out of the box (batch-set a field on every entity, list entities missing a field, list the documents), used as the starting set when the user has saved none. They double as living documentation of the world API.
std::vector< ScriptMacro > ew::app::loadScriptMacros(const Settings &settings)
Loads the user's saved macros from a Settings store; returns builtInScriptMacros() when none are saved or the stored value is malformed. Pure with respect to the store, so it is unit-testable with an in-memory Settings.
void ew::app::saveScriptMacros(Settings &settings, const std::vector< ScriptMacro > ¯os)
Saves macros to settings (as a JSON array under the "scripts/macros" key), replacing any existing list. Saving an empty list clears the key, so the built-ins return on the next load.