|
|
|
@ -543,6 +543,334 @@ protected function AcediaObject GetByText(MutableText key)
|
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Returns `bool` item at key `key`. If key is invalid or |
|
|
|
|
* stores a non-`bool` value, returns `defaultValue`. |
|
|
|
|
* |
|
|
|
|
* Referred value must be stored as `BoolBox` or `BoolRef` |
|
|
|
|
* (or one of their sub-classes) for this method to work. |
|
|
|
|
* |
|
|
|
|
* @param key Key of a `bool` item that `AssociativeArray` |
|
|
|
|
* has to return. |
|
|
|
|
* @param defaultValue Value to return if there is either no item recorded |
|
|
|
|
* at `key` or it has a wrong type. |
|
|
|
|
* @return `bool` value at `key` in the caller `AssociativeArray`. |
|
|
|
|
* `defaultValue` if passed `key` is invalid or non-`bool` value |
|
|
|
|
* is stored with it. |
|
|
|
|
*/ |
|
|
|
|
public final function bool GetBool(AcediaObject key, optional bool defaultValue) |
|
|
|
|
{ |
|
|
|
|
local AcediaObject result; |
|
|
|
|
local BoolBox asBox; |
|
|
|
|
local BoolRef asRef; |
|
|
|
|
result = GetItem(key); |
|
|
|
|
if (result == none) { |
|
|
|
|
return defaultValue; |
|
|
|
|
} |
|
|
|
|
asBox = BoolBox(result); |
|
|
|
|
if (asBox != none) { |
|
|
|
|
return asBox.Get(); |
|
|
|
|
} |
|
|
|
|
asRef = BoolRef(result); |
|
|
|
|
if (asRef != none) { |
|
|
|
|
return asRef.Get(); |
|
|
|
|
} |
|
|
|
|
return defaultValue; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Changes `AssociativeArray`'s value at key `key` to `value` that will be |
|
|
|
|
* recorded as either `BoolBox` or `BoolRef`, depending of `asRef` |
|
|
|
|
* optional parameter. |
|
|
|
|
* |
|
|
|
|
* Inserted value will always be recorded as a managed value, i.e. it will be |
|
|
|
|
* automatically deallocated when overwritten, removed or |
|
|
|
|
* caller `AssociativeArray` is deallocated. |
|
|
|
|
* |
|
|
|
|
* @param key Key, at which to change the value. If `DynamicArray` is |
|
|
|
|
* not long enough to hold it, it will be automatically expanded. |
|
|
|
|
* If passed key is negative - method will do nothing. |
|
|
|
|
* @param value Value to be set at a given key. |
|
|
|
|
* @param asRef Given `bool` value will be recorded as immutable `BoolBox` |
|
|
|
|
* by default (`asRef == false`). Setting this parameter to `true` will |
|
|
|
|
* make this method record it as a mutable `BoolRef`. |
|
|
|
|
* @return Reference to the caller `AssociativeArray` to allow for |
|
|
|
|
* method chaining. |
|
|
|
|
*/ |
|
|
|
|
public final function AssociativeArray SetBool( |
|
|
|
|
AcediaObject key, |
|
|
|
|
bool value, |
|
|
|
|
optional bool asRef) |
|
|
|
|
{ |
|
|
|
|
if (asRef) { |
|
|
|
|
SetItem(key, _.ref.bool(value), true); |
|
|
|
|
} |
|
|
|
|
else { |
|
|
|
|
SetItem(key, _.box.bool(value), true); |
|
|
|
|
} |
|
|
|
|
return self; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Returns `byte` item at key `key`. If key is invalid or |
|
|
|
|
* stores a non-`byte` value, returns `defaultValue`. |
|
|
|
|
* |
|
|
|
|
* Referred value must be stored as `ByteBox` or `ByteBox` |
|
|
|
|
* (or one of their sub-classes) for this method to work. |
|
|
|
|
* |
|
|
|
|
* @param key Key of a `byte` item that `AssociativeArray` |
|
|
|
|
* has to return. |
|
|
|
|
* @param defaultValue Value to return if there is either no item recorded |
|
|
|
|
* at `key` or it has a wrong type. |
|
|
|
|
* @return `byte` value at `key` in the caller `AssociativeArray`. |
|
|
|
|
* `defaultValue` if passed `key` is invalid or non-`byte` value |
|
|
|
|
* is stored with it. |
|
|
|
|
*/ |
|
|
|
|
public final function byte GetByte(AcediaObject key, optional byte defaultValue) |
|
|
|
|
{ |
|
|
|
|
local AcediaObject result; |
|
|
|
|
local ByteBox asBox; |
|
|
|
|
local ByteRef asRef; |
|
|
|
|
result = GetItem(key); |
|
|
|
|
if (result == none) { |
|
|
|
|
return defaultValue; |
|
|
|
|
} |
|
|
|
|
asBox = ByteBox(result); |
|
|
|
|
if (asBox != none) { |
|
|
|
|
return asBox.Get(); |
|
|
|
|
} |
|
|
|
|
asRef = ByteRef(result); |
|
|
|
|
if (asRef != none) { |
|
|
|
|
return asRef.Get(); |
|
|
|
|
} |
|
|
|
|
return defaultValue; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Changes `AssociativeArray`'s value at key `key` to `value` that will be |
|
|
|
|
* recorded as either `ByteBox` or `ByteBox`, depending of `asRef` |
|
|
|
|
* optional parameter. |
|
|
|
|
* |
|
|
|
|
* Inserted value will always be recorded as a managed value, i.e. it will be |
|
|
|
|
* automatically deallocated when overwritten, removed or |
|
|
|
|
* caller `AssociativeArray` is deallocated. |
|
|
|
|
* |
|
|
|
|
* @param key Key, at which to change the value. If `DynamicArray` is |
|
|
|
|
* not long enough to hold it, it will be automatically expanded. |
|
|
|
|
* If passed key is negative - method will do nothing. |
|
|
|
|
* @param value Value to be set at a given key. |
|
|
|
|
* @param asRef Given `byte` value will be recorded as immutable `ByteBox` |
|
|
|
|
* by default (`asRef == false`). Setting this parameter to `true` will |
|
|
|
|
* make this method record it as a mutable `ByteBox`. |
|
|
|
|
* @return Reference to the caller `AssociativeArray` to allow for |
|
|
|
|
* method chaining. |
|
|
|
|
*/ |
|
|
|
|
public final function AssociativeArray SetByte( |
|
|
|
|
AcediaObject key, |
|
|
|
|
byte value, |
|
|
|
|
optional bool asRef) |
|
|
|
|
{ |
|
|
|
|
if (asRef) { |
|
|
|
|
SetItem(key, _.ref.byte(value), true); |
|
|
|
|
} |
|
|
|
|
else { |
|
|
|
|
SetItem(key, _.box.byte(value), true); |
|
|
|
|
} |
|
|
|
|
return self; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Returns `int` item at key `key`. If key is invalid or |
|
|
|
|
* stores a non-`int` value, returns `defaultValue`. |
|
|
|
|
* |
|
|
|
|
* Referred value must be stored as `IntBox` or `IntRef` |
|
|
|
|
* (or one of their sub-classes) for this method to work. |
|
|
|
|
* |
|
|
|
|
* @param key Key of a `int` item that `AssociativeArray` |
|
|
|
|
* has to return. |
|
|
|
|
* @param defaultValue Value to return if there is either no item recorded |
|
|
|
|
* at `key` or it has a wrong type. |
|
|
|
|
* @return `int` value at `key` in the caller `AssociativeArray`. |
|
|
|
|
* `defaultValue` if passed `key` is invalid or non-`int` value |
|
|
|
|
* is stored with it. |
|
|
|
|
*/ |
|
|
|
|
public final function int GetInt(AcediaObject key, optional int defaultValue) |
|
|
|
|
{ |
|
|
|
|
local AcediaObject result; |
|
|
|
|
local IntBox asBox; |
|
|
|
|
local IntRef asRef; |
|
|
|
|
result = GetItem(key); |
|
|
|
|
if (result == none) { |
|
|
|
|
return defaultValue; |
|
|
|
|
} |
|
|
|
|
asBox = IntBox(result); |
|
|
|
|
if (asBox != none) { |
|
|
|
|
return asBox.Get(); |
|
|
|
|
} |
|
|
|
|
asRef = IntRef(result); |
|
|
|
|
if (asRef != none) { |
|
|
|
|
return asRef.Get(); |
|
|
|
|
} |
|
|
|
|
return defaultValue; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Changes `AssociativeArray`'s value at key `key` to `value` that will be |
|
|
|
|
* recorded as either `IntBox` or `IntRef`, depending of `asRef` |
|
|
|
|
* optional parameter. |
|
|
|
|
* |
|
|
|
|
* Inserted value will always be recorded as a managed value, i.e. it will be |
|
|
|
|
* automatically deallocated when overwritten, removed or |
|
|
|
|
* caller `AssociativeArray` is deallocated. |
|
|
|
|
* |
|
|
|
|
* @param key Key, at which to change the value. If `DynamicArray` is |
|
|
|
|
* not long enough to hold it, it will be automatically expanded. |
|
|
|
|
* If passed key is negative - method will do nothing. |
|
|
|
|
* @param value Value to be set at a given key. |
|
|
|
|
* @param asRef Given `int` value will be recorded as immutable `IntBox` |
|
|
|
|
* by default (`asRef == false`). Setting this parameter to `true` will |
|
|
|
|
* make this method record it as a mutable `IntRef`. |
|
|
|
|
* @return Reference to the caller `AssociativeArray` to allow for |
|
|
|
|
* method chaining. |
|
|
|
|
*/ |
|
|
|
|
public final function AssociativeArray SetInt( |
|
|
|
|
AcediaObject key, |
|
|
|
|
int value, |
|
|
|
|
optional bool asRef) |
|
|
|
|
{ |
|
|
|
|
if (asRef) { |
|
|
|
|
SetItem(key, _.ref.int(value), true); |
|
|
|
|
} |
|
|
|
|
else { |
|
|
|
|
SetItem(key, _.box.int(value), true); |
|
|
|
|
} |
|
|
|
|
return self; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Returns `float` item at key `key`. If key is invalid or |
|
|
|
|
* stores a non-`float` value, returns `defaultValue`. |
|
|
|
|
* |
|
|
|
|
* Referred value must be stored as `FloatBox` or `FloatRef` |
|
|
|
|
* (or one of their sub-classes) for this method to work. |
|
|
|
|
* |
|
|
|
|
* @param key Key of a `float` item that `AssociativeArray` |
|
|
|
|
* has to return. |
|
|
|
|
* @param defaultValue Value to return if there is either no item recorded |
|
|
|
|
* at `key` or it has a wrong type. |
|
|
|
|
* @return `float` value at `key` in the caller `AssociativeArray`. |
|
|
|
|
* `defaultValue` if passed `key` is invalid or non-`float` value |
|
|
|
|
* is stored with it. |
|
|
|
|
*/ |
|
|
|
|
public final function float GetFloat( |
|
|
|
|
AcediaObject key, |
|
|
|
|
optional float defaultValue) |
|
|
|
|
{ |
|
|
|
|
local AcediaObject result; |
|
|
|
|
local FloatBox asBox; |
|
|
|
|
local FloatRef asRef; |
|
|
|
|
result = GetItem(key); |
|
|
|
|
if (result == none) { |
|
|
|
|
return defaultValue; |
|
|
|
|
} |
|
|
|
|
asBox = FloatBox(result); |
|
|
|
|
if (asBox != none) { |
|
|
|
|
return asBox.Get(); |
|
|
|
|
} |
|
|
|
|
asRef = FloatRef(result); |
|
|
|
|
if (asRef != none) { |
|
|
|
|
return asRef.Get(); |
|
|
|
|
} |
|
|
|
|
return defaultValue; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Changes `AssociativeArray`'s value at key `key` to `value` that will be |
|
|
|
|
* recorded as either `FloatBox` or `FloatRef`, depending of `asRef` |
|
|
|
|
* optional parameter. |
|
|
|
|
* |
|
|
|
|
* Inserted value will always be recorded as a managed value, i.e. it will be |
|
|
|
|
* automatically deallocated when overwritten, removed or |
|
|
|
|
* caller `AssociativeArray` is deallocated. |
|
|
|
|
* |
|
|
|
|
* @param key Key, at which to change the value. If `DynamicArray` is |
|
|
|
|
* not long enough to hold it, it will be automatically expanded. |
|
|
|
|
* If passed key is negative - method will do nothing. |
|
|
|
|
* @param value Value to be set at a given key. |
|
|
|
|
* @param asRef Given `float` value will be recorded as immutable `FloatBox` |
|
|
|
|
* by default (`asRef == false`). Setting this parameter to `true` will |
|
|
|
|
* make this method record it as a mutable `FloatRef`. |
|
|
|
|
* @return Reference to the caller `AssociativeArray` to allow for |
|
|
|
|
* method chaining. |
|
|
|
|
*/ |
|
|
|
|
public final function AssociativeArray SetFloat( |
|
|
|
|
AcediaObject key, |
|
|
|
|
float value, |
|
|
|
|
optional bool asRef) |
|
|
|
|
{ |
|
|
|
|
if (asRef) { |
|
|
|
|
SetItem(key, _.ref.float(value), true); |
|
|
|
|
} |
|
|
|
|
else { |
|
|
|
|
SetItem(key, _.box.float(value), true); |
|
|
|
|
} |
|
|
|
|
return self; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Returns `Text` item stored at key `key`. If key is invalid or |
|
|
|
|
* stores a non-`Text` value, returns `none`. |
|
|
|
|
* |
|
|
|
|
* Referred value must be stored as `Text` (or one of it's sub-classes, |
|
|
|
|
* such as `MutableText`) for this method to work. |
|
|
|
|
* |
|
|
|
|
* @param key Key of a `Text` item that `AssociativeArray` |
|
|
|
|
* has to return. |
|
|
|
|
* @return `Text` value recorded with `key` in the caller `AssociativeArray`. |
|
|
|
|
* `none` if passed `key` is invalid or non-`Text` value |
|
|
|
|
* is stored with it. |
|
|
|
|
*/ |
|
|
|
|
public final function Text GetText(AcediaObject key) |
|
|
|
|
{ |
|
|
|
|
return Text(GetItem(key)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Returns `AssociativeArray` item stored at key `key`. If key is invalid or |
|
|
|
|
* stores a non-`AssociativeArray` value, returns `none`. |
|
|
|
|
* |
|
|
|
|
* Referred value must be stored as `AssociativeArray` |
|
|
|
|
* (or one of it's sub-classes) for this method to work. |
|
|
|
|
* |
|
|
|
|
* @param key Key of an `AssociativeArray` item that caller `AssociativeArray` |
|
|
|
|
* has to return. |
|
|
|
|
* @return `AssociativeArray` value recorded with `key` in the caller |
|
|
|
|
* `AssociativeArray`. `none` if passed `key` is invalid or |
|
|
|
|
* non-`AssociativeArray` value is stored with it. |
|
|
|
|
*/ |
|
|
|
|
public final function AssociativeArray GetAssociativeArray(AcediaObject key) |
|
|
|
|
{ |
|
|
|
|
return AssociativeArray(GetItem(key)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Returns `DynamicArray` item stored at key `key`. If key is invalid or |
|
|
|
|
* stores a non-`DynamicArray` value, returns `none`. |
|
|
|
|
* |
|
|
|
|
* Referred value must be stored as `DynamicArray` |
|
|
|
|
* (or one of it's sub-classes) for this method to work. |
|
|
|
|
* |
|
|
|
|
* @param key Key of a `DynamicArray` item that caller `AssociativeArray` |
|
|
|
|
* has to return. |
|
|
|
|
* @return `AssociativeArray` value recorded with `key` in the caller |
|
|
|
|
* `AssociativeArray`. `none` if passed `key` is invalid or |
|
|
|
|
* non-`AssociativeArray` value is stored with it. |
|
|
|
|
*/ |
|
|
|
|
public final function DynamicArray GetDynamicArray(AcediaObject key) |
|
|
|
|
{ |
|
|
|
|
return DynamicArray(GetItem(key)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
defaultproperties |
|
|
|
|
{ |
|
|
|
|
iteratorClass = class'AssociativeArrayIterator' |
|
|
|
|