Skip to content

Commit

Permalink
Rename => ConfigFile
Browse files Browse the repository at this point in the history
  • Loading branch information
AlanGriffiths committed Aug 20, 2024
1 parent 2f3b4ed commit 64546a4
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 34 deletions.
4 changes: 2 additions & 2 deletions debian/libmiral7.symbols
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,8 @@ libmiral.so.7 libmiral7 #MINVER#
(c++)"vtable for miral::MinimalWindowManager@MIRAL_5.0" 5.0.0
(c++)"vtable for miral::WindowManagementPolicy@MIRAL_5.0" 5.0.0
MIRAL_5.1@MIRAL_5.1 5.1.0
(c++)"miral::ConfigFile::ConfigFile(miral::MirRunner&, std::filesystem::__cxx11::path, std::function<void (std::basic_istream<char, std::char_traits<char> >&, std::filesystem::__cxx11::path const&)>)@MIRAL_5.1" 5.1.0
(c++)"miral::ConfigFile::~ConfigFile()@MIRAL_5.1" 5.1.0
(c++)"miral::Decorations::Decorations(std::shared_ptr<miral::Decorations::Self>)@MIRAL_5.1" 5.1.0
(c++)"miral::Decorations::always_csd()@MIRAL_5.1" 5.1.0
(c++)"miral::Decorations::always_ssd()@MIRAL_5.1" 5.1.0
Expand All @@ -445,6 +447,4 @@ libmiral.so.7 libmiral7 #MINVER#
(c++)"miral::IdleListener::on_off(std::function<void ()> const&)@MIRAL_5.1" 5.1.0
(c++)"miral::IdleListener::on_wake(std::function<void ()> const&)@MIRAL_5.1" 5.1.0
(c++)"miral::IdleListener::operator()(mir::Server&) const@MIRAL_5.1" 5.1.0
(c++)"miral::ReloadingConfigFile::ReloadingConfigFile(miral::MirRunner&, std::filesystem::__cxx11::path, std::function<void (std::basic_istream<char, std::char_traits<char> >&, std::filesystem::__cxx11::path const&)>)@MIRAL_5.1" 5.1.0
(c++)"miral::ReloadingConfigFile::~ReloadingConfigFile()@MIRAL_5.1" 5.1.0
(c++)"miral::WindowManagerTools::move_cursor_to(mir::geometry::generic::Point<float>)@MIRAL_5.1" 5.1.0
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef MIRAL_RELOADING_CONFIG_FILE_H
#define MIRAL_RELOADING_CONFIG_FILE_H
#ifndef MIRAL_CONFIG_FILE_H
#define MIRAL_CONFIG_FILE_H

#include <mir/fd.h>

Expand All @@ -38,14 +38,14 @@ namespace miral
* applied and the supplied path monitored for changes.
* \remark MirAL 5.1
*/
class ReloadingConfigFile
class ConfigFile
{
public:
/// Loader functor is passed both the open stream and the actual path (for use in reporting problems)
using Loader = std::function<void(std::istream& istream, std::filesystem::path const& path)>;

ReloadingConfigFile(MirRunner& runner, std::filesystem::path file, Loader load_config);
~ReloadingConfigFile();
ConfigFile(MirRunner& runner, std::filesystem::path file, Loader load_config);
~ConfigFile();

private:

Expand All @@ -54,4 +54,4 @@ class ReloadingConfigFile
};
}

