Browse Source

update database/session struct name registry

CPP-GTK4
yggverse 2 months ago
parent
commit
4b2bf57cec
  1. 30
      src/app/browser.cpp
  2. 4
      src/app/browser.hpp
  3. 20
      src/app/browser/main.cpp
  4. 4
      src/app/browser/main.hpp
  5. 26
      src/app/browser/main/tab.cpp
  6. 4
      src/app/browser/main/tab.hpp
  7. 16
      src/app/browser/main/tab/label.cpp
  8. 4
      src/app/browser/main/tab/label.hpp
  9. 24
      src/app/browser/main/tab/page.cpp
  10. 4
      src/app/browser/main/tab/page.hpp
  11. 24
      src/app/browser/main/tab/page/navigation.cpp
  12. 4
      src/app/browser/main/tab/page/navigation.hpp
  13. 22
      src/app/browser/main/tab/page/navigation/history.cpp
  14. 4
      src/app/browser/main/tab/page/navigation/history.hpp
  15. 18
      src/app/browser/main/tab/page/navigation/request.cpp
  16. 4
      src/app/browser/main/tab/page/navigation/request.hpp

30
src/app/browser.cpp

@ -8,7 +8,7 @@ Browser::Browser(
sqlite3 * db sqlite3 * db
) { ) {
// Init database // Init database
DB::SESSION::init( Database::Session::init(
this->db = db this->db = db
); );
@ -243,7 +243,7 @@ Browser::Browser(
"<Primary>q" "<Primary>q"
); );
session_restore(); // last session from DB session_restore(); // last session from Database
} }
); );
@ -263,7 +263,7 @@ Browser::Browser(
// Actions // Actions
int Browser::session_restore() int Browser::session_restore()
{ {
sqlite3_stmt* statement; // @TODO move to the DB model namespace sqlite3_stmt* statement; // @TODO move to the Database model namespace
const int PREPARE_STATUS = sqlite3_prepare_v3( const int PREPARE_STATUS = sqlite3_prepare_v3(
db, db,
@ -284,24 +284,24 @@ int Browser::session_restore()
set_default_size( set_default_size(
sqlite3_column_int( sqlite3_column_int(
statement, statement,
DB::SESSION::WIDTH Database::Session::WIDTH
), ),
sqlite3_column_int( sqlite3_column_int(
statement, statement,
DB::SESSION::HEIGHT Database::Session::HEIGHT
) )
); );
sqlite3_column_int( sqlite3_column_int(
statement, statement,
DB::SESSION::IS_FULLSCREEN Database::Session::IS_FULLSCREEN
) == 1 ? fullscreen() : unfullscreen(); ) == 1 ? fullscreen() : unfullscreen();
// Restore children components // Restore children components
browserMain->session_restore( browserMain->session_restore(
sqlite3_column_int64( sqlite3_column_int64(
statement, statement,
DB::SESSION::ID Database::Session::ID
) )
); );
} }
@ -314,7 +314,7 @@ int Browser::session_restore()
void Browser::session_clean() void Browser::session_clean()
{ {
DB::SESSION::clean( Database::Session::clean(
db db
); );
@ -326,12 +326,12 @@ void Browser::session_save()
char * error; // @TODO char * error; // @TODO
// Delete previous data // Delete previous data
DB::SESSION::clean( Database::Session::clean(
db db
); // @TODO run on background ); // @TODO run on background
// Create new session // Create new session
const sqlite3_int64 APP_BROWSER__SESSION__ID = DB::SESSION::add( const sqlite3_int64 APP_BROWSER__SESSION__ID = Database::Session::add(
db, db,
get_width(), get_width(),
get_height(), get_height(),
@ -345,7 +345,7 @@ void Browser::session_save()
} }
// Database // Database
int Browser::DB::SESSION::init( int Browser::Database::Session::init(
sqlite3 * db sqlite3 * db
) { ) {
char * error; char * error;
@ -368,7 +368,7 @@ int Browser::DB::SESSION::init(
); );
} }
int Browser::DB::SESSION::clean( int Browser::Database::Session::clean(
sqlite3 * db sqlite3 * db
) { ) {
char * error; // @TODO char * error; // @TODO
@ -391,7 +391,7 @@ int Browser::DB::SESSION::clean(
{ {
const sqlite3_int64 APP_BROWSER__SESSION__ID = sqlite3_column_int64( const sqlite3_int64 APP_BROWSER__SESSION__ID = sqlite3_column_int64(
statement, statement,
DB::SESSION::ID Database::Session::ID
); );
// Delete record // Delete record
@ -411,7 +411,7 @@ int Browser::DB::SESSION::clean(
// Delegate children dependencies cleanup // Delegate children dependencies cleanup
if (EXEC_STATUS == SQLITE_OK) if (EXEC_STATUS == SQLITE_OK)
{ {
browser::Main::DB::SESSION::clean( browser::Main::Database::Session::clean(
db, db,
APP_BROWSER__SESSION__ID APP_BROWSER__SESSION__ID
); );
@ -424,7 +424,7 @@ int Browser::DB::SESSION::clean(
); );
} }
sqlite3_int64 Browser::DB::SESSION::add( sqlite3_int64 Browser::Database::Session::add(
sqlite3 * db, sqlite3 * db,
const int & WIDTH, const int & WIDTH,
const int & HEIGHT, const int & HEIGHT,

4
src/app/browser.hpp

@ -27,10 +27,10 @@ namespace app
* *
* Allowed parental access to enums and relationship methods * Allowed parental access to enums and relationship methods
*/ */
struct DB struct Database
{ {
// APP_BROWSER__* // APP_BROWSER__*
struct SESSION struct Session
{ {
enum enum
{ {

20
src/app/browser/main.cpp

@ -13,7 +13,7 @@ Main::Main(
const Glib::RefPtr<Gio::SimpleAction> & ACTION__UPDATE const Glib::RefPtr<Gio::SimpleAction> & ACTION__UPDATE
) { ) {
// Init database // Init database
DB::SESSION::init( Database::Session::init(
this->db = db this->db = db
); );
@ -48,7 +48,7 @@ Main::Main(
int Main::session_restore( int Main::session_restore(
const sqlite3_int64 & APP_BROWSER__SESSION__ID const sqlite3_int64 & APP_BROWSER__SESSION__ID
) { ) {
sqlite3_stmt* statement; // @TODO move to the DB model namespace sqlite3_stmt* statement; // @TODO move to the Database model namespace
const int PREPARE_STATUS = sqlite3_prepare_v3( const int PREPARE_STATUS = sqlite3_prepare_v3(
db, db,
@ -72,7 +72,7 @@ int Main::session_restore(
mainTab->session_restore( mainTab->session_restore(
sqlite3_column_int64( sqlite3_column_int64(
statement, statement,
DB::SESSION::ID Database::Session::ID
) )
); );
} }
@ -89,13 +89,13 @@ void Main::session_save(
char * error; // @TODO char * error; // @TODO
// Delete previous data // Delete previous data
DB::SESSION::clean( Database::Session::clean(
db, db,
APP_BROWSER__SESSION__ID APP_BROWSER__SESSION__ID
); // @TODO run on background ); // @TODO run on background
// Create new session // Create new session
const sqlite3_int64 APP_BROWSER_MAIN__SESSION__ID = DB::SESSION::add( const sqlite3_int64 APP_BROWSER_MAIN__SESSION__ID = Database::Session::add(
db, db,
APP_BROWSER__SESSION__ID APP_BROWSER__SESSION__ID
); );
@ -184,7 +184,7 @@ Glib::ustring Main::get_tab_page_description()
// Database // Database
int Main::DB::SESSION::init( int Main::Database::Session::init(
sqlite3 * db sqlite3 * db
) { ) {
char * error; char * error;
@ -204,7 +204,7 @@ int Main::DB::SESSION::init(
); );
} }
int Main::DB::SESSION::clean( int Main::Database::Session::clean(
sqlite3 * db, sqlite3 * db,
const sqlite3_int64 & APP_BROWSER__SESSION__ID const sqlite3_int64 & APP_BROWSER__SESSION__ID
) { ) {
@ -232,7 +232,7 @@ int Main::DB::SESSION::clean(
{ {
const sqlite3_int64 APP_BROWSER_MAIN__SESSION__ID = sqlite3_column_int64( const sqlite3_int64 APP_BROWSER_MAIN__SESSION__ID = sqlite3_column_int64(
statement, statement,
DB::SESSION::ID Database::Session::ID
); );
// Delete record // Delete record
@ -252,7 +252,7 @@ int Main::DB::SESSION::clean(
// Delegate children dependencies cleanup // Delegate children dependencies cleanup
if (EXEC_STATUS == SQLITE_OK) if (EXEC_STATUS == SQLITE_OK)
{ {
main::Tab::DB::SESSION::clean( main::Tab::Database::Session::clean(
db, db,
APP_BROWSER_MAIN__SESSION__ID APP_BROWSER_MAIN__SESSION__ID
); );
@ -265,7 +265,7 @@ int Main::DB::SESSION::clean(
); );
} }
sqlite3_int64 Main::DB::SESSION::add( sqlite3_int64 Main::Database::Session::add(
sqlite3 * db, sqlite3 * db,
const sqlite3_int64 & APP_BROWSER__SESSION__ID const sqlite3_int64 & APP_BROWSER__SESSION__ID
) { ) {

4
src/app/browser/main.hpp

@ -25,10 +25,10 @@ namespace app::browser
* *
* Allowed parental access to enums and relationship methods * Allowed parental access to enums and relationship methods
*/ */
struct DB struct Database
{ {
// APP_BROWSER_MAIN__* // APP_BROWSER_MAIN__*
struct SESSION struct Session
{ {
enum enum
{ {

26
src/app/browser/main/tab.cpp

@ -14,7 +14,7 @@ Tab::Tab(
const Glib::RefPtr<Gio::SimpleAction> & ACTION__UPDATE const Glib::RefPtr<Gio::SimpleAction> & ACTION__UPDATE
) { ) {
// Init database // Init database
DB::SESSION::init( Database::Session::init(
this->db = db this->db = db
); );
@ -43,7 +43,7 @@ Tab::Tab(
int Tab::session_restore( int Tab::session_restore(
const sqlite3_int64 & APP_BROWSER_MAIN__SESSION__ID const sqlite3_int64 & APP_BROWSER_MAIN__SESSION__ID
) { ) {
sqlite3_stmt* statement; // @TODO move to the DB model namespace sqlite3_stmt* statement; // @TODO move to the Database model namespace
const int PREPARE_STATUS = sqlite3_prepare_v3( const int PREPARE_STATUS = sqlite3_prepare_v3(
db, db,
@ -69,7 +69,7 @@ int Tab::session_restore(
const int PAGE_NUMBER = append( const int PAGE_NUMBER = append(
sqlite3_column_int( sqlite3_column_int(
statement, statement,
DB::SESSION::IS_CURRENT Database::Session::IS_CURRENT
) == 1 ) == 1
); );
@ -79,7 +79,7 @@ int Tab::session_restore(
)->session_restore( )->session_restore(
sqlite3_column_int64( sqlite3_column_int64(
statement, statement,
DB::SESSION::ID Database::Session::ID
) )
); // maybe not much reasons to restore as page title in use @TODO ); // maybe not much reasons to restore as page title in use @TODO
@ -88,7 +88,7 @@ int Tab::session_restore(
)->session_restore( )->session_restore(
sqlite3_column_int64( sqlite3_column_int64(
statement, statement,
DB::SESSION::ID Database::Session::ID
) )
); );
} }
@ -105,7 +105,7 @@ void Tab::session_save(
char * error; // @TODO char * error; // @TODO
// Delete previous data // Delete previous data
DB::SESSION::clean( Database::Session::clean(
db, db,
APP_BROWSER_MAIN__SESSION__ID APP_BROWSER_MAIN__SESSION__ID
); // @TODO run on background ); // @TODO run on background
@ -114,7 +114,7 @@ void Tab::session_save(
for (int page_number = 0; page_number < get_n_pages(); page_number++) for (int page_number = 0; page_number < get_n_pages(); page_number++)
{ {
// Create new session // Create new session
const sqlite3_int64 APP_BROWSER_MAIN_TAB__SESSION__ID = DB::SESSION::add( const sqlite3_int64 APP_BROWSER_MAIN_TAB__SESSION__ID = Database::Session::add(
db, db,
APP_BROWSER_MAIN__SESSION__ID, APP_BROWSER_MAIN__SESSION__ID,
page_number, page_number,
@ -339,7 +339,7 @@ tab::Page * Tab::get_tabPage(
} }
// Database // Database
int Tab::DB::SESSION::init( int Tab::Database::Session::init(
sqlite3 * db sqlite3 * db
) { ) {
char * error; char * error;
@ -361,7 +361,7 @@ int Tab::DB::SESSION::init(
); );
} }
int Tab::DB::SESSION::clean( int Tab::Database::Session::clean(
sqlite3 * db, sqlite3 * db,
const sqlite3_int64 & APP_BROWSER_MAIN__SESSION__ID const sqlite3_int64 & APP_BROWSER_MAIN__SESSION__ID
) { ) {
@ -389,7 +389,7 @@ int Tab::DB::SESSION::clean(
{ {
const sqlite3_int64 APP_BROWSER_MAIN_TAB__SESSION__ID = sqlite3_column_int64( const sqlite3_int64 APP_BROWSER_MAIN_TAB__SESSION__ID = sqlite3_column_int64(
statement, statement,
DB::SESSION::ID Database::Session::ID
); );
// Delete record // Delete record
@ -409,12 +409,12 @@ int Tab::DB::SESSION::clean(
// Delegate children dependencies cleanup // Delegate children dependencies cleanup
if (EXEC_STATUS == SQLITE_OK) if (EXEC_STATUS == SQLITE_OK)
{ {
tab::Label::DB::SESSION::clean( tab::Label::Database::Session::clean(
db, db,
APP_BROWSER_MAIN_TAB__SESSION__ID APP_BROWSER_MAIN_TAB__SESSION__ID
); );
tab::Page::DB::SESSION::clean( tab::Page::Database::Session::clean(
db, db,
APP_BROWSER_MAIN_TAB__SESSION__ID APP_BROWSER_MAIN_TAB__SESSION__ID
); );
@ -427,7 +427,7 @@ int Tab::DB::SESSION::clean(
); );
} }
sqlite3_int64 Tab::DB::SESSION::add( sqlite3_int64 Tab::Database::Session::add(
sqlite3 * db, sqlite3 * db,
const sqlite3_int64 & APP_BROWSER_MAIN__SESSION__ID, const sqlite3_int64 & APP_BROWSER_MAIN__SESSION__ID,
const int & PAGE_NUMBER, const int & PAGE_NUMBER,

4
src/app/browser/main/tab.hpp

@ -25,10 +25,10 @@ namespace app::browser::main
* *
* Allowed parental access to enums and relationship methods * Allowed parental access to enums and relationship methods
*/ */
struct DB struct Database
{ {
// APP_BROWSER_MAIN_TAB__* // APP_BROWSER_MAIN_TAB__*
struct SESSION struct Session
{ {
enum enum
{ {

16
src/app/browser/main/tab/label.cpp

@ -7,7 +7,7 @@ Label::Label(
const Glib::RefPtr<Gio::SimpleAction> & ACTION__TAB_CLOSE const Glib::RefPtr<Gio::SimpleAction> & ACTION__TAB_CLOSE
) { ) {
// Init database // Init database
DB::SESSION::init( Database::Session::init(
this->db = db this->db = db
); );
@ -115,12 +115,12 @@ int Label::session_restore(
reinterpret_cast<const char*>( reinterpret_cast<const char*>(
sqlite3_column_text( sqlite3_column_text(
statement, statement,
DB::SESSION::TEXT Database::Session::TEXT
) )
), ),
sqlite3_column_int( sqlite3_column_int(
statement, statement,
DB::SESSION::IS_PINNED Database::Session::IS_PINNED
) == 1 ) == 1
); );
@ -139,7 +139,7 @@ int Label::session_save(
// Delegate save action to child components (on available) // Delegate save action to child components (on available)
// Save label session // Save label session
return DB::SESSION::add( return Database::Session::add(
db, db,
APP_BROWSER_MAIN_TAB__SESSION__ID, APP_BROWSER_MAIN_TAB__SESSION__ID,
is_pinned, is_pinned,
@ -210,7 +210,7 @@ void Label::update(
} }
// Database model // Database model
int Label::DB::SESSION::init( int Label::Database::Session::init(
sqlite3 * db sqlite3 * db
) { ) {
char * error; char * error;
@ -232,7 +232,7 @@ int Label::DB::SESSION::init(
); );
} }
int Label::DB::SESSION::clean( int Label::Database::Session::clean(
sqlite3 * db, sqlite3 * db,
const sqlite3_int64 & APP_BROWSER_MAIN_TAB__SESSION__ID const sqlite3_int64 & APP_BROWSER_MAIN_TAB__SESSION__ID
) { ) {
@ -267,7 +267,7 @@ int Label::DB::SESSION::clean(
)SQL", )SQL",
sqlite3_column_int64( sqlite3_column_int64(
statement, statement,
DB::SESSION::ID Database::Session::ID
) )
).c_str(), ).c_str(),
nullptr, nullptr,
@ -288,7 +288,7 @@ int Label::DB::SESSION::clean(
); );
} }
sqlite3_int64 Label::DB::SESSION::add( sqlite3_int64 Label::Database::Session::add(
sqlite3 * db, sqlite3 * db,
const sqlite3_int64 & APP_BROWSER_MAIN_TAB__SESSION__ID, const sqlite3_int64 & APP_BROWSER_MAIN_TAB__SESSION__ID,
const bool & IS_PINNED, const bool & IS_PINNED,

4
src/app/browser/main/tab/label.hpp

@ -22,10 +22,10 @@ namespace app::browser::main::tab
* *
* Allowed parental access to enums and relationship methods * Allowed parental access to enums and relationship methods
*/ */
struct DB struct Database
{ {
// APP_BROWSER_MAIN_TAB_LABEL__* // APP_BROWSER_MAIN_TAB_LABEL__*
struct SESSION struct Session
{ {
enum enum
{ {

24
src/app/browser/main/tab/page.cpp

@ -17,7 +17,7 @@ Page::Page(
progress_fraction = 0; progress_fraction = 0;
// Init database // Init database
DB::SESSION::init( Database::Session::init(
this->db = db this->db = db
); );
@ -93,7 +93,7 @@ Page::Page(
int Page::session_restore( int Page::session_restore(
const sqlite3_int64 & APP_BROWSER_MAIN_TAB__SESSION__ID const sqlite3_int64 & APP_BROWSER_MAIN_TAB__SESSION__ID
) { ) {
sqlite3_stmt* statement; // @TODO move to the DB model namespace sqlite3_stmt* statement; // @TODO move to the Database model namespace
const int PREPARE_STATUS = sqlite3_prepare_v3( const int PREPARE_STATUS = sqlite3_prepare_v3(
db, db,
@ -120,7 +120,7 @@ int Page::session_restore(
switch ( switch (
sqlite3_column_int( sqlite3_column_int(
statement, statement,
DB::SESSION::MIME Database::Session::MIME
) )
) { ) {
case 0: mime = MIME::TEXT_PLAIN; break; case 0: mime = MIME::TEXT_PLAIN; break;
@ -133,14 +133,14 @@ int Page::session_restore(
title = reinterpret_cast<const char*>( title = reinterpret_cast<const char*>(
sqlite3_column_text( sqlite3_column_text(
statement, statement,
DB::SESSION::TITLE Database::Session::TITLE
) )
); );
description = reinterpret_cast<const char*>( description = reinterpret_cast<const char*>(
sqlite3_column_text( sqlite3_column_text(
statement, statement,
DB::SESSION::DESCRIPTION Database::Session::DESCRIPTION
) )
); );
@ -148,7 +148,7 @@ int Page::session_restore(
pageNavigation->session_restore( pageNavigation->session_restore(
sqlite3_column_int64( sqlite3_column_int64(
statement, statement,
DB::SESSION::ID Database::Session::ID
) )
); );
} }
@ -164,7 +164,7 @@ void Page::session_save(
) { ) {
// Delegate save action to child components // Delegate save action to child components
pageNavigation->session_save( pageNavigation->session_save(
DB::SESSION::add( Database::Session::add(
db, db,
APP_BROWSER_MAIN_TAB__SESSION__ID, APP_BROWSER_MAIN_TAB__SESSION__ID,
mime, mime,
@ -519,7 +519,7 @@ Glib::ustring Page::get_description()
} }
// Database model // Database model
int Page::DB::SESSION::init( int Page::Database::Session::init(
sqlite3 * db sqlite3 * db
) { ) {
char * error; char * error;
@ -542,7 +542,7 @@ int Page::DB::SESSION::init(
); );
} }
int Page::DB::SESSION::clean( int Page::Database::Session::clean(
sqlite3 * db, sqlite3 * db,
const sqlite3_int64 & APP_BROWSER_MAIN_TAB__SESSION__ID const sqlite3_int64 & APP_BROWSER_MAIN_TAB__SESSION__ID
) { ) {
@ -569,7 +569,7 @@ int Page::DB::SESSION::clean(
{ {
const sqlite3_int64 APP_BROWSER_MAIN_TAB_PAGE__SESSION__ID = sqlite3_column_int64( const sqlite3_int64 APP_BROWSER_MAIN_TAB_PAGE__SESSION__ID = sqlite3_column_int64(
statement, statement,
DB::SESSION::ID Database::Session::ID
); );
// Delete record // Delete record
@ -589,7 +589,7 @@ int Page::DB::SESSION::clean(
// Delegate children dependencies cleanup // Delegate children dependencies cleanup
if (EXEC_STATUS == SQLITE_OK) if (EXEC_STATUS == SQLITE_OK)
{ {
page::Navigation::DB::SESSION::clean( page::Navigation::Database::Session::clean(
db, db,
APP_BROWSER_MAIN_TAB_PAGE__SESSION__ID APP_BROWSER_MAIN_TAB_PAGE__SESSION__ID
); );
@ -602,7 +602,7 @@ int Page::DB::SESSION::clean(
); );
} }
sqlite3_int64 Page::DB::SESSION::add( sqlite3_int64 Page::Database::Session::add(
sqlite3 * db, sqlite3 * db,
const sqlite3_int64 & APP_BROWSER_MAIN_TAB__SESSION__ID, const sqlite3_int64 & APP_BROWSER_MAIN_TAB__SESSION__ID,
const Page::MIME & MIME, const Page::MIME & MIME,

4
src/app/browser/main/tab/page.hpp

@ -43,10 +43,10 @@ namespace app::browser::main::tab
* *
* Allowed parental access to enums and relationship methods * Allowed parental access to enums and relationship methods
*/ */
struct DB struct Database
{ {
// APP_BROWSER_MAIN_TAB_PAGE__* // APP_BROWSER_MAIN_TAB_PAGE__*
struct SESSION struct Session
{ {
enum enum
{ {

24
src/app/browser/main/tab/page/navigation.cpp

@ -16,7 +16,7 @@ Navigation::Navigation(
const Glib::RefPtr<Gio::SimpleAction> & ACTION__UPDATE const Glib::RefPtr<Gio::SimpleAction> & ACTION__UPDATE
) { ) {
// Init database // Init database
DB::SESSION::init( Database::Session::init(
this->db = db this->db = db
); );
@ -112,7 +112,7 @@ void Navigation::update(
int Navigation::session_restore( int Navigation::session_restore(
const sqlite3_int64 & APP_BROWSER_MAIN_TAB_PAGE__SESSION__ID const sqlite3_int64 & APP_BROWSER_MAIN_TAB_PAGE__SESSION__ID
) { ) {
sqlite3_stmt* statement; // @TODO move to the DB model namespace sqlite3_stmt* statement; // @TODO move to the Database model namespace
const int PREPARE_STATUS = sqlite3_prepare_v3( const int PREPARE_STATUS = sqlite3_prepare_v3(
db, db,
@ -139,14 +139,14 @@ int Navigation::session_restore(
navigationHistory->session_restore( navigationHistory->session_restore(
sqlite3_column_int64( sqlite3_column_int64(
statement, statement,
DB::SESSION::ID Database::Session::ID
) )
); );
navigationRequest->session_restore( navigationRequest->session_restore(
sqlite3_column_int64( sqlite3_column_int64(
statement, statement,
DB::SESSION::ID Database::Session::ID
) )
); );
} }
@ -161,13 +161,13 @@ void Navigation::session_save(
const sqlite3_int64 & APP_BROWSER_MAIN_TAB_PAGE__SESSION__ID const sqlite3_int64 & APP_BROWSER_MAIN_TAB_PAGE__SESSION__ID
) { ) {
// Delete previous session // Delete previous session
DB::SESSION::clean( Database::Session::clean(
db, db,
APP_BROWSER_MAIN_TAB_PAGE__SESSION__ID APP_BROWSER_MAIN_TAB_PAGE__SESSION__ID
); );
// Create new record // Create new record
const sqlite3_int64 APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__SESSION__ID = DB::SESSION::add( const sqlite3_int64 APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__SESSION__ID = Database::Session::add(
db, db,
APP_BROWSER_MAIN_TAB_PAGE__SESSION__ID APP_BROWSER_MAIN_TAB_PAGE__SESSION__ID
); );
@ -256,7 +256,7 @@ void Navigation::set_request_text(
} }
// Database model // Database model
int Navigation::DB::SESSION::init( int Navigation::Database::Session::init(
sqlite3 * db sqlite3 * db
) { ) {
char * error; char * error;
@ -276,7 +276,7 @@ int Navigation::DB::SESSION::init(
); );
} }
int Navigation::DB::SESSION::clean( int Navigation::Database::Session::clean(
sqlite3 * db, sqlite3 * db,
const sqlite3_int64 & APP_BROWSER_MAIN_TAB_PAGE__SESSION__ID const sqlite3_int64 & APP_BROWSER_MAIN_TAB_PAGE__SESSION__ID
) { ) {
@ -304,7 +304,7 @@ int Navigation::DB::SESSION::clean(
{ {
const sqlite3_int64 APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__SESSION__ID = sqlite3_column_int64( const sqlite3_int64 APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__SESSION__ID = sqlite3_column_int64(
statement, statement,
DB::SESSION::ID Database::Session::ID
); );
// Delete record // Delete record
@ -324,12 +324,12 @@ int Navigation::DB::SESSION::clean(
// Delegate children dependencies cleanup // Delegate children dependencies cleanup
if (EXEC_STATUS == SQLITE_OK) if (EXEC_STATUS == SQLITE_OK)
{ {
navigation::History::DB::SESSION::clean( navigation::History::Database::Session::clean(
db, db,
APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__SESSION__ID APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__SESSION__ID
); );
navigation::Request::DB::SESSION::clean( navigation::Request::Database::Session::clean(
db, db,
APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__SESSION__ID APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__SESSION__ID
); );
@ -342,7 +342,7 @@ int Navigation::DB::SESSION::clean(
); );
} }
sqlite3_int64 Navigation::DB::SESSION::add( sqlite3_int64 Navigation::Database::Session::add(
sqlite3 * db, sqlite3 * db,
const sqlite3_int64 & APP_BROWSER_MAIN_TAB_PAGE__SESSION__ID const sqlite3_int64 & APP_BROWSER_MAIN_TAB_PAGE__SESSION__ID
) { ) {

4
src/app/browser/main/tab/page/navigation.hpp

@ -28,10 +28,10 @@ namespace app::browser::main::tab::page
* *
* Allowed parental access to enums and relationship methods * Allowed parental access to enums and relationship methods
*/ */
struct DB struct Database
{ {
// APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__* // APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__*
struct SESSION struct Session
{ {
enum enum
{ {

22
src/app/browser/main/tab/page/navigation/history.cpp

@ -10,7 +10,7 @@ History::History(
const Glib::RefPtr<Gio::SimpleAction> & ACTION__HISTORY_FORWARD const Glib::RefPtr<Gio::SimpleAction> & ACTION__HISTORY_FORWARD
) { ) {
// Init database // Init database
DB::SESSION::init( Database::Session::init(
this->db = db this->db = db
); );
@ -59,7 +59,7 @@ void History::add(
int History::session_restore( int History::session_restore(
const sqlite3_int64 & APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__SESSION__ID const sqlite3_int64 & APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__SESSION__ID
) { ) {
sqlite3_stmt* statement; // @TODO move to the DB model namespace sqlite3_stmt* statement; // @TODO move to the Database model namespace
const int PREPARE_STATUS = sqlite3_prepare_v3( const int PREPARE_STATUS = sqlite3_prepare_v3(
db, db,
@ -94,17 +94,17 @@ int History::session_restore(
reinterpret_cast<const char*>( reinterpret_cast<const char*>(
sqlite3_column_text( sqlite3_column_text(
statement, statement,
DB::SESSION::REQUEST Database::Session::REQUEST
) )
), ),
sqlite3_column_int( sqlite3_column_int(
statement, statement,
DB::SESSION::TIME Database::Session::TIME
) )
} }
); );
if (sqlite3_column_int(statement, DB::SESSION::IS_CURRENT) == 1) if (sqlite3_column_int(statement, Database::Session::IS_CURRENT) == 1)
{ {
index = memory.size() - 1; index = memory.size() - 1;
} }
@ -128,7 +128,7 @@ void History::session_save(
const sqlite3_int64 & APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__SESSION__ID const sqlite3_int64 & APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__SESSION__ID
) { ) {
// Delete previous records for session // Delete previous records for session
DB::SESSION::clean( Database::Session::clean(
db, db,
APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__SESSION__ID APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__SESSION__ID
); );
@ -136,7 +136,7 @@ void History::session_save(
// Add new records // Add new records
int offset = -1; for (const auto & MEMORY : memory) int offset = -1; for (const auto & MEMORY : memory)
{ {
DB::SESSION::add( Database::Session::add(
db, db,
APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__SESSION__ID, APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__SESSION__ID,
MEMORY.time, MEMORY.time,
@ -232,7 +232,7 @@ bool History::try_forward(
} }
// Database model // Database model
int History::DB::SESSION::init( int History::Database::Session::init(
sqlite3 * db sqlite3 * db
) { ) {
char * error; char * error;
@ -254,7 +254,7 @@ int History::DB::SESSION::init(
); );
} }
int History::DB::SESSION::clean( int History::Database::Session::clean(
sqlite3 * db, sqlite3 * db,
const sqlite3_int64 & APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__SESSION__ID const sqlite3_int64 & APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__SESSION__ID
) { ) {
@ -289,7 +289,7 @@ int History::DB::SESSION::clean(
)SQL", )SQL",
sqlite3_column_int64( sqlite3_column_int64(
statement, statement,
DB::SESSION::ID Database::Session::ID
) )
).c_str(), ).c_str(),
nullptr, nullptr,
@ -310,7 +310,7 @@ int History::DB::SESSION::clean(
); );
} }
sqlite3_int64 History::DB::SESSION::add( sqlite3_int64 History::Database::Session::add(
sqlite3 * db, sqlite3 * db,
const sqlite3_int64 & APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__SESSION__ID, const sqlite3_int64 & APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__SESSION__ID,
const int & TIME, const int & TIME,

4
src/app/browser/main/tab/page/navigation/history.hpp

@ -27,10 +27,10 @@ namespace app::browser::main::tab::page::navigation
* *
* Allowed parental access to enums and relationship methods * Allowed parental access to enums and relationship methods
*/ */
struct DB struct Database
{ {
// APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION_HISTORY__* // APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION_HISTORY__*
struct SESSION struct Session
{ {
enum enum
{ {

18
src/app/browser/main/tab/page/navigation/request.cpp

@ -9,7 +9,7 @@ Request::Request(
const Glib::RefPtr<Gio::SimpleAction> & ACTION__UPDATE const Glib::RefPtr<Gio::SimpleAction> & ACTION__UPDATE
) { ) {
// Init database // Init database
DB::SESSION::init( Database::Session::init(
this->db = db this->db = db
); );
@ -92,7 +92,7 @@ void Request::update(
int Request::session_restore( int Request::session_restore(
const sqlite3_int64 & APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__SESSION__ID const sqlite3_int64 & APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__SESSION__ID
) { ) {
sqlite3_stmt* statement; // @TODO move to the DB model namespace sqlite3_stmt* statement; // @TODO move to the Database model namespace
const int PREPARE_STATUS = sqlite3_prepare_v3( const int PREPARE_STATUS = sqlite3_prepare_v3(
db, db,
@ -120,7 +120,7 @@ int Request::session_restore(
reinterpret_cast<const char*>( reinterpret_cast<const char*>(
sqlite3_column_text( sqlite3_column_text(
statement, statement,
DB::SESSION::TEXT Database::Session::TEXT
) )
) )
); );
@ -138,13 +138,13 @@ int Request::session_save(
const sqlite3_int64 & APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__SESSION__ID const sqlite3_int64 & APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__SESSION__ID
) { ) {
// Delete previous records // Delete previous records
DB::SESSION::clean( Database::Session::clean(
db, db,
APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__SESSION__ID APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__SESSION__ID
); );
// Add new record // Add new record
return DB::SESSION::add( return Database::Session::add(
db, db,
APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__SESSION__ID, APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__SESSION__ID,
get_text() get_text()
@ -152,7 +152,7 @@ int Request::session_save(
} }
// Database model // Database model
int Request::DB::SESSION::init( int Request::Database::Session::init(
sqlite3 * db sqlite3 * db
) { ) {
char * error; char * error;
@ -173,7 +173,7 @@ int Request::DB::SESSION::init(
); );
} }
int Request::DB::SESSION::clean( int Request::Database::Session::clean(
sqlite3 * db, sqlite3 * db,
const sqlite3_int64 & APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__SESSION__ID const sqlite3_int64 & APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__SESSION__ID
) { ) {
@ -208,7 +208,7 @@ int Request::DB::SESSION::clean(
)SQL", )SQL",
sqlite3_column_int64( sqlite3_column_int64(
statement, statement,
DB::SESSION::ID Database::Session::ID
) )
).c_str(), ).c_str(),
nullptr, nullptr,
@ -229,7 +229,7 @@ int Request::DB::SESSION::clean(
); );
} }
sqlite3_int64 Request::DB::SESSION::add( sqlite3_int64 Request::Database::Session::add(
sqlite3 * db, sqlite3 * db,
const sqlite3_int64 & APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__SESSION__ID, const sqlite3_int64 & APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__SESSION__ID,
const Glib::ustring & TEXT const Glib::ustring & TEXT

4
src/app/browser/main/tab/page/navigation/request.hpp

@ -22,10 +22,10 @@ namespace app::browser::main::tab::page::navigation
* *
* Allowed parental access to enums and relationship methods * Allowed parental access to enums and relationship methods
*/ */
struct DB struct Database
{ {
// APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION_REQUEST__* // APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION_REQUEST__*
struct SESSION struct Session
{ {
enum enum
{ {

Loading…
Cancel
Save