From 9b6dbfa6bd75cc5c28f5b6a8ac450a70d381e495 Mon Sep 17 00:00:00 2001 From: Anton Tarasenko Date: Sun, 19 Jun 2022 00:38:02 +0700 Subject: [PATCH] Remove useless `ConstFrom...()` text methods --- sources/Text/BaseText.uc | 59 -------------------------------- sources/Text/Tests/TEST_Text.uc | Bin 125686 -> 125080 bytes sources/Text/TextAPI.uc | 21 ++++++++++-- 3 files changed, 18 insertions(+), 62 deletions(-) diff --git a/sources/Text/BaseText.uc b/sources/Text/BaseText.uc index 23ff3bf..90e7b48 100644 --- a/sources/Text/BaseText.uc +++ b/sources/Text/BaseText.uc @@ -198,65 +198,6 @@ protected final function ReformatRange( NormalizeFormatting(); } -/** - * Static method for creating an immutable `Text` object from (plain) `string`. - * - * It is preferred to use `TextAPI` methods for creating `Text` instances. - * - * @param source Plain `string` to convert into `Text`. - * @return `Text` instance (guaranteed to be not `none`) that stores contents - * of `source` if treated as a plain `string`. - */ -public static final function Text ConstFromPlainString(string source) -{ - local MutableText builder; - local Text result; - builder = MutableText(__().memory.Allocate(class'MutableText')); - result = builder.AppendString(source).Copy(); - builder.FreeSelf(); - return result; -} - -/** - * Static method for creating an immutable `Text` object from - * (colored) `string`. - * - * It is preferred to use `TextAPI` methods for creating `Text` instances. - * - * @param source Colored `string` to convert into `Text`. - * @return `Text` instance (guaranteed to be not `none`) that stores contents - * of `source` if treated as a colored `string`. - */ -public static final function Text ConstFromColoredString(string source) -{ - local MutableText builder; - local Text result; - builder = MutableText(__().memory.Allocate(class'MutableText')); - result = builder.AppendColoredString(source).Copy(); - builder.FreeSelf(); - return result; -} - -/** - * Static method for creating an immutable `Text` object from - * (formatted) `string`. - * - * It is preferred to use `TextAPI` methods for creating `Text` instances. - * - * @param source Formatted `string` to convert into `Text`. - * @return `Text` instance (guaranteed to be not `none`) that stores contents - * of `source` if treated as a formatted `string`. - */ -public static final function Text ConstFromFormattedString(string source) -{ - local MutableText builder; - local Text result; - builder = MutableText(__().memory.Allocate(class'MutableText')); - result = builder.AppendFormattedString(source).Copy(); - builder.FreeSelf(); - return result; -} - /** * Makes an immutable copy (`class'Text'`) of the caller `BaseText`. * diff --git a/sources/Text/Tests/TEST_Text.uc b/sources/Text/Tests/TEST_Text.uc index 46af352ea5ce510548d247e1307bf5c3ef23aa15..8b0502c78b61f55bd188ce28aba3baa717ab9713 100644 GIT binary patch delta 633 zcmex%m3_uV_6^p8li7F5O#fTQ$TL|xMq_fmoY-VrIf2dB1!I^%GLwI1xgi8aq?o3E ze8^}u`F^0rkc@GypMVs#j{^P`_0O&1{+cGwS8O2TfMFyvng27}^_JRW}yqSGNk}|>z+b`Qd!$WPd$2 delta 1094 zcmbPnk^S3M_6^p8liQutgq<1k8S)s48A=%37>a=GT!w(j0m`D2eU&vP=ZmOq-Y6Ku zG&wp}jT5eLvw}!J6M{SWfRq2^_r`LY^~ForP=qx%---KuKf5&wwCZ3$ktL3oyvsxAhHBHT&{6DJ#XtK%V{9u{M@@71n!cI*aE>7N^=&^ZioC+s3P0if=KkE$G zok)?YAfh_?Z@I|ycqK-@$@A~9ZPqRpLP}km14^5j@Ht}g?{WtM@@kXs*9%OZSs^hw zwipJ9os5Klx=tCNKKxr zF96mPKNs#oRMR)_ujbJ}6`EXsNNlt0k}gh6;mNW~dM0yQNNt|KZiy1!V5vPMHM#$R q&}9Bg9Fyl?1m`Ct;}k^nC*OXc29z~J5)CM|Z=QZ>`}9kUjA8)K#Z##O diff --git a/sources/Text/TextAPI.uc b/sources/Text/TextAPI.uc index 0fc75da..e356db2 100644 --- a/sources/Text/TextAPI.uc +++ b/sources/Text/TextAPI.uc @@ -665,7 +665,12 @@ public final function MutableText Empty() */ public final function Text FromString(string source) { - return class'Text'.static.ConstFromPlainString(source); + local MutableText builder; + local Text result; + builder = MutableText(_.memory.Allocate(class'MutableText')); + result = builder.AppendString(source).Copy(); + builder.FreeSelf(); + return result; } /** @@ -695,7 +700,12 @@ public final function MutableText FromStringM(string source) */ public final function Text FromColoredString(string source) { - return class'Text'.static.ConstFromColoredString(source); + local MutableText builder; + local Text result; + builder = MutableText(_.memory.Allocate(class'MutableText')); + result = builder.AppendColoredString(source).Copy(); + builder.FreeSelf(); + return result; } /** @@ -725,7 +735,12 @@ public final function MutableText FromColoredStringM(string source) */ public final function Text FromFormattedString(string source) { - return class'Text'.static.ConstFromFormattedString(source); + local MutableText builder; + local Text result; + builder = MutableText(_.memory.Allocate(class'MutableText')); + result = builder.AppendFormattedString(source).Copy(); + builder.FreeSelf(); + return result; } /**