Browse Source

Refactor text classes to subclass on `BaseText`

pull/8/head
Anton Tarasenko 2 years ago
parent
commit
1e62edfc93
  1. 14
      sources/Aliases/AliasSource.uc
  2. 8
      sources/Aliases/Aliases.uc
  3. 8
      sources/Aliases/AliasesAPI.uc
  4. 2
      sources/Avarice/AvariceAPI.uc
  5. 11
      sources/Avarice/AvariceLink.uc
  6. 4
      sources/Avarice/AvariceTcpStream.uc
  7. 2
      sources/Chat/ChatAPI.uc
  8. 5
      sources/Chat/Events/ChatAPI_OnMessageFor_Signal.uc
  9. 2
      sources/Chat/Events/ChatAPI_OnMessageFor_Slot.uc
  10. 6
      sources/Color/ColorAPI.uc
  11. 2
      sources/Commands/BuiltInCommands/ACommandHelp.uc
  12. 10
      sources/Commands/Command.uc
  13. 94
      sources/Commands/CommandDataBuilder.uc
  14. 8
      sources/Commands/CommandParser.uc
  15. 2
      sources/Commands/Commands.uc
  16. 2
      sources/Commands/Commands_Feature.uc
  17. 10
      sources/Commands/PlayersParser.uc
  18. 12
      sources/Config/AcediaConfig.uc
  19. 21
      sources/Console/ConsoleBuffer.uc
  20. 8
      sources/Console/ConsoleWriter.uc
  21. 2
      sources/Data/Collections/AssociativeArray.uc
  22. 18
      sources/Data/Collections/Collection.uc
  23. 2
      sources/Data/Collections/DynamicArray.uc
  24. 14
      sources/Data/Database/DBAPI.uc
  25. 6
      sources/Data/Database/Local/DBRecord.uc
  26. 4
      sources/Data/Database/Local/LocalDatabase.uc
  27. 2
      sources/Data/Database/Tests/TEST_LocalDatabase.uc
  28. 15
      sources/Features/Feature.uc
  29. 2
      sources/Features/FeatureConfig.uc
  30. 4
      sources/Gameplay/BaseClasses/Frontend/Templates/ATemplatesComponent.uc
  31. 2
      sources/Gameplay/BaseClasses/KillingFloor/Frontend/KFFrontend.uc
  32. 2
      sources/Gameplay/BaseClasses/KillingFloor/Frontend/Trading/ATradingComponent.uc
  33. 2
      sources/Gameplay/BaseClasses/KillingFloor/Frontend/Trading/ETrader.uc
  34. 2
      sources/Gameplay/KF1Frontend/BaseImplementation/EKFAmmo.uc
  35. 2
      sources/Gameplay/KF1Frontend/BaseImplementation/EKFFlashlightAmmo.uc
  36. 16
      sources/Gameplay/KF1Frontend/BaseImplementation/EKFInventory.uc
  37. 2
      sources/Gameplay/KF1Frontend/BaseImplementation/EKFMedicAmmo.uc
  38. 2
      sources/Gameplay/KF1Frontend/BaseImplementation/EKFSyringeAmmo.uc
  39. 2
      sources/Gameplay/KF1Frontend/BaseImplementation/EKFUnknownItem.uc
  40. 2
      sources/Gameplay/KF1Frontend/BaseImplementation/EKFWeapon.uc
  41. 2
      sources/Gameplay/KF1Frontend/KF1_Frontend.uc
  42. 4
      sources/Gameplay/KF1Frontend/Templates/KF1_TemplatesComponent.uc
  43. 4
      sources/Gameplay/KF1Frontend/Trading/KF1_Trader.uc
  44. 2
      sources/Gameplay/KF1Frontend/Trading/KF1_TradingComponent.uc
  45. 2
      sources/Logger/ConsoleLogger.uc
  46. 16
      sources/Logger/LogMessage.uc
  47. 4
      sources/Logger/Logger.uc
  48. 12
      sources/Logger/LoggerAPI.uc
  49. 6
      sources/Memory/MemoryAPI.uc
  50. 12
      sources/Players/EPlayer.uc
  51. 2
      sources/Players/Events/PlayerAPI_OnPlayerNameChanged_Signal.uc
  52. 2
      sources/Players/Events/PlayerAPI_OnPlayerNameChanged_Slot.uc
  53. 4
      sources/Players/Events/PlayerAPI_OnPlayerNameChanging_Signal.uc
  54. 2
      sources/Players/Events/PlayerAPI_OnPlayerNameChanging_Slot.uc
  55. 18
      sources/Players/Inventory/EInventory.uc
  56. 2
      sources/Players/Inventory/EItem.uc
  57. 6
      sources/Players/PlayersAPI.uc
  58. 1578
      sources/Text/BaseText.uc
  59. 2
      sources/Text/Codecs/Utf8Decoder.uc
  60. 2
      sources/Text/Codecs/Utf8Encoder.uc
  61. 8
      sources/Text/FormattedStrings/FormattingCommandsSequence.uc
  62. 4
      sources/Text/FormattedStrings/FormattingErrorsReport.uc
  63. 21
      sources/Text/FormattedStrings/FormattingStringParser.uc
  64. 31
      sources/Text/JSON/JSONAPI.uc
  65. 6
      sources/Text/JSON/JSONPointer.uc
  66. 95
      sources/Text/MutableText.uc
  67. 92
      sources/Text/Parser.uc
  68. 4
      sources/Text/Tests/TEST_FormattedStrings.uc
  69. BIN
      sources/Text/Tests/TEST_Parser.uc
  70. BIN
      sources/Text/Tests/TEST_Text.uc
  71. BIN
      sources/Text/Tests/TEST_TextAPI.uc
  72. BIN
      sources/Text/Tests/TEST_UTF8EncoderDecoder.uc
  73. 1475
      sources/Text/Text.uc
  74. 153
      sources/Text/TextAPI.uc
  75. 8
      sources/Users/User.uc
  76. 2
      sources/Users/UserAPI.uc
  77. 2
      sources/Users/UserDatabase.uc
  78. 4
      sources/Users/UserID.uc

14
sources/Aliases/AliasSource.uc

