From 9904dfcb34fac0d50d5da39023eca6541272d019 Mon Sep 17 00:00:00 2001 From: yggverse Date: Mon, 16 Sep 2024 17:19:10 +0300 Subject: [PATCH] rename database pointer --- src/app.cpp | 6 ++-- src/app/browser.cpp | 34 +++++++++---------- src/app/browser.hpp | 10 +++--- src/app/browser/main.cpp | 30 ++++++++-------- src/app/browser/main.hpp | 10 +++--- src/app/browser/main/tab.cpp | 34 +++++++++---------- src/app/browser/main/tab.hpp | 10 +++--- src/app/browser/main/tab/label.cpp | 24 ++++++------- src/app/browser/main/tab/label.hpp | 10 +++--- src/app/browser/main/tab/page.cpp | 28 +++++++-------- src/app/browser/main/tab/page.hpp | 10 +++--- src/app/browser/main/tab/page/navigation.cpp | 34 +++++++++---------- src/app/browser/main/tab/page/navigation.hpp | 10 +++--- .../main/tab/page/navigation/history.cpp | 26 +++++++------- .../main/tab/page/navigation/history.hpp | 10 +++--- .../main/tab/page/navigation/request.cpp | 26 +++++++------- .../main/tab/page/navigation/request.hpp | 10 +++--- 17 files changed, 161 insertions(+), 161 deletions(-) diff --git a/src/app.cpp b/src/app.cpp index cdd88bc7..fe1e0a06 100644 --- a/src/app.cpp +++ b/src/app.cpp @@ -6,11 +6,11 @@ int main( char * argv[] ) { // Init database - sqlite3 * db; + sqlite3 * database; sqlite3_open( "app.sqlite3", - &db + &database ); // Init application @@ -22,6 +22,6 @@ int main( return app->make_window_and_run( argc, argv, - db + database ); } \ No newline at end of file diff --git a/src/app/browser.cpp b/src/app/browser.cpp index b0694ee1..c7a30928 100644 --- a/src/app/browser.cpp +++ b/src/app/browser.cpp @@ -5,11 +5,11 @@ using namespace app; Browser::Browser( - sqlite3 * db + sqlite3 * database ) { // Init database Database::Session::init( - this->db = db + this->database = database ); // Init window actions @@ -189,7 +189,7 @@ Browser::Browser( ); browserMain = Gtk::make_managed( - db, + database, ACTION__TAB_CLOSE, ACTION__TAB_CLOSE_ALL, ACTION__TAB_PAGE_NAVIGATION_HISTORY_BACK, @@ -252,7 +252,7 @@ Browser::Browser( { session_save(); - // @TODO sqlite3_close(db); + // @TODO sqlite3_close(database); return false; }, @@ -266,7 +266,7 @@ int Browser::session_restore() sqlite3_stmt* statement; // @TODO move to the Database model namespace const int PREPARE_STATUS = sqlite3_prepare_v3( - db, + database, R"SQL( SELECT * FROM `app_browser__session` )SQL", @@ -315,7 +315,7 @@ int Browser::session_restore() void Browser::session_clean() { Database::Session::clean( - db + database ); browserMain->tab_close_all(); @@ -327,12 +327,12 @@ void Browser::session_save() // Delete previous data Database::Session::clean( - db + database ); // @TODO run on background // Create new session const sqlite3_int64 APP_BROWSER__SESSION__ID = Database::Session::add( - db, + database, get_width(), get_height(), is_fullscreen() @@ -346,12 +346,12 @@ void Browser::session_save() // Database int Browser::Database::Session::init( - sqlite3 * db + sqlite3 * database ) { char * error; return sqlite3_exec( - db, + database, R"SQL( CREATE TABLE IF NOT EXISTS `app_browser__session` ( @@ -369,13 +369,13 @@ int Browser::Database::Session::init( } int Browser::Database::Session::clean( - sqlite3 * db + sqlite3 * database ) { char * error; // @TODO sqlite3_stmt * statement; const int PREPARE_STATUS = sqlite3_prepare_v3( - db, + database, R"SQL( SELECT * FROM `app_browser__session` )SQL", @@ -396,7 +396,7 @@ int Browser::Database::Session::clean( // Delete record const int EXEC_STATUS = sqlite3_exec( - db, + database, Glib::ustring::sprintf( R"SQL( DELETE FROM `app_browser__session` WHERE `id` = %d @@ -412,7 +412,7 @@ int Browser::Database::Session::clean( if (EXEC_STATUS == SQLITE_OK) { browser::Main::Database::Session::clean( - db, + database, APP_BROWSER__SESSION__ID ); } @@ -425,7 +425,7 @@ int Browser::Database::Session::clean( } sqlite3_int64 Browser::Database::Session::add( - sqlite3 * db, + sqlite3 * database, const int & WIDTH, const int & HEIGHT, const bool & IS_FULLSCREEN @@ -433,7 +433,7 @@ sqlite3_int64 Browser::Database::Session::add( char * error; // @TODO sqlite3_exec( - db, + database, Glib::ustring::sprintf( R"SQL( INSERT INTO `app_browser__session` ( @@ -456,6 +456,6 @@ sqlite3_int64 Browser::Database::Session::add( ); return sqlite3_last_insert_rowid( - db + database ); } \ No newline at end of file diff --git a/src/app/browser.hpp b/src/app/browser.hpp index fdcb19f2..62b65426 100644 --- a/src/app/browser.hpp +++ b/src/app/browser.hpp @@ -42,15 +42,15 @@ namespace app }; // table fields index static int init( - sqlite3 * db + sqlite3 * database ); // return sqlite3_exec status code static int clean( - sqlite3 * db + sqlite3 * database ); // return sqlite3_finalize status code static sqlite3_int64 add( - sqlite3 * db, + sqlite3 * database, const int & WIDTH, const int & HEIGHT, const bool & IS_FULLSCREEN @@ -64,7 +64,7 @@ namespace app private: // Database - sqlite3 * db; + sqlite3 * database; // Components app::browser::Header * browserHeader; @@ -81,7 +81,7 @@ namespace app public: Browser( - sqlite3 * db + sqlite3 * database ); // Actions diff --git a/src/app/browser/main.cpp b/src/app/browser/main.cpp index 9294809a..2b218cfb 100644 --- a/src/app/browser/main.cpp +++ b/src/app/browser/main.cpp @@ -4,7 +4,7 @@ using namespace app::browser; Main::Main( - sqlite3 * db, + sqlite3 * database, const Glib::RefPtr & ACTION__CLOSE, const Glib::RefPtr & ACTION__CLOSE_ALL, const Glib::RefPtr & ACTION__HISTORY_BACK, @@ -14,7 +14,7 @@ Main::Main( ) { // Init database Database::Session::init( - this->db = db + this->database = database ); // Init widget @@ -28,7 +28,7 @@ Main::Main( // Init components mainTab = Gtk::make_managed( - db, + database, ACTION__CLOSE, ACTION__CLOSE_ALL, ACTION__HISTORY_BACK, @@ -51,7 +51,7 @@ int Main::session_restore( sqlite3_stmt* statement; // @TODO move to the Database model namespace const int PREPARE_STATUS = sqlite3_prepare_v3( - db, + database, Glib::ustring::sprintf( R"SQL( SELECT * FROM `app_browser_main__session` @@ -90,13 +90,13 @@ void Main::session_save( // Delete previous data Database::Session::clean( - db, + database, APP_BROWSER__SESSION__ID ); // @TODO run on background // Create new session const sqlite3_int64 APP_BROWSER_MAIN__SESSION__ID = Database::Session::add( - db, + database, APP_BROWSER__SESSION__ID ); @@ -185,12 +185,12 @@ Glib::ustring Main::get_tab_page_description() // Database int Main::Database::Session::init( - sqlite3 * db + sqlite3 * database ) { char * error; return sqlite3_exec( - db, + database, R"SQL( CREATE TABLE IF NOT EXISTS `app_browser_main__session` ( @@ -205,14 +205,14 @@ int Main::Database::Session::init( } int Main::Database::Session::clean( - sqlite3 * db, + sqlite3 * database, const sqlite3_int64 & APP_BROWSER__SESSION__ID ) { char * error; // @TODO sqlite3_stmt * statement; const int PREPARE_STATUS = sqlite3_prepare_v3( - db, + database, Glib::ustring::sprintf( R"SQL( SELECT * FROM `app_browser_main__session` @@ -237,7 +237,7 @@ int Main::Database::Session::clean( // Delete record const int EXEC_STATUS = sqlite3_exec( - db, + database, Glib::ustring::sprintf( R"SQL( DELETE FROM `app_browser_main__session` WHERE `id` = %d @@ -253,7 +253,7 @@ int Main::Database::Session::clean( if (EXEC_STATUS == SQLITE_OK) { main::Tab::Database::Session::clean( - db, + database, APP_BROWSER_MAIN__SESSION__ID ); } @@ -266,13 +266,13 @@ int Main::Database::Session::clean( } sqlite3_int64 Main::Database::Session::add( - sqlite3 * db, + sqlite3 * database, const sqlite3_int64 & APP_BROWSER__SESSION__ID ) { char * error; // @TODO sqlite3_exec( - db, + database, Glib::ustring::sprintf( R"SQL( INSERT INTO `app_browser_main__session` ( @@ -289,6 +289,6 @@ sqlite3_int64 Main::Database::Session::add( ); return sqlite3_last_insert_rowid( - db + database ); } \ No newline at end of file diff --git a/src/app/browser/main.hpp b/src/app/browser/main.hpp index c3962e1a..79f119e6 100644 --- a/src/app/browser/main.hpp +++ b/src/app/browser/main.hpp @@ -38,16 +38,16 @@ namespace app::browser }; // table fields index static int init( - sqlite3 * db + sqlite3 * database ); // return sqlite3_exec status code static int clean( - sqlite3 * db, + sqlite3 * database, const sqlite3_int64 & APP_BROWSER__SESSION__ID ); // return sqlite3_finalize status code static sqlite3_int64 add( - sqlite3 * db, + sqlite3 * database, const sqlite3_int64 & APP_BROWSER__SESSION__ID ); // return sqlite3_last_insert_rowid @@ -60,7 +60,7 @@ namespace app::browser private: // Database - sqlite3 * db; + sqlite3 * database; // Components main::Tab * mainTab; @@ -74,7 +74,7 @@ namespace app::browser public: Main( - sqlite3 * db, + sqlite3 * database, const Glib::RefPtr & ACTION__CLOSE, const Glib::RefPtr & ACTION__CLOSE_ALL, const Glib::RefPtr & ACTION__HISTORY_BACK, diff --git a/src/app/browser/main/tab.cpp b/src/app/browser/main/tab.cpp index 18c9b09f..f9cd9bea 100644 --- a/src/app/browser/main/tab.cpp +++ b/src/app/browser/main/tab.cpp @@ -5,7 +5,7 @@ using namespace app::browser::main; Tab::Tab( - sqlite3 * db, + sqlite3 * database, const Glib::RefPtr & ACTION__CLOSE, const Glib::RefPtr & ACTION__CLOSE_ALL, const Glib::RefPtr & ACTION__HISTORY_BACK, @@ -15,7 +15,7 @@ Tab::Tab( ) { // Init database Database::Session::init( - this->db = db + this->database = database ); // Init actions @@ -46,7 +46,7 @@ int Tab::session_restore( sqlite3_stmt* statement; // @TODO move to the Database model namespace const int PREPARE_STATUS = sqlite3_prepare_v3( - db, + database, Glib::ustring::sprintf( R"SQL( SELECT * FROM `app_browser_main_tab__session` @@ -106,7 +106,7 @@ void Tab::session_save( // Delete previous data Database::Session::clean( - db, + database, APP_BROWSER_MAIN__SESSION__ID ); // @TODO run on background @@ -115,7 +115,7 @@ void Tab::session_save( { // Create new session const sqlite3_int64 APP_BROWSER_MAIN_TAB__SESSION__ID = Database::Session::add( - db, + database, APP_BROWSER_MAIN__SESSION__ID, page_number, page_number == get_current_page() @@ -169,7 +169,7 @@ int Tab::append( const bool & IS_CURRENT ) { const auto TAB_PAGE = new tab::Page( // @TODO manage - db, + database, action__history_back, action__history_forward, action__reload, @@ -177,7 +177,7 @@ int Tab::append( ); const auto TAB_LABEL = new tab::Label( // @TODO manage - db, + database, action__close ); @@ -340,12 +340,12 @@ tab::Page * Tab::get_tabPage( // Database int Tab::Database::Session::init( - sqlite3 * db + sqlite3 * database ) { char * error; return sqlite3_exec( - db, + database, R"SQL( CREATE TABLE IF NOT EXISTS `app_browser_main_tab__session` ( @@ -362,14 +362,14 @@ int Tab::Database::Session::init( } int Tab::Database::Session::clean( - sqlite3 * db, + sqlite3 * database, const sqlite3_int64 & APP_BROWSER_MAIN__SESSION__ID ) { char * error; // @TODO sqlite3_stmt * statement; const int PREPARE_STATUS = sqlite3_prepare_v3( - db, + database, Glib::ustring::sprintf( R"SQL( SELECT * FROM `app_browser_main_tab__session` @@ -394,7 +394,7 @@ int Tab::Database::Session::clean( // Delete record const int EXEC_STATUS = sqlite3_exec( - db, + database, Glib::ustring::sprintf( R"SQL( DELETE FROM `app_browser_main_tab__session` WHERE `id` = %d @@ -410,12 +410,12 @@ int Tab::Database::Session::clean( if (EXEC_STATUS == SQLITE_OK) { tab::Label::Database::Session::clean( - db, + database, APP_BROWSER_MAIN_TAB__SESSION__ID ); tab::Page::Database::Session::clean( - db, + database, APP_BROWSER_MAIN_TAB__SESSION__ID ); } @@ -428,7 +428,7 @@ int Tab::Database::Session::clean( } sqlite3_int64 Tab::Database::Session::add( - sqlite3 * db, + sqlite3 * database, const sqlite3_int64 & APP_BROWSER_MAIN__SESSION__ID, const int & PAGE_NUMBER, const bool & IS_CURRENT @@ -436,7 +436,7 @@ sqlite3_int64 Tab::Database::Session::add( char * error; // @TODO sqlite3_exec( - db, + database, Glib::ustring::sprintf( R"SQL( INSERT INTO `app_browser_main_tab__session` ( @@ -459,6 +459,6 @@ sqlite3_int64 Tab::Database::Session::add( ); return sqlite3_last_insert_rowid( - db + database ); } \ No newline at end of file diff --git a/src/app/browser/main/tab.hpp b/src/app/browser/main/tab.hpp index 0299d212..5910e87e 100644 --- a/src/app/browser/main/tab.hpp +++ b/src/app/browser/main/tab.hpp @@ -40,16 +40,16 @@ namespace app::browser::main }; // table fields index static int init( - sqlite3 * db + sqlite3 * database ); // return sqlite3_exec status code static int clean( - sqlite3 * db, + sqlite3 * database, const sqlite3_int64 & APP_BROWSER_MAIN__SESSION__ID ); // return sqlite3_finalize status code static sqlite3_int64 add( - sqlite3 * db, + sqlite3 * database, const sqlite3_int64 & APP_BROWSER_MAIN__SESSION__ID, const int & PAGE_NUMBER, const bool & IS_CURRENT @@ -64,7 +64,7 @@ namespace app::browser::main private: // Database - sqlite3 * db; + sqlite3 * database; // Actions Glib::RefPtr action__close_all, @@ -84,7 +84,7 @@ namespace app::browser::main public: Tab( - sqlite3 * db, + sqlite3 * database, const Glib::RefPtr & ACTION__CLOSE, const Glib::RefPtr & ACTION__CLOSE_ALL, const Glib::RefPtr & ACTION__HISTORY_BACK, diff --git a/src/app/browser/main/tab/label.cpp b/src/app/browser/main/tab/label.cpp index 7272e27e..2fa70f0a 100644 --- a/src/app/browser/main/tab/label.cpp +++ b/src/app/browser/main/tab/label.cpp @@ -3,12 +3,12 @@ using namespace app::browser::main::tab; Label::Label( - sqlite3 * db, + sqlite3 * database, const Glib::RefPtr & ACTION__TAB_CLOSE ) { // Init database Database::Session::init( - this->db = db + this->database = database ); // Init actions @@ -90,7 +90,7 @@ int Label::session_restore( sqlite3_stmt * statement; const int PREPARE_STATUS = sqlite3_prepare_v3( - db, + database, Glib::ustring::sprintf( R"SQL( SELECT * FROM `app_browser_main_tab_label__session` @@ -140,7 +140,7 @@ int Label::session_save( // Save label session return Database::Session::add( - db, + database, APP_BROWSER_MAIN_TAB__SESSION__ID, is_pinned, text @@ -211,12 +211,12 @@ void Label::update( // Database model int Label::Database::Session::init( - sqlite3 * db + sqlite3 * database ) { char * error; return sqlite3_exec( - db, + database, R"SQL( CREATE TABLE IF NOT EXISTS `app_browser_main_tab_label__session` ( @@ -233,14 +233,14 @@ int Label::Database::Session::init( } int Label::Database::Session::clean( - sqlite3 * db, + sqlite3 * database, const sqlite3_int64 & APP_BROWSER_MAIN_TAB__SESSION__ID ) { char * error; // @TODO sqlite3_stmt * statement; const int PREPARE_STATUS = sqlite3_prepare_v3( - db, + database, Glib::ustring::sprintf( R"SQL( SELECT * FROM `app_browser_main_tab_label__session` @@ -260,7 +260,7 @@ int Label::Database::Session::clean( { // Delete record const int EXEC_STATUS = sqlite3_exec( - db, + database, Glib::ustring::sprintf( R"SQL( DELETE FROM `app_browser_main_tab_label__session` WHERE `id` = %d @@ -289,7 +289,7 @@ int Label::Database::Session::clean( } sqlite3_int64 Label::Database::Session::add( - sqlite3 * db, + sqlite3 * database, const sqlite3_int64 & APP_BROWSER_MAIN_TAB__SESSION__ID, const bool & IS_PINNED, const Glib::ustring & TEXT @@ -297,7 +297,7 @@ sqlite3_int64 Label::Database::Session::add( char * error; // @TODO sqlite3_exec( - db, + database, Glib::ustring::sprintf( R"SQL( INSERT INTO `app_browser_main_tab_label__session` ( @@ -320,6 +320,6 @@ sqlite3_int64 Label::Database::Session::add( ); return sqlite3_last_insert_rowid( - db + database ); } \ No newline at end of file diff --git a/src/app/browser/main/tab/label.hpp b/src/app/browser/main/tab/label.hpp index 7c56a7b4..e34c60b5 100644 --- a/src/app/browser/main/tab/label.hpp +++ b/src/app/browser/main/tab/label.hpp @@ -37,16 +37,16 @@ namespace app::browser::main::tab }; // table fields index static int init( - sqlite3 * db + sqlite3 * database ); // return sqlite3_exec status code static int clean( - sqlite3 * db, + sqlite3 * database, const sqlite3_int64 & APP_BROWSER_MAIN_TAB__SESSION__ID ); // return sqlite3_finalize status code static sqlite3_int64 add( - sqlite3 * db, + sqlite3 * database, const sqlite3_int64 & APP_BROWSER_MAIN_TAB__SESSION__ID, const bool & IS_PINNED, const Glib::ustring & TEXT @@ -60,7 +60,7 @@ namespace app::browser::main::tab private: // Database - sqlite3 * db; + sqlite3 * database; // Actions Glib::RefPtr action__tab_close; @@ -78,7 +78,7 @@ namespace app::browser::main::tab public: Label( - sqlite3 * db, + sqlite3 * database, const Glib::RefPtr & ACTION__TAB_CLOSE ); diff --git a/src/app/browser/main/tab/page.cpp b/src/app/browser/main/tab/page.cpp index e4bf5b4d..1cb9be73 100644 --- a/src/app/browser/main/tab/page.cpp +++ b/src/app/browser/main/tab/page.cpp @@ -5,7 +5,7 @@ using namespace app::browser::main::tab; Page::Page( - sqlite3 * db, + sqlite3 * database, const Glib::RefPtr & ACTION__HISTORY_BACK, const Glib::RefPtr & ACTION__HISTORY_FORWARD, const Glib::RefPtr & ACTION__RELOAD, @@ -18,7 +18,7 @@ Page::Page( // Init database Database::Session::init( - this->db = db + this->database = database ); // Init shared actions @@ -59,7 +59,7 @@ Page::Page( // Init widget components pageNavigation = Gtk::make_managed( - this->db, + this->database, ACTION__HISTORY_BACK, ACTION__HISTORY_FORWARD, ACTION__OPEN_LINK_VARIANT, @@ -96,7 +96,7 @@ int Page::session_restore( sqlite3_stmt* statement; // @TODO move to the Database model namespace const int PREPARE_STATUS = sqlite3_prepare_v3( - db, + database, Glib::ustring::sprintf( R"SQL( SELECT * FROM `app_browser_main_tab_page__session` @@ -165,7 +165,7 @@ void Page::session_save( // Delegate save action to child components pageNavigation->session_save( Database::Session::add( - db, + database, APP_BROWSER_MAIN_TAB__SESSION__ID, mime, title, @@ -520,12 +520,12 @@ Glib::ustring Page::get_description() // Database model int Page::Database::Session::init( - sqlite3 * db + sqlite3 * database ) { char * error; return sqlite3_exec( - db, + database, R"SQL( CREATE TABLE IF NOT EXISTS `app_browser_main_tab_page__session` ( @@ -543,14 +543,14 @@ int Page::Database::Session::init( } int Page::Database::Session::clean( - sqlite3 * db, + sqlite3 * database, const sqlite3_int64 & APP_BROWSER_MAIN_TAB__SESSION__ID ) { char * error; // @TODO sqlite3_stmt * statement; const int PREPARE_STATUS = sqlite3_prepare_v3( - db, + database, Glib::ustring::sprintf( R"SQL( SELECT * FROM `app_browser_main_tab_page__session` WHERE `app_browser_main_tab__session__id` = %d @@ -574,7 +574,7 @@ int Page::Database::Session::clean( // Delete record const int EXEC_STATUS = sqlite3_exec( - db, + database, Glib::ustring::sprintf( R"SQL( DELETE FROM `app_browser_main_tab_page__session` WHERE `id` = %d @@ -590,7 +590,7 @@ int Page::Database::Session::clean( if (EXEC_STATUS == SQLITE_OK) { page::Navigation::Database::Session::clean( - db, + database, APP_BROWSER_MAIN_TAB_PAGE__SESSION__ID ); } @@ -603,7 +603,7 @@ int Page::Database::Session::clean( } sqlite3_int64 Page::Database::Session::add( - sqlite3 * db, + sqlite3 * database, const sqlite3_int64 & APP_BROWSER_MAIN_TAB__SESSION__ID, const Page::MIME & MIME, const Glib::ustring & TITLE, @@ -612,7 +612,7 @@ sqlite3_int64 Page::Database::Session::add( char * error; // @TODO sqlite3_exec( - db, + database, Glib::ustring::sprintf( R"SQL( INSERT INTO `app_browser_main_tab_page__session` ( @@ -638,7 +638,7 @@ sqlite3_int64 Page::Database::Session::add( ); return sqlite3_last_insert_rowid( - db + database ); } diff --git a/src/app/browser/main/tab/page.hpp b/src/app/browser/main/tab/page.hpp index 39456f4c..1ccbc724 100644 --- a/src/app/browser/main/tab/page.hpp +++ b/src/app/browser/main/tab/page.hpp @@ -59,16 +59,16 @@ namespace app::browser::main::tab }; // table fields index static int init( - sqlite3 * db + sqlite3 * database ); // return sqlite3_exec status code static int clean( - sqlite3 * db, + sqlite3 * database, const sqlite3_int64 & APP_BROWSER_MAIN_TAB__SESSION__ID ); // return sqlite3_finalize status code static sqlite3_int64 add( - sqlite3 * db, + sqlite3 * database, const sqlite3_int64 & APP_BROWSER_MAIN_TAB__SESSION__ID, const Page::MIME & MIME, const Glib::ustring & TITLE, @@ -182,7 +182,7 @@ namespace app::browser::main::tab Glib::RefPtr action__update; // Database - sqlite3 * db; + sqlite3 * database; // Socket char buffer[0xfffff]; // 1Mb @@ -201,7 +201,7 @@ namespace app::browser::main::tab public: Page( - sqlite3 * db, + sqlite3 * database, const Glib::RefPtr & ACTION__HISTORY_BACK, const Glib::RefPtr & ACTION__HISTORY_FORWARD, const Glib::RefPtr & ACTION__RELOAD, diff --git a/src/app/browser/main/tab/page/navigation.cpp b/src/app/browser/main/tab/page/navigation.cpp index 8e3d53fa..cccc010a 100644 --- a/src/app/browser/main/tab/page/navigation.cpp +++ b/src/app/browser/main/tab/page/navigation.cpp @@ -8,7 +8,7 @@ using namespace app::browser::main::tab::page; Navigation::Navigation( - sqlite3 * db, + sqlite3 * database, const Glib::RefPtr & ACTION__HISTORY_BACK, const Glib::RefPtr & ACTION__HISTORY_FORWARD, const Glib::RefPtr & ACTION__OPEN_LINK_VARIANT, @@ -17,7 +17,7 @@ Navigation::Navigation( ) { // Init database Database::Session::init( - this->db = db + this->database = database ); // Init container @@ -55,7 +55,7 @@ Navigation::Navigation( ); navigationHistory = Gtk::make_managed( - db, + database, ACTION__HISTORY_BACK, ACTION__HISTORY_FORWARD ); @@ -73,7 +73,7 @@ Navigation::Navigation( ); navigationRequest = Gtk::make_managed( - db, + database, ACTION__RELOAD, ACTION__UPDATE ); @@ -115,7 +115,7 @@ int Navigation::session_restore( sqlite3_stmt* statement; // @TODO move to the Database model namespace const int PREPARE_STATUS = sqlite3_prepare_v3( - db, + database, Glib::ustring::sprintf( R"SQL( SELECT * FROM `app_browser_main_tab_page_navigation__session` @@ -162,13 +162,13 @@ void Navigation::session_save( ) { // Delete previous session Database::Session::clean( - db, + database, APP_BROWSER_MAIN_TAB_PAGE__SESSION__ID ); // Create new record const sqlite3_int64 APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__SESSION__ID = Database::Session::add( - db, + database, APP_BROWSER_MAIN_TAB_PAGE__SESSION__ID ); @@ -257,12 +257,12 @@ void Navigation::set_request_text( // Database model int Navigation::Database::Session::init( - sqlite3 * db + sqlite3 * database ) { char * error; return sqlite3_exec( - db, + database, R"SQL( CREATE TABLE IF NOT EXISTS `app_browser_main_tab_page_navigation__session` ( @@ -277,14 +277,14 @@ int Navigation::Database::Session::init( } int Navigation::Database::Session::clean( - sqlite3 * db, + sqlite3 * database, const sqlite3_int64 & APP_BROWSER_MAIN_TAB_PAGE__SESSION__ID ) { char * error; // @TODO sqlite3_stmt * statement; const int PREPARE_STATUS = sqlite3_prepare_v3( - db, + database, Glib::ustring::sprintf( R"SQL( SELECT * FROM `app_browser_main_tab_page_navigation__session` @@ -309,7 +309,7 @@ int Navigation::Database::Session::clean( // Delete record const int EXEC_STATUS = sqlite3_exec( - db, + database, Glib::ustring::sprintf( R"SQL( DELETE FROM `app_browser_main_tab_page_navigation__session` WHERE `id` = %d @@ -325,12 +325,12 @@ int Navigation::Database::Session::clean( if (EXEC_STATUS == SQLITE_OK) { navigation::History::Database::Session::clean( - db, + database, APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__SESSION__ID ); navigation::Request::Database::Session::clean( - db, + database, APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__SESSION__ID ); } @@ -343,13 +343,13 @@ int Navigation::Database::Session::clean( } sqlite3_int64 Navigation::Database::Session::add( - sqlite3 * db, + sqlite3 * database, const sqlite3_int64 & APP_BROWSER_MAIN_TAB_PAGE__SESSION__ID ) { char * error; // @TODO sqlite3_exec( - db, + database, Glib::ustring::sprintf( R"SQL( INSERT INTO `app_browser_main_tab_page_navigation__session` ( @@ -366,6 +366,6 @@ sqlite3_int64 Navigation::Database::Session::add( ); return sqlite3_last_insert_rowid( - db + database ); } \ No newline at end of file diff --git a/src/app/browser/main/tab/page/navigation.hpp b/src/app/browser/main/tab/page/navigation.hpp index abfb0ca6..c1fb067b 100644 --- a/src/app/browser/main/tab/page/navigation.hpp +++ b/src/app/browser/main/tab/page/navigation.hpp @@ -41,16 +41,16 @@ namespace app::browser::main::tab::page }; // table fields index static int init( - sqlite3 * db + sqlite3 * database ); // return sqlite3_exec status code static int clean( - sqlite3 * db, + sqlite3 * database, const sqlite3_int64 & APP_BROWSER_MAIN_TAB_PAGE__SESSION__ID ); // return sqlite3_finalize status code static sqlite3_int64 add( - sqlite3 * db, + sqlite3 * database, const sqlite3_int64 & APP_BROWSER_MAIN_TAB_PAGE__SESSION__ID ); // return sqlite3_last_insert_rowid }; @@ -62,7 +62,7 @@ namespace app::browser::main::tab::page private: // Database - sqlite3 * db; + sqlite3 * database; // Components navigation::Base * navigationBase; @@ -81,7 +81,7 @@ namespace app::browser::main::tab::page public: Navigation( - sqlite3 * db, + sqlite3 * database, const Glib::RefPtr & ACTION__HISTORY_BACK, const Glib::RefPtr & ACTION__HISTORY_FORWARD, const Glib::RefPtr & ACTION__OPEN_LINK_VARIANT, diff --git a/src/app/browser/main/tab/page/navigation/history.cpp b/src/app/browser/main/tab/page/navigation/history.cpp index 54182802..8892f7e3 100644 --- a/src/app/browser/main/tab/page/navigation/history.cpp +++ b/src/app/browser/main/tab/page/navigation/history.cpp @@ -5,13 +5,13 @@ using namespace app::browser::main::tab::page::navigation; History::History( - sqlite3 * db, + sqlite3 * database, const Glib::RefPtr & ACTION__HISTORY_BACK, const Glib::RefPtr & ACTION__HISTORY_FORWARD ) { // Init database Database::Session::init( - this->db = db + this->database = database ); // Init widget @@ -62,7 +62,7 @@ int History::session_restore( sqlite3_stmt* statement; // @TODO move to the Database model namespace const int PREPARE_STATUS = sqlite3_prepare_v3( - db, + database, Glib::ustring::sprintf( R"SQL( SELECT * FROM `app_browser_main_tab_page_navigation_history__session` @@ -129,7 +129,7 @@ void History::session_save( ) { // Delete previous records for session Database::Session::clean( - db, + database, APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__SESSION__ID ); @@ -137,7 +137,7 @@ void History::session_save( int offset = -1; for (const auto & MEMORY : memory) { Database::Session::add( - db, + database, APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__SESSION__ID, MEMORY.time, MEMORY.request, @@ -233,12 +233,12 @@ bool History::try_forward( // Database model int History::Database::Session::init( - sqlite3 * db + sqlite3 * database ) { char * error; return sqlite3_exec( - db, + database, R"SQL( CREATE TABLE IF NOT EXISTS `app_browser_main_tab_page_navigation_history__session` ( @@ -255,14 +255,14 @@ int History::Database::Session::init( } int History::Database::Session::clean( - sqlite3 * db, + sqlite3 * database, const sqlite3_int64 & APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__SESSION__ID ) { char * error; // @TODO sqlite3_stmt * statement; const int PREPARE_STATUS = sqlite3_prepare_v3( - db, + database, Glib::ustring::sprintf( R"SQL( SELECT * FROM `app_browser_main_tab_page_navigation_history__session` @@ -282,7 +282,7 @@ int History::Database::Session::clean( { // Delete record const int EXEC_STATUS = sqlite3_exec( - db, + database, Glib::ustring::sprintf( R"SQL( DELETE FROM `app_browser_main_tab_page_navigation_history__session` WHERE `id` = %d @@ -311,7 +311,7 @@ int History::Database::Session::clean( } sqlite3_int64 History::Database::Session::add( - sqlite3 * db, + sqlite3 * database, const sqlite3_int64 & APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__SESSION__ID, const int & TIME, const Glib::ustring & REQUEST, @@ -320,7 +320,7 @@ sqlite3_int64 History::Database::Session::add( char * error; // @TODO sqlite3_exec( - db, + database, Glib::ustring::sprintf( R"SQL( INSERT INTO `app_browser_main_tab_page_navigation_history__session` ( @@ -346,6 +346,6 @@ sqlite3_int64 History::Database::Session::add( ); return sqlite3_last_insert_rowid( - db + database ); } \ No newline at end of file diff --git a/src/app/browser/main/tab/page/navigation/history.hpp b/src/app/browser/main/tab/page/navigation/history.hpp index 88c99701..cbedb2c2 100644 --- a/src/app/browser/main/tab/page/navigation/history.hpp +++ b/src/app/browser/main/tab/page/navigation/history.hpp @@ -42,16 +42,16 @@ namespace app::browser::main::tab::page::navigation }; // table fields index static int init( - sqlite3 * db + sqlite3 * database ); // return sqlite3_exec status code static int clean( - sqlite3 * db, + sqlite3 * database, const sqlite3_int64 & APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__SESSION__ID ); // return sqlite3_finalize status code static sqlite3_int64 add( - sqlite3 * db, + sqlite3 * database, const sqlite3_int64 & APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__SESSION__ID, const int & TIME, const Glib::ustring & REQUEST, @@ -66,7 +66,7 @@ namespace app::browser::main::tab::page::navigation private: // Database - sqlite3 * db; + sqlite3 * database; // Components history::Back * historyBack; @@ -91,7 +91,7 @@ namespace app::browser::main::tab::page::navigation std::vector memory; History( - sqlite3 * db, + sqlite3 * database, const Glib::RefPtr & ACTION__HISTORY_BACK, const Glib::RefPtr & ACTION__HISTORY_FORWARD ); diff --git a/src/app/browser/main/tab/page/navigation/request.cpp b/src/app/browser/main/tab/page/navigation/request.cpp index fe21fea2..72a69744 100644 --- a/src/app/browser/main/tab/page/navigation/request.cpp +++ b/src/app/browser/main/tab/page/navigation/request.cpp @@ -4,13 +4,13 @@ using namespace app::browser::main::tab::page::navigation; // Construct Request::Request( - sqlite3 * db, + sqlite3 * database, const Glib::RefPtr & ACTION__RELOAD, const Glib::RefPtr & ACTION__UPDATE ) { // Init database Database::Session::init( - this->db = db + this->database = database ); // Init actions @@ -95,7 +95,7 @@ int Request::session_restore( sqlite3_stmt* statement; // @TODO move to the Database model namespace const int PREPARE_STATUS = sqlite3_prepare_v3( - db, + database, Glib::ustring::sprintf( R"SQL( SELECT * FROM `app_browser_main_tab_page_navigation_request__session` @@ -139,13 +139,13 @@ int Request::session_save( ) { // Delete previous records Database::Session::clean( - db, + database, APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__SESSION__ID ); // Add new record return Database::Session::add( - db, + database, APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__SESSION__ID, get_text() ); @@ -153,12 +153,12 @@ int Request::session_save( // Database model int Request::Database::Session::init( - sqlite3 * db + sqlite3 * database ) { char * error; return sqlite3_exec( - db, + database, R"SQL( CREATE TABLE IF NOT EXISTS `app_browser_main_tab_page_navigation_request__session` ( @@ -174,14 +174,14 @@ int Request::Database::Session::init( } int Request::Database::Session::clean( - sqlite3 * db, + sqlite3 * database, const sqlite3_int64 & APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__SESSION__ID ) { char * error; // @TODO sqlite3_stmt * statement; const int PREPARE_STATUS = sqlite3_prepare_v3( - db, + database, Glib::ustring::sprintf( R"SQL( SELECT * FROM `app_browser_main_tab_page_navigation_request__session` @@ -201,7 +201,7 @@ int Request::Database::Session::clean( { // Delete record const int EXEC_STATUS = sqlite3_exec( - db, + database, Glib::ustring::sprintf( R"SQL( DELETE FROM `app_browser_main_tab_page_navigation_request__session` WHERE `id` = %d @@ -230,14 +230,14 @@ int Request::Database::Session::clean( } sqlite3_int64 Request::Database::Session::add( - sqlite3 * db, + sqlite3 * database, const sqlite3_int64 & APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__SESSION__ID, const Glib::ustring & TEXT ) { char * error; // @TODO sqlite3_exec( - db, + database, Glib::ustring::sprintf( R"SQL( INSERT INTO `app_browser_main_tab_page_navigation_request__session` ( @@ -257,6 +257,6 @@ sqlite3_int64 Request::Database::Session::add( ); return sqlite3_last_insert_rowid( - db + database ); } \ No newline at end of file diff --git a/src/app/browser/main/tab/page/navigation/request.hpp b/src/app/browser/main/tab/page/navigation/request.hpp index 44cbbd9b..ed0eb594 100644 --- a/src/app/browser/main/tab/page/navigation/request.hpp +++ b/src/app/browser/main/tab/page/navigation/request.hpp @@ -36,16 +36,16 @@ namespace app::browser::main::tab::page::navigation }; // table fields index static int init( - sqlite3 * db + sqlite3 * database ); // return sqlite3_exec status code static int clean( - sqlite3 * db, + sqlite3 * database, const sqlite3_int64 & APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__SESSION__ID ); // return sqlite3_finalize status code static sqlite3_int64 add( - sqlite3 * db, + sqlite3 * database, const sqlite3_int64 & APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__SESSION__ID, const Glib::ustring & TEXT ); // return sqlite3_last_insert_rowid @@ -58,7 +58,7 @@ namespace app::browser::main::tab::page::navigation private: // Database - sqlite3 * db; + sqlite3 * database; // Actions Glib::RefPtr action__reload, @@ -79,7 +79,7 @@ namespace app::browser::main::tab::page::navigation public: Request( - sqlite3 * db, + sqlite3 * database, const Glib::RefPtr & ACTION__RELOAD, const Glib::RefPtr & ACTION__UPDATE );