#endif //MIRAL_RELOADING_CONFIG_FILE_H
#endif //MIRAL_CONFIG_FILE_H
2 changes: 1 addition & 1 deletion src/miral/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ add_library(miral-external OBJECT
application_authorizer.cpp ${miral_include}/miral/application_authorizer.h
application_info.cpp ${miral_include}/miral/application_info.h
canonical_window_manager.cpp ${miral_include}/miral/canonical_window_manager.h
config_file.cpp ${miral_include}/miral/config_file.h
configuration_option.cpp ${miral_include}/miral/configuration_option.h
${miral_include}/miral/command_line_option.h
cursor_theme.cpp ${miral_include}/miral/cursor_theme.h
Expand All @@ -74,7 +75,6 @@ add_library(miral-external OBJECT
window_specification.cpp ${miral_include}/miral/window_specification.h
internal_client.cpp ${miral_include}/miral/internal_client.h
prepend_event_filter.cpp ${miral_include}/miral/prepend_event_filter.h
reloading_config_file.cpp ${miral_include}/miral/reloading_config_file.h
runner.cpp ${miral_include}/miral/runner.h
session_lock_listener.cpp ${miral_include}/miral/session_lock_listener.h
set_command_line_handler.cpp ${miral_include}/miral/set_command_line_handler.h
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

#include <miral/reloading_config_file.h>
#include <miral/config_file.h>

#include <miral/runner.h>

Expand Down Expand Up @@ -67,7 +67,7 @@ auto watch_descriptor(mir::Fd const& inotify_fd, std::optional<path> const& path
}
}

class miral::ReloadingConfigFile::Self
class miral::ConfigFile::Self
{
public:
Self(MirRunner& runner, path file, Loader load_config);
Expand All @@ -83,7 +83,7 @@ class miral::ReloadingConfigFile::Self
std::unique_ptr<miral::FdHandle> fd_handle;
};

miral::ReloadingConfigFile::Self::Self(MirRunner& runner, path file, Loader load_config) :
miral::ConfigFile::Self::Self(MirRunner& runner, path file, Loader load_config) :
inotify_fd{inotify_init1(IN_CLOEXEC)},
load_config{load_config},
filename{file.filename()},
Expand Down Expand Up @@ -132,14 +132,14 @@ miral::ReloadingConfigFile::Self::Self(MirRunner& runner, path file, Loader load
}
}

miral::ReloadingConfigFile::ReloadingConfigFile(MirRunner& runner, path file, Loader load_config) :
miral::ConfigFile::ConfigFile(MirRunner& runner, path file, Loader load_config) :
self{std::make_shared<Self>(runner, file, load_config)}
{
}

miral::ReloadingConfigFile::~ReloadingConfigFile() = default;
miral::ConfigFile::~ConfigFile() = default;

