diff --git a/CMakeLists.txt b/CMakeLists.txt index 6ba97c1..75090d6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,6 +9,7 @@ HunterGate( project(eedb) +set(CMAKE_EXPORT_COMPILE_COMMANDS TRUE) set(HUNTER_BUILD_SHARED_LIBS TRUE) include(cmake/Compiler.cmake) diff --git a/cmake/Compiler.cmake b/cmake/Compiler.cmake index d6c597f..781d8e2 100644 --- a/cmake/Compiler.cmake +++ b/cmake/Compiler.cmake @@ -1 +1 @@ -add_definitions( -std=c++1z ) +add_definitions( -std=c++17 ) diff --git a/src/app/main.cpp b/src/app/main.cpp index 4bff869..a524a4d 100644 --- a/src/app/main.cpp +++ b/src/app/main.cpp @@ -20,7 +20,7 @@ Wt::WApplication * createApplication(const Wt::WEnvironment & env) { using std::unique_ptr; auto dbConfig = make_unique< eedb::db::PgConfig >(env); - // auto dbConnection = make_unique< eedb::db::PgConnection >(move(dbConfig)); + auto dbConnection = make_unique< eedb::db::PgConnection >(move(dbConfig)); // auto session = unique_ptr< eedb::Session >(make_unique< eedb::WebSession >(move(dbConnection), env)); // auto authPageFactory = [_session = session.get()]()->std::unique_ptr< eedb::AuthPage > { diff --git a/src/eedb/EEDB.cpp b/src/eedb/EEDB.cpp index 4cc1519..a3b88e6 100644 --- a/src/eedb/EEDB.cpp +++ b/src/eedb/EEDB.cpp @@ -67,4 +67,4 @@ void EEDB::authEventLogout() { redirect(url()); quit(); } -} +} // namespace eedb diff --git a/src/eedb/EEDB.hpp b/src/eedb/EEDB.hpp index 409fc56..f51cc72 100644 --- a/src/eedb/EEDB.hpp +++ b/src/eedb/EEDB.hpp @@ -35,4 +35,4 @@ class EEDB : public Wt::WApplication { HomePageFactory _homePageFactory; std::unique_ptr< eedb::HomePage > _homePage; }; -} +} // namespace eedb diff --git a/src/eedb/Session.cpp b/src/eedb/Session.cpp index b30e054..974bbdb 100644 --- a/src/eedb/Session.cpp +++ b/src/eedb/Session.cpp @@ -4,8 +4,7 @@ #include namespace eedb { -WebSession::WebSession(std::unique_ptr< eedb::db::PgConnection > dbConnection, - const Wt::WEnvironment & env) +WebSession::WebSession(std::unique_ptr< eedb::db::PgConnection > dbConnection, const Wt::WEnvironment & env) : _dbConnection(std::move(dbConnection)), _env(env) {} db::PgConnection & WebSession::db() { @@ -19,4 +18,4 @@ const Wt::WEnvironment & WebSession::enviroment() const { Wt::Auth::Login & WebSession::login() { return _login; } -} +} // namespace eedb diff --git a/src/eedb/Session.hpp b/src/eedb/Session.hpp index 739df01..df04676 100644 --- a/src/eedb/Session.hpp +++ b/src/eedb/Session.hpp @@ -38,4 +38,4 @@ class WebSession final : public Session { Wt::Auth::Login _login; const Wt::WEnvironment & _env; }; -} +} // namespace eedb diff --git a/src/eedb/auth/PgUserAuth.cpp b/src/eedb/auth/PgUserAuth.cpp index 66c9792..32254d3 100644 --- a/src/eedb/auth/PgUserAuth.cpp +++ b/src/eedb/auth/PgUserAuth.cpp @@ -17,6 +17,7 @@ #include #include #include +#include #include #include @@ -30,15 +31,15 @@ using namespace Wt::Auth; // enum LoginActions { Login, Logout }; // static std::array< std::string_view, 2 > UserActionNames = {{"login", "logout"}}; -std::string RandomString(int len) { +std::string RandomString(uint len) { using namespace std; - srand(time(0)); - string str = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; + srand(static_cast< unsigned int >(time(nullptr))); + experimental::string_view str = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; string newstr; - int pos; + std::size_t pos; while(newstr.size() != len) { - pos = ((rand() % (str.size() - 1))); - newstr += str.substr(pos, 1); + pos = ((rand() % (static_cast< int >(str.size()) - 1))); + newstr += str.substr(pos, 1).to_string(); } return newstr; } @@ -53,8 +54,7 @@ struct TransactionGuard : public Wt::Auth::AbstractUserDatabase::Transaction { _c.native()->commit_transaction(); } void rollback() override { - ///FIXME -// _c.native()->rollback_transaction(); + _c.native()->rollback_transaction(false); } private: @@ -85,8 +85,6 @@ namespace { .limit(1u); } // namespace -PgUserAuth::~PgUserAuth() {} - PgUserAuth::PgUserAuth(eedb::db::PgConnection & _db, const Wt::WEnvironment & env) : db(_db), _env(env) { this->setAuthService(eedb::auth::Services::authService()); } @@ -106,7 +104,7 @@ User PgUserAuth::findWithId(const std::string & id) const { User PgUserAuth::findWithIdentity(const std::string & provider, const Wt::WString & identity) const { auto _identity = identity.toUTF8(); - if(_authService && _authService->identityPolicy() == Wt::Auth::IdentityPolicy::EmailAddress ) { + if(_authService && _authService->identityPolicy() == Wt::Auth::IdentityPolicy::EmailAddress) { std::transform(_identity.begin(), _identity.end(), _identity.begin(), ::tolower); } diff --git a/src/eedb/auth/PgUserAuth.hpp b/src/eedb/auth/PgUserAuth.hpp index 4513f0f..5e07e4e 100644 --- a/src/eedb/auth/PgUserAuth.hpp +++ b/src/eedb/auth/PgUserAuth.hpp @@ -22,7 +22,6 @@ class PgUserAuth : public Wt::Auth::AbstractUserDatabase { _authService = s; } - virtual ~PgUserAuth(); PgUserAuth(eedb::db::PgConnection & db, const Wt::WEnvironment & env); Transaction * startTransaction() override; diff --git a/src/eedb/auth/Services.cpp b/src/eedb/auth/Services.cpp index d17f460..4c0ae19 100644 --- a/src/eedb/auth/Services.cpp +++ b/src/eedb/auth/Services.cpp @@ -18,15 +18,16 @@ namespace { class MyOAuth : public std::vector< const Wt::Auth::OAuthService * > { public: ~MyOAuth() { - for(unsigned i = 0; i < size(); ++i) + for(unsigned i = 0; i < size(); ++i) { delete(*this)[i]; + } } }; Wt::Auth::AuthService myAuthService; Wt::Auth::PasswordService myPasswordService(myAuthService); MyOAuth myOAuthServices; -} +} // namespace namespace eedb::auth { Wt::Auth::AuthService * Services::authService() { @@ -46,7 +47,7 @@ void Services::configureAuth() { myAuthService.setEmailVerificationEnabled(true); myAuthService.setEmailVerificationRequired(true); { - auto verifier = std::unique_ptr(); + auto verifier = std::unique_ptr< Wt::Auth::PasswordVerifier >(); verifier->addHashFunction(std::make_unique< Wt::Auth::BCryptHashFunction >(7)); myPasswordService.setVerifier(std::move(verifier)); } @@ -54,13 +55,16 @@ void Services::configureAuth() { myPasswordService.setAttemptThrottlingEnabled(true); myPasswordService.setStrengthValidator(std::make_unique< Wt::Auth::PasswordStrengthValidator >()); - if(Wt::Auth::GoogleService::configured()) + if(Wt::Auth::GoogleService::configured()) { myOAuthServices.push_back(new Wt::Auth::GoogleService(myAuthService)); + } - if(Wt::Auth::FacebookService::configured()) + if(Wt::Auth::FacebookService::configured()) { myOAuthServices.push_back(new Wt::Auth::FacebookService(myAuthService)); + } - for(unsigned i = 0; i < myOAuthServices.size(); ++i) + for(unsigned i = 0; i < myOAuthServices.size(); ++i) { myOAuthServices[i]->generateRedirectEndpoint(); + } } -}; +} // namespace eedb::auth diff --git a/src/eedb/auth/Services.hpp b/src/eedb/auth/Services.hpp index 6efd62f..34ad723 100644 --- a/src/eedb/auth/Services.hpp +++ b/src/eedb/auth/Services.hpp @@ -19,4 +19,4 @@ class Services { static std::vector< const Wt::Auth::OAuthService * > oAuthServices(); }; -} +} // namespace eedb::auth diff --git a/src/eedb/data/Category.hpp b/src/eedb/data/Category.hpp index af72635..760bc0f 100644 --- a/src/eedb/data/Category.hpp +++ b/src/eedb/data/Category.hpp @@ -4,4 +4,4 @@ namespace eedb { class Category { public: }; -} +} // namespace eedb diff --git a/src/eedb/data/IUserRepository.hpp b/src/eedb/data/IUserRepository.hpp index 107743d..95e39be 100644 --- a/src/eedb/data/IUserRepository.hpp +++ b/src/eedb/data/IUserRepository.hpp @@ -27,4 +27,4 @@ class IUserRepository { virtual void remove(User); }; -} +} // namespace eedb diff --git a/src/eedb/data/PgUser.cpp b/src/eedb/data/PgUser.cpp index ba8fed6..857e868 100644 --- a/src/eedb/data/PgUser.cpp +++ b/src/eedb/data/PgUser.cpp @@ -28,14 +28,13 @@ auto auth = t_user.join(t_info).on(t_user.uid == t_info.user_uid).join(t_identit auto auth_info_identity = t_info.join(t_identity).on(t_info.id == t_identity.auth_info_id); auto user_auth_info = t_user.join(t_info).on(t_info.user_uid == t_user.uid); auto auth_token_info = user_auth_info.join(authToken).on(authToken.auth_info_id == t_info.id); -} +} // namespace namespace eedb { -PgUserIdentity::PgUserIdentity(db::PgConnection & con, int uid, string provider) - : _db(con), _provider(std::move(provider)), _email("") { - select(all_of(t_identity)) // - .from(auth_info_identity) // +PgUserIdentity::PgUserIdentity(db::PgConnection & con, int uid, string provider) : _db(con), _provider(std::move(provider)), _email("") { + select(all_of(t_identity)) // + .from(auth_info_identity) // .where(t_info.user_uid == uid); } @@ -44,18 +43,17 @@ AuthIdentity::string_view PgUserIdentity::identity() const { const auto provider_eq = t_identity.provider == _provider; auto res = _db(select(t_identity.identity) // - .from(auth_info_identity) // + .from(auth_info_identity) // .where(id_eq and provider_eq)); if(res.empty()) return {}; -// _name = res.front().identity; + // _name = res.front().identity; return _name; } - AuthIdentity::string_view PgUserIdentity::provider() const {} const AuthIdentity & PgUser::identity() const {} @@ -69,4 +67,4 @@ void PgUser::changePassword(UserPassword & password) {} void PgUser::login(UserPassword & password) {} void PgUser::logout() {} -} +} // namespace eedb diff --git a/src/eedb/data/PgUser.hpp b/src/eedb/data/PgUser.hpp index a5ba0e2..d1a49b2 100644 --- a/src/eedb/data/PgUser.hpp +++ b/src/eedb/data/PgUser.hpp @@ -15,6 +15,7 @@ class PgUserIdentity : public AuthIdentity { string_view identity() const override; string_view provider() const override; + private: eedb::db::PgConnection & _db; string _name; @@ -34,4 +35,4 @@ class PgUser : public User { void login(UserPassword & password) override; void logout() override; }; -} +} // namespace eedb diff --git a/src/eedb/data/PgUsers.cpp b/src/eedb/data/PgUsers.cpp index 4e13142..b30c091 100644 --- a/src/eedb/data/PgUsers.cpp +++ b/src/eedb/data/PgUsers.cpp @@ -1,8 +1,8 @@ -#include #include +#include -#include #include +#include #include namespace eedb { @@ -10,24 +10,14 @@ namespace eedb { template < typename T > using shared_ptr = PgUsers::shared_ptr< T >; -shared_ptr< User > PgUsers::findWith(int) const { - -} +shared_ptr< User > PgUsers::findWith(int) const {} -shared_ptr< User > PgUsers::findWith(const AuthIdentity & identity) const { - -} +shared_ptr< User > PgUsers::findWith(const AuthIdentity & identity) const {} -shared_ptr< User > PgUsers::findWith(const Email & email) const { - -} +shared_ptr< User > PgUsers::findWith(const Email & email) const {} -shared_ptr< User > PgUsers::findWith(const Users::AuthToken & token) const { - -} +shared_ptr< User > PgUsers::findWith(const Users::AuthToken & token) const {} -shared_ptr< User > PgUsers::addUser(unique_ptr< AuthIdentity >) { - -} +shared_ptr< User > PgUsers::addUser(unique_ptr< AuthIdentity >) {} -} +} // namespace eedb diff --git a/src/eedb/data/PgUsers.hpp b/src/eedb/data/PgUsers.hpp index 67b192e..124f734 100644 --- a/src/eedb/data/PgUsers.hpp +++ b/src/eedb/data/PgUsers.hpp @@ -13,4 +13,4 @@ class PgUsers : public Users { shared_ptr< User > addUser(unique_ptr< AuthIdentity >) override; }; -} +} // namespace eedb diff --git a/src/eedb/data/User.cpp b/src/eedb/data/User.cpp index e1984b8..7a0e8ec 100644 --- a/src/eedb/data/User.cpp +++ b/src/eedb/data/User.cpp @@ -1,7 +1,3 @@ #include "User.hpp" -namespace eedb { - - -} - +namespace eedb {} diff --git a/src/eedb/data/User.hpp b/src/eedb/data/User.hpp index 7fd57da..1f32c05 100644 --- a/src/eedb/data/User.hpp +++ b/src/eedb/data/User.hpp @@ -139,4 +139,4 @@ class User { virtual void login(UserPassword & password) = 0; virtual void logout() = 0; }; -} +} // namespace eedb diff --git a/src/eedb/data/Users.hpp b/src/eedb/data/Users.hpp index 38e23b5..69e4dad 100644 --- a/src/eedb/data/Users.hpp +++ b/src/eedb/data/Users.hpp @@ -27,4 +27,4 @@ class Users { // adds new user into users virtual shared_ptr< User > addUser(unique_ptr< AuthIdentity >) = 0; }; -} +} // namespace eedb diff --git a/src/eedb/db/connection.cpp b/src/eedb/db/connection.cpp index 0b21c8d..c098cd7 100644 --- a/src/eedb/db/connection.cpp +++ b/src/eedb/db/connection.cpp @@ -3,5 +3,6 @@ namespace eedb::db { -PgConnection::PgConnection(std::shared_ptr config) : _conn(std::make_unique< sqlpp::postgresql::connection >(config)) {} -} +PgConnection::PgConnection(std::shared_ptr< eedb::db::PgConfig > config) + : _conn(std::make_unique< sqlpp::postgresql::connection >(config)) {} +} // namespace eedb::db diff --git a/src/eedb/db/connection.hpp b/src/eedb/db/connection.hpp index 16a4c8b..7b9bd3b 100644 --- a/src/eedb/db/connection.hpp +++ b/src/eedb/db/connection.hpp @@ -15,7 +15,7 @@ class PgConnection { return _conn.get(); } - template < typename T > + template < typename T > auto operator()(T && t) { return _conn->operator()(std::forward< T >(t)); } @@ -23,4 +23,4 @@ class PgConnection { private: std::unique_ptr< sqlpp::postgresql::connection > _conn; }; -} +} // namespace eedb::db diff --git a/src/eedb/widgets/AuthPage.hpp b/src/eedb/widgets/AuthPage.hpp index 71ac8f0..4879f3b 100644 --- a/src/eedb/widgets/AuthPage.hpp +++ b/src/eedb/widgets/AuthPage.hpp @@ -21,4 +21,4 @@ class AuthPage { virtual void registerOnUserStrongLogin(std::function< void() > f) = 0; virtual void registerOnUserLogout(std::function< void() > f) = 0; }; -} +} // namespace eedb diff --git a/src/eedb/widgets/BootstrapTheme.cpp b/src/eedb/widgets/BootstrapTheme.cpp index 351eaa0..3a3ea0a 100644 --- a/src/eedb/widgets/BootstrapTheme.cpp +++ b/src/eedb/widgets/BootstrapTheme.cpp @@ -4,12 +4,12 @@ namespace eedb { -std::shared_ptr BootstrapTheme::create() const { - auto theme = std::shared_ptr(); +std::shared_ptr< Wt::WTheme > BootstrapTheme::create() const { + auto theme = std::shared_ptr< Wt::WBootstrapTheme >(); theme->setVersion(Wt::WBootstrapTheme::Version::v3); // theme->setResponsive(true); return theme; } Theme::~Theme() = default; -} +} // namespace eedb diff --git a/src/eedb/widgets/BootstrapTheme.hpp b/src/eedb/widgets/BootstrapTheme.hpp index 6b576b2..f085895 100644 --- a/src/eedb/widgets/BootstrapTheme.hpp +++ b/src/eedb/widgets/BootstrapTheme.hpp @@ -11,4 +11,4 @@ class BootstrapTheme final : public Theme { std::shared_ptr< Wt::WTheme > create() const override; }; -} +} // namespace eedb diff --git a/src/eedb/widgets/CategoryThree.hpp b/src/eedb/widgets/CategoryThree.hpp index 3bc0e4f..5f51c18 100644 --- a/src/eedb/widgets/CategoryThree.hpp +++ b/src/eedb/widgets/CategoryThree.hpp @@ -18,4 +18,4 @@ class CategoriesTree { virtual void registerOnCategoryChanged(std::function< void(const Category &) >) = 0; }; -} +} // namespace eedb diff --git a/src/eedb/widgets/DefaultAuthPage.cpp b/src/eedb/widgets/DefaultAuthPage.cpp index e766089..ba5480c 100644 --- a/src/eedb/widgets/DefaultAuthPage.cpp +++ b/src/eedb/widgets/DefaultAuthPage.cpp @@ -11,8 +11,9 @@ namespace std { template <> struct default_delete< Wt::Auth::AuthWidget > { void operator()(Wt::Auth::AuthWidget * ptr) { - if(ptr && !ptr->parent()) + if(ptr && !ptr->parent()) { delete ptr; + } } }; } // namespace std @@ -23,7 +24,7 @@ struct DefaultAuthPage::DefaultAuthPagePriv { DefaultAuthPagePriv(const auth::Services & baseAuth, std::unique_ptr< Wt::Auth::AbstractUserDatabase > userDatabase, Wt::Auth::Login & _login) - : _authWidget(std::make_unique< Wt::Auth::AuthWidget >(*baseAuth.authService(), *userDatabase.get(), _login)), + : _authWidget(std::make_unique< Wt::Auth::AuthWidget >(*baseAuth.authService(), *userDatabase, _login)), _userDatabase(std::move(userDatabase)) { _authWidget->model()->addPasswordAuth(eedb::auth::Services::passwordService()); _authWidget->model()->addOAuth(eedb::auth::Services::oAuthServices()); @@ -43,18 +44,18 @@ DefaultAuthPage::DefaultAuthPage(const auth::Services & baseAuth, std::unique_ptr< Wt::Auth::AbstractUserDatabase > userDatabase, Wt::Auth::Login & _login) : _priv(std::make_unique< DefaultAuthPagePriv >(baseAuth, std::move(userDatabase), _login)) { -///FIXME + /// FIXME // _priv->_authWidget->login().changed().connect([this](auto...) { -// if(_priv->_authWidget->login().state() == Wt::Auth::LoginState::Strong) { -// this->notifyUserStrongLogin(); -// } else if(_priv->_authWidget->login().state() == Wt::Auth::LoginState::Weak) { -// this->notifyUserWeakLogin(); -// } else if(_priv->_authWidget->login().state() == Wt::Auth::LoginState::Disabled) { -// this->notifyNeedEmailVerification(); -// } else { -// this->notifyUserLogout(); -// } -// }); + // if(_priv->_authWidget->login().state() == Wt::Auth::LoginState::Strong) { + // this->notifyUserStrongLogin(); + // } else if(_priv->_authWidget->login().state() == Wt::Auth::LoginState::Weak) { + // this->notifyUserWeakLogin(); + // } else if(_priv->_authWidget->login().state() == Wt::Auth::LoginState::Disabled) { + // this->notifyNeedEmailVerification(); + // } else { + // this->notifyUserLogout(); + // } + // }); } DefaultAuthPage::DefaultAuthPage(DefaultAuthPage && rhs) : _priv(std::move(rhs._priv)) {} @@ -64,15 +65,15 @@ DefaultAuthPage & DefaultAuthPage::operator=(DefaultAuthPage && rhs) { return *this; } -DefaultAuthPage::~DefaultAuthPage() = default; void DefaultAuthPage::attachTo(Wt::WContainerWidget * parent) { parent->addWidget(std::move(_priv->_authWidget)); } void DefaultAuthPage::detach() { auto parent = dynamic_cast< Wt::WContainerWidget * >(_priv->_authWidget->parent()); - if(parent) + if(parent) { parent->removeWidget(_priv->_authWidget.get()); + } } void DefaultAuthPage::processEnvironment() { diff --git a/src/eedb/widgets/DefaultAuthPage.hpp b/src/eedb/widgets/DefaultAuthPage.hpp index 5d269d6..a63f311 100644 --- a/src/eedb/widgets/DefaultAuthPage.hpp +++ b/src/eedb/widgets/DefaultAuthPage.hpp @@ -7,7 +7,7 @@ namespace Wt::Auth { class AbstractUserDatabase; class Login; -} +} // namespace Wt::Auth namespace eedb::auth { class Services; @@ -27,7 +27,6 @@ class DefaultAuthPage final : public AuthPage { DefaultAuthPage & operator=(DefaultAuthPage &&); // clang-format on - ~DefaultAuthPage(); void attachTo(Wt::WContainerWidget * parent) override; void detach() override; void processEnvironment() override; @@ -47,4 +46,4 @@ class DefaultAuthPage final : public AuthPage { struct DefaultAuthPagePriv; std::unique_ptr< DefaultAuthPagePriv > _priv; }; -} +} // namespace eedb diff --git a/src/eedb/widgets/DefaultCategoryTree.cpp b/src/eedb/widgets/DefaultCategoryTree.cpp index b116baf..0f38dfd 100644 --- a/src/eedb/widgets/DefaultCategoryTree.cpp +++ b/src/eedb/widgets/DefaultCategoryTree.cpp @@ -7,14 +7,16 @@ namespace std { +/// TODO remove template <> struct default_delete< Wt::WTreeView > { void operator()(Wt::WTreeView * ptr) { - if(ptr && !ptr->parent()) + if(ptr && !ptr->parent()) { delete ptr; + } } }; -} +} // namespace std namespace eedb { @@ -34,4 +36,4 @@ void DefaultCategoriesTree::attachTo(Wt::WContainerWidget * parent) { } void DefaultCategoriesTree::registerOnCategoryChanged(std::function< void(const Category &) >) {} -} +} // namespace eedb diff --git a/src/eedb/widgets/DefaultCategoryTree.hpp b/src/eedb/widgets/DefaultCategoryTree.hpp index 6321268..fd5da34 100644 --- a/src/eedb/widgets/DefaultCategoryTree.hpp +++ b/src/eedb/widgets/DefaultCategoryTree.hpp @@ -10,7 +10,7 @@ class DefaultCategoriesTree final : public CategoriesTree { // CategoriesTree interface public: DefaultCategoriesTree(); - ~DefaultCategoriesTree(); + ~DefaultCategoriesTree() override; DefaultCategoriesTree(const DefaultCategoriesTree &) = delete; DefaultCategoriesTree(DefaultCategoriesTree &&); @@ -28,4 +28,4 @@ class DefaultCategoriesTree final : public CategoriesTree { struct DefaultCategoriesTreePriv; std::unique_ptr< DefaultCategoriesTreePriv > _priv; }; -} +} // namespace eedb diff --git a/src/eedb/widgets/DefaultHomePage.hpp b/src/eedb/widgets/DefaultHomePage.hpp index 1cfb08c..011461f 100644 --- a/src/eedb/widgets/DefaultHomePage.hpp +++ b/src/eedb/widgets/DefaultHomePage.hpp @@ -8,7 +8,7 @@ namespace Wt { class WContainerWidget; class WTreeView; class WNavigationBar; -} +} // namespace Wt namespace eedb { class Session; @@ -17,7 +17,7 @@ class NavigationBar; class DefaultHomePage final : public HomePage { public: DefaultHomePage(Session & session, std::unique_ptr< NavigationBar > navigationBar); - ~DefaultHomePage(); + ~DefaultHomePage() override; void attachTo(Wt::WContainerWidget * parent) override; @@ -28,4 +28,4 @@ class DefaultHomePage final : public HomePage { std::unique_ptr< NavigationBar > _navigationBar; Wt::WTreeView * _categoryTree; }; -} +} // namespace eedb diff --git a/src/eedb/widgets/DefaultNavigationBar.cpp b/src/eedb/widgets/DefaultNavigationBar.cpp index 431e36b..cbddc96 100644 --- a/src/eedb/widgets/DefaultNavigationBar.cpp +++ b/src/eedb/widgets/DefaultNavigationBar.cpp @@ -17,8 +17,8 @@ struct DefaultNavigationBar::DefaultNavigationBarPriv { auto mainTabs = std::make_unique< Wt::WMenu >(); auto homeItem = mainTabs->addItem("Home"); homeItem->setObjectName("navigation_bar.home_menu"); - ///FIXME -// homeItem->triggered().connect([=](auto...) {}); + /// FIXME + // homeItem->triggered().connect([=](auto...) {}); // Setup a Right-aligned menu. // Create a popup submenu for the Help menu. diff --git a/src/eedb/widgets/DefaultNavigationBar.hpp b/src/eedb/widgets/DefaultNavigationBar.hpp index 6f97dff..35f464a 100644 --- a/src/eedb/widgets/DefaultNavigationBar.hpp +++ b/src/eedb/widgets/DefaultNavigationBar.hpp @@ -5,7 +5,7 @@ namespace Wt::Auth { class AbstractUserDatabase; class Login; -} +} // namespace Wt::Auth namespace eedb { class DefaultNavigationBar final : public NavigationBar { @@ -19,7 +19,7 @@ class DefaultNavigationBar final : public NavigationBar { DefaultNavigationBar & operator=(const DefaultNavigationBar &) = delete; DefaultNavigationBar & operator=(DefaultNavigationBar &&); // clang-format on - ~DefaultNavigationBar(); + ~DefaultNavigationBar() override; void attachTo(Wt::WContainerWidget * parent) override; void detach() override; @@ -30,4 +30,4 @@ class DefaultNavigationBar final : public NavigationBar { struct DefaultNavigationBarPriv; std::unique_ptr< DefaultNavigationBarPriv > _priv; }; -} +} // namespace eedb diff --git a/src/eedb/widgets/HomePage.hpp b/src/eedb/widgets/HomePage.hpp index 3744118..e9bddb0 100644 --- a/src/eedb/widgets/HomePage.hpp +++ b/src/eedb/widgets/HomePage.hpp @@ -4,7 +4,6 @@ namespace Wt { class WContainerWidget; } - namespace eedb { class HomePage { @@ -14,4 +13,4 @@ class HomePage { virtual void attachTo(Wt::WContainerWidget * parent) = 0; }; -} +} // namespace eedb diff --git a/src/eedb/widgets/MenuTree.cpp b/src/eedb/widgets/MenuTree.cpp index 0b84066..7fa246a 100644 --- a/src/eedb/widgets/MenuTree.cpp +++ b/src/eedb/widgets/MenuTree.cpp @@ -10,7 +10,7 @@ void eedb::MenuTree::createTree() { using namespace eedb::db; -// using namespace sqlpp; + // using namespace sqlpp; Wt::WTree * tree = new Wt::WTree(); @@ -23,14 +23,14 @@ void eedb::MenuTree::createTree() { tree->setTreeRoot(std::move(node)); node->label()->setTextFormat(Wt::TextFormat::Plain); node->setLoadPolicy(Wt::ContentLoading::Lazy); -///FIXME -// const eedb::category cat; + /// FIXME + // const eedb::category cat; -// auto r = _db(sqlpp::select(sqlpp::all_of(cat)).from(cat).where(cat.parent_path < 'root')); + // auto r = _db(sqlpp::select(sqlpp::all_of(cat)).from(cat).where(cat.parent_path < 'root')); -// for(const auto & row : r) { -// node->addChildNode(new Wt::WTreeNode(row.Name)); -// } + // for(const auto & row : r) { + // node->addChildNode(new Wt::WTreeNode(row.Name)); + // } // if (_db.is_open()){ // auto sql = "SELECT * FROM category WHERE parent_path <@ 'root'"; diff --git a/src/eedb/widgets/MenuTree.hpp b/src/eedb/widgets/MenuTree.hpp index 85d661d..1c50f24 100644 --- a/src/eedb/widgets/MenuTree.hpp +++ b/src/eedb/widgets/MenuTree.hpp @@ -9,16 +9,13 @@ namespace eedb::db { class PgConnection; } - namespace eedb { -class MenuTree{ -public: - MenuTree(db::PgConnection & con): - _db(con) - {} +class MenuTree { + public: + MenuTree(db::PgConnection & con) : _db(con) {} -private: + private: void createTree(); eedb::db::PgConnection & _db; }; -} +} // namespace eedb diff --git a/src/eedb/widgets/NavigationBar.hpp b/src/eedb/widgets/NavigationBar.hpp index 976cbcb..63e50f6 100644 --- a/src/eedb/widgets/NavigationBar.hpp +++ b/src/eedb/widgets/NavigationBar.hpp @@ -12,9 +12,9 @@ class NavigationBar { public: virtual ~NavigationBar() = default; - virtual void attachTo(Wt::WContainerWidget * parent) = 0; - virtual void detach() = 0; + virtual void attachTo(Wt::WContainerWidget * parent) = 0; + virtual void detach() = 0; virtual void registerLogoutAction(std::function< void() > f) = 0; }; -} +} // namespace eedb diff --git a/src/eedb/widgets/Theme.hpp b/src/eedb/widgets/Theme.hpp index d93969e..0143d53 100644 --- a/src/eedb/widgets/Theme.hpp +++ b/src/eedb/widgets/Theme.hpp @@ -14,8 +14,7 @@ class Theme { virtual ~Theme(); - virtual std::shared_ptr create() const = 0; + virtual std::shared_ptr< Wt::WTheme > create() const = 0; }; - -} +} // namespace eedb