Browse Source

enshort db members namespace

CPP-GTK4
yggverse 4 months ago
parent
commit
edeee5654e
  1. 22
      src/app/browser/main/tab.cpp
  2. 3
      src/app/browser/main/tab.hpp
  3. 14
      src/app/browser/main/tab/page.cpp
  4. 3
      src/app/browser/main/tab/page.hpp
  5. 14
      src/app/browser/main/tab/page/navigation.cpp
  6. 3
      src/app/browser/main/tab/page/navigation.hpp
  7. 15
      src/app/browser/main/tab/page/navigation/request.cpp
  8. 3
      src/app/browser/main/tab/page/navigation/request.hpp

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

@ -14,7 +14,7 @@ Tab::Tab( @@ -14,7 +14,7 @@ Tab::Tab(
const Glib::RefPtr<Gio::SimpleAction> & ACTION__TAB_PAGE_NAVIGATION_UPDATE
) {
// Init database
DB::APP_BROWSER_MAIN_TAB__SESSION::init(
DB::SESSION::init(
this->db = db
);
@ -73,12 +73,12 @@ int Tab::restore() @@ -73,12 +73,12 @@ int Tab::restore()
reinterpret_cast<const char*>(
sqlite3_column_text(
statement,
DB::APP_BROWSER_MAIN_TAB__SESSION::LABEL_TEXT
DB::SESSION::LABEL_TEXT
)
),
sqlite3_column_int(
statement,
DB::APP_BROWSER_MAIN_TAB__SESSION::IS_CURRENT
DB::SESSION::IS_CURRENT
) == 1
);
@ -95,7 +95,7 @@ int Tab::restore() @@ -95,7 +95,7 @@ int Tab::restore()
void Tab::clean() // @TODO menu action?
{
DB::APP_BROWSER_MAIN_TAB__SESSION::clean(
DB::SESSION::clean(
db
);
@ -107,7 +107,7 @@ void Tab::save() @@ -107,7 +107,7 @@ void Tab::save()
char * error; // @TODO
// Delete previous data
DB::APP_BROWSER_MAIN_TAB__SESSION::clean(
DB::SESSION::clean(
db
);
@ -118,7 +118,7 @@ void Tab::save() @@ -118,7 +118,7 @@ void Tab::save()
get_tabPage(
page_number
)->save(
DB::APP_BROWSER_MAIN_TAB__SESSION::add(
DB::SESSION::add(
db,
page_number,
page_number == get_current_page() ? 1 : 0,
@ -333,7 +333,7 @@ tab::Page * Tab::get_tabPage( @@ -333,7 +333,7 @@ tab::Page * Tab::get_tabPage(
}
// Database
int Tab::DB::APP_BROWSER_MAIN_TAB__SESSION::init(
int Tab::DB::SESSION::init(
sqlite3 * db
) {
char * error;
@ -356,7 +356,7 @@ int Tab::DB::APP_BROWSER_MAIN_TAB__SESSION::init( @@ -356,7 +356,7 @@ int Tab::DB::APP_BROWSER_MAIN_TAB__SESSION::init(
);
}
int Tab::DB::APP_BROWSER_MAIN_TAB__SESSION::clean(
int Tab::DB::SESSION::clean(
sqlite3 * db
) {
char * error; // @TODO
@ -379,7 +379,7 @@ int Tab::DB::APP_BROWSER_MAIN_TAB__SESSION::clean( @@ -379,7 +379,7 @@ int Tab::DB::APP_BROWSER_MAIN_TAB__SESSION::clean(
{
const int APP_BROWSER_MAIN_TAB__SESSION_ID = sqlite3_column_int(
statement,
DB::APP_BROWSER_MAIN_TAB__SESSION::ID
DB::SESSION::ID
);
// Delete record
@ -399,7 +399,7 @@ int Tab::DB::APP_BROWSER_MAIN_TAB__SESSION::clean( @@ -399,7 +399,7 @@ int Tab::DB::APP_BROWSER_MAIN_TAB__SESSION::clean(
// Delegate children dependencies cleanup
if (EXEC_STATUS == SQLITE_OK)
{
tab::Page::DB::APP_BROWSER_MAIN_TAB_PAGE__SESSION::clean(
tab::Page::DB::SESSION::clean(
db,
APP_BROWSER_MAIN_TAB__SESSION_ID
);
@ -412,7 +412,7 @@ int Tab::DB::APP_BROWSER_MAIN_TAB__SESSION::clean( @@ -412,7 +412,7 @@ int Tab::DB::APP_BROWSER_MAIN_TAB__SESSION::clean(
);
}
sqlite3_int64 Tab::DB::APP_BROWSER_MAIN_TAB__SESSION::add(
sqlite3_int64 Tab::DB::SESSION::add(
sqlite3 * db,
const int & PAGE_NUMBER,
const bool & IS_CURRENT,

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

@ -27,7 +27,8 @@ namespace app::browser::main @@ -27,7 +27,8 @@ namespace app::browser::main
*/
struct DB
{
struct APP_BROWSER_MAIN_TAB__SESSION
// APP_BROWSER_MAIN_TAB__*
struct SESSION
{
enum
{

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

@ -24,7 +24,7 @@ Page::Page( @@ -24,7 +24,7 @@ Page::Page(
action__refresh = ACTION__REFRESH;
// Init database
DB::APP_BROWSER_MAIN_TAB_PAGE__SESSION::init(
DB::SESSION::init(
this->db = db
);
@ -75,7 +75,7 @@ int Page::save( @@ -75,7 +75,7 @@ int Page::save(
) {
// Delegate save action to child components
return pageNavigation->save(
DB::APP_BROWSER_MAIN_TAB_PAGE__SESSION::add(
DB::SESSION::add(
db,
DB__APP_BROWSER_MAIN_TAB__SESSION_ID,
mime,
@ -365,7 +365,7 @@ void Page::set_navbar_request_text( @@ -365,7 +365,7 @@ void Page::set_navbar_request_text(
}
// Database model
int Page::DB::APP_BROWSER_MAIN_TAB_PAGE__SESSION::init(
int Page::DB::SESSION::init(
sqlite3 * db
) {
char * error;
@ -388,7 +388,7 @@ int Page::DB::APP_BROWSER_MAIN_TAB_PAGE__SESSION::init( @@ -388,7 +388,7 @@ int Page::DB::APP_BROWSER_MAIN_TAB_PAGE__SESSION::init(
);
}
int Page::DB::APP_BROWSER_MAIN_TAB_PAGE__SESSION::clean(
int Page::DB::SESSION::clean(
sqlite3 * db,
const int & DB__APP_BROWSER_MAIN_TAB__SESSION_ID
) {
@ -415,7 +415,7 @@ int Page::DB::APP_BROWSER_MAIN_TAB_PAGE__SESSION::clean( @@ -415,7 +415,7 @@ int Page::DB::APP_BROWSER_MAIN_TAB_PAGE__SESSION::clean(
{
const int APP_BROWSER_MAIN_TAB_PAGE__SESSION_ID = sqlite3_column_int(
statement,
DB::APP_BROWSER_MAIN_TAB_PAGE__SESSION::ID
DB::SESSION::ID
);
// Delete record
@ -435,7 +435,7 @@ int Page::DB::APP_BROWSER_MAIN_TAB_PAGE__SESSION::clean( @@ -435,7 +435,7 @@ int Page::DB::APP_BROWSER_MAIN_TAB_PAGE__SESSION::clean(
// Delegate children dependencies cleanup
if (EXEC_STATUS == SQLITE_OK)
{
page::Navigation::DB::APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__SESSION::clean(
page::Navigation::DB::SESSION::clean(
db,
APP_BROWSER_MAIN_TAB_PAGE__SESSION_ID
);
@ -448,7 +448,7 @@ int Page::DB::APP_BROWSER_MAIN_TAB_PAGE__SESSION::clean( @@ -448,7 +448,7 @@ int Page::DB::APP_BROWSER_MAIN_TAB_PAGE__SESSION::clean(
);
}
sqlite3_int64 Page::DB::APP_BROWSER_MAIN_TAB_PAGE__SESSION::add(
sqlite3_int64 Page::DB::SESSION::add(
sqlite3 * db,
const sqlite3_int64 & DB__APP_BROWSER_MAIN_TAB__SESSION_ID,
const Page::MIME & MIME,

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

@ -42,7 +42,8 @@ namespace app::browser::main::tab @@ -42,7 +42,8 @@ namespace app::browser::main::tab
*/
struct DB
{
struct APP_BROWSER_MAIN_TAB_PAGE__SESSION
// APP_BROWSER_MAIN_TAB_PAGE__*
struct SESSION
{
enum
{

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

@ -15,7 +15,7 @@ Navigation::Navigation( @@ -15,7 +15,7 @@ Navigation::Navigation(
const Glib::RefPtr<Gio::SimpleAction> & ACTION__NAVIGATION_UPDATE
) {
// Init database
DB::APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__SESSION::init(
DB::SESSION::init(
this->db = db
);
@ -112,7 +112,7 @@ int Navigation::save( @@ -112,7 +112,7 @@ int Navigation::save(
const sqlite3_int64 & DB__APP_BROWSER_MAIN_TAB_PAGE__SESSION_ID
) {
return navigationRequest->save(
DB::APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__SESSION::add(
DB::SESSION::add(
db,
DB__APP_BROWSER_MAIN_TAB_PAGE__SESSION_ID
)
@ -203,7 +203,7 @@ void Navigation::set_request_text( @@ -203,7 +203,7 @@ void Navigation::set_request_text(
}
// Database model
int Navigation::DB::APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__SESSION::init(
int Navigation::DB::SESSION::init(
sqlite3 * db
) {
char * error;
@ -223,7 +223,7 @@ int Navigation::DB::APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__SESSION::init( @@ -223,7 +223,7 @@ int Navigation::DB::APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__SESSION::init(
);
}
int Navigation::DB::APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__SESSION::clean(
int Navigation::DB::SESSION::clean(
sqlite3 * db,
const int & DB__APP_BROWSER_MAIN_TAB_PAGE__SESSION_ID
) {
@ -250,7 +250,7 @@ int Navigation::DB::APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__SESSION::clean( @@ -250,7 +250,7 @@ int Navigation::DB::APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__SESSION::clean(
{
const int APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__SESSION_ID = sqlite3_column_int(
statement,
DB::APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__SESSION::ID
DB::SESSION::ID
);
// Delete record
@ -270,7 +270,7 @@ int Navigation::DB::APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__SESSION::clean( @@ -270,7 +270,7 @@ int Navigation::DB::APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__SESSION::clean(
// Delegate children dependencies cleanup
if (EXEC_STATUS == SQLITE_OK)
{
navigation::Request::DB::APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION_REQUEST__SESSION::clean(
navigation::Request::DB::SESSION::clean(
db,
APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__SESSION_ID
);
@ -283,7 +283,7 @@ int Navigation::DB::APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__SESSION::clean( @@ -283,7 +283,7 @@ int Navigation::DB::APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__SESSION::clean(
);
}
sqlite3_int64 Navigation::DB::APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__SESSION::add(
sqlite3_int64 Navigation::DB::SESSION::add(
sqlite3 * db,
const sqlite3_int64 & DB__APP_BROWSER_MAIN_TAB_PAGE__SESSION_ID
) {

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

@ -30,7 +30,8 @@ namespace app::browser::main::tab::page @@ -30,7 +30,8 @@ namespace app::browser::main::tab::page
*/
struct DB
{
struct APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__SESSION
// APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__*
struct SESSION
{
enum
{

15
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::APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION_REQUEST__SESSION::init(
DB::SESSION::init(
this->db = db
);
@ -87,7 +87,7 @@ void Request::refresh( @@ -87,7 +87,7 @@ void Request::refresh(
int Request::save(
const sqlite3_int64 & DB__APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__SESSION_ID
) {
return DB::APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION_REQUEST__SESSION::add(
return DB::SESSION::add(
db,
DB__APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__SESSION_ID,
get_text()
@ -151,7 +151,7 @@ Glib::ustring Request::get_query() @@ -151,7 +151,7 @@ Glib::ustring Request::get_query()
}
// Database model
int Request::DB::APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION_REQUEST__SESSION::init(
int Request::DB::SESSION::init(
sqlite3 * db
) {
char * error;
@ -172,7 +172,7 @@ int Request::DB::APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION_REQUEST__SESSION::init( @@ -172,7 +172,7 @@ int Request::DB::APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION_REQUEST__SESSION::init(
);
}
int Request::DB::APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION_REQUEST__SESSION::clean(
int Request::DB::SESSION::clean(
sqlite3 * db,
const int & DB__APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__SESSION_ID
) {
@ -183,7 +183,8 @@ int Request::DB::APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION_REQUEST__SESSION::clean( @@ -183,7 +183,8 @@ int Request::DB::APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION_REQUEST__SESSION::clean(
db,
Glib::ustring::sprintf(
R"SQL(
SELECT * FROM `app_browser_main_tab_page_navigation_request__session` WHERE `app_browser_main_tab_page_navigation__session_id` = %d
SELECT * FROM `app_browser_main_tab_page_navigation_request__session`
WHERE `app_browser_main_tab_page_navigation__session_id` = %d
)SQL",
DB__APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__SESSION_ID
).c_str(),
@ -199,7 +200,7 @@ int Request::DB::APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION_REQUEST__SESSION::clean( @@ -199,7 +200,7 @@ int Request::DB::APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION_REQUEST__SESSION::clean(
{
const int APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION_REQUEST__SESSION_ID = sqlite3_column_int(
statement,
DB::APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION_REQUEST__SESSION::ID
DB::SESSION::ID
);
// Delete record
@ -229,7 +230,7 @@ int Request::DB::APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION_REQUEST__SESSION::clean( @@ -229,7 +230,7 @@ int Request::DB::APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION_REQUEST__SESSION::clean(
);
}
sqlite3_int64 Request::DB::APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION_REQUEST__SESSION::add(
sqlite3_int64 Request::DB::SESSION::add(
sqlite3 * db,
const sqlite3_int64 & DB__APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__SESSION_ID,
const Glib::ustring & TEXT

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

@ -23,7 +23,8 @@ namespace app::browser::main::tab::page::navigation @@ -23,7 +23,8 @@ namespace app::browser::main::tab::page::navigation
*/
struct DB
{
struct APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION_REQUEST__SESSION
// APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION_REQUEST__*
struct SESSION
{
enum
{

Loading…
Cancel
Save