From 759d2b512d5b1ad113103d50d7f6f9cd0602eecb Mon Sep 17 00:00:00 2001 From: Anton Tarasenko Date: Wed, 19 Oct 2022 03:49:21 +0700 Subject: [PATCH] Add `GetAllAliases()` method for alias sources --- sources/Aliases/AliasSource.uc | 5 +++++ sources/Aliases/BaseAliasSource.uc | 28 ++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/sources/Aliases/AliasSource.uc b/sources/Aliases/AliasSource.uc index 340a923..91f1992 100644 --- a/sources/Aliases/AliasSource.uc +++ b/sources/Aliases/AliasSource.uc @@ -140,6 +140,11 @@ public static function bool AreValuesCaseSensitive() return false; } +public function array GetAllAliases() +{ + return aliasHash.GetTextKeys(); +} + public function array GetAliases(BaseText value) { local int i; diff --git a/sources/Aliases/BaseAliasSource.uc b/sources/Aliases/BaseAliasSource.uc index 0244ce2..24c5c4a 100644 --- a/sources/Aliases/BaseAliasSource.uc +++ b/sources/Aliases/BaseAliasSource.uc @@ -75,6 +75,34 @@ class BaseAliasSource extends AcediaObject */ 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 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 GetAllAliases_S() +{ + local int i; + local array resultWithTexts; + local array 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`. *