Browse Source

Add `GetAllAliases()` method for alias sources

pull/8/head
Anton Tarasenko 2 years ago
parent
commit
759d2b512d
  1. 5
      sources/Aliases/AliasSource.uc
  2. 28
      sources/Aliases/BaseAliasSource.uc

5
sources/Aliases/AliasSource.uc

@ -140,6 +140,11 @@ public static function bool AreValuesCaseSensitive()
return false; return false;
} }
public function array<Text> GetAllAliases()
{
return aliasHash.GetTextKeys();
}
public function array<Text> GetAliases(BaseText value) public function array<Text> GetAliases(BaseText value)
{ {
local int i; local int i;

28
sources/Aliases/BaseAliasSource.uc

@ -75,6 +75,34 @@ class BaseAliasSource extends AcediaObject
*/ */
public static function bool AreValuesCaseSensitive(); public static function bool AreValuesCaseSensitive();
/**
* Returns all aliases that are stored in the caller source/
*
* @return Array of all aliases inside the caller alias source. All `Text`
* references are guaranteed to not be `none` or duplicated.
*/
public function array<Text> GetAllAliases();
/**
* Returns all aliases that are stored in the caller source/
*
* @return Array of all aliases inside the caller alias source. All `Text`
* references are guaranteed to not be `none` or duplicated.
*/
public function array<string> GetAllAliases_S()
{
local int i;
local array<Text> resultWithTexts;
local array<string> result;
resultWithTexts = GetAllAliases();
for (i = 0; i < resultWithTexts.length; i += 1) {
result[result.length] = resultWithTexts[i].ToString();
}
_.memory.FreeMany(resultWithTexts);
return result;
}
/** /**
* Returns all aliases that represent given value `value`. * Returns all aliases that represent given value `value`.
* *

Loading…
Cancel
Save