void miral::ReloadingConfigFile::Self::register_handler(MirRunner& runner)
void miral::ConfigFile::Self::register_handler(MirRunner& runner)
{
if (directory_watch_descriptor)
{
Expand Down
6 changes: 3 additions & 3 deletions src/miral/symbols.map
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,8 @@ local: *;
MIRAL_5.1 {
global:
extern "C++" {
miral::ConfigFile::?ConfigFile*;
miral::ConfigFile::ConfigFile*;
miral::Decorations::Decorations*;
miral::Decorations::always_csd*;
miral::Decorations::always_ssd*;
Expand All @@ -468,12 +470,10 @@ global:
miral::IdleListener::on_off*;
miral::IdleListener::on_wake*;
miral::IdleListener::operator*;
miral::ReloadingConfigFile::?ReloadingConfigFile*;
miral::ReloadingConfigFile::ReloadingConfigFile*;
miral::WindowManagerTools::move_cursor_to*;
typeinfo?for?miral::ConfigFile;
typeinfo?for?miral::Decorations;
typeinfo?for?miral::IdleListener;
typeinfo?for?miral::ReloadingConfigFile;
};
} MIRAL_5.0;

2 changes: 1 addition & 1 deletion tests/miral/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ target_link_libraries(miral-test-internal

mir_add_wrapped_executable(miral-test NOINSTALL
external_client.cpp
reloading_config_file.cpp
config_file.cpp
runner.cpp
wayland_extensions.cpp
zone.cpp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
*/

#include "miral/test_server.h"
#include "miral/reloading_config_file.h"
#include "miral/config_file.h"

#include <wayland_wrapper.h>
#include <gmock/gmock-function-mocker.h>

#include <format>
#include <fstream>

using miral::ReloadingConfigFile;
using miral::ConfigFile;

namespace
{
Expand Down Expand Up @@ -71,7 +71,7 @@ struct TestReloadingConfigFile : miral::TestServer, PendingLoad
TestReloadingConfigFile();
MOCK_METHOD(void, load, (std::istream& in, std::filesystem::path path), ());

std::optional<ReloadingConfigFile> reloading_config_file;
std::optional<ConfigFile> reloading_config_file;

void write_a_file()
{
Expand Down Expand Up @@ -123,7 +123,7 @@ TEST_F(TestReloadingConfigFile, with_no_file_nothing_is_loaded)

invoke_runner([this](miral::MirRunner& runner)
{
reloading_config_file = ReloadingConfigFile{
reloading_config_file = ConfigFile{
runner,
no_such_file,
[this](std::istream& in, std::filesystem::path path) { load(in, path); }};
Expand All @@ -138,7 +138,7 @@ TEST_F(TestReloadingConfigFile, with_a_file_something_is_loaded)

invoke_runner([this](miral::MirRunner& runner)
{
reloading_config_file = ReloadingConfigFile{
reloading_config_file = ConfigFile{
runner,
a_file,
[this](std::istream& in, std::filesystem::path path) { load(in, path); }};
Expand All @@ -150,7 +150,7 @@ TEST_F(TestReloadingConfigFile, when_a_file_is_written_something_is_loaded)
{
invoke_runner([this](miral::MirRunner& runner)
{
reloading_config_file = ReloadingConfigFile{
reloading_config_file = ConfigFile{
runner,
a_file,
[this](std::istream& in, std::filesystem::path path) { load(in, path); }};
Expand All @@ -172,7 +172,7 @@ TEST_F(TestReloadingConfigFile, each_time_a_file_is_rewritten_something_is_loade

invoke_runner([this](miral::MirRunner& runner)
{
reloading_config_file = ReloadingConfigFile{
reloading_config_file = ConfigFile{
runner,
a_file,
[this](std::istream& in, std::filesystem::path path) { load(in, path); }};
Expand All @@ -198,7 +198,7 @@ TEST_F(TestReloadingConfigFile, when_config_home_unset_a_file_in_home_config_is_

invoke_runner([this](miral::MirRunner& runner)
{
reloading_config_file = ReloadingConfigFile{
reloading_config_file = ConfigFile{
runner,
config_file,
[this](std::istream& in, std::filesystem::path path) { load(in, path); }};
Expand All @@ -218,7 +218,7 @@ TEST_F(TestReloadingConfigFile, a_file_in_xdg_config_home_is_loaded)

invoke_runner([this](miral::MirRunner& runner)
{
reloading_config_file = ReloadingConfigFile{
reloading_config_file = ConfigFile{
runner,
config_file,
[this](std::istream& in, std::filesystem::path path) { load(in, path); }};
Expand All @@ -238,7 +238,7 @@ TEST_F(TestReloadingConfigFile, a_file_in_xdg_config_home_is_reloaded)

invoke_runner([this](miral::MirRunner& runner)
{
reloading_config_file = ReloadingConfigFile{
reloading_config_file = ConfigFile{
runner,
config_file,
[this](std::istream& in, std::filesystem::path path) { load(in, path); }};
Expand All @@ -261,7 +261,7 @@ TEST_F(TestReloadingConfigFile, a_config_in_xdg_conf_dir0_is_loaded)

invoke_runner([this](miral::MirRunner& runner)
{
reloading_config_file = ReloadingConfigFile{
reloading_config_file = ConfigFile{
runner,
config_file,
[this](std::istream& in, std::filesystem::path path) { load(in, path); }};
Expand All @@ -284,7 +284,7 @@ TEST_F(TestReloadingConfigFile, after_a_config_in_xdg_conf_dir0_is_loaded_a_new_

invoke_runner([this](miral::MirRunner& runner)
{
reloading_config_file = ReloadingConfigFile{
reloading_config_file = ConfigFile{
runner,
config_file,
[this](std::istream& in, std::filesystem::path path) { load(in, path); }};
Expand All @@ -308,7 +308,7 @@ TEST_F(TestReloadingConfigFile, a_config_in_xdg_conf_dir0_is_loaded_in_preferenc

invoke_runner([this](miral::MirRunner& runner)
{
reloading_config_file = ReloadingConfigFile{
reloading_config_file = ConfigFile{
runner,
config_file,
[this](std::istream& in, std::filesystem::path path) { load(in, path); }};
Expand All @@ -328,7 +328,7 @@ TEST_F(TestReloadingConfigFile, a_config_in_xdg_conf_dir1_is_loaded_in_preferenc

invoke_runner([this](miral::MirRunner& runner)
{
reloading_config_file = ReloadingConfigFile{
reloading_config_file = ConfigFile{
runner,
config_file,
[this](std::istream& in, std::filesystem::path path) { load(in, path); }};
Expand All @@ -347,7 +347,7 @@ TEST_F(TestReloadingConfigFile, a_config_in_xdg_conf_dir2_is_loaded)

invoke_runner([this](miral::MirRunner& runner)
{
reloading_config_file = ReloadingConfigFile{
reloading_config_file = ConfigFile{
runner,
config_file,
[this](std::istream& in, std::filesystem::path path) { load(in, path); }};
Expand Down

0 comments on commit 64546a4

Please sign in to comment.