From 3f06b44e253535b46ce58dce1c98d45ada751812 Mon Sep 17 00:00:00 2001 From: sha512sum Date: Thu, 29 Aug 2024 16:42:58 +0000 Subject: [PATCH] Switch to headers + .cpp files --- CMakeLists.txt | 51 +++--- include/larra/application.hpp | 28 ++++ include/larra/main_window.hpp | 14 ++ library/include/larra/jid.hpp | 74 +++++++++ library/include/larra/stream.hpp | 50 ++++++ .../include/larra/utils.hpp | 19 +-- library/src/jid.cpp | 80 ++++++++++ library/src/library.cpp | 0 src/application.cpp | 67 ++++---- src/application_impl.cpp | 16 -- src/lib/jid.cpp | 147 ------------------ src/lib/library.cpp | 3 - src/main.cpp | 3 +- src/main_window.cpp | 27 ++-- tests/jid.cpp | 4 +- tests/set.cpp | 5 +- 16 files changed, 322 insertions(+), 266 deletions(-) create mode 100644 include/larra/application.hpp create mode 100644 include/larra/main_window.hpp create mode 100644 library/include/larra/jid.hpp create mode 100644 library/include/larra/stream.hpp rename src/lib/utils.cpp => library/include/larra/utils.hpp (95%) create mode 100644 library/src/jid.cpp create mode 100644 library/src/library.cpp delete mode 100644 src/application_impl.cpp delete mode 100644 src/lib/jid.cpp delete mode 100644 src/lib/library.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 1fce9b8..fbfce66 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,11 +1,5 @@ cmake_minimum_required(VERSION 3.30) -set(CMAKE_EXPERIMENTAL_CXX_IMPORT_STD - # This specific value changes as experimental support evolves. See - # `Help/dev/experimental.rst` in the CMake source corresponding to - # your CMake build for the exact value to use. - "0e5b6991-d74f-4b3d-a41c-cf096e0b2508") - project(larra VERSION 0.1 LANGUAGES CXX) @@ -14,20 +8,15 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON) set(CMAKE_CXX_STANDARD 23) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) -set(FMT_MODULE ON) +set(FMT_MODULE OFF) +set(UTEMPL_MODULE OFF) set(CXX_EXTENSIONS NO) set(BOOST_INCLUDE_LIBRARIES "pfr;asio") option(CPM_USE_LOCAL_PACKAGES "Use local packages" ON) -file(GLOB_RECURSE LIB_SOURCES "src/lib/*.cpp") +file(GLOB_RECURSE LIB_SOURCES "library/src/*.cpp") file(GLOB_RECURSE SOURCES "src/*.cpp") -file(GLOB_RECURSE IMPL_SOURCES "src/*_impl.cpp") -file(GLOB_RECURSE LIB_IMPL_SOURCES "src/lib/*_impl.cpp") -list(REMOVE_ITEM LIB_SOURCES ${LIB_IMPL_SOURCES}) -list(REMOVE_ITEM SOURCES ${IMPL_SOURCES} ${LIB_SOURCES}) -set(CMAKE_CXX_MODULE_STD 1) -set_target_properties(__cmake_cxx23 PROPERTIES CXX_EXTENSIONS OFF) file( DOWNLOAD @@ -58,21 +47,19 @@ CPMAddPackage( CPMAddPackage("gh:zeux/pugixml@1.14") +CPMAddPackage("gh:fmtlib/fmt#11.0.2") + set(TMP ${CPM_USE_LOCAL_PACKAGES}) set(CPM_USE_LOCAL_PACKAGES OFF) - -CPMAddPackage("gh:fmtlib/fmt#11.0.2") - -set(CPM_USE_LOCAL_PACKAGES ${TMP}) - CPMAddPackage( NAME utempl URL "https://github.com/linuxnyasha/utempl/archive/refs/heads/main.zip" EXCLUDE_FROM_ALL ON OPTIONS "ENABLE_TESTS OFF" "ENABLE_EXAMPLES OFF" ) +set(CPM_USE_LOCAL_PACKAGES ${TMP}) @@ -87,12 +74,13 @@ add_library(larra_xmpp) add_library(larra::larra_xmpp ALIAS larra_xmpp) -target_compile_features(larra_xmpp INTERFACE cxx_std_23) +target_compile_features(larra_xmpp PUBLIC cxx_std_23) -target_sources(larra_xmpp PUBLIC FILE_SET larraXMPPSet TYPE CXX_MODULES - FILES ${LIB_SOURCES}) +target_sources(larra_xmpp PRIVATE ${LIB_SOURCES}) -target_sources(larra_xmpp PUBLIC ${LIB_IMPL_SOURCES}) +target_include_directories(larra_xmpp PUBLIC + $ + $) install(TARGETS larra_xmpp @@ -121,10 +109,13 @@ target_compile_features(larra INTERFACE cxx_std_23) target_link_libraries(larra larra_xmpp ${GTKMM_LIBRARIES} ${GTKMM_LIBRARIES}) -target_sources(larra PUBLIC FILE_SET larraSet TYPE CXX_MODULES - FILES ${SOURCES}) +target_include_directories(larra PRIVATE + $ + $) + +target_sources(larra PRIVATE ${SOURCES}) + -target_sources(larra PUBLIC ${IMPL_SOURCES}) install(TARGETS larra RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} @@ -158,12 +149,14 @@ install(EXPORT larraXMPPTargets if(ENABLE_TESTS) - find_package(GTest REQUIRED) + CPMAddPackage( + NAME GTest + URL https://github.com/google/googletest/archive/03597a01ee50ed33e9dfd640b249b4be3799d395.zip + ) enable_testing() file(GLOB_RECURSE SOURCES "tests/*.cpp" ) add_executable(larra_xmpp_tests) - target_sources(larra_xmpp_tests PUBLIC FILE_SET tests TYPE CXX_MODULES - FILES ${SOURCES}) + target_sources(larra_xmpp_tests PUBLIC ${SOURCES}) target_link_libraries(larra_xmpp_tests GTest::gtest_main larra_xmpp) set_property(TARGET larra_xmpp_tests PROPERTY CXX_STANDARD 23) diff --git a/include/larra/application.hpp b/include/larra/application.hpp new file mode 100644 index 0000000..c8d3102 --- /dev/null +++ b/include/larra/application.hpp @@ -0,0 +1,28 @@ +#pragma once +#include + +#include + +namespace larra { + +struct Application : Gtk::Application { + Application() : Gtk::Application("org.larra.larra") { + Glib::set_application_name("Larra"); + } + static auto create() -> Glib::RefPtr; + auto on_startup() -> void final; + + auto on_activate() -> void final; + + private: + auto OnClickPreferences() -> void { + } + + auto OnClickManageAccounts() -> void { + } + + auto OnClickAbout() -> void { + } +}; + +} // namespace larra diff --git a/include/larra/main_window.hpp b/include/larra/main_window.hpp new file mode 100644 index 0000000..f5be2e8 --- /dev/null +++ b/include/larra/main_window.hpp @@ -0,0 +1,14 @@ +#pragma once +#include + +#include + +namespace larra { + +struct MainWindow : Gtk::ApplicationWindow { + Gtk::Box main; + Application& app; + MainWindow(Application& app); +}; + +} // namespace larra diff --git a/library/include/larra/jid.hpp b/library/include/larra/jid.hpp new file mode 100644 index 0000000..10ce152 --- /dev/null +++ b/library/include/larra/jid.hpp @@ -0,0 +1,74 @@ +#pragma once +#include +#include +#include +#include + +namespace larra::xmpp { + +struct BareJid { + std::string username; + std::string server; + [[nodiscard]] static auto Parse(std::string_view jid) -> BareJid; + friend auto ToString(const BareJid& jid) -> std::string; + + template + [[nodiscard]] auto Username(this Self&& self, std::string username) -> BareJid { + return utils::FieldSetHelper::With<"username">(std::forward(self), std::move(username)); + } + + template + [[nodiscard]] auto Server(this Self&& self, std::string server) -> BareJid { + return utils::FieldSetHelper::With<"server">(std::forward(self), std::move(server)); + } +}; + +struct BareResourceJid { + std::string server; + std::string resource; + [[nodiscard]] static auto Parse(std::string_view jid) -> BareResourceJid; + friend auto ToString(const BareResourceJid& jid) -> std::string; + + template + [[nodiscard]] auto Server(this Self&& self, std::string server) -> BareResourceJid { + return utils::FieldSetHelper::With<"server">(std::forward(self), std::move(server)); + } + + template + [[nodiscard]] auto Resource(this Self&& self, std::string resource) -> BareResourceJid { + return utils::FieldSetHelper::With<"resource">(std::forward(self), std::move(resource)); + } +}; + +struct FullJid { + std::string username; + std::string server; + std::string resource; + [[nodiscard]] static auto Parse(std::string_view jid) -> FullJid; + friend auto ToString(const FullJid& jid) -> std::string; + + template + [[nodiscard]] auto Username(this Self&& self, std::string username) -> FullJid { + return utils::FieldSetHelper::With<"username">(std::forward(self), std::move(username)); + }; + + template + [[nodiscard]] auto Server(this Self&& self, std::string server) -> FullJid { + return utils::FieldSetHelper::With<"server">(std::forward(self), std::move(server)); + }; + + template + [[nodiscard]] auto Resource(this Self&& self, std::string resource) -> FullJid { + return utils::FieldSetHelper::With<"resource">(std::forward(self), std::move(resource)); + }; +}; + +using JidVariant = std::variant; + +struct Jid : JidVariant { + using JidVariant::variant; + [[nodiscard]] static auto Parse(std::string_view jid) -> Jid; + friend auto ToString(const Jid& jid) -> std::string; +}; + +} // namespace larra::xmpp diff --git a/library/include/larra/stream.hpp b/library/include/larra/stream.hpp new file mode 100644 index 0000000..e1d9d9a --- /dev/null +++ b/library/include/larra/stream.hpp @@ -0,0 +1,50 @@ +module; +c export module larra.library.stream; +export import larra.library.jid; +import larra.library.utils; +import std; + +namespace larra::xmpp { + +export struct Stream { + std::optional from; + std::optional to; + std::optional id; + std::optional version; + std::optional xmlLang; + + template + constexpr auto From(this Self&& self, BareJid value) { + return utils::FieldSetHelper::With<"from">(std::forward(self), std::move(value)); + }; + + template + constexpr auto To(this Self&& self, BareJid value) { + return utils::FieldSetHelper::With<"to">(std::forward(self), std::move(value)); + }; + + template + constexpr auto Id(this Self&& self, std::string value) { + return utils::FieldSetHelper::With<"id">(std::forward(self), std::move(value)); + }; + + template + constexpr auto Version(this Self&& self, std::string value) { + return utils::FieldSetHelper::With<"version">(std::forward(self), std::move(value)); + }; + + template + constexpr auto XmlLang(this Self&& self, std::string value) { + return utils::FieldSetHelper::With<"xmlLang">(std::forward(self), std::move(value)); + }; + + constexpr Stream(BareJid to) : to(std::move(to)), version("1.0") {}; + friend auto operator<<(pugi::xml_node& node, const Stream& stream) { + if(stream.from) { + auto str = ToString(*stream.from); + node.append_attribute("from") = str.c_str(); + }; + }; +}; + +} // namespace larra::xmpp diff --git a/src/lib/utils.cpp b/library/include/larra/utils.hpp similarity index 95% rename from src/lib/utils.cpp rename to library/include/larra/utils.hpp index 51d6933..59a5081 100644 --- a/src/lib/utils.cpp +++ b/library/include/larra/utils.hpp @@ -1,8 +1,5 @@ -module; #include -export module larra.library.utils; -import std; -import utempl; +#include namespace larra::xmpp::utils { @@ -25,7 +22,7 @@ constexpr auto GetType(R(T::* ptr)) -> R; // return kUtils.With(&SomeStruct::field2, std::forward(self), std::move(field2)); // With field2 // } // }; -export template +template struct FieldsDescription { utempl::Tuple tuple; /*!< tuple for field ptrs */ /* Method accepting field index, self and new value for field and returns object with new field value @@ -80,20 +77,24 @@ struct FieldsDescription { }; }; +namespace impl { + template consteval auto CreateFieldsDescriptionHelper(Fs&&... fs) -> FieldsDescription...> { return {.tuple = {std::forward(fs)...}}; -}; +} + +} // namespace impl /* Method accepting field ptrs and returns FieldsDescription * * \param ptrs field ptrs * \return FieldsDescription with T and ptrs */ -export template +template consteval auto CreateFieldsDescription(Rs(T::*... ptrs)) { return [&](auto... is) { - return CreateFieldsDescriptionHelper(ptrs...); + return impl::CreateFieldsDescriptionHelper(ptrs...); } | utempl::kSeq; }; @@ -113,7 +114,7 @@ consteval auto CreateFieldsDescription(Rs(T::*... ptrs)) { // } // }; -export struct FieldSetHelper { +struct FieldSetHelper { /* Method accepting field index, self and new value for field and returns object with new field value * * \param I field index for object T diff --git a/library/src/jid.cpp b/library/src/jid.cpp new file mode 100644 index 0000000..f9ca838 --- /dev/null +++ b/library/src/jid.cpp @@ -0,0 +1,80 @@ +#include +#include + +namespace larra::xmpp { + +auto ParseBareJid(std::string_view jid, std::size_t at) -> BareJid { + return {static_cast(jid.substr(0, at)), static_cast(jid.substr(at + 1))}; +} + +auto ParseBareResourceJid(std::string_view jid, std::size_t slash) -> BareResourceJid { + return {static_cast(jid.substr(0, slash)), static_cast(jid.substr(slash + 1))}; +} + +auto ParseFullJid(std::string_view jid, std::size_t at, std::size_t slash) -> FullJid { + return {static_cast(jid.substr(0, at)), + static_cast(jid.substr(at + 1, slash - at - 1)), + static_cast(jid.substr(slash + 1))}; +} + +auto BareJid::Parse(std::string_view jid) -> BareJid { + const auto at = jid.find('@'); + if(at == std::string_view::npos) { + throw std::invalid_argument("Invalid string for jid"); + } + + return ParseBareJid(jid, at); +} + +auto BareResourceJid::Parse(std::string_view jid) -> BareResourceJid { + const auto slash = jid.find('/'); + if(slash == std::string_view::npos) { + throw std::invalid_argument("Invalid string for jid"); + } + + return ParseBareResourceJid(jid, slash); +} + +auto FullJid::Parse(std::string_view jid) -> FullJid { + const auto at = jid.find('@'); + const auto slash = jid.find('/', at); + if(at == std::string_view::npos || slash == std::string_view::npos) { + throw std::invalid_argument("Invalid string for jid"); + } + + return ParseFullJid(jid, at, slash); +} + +auto Jid::Parse(std::string_view jid) -> Jid { + const auto at = jid.find('@'); + const auto slash = jid.find('/', at == std::string_view::npos ? 0 : at); + if(at == std::string_view::npos) { + return ParseBareResourceJid(jid, slash); + } + if(slash == std::string_view::npos) { + return ParseBareJid(jid, at); + } + return ParseFullJid(jid, at, slash); +} + +auto ToString(const BareJid& jid) -> std::string { + return std::format("{}@{}", jid.username, jid.server); +} + +auto ToString(const BareResourceJid& jid) -> std::string { + return std::format("{}/{}", jid.server, jid.resource); +} + +auto ToString(const FullJid& jid) -> std::string { + return std::format("{}@{}/{}", jid.username, jid.server, jid.resource); +} + +auto ToString(const Jid& jid) -> std::string { + return std::visit( + [](const auto& jid) -> std::string { + return ToString(jid); + }, + jid); +} + +} // namespace larra::xmpp diff --git a/library/src/library.cpp b/library/src/library.cpp new file mode 100644 index 0000000..e69de29 diff --git a/src/application.cpp b/src/application.cpp index 6a57c41..d361d07 100644 --- a/src/application.cpp +++ b/src/application.cpp @@ -1,47 +1,40 @@ -module; -#include - -#include -export module larra.application; +#include +#include namespace larra { -export struct Application : Gtk::Application { - Application() : Gtk::Application("org.larra.larra") { - Glib::set_application_name("Larra"); - } - static auto create() -> Glib::RefPtr { - return Glib::make_refptr_for_instance(new Application{}); // NOLINT - } - auto on_startup() -> void final { - this->Gtk::Application::on_startup(); - this->add_action("preferences", sigc::mem_fun(*this, &Application::OnClickPreferences)); - this->add_action("accounts", sigc::mem_fun(*this, &Application::OnClickManageAccounts)); - this->add_action("about", sigc::mem_fun(*this, &Application::OnClickAbout)); +auto Application::on_activate() -> void { + auto win = new MainWindow{*this}; // NOLINT + this->add_window(*win); + win->signal_hide().connect([win] { + delete win; // NOLINT + }); + win->set_show_menubar(); + win->set_visible(true); +} - auto gmenu = Gio::Menu::create(); - auto larraMenu = Gio::Menu::create(); - larraMenu->append("Preferences", "app.preferences"); - auto accountsMenu = Gio::Menu::create(); - accountsMenu->append("Manage accounts", "app.accounts"); - auto helpMenu = Gio::Menu::create(); - helpMenu->append("About", "app.about"); +auto Application::on_startup() -> void { + this->Gtk::Application::on_startup(); + this->add_action("preferences", sigc::mem_fun(*this, &Application::OnClickPreferences)); + this->add_action("accounts", sigc::mem_fun(*this, &Application::OnClickManageAccounts)); + this->add_action("about", sigc::mem_fun(*this, &Application::OnClickAbout)); - gmenu->append_submenu("Larra", larraMenu); - gmenu->append_submenu("Accounts", accountsMenu); - gmenu->append_submenu("Help", helpMenu); - this->set_menubar(gmenu); - } + auto gmenu = Gio::Menu::create(); + auto larraMenu = Gio::Menu::create(); + larraMenu->append("Preferences", "app.preferences"); + auto accountsMenu = Gio::Menu::create(); + accountsMenu->append("Manage accounts", "app.accounts"); + auto helpMenu = Gio::Menu::create(); + helpMenu->append("About", "app.about"); - auto on_activate() -> void final; + gmenu->append_submenu("Larra", larraMenu); + gmenu->append_submenu("Accounts", accountsMenu); + gmenu->append_submenu("Help", helpMenu); + this->set_menubar(gmenu); +}; - auto OnClickPreferences() -> void { - } - - auto OnClickManageAccounts() -> void { - } - - auto OnClickAbout() -> void {}; +auto Application::create() -> Glib::RefPtr { + return Glib::make_refptr_for_instance(new Application{}); // NOLINT }; } // namespace larra diff --git a/src/application_impl.cpp b/src/application_impl.cpp deleted file mode 100644 index 0d8cf16..0000000 --- a/src/application_impl.cpp +++ /dev/null @@ -1,16 +0,0 @@ -module larra.application; -import larra.main_window; - -namespace larra { - -auto Application::on_activate() -> void { - auto win = new MainWindow{*this}; // NOLINT - this->add_window(*win); - win->signal_hide().connect([win] { - delete win; // NOLINT - }); - win->set_show_menubar(); - win->set_visible(true); -} - -} // namespace larra diff --git a/src/lib/jid.cpp b/src/lib/jid.cpp deleted file mode 100644 index 4d06fc7..0000000 --- a/src/lib/jid.cpp +++ /dev/null @@ -1,147 +0,0 @@ -export module larra.library.jid; -import std; -import fmt; - -namespace larra::xmpp { - -export struct BareJid; - -auto ParseBareJid(std::string_view, std::size_t) -> BareJid; - -export struct BareJid { - std::string username; - std::string server; - - [[nodiscard]] friend auto ToString(const BareJid& jid) -> std::string { - return std::format("{}@{}", jid.username, jid.server); - } - - template - [[nodiscard]] auto Username(this Self&& self, std::string username) -> BareJid { - return {std::move(username), std::forward_like(self.resource)}; - } - - template - [[nodiscard]] auto Server(this Self&& self, std::string server) -> BareJid { - return {std::forward_like(self.server), std::move(server)}; - } - - [[nodiscard]] static auto Parse(std::string_view jid) -> BareJid { - const auto at = jid.find('@'); - if(at == std::string_view::npos) { - throw std::invalid_argument("Invalid string for jid"); - } - - return ParseBareJid(jid, at); - } -}; - -auto ParseBareJid(std::string_view jid, std::size_t at) -> BareJid { - return {static_cast(jid.substr(0, at)), static_cast(jid.substr(at + 1))}; -} - -export struct BareResourceJid; - -auto ParseBareResourceJid(std::string_view, std::size_t) -> BareResourceJid; - -export struct BareResourceJid { - std::string server; - std::string resource; - - [[nodiscard]] friend auto ToString(const BareResourceJid& jid) -> std::string { - return std::format("{}/{}", jid.server, jid.resource); - }; - - template - [[nodiscard]] auto Server(this Self&& self, std::string server) -> BareResourceJid { - return {std::move(server), std::forward_like(self.resource)}; - }; - - template - [[nodiscard]] auto Resource(this Self&& self, std::string resource) -> BareResourceJid { - return {std::forward_like(self.server), std::move(resource)}; - }; - - [[nodiscard]] static auto Parse(std::string_view jid) -> BareResourceJid { - const auto slash = jid.find('/'); - if(slash == std::string_view::npos) { - throw std::invalid_argument("Invalid string for jid"); - }; - - return ParseBareResourceJid(jid, slash); - }; -}; - -auto ParseBareResourceJid(std::string_view jid, std::size_t slash) -> BareResourceJid { - return {static_cast(jid.substr(0, slash)), static_cast(jid.substr(slash + 1))}; -} - -export struct FullJid; - -auto ParseFullJid(std::string_view jid, std::size_t at, std::size_t slash) -> FullJid; - -export struct FullJid { - std::string username; - std::string server; - std::string resource; - - [[nodiscard]] friend auto ToString(const FullJid& jid) -> std::string { - return std::format("{}@{}/{}", jid.username, jid.server, jid.resource); - }; - - template - [[nodiscard]] auto Username(this Self&& self, std::string username) -> FullJid { - return {std::move(username), std::forward_like(self.server), std::forward_like(self.resource)}; - }; - - template - [[nodiscard]] auto Server(this Self&& self, std::string server) -> FullJid { - return {std::forward_like(self.username), std::move(server), std::forward_like(self.resource)}; - }; - - template - [[nodiscard]] auto Resource(this Self&& self, std::string resource) -> FullJid { - return {std::forward_like(self.username), std::forward_like(self.server), std::move(resource)}; - }; - - [[nodiscard]] static auto Parse(std::string_view jid) -> FullJid { - const auto at = jid.find('@'); - const auto slash = jid.find('/', at); - if(at == std::string_view::npos || slash == std::string_view::npos) { - throw std::invalid_argument("Invalid string for jid"); - }; - - return ParseFullJid(jid, at, slash); - }; -}; - -auto ParseFullJid(std::string_view jid, std::size_t at, std::size_t slash) -> FullJid { - return {static_cast(jid.substr(0, at)), - static_cast(jid.substr(at + 1, slash - at - 1)), - static_cast(jid.substr(slash + 1))}; -} -using JidVariant = std::variant; - -export struct Jid : JidVariant { - using JidVariant::variant; - [[nodiscard]] static auto Parse(std::string_view jid) -> Jid { - const auto at = jid.find('@'); - const auto slash = jid.find('/', at == std::string_view::npos ? 0 : at); - if(at == std::string_view::npos) { - return ParseBareResourceJid(jid, slash); - } - if(slash == std::string_view::npos) { - return ParseBareJid(jid, at); - } - return ParseFullJid(jid, at, slash); - } - [[nodiscard]] friend auto ToString(const Jid& jid) -> std::string { - return std::visit( - [](const auto& jid) -> std::string { - return ToString(jid); - }, - jid); - }; -}; - -} // namespace larra::xmpp diff --git a/src/lib/library.cpp b/src/lib/library.cpp deleted file mode 100644 index 8859ef6..0000000 --- a/src/lib/library.cpp +++ /dev/null @@ -1,3 +0,0 @@ -export module larra.library; -export import larra.library.jid; -export import larra.library.utils; diff --git a/src/main.cpp b/src/main.cpp index 37f6fe0..de99ca7 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,5 +1,4 @@ -export module larra.main; -import larra.application; +#include auto main(int argc, char* argv[]) -> int { auto app = larra::Application::create(); diff --git a/src/main_window.cpp b/src/main_window.cpp index 546b289..3adcaed 100644 --- a/src/main_window.cpp +++ b/src/main_window.cpp @@ -1,23 +1,16 @@ -module; -#include -export module larra.main_window; -import larra.application; +#include namespace larra { -export struct MainWindow : Gtk::ApplicationWindow { - Gtk::Box main; - Application& app; - MainWindow(Application& app) : app(app) { - this->set_title("Larra"); - Gtk::Box leftPanel{Gtk::Orientation::VERTICAL}; - leftPanel.set_halign(Gtk::Align::START); - leftPanel.set_expand(true); - Gtk::Box accounts{Gtk::Orientation::VERTICAL}; - leftPanel.append(accounts); - this->main.append(leftPanel); - this->set_child(this->main); - } +MainWindow::MainWindow(Application& app) : app(app) { + this->set_title("Larra"); + Gtk::Box leftPanel{Gtk::Orientation::VERTICAL}; + leftPanel.set_halign(Gtk::Align::START); + leftPanel.set_expand(true); + Gtk::Box accounts{Gtk::Orientation::VERTICAL}; + leftPanel.append(accounts); + this->main.append(leftPanel); + this->set_child(this->main); }; } // namespace larra diff --git a/tests/jid.cpp b/tests/jid.cpp index 49d108b..97d7e65 100644 --- a/tests/jid.cpp +++ b/tests/jid.cpp @@ -1,7 +1,5 @@ -module; +#include #include -export module tests.jid; -import larra.library.jid; namespace larra::xmpp { diff --git a/tests/set.cpp b/tests/set.cpp index cea7de7..6fba1e3 100644 --- a/tests/set.cpp +++ b/tests/set.cpp @@ -1,7 +1,6 @@ -module; #include -export module tests.set; -import larra.library.utils; + +#include namespace larra::xmpp {