Skip to content

Commit

Permalink
Clearer types in code rather than void pointers
Browse files Browse the repository at this point in the history
  • Loading branch information
teusbenschop committed Jan 7, 2024
1 parent 3f19d24 commit ef67781
Show file tree
Hide file tree
Showing 15 changed files with 144 additions and 5,202 deletions.
18 changes: 9 additions & 9 deletions assets/header.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,25 +206,25 @@ string Assets_Header::run ()
if (basic_mode) {
// Basic mode gives basic menu, but nothing in tabbed mode.
if (!tabbed_mode_on) {
menublock = menu_logic_basic_categories (std::addressof(m_webserver_request));
menublock = menu_logic_basic_categories (m_webserver_request);
}
} else {
string devnull;
menublock = menu_logic_main_categories (std::addressof(m_webserver_request), devnull);
menublock = menu_logic_main_categories (m_webserver_request, devnull);
}
start_button = false;
} else if (item == menu_logic_translate_menu ()) {
menublock = menu_logic_translate_category (std::addressof(m_webserver_request));
menublock = menu_logic_translate_category (m_webserver_request);
} else if (item == menu_logic_search_menu ()) {
menublock = menu_logic_search_category (std::addressof(m_webserver_request));
menublock = menu_logic_search_category (m_webserver_request);
} else if (item == menu_logic_tools_menu ()) {
menublock = menu_logic_tools_category (std::addressof(m_webserver_request));
menublock = menu_logic_tools_category (m_webserver_request);
} else if (item == menu_logic_settings_menu ()) {
menublock = menu_logic_settings_category (std::addressof(m_webserver_request));
menublock = menu_logic_settings_category (m_webserver_request);
} else if (item == menu_logic_settings_resources_menu ()) {
menublock = menu_logic_settings_resources_category (std::addressof(m_webserver_request));
menublock = menu_logic_settings_resources_category (m_webserver_request);
} else if (item == "help") {
menublock = menu_logic_help_category (std::addressof(m_webserver_request));
menublock = menu_logic_help_category (m_webserver_request);
}
m_view->set_variable ("mainmenu", menublock);

Expand All @@ -235,7 +235,7 @@ string Assets_Header::run ()
if (start_button) {
m_view->enable_zone ("start_button");
string tooltip;
menu_logic_main_categories (std::addressof(m_webserver_request), tooltip);
menu_logic_main_categories (m_webserver_request, tooltip);
m_view->set_variable ("starttooltip", tooltip);
}

Expand Down
6 changes: 3 additions & 3 deletions editor/select.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ string editor_select (Webserver_Request& webserver_request)
vector <string> urls;

if (edit_index_acl (webserver_request)) {
if (menu_logic_editor_enabled (std::addressof(webserver_request), true, true)) {
if (menu_logic_editor_enabled (webserver_request, true, true)) {
string label = menu_logic_editor_menu_text (true, true);
string url = edit_index_url ();
view.add_iteration ("editor", { pair ("url", url), pair ("label", label) } );
Expand All @@ -67,7 +67,7 @@ string editor_select (Webserver_Request& webserver_request)
}

if (editone2_index_acl (webserver_request)) {
if (menu_logic_editor_enabled (std::addressof(webserver_request), true, false)) {
if (menu_logic_editor_enabled (webserver_request, true, false)) {
string label = menu_logic_editor_menu_text (true, false);
string url = editone2_index_url ();
view.add_iteration ("editor", { pair ("url", url), pair ("label", label) } );
Expand All @@ -76,7 +76,7 @@ string editor_select (Webserver_Request& webserver_request)
}

if (editusfm_index_acl (webserver_request)) {
if (menu_logic_editor_enabled (std::addressof(webserver_request), false, true)) {
if (menu_logic_editor_enabled (webserver_request, false, true)) {
string label = menu_logic_editor_menu_text (false, true);
string url = editusfm_index_url ();
view.add_iteration ("editor", { pair ("url", url), pair ("label", label) } );
Expand Down
4 changes: 2 additions & 2 deletions index/index.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ std::string index_index (Webserver_Request& webserver_request)
if (!mode.empty ()) {
const bool basic = (mode == "basic");
webserver_request.database_config_user ()->setBasicInterfaceMode (basic);
menu_logic_tabbed_mode_save_json (std::addressof(webserver_request));
menu_logic_tabbed_mode_save_json (webserver_request);
}

// Upon app start, initialize the JSON for tabbed mode.
Expand All @@ -71,7 +71,7 @@ std::string index_index (Webserver_Request& webserver_request)
static bool tabbed_json_initialized = false;
if (!tabbed_json_initialized) {
if (menu_logic_can_do_tabbed_mode ()) {
menu_logic_tabbed_mode_save_json (std::addressof(webserver_request));
menu_logic_tabbed_mode_save_json (webserver_request);
}
tabbed_json_initialized = true;
}
Expand Down
2 changes: 1 addition & 1 deletion lexicon/logic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ vector <string> lexicon_logic_resource_names ()


// Gets the HTMl for displaying the book/chapter/verse of the $lexicon.
string lexicon_logic_get_html ([[maybe_unused]] void * webserver_request, string lexicon, int book, int chapter, int verse)
string lexicon_logic_get_html ([[maybe_unused]] Webserver_Request& webserver_request, string lexicon, int book, int chapter, int verse)
{
string html;

Expand Down
5 changes: 4 additions & 1 deletion lexicon/logic.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,11 @@
#define BDB_PREFIX "b"


class Webserver_Request;


std::vector <std::string> lexicon_logic_resource_names ();
std::string lexicon_logic_get_html (void * webserver_request, std::string lexicon, int book, int chapter, int verse);
std::string lexicon_logic_get_html (Webserver_Request& webserver_request, std::string lexicon, int book, int chapter, int verse);
std::string lexicon_logic_get_script (std::string prefix);
std::string lexicon_logic_strong_number_cleanup (std::string strong);
void lexicon_logic_convert_morphhb_parsing_to_strong (std::string parsing,
Expand Down
Loading

0 comments on commit ef67781

Please sign in to comment.