-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
♻️ (config): Move Config struct in own header + clean up includes
- Loading branch information
Showing
3 changed files
with
30 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Leka - LekaOS | ||
// Copyright 2022 APF France handicap | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
#pragma once | ||
|
||
#include <filesystem> | ||
|
||
namespace leka { | ||
|
||
struct Config { | ||
public: | ||
explicit Config(const std::filesystem::path &path, uint8_t default_value = 0xFF) | ||
: _path(_default_parent_path / path), _default_value(default_value) | ||
{ | ||
// nothing to do | ||
} | ||
|
||
[[nodiscard]] auto path() const -> std::filesystem::path { return _path; } | ||
[[nodiscard]] auto default_value() const -> uint8_t { return _default_value; } | ||
|
||
private: | ||
const std::filesystem::path _default_parent_path = "/fs/conf"; | ||
const std::filesystem::path _path; | ||
const uint8_t _default_value; | ||
}; | ||
|
||
} // namespace leka |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters