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

4
src/app/browser.hpp

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

20
src/app/browser/main.cpp

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

4
src/app/browser/main.hpp

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -16,7 +16,7 @@ Navigation::Navigation( @@ -16,7 +16,7 @@ Navigation::Navigation(
const Glib::RefPtr<Gio::SimpleAction> & ACTION__UPDATE
) {
// Init database
DB::SESSION::init(
Database::Session::init(
this->db = db
);
@ -112,7 +112,7 @@ void Navigation::update( @@ -112,7 +112,7 @@ void Navigation::update(
int Navigation::session_restore(
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(
db,
@ -139,14 +139,14 @@ int Navigation::session_restore( @@ -139,14 +139,14 @@ int Navigation::session_restore(
navigationHistory->session_restore(
sqlite3_column_int64(
statement,
DB::SESSION::ID
Database::Session::ID
)
);
navigationRequest->session_restore(
sqlite3_column_int64(
statement,
DB::SESSION::ID
Database::Session::ID
)
);
}
@ -161,13 +161,13 @@ void Navigation::session_save( @@ -161,13 +161,13 @@ void Navigation::session_save(
const sqlite3_int64 & APP_BROWSER_MAIN_TAB_PAGE__SESSION__ID
) {
// Delete previous session
DB::SESSION::clean(
Database::Session::clean(
db,
APP_BROWSER_MAIN_TAB_PAGE__SESSION__ID
);
// 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,
APP_BROWSER_MAIN_TAB_PAGE__SESSION__ID
);
@ -256,7 +256,7 @@ void Navigation::set_request_text( @@ -256,7 +256,7 @@ void Navigation::set_request_text(
}
// Database model
int Navigation::DB::SESSION::init(
int Navigation::Database::Session::init(
sqlite3 * db
) {
char * error;
@ -276,7 +276,7 @@ int Navigation::DB::SESSION::init( @@ -276,7 +276,7 @@ int Navigation::DB::SESSION::init(
);
}
int Navigation::DB::SESSION::clean(
int Navigation::Database::Session::clean(
sqlite3 * db,
const sqlite3_int64 & APP_BROWSER_MAIN_TAB_PAGE__SESSION__ID
) {
@ -304,7 +304,7 @@ int Navigation::DB::SESSION::clean( @@ -304,7 +304,7 @@ int Navigation::DB::SESSION::clean(
{
const sqlite3_int64 APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__SESSION__ID = sqlite3_column_int64(
statement,
DB::SESSION::ID
Database::Session::ID
);
// Delete record
@ -324,12 +324,12 @@ int Navigation::DB::SESSION::clean( @@ -324,12 +324,12 @@ int Navigation::DB::SESSION::clean(
// Delegate children dependencies cleanup
if (EXEC_STATUS == SQLITE_OK)
{
navigation::History::DB::SESSION::clean(
navigation::History::Database::Session::clean(
db,
APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__SESSION__ID
);
navigation::Request::DB::SESSION::clean(
navigation::Request::Database::Session::clean(
db,
APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__SESSION__ID
);
@ -342,7 +342,7 @@ int Navigation::DB::SESSION::clean( @@ -342,7 +342,7 @@ int Navigation::DB::SESSION::clean(
);
}
sqlite3_int64 Navigation::DB::SESSION::add(
sqlite3_int64 Navigation::Database::Session::add(
sqlite3 * db,
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 @@ -28,10 +28,10 @@ namespace app::browser::main::tab::page
*
* Allowed parental access to enums and relationship methods
*/
struct DB
struct Database
{
// APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__*
struct SESSION
struct Session
{
enum
{

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

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

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

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

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

@ -9,7 +9,7 @@ Request::Request( @@ -9,7 +9,7 @@ Request::Request(
const Glib::RefPtr<Gio::SimpleAction> & ACTION__UPDATE
) {
// Init database
DB::SESSION::init(
Database::Session::init(
this->db = db
);
@ -92,7 +92,7 @@ void Request::update( @@ -92,7 +92,7 @@ void Request::update(
int Request::session_restore(
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(
db,
@ -120,7 +120,7 @@ int Request::session_restore( @@ -120,7 +120,7 @@ int Request::session_restore(
reinterpret_cast<const char*>(
sqlite3_column_text(
statement,
DB::SESSION::TEXT
Database::Session::TEXT
)
)
);
@ -138,13 +138,13 @@ int Request::session_save( @@ -138,13 +138,13 @@ int Request::session_save(
const sqlite3_int64 & APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__SESSION__ID
) {
// Delete previous records
DB::SESSION::clean(
Database::Session::clean(
db,
APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__SESSION__ID
);
// Add new record
return DB::SESSION::add(
return Database::Session::add(
db,
APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__SESSION__ID,
get_text()
@ -152,7 +152,7 @@ int Request::session_save( @@ -152,7 +152,7 @@ int Request::session_save(
}
// Database model
int Request::DB::SESSION::init(
int Request::Database::Session::init(
sqlite3 * db
) {
char * error;
@ -173,7 +173,7 @@ int Request::DB::SESSION::init( @@ -173,7 +173,7 @@ int Request::DB::SESSION::init(
);
}
int Request::DB::SESSION::clean(
int Request::Database::Session::clean(
sqlite3 * db,
const sqlite3_int64 & APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__SESSION__ID
) {
@ -208,7 +208,7 @@ int Request::DB::SESSION::clean( @@ -208,7 +208,7 @@ int Request::DB::SESSION::clean(
)SQL",
sqlite3_column_int64(
statement,
DB::SESSION::ID
Database::Session::ID
)
).c_str(),
nullptr,
@ -229,7 +229,7 @@ int Request::DB::SESSION::clean( @@ -229,7 +229,7 @@ int Request::DB::SESSION::clean(
);
}
sqlite3_int64 Request::DB::SESSION::add(
sqlite3_int64 Request::Database::Session::add(
sqlite3 * db,
const sqlite3_int64 & APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__SESSION__ID,
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 @@ -22,10 +22,10 @@ namespace app::browser::main::tab::page::navigation
*
* Allowed parental access to enums and relationship methods
*/
struct DB
struct Database
{
// APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION_REQUEST__*
struct SESSION
struct Session
{
enum
{

Loading…
Cancel
Save