Use StringBuilder for GetString/GetStringWithArgs, as per upstream

Update dependent code as required
This commit is contained in:
Jonathan G Rennison
2024-01-05 21:12:54 +00:00
parent 1b7a5372ec
commit f034714559
61 changed files with 1064 additions and 1228 deletions

View File

@@ -26,7 +26,7 @@ public:
* @return A string.
* @api -all
*/
virtual const std::string GetEncodedText() = 0;
virtual std::string GetEncodedText() = 0;
/**
* Convert a #ScriptText into a decoded normal string.
@@ -44,7 +44,7 @@ class RawText : public Text {
public:
RawText(const std::string &text);
const std::string GetEncodedText() override { return this->text; }
std::string GetEncodedText() override { return this->text; }
private:
const std::string text;
};
@@ -125,7 +125,7 @@ public:
/**
* @api -all
*/
const std::string GetEncodedText() override;
std::string GetEncodedText() override;
private:
using ScriptTextRef = ScriptObjectRef<ScriptText>;
@@ -140,13 +140,11 @@ private:
/**
* Internal function for recursive calling this function over multiple
* instances, while writing in the same buffer.
* @param p The current position in the buffer.
* @param lastofp The last position valid in the buffer.
* @param output The output to write the encoded text to.
* @param param_count The number of parameters that are in the string.
* @param seen_ids The list of seen StringID.
* @return The new current position in the buffer.
*/
char *_GetEncodedText(char *p, char *lastofp, int &param_count, StringIDList &seen_ids);
void _GetEncodedText(std::back_insert_iterator<std::string> &output, int &param_count, StringIDList &seen_ids);
/**
* Set a parameter, where the value is the first item on the stack.