summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAotrix <[email protected]>2025-06-29 02:16:13 +0200
committerAotrix <[email protected]>2025-06-29 02:16:13 +0200
commit4167f92f3d36b7384c4c5f8bf7501bba52e91a0c (patch)
tree7cbccb75c24ddb1d256a1e3b78d05c0ca7dcbd7c /include
parenta61305a4f779d72ebf01bf1c4b0d4c9244d23236 (diff)
refactoring and added start menu
Diffstat (limited to 'include')
-rw-r--r--include/hearthstoneAPIHandler.hpp (renamed from include/hearthstoneAPIHandler.h)0
-rw-r--r--include/postgresHandler.h9
-rw-r--r--include/postgresHandler.hpp36
-rw-r--r--include/startMenu.hpp16
4 files changed, 52 insertions, 9 deletions
diff --git a/include/hearthstoneAPIHandler.h b/include/hearthstoneAPIHandler.hpp
index 9d5ec58..9d5ec58 100644
--- a/include/hearthstoneAPIHandler.h
+++ b/include/hearthstoneAPIHandler.hpp
diff --git a/include/postgresHandler.h b/include/postgresHandler.h
deleted file mode 100644
index 3c77824..0000000
--- a/include/postgresHandler.h
+++ /dev/null
@@ -1,9 +0,0 @@
-#pragma once
-#include <pqxx/pqxx>
-
-const pqxx::result execute_query(pqxx::work &t_transaction,
- std::string_view t_query);
-
-void add_cards_to_database(const std::string &t_cards, pqxx::work &t_tx);
-
-void refresh_cards_table();
diff --git a/include/postgresHandler.hpp b/include/postgresHandler.hpp
new file mode 100644
index 0000000..2c3f6f4
--- /dev/null
+++ b/include/postgresHandler.hpp
@@ -0,0 +1,36 @@
+#pragma once
+#include "hearthstoneAPIHandler.hpp"
+#include <pqxx/pqxx>
+#include <regex>
+
+/**
+ * Execute a SQL query from a libpqxx transaction
+ *
+ * @param aTransaction The SQL transaction object used to execute the query
+ * @param aQuery The SQL query
+ * @return The result of the executed SQL query
+ */
+const pqxx::result executeQuery(pqxx::work &aTransaction,
+ std::string_view aQuery);
+
+/**
+ * Get the type id of the value element in the "key": value regex match
+ * For instance, if the regex match is "isZilliaxCosmeticModule":false
+ * Then the type id is the one correponding to BOOL
+ *
+ * @param kSregexIt the regex match for a "key": value card information
+ * @return the type identifier of the value element
+ */
+const unsigned int
+getTypeIndexOfRegexIterator(const std::sregex_iterator &kSregexIt);
+/**
+ * Add a list of cards (TODO: Complete documentation and function)
+ *
+ * @param kCards
+ * @param aTransaction
+ */
+void addCardsToDatabase(HearthstoneAPIHandler &aAPIIntermediate,
+ pqxx::work &aTransaction,
+ const std::string &kURLOfCardsPage);
+
+void refresh_cards_table();
diff --git a/include/startMenu.hpp b/include/startMenu.hpp
new file mode 100644
index 0000000..0168424
--- /dev/null
+++ b/include/startMenu.hpp
@@ -0,0 +1,16 @@
+#pragma once
+#include <format>
+#include <iostream>
+
+template <typename... FunctionType>
+void launchFunction(FunctionType... aFunctions) {
+ std::cout << "MENU: SELECT THE FUNCTION\n"
+ << "=========================" << std::endl;
+ for (size_t aFunctionIndex = 0; aFunctionIndex < sizeof...(aFunctions);
+ aFunctionIndex++) {
+ std::cout << std::format("{}) {}", aFunctionIndex + 1,
+ "currentFunctionName") // FIXME: replace this
+ << std::endl;
+ }
+ std::cout << "=========================" << std::endl;
+}