104 lines
3.0 KiB
Plaintext
104 lines
3.0 KiB
Plaintext
#include "..\script_component.hpp"
|
|
|
|
/*
|
|
* File: fnc_baseStore.sqf
|
|
* Author: IDSolutions
|
|
* Date: 2026-01-08
|
|
* Last Update: 2026-01-10
|
|
* Public: No
|
|
*
|
|
* Description:
|
|
* No description added yet.
|
|
*
|
|
* Parameter(s):
|
|
* N/A
|
|
*
|
|
* Returns:
|
|
* Something [BOOL]
|
|
*
|
|
* Example(s):
|
|
* [parameter] call forge_x_component_fnc_myFunction
|
|
*/
|
|
|
|
#pragma hemtt ignore_variables ["_self"]
|
|
GVAR(BaseStore) = compileFinal createHashMapFromArray [
|
|
["#type", "IBaseStore"],
|
|
["fetch", {
|
|
params [["_function", "", [""]], ["_uid", "", [""]]];
|
|
|
|
private _data = createHashMap;
|
|
|
|
[_function, [_uid]] call EFUNC(extension,extCall) params ["_result", "_isSuccess"];
|
|
["INFO", format ["Data: %1", _result], nil, nil] call EFUNC(common,log);
|
|
|
|
if (count _result > 0) then { _data = _self call ["toHashMap", [_result]] };
|
|
|
|
_data
|
|
}],
|
|
["set", {
|
|
params [["_registry", createHashMap, [createHashMap]], ["_function", "", [""]], ["_uid", "", [""]], ["_field", "", [""]], ["_value", nil, [0, "", [], false, createHashMap, objNull, grpNull]], ["_sync", false, [false]]];
|
|
|
|
private _existingData = _registry get _uid;
|
|
private _finalData = +_existingData;
|
|
private _hashMap = createHashMap;
|
|
|
|
_finalData set [_field, _value];
|
|
_hashMap set [_field, _value];
|
|
_registry set [_uid, _finalData];
|
|
|
|
if (_sync) then {
|
|
private _json = _self call ["toJSON", [_hashMap]];
|
|
[_function, [_uid, _json]] call EFUNC(extension,extCall);
|
|
};
|
|
|
|
_hashMap
|
|
}],
|
|
["mset", {
|
|
params [["_registry", createHashMap, [createHashMap]], ["_function", "", [""]], ["_uid", "", [""]], ["_fieldValuePairs", createHashMap, [createHashMap]], ["_sync", false, [false]]];
|
|
|
|
private _existingData = _registry get _uid;
|
|
private _finalData = +_existingData;
|
|
private _hashMap = createHashMap;
|
|
|
|
{ _finalData set [_x, _y]; } forEach _fieldValuePairs;
|
|
{ _hashMap set [_x, _y]; } forEach _fieldValuePairs;
|
|
|
|
_registry set [_uid, _finalData];
|
|
|
|
if (_sync) then {
|
|
private _json = _self call ["toJSON", [_hashMap]];
|
|
[_function, [_uid, _json]] call EFUNC(extension,extCall);
|
|
};
|
|
|
|
_hashMap
|
|
}],
|
|
["save", {
|
|
params [["_registry", createHashMap, [createHashMap]], ["_function", "", [""]], ["_uid", "", [""]]];
|
|
|
|
private _existingData = _registry get _uid;
|
|
private _finalData = +_existingData;
|
|
private _json = _self call ["toJSON", [_finalData]];
|
|
|
|
[_function, [_uid, _json]] call EFUNC(extension,extCall);
|
|
|
|
_finalData
|
|
}],
|
|
["remove", {
|
|
params [["_registry", createHashMap, [createHashMap]], ["_uid", "", [""]]];
|
|
|
|
_registry deleteAt _uid;
|
|
}],
|
|
["toHashMap", {
|
|
params [["_data", "", [""]]];
|
|
|
|
fromJSON _data
|
|
}],
|
|
["toJSON", {
|
|
params [["_data", createHashMap, [createHashMap]]];
|
|
|
|
toJSON _data
|
|
}]
|
|
];
|
|
|
|
GVAR(BaseStore)
|