Browse Source

Replaced string_parseInteger and string_parseDouble to simplify reading the code.

David Piuva 5 years ago
parent
commit
77996d3b13

+ 0 - 64
Source/DFPSR/base/text.cpp

@@ -179,14 +179,6 @@ ReadableString dsr::string_removeOuterWhiteSpace(const ReadableString &text) {
 	}
 	}
 }
 }
 
 
-int64_t dsr::string_parseInteger(const ReadableString& content) {
-	return content.toInteger();
-}
-
-double dsr::string_parseDouble(const ReadableString& content) {
-	return content.toDouble();
-}
-
 String dsr::string_mangleQuote(const ReadableString &rawText) {
 String dsr::string_mangleQuote(const ReadableString &rawText) {
 	String result;
 	String result;
 	result.reserve(rawText.length() + 2);
 	result.reserve(rawText.length() + 2);
@@ -681,62 +673,6 @@ List<ReadableString> dsr::string_split(const ReadableString& source, DsrChar sep
 	return result;
 	return result;
 }
 }
 
 
-// TODO: Delete
-int64_t ReadableString::toInteger() const {
-	int64_t result;
-	bool negated;
-	result = 0;
-	negated = false;
-	for (int i = 0; i < this->length(); i++) {
-		DsrChar c = this->readSection[i];
-		if (c == '-' || c == '~') {
-			negated = !negated;
-		} else if (c >= '0' && c <= '9') {
-			result = (result * 10) + (int)(c - '0');
-		} else if (c == ',' || c == '.') {
-			// Truncate any decimals by ignoring them
-			break;
-		}
-	}
-	if (negated) {
-		return -result;
-	} else {
-		return result;
-	}
-}
-
-// TODO: Delete
-double ReadableString::toDouble() const {
-	double result;
-	bool negated;
-	bool reachedDecimal;
-	int digitDivider;
-	result = 0.0;
-	negated = false;
-	reachedDecimal = false;
-	digitDivider = 1;
-	for (int i = 0; i < this->length(); i++) {
-		DsrChar c = this->readSection[i];
-		if (c == '-' || c == '~') {
-			negated = !negated;
-		} else if (c >= '0' && c <= '9') {
-			if (reachedDecimal) {
-				digitDivider = digitDivider * 10;
-				result = result + ((double)(c - '0') / (double)digitDivider);
-			} else {
-				result = (result * 10) + (double)(c - '0');
-			}
-		} else if (c == ',' || c == '.') {
-			reachedDecimal = true;
-		}
-	}
-	if (negated) {
-		return -result;
-	} else {
-		return result;
-	}
-}
-
 int64_t dsr::string_toInteger(const ReadableString& source) {
 int64_t dsr::string_toInteger(const ReadableString& source) {
 	int64_t result;
 	int64_t result;
 	bool negated;
 	bool negated;

+ 1 - 13
Source/DFPSR/base/text.h

@@ -47,6 +47,7 @@ protected:
 public:
 public:
 	int length() const;
 	int length() const;
 	DsrChar read(int index) const;
 	DsrChar read(int index) const;
+	// Returning the character by value prevents writing to memory that might be a constant literal or shared with other strings
 	DsrChar operator[] (int index) const;
 	DsrChar operator[] (int index) const;
 public:
 public:
 	// Empty string
 	// Empty string
@@ -72,10 +73,6 @@ public:
 	// A bug in GCC linking forces these to be virtual
 	// A bug in GCC linking forces these to be virtual
 	virtual std::ostream& toStream(std::ostream& out) const;
 	virtual std::ostream& toStream(std::ostream& out) const;
 	virtual std::string toStdString() const;
 	virtual std::string toStdString() const;
-public:
-	// TODO: Remove
-	int64_t toInteger() const;
-	double toDouble() const;
 };
 };
 
 
 class String;
 class String;
@@ -252,15 +249,6 @@ void string_split_inPlace(List<ReadableString> &target, const ReadableString& so
 int64_t string_toInteger(const ReadableString& source);
 int64_t string_toInteger(const ReadableString& source);
 // Post-condition: Returns the double precision floating-point representation of source.
 // Post-condition: Returns the double precision floating-point representation of source.
 double string_toDouble(const ReadableString& source);
 double string_toDouble(const ReadableString& source);
-// Pre-condition: Content must contain an integer, or unexpected things may happen.
-// Post-condition: Returns the numerical integer value of content while ignoring any forbidden characters.
-// Examples:
-//   string_parseInteger(U"-25") == -25 // Good case
-//   string_parseInteger(U" -25 ") == -25 // Still works
-//   string_parseInteger(U" 10x10 ") == 1010 // Any digits are simply added in order while ignoring the rest
-int64_t string_parseInteger(const ReadableString& content);
-// Post-condition: Returns the double-precision floating-point approximation of content's numerical value
-double string_parseDouble(const ReadableString& content);
 
 
 // Post-condition:
 // Post-condition:
 //   Returns the content of the file referred to be filename.
 //   Returns the content of the file referred to be filename.

+ 1 - 1
Source/DFPSR/gui/components/ListBox.cpp

@@ -338,7 +338,7 @@ String ListBox::call(const ReadableString &methodName, const ReadableString &arg
 		return U"";
 		return U"";
 	} else if (string_caseInsensitiveMatch(methodName, U"RemoveElement")) {
 	} else if (string_caseInsensitiveMatch(methodName, U"RemoveElement")) {
 		// Remove an element who's index is given in the only input argument
 		// Remove an element who's index is given in the only input argument
-		int64_t index = string_parseInteger(arguments);
+		int64_t index = string_toInteger(arguments);
 		if (index < 0 || index >= this->list.value.length()) {
 		if (index < 0 || index >= this->list.value.length()) {
 			throwError("Index (", arguments, " = ", index, ") out of bound in RemoveElement!\n");
 			throwError("Index (", arguments, " = ", index, ") out of bound in RemoveElement!\n");
 		}
 		}

+ 7 - 7
Source/DFPSR/image/Color.cpp

@@ -45,11 +45,11 @@ ColorRgbI32::ColorRgbI32(const ReadableString &content) : red(0), green(0), blue
 	List<ReadableString> elements = string_split(content, U',');
 	List<ReadableString> elements = string_split(content, U',');
 	int givenChannels = elements.length();
 	int givenChannels = elements.length();
 	if (givenChannels >= 1) {
 	if (givenChannels >= 1) {
-		this-> red = string_parseInteger(elements[0]);
+		this-> red = string_toInteger(elements[0]);
 		if (givenChannels >= 2) {
 		if (givenChannels >= 2) {
-			this-> green = string_parseInteger(elements[1]);
+			this-> green = string_toInteger(elements[1]);
 			if (givenChannels >= 3) {
 			if (givenChannels >= 3) {
-				this-> blue = string_parseInteger(elements[2]);
+				this-> blue = string_toInteger(elements[2]);
 			}
 			}
 		}
 		}
 	}
 	}
@@ -77,13 +77,13 @@ ColorRgbaI32::ColorRgbaI32(const ReadableString &content) : red(0), green(0), bl
 	List<ReadableString> elements = string_split(content, U',');
 	List<ReadableString> elements = string_split(content, U',');
 	int givenChannels = elements.length();
 	int givenChannels = elements.length();
 	if (givenChannels >= 1) {
 	if (givenChannels >= 1) {
-		this-> red = string_parseInteger(elements[0]);
+		this-> red = string_toInteger(elements[0]);
 		if (givenChannels >= 2) {
 		if (givenChannels >= 2) {
-			this-> green = string_parseInteger(elements[1]);
+			this-> green = string_toInteger(elements[1]);
 			if (givenChannels >= 3) {
 			if (givenChannels >= 3) {
-				this-> blue = string_parseInteger(elements[2]);
+				this-> blue = string_toInteger(elements[2]);
 				if (givenChannels >= 4) {
 				if (givenChannels >= 4) {
-					this-> alpha = string_parseInteger(elements[3]);
+					this-> alpha = string_toInteger(elements[3]);
 				}
 				}
 			}
 			}
 		}
 		}

+ 4 - 4
Source/DFPSR/math/FixedPoint.cpp

@@ -262,7 +262,7 @@ FixedPoint FixedPoint::fromText(const ReadableString& text) {
 	if (decimal > -1 && colon == -1) {
 	if (decimal > -1 && colon == -1) {
 		// Floating-point decimal
 		// Floating-point decimal
 		// TODO: Give warnings for incorrect whole integers
 		// TODO: Give warnings for incorrect whole integers
-		int64_t wholeInteger = string_parseInteger(string_before(content, decimal));
+		int64_t wholeInteger = string_toInteger(string_before(content, decimal));
 		ReadableString decimals = string_after(content, decimal);
 		ReadableString decimals = string_after(content, decimal);
 		uint64_t fraction = 0; // Extra high precision for accumulation
 		uint64_t fraction = 0; // Extra high precision for accumulation
 		for (int i = 0; i < string_length(decimals); i++) {
 		for (int i = 0; i < string_length(decimals); i++) {
@@ -278,14 +278,14 @@ FixedPoint FixedPoint::fromText(const ReadableString& text) {
 	} else if (decimal == -1 && colon > -1) {
 	} else if (decimal == -1 && colon > -1) {
 		// Whole integer and 16-bit fraction
 		// Whole integer and 16-bit fraction
 		// TODO: Give warnings for incorrect integers
 		// TODO: Give warnings for incorrect integers
-		int64_t wholeInteger = string_parseInteger(string_before(content, colon));
-		int64_t fraction = string_parseInteger(string_after(content, colon));
+		int64_t wholeInteger = string_toInteger(string_before(content, colon));
+		int64_t fraction = string_toInteger(string_after(content, colon));
 		clampForSaturatedWhole(wholeInteger);
 		clampForSaturatedWhole(wholeInteger);
 		if (isSigned) { fraction = -fraction; }
 		if (isSigned) { fraction = -fraction; }
 		result = (wholeInteger * 65536) + fraction;
 		result = (wholeInteger * 65536) + fraction;
 	} else if (decimal == -1 && colon == -1) {
 	} else if (decimal == -1 && colon == -1) {
 		// Whole
 		// Whole
-		int64_t wholeInteger = string_parseInteger(content);
+		int64_t wholeInteger = string_toInteger(content);
 		clampForSaturatedWhole(wholeInteger);
 		clampForSaturatedWhole(wholeInteger);
 		result = wholeInteger * 65536; // Does this need to saturate again?
 		result = wholeInteger * 65536; // Does this need to saturate again?
 	} // TODO: Give a warning if both . and : is used!
 	} // TODO: Give a warning if both . and : is used!

+ 1 - 1
Source/DFPSR/persistent/atomic/PersistentInteger.cpp

@@ -28,7 +28,7 @@ using namespace dsr;
 PERSISTENT_DEFINITION(PersistentInteger)
 PERSISTENT_DEFINITION(PersistentInteger)
 
 
 bool PersistentInteger::assignValue(const ReadableString &text) {
 bool PersistentInteger::assignValue(const ReadableString &text) {
-	this->value = string_parseInteger(text);
+	this->value = string_toInteger(text);
 	return true; // TODO: Discriminate bad input
 	return true; // TODO: Discriminate bad input
 }
 }
 
 

+ 2 - 2
Source/DFPSR/render/model/format/dmf1.cpp

@@ -112,7 +112,7 @@ static int roundIndex(double value) {
 }
 }
 
 
 static void setProperty(ParserState &state, const String &propertyName, int index, const ReadableString &content) {
 static void setProperty(ParserState &state, const String &propertyName, int index, const ReadableString &content) {
-	float value = (float)string_parseDouble(content);
+	float value = (float)string_toDouble(content);
 	if (state.parserSpace == ParserSpace_Main) {
 	if (state.parserSpace == ParserSpace_Main) {
 		if PROPERTY_MATCH(FilterType) {
 		if PROPERTY_MATCH(FilterType) {
 			PARSER_NOINDEX
 			PARSER_NOINDEX
@@ -238,7 +238,7 @@ static void readToken(ParserState &state, const String &fileContent, int start,
 		} else if (fileContent[start] == U'[' && fileContent[end] == U']') {
 		} else if (fileContent[start] == U'[' && fileContent[end] == U']') {
 			// Index
 			// Index
 			if (state.parserState == ParserState_WaitForIndexOrProperty) {
 			if (state.parserState == ParserState_WaitForIndexOrProperty) {
-				state.propertyIndex = roundIndex(string_parseDouble(string_inclusiveRange(fileContent, start + 1, end - 1)));
+				state.propertyIndex = roundIndex(string_toDouble(string_inclusiveRange(fileContent, start + 1, end - 1)));
 			} else {
 			} else {
 				printText("Unexpected index!\n");
 				printText("Unexpected index!\n");
 			}
 			}

+ 2 - 2
Source/SDK/guiExample/main.cpp

@@ -43,14 +43,14 @@ int main(int argn, char **argv) {
 	component_setKeyDownEvent(myListBox, [](const KeyboardEvent& event) {
 	component_setKeyDownEvent(myListBox, [](const KeyboardEvent& event) {
 		if (event.dsrKey == DsrKey_Delete) {
 		if (event.dsrKey == DsrKey_Delete) {
 			// Delete from list
 			// Delete from list
-			int64_t index = string_parseInteger(component_call(myListBox, U"GetSelectedIndex"));
+			int64_t index = string_toInteger(component_call(myListBox, U"GetSelectedIndex"));
 			if (index > -1) {
 			if (index > -1) {
 				component_call(myListBox, U"RemoveElement", string_combine(index));
 				component_call(myListBox, U"RemoveElement", string_combine(index));
 			}
 			}
 		}
 		}
 	});
 	});
 	component_setPressedEvent(myListBox, []() {
 	component_setPressedEvent(myListBox, []() {
-		int64_t index = string_parseInteger(component_call(myListBox, U"GetSelectedIndex"));
+		int64_t index = string_toInteger(component_call(myListBox, U"GetSelectedIndex"));
 		String content = component_call(myListBox, U"GetSelectedText");
 		String content = component_call(myListBox, U"GetSelectedText");
 		printText("content is (", content, ") at index ", index, "\n");
 		printText("content is (", content, ") at index ", index, "\n");
 	});
 	});

+ 2 - 2
Source/SDK/sandbox/sprite/orthoAPI.h

@@ -192,9 +192,9 @@ public:
 		config_parse_ini(content, [this](const ReadableString& block, const ReadableString& key, const ReadableString& value) {
 		config_parse_ini(content, [this](const ReadableString& block, const ReadableString& key, const ReadableString& value) {
 			if (string_length(block) == 0) {
 			if (string_length(block) == 0) {
 				if (string_caseInsensitiveMatch(key, U"DownTiltPerThousand")) {
 				if (string_caseInsensitiveMatch(key, U"DownTiltPerThousand")) {
-					this->cameraTilt = (float)string_parseInteger(value) * -0.001f;
+					this->cameraTilt = (float)string_toInteger(value) * -0.001f;
 				} else if (string_caseInsensitiveMatch(key, U"PixelsPerTile")) {
 				} else if (string_caseInsensitiveMatch(key, U"PixelsPerTile")) {
-					this->pixelsPerTile = string_parseInteger(value);
+					this->pixelsPerTile = string_toInteger(value);
 				} else {
 				} else {
 					printText("Unrecognized key \"", key, "\" in orthogonal camera configuration file.\n");
 					printText("Unrecognized key \"", key, "\" in orthogonal camera configuration file.\n");
 				}
 				}

+ 8 - 8
Source/SDK/sandbox/sprite/spriteAPI.cpp

@@ -22,13 +22,13 @@ struct SpriteConfig {
 		config_parse_ini(content, [this](const ReadableString& block, const ReadableString& key, const ReadableString& value) {
 		config_parse_ini(content, [this](const ReadableString& block, const ReadableString& key, const ReadableString& value) {
 			if (string_length(block) == 0) {
 			if (string_length(block) == 0) {
 				if (string_caseInsensitiveMatch(key, U"CenterX")) {
 				if (string_caseInsensitiveMatch(key, U"CenterX")) {
-					this->centerX = string_parseInteger(value);
+					this->centerX = string_toInteger(value);
 				} else if (string_caseInsensitiveMatch(key, U"CenterY")) {
 				} else if (string_caseInsensitiveMatch(key, U"CenterY")) {
-					this->centerY = string_parseInteger(value);
+					this->centerY = string_toInteger(value);
 				} else if (string_caseInsensitiveMatch(key, U"FrameRows")) {
 				} else if (string_caseInsensitiveMatch(key, U"FrameRows")) {
-					this->frameRows = string_parseInteger(value);
+					this->frameRows = string_toInteger(value);
 				} else if (string_caseInsensitiveMatch(key, U"PropertyColumns")) {
 				} else if (string_caseInsensitiveMatch(key, U"PropertyColumns")) {
-					this->propertyColumns = string_parseInteger(value);
+					this->propertyColumns = string_toInteger(value);
 				} else if (string_caseInsensitiveMatch(key, U"MinBound")) {
 				} else if (string_caseInsensitiveMatch(key, U"MinBound")) {
 					this->minBound = parseFVector3D(value);
 					this->minBound = parseFVector3D(value);
 				} else if (string_caseInsensitiveMatch(key, U"MaxBound")) {
 				} else if (string_caseInsensitiveMatch(key, U"MaxBound")) {
@@ -41,7 +41,7 @@ struct SpriteConfig {
 						this->points.clear();
 						this->points.clear();
 						this->points.reserve(values.length() / 3);
 						this->points.reserve(values.length() / 3);
 						for (int v = 0; v < values.length(); v += 3) {
 						for (int v = 0; v < values.length(); v += 3) {
-							this->points.push(FVector3D(string_parseDouble(values[v]), string_parseDouble(values[v+1]), string_parseDouble(values[v+2])));
+							this->points.push(FVector3D(string_toDouble(values[v]), string_toDouble(values[v+1]), string_toDouble(values[v+2])));
 						}
 						}
 					}
 					}
 				} else if (string_caseInsensitiveMatch(key, U"TriangleIndices")) {
 				} else if (string_caseInsensitiveMatch(key, U"TriangleIndices")) {
@@ -52,7 +52,7 @@ struct SpriteConfig {
 						this->triangleIndices.clear();
 						this->triangleIndices.clear();
 						this->triangleIndices.reserve(values.length());
 						this->triangleIndices.reserve(values.length());
 						for (int v = 0; v < values.length(); v++) {
 						for (int v = 0; v < values.length(); v++) {
-							this->triangleIndices.push(string_parseInteger(values[v]));
+							this->triangleIndices.push(string_toInteger(values[v]));
 						}
 						}
 					}
 					}
 				} else {
 				} else {
@@ -979,8 +979,8 @@ static bool approximateTextMatch(const ReadableString &a, const ReadableString &
 			while (isDigit(a[readerA])) { readerA++; }
 			while (isDigit(a[readerA])) { readerA++; }
 			while (isDigit(b[readerB])) { readerB++; }
 			while (isDigit(b[readerB])) { readerB++; }
 			// Approximate values
 			// Approximate values
-			double valueA = string_parseDouble(string_exclusiveRange(a, startA, readerA));
-			double valueB = string_parseDouble(string_exclusiveRange(b, startB, readerB));
+			double valueA = string_toDouble(string_exclusiveRange(a, startA, readerA));
+			double valueB = string_toDouble(string_exclusiveRange(b, startB, readerB));
 			// Check the difference
 			// Check the difference
 			double diff = valueB - valueA;
 			double diff = valueB - valueA;
 			if (diff > tolerance || diff < -tolerance) {
 			if (diff > tolerance || diff < -tolerance) {

+ 1 - 1
Source/SDK/sandbox/sprite/spriteAPI.h

@@ -17,7 +17,7 @@ inline FVector3D parseFVector3D(const ReadableString& content) {
 		printText("Expected a vector of three decimal values.\n");
 		printText("Expected a vector of three decimal values.\n");
 		return FVector3D();
 		return FVector3D();
 	} else {
 	} else {
-		return FVector3D(string_parseDouble(args[0]), string_parseDouble(args[1]), string_parseDouble(args[2]));
+		return FVector3D(string_toDouble(args[0]), string_toDouble(args[1]), string_toDouble(args[2]));
 	}
 	}
 }
 }
 
 

+ 23 - 23
Source/SDK/sandbox/tool.cpp

@@ -223,17 +223,17 @@ if (string_caseInsensitiveMatch(key, NAME)) { \
 	} \
 	} \
 }
 }
 static void parse_assignment(ParserState& state, const ReadableString& key, const ReadableString& value) {
 static void parse_assignment(ParserState& state, const ReadableString& key, const ReadableString& value) {
-	MATCH_ASSIGN_GLOBAL(U"Angles", state.angles, string_parseInteger, "camera angle count")
+	MATCH_ASSIGN_GLOBAL(U"Angles", state.angles, string_toInteger, "camera angle count")
 	else MATCH_ASSIGN(part, U"Origin", state.partSettings.location.position, parseFVector3D, "origin")
 	else MATCH_ASSIGN(part, U"Origin", state.partSettings.location.position, parseFVector3D, "origin")
 	else MATCH_ASSIGN(part, U"XAxis", state.partSettings.location.transform.xAxis, parseFVector3D, "X-Axis")
 	else MATCH_ASSIGN(part, U"XAxis", state.partSettings.location.transform.xAxis, parseFVector3D, "X-Axis")
 	else MATCH_ASSIGN(part, U"YAxis", state.partSettings.location.transform.yAxis, parseFVector3D, "Y-Axis")
 	else MATCH_ASSIGN(part, U"YAxis", state.partSettings.location.transform.yAxis, parseFVector3D, "Y-Axis")
 	else MATCH_ASSIGN(part, U"ZAxis", state.partSettings.location.transform.zAxis, parseFVector3D, "Z-Axis")
 	else MATCH_ASSIGN(part, U"ZAxis", state.partSettings.location.transform.zAxis, parseFVector3D, "Z-Axis")
-	else MATCH_ASSIGN(part, U"Displacement", state.partSettings.displacement, string_parseDouble, "displacement")
-	else MATCH_ASSIGN(part, U"ClipZero", state.partSettings.clipZero, string_parseInteger, "zero clipping")
-	else MATCH_ASSIGN(part, U"Mirror", state.partSettings.mirror, string_parseInteger, "mirror flag")
-	else MATCH_ASSIGN(part, U"PatchWidth", state.partSettings.patchWidth, string_parseDouble, "patch width")
-	else MATCH_ASSIGN(part, U"PatchHeight", state.partSettings.patchHeight, string_parseDouble, "patch height")
-	else MATCH_ASSIGN(part, U"Radius", state.partSettings.radius, string_parseDouble, "radius")
+	else MATCH_ASSIGN(part, U"Displacement", state.partSettings.displacement, string_toDouble, "displacement")
+	else MATCH_ASSIGN(part, U"ClipZero", state.partSettings.clipZero, string_toInteger, "zero clipping")
+	else MATCH_ASSIGN(part, U"Mirror", state.partSettings.mirror, string_toInteger, "mirror flag")
+	else MATCH_ASSIGN(part, U"PatchWidth", state.partSettings.patchWidth, string_toDouble, "patch width")
+	else MATCH_ASSIGN(part, U"PatchHeight", state.partSettings.patchHeight, string_toDouble, "patch height")
+	else MATCH_ASSIGN(part, U"Radius", state.partSettings.radius, string_toDouble, "radius")
 	else {
 	else {
 		printText("    Tried to assign ", value, " to unrecognized key ", key, ".\n");
 		printText("    Tried to assign ", value, " to unrecognized key ", key, ".\n");
 	}
 	}
@@ -427,7 +427,7 @@ static void loadPlyModel(ParserState& state, const ReadableString& content, bool
 						}
 						}
 						PlyProperty *currentProperty = &(currentElement->properties[propertyIndex]);
 						PlyProperty *currentProperty = &(currentElement->properties[propertyIndex]);
 						if (currentProperty->list) {
 						if (currentProperty->list) {
-							int listLength = string_parseInteger(tokens[tokenIndex]);
+							int listLength = string_toInteger(tokens[tokenIndex]);
 							tokenIndex++;
 							tokenIndex++;
 							// Detect polygons
 							// Detect polygons
 							if (inputMode == PlyDataInput::Face && string_caseInsensitiveMatch(currentProperty->name, U"VERTEX_INDICES")) {
 							if (inputMode == PlyDataInput::Face && string_caseInsensitiveMatch(currentProperty->name, U"VERTEX_INDICES")) {
@@ -437,10 +437,10 @@ static void loadPlyModel(ParserState& state, const ReadableString& content, bool
 								bool flipSides = flipX;
 								bool flipSides = flipX;
 								if (listLength == 4) {
 								if (listLength == 4) {
 									// Use a quad to save memory
 									// Use a quad to save memory
-									int indexA = string_parseInteger(tokens[tokenIndex]);
-									int indexB = string_parseInteger(tokens[tokenIndex + 1]);
-									int indexC = string_parseInteger(tokens[tokenIndex + 2]);
-									int indexD = string_parseInteger(tokens[tokenIndex + 3]);
+									int indexA = string_toInteger(tokens[tokenIndex]);
+									int indexB = string_toInteger(tokens[tokenIndex + 1]);
+									int indexC = string_toInteger(tokens[tokenIndex + 2]);
+									int indexD = string_toInteger(tokens[tokenIndex + 3]);
 									FVector4D colorA = vertices[indexA].color;
 									FVector4D colorA = vertices[indexA].color;
 									FVector4D colorB = vertices[indexB].color;
 									FVector4D colorB = vertices[indexB].color;
 									FVector4D colorC = vertices[indexC].color;
 									FVector4D colorC = vertices[indexC].color;
@@ -470,12 +470,12 @@ static void loadPlyModel(ParserState& state, const ReadableString& content, bool
 									}
 									}
 								} else {
 								} else {
 									// Polygon generating a triangle fan
 									// Polygon generating a triangle fan
-									int indexA = string_parseInteger(tokens[tokenIndex]);
-									int indexB = string_parseInteger(tokens[tokenIndex + 1]);
+									int indexA = string_toInteger(tokens[tokenIndex]);
+									int indexB = string_toInteger(tokens[tokenIndex + 1]);
 									FVector4D colorA = vertices[indexA].color;
 									FVector4D colorA = vertices[indexA].color;
 									FVector4D colorB = vertices[indexB].color;
 									FVector4D colorB = vertices[indexB].color;
 									for (int i = 2; i < listLength; i++) {
 									for (int i = 2; i < listLength; i++) {
-										int indexC = string_parseInteger(tokens[tokenIndex + i]);
+										int indexC = string_toInteger(tokens[tokenIndex + i]);
 										FVector4D colorC = vertices[indexC].color;
 										FVector4D colorC = vertices[indexC].color;
 										// Create a triangle
 										// Create a triangle
 										if (flipSides) {
 										if (flipSides) {
@@ -507,7 +507,7 @@ static void loadPlyModel(ParserState& state, const ReadableString& content, bool
 						} else {
 						} else {
 							// Detect vertex data
 							// Detect vertex data
 							if (inputMode == PlyDataInput::Vertex) {
 							if (inputMode == PlyDataInput::Vertex) {
-								float value = string_parseDouble(tokens[tokenIndex]) / (double)currentProperty->scale;
+								float value = string_toDouble(tokens[tokenIndex]) / (double)currentProperty->scale;
 								// Swap X, Y and Z to convert from PLY coordinates
 								// Swap X, Y and Z to convert from PLY coordinates
 								if (string_caseInsensitiveMatch(currentProperty->name, U"X")) {
 								if (string_caseInsensitiveMatch(currentProperty->name, U"X")) {
 									if (flipX) {
 									if (flipX) {
@@ -570,7 +570,7 @@ static void loadPlyModel(ParserState& state, const ReadableString& content, bool
 					}
 					}
 				} else if (tokens.length() >= 3) {
 				} else if (tokens.length() >= 3) {
 					if (string_caseInsensitiveMatch(tokens[0], U"ELEMENT")) {
 					if (string_caseInsensitiveMatch(tokens[0], U"ELEMENT")) {
-						elements.push(PlyElement(tokens[1], string_parseInteger(tokens[2])));
+						elements.push(PlyElement(tokens[1], string_toInteger(tokens[2])));
 						elementIndex = elements.length() - 1;
 						elementIndex = elements.length() - 1;
 					} else if (string_caseInsensitiveMatch(tokens[0], U"PROPERTY")) {
 					} else if (string_caseInsensitiveMatch(tokens[0], U"PROPERTY")) {
 						if (elementIndex < 0) {
 						if (elementIndex < 0) {
@@ -620,9 +620,9 @@ static void generateBasicShape(ParserState& state, Shape shape, const ReadableSt
 	// All shapes are centered around the axis system's origin from -0.5 to +0.5 of any given size
 	// All shapes are centered around the axis system's origin from -0.5 to +0.5 of any given size
 	if (shape == Shape::Box) {
 	if (shape == Shape::Box) {
 		// Parse arguments
 		// Parse arguments
-		float width = string_parseDouble(arg1);
-		float height = string_parseDouble(arg2);
-		float depth = string_parseDouble(arg3);
+		float width = string_toDouble(arg1);
+		float height = string_toDouble(arg2);
+		float depth = string_toDouble(arg3);
 		// Create a bound
 		// Create a bound
 		FVector3D upper = FVector3D(width, height, depth) * 0.5f;
 		FVector3D upper = FVector3D(width, height, depth) * 0.5f;
 		FVector3D lower = -upper;
 		FVector3D lower = -upper;
@@ -645,9 +645,9 @@ static void generateBasicShape(ParserState& state, Shape shape, const ReadableSt
 		model_addQuad(model, part, first + 0, first + 4, first + 5, first + 1); // Bottom quad
 		model_addQuad(model, part, first + 0, first + 4, first + 5, first + 1); // Bottom quad
 	} else if (shape == Shape::Cylinder) {
 	} else if (shape == Shape::Cylinder) {
 		// Parse arguments
 		// Parse arguments
-		float radius = string_parseDouble(arg1);
-		float height = string_parseDouble(arg2);
-		int sideCount = string_parseDouble(arg3);
+		float radius = string_toDouble(arg1);
+		float height = string_toDouble(arg2);
+		int sideCount = string_toDouble(arg3);
 		// Create a bound
 		// Create a bound
 		float topHeight = height * 0.5f;
 		float topHeight = height * 0.5f;
 		float bottomHeight = height * -0.5f;
 		float bottomHeight = height * -0.5f;