[Strings] Add more number formatters (#2873)

* [Strings] Add more number formatters

# Notes
- Adds `Strings::ToUnsignedInt` for `uint32` support.
- Adds `Strings::ToBigInt` for `int64` support.
- Adds `Strings::ToUnsignedBigInt` for `uint64` support.
- Adds `Strings::ToFloat` for `float` support.
- Replaces all `std::stoi` references with `Strings::ToInt`.
- Replaces all `atoi` references with `Strings::ToInt`.
- Replaces all `std::stoul` references with `Strings::ToUnsignedInt`.
- Replaces all `atoul` references with `Strings::ToUnsignedInt`.
- Replaces all `std::stoll` references with `Strings::ToBigInt`.
- Replaces all `atoll` references with `Strings::ToBigInt`.
- Replaces all `std::stoull` references with `Strings::ToUnsignedBigInt`.
- Replaces all `atoull` references with `Strings::ToUnsignedBigInt`.
- Replaces all `std::stof` references with `Strings::ToFloat`.

* [Strings] Add more number formatters

- Adds `Strings::ToUnsignedInt` for `uint32` support.
- Adds `Strings::ToBigInt` for `int64` support.
- Adds `Strings::ToUnsignedBigInt` for `uint64` support.
- Adds `Strings::ToFloat` for `float` support.
- Replaces all `std::stoi` references with `Strings::ToInt`.
- Replaces all `atoi` references with `Strings::ToInt`.
- Replaces all `std::stoul` references with `Strings::ToUnsignedInt`.
- Replaces all `atoul` references with `Strings::ToUnsignedInt`.
- Replaces all `std::stoll` references with `Strings::ToBigInt`.
- Replaces all `atoll` references with `Strings::ToBigInt`.
- Replaces all `std::stoull` references with `Strings::ToUnsignedBigInt`.
- Replaces all `atoull` references with `Strings::ToUnsignedBigInt`.
- Replaces all `std::stof` references with `Strings::ToFloat`.

* Rebase cleanup

* Changes/benchmarks/tests

---------

Co-authored-by: Akkadius <akkadius1@gmail.com>
This commit is contained in:
Alex King
2023-03-04 18:01:19 -05:00
committed by GitHub
parent be567af70d
commit 2a6cf8c8e7
261 changed files with 3178 additions and 3012 deletions
+5 -5
View File
@@ -392,7 +392,7 @@ bool ZoneDatabase::LoadTributes() {
}
for (auto row = results.begin(); row != results.end(); ++row) {
uint32 id = atoul(row[0]);
uint32 id = Strings::ToUnsignedInt(row[0]);
tributeData.name = row[1];
tributeData.description = row[2];
tributeData.unknown = strtoul(row[3], nullptr, 10);
@@ -410,7 +410,7 @@ bool ZoneDatabase::LoadTributes() {
}
for (auto row = results.begin(); row != results.end(); ++row) {
uint32 id = atoul(row[0]);
uint32 id = Strings::ToUnsignedInt(row[0]);
if (tribute_list.count(id) != 1) {
LogError("Error in LoadTributes: unknown tribute [{}] in tribute_levels", (unsigned long) id);
@@ -426,9 +426,9 @@ bool ZoneDatabase::LoadTributes() {
TributeLevel_Struct &s = cur.tiers[cur.tier_count];
s.level = atoul(row[1]);
s.cost = atoul(row[2]);
s.tribute_item_id = atoul(row[3]);
s.level = Strings::ToUnsignedInt(row[1]);
s.cost = Strings::ToUnsignedInt(row[2]);
s.tribute_item_id = Strings::ToUnsignedInt(row[3]);
cur.tier_count++;
}