@ -123,7 +123,7 @@ private final function HashValidAliasesFromPerObjectConfig()
// they already exist. // they already exist.
// Takes care of lower case conversion to store aliases in `aliasHash` // Takes care of lower case conversion to store aliases in `aliasHash`
// in a case-insensitive way. // in a case-insensitive way.
private final function InsertAlias(Text alias, Text value) private final function InsertAlias(BaseText alias, BaseText value)
{ {
local Text aliasLowerCaseCopy; local Text aliasLowerCaseCopy;
local AssociativeArray.Entry hashEntry; local AssociativeArray.Entry hashEntry;
@ -145,7 +145,7 @@ private final function InsertAlias(Text alias, Text value)
* @param alias Alias to check, case-insensitive. * @param alias Alias to check, case-insensitive.
* @return `true` if present, `false` otherwise. * @return `true` if present, `false` otherwise.
*/ */
public function bool HasAlias(Text alias) public function bool HasAlias(BaseText alias)
{ {
local bool result; local bool result;
local Text lowerCaseAlias; local Text lowerCaseAlias;
@ -174,7 +174,7 @@ public function bool HasAlias(Text alias)
* and `copyOnFailure == true` means method will return `alias.Copy()`. * and `copyOnFailure == true` means method will return `alias.Copy()`.
* If `alias == none` method always returns `none`. * If `alias == none` method always returns `none`.
*/ */
public function Text Resolve(Text alias, optional bool copyOnFailure) public function Text Resolve(BaseText alias, optional bool copyOnFailure)
{ {
local Text result; local Text result;
local Text lowerCaseAlias; local Text lowerCaseAlias;
@ -273,7 +273,7 @@ public final function bool AddAlias(
* *
* @param aliasToRemove Alias that you want to remove from caller source. * @param aliasToRemove Alias that you want to remove from caller source.
*/ */
public final function RemoveAlias(Text aliasToRemove) public final function RemoveAlias(BaseText aliasToRemove)
{ {
local int i; local int i;
local bool isMatchingRecord; local bool isMatchingRecord;
@ -308,7 +308,9 @@ public final function RemoveAlias(Text aliasToRemove)
} }
} }
private final function LogDuplicateAliasWarning(Text alias, Text existingValue) private final function LogDuplicateAliasWarning(
BaseText alias,
BaseText existingValue)
{ {
_.logger.Auto(warnDuplicateAlias) _.logger.Auto(warnDuplicateAlias)
.ArgClass(class) .ArgClass(class)
@ -319,7 +321,7 @@ private final function LogDuplicateAliasWarning(Text alias, Text existingValue)
// Tries to find a loaded `Aliases` config object that stores aliases for // Tries to find a loaded `Aliases` config object that stores aliases for
// the given value. If such object does not exists - creates a new one. // the given value. If such object does not exists - creates a new one.
// Assumes `value != none`. // Assumes `value != none`.
private final function Aliases GetAliasesObjectWithValue(Text value) private final function Aliases GetAliasesObjectWithValue(BaseText value)
{ {
local int i; local int i;
local Text nextValue; local Text nextValue;

8
sources/Aliases/Aliases.uc

@ -48,7 +48,7 @@ var protected config array<string> alias;
// we need methods to convert between "storage" (`string`) // we need methods to convert between "storage" (`string`)
// and "actual" (`Text`) value version. // and "actual" (`Text`) value version.
// `ToStorageVersion()` and `ToActualVersion()` do that. // `ToStorageVersion()` and `ToActualVersion()` do that.
private final static function string ToStorageVersion(Text actualValue) private final static function string ToStorageVersion(BaseText actualValue)
{ {
return Repl(actualValue.ToString(), ".", ":"); return Repl(actualValue.ToString(), ".", ":");
} }
@ -98,7 +98,7 @@ private static final function Aliases LoadObjectByName(string objectName)
* correspond to. * correspond to.
* @return Instance of `Aliases` object with a given name. * @return Instance of `Aliases` object with a given name.
*/ */
public static final function Aliases LoadObject(Text aliasesValue) public static final function Aliases LoadObject(BaseText aliasesValue)
{ {
if (aliasesValue != none) { if (aliasesValue != none) {
return LoadObjectByName(ToStorageVersion(aliasesValue)); return LoadObjectByName(ToStorageVersion(aliasesValue));
@ -141,7 +141,7 @@ public final function array<Text> GetAliases()
* @param aliasToAdd Alias to add to caller `Aliases` object. * @param aliasToAdd Alias to add to caller `Aliases` object.
* If `none`, method will do nothing. * If `none`, method will do nothing.
*/ */
public final function AddAlias(Text aliasToAdd) public final function AddAlias(BaseText aliasToAdd)
{ {
local int i; local int i;
if (aliasToAdd == none) return; if (aliasToAdd == none) return;
@ -165,7 +165,7 @@ public final function AddAlias(Text aliasToAdd)
* *
* @param aliasToRemove Alias to remove from caller `Aliases` object. * @param aliasToRemove Alias to remove from caller `Aliases` object.
*/ */
public final function RemoveAlias(Text aliasToRemove) public final function RemoveAlias(BaseText aliasToRemove)
{ {
local int i; local int i;
local bool removedAlias; local bool removedAlias;

8
sources/Aliases/AliasesAPI.uc

@ -155,7 +155,7 @@ public final function AliasSource GetFeatureSource()
* If `alias == none` method always returns `none`. * If `alias == none` method always returns `none`.
*/ */
public final function Text ResolveWeapon( public final function Text ResolveWeapon(
Text alias, BaseText alias,
optional bool copyOnFailure) optional bool copyOnFailure)
{ {
local AliasSource source; local AliasSource source;
@ -187,7 +187,9 @@ public final function Text ResolveWeapon(
* and `copyOnFailure == true` means method will return `alias.Copy()`. * and `copyOnFailure == true` means method will return `alias.Copy()`.
* If `alias == none` method always returns `none`. * If `alias == none` method always returns `none`.
*/ */
public final function Text ResolveColor(Text alias, optional bool copyOnFailure) public final function Text ResolveColor(
BaseText alias,
optional bool copyOnFailure)
{ {
local AliasSource source; local AliasSource source;
source = GetColorSource(); source = GetColorSource();
@ -219,7 +221,7 @@ public final function Text ResolveColor(Text alias, optional bool copyOnFailure)
* If `alias == none` method always returns `none`. * If `alias == none` method always returns `none`.
*/ */
public final function Text ResolveFeature( public final function Text ResolveFeature(
Text alias, BaseText alias,
optional bool copyOnFailure) optional bool copyOnFailure)
{ {
local AliasSource source; local AliasSource source;

2
sources/Avarice/AvariceAPI.uc

@ -47,7 +47,7 @@ public final function array<AvariceLink> GetAllLinks()
* If `linkName == none` or `AvariceLink` with such name does not exist - * If `linkName == none` or `AvariceLink` with such name does not exist -
* returns `none`. * returns `none`.
*/ */
public final function AvariceLink GetLink(Text linkName) public final function AvariceLink GetLink(BaseText linkName)
{ {
local int i; local int i;
local Text nextName; local Text nextName;

11
sources/Avarice/AvariceLink.uc

@ -123,7 +123,7 @@ protected function Finalizer()
* @param name Port used by the Avarice instance that caller `AvariceLink` * @param name Port used by the Avarice instance that caller `AvariceLink`
* is connecting to. * is connecting to.
*/ */
public final function Initialize(Text name, Text host, int port) public final function Initialize(BaseText name, BaseText host, int port)
{ {
if (tcpStream != none) return; if (tcpStream != none) return;
if (name == none) return; if (name == none) return;
@ -198,12 +198,13 @@ public final function SimpleSlot OnDeath(AcediaObject receiver)
/* SIGNAL */ /* SIGNAL */
public final function Avarice_OnMessage_Slot OnMessage( public final function Avarice_OnMessage_Slot OnMessage(
AcediaObject receiver, AcediaObject receiver,
Text service) BaseText service)
{ {
return Avarice_OnMessage_Slot(GetServiceSignal(service).NewSlot(receiver)); return Avarice_OnMessage_Slot(GetServiceSignal(service).NewSlot(receiver));
} }
private final function Avarice_OnMessage_Signal GetServiceSignal(Text service) private final function Avarice_OnMessage_Signal GetServiceSignal(
BaseText service)
{ {
local Avarice_OnMessage_Signal result; local Avarice_OnMessage_Signal result;
if (service != none) { if (service != none) {
@ -370,8 +371,8 @@ public final function int GetPort()
* addressing make a reply. * addressing make a reply.
*/ */
public final function bool SendMessage( public final function bool SendMessage(
Text service, BaseText service,
Text type, BaseText type,
AcediaObject parameters) AcediaObject parameters)
{ {
local Mutabletext parametesAsJSON; local Mutabletext parametesAsJSON;

4
sources/Avarice/AvariceTcpStream.uc

@ -269,7 +269,7 @@ private final function HandleIncomingData()
_.memory.FreeMany(receivedMessages); _.memory.FreeMany(receivedMessages);
} }
public final function SendMessage(Text textMessage) public final function SendMessage(BaseText textMessage)
{ {
local int i; local int i;
local int nextByte; local int nextByte;
@ -331,7 +331,7 @@ private final function SendReceived(int received)
SendBinary(3, buffer); SendBinary(3, buffer);
} }
private final function AvariceMessage MessageFromText(Text message) private final function AvariceMessage MessageFromText(BaseText message)
{ {
local Parser parser; local Parser parser;
local AvariceMessage result; local AvariceMessage result;

2
sources/Chat/ChatAPI.uc

@ -80,7 +80,7 @@ public function ChatAPI_OnMessage_Slot OnMessage(
* also be interrupted. * also be interrupted.
* *
* [Signature] * [Signature]
* bool <slot>(EPlayer receiver, EPlayer sender, Text message) * bool <slot>(EPlayer receiver, EPlayer sender, BaseText message)
* *
* @param receiver `EPlayer` that will receive the message. * @param receiver `EPlayer` that will receive the message.
* @param sender `EPlayer` that has sent the message. * @param sender `EPlayer` that has sent the message.

5
sources/Chat/Events/ChatAPI_OnMessageFor_Signal.uc

@ -19,7 +19,10 @@
*/ */
class ChatAPI_OnMessageFor_Signal extends Signal; class ChatAPI_OnMessageFor_Signal extends Signal;
public final function bool Emit(EPlayer receiver, EPlayer sender, Text message) public final function bool Emit(
EPlayer receiver,
EPlayer sender,
BaseText message)
{ {
local Slot nextSlot; local Slot nextSlot;
local bool nextReply; local bool nextReply;

2
sources/Chat/Events/ChatAPI_OnMessageFor_Slot.uc

@ -19,7 +19,7 @@
*/ */
class ChatAPI_OnMessageFor_Slot extends Slot; class ChatAPI_OnMessageFor_Slot extends Slot;
delegate bool connect(EPlayer receiver, EPlayer sender, Text message) delegate bool connect(EPlayer receiver, EPlayer sender, BaseText message)
{ {
DummyCall(); DummyCall();
return true; return true;

6
sources/Color/ColorAPI.uc

@ -1026,7 +1026,7 @@ public final function bool ParseString(
* @return `true` if parsing was successful and false otherwise. * @return `true` if parsing was successful and false otherwise.
*/ */
public final function bool Parse( public final function bool Parse(
Text textWithColor, BaseText textWithColor,
out Color resultingColor) out Color resultingColor)
{ {
local bool successfullyParsed; local bool successfullyParsed;
@ -1051,8 +1051,8 @@ public final function bool Parse(
* @return `true` if resolving was successful and false otherwise. * @return `true` if resolving was successful and false otherwise.
*/ */
public final function bool ResolveShortTagColor( public final function bool ResolveShortTagColor(
Text.Character shortTag, BaseText.Character shortTag,
out Color resultingColor) out Color resultingColor)
{ {
local int i; local int i;
if (shortTag.codePoint <= 0) { if (shortTag.codePoint <= 0) {

2
sources/Commands/BuiltInCommands/ACommandHelp.uc

@ -157,7 +157,7 @@ private final function PrintCommands(ConsoleWriter cout, Command.Data data)
private final function PrintSubCommand( private final function PrintSubCommand(
ConsoleWriter cout, ConsoleWriter cout,
SubCommand subCommand, SubCommand subCommand,
Text commandName) BaseText commandName)
{ {
// Command + parameters // Command + parameters
// Command name + sub command name // Command name + sub command name

10
sources/Commands/Command.uc

@ -24,7 +24,7 @@
* along with Acedia. If not, see <https://www.gnu.org/licenses/>. * along with Acedia. If not, see <https://www.gnu.org/licenses/>.
*/ */
class Command extends AcediaObject class Command extends AcediaObject
dependson(Text); dependson(BaseText);
/** /**
* Possible errors that can arise when parsing command parameters from * Possible errors that can arise when parsing command parameters from
@ -149,7 +149,7 @@ struct SubCommand
// Options are independent from sub-commands. // Options are independent from sub-commands.
struct Option struct Option
{ {
var Text.Character shortName; var BaseText.Character shortName;
var Text longName; var Text longName;
var Text description; var Text description;
// Option can also have their own parameters // Option can also have their own parameters
@ -550,12 +550,12 @@ private final function array<EPlayer> ParseTargets(
return targetPlayers; return targetPlayers;
} }
// TODO: This is a hack to insert new line symbol, // TODO: This is a hack to insert new line symbol,
// this needs to be redone in a better way // this needs to be redone in a better way
private final function Text.Character GetNewLine(Text.Formatting formatting) private final function BaseText.Character GetNewLine(
BaseText.Formatting formatting)
{ {
local Text.Character newLine; local BaseText.Character newLine;
newLine.codePoint = 10; newLine.codePoint = 10;
newLine.formatting = formatting; newLine.formatting = formatting;
return newLine; return newLine;

94
sources/Commands/CommandDataBuilder.uc

@ -95,7 +95,7 @@ protected function Finalizer()
// Find index of sub-command with a given name `name` in `subcommands`. // Find index of sub-command with a given name `name` in `subcommands`.
// `-1` if there's not sub-command with such name. // `-1` if there's not sub-command with such name.
// Case-sensitive. // Case-sensitive.
private final function int FindSubCommandIndex(Text name) private final function int FindSubCommandIndex(BaseText name)
{ {
local int i; local int i;
if (name == none) { if (name == none) {
@ -113,7 +113,7 @@ private final function int FindSubCommandIndex(Text name)
// Find index of option with a given name `name` in `options`. // Find index of option with a given name `name` in `options`.
// `-1` if there's not sub-command with such name. // `-1` if there's not sub-command with such name.
// Case-sensitive. // Case-sensitive.
private final function int FindOptionIndex(Text longName) private final function int FindOptionIndex(BaseText longName)
{ {
local int i; local int i;
if (longName == none) { if (longName == none) {
@ -132,7 +132,7 @@ private final function int FindOptionIndex(Text longName)
// name (long name) `name`. // name (long name) `name`.
// Doe not check whether subcommand/option with that name already exists. // Doe not check whether subcommand/option with that name already exists.
// Copies passed `name`, assumes that it is not `none`. // Copies passed `name`, assumes that it is not `none`.
private final function MakeEmptySelection(Text name, bool selectedOption) private final function MakeEmptySelection(BaseText name, bool selectedOption)
{ {
selectedItemIsOption = selectedOption; selectedItemIsOption = selectedOption;
selectedItemName = name.Copy(); selectedItemName = name.Copy();
@ -146,7 +146,7 @@ private final function MakeEmptySelection(Text name, bool selectedOption)
// creates new record in selection, otherwise copies previously saved data. // creates new record in selection, otherwise copies previously saved data.
// Automatically saves previously selected data into prepared data. // Automatically saves previously selected data into prepared data.
// Copies `name` if it has to create new record. // Copies `name` if it has to create new record.
private final function SelectSubCommand(Text name) private final function SelectSubCommand(BaseText name)
{ {
local int subcommandIndex; local int subcommandIndex;
if (name == none) return; if (name == none) return;
@ -181,7 +181,7 @@ private final function SelectSubCommand(Text name)
// creates new record in selection, otherwise copies previously saved data. // creates new record in selection, otherwise copies previously saved data.
// Automatically saves previously selected data into prepared data. // Automatically saves previously selected data into prepared data.
// Copies `name` if it has to create new record. // Copies `name` if it has to create new record.
private final function SelectOption(Text longName) private final function SelectOption(BaseText longName)
{ {
local int optionIndex; local int optionIndex;
if (longName == none) return; if (longName == none) return;
@ -293,7 +293,7 @@ private final function RecordSelectedOption()
* @return Returns the caller `CommandDataBuilder` to allow for * @return Returns the caller `CommandDataBuilder` to allow for
* method chaining. * method chaining.
*/ */
public final function CommandDataBuilder SubCommand(Text name) public final function CommandDataBuilder SubCommand(BaseText name)
{ {
SelectSubCommand(name); SelectSubCommand(name);
return self; return self;
@ -309,9 +309,9 @@ public final function CommandDataBuilder SubCommand(Text name)
// the option altogether. // the option altogether.
// Returns `none` if validation failed and chosen short name otherwise // Returns `none` if validation failed and chosen short name otherwise
// (if `shortName` was used for it - it's value will be copied). // (if `shortName` was used for it - it's value will be copied).
private final function Text.Character GetValidShortName( private final function BaseText.Character GetValidShortName(
Text longName, BaseText longName,
Text shortName) BaseText shortName)
{ {
// Validate `longName` // Validate `longName`
if (longName == none) { if (longName == none) {
@ -341,8 +341,8 @@ private final function Text.Character GetValidShortName(
// i.e. we cannot have several options with identical names: // i.e. we cannot have several options with identical names:
// (--silent, -s) and (--sick, -s). // (--silent, -s) and (--sick, -s).
private final function bool VerifyNoOptionNamingConflict( private final function bool VerifyNoOptionNamingConflict(
Text longName, BaseText longName,
Text.Character shortName) BaseText.Character shortName)
{ {
local int i; local int i;
// To make sure we will search through the up-to-date `options`, // To make sure we will search through the up-to-date `options`,
@ -397,11 +397,11 @@ private final function bool VerifyNoOptionNamingConflict(
* method chaining. * method chaining.
*/ */
public final function CommandDataBuilder Option( public final function CommandDataBuilder Option(
Text longName, BaseText longName,
optional Text shortName) optional BaseText shortName)
{ {
local int optionIndex; local int optionIndex;
local Text.Character shortNameAsCharacter; local BaseText.Character shortNameAsCharacter;
// Unlike for `SubCommand()`, we need to ensure that option naming is // Unlike for `SubCommand()`, we need to ensure that option naming is
// correct and does not conflict with existing options // correct and does not conflict with existing options
// (user might attempt to add two options with same long names and // (user might attempt to add two options with same long names and
@ -440,7 +440,7 @@ public final function CommandDataBuilder Option(
* @return Returns the caller `CommandDataBuilder` to allow for * @return Returns the caller `CommandDataBuilder` to allow for
* method chaining. * method chaining.
*/ */
public final function CommandDataBuilder Describe(Text description) public final function CommandDataBuilder Describe(BaseText description)
{ {
if (selectedDescription == description) { if (selectedDescription == description) {
return self; return self;
@ -459,7 +459,7 @@ public final function CommandDataBuilder Describe(Text description)
* @return Returns the caller `CommandDataBuilder` to allow for * @return Returns the caller `CommandDataBuilder` to allow for
* method chaining. * method chaining.
*/ */
public final function CommandDataBuilder Name(Text newName) public final function CommandDataBuilder Name(BaseText newName)
{ {
if (newName != none && newName == commandName) { if (newName != none && newName == commandName) {
return self; return self;
@ -481,7 +481,7 @@ public final function CommandDataBuilder Name(Text newName)
* @return Returns the caller `CommandDataBuilder` to allow for * @return Returns the caller `CommandDataBuilder` to allow for
* method chaining. * method chaining.
*/ */
public final function CommandDataBuilder Summary(Text newSummary) public final function CommandDataBuilder Summary(BaseText newSummary)
{ {
if (newSummary != none && newSummary == commandSummary) { if (newSummary != none && newSummary == commandSummary) {
return self; return self;
@ -561,10 +561,10 @@ private final function PushParameter(Command.Parameter newParameter)
// Fills `Command.ParameterType` struct with given values // Fills `Command.ParameterType` struct with given values
// (except boolean format). Assumes `displayName != none`. // (except boolean format). Assumes `displayName != none`.
private final function Command.Parameter NewParameter( private final function Command.Parameter NewParameter(
Text displayName, BaseText displayName,
Command.ParameterType parameterType, Command.ParameterType parameterType,
bool isListParameter, bool isListParameter,
optional Text variableName) optional BaseText variableName)
{ {
local Command.Parameter newParameter; local Command.Parameter newParameter;
newParameter.displayName = displayName.Copy(); newParameter.displayName = displayName.Copy();
@ -574,7 +574,7 @@ private final function Command.Parameter NewParameter(
newParameter.variableName = variableName.Copy(); newParameter.variableName = variableName.Copy();
} }
else { else {
newParameter.variableName = displayName; newParameter.variableName = displayName.Copy();
} }
return newParameter; return newParameter;
} }
@ -601,9 +601,9 @@ private final function Command.Parameter NewParameter(
* method chaining. * method chaining.
*/ */
public final function CommandDataBuilder ParamBoolean( public final function CommandDataBuilder ParamBoolean(
Text name, BaseText name,
optional Command.PreferredBooleanFormat format, optional Command.PreferredBooleanFormat format,
optional Text variableName) optional BaseText variableName)
{ {
local Command.Parameter newParam; local Command.Parameter newParam;
if (name == none) { if (name == none) {
@ -636,9 +636,9 @@ public final function CommandDataBuilder ParamBoolean(
* method chaining. * method chaining.
*/ */
public final function CommandDataBuilder ParamBooleanList( public final function CommandDataBuilder ParamBooleanList(
Text name, BaseText name,
optional Command.PreferredBooleanFormat format, optional Command.PreferredBooleanFormat format,
optional Text variableName) optional BaseText variableName)
{ {
local Command.Parameter newParam; local Command.Parameter newParam;
if (name == none) { if (name == none) {
@ -667,8 +667,8 @@ public final function CommandDataBuilder ParamBooleanList(
* method chaining. * method chaining.
*/ */
public final function CommandDataBuilder ParamInteger( public final function CommandDataBuilder ParamInteger(
Text name, BaseText name,
optional Text variableName) optional BaseText variableName)
{ {
if (name == none) { if (name == none) {
return self; return self;
@ -694,8 +694,8 @@ public final function CommandDataBuilder ParamInteger(
* method chaining. * method chaining.
*/ */
public final function CommandDataBuilder ParamIntegerList( public final function CommandDataBuilder ParamIntegerList(
Text name, BaseText name,
optional Text variableName) optional BaseText variableName)
{ {
if (name == none) { if (name == none) {
return self; return self;
@ -721,8 +721,8 @@ public final function CommandDataBuilder ParamIntegerList(
* method chaining. * method chaining.
*/ */
public final function CommandDataBuilder ParamNumber( public final function CommandDataBuilder ParamNumber(
Text name, BaseText name,
optional Text variableName) optional BaseText variableName)
{ {
if (name == none) { if (name == none) {
return self; return self;
@ -748,8 +748,8 @@ public final function CommandDataBuilder ParamNumber(
* method chaining. * method chaining.
*/ */
public final function CommandDataBuilder ParamNumberList( public final function CommandDataBuilder ParamNumberList(
Text name, BaseText name,
optional Text variableName) optional BaseText variableName)
{ {
if (name == none) { if (name == none) {
return self; return self;
@ -775,8 +775,8 @@ public final function CommandDataBuilder ParamNumberList(
* method chaining. * method chaining.
*/ */
public final function CommandDataBuilder ParamText( public final function CommandDataBuilder ParamText(
Text name, BaseText name,
optional Text variableName) optional BaseText variableName)
{ {
if (name == none) { if (name == none) {
return self; return self;
@ -802,8 +802,8 @@ public final function CommandDataBuilder ParamText(
* method chaining. * method chaining.
*/ */
public final function CommandDataBuilder ParamTextList( public final function CommandDataBuilder ParamTextList(
Text name, BaseText name,
optional Text variableName) optional BaseText variableName)
{ {
if (name == none) { if (name == none) {
return self; return self;
@ -829,8 +829,8 @@ public final function CommandDataBuilder ParamTextList(
* method chaining. * method chaining.
*/ */
public final function CommandDataBuilder ParamRemainder( public final function CommandDataBuilder ParamRemainder(
Text name, BaseText name,
optional Text variableName) optional BaseText variableName)
{ {
if (name == none) { if (name == none) {
return self; return self;
@ -856,8 +856,8 @@ public final function CommandDataBuilder ParamRemainder(
* method chaining. * method chaining.
*/ */
public final function CommandDataBuilder ParamObject( public final function CommandDataBuilder ParamObject(
Text name, BaseText name,
optional Text variableName) optional BaseText variableName)
{ {
if (name == none) { if (name == none) {
return self; return self;
@ -883,8 +883,8 @@ public final function CommandDataBuilder ParamObject(
* method chaining. * method chaining.
*/ */
public final function CommandDataBuilder ParamObjectList( public final function CommandDataBuilder ParamObjectList(
Text name, BaseText name,
optional Text variableName) optional BaseText variableName)
{ {
if (name == none) { if (name == none) {
return self; return self;
@ -910,8 +910,8 @@ public final function CommandDataBuilder ParamObjectList(
* method chaining. * method chaining.
*/ */
public final function CommandDataBuilder ParamArray( public final function CommandDataBuilder ParamArray(
Text name, BaseText name,
optional Text variableName) optional BaseText variableName)
{ {
if (name == none) { if (name == none) {
return self; return self;
@ -937,8 +937,8 @@ public final function CommandDataBuilder ParamArray(
* method chaining. * method chaining.
*/ */
public final function CommandDataBuilder ParamArrayList( public final function CommandDataBuilder ParamArrayList(
Text name, BaseText name,
optional Text variableName) optional BaseText variableName)
{ {
if (name == none) { if (name == none) {
return self; return self;

8
sources/Commands/CommandParser.uc

@ -141,7 +141,7 @@ private final function Reset()
// Auxiliary method for recording errors // Auxiliary method for recording errors
private final function DeclareError( private final function DeclareError(
Command.ErrorType type, Command.ErrorType type,
optional Text cause) optional BaseText cause)
{ {
nextResult.parsingError = type; nextResult.parsingError = type;
if (cause != none) { if (cause != none) {
@ -764,9 +764,9 @@ private final function bool ParseShortOption()
// `nextError.DeclareError()` call, so you can use `nextResult.IsSuccessful()` // `nextError.DeclareError()` call, so you can use `nextResult.IsSuccessful()`
// to check if method has failed. // to check if method has failed.
private final function bool AddOptionByCharacter( private final function bool AddOptionByCharacter(
Text.Character optionCharacter, BaseText.Character optionCharacter,
Text optionSourceList, BaseText optionSourceList,
bool forbidOptionWithParameters) bool forbidOptionWithParameters)
{ {
local int i; local int i;
local bool optionHasParameters; local bool optionHasParameters;

2
sources/Commands/Commands.uc

@ -44,7 +44,7 @@ protected function FromData(AssociativeArray source)
} }
useChatInput = source.GetBool(P("useChatInput")); useChatInput = source.GetBool(P("useChatInput"));
useMutateInput = source.GetBool(P("useMutateInput")); useMutateInput = source.GetBool(P("useMutateInput"));
newChatPrefix = source.GetText(P("chatCommandPrefix")); newChatPrefix = source.GetText(P("chatCommandPrefix"));
chatCommandPrefix = "!"; chatCommandPrefix = "!";
if (newChatPrefix != none) { if (newChatPrefix != none) {
chatCommandPrefix = newChatPrefix.ToString(); chatCommandPrefix = newChatPrefix.ToString();

2
sources/Commands/Commands_Feature.uc

@ -185,7 +185,7 @@ public final function RemoveCommand(class<Command> commandClass)
* @return Command, registered with a given name `commandName`. * @return Command, registered with a given name `commandName`.
* If no command with such name was registered - returns `none`. * If no command with such name was registered - returns `none`.
*/ */
public final function Command GetCommand(Text commandName) public final function Command GetCommand(BaseText commandName)
{ {
local Text commandNameLowerCase; local Text commandNameLowerCase;
local Command commandInstance; local Command commandInstance;

10
sources/Commands/PlayersParser.uc

@ -153,7 +153,7 @@ private final function RemoveByKey(int key)
} }
// Adds all the players with specified name (`name`) to the current selection. // Adds all the players with specified name (`name`) to the current selection.
private final function AddByName(Text name) private final function AddByName(BaseText name)
{ {
local int i; local int i;
local Text nextPlayerName; local Text nextPlayerName;
@ -170,7 +170,7 @@ private final function AddByName(Text name)
// Removes all the players with specified name (`name`) from // Removes all the players with specified name (`name`) from
// the current selection. // the current selection.
private final function RemoveByName(Text name) private final function RemoveByName(BaseText name)
{ {
local int i; local int i;
local Text nextPlayerName; local Text nextPlayerName;
@ -216,7 +216,7 @@ private final function RemoveAdmins()
// Add all the players specified by `macroText` (from macro "@<macroText>"). // Add all the players specified by `macroText` (from macro "@<macroText>").
// Does nothing if there is no such macro. // Does nothing if there is no such macro.
private final function AddByMacro(Text macroText) private final function AddByMacro(BaseText macroText)
{ {
if (macroText.Compare(T(TADMIN), SCASE_INSENSITIVE)) if (macroText.Compare(T(TADMIN), SCASE_INSENSITIVE))
{ {
@ -239,7 +239,7 @@ private final function AddByMacro(Text macroText)
// Removes all the players specified by `macroText` // Removes all the players specified by `macroText`
// (from macro "@<macroText>"). // (from macro "@<macroText>").
// Does nothing if there is no such macro. // Does nothing if there is no such macro.
private final function RemoveByMacro(Text macroText) private final function RemoveByMacro(BaseText macroText)
{ {
local int i; local int i;
if (macroText.Compare(T(TADMIN), SCASE_INSENSITIVE)) if (macroText.Compare(T(TADMIN), SCASE_INSENSITIVE))
@ -478,7 +478,7 @@ private final function Reset()
* @param toParse `Text` from which to parse player list. * @param toParse `Text` from which to parse player list.
* @return `true` if parsing was successful and `false` otherwise. * @return `true` if parsing was successful and `false` otherwise.
*/ */
public final function bool Parse(Text toParse) public final function bool Parse(BaseText toParse)
{ {
local bool wasSuccessful; local bool wasSuccessful;
local Parser parser; local Parser parser;

12
sources/Config/AcediaConfig.uc

@ -153,7 +153,7 @@ private static function string NameToActualVersion(string configObjectName)
* @return `false` iff config object name `name` already existed * @return `false` iff config object name `name` already existed
* or `name` is invalid for config object. * or `name` is invalid for config object.
*/ */
public final static function bool NewConfig(Text name) public final static function bool NewConfig(BaseText name)
{ {
local AcediaConfig newConfig; local AcediaConfig newConfig;
if (name == none) return false; if (name == none) return false;
@ -186,7 +186,7 @@ public final static function bool NewConfig(Text name)
* and dot ('.') character. * and dot ('.') character.
* @return `true` iff new config object was created. * @return `true` iff new config object was created.
*/ */
public final static function bool Exists(Text name) public final static function bool Exists(BaseText name)
{ {
local bool result; local bool result;
if (name == none) return false; if (name == none) return false;
@ -214,7 +214,7 @@ public final static function bool Exists(Text name)
* Case-insensitive, must contain only ASCII latin letters, digits * Case-insensitive, must contain only ASCII latin letters, digits
* and dot ('.') character. * and dot ('.') character.
*/ */
public final static function DeleteConfig(Text name) public final static function DeleteConfig(BaseText name)
{ {
local AssociativeArray.Entry entry; local AssociativeArray.Entry entry;
if (default.existingConfigs == none) { if (default.existingConfigs == none) {
@ -250,7 +250,7 @@ public static function array<Text> AvailableConfigs()
* digits and dot ('.') character. * digits and dot ('.') character.
* @return `AcediaConfig` of caller class with name `name`. * @return `AcediaConfig` of caller class with name `name`.
*/ */
public final static function AcediaConfig GetConfigInstance(Text name) public final static function AcediaConfig GetConfigInstance(BaseText name)
{ {
local AssociativeArray.Entry configEntry; local AssociativeArray.Entry configEntry;
if (name == none) return none; if (name == none) return none;
@ -286,7 +286,7 @@ public final static function AcediaConfig GetConfigInstance(Text name)
* For correctly implemented config objects should only return `none` if * For correctly implemented config objects should only return `none` if
* their class was not yet initialized (see `self.Initialize()` method). * their class was not yet initialized (see `self.Initialize()` method).
*/ */
public final static function AssociativeArray LoadData(Text name) public final static function AssociativeArray LoadData(BaseText name)
{ {
local AssociativeArray result; local AssociativeArray result;
local AcediaConfig requiredConfig; local AcediaConfig requiredConfig;
@ -311,7 +311,7 @@ public final static function AssociativeArray LoadData(Text name)
* allows for JSON deserialization (see `JSONAPI.IsCompatible()` for * allows for JSON deserialization (see `JSONAPI.IsCompatible()` for
* details). * details).
*/ */
public final static function SaveData(Text name, AssociativeArray data) public final static function SaveData(BaseText name, AssociativeArray data)
{ {
local AcediaConfig requiredConfig; local AcediaConfig requiredConfig;
requiredConfig = GetConfigInstance(name); requiredConfig = GetConfigInstance(name);

21
sources/Console/ConsoleBuffer.uc

@ -21,7 +21,7 @@
* along with Acedia. If not, see <https://www.gnu.org/licenses/>. * along with Acedia. If not, see <https://www.gnu.org/licenses/>.
*/ */
class ConsoleBuffer extends AcediaObject class ConsoleBuffer extends AcediaObject
dependson(Text) dependson(BaseText)
dependson(ConsoleAPI); dependson(ConsoleAPI);
/** /**
@ -177,10 +177,10 @@ public final function ConsoleBuffer Clear()
* @param inputType How to treat given `string` regarding coloring. * @param inputType How to treat given `string` regarding coloring.
* @return Returns caller `ConsoleBuffer` to allow method chaining. * @return Returns caller `ConsoleBuffer` to allow method chaining.
*/ */
public final function ConsoleBuffer Insert(Text input) public final function ConsoleBuffer Insert(BaseText input)
{ {
local int inputConsumed; local int inputConsumed;
local Text.Character nextCharacter; local BaseText.Character nextCharacter;
if (input == none) { if (input == none) {
return self; return self;
} }
@ -249,11 +249,11 @@ public final function ConsoleBuffer Flush()
// It is assumed that passed characters are not whitespace, - // It is assumed that passed characters are not whitespace, -
// responsibility to check is on the one calling this method. // responsibility to check is on the one calling this method.
private final function InsertIntoWordBuffer(Text.Character newCharacter) private final function InsertIntoWordBuffer(BaseText.Character newCharacter)
{ {
local int newCharacterIndex; local int newCharacterIndex;
local Text.Formatting newFormatting; local BaseText.Formatting newFormatting;
local Color oldColor, newColor; local Color oldColor, newColor;
// Fix text color in the buffer to remember default color, if we use it. // Fix text color in the buffer to remember default color, if we use it.
newFormatting = _.text.GetCharacterFormatting(newCharacter); newFormatting = _.text.GetCharacterFormatting(newCharacter);
newFormatting.color = newFormatting.color =
@ -336,7 +336,7 @@ private final function bool CanAppendWhitespaceIntoLine()
} }
private final function bool CanAppendNonWhitespaceIntoLine( private final function bool CanAppendNonWhitespaceIntoLine(
Text.Character nextCharacter) BaseText.Character nextCharacter)
{ {
// We always allow to insert at least something into empty line, // We always allow to insert at least something into empty line,
// otherwise we can never insert it anywhere // otherwise we can never insert it anywhere
@ -357,7 +357,8 @@ private final function bool CanAppendNonWhitespaceIntoLine(
// For performance reasons assumes that passed character is a whitespace, // For performance reasons assumes that passed character is a whitespace,
// the burden of checking is on the caller. // the burden of checking is on the caller.
private final function AppendWhitespaceToCurrentLine(Text.Character whitespace) private final function AppendWhitespaceToCurrentLine(
BaseText.Character whitespace)
{ {
if (_.text.IsCodePoint(whitespace, CODEPOINT_NEWLINE)) { if (_.text.IsCodePoint(whitespace, CODEPOINT_NEWLINE)) {
BreakLine(false); BreakLine(false);

8
sources/Console/ConsoleWriter.uc

@ -505,7 +505,7 @@ public final function ConsoleWriter Flush()
* @param message `Text` to output. * @param message `Text` to output.
* @return Returns caller `ConsoleWriter` to allow for method chaining. * @return Returns caller `ConsoleWriter` to allow for method chaining.
*/ */
public final function ConsoleWriter Write(optional Text message) public final function ConsoleWriter Write(optional BaseText message)
{ {
outputBuffer.Insert(message); outputBuffer.Insert(message);
if (needToResetColor) { if (needToResetColor) {
@ -521,7 +521,7 @@ public final function ConsoleWriter Write(optional Text message)
* @param message `Text` to output. * @param message `Text` to output.
* @return Returns caller `ConsoleWriter` to allow for method chaining. * @return Returns caller `ConsoleWriter` to allow for method chaining.
*/ */
public final function ConsoleWriter WriteLine(optional Text message) public final function ConsoleWriter WriteLine(optional BaseText message)
{ {
return Write(message).Flush(); return Write(message).Flush();
} }
@ -538,7 +538,7 @@ public final function ConsoleWriter WriteLine(optional Text message)
* @param message `Text` to output. * @param message `Text` to output.
* @return Returns caller `ConsoleWriter` to allow for method chaining. * @return Returns caller `ConsoleWriter` to allow for method chaining.
*/ */
public final function ConsoleWriter WriteBlock(optional Text message) public final function ConsoleWriter WriteBlock(optional BaseText message)
{ {
outputBuffer.Insert(message).Flush(); outputBuffer.Insert(message).Flush();
SendBuffer(true); SendBuffer(true);
@ -558,7 +558,7 @@ public final function ConsoleWriter WriteBlock(optional Text message)
* @param message `Text` to output. * @param message `Text` to output.
* @return Returns caller `ConsoleWriter` to allow for method chaining. * @return Returns caller `ConsoleWriter` to allow for method chaining.
*/ */
public final function ConsoleWriter Say(optional Text message) public final function ConsoleWriter Say(optional BaseText message)
{ {
outputBuffer.Insert(message).Flush(); outputBuffer.Insert(message).Flush();
SendBuffer(, true); SendBuffer(, true);

2
sources/Data/Collections/AssociativeArray.uc

@ -669,7 +669,7 @@ public final function Entry GetEntryByIndex(Index index)
return hashTable[index.bucketIndex].entries[index.entryIndex]; return hashTable[index.bucketIndex].entries[index.entryIndex];
} }
protected function AcediaObject GetByText(Text key) protected function AcediaObject GetByText(BaseText key)
{ {
return GetItem(key); return GetItem(key);
} }

18
sources/Data/Collections/Collection.uc

@ -36,7 +36,7 @@ var protected class<Iter> iteratorClass;
* this method (i.e. `AssociativeArray` only lets you access values with * this method (i.e. `AssociativeArray` only lets you access values with
* `Text` keys). * `Text` keys).
*/ */
protected function AcediaObject GetByText(Text key); protected function AcediaObject GetByText(BaseText key);
/** /**
* Creates an `Iterator` instance to iterate over stored items. * Creates an `Iterator` instance to iterate over stored items.
@ -166,7 +166,7 @@ public final function AcediaObject GetItemByJSON(JSONPointer jsonPointer)
* @return An item `jsonPointerAsText` is referring to (according to the above * @return An item `jsonPointerAsText` is referring to (according to the above
* stated rules). `none` if such item does not exist. * stated rules). `none` if such item does not exist.
*/ */
public final function AcediaObject GetItemBy(Text jsonPointerAsText) public final function AcediaObject GetItemBy(BaseText jsonPointerAsText)
{ {
local AcediaObject result; local AcediaObject result;
local JSONPointer jsonPointer; local JSONPointer jsonPointer;
@ -196,7 +196,7 @@ public final function AcediaObject GetItemBy(Text jsonPointerAsText)
* is missing or has a different type. * is missing or has a different type.
*/ */
public final function bool GetBoolBy( public final function bool GetBoolBy(
Text jsonPointerAsText, BaseText jsonPointerAsText,
optional bool defaultValue) optional bool defaultValue)
{ {
local AcediaObject result; local AcediaObject result;
@ -234,7 +234,7 @@ public final function bool GetBoolBy(
* is missing or has a different type. * is missing or has a different type.
*/ */
public final function byte GetByteBy( public final function byte GetByteBy(
Text jsonPointerAsText, BaseText jsonPointerAsText,
optional byte defaultValue) optional byte defaultValue)
{ {
local AcediaObject result; local AcediaObject result;
@ -272,7 +272,7 @@ public final function byte GetByteBy(
* is missing or has a different type. * is missing or has a different type.
*/ */
public final function int GetIntBy( public final function int GetIntBy(
Text jsonPointerAsText, BaseText jsonPointerAsText,
optional int defaultValue) optional int defaultValue)
{ {
local AcediaObject result; local AcediaObject result;
@ -310,7 +310,7 @@ public final function int GetIntBy(
* is missing or has a different type. * is missing or has a different type.
*/ */
public final function float GetFloatBy( public final function float GetFloatBy(
Text jsonPointerAsText, BaseText jsonPointerAsText,
optional float defaultValue) optional float defaultValue)
{ {
local AcediaObject result; local AcediaObject result;
@ -344,7 +344,7 @@ public final function float GetFloatBy(
* @return `Text` value, stored at `jsonPointerAsText` or `none` if it * @return `Text` value, stored at `jsonPointerAsText` or `none` if it
* is missing or has a different type. * is missing or has a different type.
*/ */
public final function Text GetTextBy(Text jsonPointerAsText) public final function Text GetTextBy(BaseText jsonPointerAsText)
{ {
return Text(GetItemBy(jsonPointerAsText)); return Text(GetItemBy(jsonPointerAsText));
} }
@ -364,7 +364,7 @@ public final function Text GetTextBy(Text jsonPointerAsText)
* `none` if it is missing or has a different type. * `none` if it is missing or has a different type.
*/ */
public final function AssociativeArray GetAssociativeArrayBy( public final function AssociativeArray GetAssociativeArrayBy(
Text jsonPointerAsText) BaseText jsonPointerAsText)
{ {
return AssociativeArray(GetItemBy(jsonPointerAsText)); return AssociativeArray(GetItemBy(jsonPointerAsText));
} }
@ -383,7 +383,7 @@ public final function AssociativeArray GetAssociativeArrayBy(
* @return `DynamicArray` value, stored at `jsonPointerAsText` or * @return `DynamicArray` value, stored at `jsonPointerAsText` or
* `none` if it is missing or has a different type. * `none` if it is missing or has a different type.
*/ */
public final function DynamicArray GetDynamicArrayBy(Text jsonPointerAsText) public final function DynamicArray GetDynamicArrayBy(BaseText jsonPointerAsText)
{ {
return DynamicArray(GetItemBy(jsonPointerAsText)); return DynamicArray(GetItemBy(jsonPointerAsText));
} }

2
sources/Data/Collections/DynamicArray.uc

@ -479,7 +479,7 @@ public final function int Find(AcediaObject item)
return -1; return -1;
} }
protected function AcediaObject GetByText(Text key) protected function AcediaObject GetByText(BaseText key)
{ {
local int index, consumed; local int index, consumed;
local Parser parser; local Parser parser;

14
sources/Data/Database/DBAPI.uc

@ -51,7 +51,7 @@ private final function CreateLocalDBMapIfMissing()
* @param databaseLink Link from which to extract database's name. * @param databaseLink Link from which to extract database's name.
* @return Database named "<db_name>" of type "<type>" from the `databaseLink`. * @return Database named "<db_name>" of type "<type>" from the `databaseLink`.
*/ */
public final function Database Load(Text databaseLink) public final function Database Load(BaseText databaseLink)
{ {
local Parser parser; local Parser parser;
local Database result; local Database result;
@ -94,7 +94,7 @@ public final function Database Load(Text databaseLink)
* Guaranteed to not be `none` if provided argument `databaseLink` * Guaranteed to not be `none` if provided argument `databaseLink`
* is not `none`. * is not `none`.
*/ */
public final function JSONPointer GetPointer(Text databaseLink) public final function JSONPointer GetPointer(BaseText databaseLink)
{ {
local int slashIndex; local int slashIndex;
local Text textPointer; local Text textPointer;
@ -122,7 +122,7 @@ public final function JSONPointer GetPointer(Text databaseLink)
* @param databaseName Name for the new database. * @param databaseName Name for the new database.
* @return Reference to created database. Returns `none` iff method failed. * @return Reference to created database. Returns `none` iff method failed.
*/ */
public final function LocalDatabaseInstance NewLocal(Text databaseName) public final function LocalDatabaseInstance NewLocal(BaseText databaseName)
{ {
local DBRecord rootRecord; local DBRecord rootRecord;
local Text rootRecordName; local Text rootRecordName;
@ -158,7 +158,7 @@ public final function LocalDatabaseInstance NewLocal(Text databaseName)
* @param databaseName Name of the database to load. * @param databaseName Name of the database to load.
* @return Loaded local database. `none` if it does not exist. * @return Loaded local database. `none` if it does not exist.
*/ */
public final function LocalDatabaseInstance LoadLocal(Text databaseName) public final function LocalDatabaseInstance LoadLocal(BaseText databaseName)
{ {
local DBRecord rootRecord; local DBRecord rootRecord;
local Text rootRecordName; local Text rootRecordName;
@ -209,7 +209,7 @@ public final function LocalDatabaseInstance LoadLocal(Text databaseName)
* @param databaseName Name of the database to check. * @param databaseName Name of the database to check.
* @return `true` if database with specified name exists and `false` otherwise. * @return `true` if database with specified name exists and `false` otherwise.
*/ */
public final function bool ExistsLocal(Text databaseName) public final function bool ExistsLocal(BaseText databaseName)
{ {
return LoadLocal(databaseName) != none; return LoadLocal(databaseName) != none;
} }
@ -221,7 +221,7 @@ public final function bool ExistsLocal(Text databaseName)
* @return `true` if database with specified name existed and was deleted and * @return `true` if database with specified name existed and was deleted and
* `false` otherwise. * `false` otherwise.
*/ */
public final function bool DeleteLocal(Text databaseName) public final function bool DeleteLocal(BaseText databaseName)
{ {
local LocalDatabase localDatabaseConfig; local LocalDatabase localDatabaseConfig;
local LocalDatabaseInstance localDatabase; local LocalDatabaseInstance localDatabase;
@ -250,7 +250,7 @@ public final function bool DeleteLocal(Text databaseName)
return false; return false;
} }
private function EraseAllPackageData(Text packageToErase) private function EraseAllPackageData(BaseText packageToErase)
{ {
local int i; local int i;
local string packageName; local string packageName;

6
sources/Data/Database/Local/DBRecord.uc

@ -266,7 +266,7 @@ public static final function Global __()
* @return New `DBRecord`, created in specified package. * @return New `DBRecord`, created in specified package.
* `none` iff `dbPackageName == none`. * `none` iff `dbPackageName == none`.
*/ */
public final static function DBRecord NewRecord(Text dbPackageName) public final static function DBRecord NewRecord(BaseText dbPackageName)
{ {
if (dbPackageName == none) { if (dbPackageName == none) {
return none; return none;
@ -303,8 +303,8 @@ private final static function DBRecord NewRecordFor(string dbPackageName)
} }
public final static function DBRecord LoadRecord( public final static function DBRecord LoadRecord(
Text recordName, BaseText recordName,
Text dbPackageName) BaseText dbPackageName)
{ {
if (dbPackageName == none) return none; if (dbPackageName == none) return none;
if (recordName == none) return none; if (recordName == none) return none;

4
sources/Data/Database/Local/LocalDatabase.uc

@ -48,7 +48,7 @@ public final function Text GetRootName()
* *
* Only makes changes if root is not already defined. * Only makes changes if root is not already defined.
*/ */
public final function SetRootName(Text rootName) public final function SetRootName(BaseText rootName)
{ {
if (HasDefinedRoot()) { if (HasDefinedRoot()) {
return; return;
@ -61,7 +61,7 @@ public final function SetRootName(Text rootName)
} }
} }
public final static function LocalDatabase Load(Text databaseName) public final static function LocalDatabase Load(BaseText databaseName)
{ {
if (!__().text.IsEmpty(databaseName)) { if (!__().text.IsEmpty(databaseName)) {
return new(none, databaseName.ToString()) class'LocalDatabase'; return new(none, databaseName.ToString()) class'LocalDatabase';

2
sources/Data/Database/Tests/TEST_LocalDatabase.uc

@ -1000,7 +1000,7 @@ protected static function SubTest_IncrementString(LocalDatabaseInstance db)
TEST_ExpectTrue( TEST_ExpectTrue(
Text(default.resultObject).ToString() == "simpleValue!"); Text(default.resultObject).ToString() == "simpleValue!");
task = db.IncrementData(__().json.Pointer(P("/A")), task = db.IncrementData(__().json.Pointer(P("/A")),
__().text.FromStringM("?")); __().text.FromString("?"));
task.connect = DBIncrementHandler; task.connect = DBIncrementHandler;
task.TryCompleting(); task.TryCompleting();
TEST_ExpectTrue(default.resultType == DBR_Success); TEST_ExpectTrue(default.resultType == DBR_Success);

15
sources/Features/Feature.uc

@ -138,8 +138,9 @@ protected function Finalizer()
* *
* @param newConfigName Name of the config to apply to the caller `Feature`. * @param newConfigName Name of the config to apply to the caller `Feature`.
*/ */
private final function ApplyConfig(Text newConfigName) private final function ApplyConfig(BaseText newConfigName)
{ {
local Text configNameCopy;
local FeatureConfig newConfig; local FeatureConfig newConfig;
if (newConfigName == none) { if (newConfigName == none) {
return; return;
@ -150,17 +151,17 @@ private final function ApplyConfig(Text newConfigName)
{ {
_.logger.Auto(errorBadConfigData).ArgClass(class); _.logger.Auto(errorBadConfigData).ArgClass(class);
// Fallback to "default" config // Fallback to "default" config
newConfigName = _.text.FromString(defaultConfigName); configNameCopy = _.text.FromString(defaultConfigName);
configClass.static.NewConfig(newConfigName); configClass.static.NewConfig(configNameCopy);
newConfig = newConfig =
FeatureConfig(configClass.static.GetConfigInstance(newConfigName)); FeatureConfig(configClass.static.GetConfigInstance(configNameCopy));
} }
else { else {
newConfigName = newConfigName.Copy(); configNameCopy = newConfigName.Copy();
} }
SwapConfig(newConfig); SwapConfig(newConfig);
_.memory.Free(currentConfigName); _.memory.Free(currentConfigName);
currentConfigName = newConfigName; currentConfigName = configNameCopy;
} }
/** /**
@ -258,7 +259,7 @@ public static final function bool IsEnabled()
* Passing `none` will make caller `Feature` use "default" config. * Passing `none` will make caller `Feature` use "default" config.
* @return Active instance of the caller `Feature` class. * @return Active instance of the caller `Feature` class.
*/ */
public static final function Feature EnableMe(Text configName) public static final function Feature EnableMe(BaseText configName)
{ {
local Feature myInstance; local Feature myInstance;
if (configName == none) { if (configName == none) {

2
sources/Features/FeatureConfig.uc

@ -97,7 +97,7 @@ public static function Text GetAutoEnabledConfig()
* @return `true` iff some config was set to be used when it's `Feature` is * @return `true` iff some config was set to be used when it's `Feature` is
* auto-enabled, even if the same config was already configured to be used. * auto-enabled, even if the same config was already configured to be used.
*/ */
public static function bool SetAutoEnabledConfig(Text autoEnabledConfigName) public static function bool SetAutoEnabledConfig(BaseText autoEnabledConfigName)
{ {
local int i; local int i;
local array<Text> names; local array<Text> names;

4
sources/Gameplay/BaseClasses/Frontend/Templates/ATemplatesComponent.uc

@ -31,7 +31,7 @@ class ATemplatesComponent extends AcediaObject
* @return `true` if list named `listName` exists and `false` otherwise. * @return `true` if list named `listName` exists and `false` otherwise.
* Always returns `false` if `listName` equals `none`. * Always returns `false` if `listName` equals `none`.
*/ */
public function bool ItemListExists(Text listName) public function bool ItemListExists(BaseText listName)
{ {
return false; return false;
} }
@ -54,7 +54,7 @@ public function bool ItemListExists(Text listName)
* When incorrect `listName` is specified - empty array is returned * When incorrect `listName` is specified - empty array is returned
* (which can also happen if specified list is empty). * (which can also happen if specified list is empty).
*/ */
public function array<Text> GetItemList(Text listName) public function array<Text> GetItemList(BaseText listName)
{ {
local array<Text> emptyArray; local array<Text> emptyArray;
return emptyArray; return emptyArray;

2
sources/Gameplay/BaseClasses/KillingFloor/Frontend/KFFrontend.uc

@ -46,7 +46,7 @@ protected function Finalizer()
* `none` if item template with given name does not exist or passed * `none` if item template with given name does not exist or passed
* `templateName` is equal to `none`. * `templateName` is equal to `none`.
*/ */
public function EItemTemplateInfo GetItemTemplateInfo(Text templateName) public function EItemTemplateInfo GetItemTemplateInfo(BaseText templateName)
{ {
return none; return none;
} }

2
sources/Gameplay/BaseClasses/KillingFloor/Frontend/Trading/ATradingComponent.uc

@ -100,7 +100,7 @@ public function array<ETrader> GetTraders();
* @return `ETrader` with a given `traderName`. `none` if either `traderName` * @return `ETrader` with a given `traderName`. `none` if either `traderName`
* is `none` or there is no trader with such a name. * is `none` or there is no trader with such a name.
*/ */
public function ETrader GetTrader(Text traderName); public function ETrader GetTrader(BaseText traderName);
/** /**
* Checks whether trading is currently active. * Checks whether trading is currently active.

2
sources/Gameplay/BaseClasses/KillingFloor/Frontend/Trading/ETrader.uc

@ -60,7 +60,7 @@ public function Text GetName();
* @param newName New name of the caller trader. * @param newName New name of the caller trader.
* @return `true` if trader is currently enabled and `false` otherwise. * @return `true` if trader is currently enabled and `false` otherwise.
*/ */
public function ETrader SetName(Text newName); public function ETrader SetName(BaseText newName);
/** /**
* Checks if caller trader is currently enabled. * Checks if caller trader is currently enabled.

2
sources/Gameplay/KF1Frontend/BaseImplementation/EKFAmmo.uc

@ -121,7 +121,7 @@ public function array<Text> GetTags()
return tagArray; return tagArray;
} }
public function bool HasTag(Text tagToCheck) public function bool HasTag(BaseText tagToCheck)
{ {
if (tagToCheck == none) return false; if (tagToCheck == none) return false;
if (tagToCheck.Compare(P("ammo"))) return true; if (tagToCheck.Compare(P("ammo"))) return true;

2
sources/Gameplay/KF1Frontend/BaseImplementation/EKFFlashlightAmmo.uc

@ -121,7 +121,7 @@ public function array<Text> GetTags()
return tagArray; return tagArray;
} }
public function bool HasTag(Text tagToCheck) public function bool HasTag(BaseText tagToCheck)
{ {
if (tagToCheck == none) return false; if (tagToCheck == none) return false;
if (tagToCheck.Compare(P("ammo"))) return true; if (tagToCheck.Compare(P("ammo"))) return true;

16
sources/Gameplay/KF1Frontend/BaseImplementation/EKFInventory.uc

@ -310,7 +310,7 @@ public function EItem Add(EItem newItem, optional bool forceAddition)
* and can fail adding an item even if `CanAddTemplate()` succeeded. * and can fail adding an item even if `CanAddTemplate()` succeeded.
*/ */
public function EItem AddTemplate( public function EItem AddTemplate(
Text newItemTemplate, BaseText newItemTemplate,
optional bool forceAddition) optional bool forceAddition)
{ {
local Pawn pawn; local Pawn pawn;
@ -399,7 +399,7 @@ public function Text CanAddExplain(
* and can raise "faulty implementation" error in case it cannot. * and can raise "faulty implementation" error in case it cannot.
*/ */
public function Text CanAddTemplateExplain( public function Text CanAddTemplateExplain(
Text itemTemplateToCheck, BaseText itemTemplateToCheck,
optional bool forceAddition) optional bool forceAddition)
{ {
local class<Inventory> inventoryClass; local class<Inventory> inventoryClass;
@ -614,7 +614,7 @@ public function bool Remove(
* added by other mods) items. * added by other mods) items.
*/ */
public function bool RemoveTemplate( public function bool RemoveTemplate(
Text template, BaseText template,
optional bool keepItem, optional bool keepItem,
optional bool forceRemoval, optional bool forceRemoval,
optional bool removeAll) optional bool removeAll)
@ -962,7 +962,7 @@ public function bool Contains(EItem itemToCheck)
return false; return false;
} }
public function bool ContainsTemplate(Text itemTemplateToCheck) public function bool ContainsTemplate(BaseText itemTemplateToCheck)
{ {
local bool success; local bool success;
local EItem templateItem; local EItem templateItem;
@ -1100,7 +1100,7 @@ public function array<EItem> GetItemsSupporting(class<EItem> interfaceClass)
return GetItemsByFlags(getWeapon, getAmmo, false); return GetItemsByFlags(getWeapon, getAmmo, false);
} }
public function array<EItem> GetTagItems(Text tag) public function array<EItem> GetTagItems(BaseText tag)
{ {
local array<EItem> emptyArray; local array<EItem> emptyArray;
local bool getWeapon, getAmmo; local bool getWeapon, getAmmo;
@ -1112,7 +1112,7 @@ public function array<EItem> GetTagItems(Text tag)
return GetItemsByFlags(getWeapon, getAmmo, false); return GetItemsByFlags(getWeapon, getAmmo, false);
} }
public function EItem GetTagItem(Text tag) public function EItem GetTagItem(BaseText tag)
{ {
local bool getWeapon, getAmmo; local bool getWeapon, getAmmo;
if (tag == none) { if (tag == none) {
@ -1123,7 +1123,7 @@ public function EItem GetTagItem(Text tag)
return GetItemByFlags(getWeapon, getAmmo, false); return GetItemByFlags(getWeapon, getAmmo, false);
} }
public function array<EItem> GetTemplateItems(Text template) public function array<EItem> GetTemplateItems(BaseText template)
{ {
local Pawn pawn; local Pawn pawn;
local bool getBuiltInAmmo; local bool getBuiltInAmmo;
@ -1173,7 +1173,7 @@ public function array<EItem> GetTemplateItems(Text template)
return result; return result;
} }
public function EItem GetTemplateItem(Text template) public function EItem GetTemplateItem(BaseText template)
{ {
local Pawn pawn; local Pawn pawn;
local bool getBuiltInAmmo; local bool getBuiltInAmmo;

2
sources/Gameplay/KF1Frontend/BaseImplementation/EKFMedicAmmo.uc

@ -120,7 +120,7 @@ public function array<Text> GetTags()
return tagArray; return tagArray;
} }
public function bool HasTag(Text tagToCheck) public function bool HasTag(BaseText tagToCheck)
{ {
if (tagToCheck == none) return false; if (tagToCheck == none) return false;
if (tagToCheck.Compare(P("ammo"))) return true; if (tagToCheck.Compare(P("ammo"))) return true;

2
sources/Gameplay/KF1Frontend/BaseImplementation/EKFSyringeAmmo.uc

@ -120,7 +120,7 @@ public function array<Text> GetTags()
return tagArray; return tagArray;
} }
public function bool HasTag(Text tagToCheck) public function bool HasTag(BaseText tagToCheck)
{ {
if (tagToCheck == none) return false; if (tagToCheck == none) return false;
if (tagToCheck.Compare(P("ammo"))) return true; if (tagToCheck.Compare(P("ammo"))) return true;

2
sources/Gameplay/KF1Frontend/BaseImplementation/EKFUnknownItem.uc

@ -111,7 +111,7 @@ public function array<Text> GetTags()
return emptyArray; return emptyArray;
} }
public function bool HasTag(Text tagToCheck) public function bool HasTag(BaseText tagToCheck)
{ {
return false; return false;
} }

2
sources/Gameplay/KF1Frontend/BaseImplementation/EKFWeapon.uc

@ -118,7 +118,7 @@ public function array<Text> GetTags()
return tagArray; return tagArray;
} }
public function bool HasTag(Text tagToCheck) public function bool HasTag(BaseText tagToCheck)
{ {
if (tagToCheck == none) return false; if (tagToCheck == none) return false;
if (tagToCheck.Compare(P("weapon"))) return true; if (tagToCheck.Compare(P("weapon"))) return true;

2
sources/Gameplay/KF1Frontend/KF1_Frontend.uc

@ -21,7 +21,7 @@
*/ */
class KF1_Frontend extends KFFrontend; class KF1_Frontend extends KFFrontend;
public function EItemTemplateInfo GetItemTemplateInfo(Text templateName) public function EItemTemplateInfo GetItemTemplateInfo(BaseText templateName)
{ {
local class<Inventory> inventoryClass; local class<Inventory> inventoryClass;
inventoryClass = class<Inventory>(_.memory.LoadClass(templateName)); inventoryClass = class<Inventory>(_.memory.LoadClass(templateName));

4
sources/Gameplay/KF1Frontend/Templates/KF1_TemplatesComponent.uc

@ -150,7 +150,7 @@ private function array<Text> CopyList(array<Text> inputList)
return outputList; return outputList;
} }
public function bool ItemListExists(Text listName) public function bool ItemListExists(BaseText listName)
{ {
local string listNameAsString; local string listNameAsString;
if (listName == none) return false; if (listName == none) return false;
@ -171,7 +171,7 @@ public function bool ItemListExists(Text listName)
return false; return false;
} }
public function array<Text> GetItemList(Text listName) public function array<Text> GetItemList(BaseText listName)
{ {
local string listNameAsString; local string listNameAsString;
local array<Text> emptyArray; local array<Text> emptyArray;

4
sources/Gameplay/KF1Frontend/Trading/KF1_Trader.uc

@ -138,13 +138,13 @@ public final /* unreal */ function ShopVolume GetShopVolume()
public function Text GetName() public function Text GetName()
{ {
if (myName == none) { if (myName == none) {
return _.text.Empty(); return P("");
} }
return myName.Copy(); return myName.Copy();
} }
// TODO: it is broken, needs fixing // TODO: it is broken, needs fixing
public function ETrader SetName(Text newName) public function ETrader SetName(BaseText newName)
{ {
if (newName == none) return self; if (newName == none) return self;
if (newName.IsEmpty()) return self; if (newName.IsEmpty()) return self;

2
sources/Gameplay/KF1Frontend/Trading/KF1_TradingComponent.uc

@ -84,7 +84,7 @@ public function array<ETrader> GetTraders()
return result; return result;
} }
public function ETrader GetTrader(Text traderName) public function ETrader GetTrader(BaseText traderName)
{ {
local int i; local int i;
local Text nextTraderName; local Text nextTraderName;

2
sources/Logger/ConsoleLogger.uc

@ -24,7 +24,7 @@ class ConsoleLogger extends Logger
config(AcediaSystem) config(AcediaSystem)
dependson(LoggerAPI); dependson(LoggerAPI);
public function Write(Text message, LoggerAPI.LogLevel messageLevel) public function Write(BaseText message, LoggerAPI.LogLevel messageLevel)
{ {
local MutableText builder; local MutableText builder;
if (message != none) if (message != none)

16
sources/Logger/LogMessage.uc

@ -79,7 +79,7 @@ var private array<int> normalizedArguments;
// amounts of trash objects, since only one of them can "make a mess". // amounts of trash objects, since only one of them can "make a mess".
var private LogMessage dirtyLogMessage; var private LogMessage dirtyLogMessage;
// Arguments, collected so far by the `Arg*()` calls // Arguments, collected so far by the `Arg*()` calls
var private array<Text> collectedArguments; var private array<BaseText> collectedArguments;
protected function Finalizer() protected function Finalizer()
{ {
@ -105,11 +105,11 @@ protected function Finalizer()
*/ */
public final function Initialize(LoggerAPI.Definition logMessageDefinition) public final function Initialize(LoggerAPI.Definition logMessageDefinition)
{ {
local int nextArgument; local int nextArgument;
local Parser parser; local Parser parser;
local MutableText nextLogPart, nextChunk; local MutableText nextLogPart, nextChunk;
local Text.Character percentCharacter; local BaseText.Character percentCharacter;
local array<int> parsedArguments; local array<int> parsedArguments;
if (isInitialized) { if (isInitialized) {
return; return;
} }
@ -208,7 +208,7 @@ private final function NormalizeArguments(array<int> argumentsOrder)
* returned by `P()`, `C()` or `F()` calls. * returned by `P()`, `C()` or `F()` calls.
* @return Caller `LogMessage` to allow for method chaining. * @return Caller `LogMessage` to allow for method chaining.
*/ */
public final function LogMessage Arg(Text argument) public final function LogMessage Arg(/*take*/ BaseText argument)
{ {
if (IsArgumentListFull()) { if (IsArgumentListFull()) {
return self; return self;
@ -335,7 +335,7 @@ public final function Text Collect()
{ {
local int i, argumentIndex; local int i, argumentIndex;
local Text result; local Text result;
local Text nextArgument; local BaseText nextArgument;
local MutableText builder; local MutableText builder;
if (logParts.length == 0) { if (logParts.length == 0) {
return P("").Copy(); return P("").Copy();

4
sources/Logger/Logger.uc

@ -60,7 +60,7 @@ protected static function StaticFinalizer()
* unless it is deallocated. * unless it is deallocated.
* @return Logger with object name `loggerName`. * @return Logger with object name `loggerName`.
*/ */
public final static function Logger GetLogger(Text loggerName) public final static function Logger GetLogger(BaseText loggerName)
{ {
local Logger loggerInstance; local Logger loggerInstance;
local Text loggerKey; local Text loggerKey;
@ -136,7 +136,7 @@ protected function MutableText GetPrefix(LoggerAPI.LogLevel messageLevel)
* @param message Message to output. * @param message Message to output.
* @param messageLevel Level, at which message must be output. * @param messageLevel Level, at which message must be output.
*/ */
public function Write(Text message, LoggerAPI.LogLevel messageLevel){} public function Write(BaseText message, LoggerAPI.LogLevel messageLevel){}
defaultproperties defaultproperties
{ {

12
sources/Logger/LoggerAPI.uc

@ -245,7 +245,7 @@ public final function LogMessage Auto(out Definition definition)
* @param message Message to log. * @param message Message to log.
* @param messageLevel Level at which to log message. * @param messageLevel Level at which to log message.
*/ */
public final function LogAtLevel(Text message, LogLevel messageLevel) public final function LogAtLevel(BaseText message, LogLevel messageLevel)
{ {
switch (messageLevel) switch (messageLevel)
{ {
@ -274,7 +274,7 @@ public final function LogAtLevel(Text message, LogLevel messageLevel)
* *
* @param message Message to log. * @param message Message to log.
*/ */
public final function Debug(Text message) public final function Debug(BaseText message)
{ {
local int i; local int i;
for (i = 0; i < debugLoggerInstances.length; i += 1) { for (i = 0; i < debugLoggerInstances.length; i += 1) {
@ -288,7 +288,7 @@ public final function Debug(Text message)
* *
* @param message Message to log. * @param message Message to log.
*/ */
public final function Info(Text message) public final function Info(BaseText message)
{ {
local int i; local int i;
for (i = 0; i < infoLoggerInstances.length; i += 1) { for (i = 0; i < infoLoggerInstances.length; i += 1) {
@ -302,7 +302,7 @@ public final function Info(Text message)
* *
* @param message Message to log. * @param message Message to log.
*/ */
public final function Warning(Text message) public final function Warning(BaseText message)
{ {
local int i; local int i;
for (i = 0; i < warningLoggerInstances.length; i += 1) { for (i = 0; i < warningLoggerInstances.length; i += 1) {
@ -316,7 +316,7 @@ public final function Warning(Text message)
* *
* @param message Message to log. * @param message Message to log.
*/ */
public final function Error(Text message) public final function Error(BaseText message)
{ {
local int i; local int i;
for (i = 0; i < errorLoggerInstances.length; i += 1) { for (i = 0; i < errorLoggerInstances.length; i += 1) {
@ -330,7 +330,7 @@ public final function Error(Text message)
* *
* @param message Message to log. * @param message Message to log.
*/ */
public final function Fatal(Text message) public final function Fatal(BaseText message)
{ {
local int i; local int i;
for (i = 0; i < fatalLoggerInstances.length; i += 1) { for (i = 0; i < fatalLoggerInstances.length; i += 1) {

6
sources/Memory/MemoryAPI.uc

@ -30,7 +30,7 @@ class MemoryAPI extends AcediaObject;
* @param classReference Text representation of the class to return. * @param classReference Text representation of the class to return.
* @return Loaded class, corresponding to its name from `classReference`. * @return Loaded class, corresponding to its name from `classReference`.
*/ */
public final function class<Object> LoadClass(Text classReference) public final function class<Object> LoadClass(BaseText classReference)
{ {
if (classReference == none) { if (classReference == none) {
return none; return none;
@ -139,7 +139,7 @@ public final function Object Allocate(
* guarantees to return last pooled object (in a LIFO queue), * guarantees to return last pooled object (in a LIFO queue),
* unless `forceNewInstance == true`. * unless `forceNewInstance == true`.
* *
* @param refToClassToAllocate `Text` representation of the class of * @param refToClassToAllocate `BaseText` representation of the class of
* the `Object` / `Actor` that this method must create. * the `Object` / `Actor` that this method must create.
* @param forceNewInstance Set this to `true` if you require this method to * @param forceNewInstance Set this to `true` if you require this method to
* create a new instance, bypassing any object pools. * create a new instance, bypassing any object pools.
@ -147,7 +147,7 @@ public final function Object Allocate(
* `none` if creation has failed (only possible for actors). * `none` if creation has failed (only possible for actors).
*/ */
public final function Object AllocateByReference( public final function Object AllocateByReference(
Text refToClassToAllocate, BaseText refToClassToAllocate,
optional bool forceNewInstance) optional bool forceNewInstance)
{ {
return Allocate(LoadClass(refToClassToAllocate), forceNewInstance); return Allocate(LoadClass(refToClassToAllocate), forceNewInstance);

12
sources/Players/EPlayer.uc

@ -256,7 +256,7 @@ public final function Text GetName()
* @param newPlayerName New name of the caller `EPlayer`. This value will * @param newPlayerName New name of the caller `EPlayer`. This value will
* be copied. Passing `none` will result in an empty name. * be copied. Passing `none` will result in an empty name.
*/ */
public final function SetName(Text newPlayerName) public final function SetName(BaseText newPlayerName)
{ {
local Text oldPlayerName; local Text oldPlayerName;
local PlayerReplicationInfo replicationInfo; local PlayerReplicationInfo replicationInfo;
@ -270,10 +270,10 @@ public final function SetName(Text newPlayerName)
} }
// Converts `Text` nickname into a suitable `string` representation. // Converts `Text` nickname into a suitable `string` representation.
private final function string ConvertTextNameIntoString(Text playerName) private final function string ConvertTextNameIntoString(BaseText playerName)
{ {
local string newPlayerNameAsString; local string newPlayerNameAsString;
local Text.Formatting endingFormatting; local BaseText.Formatting endingFormatting;
if (playerName == none) { if (playerName == none) {
return ""; return "";
} }
@ -301,8 +301,8 @@ private final function string ConvertTextNameIntoString(Text playerName)
// Calls appropriate events to let them modify / "censor" player's new name. // Calls appropriate events to let them modify / "censor" player's new name.
private final function string CensorPlayerName( private final function string CensorPlayerName(
Text oldPlayerName, BaseText oldPlayerName,
Text newPlayerName) BaseText newPlayerName)
{ {
local string result; local string result;
local Text censoredName; local Text censoredName;

2
sources/Players/Events/PlayerAPI_OnPlayerNameChanged_Signal.uc

@ -19,7 +19,7 @@
*/ */
class PlayerAPI_OnPlayerNameChanged_Signal extends Signal; class PlayerAPI_OnPlayerNameChanged_Signal extends Signal;
public final function Emit(EPlayer player, Text oldName, Text newName) public final function Emit(EPlayer player, BaseText oldName, BaseText newName)
{ {
local Slot nextSlot; local Slot nextSlot;
StartIterating(); StartIterating();

2
sources/Players/Events/PlayerAPI_OnPlayerNameChanged_Slot.uc

@ -19,7 +19,7 @@
*/ */
class PlayerAPI_OnPlayerNameChanged_Slot extends Slot; class PlayerAPI_OnPlayerNameChanged_Slot extends Slot;
delegate connect(EPlayer player, Text oldName, Text newName) delegate connect(EPlayer player, BaseText oldName, BaseText newName)
{ {
DummyCall(); DummyCall();
} }

4
sources/Players/Events/PlayerAPI_OnPlayerNameChanging_Signal.uc

@ -19,7 +19,9 @@
*/ */
class PlayerAPI_OnPlayerNameChanging_Signal extends Signal; class PlayerAPI_OnPlayerNameChanging_Signal extends Signal;
public final function Emit(EPlayer player, Text oldName, MutableText newName) public final function Emit(EPlayer player,
BaseText oldName,
MutableText newName)
{ {
local Slot nextSlot; local Slot nextSlot;
StartIterating(); StartIterating();

2
sources/Players/Events/PlayerAPI_OnPlayerNameChanging_Slot.uc

@ -19,7 +19,7 @@
*/ */
class PlayerAPI_OnPlayerNameChanging_Slot extends Slot; class PlayerAPI_OnPlayerNameChanging_Slot extends Slot;
delegate connect(EPlayer player, Text oldName, MutableText newName) delegate connect(EPlayer player, BaseText oldName, MutableText newName)
{ {
DummyCall(); DummyCall();
} }

18
sources/Players/Inventory/EInventory.uc

@ -82,7 +82,7 @@ public function EItem Add(EItem newItem, optional bool forceAddition)
* `none` iff adding item has failed. * `none` iff adding item has failed.
*/ */
public function EItem AddTemplate( public function EItem AddTemplate(
Text newItemTemplate, BaseText newItemTemplate,
optional bool forceAddition) optional bool forceAddition)
{ {
return none; return none;
@ -130,7 +130,7 @@ public final function bool CanAdd(
* `false` otherwise. * `false` otherwise.
*/ */
public function bool CanAddTemplate( public function bool CanAddTemplate(
Text itemTemplateToCheck, BaseText itemTemplateToCheck,
optional bool forceAddition) optional bool forceAddition)
{ {
local bool success; local bool success;
@ -181,7 +181,7 @@ public function Text CanAddExplain(
* description of reason why not otherwise. * description of reason why not otherwise.
*/ */
public function Text CanAddTemplateExplain( public function Text CanAddTemplateExplain(
Text itemTemplateToCheck, BaseText itemTemplateToCheck,
optional bool forceAddition) optional bool forceAddition)
{ {
return none; return none;
@ -243,7 +243,7 @@ public function bool Remove(
* caller `EInventory` in the first place). * caller `EInventory` in the first place).
*/ */
public function bool RemoveTemplate( public function bool RemoveTemplate(
Text itemTemplateToRemove, BaseText itemTemplateToRemove,
optional bool keepItem, optional bool keepItem,
optional bool forceRemoval, optional bool forceRemoval,
optional bool removeAll) optional bool removeAll)
@ -307,7 +307,7 @@ public function bool Contains(EItem itemToCheck)
* @result `true` if item with a given template does belong to the inventory * @result `true` if item with a given template does belong to the inventory
* and `false` otherwise. * and `false` otherwise.
*/ */
public function bool ContainsTemplate(Text itemTemplateToCheck) public function bool ContainsTemplate(BaseText itemTemplateToCheck)
{ {
return false; return false;
} }
@ -348,7 +348,7 @@ public function array<EItem> GetItemsSupporting(class<EItem> interfaceClass)
* Guaranteed to not contain `none` references of interfaces to * Guaranteed to not contain `none` references of interfaces to
* inexistent entities. * inexistent entities.
*/ */
public function array<EItem> GetTagItems(Text tag) public function array<EItem> GetTagItems(BaseText tag)
{ {
local array<EItem> emptyArray; local array<EItem> emptyArray;
return emptyArray; return emptyArray;
@ -368,7 +368,7 @@ public function array<EItem> GetTagItems(Text tag)
* the specified tag `tag`. * the specified tag `tag`.
* Guaranteed to not be `none` or refer to non-existent entity. * Guaranteed to not be `none` or refer to non-existent entity.
*/ */
public function EItem GetTagItem(Text tag) { return none; } public function EItem GetTagItem(BaseText tag) { return none; }
/** /**
* Returns array with all `EItem`s contained inside the caller `EInventory` * Returns array with all `EItem`s contained inside the caller `EInventory`
@ -380,7 +380,7 @@ public function EItem GetTagItem(Text tag) { return none; }
* Guaranteed to not contain `none` references or interfaces to * Guaranteed to not contain `none` references or interfaces to
* inexistent entities. * inexistent entities.
*/ */
public function array<EItem> GetTemplateItems(Text template) public function array<EItem> GetTemplateItems(BaseText template)
{ {
local array<EItem> emptyArray; local array<EItem> emptyArray;
return emptyArray; return emptyArray;
@ -400,7 +400,7 @@ public function array<EItem> GetTemplateItems(Text template)
* from the specified template `template`. * from the specified template `template`.
* Guaranteed to not be `none` or refer to non-existent entity. * Guaranteed to not be `none` or refer to non-existent entity.
*/ */
public function EItem GetTemplateItem(Text template) { return none; } public function EItem GetTemplateItem(BaseText template) { return none; }
/** /**
* Returns array of caller `EInventory`'s items that are currently equipped by * Returns array of caller `EInventory`'s items that are currently equipped by

2
sources/Players/Inventory/EItem.uc

@ -64,7 +64,7 @@ public function array<Text> GetTags()
} }
// TODO: document this // TODO: document this
public function bool HasTag(Text tagToCheck) public function bool HasTag(BaseText tagToCheck)
{ {
return false; return false;
} }

6
sources/Players/PlayersAPI.uc

@ -19,7 +19,7 @@
*/ */
class PlayersAPI extends AcediaObject class PlayersAPI extends AcediaObject
dependson(ConnectionService) dependson(ConnectionService)
dependson(Text) dependson(BaseText)
dependson(EPlayer); dependson(EPlayer);
// Writer that can be used to write into this player's console // Writer that can be used to write into this player's console
@ -108,7 +108,7 @@ public function PlayerAPI_OnLostPlayer_Slot OnLostPlayer(
* use `OnPlayerNameChanged` instead. * use `OnPlayerNameChanged` instead.
* *
* [Signature] * [Signature]
* void <slot>(EPlayer affectedPlayer, Text oldName, MutableText newName) * void <slot>(EPlayer affectedPlayer, BaseText oldName, MutableText newName)
* *
* @param affectedPlayer Player, whos name got changed. * @param affectedPlayer Player, whos name got changed.
* @param oldName Player's old name. * @param oldName Player's old name.
@ -130,7 +130,7 @@ public function PlayerAPI_OnPlayerNameChanging_Slot OnPlayerNameChanging(
* after change caused by someone else, use `OnPlayerNameChanging` instead. * after change caused by someone else, use `OnPlayerNameChanging` instead.
* *
* [Signature] * [Signature]
* void <slot>(EPlayer affectedPlayer, Text oldName, Text newName) * void <slot>(EPlayer affectedPlayer, BaseText oldName, BaseText newName)
* *
* @param affectedPlayer Player, whos name got changed. * @param affectedPlayer Player, whos name got changed.
* @param oldName Player's old name. * @param oldName Player's old name.

1578
sources/Text/BaseText.uc

File diff suppressed because it is too large Load Diff

2
sources/Text/Codecs/Utf8Decoder.uc

@ -141,7 +141,7 @@ private final function bool PushInnerByte(byte nextByte)
private final function AppendCodePoint(int codePoint) private final function AppendCodePoint(int codePoint)
{ {
local Text.Character nextCharacter; local BaseText.Character nextCharacter;
nextCharacter.codePoint = codePoint; nextCharacter.codePoint = codePoint;
builtText.AppendCharacter(nextCharacter); builtText.AppendCharacter(nextCharacter);
} }

2
sources/Text/Codecs/Utf8Encoder.uc

@ -44,7 +44,7 @@ var private int lastSixBits;
* `none` iff `text == none` or `text` contains invalid Unicode * `none` iff `text == none` or `text` contains invalid Unicode
* code points. * code points.
*/ */
public final function ByteArrayRef Encode(Text text) public final function ByteArrayRef Encode(BaseText text)
{ {
local int i, nextCodepoint, textLength; local int i, nextCodepoint, textLength;
local ByteArrayRef buffer; local ByteArrayRef buffer;

8
sources/Text/FormattedStrings/FormattingCommandsSequence.uc

@ -24,7 +24,7 @@
* along with Acedia. If not, see <https://www.gnu.org/licenses/>. * along with Acedia. If not, see <https://www.gnu.org/licenses/>.
*/ */
class FormattingCommandsSequence extends AcediaObject class FormattingCommandsSequence extends AcediaObject
dependson(Text); dependson(BaseText);
enum FormattingCommandType enum FormattingCommandType
{ {
@ -48,7 +48,7 @@ struct FormattingCommand
// Formatting character for the "^"-type tag // Formatting character for the "^"-type tag
// This parameter is only used for `FST_StackSwap` command type. // This parameter is only used for `FST_StackSwap` command type.
var Text.Character charTag; var BaseText.Character charTag;
// Rest of the parameters are only used for `FST_StackPush` // Rest of the parameters are only used for `FST_StackPush`
// command type. // command type.
@ -149,7 +149,7 @@ protected function Finalizer()
* direct access to formatting commands defined in `input`. * direct access to formatting commands defined in `input`.
*/ */
public final static function FormattingCommandsSequence FromText( public final static function FormattingCommandsSequence FromText(
Text input, BaseText input,
optional FormattingErrorsReport errorsReporter) optional FormattingErrorsReport errorsReporter)
{ {
local FormattingCommandsSequence newSequence; local FormattingCommandsSequence newSequence;
@ -205,7 +205,7 @@ public final function FormattingCommand GetCommand(int commandIndex)
private final function BuildSelf() private final function BuildSelf()
{ {
local Text.Character nextCharacter; local BaseText.Character nextCharacter;
while (!parser.HasFinished()) while (!parser.HasFinished())
{ {
parser.MCharacter(nextCharacter); parser.MCharacter(nextCharacter);

4
sources/Text/FormattedStrings/FormattingErrorsReport.uc

@ -95,7 +95,9 @@ protected function Finalizer()
* do nothing. * do nothing.
* Parameter is unused for other types of errors. * Parameter is unused for other types of errors.
*/ */
public final function Report(FormattedStringErrorType type, optional Text cause) public final function Report(
FormattedStringErrorType type,
optional BaseText cause)
{ {
switch (type) switch (type)
{ {

21
sources/Text/FormattedStrings/FormattingStringParser.uc

@ -22,7 +22,7 @@
* along with Acedia. If not, see <https://www.gnu.org/licenses/>. * along with Acedia. If not, see <https://www.gnu.org/licenses/>.
*/ */
class FormattingStringParser extends AcediaObject class FormattingStringParser extends AcediaObject
dependson(Text) dependson(BaseText)
dependson(FormattingErrorsReport) dependson(FormattingErrorsReport)
dependson(FormattingCommandsSequence); dependson(FormattingCommandsSequence);
@ -121,7 +121,7 @@ var private MutableText borrowedTarget;
var private FormattingErrorsReport borrowedErrors; var private FormattingErrorsReport borrowedErrors;
// Keep this as an easy access to separator of gradient colors ':' // Keep this as an easy access to separator of gradient colors ':'
var private Text.Character separatorCharacter; var private BaseText.Character separatorCharacter;
var private const int TOPENING_BRACKET, TCLOSING_BRACKET, TPERCENT; var private const int TOPENING_BRACKET, TCLOSING_BRACKET, TPERCENT;
@ -165,7 +165,7 @@ protected function Finalizer()
*/ */
public static final function array<FormattingErrorsReport.FormattedStringError> public static final function array<FormattingErrorsReport.FormattedStringError>
ParseFormatted( ParseFormatted(
Text source, BaseText source,
optional MutableText target, optional MutableText target,
optional bool doReportErrors) optional bool doReportErrors)
{ {
@ -207,7 +207,7 @@ public static final function array<FormattingErrorsReport.FormattedStringError>
private final function DoAppend() private final function DoAppend()
{ {
local int i; local int i;
local Text.Formatting emptyFormatting; local BaseText.Formatting emptyFormatting;
local FormattingCommandsSequence.FormattingCommand nextCommand; local FormattingCommandsSequence.FormattingCommand nextCommand;
SetupFormattingStack(emptyFormatting); SetupFormattingStack(emptyFormatting);
// First element of color stack is special and has no color information; // First element of color stack is special and has no color information;
@ -262,7 +262,7 @@ private final function AppendToTarget(array<Text.Character> contents)
private final function Report( private final function Report(
FormattingErrorsReport.FormattedStringErrorType type, FormattingErrorsReport.FormattedStringErrorType type,
optional Text cause) optional BaseText cause)
{ {
if (borrowedErrors == none) { if (borrowedErrors == none) {
return; return;
@ -278,9 +278,9 @@ private final function bool IsCurrentFormattingGradient()
return formattingStackHead.gradient; return formattingStackHead.gradient;
} }
private final function Text.Formatting GetFormattingFor(int index) private final function BaseText.Formatting GetFormattingFor(int index)
{ {
local Text.Formatting emptyFormatting; local BaseText.Formatting emptyFormatting;
if (formattingStack.length <= 0) return emptyFormatting; if (formattingStack.length <= 0) return emptyFormatting;
if (!formattingStackHead.colored) return emptyFormatting; if (!formattingStackHead.colored) return emptyFormatting;
@ -319,7 +319,7 @@ private final function Color GetColorFor(int index)
return targetColor; return targetColor;
} }
private final function FormattingInfo ParseFormattingInfo(Text colorTag) private final function FormattingInfo ParseFormattingInfo(BaseText colorTag)
{ {
local int i; local int i;
local Parser colorParser; local Parser colorParser;
@ -477,7 +477,8 @@ private final function array<float> NormalizePoints(array<float> points)
// that will be used when we pop all the other elements. // that will be used when we pop all the other elements.
// It is necessary to deal with possible folded formatting definitions in // It is necessary to deal with possible folded formatting definitions in
// formatted strings. // formatted strings.
private final function SetupFormattingStack(Text.Formatting defaultFormatting) private final function SetupFormattingStack(
BaseText.Formatting defaultFormatting)
{ {
local FormattingInfo defaultFormattingInfo; local FormattingInfo defaultFormattingInfo;
defaultFormattingInfo.colored = defaultFormatting.isColored; defaultFormattingInfo.colored = defaultFormatting.isColored;
@ -499,7 +500,7 @@ private final function PushIntoFormattingStack(
formattingStack[formattingStack.length] = formattingStackHead; formattingStack[formattingStack.length] = formattingStackHead;
} }
private final function SwapFormattingStack(Text.Character tagCharacter) private final function SwapFormattingStack(BaseText.Character tagCharacter)
{ {
local FormattingInfo updatedFormatting; local FormattingInfo updatedFormatting;
if (formattingStack.length > 0) { if (formattingStack.length > 0) {

31
sources/Text/JSON/JSONAPI.uc

@ -28,8 +28,9 @@ class JSONAPI extends AcediaObject
var private bool formattingInitialized; var private bool formattingInitialized;
// Variables used in json pretty printing for defining used colors; // Variables used in json pretty printing for defining used colors;
// Colors are taken from `ColorAPI`. // Colors are taken from `ColorAPI`.
var private Text.Formatting jPropertyName, jObjectBraces, jArrayBraces, jComma; var private BaseText.Formatting jPropertyName, jObjectBraces, jArrayBraces;
var private Text.Formatting jColon, jNumber, jBoolean, jString, jNull; var private BaseText.Formatting jComma, jColon, jNumber, jBoolean, jString;
var private BaseText.Formatting jNull;
var const int TNULL, TTRUE, TFALSE, TDOT, TEXPONENT; var const int TNULL, TTRUE, TFALSE, TDOT, TEXPONENT;
var const int TOPEN_BRACKET, TCLOSE_BRACKET, TOPEN_BRACE, TCLOSE_BRACE; var const int TOPEN_BRACKET, TCLOSE_BRACKET, TOPEN_BRACE, TCLOSE_BRACE;
@ -79,7 +80,7 @@ private final function InitFormatting()
* an incorrect JSON pointer or `none`, - empty `JSONPointer` will be * an incorrect JSON pointer or `none`, - empty `JSONPointer` will be
* returned. * returned.
*/ */
public final function JSONPointer Pointer(optional Text pointerAsText) public final function JSONPointer Pointer(optional BaseText pointerAsText)
{ {
return JSONPointer(_.memory.Allocate(class'JSONPointer')) return JSONPointer(_.memory.Allocate(class'JSONPointer'))
.Set(pointerAsText); .Set(pointerAsText);
@ -147,7 +148,7 @@ public final function TryNullWith(Parser parser)
* @param source `Text` instance to parse JSON null value from. * @param source `Text` instance to parse JSON null value from.
* @return `true` if parsing succeeded and `false` otherwise. * @return `true` if parsing succeeded and `false` otherwise.
*/ */
public final function bool IsNull(Text source) public final function bool IsNull(BaseText source)
{ {
local bool parsingSucceeded; local bool parsingSucceeded;
local Parser parser; local Parser parser;
@ -258,7 +259,7 @@ public final function AcediaObject ParseBooleanWith(
* Returns `none` iff parsing has failed. * Returns `none` iff parsing has failed.
*/ */
public final function AcediaObject ParseBoolean( public final function AcediaObject ParseBoolean(
Text source, BaseText source,
optional bool parseAsMutable) optional bool parseAsMutable)
{ {
local bool result; local bool result;
@ -476,7 +477,7 @@ public final function AcediaObject ParseNumberWith(
* Returns `none` iff parsing has failed. * Returns `none` iff parsing has failed.
*/ */
public final function AcediaObject ParseNumber( public final function AcediaObject ParseNumber(
Text source, BaseText source,
optional bool parseAsMutable) optional bool parseAsMutable)
{ {
local int integerResult; local int integerResult;
@ -534,7 +535,7 @@ public final function AcediaObject ParseNumber(
* `none` otherwise. To check for parsing success check the state of * `none` otherwise. To check for parsing success check the state of
* the `parser`. * the `parser`.
*/ */
public final function Text ParseStringWith( public final function BaseText ParseStringWith(
Parser parser, Parser parser,
optional bool parseAsMutable) optional bool parseAsMutable)
{ {
@ -572,8 +573,8 @@ public final function Text ParseStringWith(
* `none` otherwise. To check for parsing success check the state of * `none` otherwise. To check for parsing success check the state of
* the `parser`. * the `parser`.
*/ */
public final function Text ParseString( public final function BaseText ParseString(
Text source, BaseText source,
optional bool parseAsMutable) optional bool parseAsMutable)
{ {
local bool parsingSuccessful; local bool parsingSuccessful;
@ -1250,7 +1251,7 @@ private final function MutableText PrettyPrintObjectWithIndent(
// initialized. // initialized.
private final function PrettyPrintKeyValue( private final function PrettyPrintKeyValue(
MutableText builder, MutableText builder,
Text nextKey, BaseText nextKey,
AcediaObject nextValue, AcediaObject nextValue,
MutableText accumulatedIndent) MutableText accumulatedIndent)
{ {
@ -1276,12 +1277,12 @@ private final function PrettyPrintKeyValue(
// representation. // representation.
// We can't just dump `original`'s contents into JSON output as is, // We can't just dump `original`'s contents into JSON output as is,
// since we have to replace several special characters with escaped sequences. // since we have to replace several special characters with escaped sequences.
private final function MutableText DisplayText(Text original) private final function MutableText DisplayText(BaseText original)
{ {
local int i, length; local int i, length;
local MutableText result; local MutableText result;
local Text.Character nextCharacter; local BaseText.Character nextCharacter;
local Text.Character reverseSolidus; local BaseText.Character reverseSolidus;
reverseSolidus = _.text.CharacterFromCodePoint(CODEPOINT_REVERSE_SOLIDUS); reverseSolidus = _.text.CharacterFromCodePoint(CODEPOINT_REVERSE_SOLIDUS);
result = T(TQUOTE).MutableCopy(); result = T(TQUOTE).MutableCopy();
length = original.GetLength(); length = original.GetLength();

6
sources/Text/JSON/JSONPointer.uc

@ -90,7 +90,7 @@ public final function JSONPointer Empty()
* @param pointerAsText `Text` representation of the JSON pointer. * @param pointerAsText `Text` representation of the JSON pointer.
* @return Reference to the caller `JSONPointer` to allow for method chaining. * @return Reference to the caller `JSONPointer` to allow for method chaining.
*/ */
public final function JSONPointer Set(Text pointerAsText) public final function JSONPointer Set(BaseText pointerAsText)
{ {
local int i; local int i;
local bool hasEscapedSequences; local bool hasEscapedSequences;
@ -144,7 +144,7 @@ public final function JSONPointer Set(Text pointerAsText)
* no changes will be made at all. * no changes will be made at all.
* @return Reference to the caller `JSONPointer` to allow for method chaining. * @return Reference to the caller `JSONPointer` to allow for method chaining.
*/ */
public final function JSONPointer Push(Text newComponent) public final function JSONPointer Push(BaseText newComponent)
{ {
local Component newComponentRecord; local Component newComponentRecord;
if (newComponent == none) { if (newComponent == none) {
@ -199,7 +199,7 @@ public final function Text Pop(optional bool doNotRemove)
lastIndex = components.length - 1; lastIndex = components.length - 1;
// Do not use `GetComponent()` to avoid unnecessary `Text` copying // Do not use `GetComponent()` to avoid unnecessary `Text` copying
if (components[lastIndex].asText == none) { if (components[lastIndex].asText == none) {
result = _.text.FromIntM(components[lastIndex].asNumber); result = _.text.FromInt(components[lastIndex].asNumber);
} }
else { else {
result = components[lastIndex].asText.Copy(); result = components[lastIndex].asText.Copy();

95
sources/Text/MutableText.uc

@ -1,5 +1,5 @@
/** /**
* Mutable version of Acedia's `Text` * Mutable version of Acedia's `BaseText`.
* Copyright 2020 - 2022 Anton Tarasenko * Copyright 2020 - 2022 Anton Tarasenko
*------------------------------------------------------------------------------ *------------------------------------------------------------------------------
* This file is part of Acedia. * This file is part of Acedia.
@ -17,10 +17,23 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with Acedia. If not, see <https://www.gnu.org/licenses/>. * along with Acedia. If not, see <https://www.gnu.org/licenses/>.
*/ */
class MutableText extends Text; class MutableText extends BaseText;
var private int CODEPOINT_NEWLINE; var private int CODEPOINT_NEWLINE;
public function Text IntoText()
{
local Text immutableVersion;
immutableVersion = Copy();
FreeSelf();
return immutableVersion;
}
public function MutableText IntoMutableText()
{
return self;
}
/** /**
* Clears all current data from the caller `MutableText` instance. * Clears all current data from the caller `MutableText` instance.
* *
@ -44,7 +57,7 @@ public final function MutableText Clear()
* @return Caller `MutableText` to allow for method chaining. * @return Caller `MutableText` to allow for method chaining.
*/ */
public final function MutableText AppendRawCharacter( public final function MutableText AppendRawCharacter(
Text.Character newCharacter, BaseText.Character newCharacter,
optional Formatting characterFormatting) optional Formatting characterFormatting)
{ {
if (!_.text.IsValidCharacter(newCharacter)) { if (!_.text.IsValidCharacter(newCharacter)) {
@ -70,8 +83,8 @@ public final function MutableText AppendRawCharacter(
* @return Caller `MutableText` to allow for method chaining. * @return Caller `MutableText` to allow for method chaining.
*/ */
public final function MutableText AppendManyRawCharacters( public final function MutableText AppendManyRawCharacters(
array<Text.Character> newCharacters, array<BaseText.Character> newCharacters,
optional Formatting charactersFormatting) optional Formatting charactersFormatting)
{ {
local int i; local int i;
SetFormatting(charactersFormatting); SetFormatting(charactersFormatting);
@ -88,7 +101,8 @@ public final function MutableText AppendManyRawCharacters(
* Only valid characters will be added. * Only valid characters will be added.
* @return Caller `MutableText` to allow for method chaining. * @return Caller `MutableText` to allow for method chaining.
*/ */
public final function MutableText AppendCharacter(Text.Character newCharacter) public final function MutableText AppendCharacter(
BaseText.Character newCharacter)
{ {
if (!_.text.IsValidCharacter(newCharacter)) { if (!_.text.IsValidCharacter(newCharacter)) {
return self; return self;
@ -105,7 +119,7 @@ public final function MutableText AppendCharacter(Text.Character newCharacter)
* @return Caller `MutableText` to allow for method chaining. * @return Caller `MutableText` to allow for method chaining.
*/ */
public final function MutableText AppendManyCharacters( public final function MutableText AppendManyCharacters(
array<Text.Character> newCharacters) array<BaseText.Character> newCharacters)
{ {
local int i; local int i;
for (i = 0; i < newCharacters.length; i += 1) { for (i = 0; i < newCharacters.length; i += 1) {
@ -153,10 +167,10 @@ public final function MutableText AppendLineBreak()
} }
/** /**
* Appends contents of another `Text` to the caller `MutableText`. * Appends contents of another `BaseText` to the caller `MutableText`.
* *
* @param other Instance of `Text`, which content method must * @param other Instance of `BaseText`, which content method
* append. Appends nothing if passed value is `none`. * will append. Appends nothing if passed value is `none`.
* @param defaultFormatting Formatting to apply to `other`'s character that * @param defaultFormatting Formatting to apply to `other`'s character that
* do not have it specified. For example, `defaultFormatting.isColored`, * do not have it specified. For example, `defaultFormatting.isColored`,
* but some of `other`'s characters do not have a color defined - * but some of `other`'s characters do not have a color defined -
@ -164,7 +178,7 @@ public final function MutableText AppendLineBreak()
* @return Caller `MutableText` to allow for method chaining. * @return Caller `MutableText` to allow for method chaining.
*/ */
public final function MutableText Append( public final function MutableText Append(
Text other, BaseText other,
optional Formatting defaultFormatting) optional Formatting defaultFormatting)
{ {
local int i; local int i;
@ -255,7 +269,7 @@ public final function MutableText AppendColoredString(
{ {
if (i + 3 >= sourceLength) break; if (i + 3 >= sourceLength) break;
newFormatting.isColored = true; newFormatting.isColored = true;
newFormatting.color = _.color.RGB(sourceAsIntegers[i + 1], newFormatting.color = _.color.RGB( sourceAsIntegers[i + 1],
sourceAsIntegers[i + 2], sourceAsIntegers[i + 2],
sourceAsIntegers[i + 3]); sourceAsIntegers[i + 3]);
i += 4; i += 4;
@ -271,14 +285,14 @@ public final function MutableText AppendColoredString(
} }
/** /**
* Appends contents of the formatted `Text` to the caller `MutableText`. * Appends contents of the formatted `BaseText` to the caller `MutableText`.
* *
* @param source `Text` (with formatted string contents) to be * @param source `BaseText` (with formatted string contents) to be
* appended to the caller `MutableText`. * appended to the caller `MutableText`.
* @return Caller `MutableText` to allow for method chaining. * @return Caller `MutableText` to allow for method chaining.
*/ */
public final function MutableText AppendFormatted( public final function MutableText AppendFormatted(
Text source, BaseText source,
optional Formatting defaultFormatting) optional Formatting defaultFormatting)
{ {
class'FormattingStringParser'.static.ParseFormatted(source, self); class'FormattingStringParser'.static.ParseFormatted(source, self);
@ -296,8 +310,8 @@ public final function MutableText AppendFormattedString(
string source, string source,
optional Formatting defaultFormatting) optional Formatting defaultFormatting)
{ {
local Text sourceAsText; local MutableText sourceAsText;
sourceAsText = _.text.FromString(source); sourceAsText = _.text.FromStringM(source);
AppendFormatted(sourceAsText); AppendFormatted(sourceAsText);
_.memory.Free(sourceAsText); _.memory.Free(sourceAsText);
return self; return self;
@ -316,10 +330,11 @@ protected function int CalculateHashCode()
} }
/** /**
* Replaces every occurrence of the string `before` with the string `after`. * Replaces every occurrence of the `Text` object `before` with
* the `Text` object `after`.
* *
* @param before `Text` contents to match and then replace. * @param before `BaseText` contents to match and then replace.
* @param after `Text` contents to replace `before` with. * @param after `BaseText` contents to replace `before` with.
* @param caseSensitivity Defines whether `before` should be matched * @param caseSensitivity Defines whether `before` should be matched
* in a case-sensitive manner. By default it will be. * in a case-sensitive manner. By default it will be.
* @param formatSensitivity Defines whether `before` should be matched * @param formatSensitivity Defines whether `before` should be matched
@ -327,15 +342,15 @@ protected function int CalculateHashCode()
* @return Returns caller `MutableText`, to allow for method chaining. * @return Returns caller `MutableText`, to allow for method chaining.
*/ */
public final function MutableText Replace( public final function MutableText Replace(
Text before, BaseText before,
Text after, BaseText after,
optional CaseSensitivity caseSensitivity, optional CaseSensitivity caseSensitivity,
optional FormatSensitivity formatSensitivity) optional FormatSensitivity formatSensitivity)
{ {
local int index; local int index;
local bool needToInsertReplacer; local bool needToInsertReplacer;
local int nextReplacementIndex; local int nextReplacementIndex;
local Text selfCopy; local BaseText selfCopy;
if (before == none) return self; if (before == none) return self;
if (before.IsEmpty()) return self; if (before.IsEmpty()) return self;
@ -372,10 +387,34 @@ public final function MutableText Replace(
} }
/** /**
* Sets `newFormatting` for every non-formatted character in the caller `Text`. * Replaces every occurrence of the string `before` with the string `after`.
*
* @param before `string` contents to match and then replace.
* @param after `string` contents to replace `before` with.
* @param caseSensitivity Defines whether `before` should be matched
* in a case-sensitive manner. By default it will be.
* @return Returns caller `MutableText`, to allow for method chaining.
*/
public final function MutableText ReplaceS(
string before,
string after,
optional CaseSensitivity caseSensitivity)
{
local MutableText beforeText, afterText;
beforeText = _.text.FromStringM(before);
afterText = _.text.FromStringM(after);
Replace(beforeText, afterText, caseSensitivity);
_.memory.Free(beforeText);
_.memory.Free(afterText);
return self;
}
/**
* Sets `newFormatting` for every non-formatted character in
* the caller `MutableText`.
* *
* @param newFormatting Formatting to use for all non-formatted character in * @param newFormatting Formatting to use for all non-formatted character in
* the caller `Text`. If `newFormatting` is not colored itself - * the caller `MutableText`. If `newFormatting` is not colored itself -
* method does nothing. * method does nothing.
* @return Returns caller `MutableText`, to allow for method chaining. * @return Returns caller `MutableText`, to allow for method chaining.
*/ */

92
sources/Text/Parser.uc

@ -19,7 +19,7 @@
* along with Acedia. If not, see <https://www.gnu.org/licenses/>. * along with Acedia. If not, see <https://www.gnu.org/licenses/>.
*/ */
class Parser extends AcediaObject class Parser extends AcediaObject
dependson(Text) dependson(BaseText)
dependson(UnicodeData); dependson(UnicodeData);
// Max value of a byte // Max value of a byte
@ -75,7 +75,7 @@ enum ParsedSign
// Common logic for parser initialization. // Common logic for parser initialization.
// Uses `source` as is, without copying, so public initialization method // Uses `source` as is, without copying, so public initialization method
// must do it itself. // must do it itself.
private final function Parser _initialize(Text source) private final function Parser _initialize(/*take*/ Text source)
{ {
if (source == none) return self; if (source == none) return self;
@ -98,7 +98,7 @@ private final function Parser _initialize(Text source)
* If `none` is passed - parser won't be initialized. * If `none` is passed - parser won't be initialized.
* @return Returns the caller `Parser`, to allow for function chaining. * @return Returns the caller `Parser`, to allow for function chaining.
*/ */
public final function Parser Initialize(Text source) public final function Parser Initialize(BaseText source)
{ {
if (source == none) { if (source == none) {
return self; return self;
@ -304,10 +304,10 @@ protected final function Parser ShiftPointer(optional int shift)
* invalid character if caller `Parser` was not initialized, * invalid character if caller `Parser` was not initialized,
* its contents are empty or it has already consumed all input. * its contents are empty or it has already consumed all input.
*/ */
protected final function Text.Character GetCharacter(optional int shift) protected final function BaseText.Character GetCharacter(optional int shift)
{ {
local Text.Character invalidCharacter; local BaseText.Character invalidCharacter;
local int absoluteAddress; local int absoluteAddress;
if (content == none) return _.text.GetInvalidCharacter(); if (content == none) return _.text.GetInvalidCharacter();
absoluteAddress = currentState.pointer + Max(0, shift); absoluteAddress = currentState.pointer + Max(0, shift);
@ -377,11 +377,12 @@ public final function bool HasFinished()
} }
/** /**
* Returns still unparsed part of caller `Parser`'s source as `Text`. * Returns still unparsed part of caller `Parser`'s source as `MutableText`.
* *
* @return Unparsed part of caller `Parser`'s source as `Text`. * @return Unparsed part of caller `Parser`'s source as `MutableText`.
* Guaranteed to be not-`none`.
*/ */
public final function Text GetRemainder() public final function MutableText GetRemainderM()
{ {
local int i; local int i;
local MutableText result; local MutableText result;
@ -392,6 +393,17 @@ public final function Text GetRemainder()
return result; return result;
} }
/**
* Returns still unparsed part of caller `Parser`'s source as `Text`.
*
* @return Unparsed part of caller `Parser`'s source as `Text`.
* Guaranteed to be not-`none`.
*/
public final function Text GetRemainder()
{
return GetRemainderM().IntoText();
}
/** /**
* Returns still unparsed part of caller `Parser`'s source as a plain `string`. * Returns still unparsed part of caller `Parser`'s source as a plain `string`.
* *
@ -475,8 +487,8 @@ public final function Parser Skip(optional out int whitespacesAmount)
* @return Returns the caller `Parser`, to allow for function chaining. * @return Returns the caller `Parser`, to allow for function chaining.
*/ */
public final function Parser Match( public final function Parser Match(
Text word, BaseText word,
optional Text.CaseSensitivity caseSensitivity) optional BaseText.CaseSensitivity caseSensitivity)
{ {
local int i; local int i;
local int wordLength; local int wordLength;
@ -513,8 +525,8 @@ public final function Parser Match(
* @return Returns the caller `Parser`, to allow for function chaining. * @return Returns the caller `Parser`, to allow for function chaining.
*/ */
public final function Parser MatchS( public final function Parser MatchS(
string word, string word,
optional Text.CaseSensitivity caseSensitivity) optional BaseText.CaseSensitivity caseSensitivity)
{ {
local Text wrapper; local Text wrapper;
wrapper = _.text.FromString(word); wrapper = _.text.FromString(word);
@ -639,7 +651,7 @@ protected final function int SafeIntegerCombination(
* @return Returns the caller `Parser`, to allow for function chaining. * @return Returns the caller `Parser`, to allow for function chaining.
*/ */
public final function Parser MEscapedSequence( public final function Parser MEscapedSequence(
out Text.Character denotedCharacter) out BaseText.Character denotedCharacter)
{ {
local int i; local int i;
if (!Ok()) return self; if (!Ok()) return self;
@ -686,8 +698,8 @@ public final function Parser MEscapedSequence(
*/ */
public final function Parser MName(out MutableText result) public final function Parser MName(out MutableText result)
{ {
local TextAPI api; local TextAPI api;
local Text.Character nextCharacter; local BaseText.Character nextCharacter;
ResetResultText(result); ResetResultText(result);
if (!Ok()) return self; if (!Ok()) return self;
if (GetRemainingLength() <= 0) return Fail(); if (GetRemainingLength() <= 0) return Fail();
@ -753,10 +765,10 @@ public final function Parser MNameS(out string result)
*/ */
public final function Parser MStringLiteral(out MutableText result) public final function Parser MStringLiteral(out MutableText result)
{ {
local TextAPI api; local TextAPI api;
local Text.Character nextCharacter; local BaseText.Character nextCharacter;
local Text.Character usedQuotationMark; local BaseText.Character usedQuotationMark;
local Text.Character escapedCharacter; local BaseText.Character escapedCharacter;
ResetResultText(result); ResetResultText(result);
if (!Ok()) return self; if (!Ok()) return self;
usedQuotationMark = GetCharacter(); usedQuotationMark = GetCharacter();
@ -843,13 +855,13 @@ public final function Parser MStringLiteralS(out string result)
* @return Returns the caller `Parser`, to allow for function chaining. * @return Returns the caller `Parser`, to allow for function chaining.
*/ */
public final function Parser MUntil( public final function Parser MUntil(
out MutableText result, out MutableText result,
optional Text.Character characterBreak, optional BaseText.Character characterBreak,
optional bool whitespacesBreak, optional bool whitespacesBreak,
optional bool quotesBreak) optional bool quotesBreak)
{ {
local Text.Character nextCharacter; local BaseText.Character nextCharacter;
local TextAPI api; local TextAPI api;
ResetResultText(result); ResetResultText(result);
if (!Ok()) return self; if (!Ok()) return self;
@ -889,10 +901,10 @@ public final function Parser MUntil(
* @return Returns the caller `Parser`, to allow for function chaining. * @return Returns the caller `Parser`, to allow for function chaining.
*/ */
public final function Parser MUntilS( public final function Parser MUntilS(
out string result, out string result,
optional Text.Character characterBreak, optional BaseText.Character characterBreak,
optional bool whitespacesBreak, optional bool whitespacesBreak,
optional bool quotesBreak) optional bool quotesBreak)
{ {
local MutableText wrapper; local MutableText wrapper;
if (!Ok()) return self; if (!Ok()) return self;
@ -929,14 +941,14 @@ public final function Parser MUntilS(
*/ */
public final function Parser MUntilMany( public final function Parser MUntilMany(
out MutableText result, out MutableText result,
array<Text> separators, array<BaseText> separators,
optional bool whitespacesBreak, optional bool whitespacesBreak,
optional bool quotesBreak) optional bool quotesBreak)
{ {
local bool foundEnd; local bool foundEnd;
local int i, pointerShift; local int i, pointerShift;
local array<int> completions; local array<int> completions;
local Text.Character nextCharacter, separatorCharacter; local BaseText.Character nextCharacter, separatorCharacter;
ResetResultText(result); ResetResultText(result);
if (!Ok()) return self; if (!Ok()) return self;
@ -1002,7 +1014,7 @@ public final function Parser MUntilMany(
*/ */
public final function Parser MUntilManyS( public final function Parser MUntilManyS(
out string result, out string result,
array<Text> separators, array<BaseText> separators,
optional bool whitespacesBreak, optional bool whitespacesBreak,
optional bool quotesBreak) optional bool quotesBreak)
{ {
@ -1093,8 +1105,8 @@ public final function Parser MStringS(out string result)
*/ */
public final function Parser MWhitespaces(out MutableText result) public final function Parser MWhitespaces(out MutableText result)
{ {
local Text.Character nextCharacter; local BaseText.Character nextCharacter;
local TextAPI api; local TextAPI api;
if (!Ok()) return self; if (!Ok()) return self;
api = _.text; api = _.text;
@ -1148,7 +1160,7 @@ public final function Parser MWhitespacesS(out string result)
* Any passed value is discarded. * Any passed value is discarded.
* @return Returns the caller `Parser`, to allow for function chaining. * @return Returns the caller `Parser`, to allow for function chaining.
*/ */
public final function Parser MCharacter(out Text.Character result) public final function Parser MCharacter(out BaseText.Character result)
{ {
if (!Ok()) return self; if (!Ok()) return self;
if (HasFinished()) return Fail(); if (HasFinished()) return Fail();
@ -1170,7 +1182,7 @@ public final function Parser MCharacter(out Text.Character result)
*/ */
public final function Parser MByte(out byte result) public final function Parser MByte(out byte result)
{ {
local Text.Character character; local BaseText.Character character;
if (!Ok()) return self; if (!Ok()) return self;
if (!MCharacter(character).Ok()) if (!MCharacter(character).Ok())

4
sources/Text/Tests/TEST_FormattedStrings.uc

@ -212,7 +212,7 @@ protected static function SubTest_TestGradientTwoColors()
TEST_ExpectTrue(currentColor.b == 56); TEST_ExpectTrue(currentColor.b == 56);
} }
protected static function CheckRedDecrease(Text sample, int from, int to) protected static function CheckRedDecrease(BaseText sample, int from, int to)
{ {
local int i; local int i;
local Color previousColor, currentColor; local Color previousColor, currentColor;
@ -227,7 +227,7 @@ protected static function CheckRedDecrease(Text sample, int from, int to)
} }
} }
protected static function CheckRedIncrease(Text sample, int from, int to) protected static function CheckRedIncrease(BaseText sample, int from, int to)
{ {
local int i; local int i;
local Color previousColor, currentColor; local Color previousColor, currentColor;

BIN
sources/Text/Tests/TEST_Parser.uc

Binary file not shown.

BIN
sources/Text/Tests/TEST_Text.uc

Binary file not shown.

BIN
sources/Text/Tests/TEST_TextAPI.uc

Binary file not shown.

BIN
sources/Text/Tests/TEST_UTF8EncoderDecoder.uc

Binary file not shown.

1475
sources/Text/Text.uc

File diff suppressed because it is too large Load Diff

153
sources/Text/TextAPI.uc

@ -1,6 +1,6 @@
/** /**
* API that provides functions for working with characters and for creating * API that provides functions for working with characters and for creating
* `Text` and `Parser` instances. * `Text`, `MutableText` and `Parser` instances.
* Copyright 2020 - 2022 Anton Tarasenko * Copyright 2020 - 2022 Anton Tarasenko
*------------------------------------------------------------------------------ *------------------------------------------------------------------------------
* This file is part of Acedia. * This file is part of Acedia.
@ -19,7 +19,7 @@
* along with Acedia. If not, see <https://www.gnu.org/licenses/>. * along with Acedia. If not, see <https://www.gnu.org/licenses/>.
*/ */
class TextAPI extends AcediaObject class TextAPI extends AcediaObject
dependson(Text); dependson(BaseText);
/** /**
* Creates a new `Formatting` structure that defines a default, * Creates a new `Formatting` structure that defines a default,
@ -29,9 +29,9 @@ class TextAPI extends AcediaObject
* *
* @return Empty formatting object. * @return Empty formatting object.
*/ */
public final function Text.Formatting EmptyFormatting() public final function BaseText.Formatting EmptyFormatting()
{ {
local Text.Formatting emptyFormatting; local BaseText.Formatting emptyFormatting;
return emptyFormatting; return emptyFormatting;
} }
@ -43,9 +43,9 @@ public final function Text.Formatting EmptyFormatting()
* @param color Color that formatting must have. * @param color Color that formatting must have.
* @return Formatting object that describes text colored with `color`. * @return Formatting object that describes text colored with `color`.
*/ */
public final function Text.Formatting FormattingFromColor(Color color) public final function BaseText.Formatting FormattingFromColor(Color color)
{ {
local Text.Formatting coloredFormatting; local BaseText.Formatting coloredFormatting;
coloredFormatting.isColored = true; coloredFormatting.isColored = true;
coloredFormatting.color = color; coloredFormatting.color = color;
return coloredFormatting; return coloredFormatting;
@ -62,8 +62,8 @@ public final function Text.Formatting FormattingFromColor(Color color)
* @return `true` if formattings are equal and `false` otherwise. * @return `true` if formattings are equal and `false` otherwise.
*/ */
public final function bool IsFormattingEqual( public final function bool IsFormattingEqual(
Text.Formatting formatting1, BaseText.Formatting formatting1,
Text.Formatting formatting2) BaseText.Formatting formatting2)
{ {
if (formatting1.isColored != formatting2.isColored) { if (formatting1.isColored != formatting2.isColored) {
return false; return false;
@ -85,7 +85,7 @@ public final function bool IsFormattingEqual(
* @param character Character to test for lower case. * @param character Character to test for lower case.
* @return `true` if given character is lower case. * @return `true` if given character is lower case.
*/ */
public final function bool IsLower(Text.Character character) public final function bool IsLower(BaseText.Character character)
{ {
// Small Latin letters // Small Latin letters
if (character.codePoint >= 97 && character.codePoint <= 122) { if (character.codePoint >= 97 && character.codePoint <= 122) {
@ -113,7 +113,7 @@ public final function bool IsLower(Text.Character character)
* @param character Character to test for upper case. * @param character Character to test for upper case.
* @return `true` if given character is upper case. * @return `true` if given character is upper case.
*/ */
public final function bool IsUpper(Text.Character character) public final function bool IsUpper(BaseText.Character character)
{ {
// Capital Latin letters // Capital Latin letters
if (character.codePoint >= 65 && character.codePoint <= 90) { if (character.codePoint >= 65 && character.codePoint <= 90) {
@ -136,7 +136,7 @@ public final function bool IsUpper(Text.Character character)
* @param codePoint Unicode code point to check for being a digit. * @param codePoint Unicode code point to check for being a digit.
* @return `true` if given Unicode code point is a digit, `false` otherwise. * @return `true` if given Unicode code point is a digit, `false` otherwise.
*/ */
public final function bool IsDigit(Text.Character character) public final function bool IsDigit(BaseText.Character character)
{ {
if (character.codePoint >= 48 && character.codePoint <= 57) { if (character.codePoint >= 48 && character.codePoint <= 57) {
return true; return true;
@ -152,7 +152,7 @@ public final function bool IsDigit(Text.Character character)
* @return `true` if given Unicode code point belongs to a latin alphabet, * @return `true` if given Unicode code point belongs to a latin alphabet,
* `false` otherwise. * `false` otherwise.
*/ */
public final function bool IsAlpha(Text.Character character) public final function bool IsAlpha(BaseText.Character character)
{ {
// Capital Latin letters // Capital Latin letters
if (character.codePoint >= 65 && character.codePoint <= 90) { if (character.codePoint >= 65 && character.codePoint <= 90) {
@ -171,7 +171,7 @@ public final function bool IsAlpha(Text.Character character)
* @param character Character to check for being from ASCII. * @param character Character to check for being from ASCII.
* @return `true` if given character is a digit, `false` otherwise. * @return `true` if given character is a digit, `false` otherwise.
*/ */
public final function bool IsASCII(Text.Character character) public final function bool IsASCII(BaseText.Character character)
{ {
if (character.codePoint >= 0 && character.codePoint <= 127) { if (character.codePoint >= 0 && character.codePoint <= 127) {
return true; return true;
@ -189,7 +189,7 @@ public final function bool IsASCII(Text.Character character)
* @param character Character to check for being a whitespace. * @param character Character to check for being a whitespace.
* @return `true` if given character is a whitespace, `false` otherwise. * @return `true` if given character is a whitespace, `false` otherwise.
*/ */
public final function bool IsWhitespace(Text.Character character) public final function bool IsWhitespace(BaseText.Character character)
{ {
switch (character.codePoint) switch (character.codePoint)
{ {
@ -232,7 +232,7 @@ public final function bool IsWhitespace(Text.Character character)
* @return `true` if given Unicode code point denotes one of the recognized * @return `true` if given Unicode code point denotes one of the recognized
* quote symbols, `false` otherwise. * quote symbols, `false` otherwise.
*/ */
public final function bool IsQuotationMark(Text.Character character) public final function bool IsQuotationMark(BaseText.Character character)
{ {
if (character.codePoint == 0x0022) return true; if (character.codePoint == 0x0022) return true;
if (character.codePoint == 0x0027) return true; if (character.codePoint == 0x0027) return true;
@ -252,11 +252,11 @@ public final function bool IsQuotationMark(Text.Character character)
* `formatting`. * `formatting`.
*/ */
// TODO: Validity checks fro non-negative input code points // TODO: Validity checks fro non-negative input code points
public final function Text.Character CharacterFromCodePoint( public final function BaseText.Character CharacterFromCodePoint(
int codePoint, int codePoint,
optional Text.Formatting formatting) optional BaseText.Formatting formatting)
{ {
local Text.Character result; local BaseText.Character result;
result.codePoint = codePoint; result.codePoint = codePoint;
result.formatting = formatting; result.formatting = formatting;
return result; return result;
@ -266,7 +266,7 @@ public final function Text.Character CharacterFromCodePoint(
* Extracts a character at position `position` from a given plain `string`. * Extracts a character at position `position` from a given plain `string`.
* *
* For extracting multiple character or character from colored/formatted * For extracting multiple character or character from colored/formatted
* `string` we advice to convert `string` into `Text` instead. * `string` we advice to convert `string` into `BaseText` instead.
* *
* @param source `string`, from which to extract the character. * @param source `string`, from which to extract the character.
* @param position Position of the character to extract, starts from `0`. * @param position Position of the character to extract, starts from `0`.
@ -274,11 +274,11 @@ public final function Text.Character CharacterFromCodePoint(
* If specified position is invalid (`< 0` or `>= Len(source)`), * If specified position is invalid (`< 0` or `>= Len(source)`),
* returns invalid character. * returns invalid character.
*/ */
public final function Text.Character GetCharacter( public final function BaseText.Character GetCharacter(
string source, string source,
optional int position) optional int position)
{ {
local Text.Character result; local BaseText.Character result;
if (position < 0) return GetInvalidCharacter(); if (position < 0) return GetInvalidCharacter();
if (position >= Len(source)) return GetInvalidCharacter(); if (position >= Len(source)) return GetInvalidCharacter();
@ -287,34 +287,34 @@ public final function Text.Character GetCharacter(
} }
/** /**
* Auxiliary method for checking whether `Text` object defines an "empty" * Auxiliary method for checking whether `BaseText` object defines an "empty"
* `string`. That is, if it's either `none` or has empty contents. * `string`. That is, if it's either `none` or has empty contents.
* *
* It is added, since it allows to replace two common checks * It is added, since it allows to replace two common checks
* `text == none || text.IsEmpty()` with a nicer looking one: * `text == none || text.IsEmpty()` with a nicer looking one:
* `_.text.IsEmpty(text)`. * `_.text.IsEmpty(text)`.
* *
* @param text `Text` to check for emptiness. * @param text `BaseText` to check for emptiness.
* @return `true` iff either passed `text == none` or `text.IsEmpty()`. * @return `true` iff either passed `text == none` or `text.IsEmpty()`.
*/ */
public final function bool IsEmpty(Text text) public final function bool IsEmpty(BaseText text)
{ {
return (text == none || text.IsEmpty()); return (text == none || text.IsEmpty());
} }
/** /**
* Converts given `Text` into a plain `string`, returns it's value and * Converts given `BaseText` into a plain `string`, returns it's value and
* deallocates passed `Text`. * deallocates passed `BaseText`.
* *
* Method introduced to simplify a common use-case of converting returned copy * Method introduced to simplify a common use-case of converting returned copy
* of `Text` into a `string`, which required additional variable to store and * of `BaseText` into a `string`, which required additional variable to store
* later deallocate `Text` reference. * and later deallocate `BaseText` reference.
* *
* @param toConvert `Text` to convert. * @param toConvert `BaseText` to convert.
* @return `string` representation of passed `Text` as a plain `string`. * @return `string` representation of passed `BaseText` as a plain string.
* Empty `string`, if `toConvert == none`. * Empty `string`, if `toConvert == none`.
*/ */
public final function string ToString(Text toConvert) public final function string ToString(/*take*/ BaseText toConvert)
{ {
local string result; local string result;
if (toConvert != none) { if (toConvert != none) {
@ -325,18 +325,18 @@ public final function string ToString(Text toConvert)
} }
/** /**
* Converts given `Text` into a colored `string`, returns it's value and * Converts given `BaseText` into a colored `string`, returns it's value and
* deallocates passed `Text`. * deallocates passed `BaseText`.
* *
* Method introduced to simplify a common use-case of converting returned copy * Method introduced to simplify a common use-case of converting returned copy
* of `Text` into a `string`, which required additional variable to store and * of `BaseText` into a `string`, which required additional variable to store
* later deallocate `Text` reference. * and later deallocate `BaseText` reference.
* *
* @param toConvert `Text` to convert. * @param toConvert `BaseText` to convert.
* @return `string` representation of passed `Text` as a colored `string`. * @return `string` representation of passed `BaseText` as a colored `string`.
* Empty `string`, if `toConvert == none`. * Empty `string`, if `toConvert == none`.
*/ */
public final function string ToColoredString(Text toConvert) public final function string ToColoredString(/*take*/ Text toConvert)
{ {
local string result; local string result;
if (toConvert != none) { if (toConvert != none) {
@ -347,18 +347,18 @@ public final function string ToColoredString(Text toConvert)
} }
/** /**
* Converts given `Text` into a formatted `string`, returns it's value and * Converts given `BaseText` into a formatted `string`, returns it's value and
* deallocates passed `Text`. * deallocates passed `BaseText`.
* *
* Method introduced to simplify a common use-case of converting returned copy * Method introduced to simplify a common use-case of converting returned copy
* of `Text` into a `string`, which required additional variable to store and * of `BaseText` into a `string`, which required additional variable to store
* later deallocate `Text` reference. * and later deallocate `BaseText` reference.
* *
* @param toConvert `Text` to convert. * @param toConvert `BaseText` to convert.
* @return `string` representation of passed `Text` as a formatted `string`. * @return `string` representation of passed `BaseText` as a formatted `string`.
* Empty `string`, if `toConvert == none`. * Empty `string`, if `toConvert == none`.
*/ */
public final function string ToFormattedString(Text toConvert) public final function string ToFormattedString(/*take*/ BaseText toConvert)
{ {
local string result; local string result;
if (toConvert != none) { if (toConvert != none) {
@ -375,7 +375,7 @@ public final function string ToFormattedString(Text toConvert)
* @return `string` that consists only of a given character, * @return `string` that consists only of a given character,
* if given character is valid. Empty `string` otherwise. * if given character is valid. Empty `string` otherwise.
*/ */
public final function string CharacterToString(Text.Character character) public final function string CharacterToString(BaseText.Character character)
{ {
if (!IsValidCharacter(character)) { if (!IsValidCharacter(character)) {
return ""; return "";
@ -404,7 +404,7 @@ public final function string CharacterToString(Text.Character character)
* `-1` if given character does not represent anything in the given base. * `-1` if given character does not represent anything in the given base.
*/ */
public final function int CharacterToInt( public final function int CharacterToInt(
Text.Character character, BaseText.Character character,
optional int base optional int base
) )
{ {
@ -439,7 +439,9 @@ public final function int CharacterToInt(
* @return `true` if given character can be represented by a given code point * @return `true` if given character can be represented by a given code point
* and `false` otherwise. * and `false` otherwise.
*/ */
public final function bool IsCodePoint(Text.Character character, int codePoint) public final function bool IsCodePoint(
BaseText.Character character,
int codePoint)
{ {
return (character.codePoint == codePoint); return (character.codePoint == codePoint);
} }
@ -451,10 +453,10 @@ public final function bool IsCodePoint(Text.Character character, int codePoint)
* @return Returns formatting of the given character. * @return Returns formatting of the given character.
* Always returns 'null' (not colored) formatting for invalid characters. * Always returns 'null' (not colored) formatting for invalid characters.
*/ */
public final function Text.Formatting GetCharacterFormatting( public final function BaseText.Formatting GetCharacterFormatting(
Text.Character character) BaseText.Character character)
{ {
local Text.Formatting emptyFormatting; local BaseText.Formatting emptyFormatting;
if(IsValidCharacter(character)) { if(IsValidCharacter(character)) {
return character.formatting; return character.formatting;
} }
@ -469,9 +471,9 @@ public final function Text.Formatting GetCharacterFormatting(
* @return Same character as `character`, but with new formatting. * @return Same character as `character`, but with new formatting.
* Invalid characters are not altered. * Invalid characters are not altered.
*/ */
public final function Text.Character SetFormatting( public final function BaseText.Character SetFormatting(
Text.Character character, BaseText.Character character,
Text.Formatting newFormatting) BaseText.Formatting newFormatting)
{ {
if(!IsValidCharacter(character)) { if(!IsValidCharacter(character)) {
return character; return character;
@ -492,8 +494,8 @@ public final function Text.Character SetFormatting(
* `defaultColor`. * `defaultColor`.
*/ */
public final function Color GetCharacterColor( public final function Color GetCharacterColor(
Text.Character character, BaseText.Character character,
optional Color defaultColor) optional Color defaultColor)
{ {
if (character.formatting.isColored) { if (character.formatting.isColored) {
return character.formatting.color; return character.formatting.color;
@ -508,9 +510,9 @@ public final function Color GetCharacterColor(
* *
* @return Invalid character instance. * @return Invalid character instance.
*/ */
public final function Text.Character GetInvalidCharacter() public final function BaseText.Character GetInvalidCharacter()
{ {
local Text.Character result; local BaseText.Character result;
result.codePoint = -1; result.codePoint = -1;
return result; return result;
} }
@ -521,7 +523,7 @@ public final function Text.Character GetInvalidCharacter()
* @param character Character to check. * @param character Character to check.
* @return `true` if passed character is valid and `false` otherwise. * @return `true` if passed character is valid and `false` otherwise.
*/ */
public final function bool IsValidCharacter(Text.Character character) public final function bool IsValidCharacter(BaseText.Character character)
{ {
return (character.codePoint >= 0); return (character.codePoint >= 0);
} }
@ -548,10 +550,10 @@ public final function bool IsValidCharacter(Text.Character character)
* `false` otherwise. * `false` otherwise.
*/ */
public final function bool AreEqual( public final function bool AreEqual(
Text.Character character1, BaseText.Character character1,
Text.Character character2, BaseText.Character character2,
optional Text.CaseSensitivity caseSensitivity, optional BaseText.CaseSensitivity caseSensitivity,
optional Text.FormatSensitivity formatSensitivity optional BaseText.FormatSensitivity formatSensitivity
) )
{ {
// These handle checks with invalid characters // These handle checks with invalid characters
@ -572,7 +574,7 @@ public final function bool AreEqual(
} }
/** /**
* Converts Unicode code point into it's lower case folding, * Converts Unicode code point into its lower case folding,
* as defined by Unicode standard. * as defined by Unicode standard.
* *
* @param codePoint Code point to convert into lower case. * @param codePoint Code point to convert into lower case.
@ -580,7 +582,7 @@ public final function bool AreEqual(
* not define any lower case folding (like "&" or "!") for given code point, - * not define any lower case folding (like "&" or "!") for given code point, -
* function returns given code point unchanged. * function returns given code point unchanged.
*/ */
public final function Text.Character ToLower(Text.Character character) public final function BaseText.Character ToLower(BaseText.Character character)
{ {
local int newCodePoint; local int newCodePoint;
newCodePoint = newCodePoint =
@ -600,7 +602,7 @@ public final function Text.Character ToLower(Text.Character character)
* not define any upper case version (like "&" or "!") for given code point, - * not define any upper case version (like "&" or "!") for given code point, -
* function returns given code point unchanged. * function returns given code point unchanged.
*/ */
public final function Text.Character ToUpper(Text.Character character) public final function BaseText.Character ToUpper(BaseText.Character character)
{ {
local int newCodePoint; local int newCodePoint;
newCodePoint = newCodePoint =
@ -612,21 +614,21 @@ public final function Text.Character ToUpper(Text.Character character)
} }
/** /**
* Prepares an array of parts from a given single `Text`. * Prepares an array of parts from a given single `BaseText`.
* First character is treated as a separator with which the rest of * First character is treated as a separator with which the rest of
* the given `Text` is split into parts: * the given `BaseText` is split into parts:
* ~ "/ab/c/d" => ["ab", "c", "d"] * ~ "/ab/c/d" => ["ab", "c", "d"]
* ~ "zWordzomgzz" => ["Word", "omg", "", ""] * ~ "zWordzomgzz" => ["Word", "omg", "", ""]
* *
* This method is useful to easily prepare array of words for `Parser`'s * This method is useful to easily prepare array of words for `Parser`'s
* methods. * methods.
* *
* @param source `Text` that contains separator with parts to * @param source `BaseText` that contains separator with parts to
* separate and extract. * separate and extract.
* @return Separated words. Empty array if passed `source` was empty, * @return Separated words. Empty array if passed `source` was empty,
* otherwise contains at least one element. * otherwise contains at least one element.
*/ */
public final function array<MutableText> Parts(Text source) public final function array<MutableText> Parts(BaseText source)
{ {
local array<MutableText> result; local array<MutableText> result;
if (source == none) return result; if (source == none) return result;
@ -757,16 +759,17 @@ public final function Parser NewParser()
} }
/** /**
* Method for creating a new parser, initialized with contents of given `Text`. * Method for creating a new parser, initialized with contents of given
* `BaseText`.
* *
* @param source Returned `Parser` will be setup to parse the contents of * @param source Returned `Parser` will be setup to parse the contents of
* the passed `Text`. * the passed `BaseText`.
* If `none` value is passed, - parser won't be initialized. * If `none` value is passed, - parser won't be initialized.
* @return Guaranteed to be not `none` and contain a valid `Parser`. * @return Guaranteed to be not `none` and contain a valid `Parser`.
* If passed argument also is not `none`, - guaranteed to be * If passed argument also is not `none`, - guaranteed to be
* initialized with it's content. * initialized with it's content.
*/ */
public final function Parser Parse(Text source) public final function Parser Parse(BaseText source)
{ {
local Parser parser; local Parser parser;
parser = NewParser(); parser = NewParser();
@ -798,7 +801,7 @@ public final function Parser ParseString(string source)
* if given character is valid. Empty `Text` otherwise. * if given character is valid. Empty `Text` otherwise.
* Guaranteed to be not `none`. * Guaranteed to be not `none`.
*/ */
public final function Text FromCharacter(Text.Character character) public final function Text FromCharacter(BaseText.Character character)
{ {
return _.text.FromString(CharacterToString(character)); return _.text.FromString(CharacterToString(character));
} }

8
sources/Users/User.uc

@ -88,8 +88,8 @@ public final function int GetKey()
* `_.users.PersistentStorageExists() == true`. * `_.users.PersistentStorageExists() == true`.
*/ */
public final function DBReadTask ReadPersistentData( public final function DBReadTask ReadPersistentData(
Text groupName, BaseText groupName,
Text dataName) BaseText dataName)
{ {
local DBReadTask task; local DBReadTask task;
if (groupName == none) return none; if (groupName == none) return none;
@ -123,8 +123,8 @@ public final function DBReadTask ReadPersistentData(
* `_.users.PersistentStorageExists() == true`. * `_.users.PersistentStorageExists() == true`.
*/ */
public final function DBWriteTask WritePersistentData( public final function DBWriteTask WritePersistentData(
Text groupName, BaseText groupName,
Text dataName, BaseText dataName,
AcediaObject data) AcediaObject data)
{ {
local DBWriteTask task; local DBWriteTask task;

2
sources/Users/UserAPI.uc

@ -53,7 +53,7 @@ public final function User Fetch(UserID userID)
* @return Corresponding `User` object. Guaranteed to be a valid non-`none` * @return Corresponding `User` object. Guaranteed to be a valid non-`none`
* reference. * reference.
*/ */
public final function User FetchByIDHash(Text idHash) public final function User FetchByIDHash(BaseText idHash)
{ {
local UserID userID; local UserID userID;
local UserDatabase userDB; local UserDatabase userDB;

2
sources/Users/UserDatabase.uc

@ -66,7 +66,7 @@ public final static function UserDatabase GetInstance()
* correctly initialized with given `idHash` (guaranteed not to happen for * correctly initialized with given `idHash` (guaranteed not to happen for
* any valid id hashes). * any valid id hashes).
*/ */
public final function UserID FetchUserID(Text idHash) public final function UserID FetchUserID(BaseText idHash)
{ {
local int i; local int i;
local UserID.SteamID steamID; local UserID.SteamID steamID;

4
sources/Users/UserID.uc

@ -129,7 +129,7 @@ private final function string GetSteamAccountTypeCharacter()
* @param steamID64 Steam64 ID's decimal representation. * @param steamID64 Steam64 ID's decimal representation.
* @return `SteamID` generated from a given Steam64 ID `steamID64`. * @return `SteamID` generated from a given Steam64 ID `steamID64`.
*/ */
public static final function SteamID GetSteamIDFromIDHash(Text steamID64) public static final function SteamID GetSteamIDFromIDHash(BaseText steamID64)
{ {
local int i; local int i;
local SteamID newSteamID; local SteamID newSteamID;
@ -170,7 +170,7 @@ public static final function SteamID GetSteamIDFromIDHash(Text steamID64)
* (can happen if caller `UserID` was already initialized * (can happen if caller `UserID` was already initialized
* or `steamID64 == none`). * or `steamID64 == none`).
*/ */
public final function bool Initialize(Text steamID64) public final function bool Initialize(BaseText steamID64)
{ {
if (initialized) return false; if (initialized) return false;
if (steamID64 == none) return false; if (steamID64 == none) return false;

Loading…
Cancel
Save