Make LibrarySettings follow PIMPL, adds documentation.
Signed-off-by: Deukhoofd <Deukhoofd@gmail.com>
This commit is contained in:
parent
dd8847a441
commit
539a278114
|
@ -0,0 +1,22 @@
|
||||||
|
#include "LibrarySettings.hpp"
|
||||||
|
|
||||||
|
namespace CreatureLib::Library {
|
||||||
|
struct LibrarySettings::impl {
|
||||||
|
level_int_t _maximalLevel;
|
||||||
|
uint8_t _maximalAttacks;
|
||||||
|
|
||||||
|
public:
|
||||||
|
impl(level_int_t maximalLevel, uint8_t maximalAttacks)
|
||||||
|
: _maximalLevel(maximalLevel), _maximalAttacks(maximalAttacks) {}
|
||||||
|
|
||||||
|
[[nodiscard]] inline level_int_t GetMaximalLevel() const noexcept { return _maximalLevel; }
|
||||||
|
|
||||||
|
[[nodiscard]] inline uint8_t GetMaximalAttacks() const noexcept { return _maximalAttacks; }
|
||||||
|
};
|
||||||
|
LibrarySettings::LibrarySettings(level_int_t maximalLevel, uint8_t maximalAttacks)
|
||||||
|
: _impl(new impl(maximalLevel, maximalAttacks)) {}
|
||||||
|
LibrarySettings::~LibrarySettings() = default;
|
||||||
|
|
||||||
|
level_int_t LibrarySettings::GetMaximalLevel() const noexcept { return _impl->GetMaximalLevel(); }
|
||||||
|
uint8_t LibrarySettings::GetMaximalAttacks() const noexcept { return _impl->GetMaximalAttacks(); }
|
||||||
|
}
|
|
@ -1,20 +1,25 @@
|
||||||
#ifndef CREATURELIB_LIBRARYSETTINGS_HPP
|
#ifndef CREATURELIB_LIBRARYSETTINGS_HPP
|
||||||
#define CREATURELIB_LIBRARYSETTINGS_HPP
|
#define CREATURELIB_LIBRARYSETTINGS_HPP
|
||||||
|
|
||||||
#include "../Defines.hpp"
|
|
||||||
|
|
||||||
namespace CreatureLib::Library {
|
namespace CreatureLib::Library {
|
||||||
|
/// @brief Hold the different runtime settings for a given library.
|
||||||
class LibrarySettings {
|
class LibrarySettings {
|
||||||
level_int_t _maximalLevel;
|
struct impl;
|
||||||
uint8_t _maximalAttacks;
|
std::unique_ptr<impl> _impl;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
LibrarySettings(level_int_t maximalLevel, uint8_t maximalAttacks)
|
/// @brief Initialises LibrarySettings.
|
||||||
: _maximalLevel(maximalLevel), _maximalAttacks(maximalAttacks) {}
|
/// @param maximalLevel The maximal level a creature can be.
|
||||||
|
/// @param maximalAttacks The maximal number of attacks a creature can have.
|
||||||
|
LibrarySettings(level_int_t maximalLevel, uint8_t maximalAttacks);
|
||||||
|
virtual ~LibrarySettings();
|
||||||
|
|
||||||
inline level_int_t GetMaximalLevel() const noexcept { return _maximalLevel; }
|
/// @brief Returns the maximal level a creature can be in the current library.
|
||||||
|
/// @return The maximal level a creature can be in the current library.
|
||||||
inline uint8_t GetMaximalAttacks() const noexcept { return _maximalAttacks; }
|
[[nodiscard]] level_int_t GetMaximalLevel() const noexcept;
|
||||||
|
/// @brief Returns the maximal number of attacks a creature can have.
|
||||||
|
/// @return The maximal number of attacks a creature can have.
|
||||||
|
[[nodiscard]] uint8_t GetMaximalAttacks() const noexcept;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue