[Strings] Refactor Strings Usage (#2305)

* Initial commit checkpoint

* More functions converted

* Commify

* More functions

* Fin

* Sort declarations

* Split functions between files

* Bots

* Update strings.h

* Split

* Revert find replaces

* Repository template

* Money

* Misc function

* Update CMakeLists.txt

* Saylink

* Update strings.cpp

* Swap Strings::Saylink for Saylink::Create since saylink is coupled to zone database

* API casings
This commit is contained in:
Chris Miles
2022-07-14 02:10:52 -05:00
committed by GitHub
parent 44c85a0dd7
commit dfd8f84cac
573 changed files with 5197 additions and 5137 deletions
@@ -13,7 +13,7 @@
#define EQEMU_BASE_GROUND_SPAWNS_REPOSITORY_H
#include "../../database.h"
#include "../../string_util.h"
#include "../../strings.h"
#include <ctime>
class BaseGroundSpawnsRepository {
@@ -94,12 +94,12 @@ public:
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
return std::string(Strings::Implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
return std::string(Strings::Implode(", ", SelectColumns()));
}
static std::string TableName()
@@ -241,21 +241,21 @@ public:
update_values.push_back(columns[6] + " = " + std::to_string(ground_spawns_entry.min_x));
update_values.push_back(columns[7] + " = " + std::to_string(ground_spawns_entry.min_y));
update_values.push_back(columns[8] + " = " + std::to_string(ground_spawns_entry.heading));
update_values.push_back(columns[9] + " = '" + EscapeString(ground_spawns_entry.name) + "'");
update_values.push_back(columns[9] + " = '" + Strings::Escape(ground_spawns_entry.name) + "'");
update_values.push_back(columns[10] + " = " + std::to_string(ground_spawns_entry.item));
update_values.push_back(columns[11] + " = " + std::to_string(ground_spawns_entry.max_allowed));
update_values.push_back(columns[12] + " = '" + EscapeString(ground_spawns_entry.comment) + "'");
update_values.push_back(columns[12] + " = '" + Strings::Escape(ground_spawns_entry.comment) + "'");
update_values.push_back(columns[13] + " = " + std::to_string(ground_spawns_entry.respawn_timer));
update_values.push_back(columns[14] + " = " + std::to_string(ground_spawns_entry.min_expansion));
update_values.push_back(columns[15] + " = " + std::to_string(ground_spawns_entry.max_expansion));
update_values.push_back(columns[16] + " = '" + EscapeString(ground_spawns_entry.content_flags) + "'");
update_values.push_back(columns[17] + " = '" + EscapeString(ground_spawns_entry.content_flags_disabled) + "'");
update_values.push_back(columns[16] + " = '" + Strings::Escape(ground_spawns_entry.content_flags) + "'");
update_values.push_back(columns[17] + " = '" + Strings::Escape(ground_spawns_entry.content_flags_disabled) + "'");
auto results = db.QueryDatabase(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
implode(", ", update_values),
Strings::Implode(", ", update_values),
PrimaryKey(),
ground_spawns_entry.id
)
@@ -280,21 +280,21 @@ public:
insert_values.push_back(std::to_string(ground_spawns_entry.min_x));
insert_values.push_back(std::to_string(ground_spawns_entry.min_y));
insert_values.push_back(std::to_string(ground_spawns_entry.heading));
insert_values.push_back("'" + EscapeString(ground_spawns_entry.name) + "'");
insert_values.push_back("'" + Strings::Escape(ground_spawns_entry.name) + "'");
insert_values.push_back(std::to_string(ground_spawns_entry.item));
insert_values.push_back(std::to_string(ground_spawns_entry.max_allowed));
insert_values.push_back("'" + EscapeString(ground_spawns_entry.comment) + "'");
insert_values.push_back("'" + Strings::Escape(ground_spawns_entry.comment) + "'");
insert_values.push_back(std::to_string(ground_spawns_entry.respawn_timer));
insert_values.push_back(std::to_string(ground_spawns_entry.min_expansion));
insert_values.push_back(std::to_string(ground_spawns_entry.max_expansion));
insert_values.push_back("'" + EscapeString(ground_spawns_entry.content_flags) + "'");
insert_values.push_back("'" + EscapeString(ground_spawns_entry.content_flags_disabled) + "'");
insert_values.push_back("'" + Strings::Escape(ground_spawns_entry.content_flags) + "'");
insert_values.push_back("'" + Strings::Escape(ground_spawns_entry.content_flags_disabled) + "'");
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
implode(",", insert_values)
Strings::Implode(",", insert_values)
)
);
@@ -327,17 +327,17 @@ public:
insert_values.push_back(std::to_string(ground_spawns_entry.min_x));
insert_values.push_back(std::to_string(ground_spawns_entry.min_y));
insert_values.push_back(std::to_string(ground_spawns_entry.heading));
insert_values.push_back("'" + EscapeString(ground_spawns_entry.name) + "'");
insert_values.push_back("'" + Strings::Escape(ground_spawns_entry.name) + "'");
insert_values.push_back(std::to_string(ground_spawns_entry.item));
insert_values.push_back(std::to_string(ground_spawns_entry.max_allowed));
insert_values.push_back("'" + EscapeString(ground_spawns_entry.comment) + "'");
insert_values.push_back("'" + Strings::Escape(ground_spawns_entry.comment) + "'");
insert_values.push_back(std::to_string(ground_spawns_entry.respawn_timer));
insert_values.push_back(std::to_string(ground_spawns_entry.min_expansion));
insert_values.push_back(std::to_string(ground_spawns_entry.max_expansion));
insert_values.push_back("'" + EscapeString(ground_spawns_entry.content_flags) + "'");
insert_values.push_back("'" + EscapeString(ground_spawns_entry.content_flags_disabled) + "'");
insert_values.push_back("'" + Strings::Escape(ground_spawns_entry.content_flags) + "'");
insert_values.push_back("'" + Strings::Escape(ground_spawns_entry.content_flags_disabled) + "'");
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
insert_chunks.push_back("(" + Strings::Implode(",", insert_values) + ")");
}
std::vector<std::string> insert_values;
@@ -346,7 +346,7 @@ public:
fmt::format(
"{} VALUES {}",
BaseInsert(),
implode(",", insert_chunks)
Strings::Implode(",", insert_chunks)
)
);