MCPcopy Create free account
hub / github.com/WolfireGames/overgrowth / RegisterScriptType

Method RegisterScriptType

Source/Scripting/scriptparams.cpp:40–69  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

38}
39
40void ScriptParams::RegisterScriptType(ASContext *context) {
41 if (context->TypeExists("ScriptParams")) {
42 return;
43 }
44 context->RegisterObjectType("ScriptParams", 0, asOBJ_REF | asOBJ_NOCOUNT);
45 context->RegisterObjectMethod("ScriptParams", "const string &GetString (const string &in key)", asMETHOD(ScriptParams, GetStringVal), asCALL_THISCALL);
46 context->RegisterObjectMethod("ScriptParams", "float GetFloat (const string &in key)", asMETHOD(ScriptParams, ASGetFloat), asCALL_THISCALL);
47 context->RegisterObjectMethod("ScriptParams", "int GetInt (const string &in key)", asMETHOD(ScriptParams, ASGetInt), asCALL_THISCALL);
48 context->RegisterObjectMethod("ScriptParams", "float SetFloat (const string &in key, float val)", asMETHOD(ScriptParams, ASSetFloat), asCALL_THISCALL);
49 context->RegisterObjectMethod("ScriptParams", "int SetInt (const string &in key, int)", asMETHOD(ScriptParams, ASSetInt), asCALL_THISCALL);
50 context->RegisterObjectMethod("ScriptParams", "void SetString (const string &in key, const string &in val)", asMETHOD(ScriptParams, ASSetString), asCALL_THISCALL);
51 context->RegisterObjectMethod("ScriptParams", "void AddInt (const string &in key, int default_val)", asMETHOD(ScriptParams, ASAddInt), asCALL_THISCALL);
52 context->RegisterObjectMethod("ScriptParams", "void AddIntSlider (const string &in key, int default_val, const string &in bounds)", asMETHOD(ScriptParams, ASAddIntSlider), asCALL_THISCALL);
53 context->RegisterObjectMethod("ScriptParams", "void AddFloatSlider (const string &in key, float default_val, const string &in bounds)", asMETHOD(ScriptParams, ASAddFloatSlider), asCALL_THISCALL);
54 context->RegisterObjectMethod("ScriptParams", "void AddIntCheckbox (const string &in key, bool default_val)", asMETHOD(ScriptParams, ASAddIntCheckbox), asCALL_THISCALL);
55 context->RegisterObjectMethod("ScriptParams", "void AddFloat (const string &in key, float default_val)", asMETHOD(ScriptParams, ASAddFloat), asCALL_THISCALL);
56 context->RegisterObjectMethod("ScriptParams", "void AddString (const string &in key, const string &in default_val)", asMETHOD(ScriptParams, ASAddString), asCALL_THISCALL);
57
58 context->RegisterObjectMethod("ScriptParams", "void ASAddJSONFromString (const string &in key, const string &in default_val)", asMETHOD(ScriptParams, ASAddJSONFromString), asCALL_THISCALL);
59 context->RegisterObjectMethod("ScriptParams", "void AddJSON (const string &in key, JSON &in default_val)", asMETHOD(ScriptParams, ASAddJSON), asCALL_THISCALL);
60 context->RegisterObjectMethod("ScriptParams", "JSON GetJSON (const string &in key)", asMETHOD(ScriptParams, ASGetJSON), asCALL_THISCALL);
61
62 context->RegisterObjectMethod("ScriptParams", "void Remove (const string &in key)", asMETHOD(ScriptParams, ASRemove), asCALL_THISCALL);
63 context->RegisterObjectMethod("ScriptParams", "bool HasParam (const string &in key)", asMETHOD(ScriptParams, HasParam), asCALL_THISCALL);
64 context->RegisterObjectMethod("ScriptParams", "bool IsParamInt(const string &in key)", asMETHOD(ScriptParams, IsParamInt), asCALL_THISCALL);
65 context->RegisterObjectMethod("ScriptParams", "bool IsParamFloat(const string &in key)", asMETHOD(ScriptParams, IsParamFloat), asCALL_THISCALL);
66 context->RegisterObjectMethod("ScriptParams", "bool IsParamString(const string &in key)", asMETHOD(ScriptParams, IsParamString), asCALL_THISCALL);
67 context->RegisterObjectMethod("ScriptParams", "bool IsParamJSON(const string &in key)", asMETHOD(ScriptParams, IsParamJSON), asCALL_THISCALL);
68 context->DocsCloseBrace();
69}
70
71namespace {
72std::string null_str;

Callers

nothing calls this directly

Calls 4

TypeExistsMethod · 0.80
RegisterObjectTypeMethod · 0.80
DocsCloseBraceMethod · 0.80
RegisterObjectMethodMethod · 0.45

Tested by

no test coverage detected