Skip to content

Commit be6975c

Browse files
fix: General fixes
1 parent d0b382c commit be6975c

4 files changed

Lines changed: 12 additions & 10 deletions

File tree

examples/example.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,19 @@ int main()
1717
auto& config = app.GetConfig();
1818

1919
// Type-safe value retrieval
20-
std::string db_url = config.GetSetting(example::AppConfigName::DatabaseUrl).Value<std::string>();
20+
auto db_url = config.GetSetting(example::AppConfigName::DatabaseUrl).Value<std::string>();
2121
std::cout << "Database URL: " << db_url << '\n';
2222

23-
int max_conn = config.GetSetting(example::AppConfigName::MaxConnections).Value<int>();
23+
auto max_conn = config.GetSetting(example::AppConfigName::MaxConnections).Value<int>();
2424
std::cout << "Max Connections: " << max_conn << '\n';
2525

26-
bool logging_enabled = config.GetSetting(example::AppConfigName::EnableLogging).Value<bool>();
26+
auto logging_enabled = config.GetSetting(example::AppConfigName::EnableLogging).Value<bool>();
2727
std::cout << "Logging Enabled: " << (logging_enabled ? "Yes" : "No") << '\n';
2828

29-
int retry_count = config.GetSetting(example::AppConfigName::RetryCount).Value<int>();
29+
auto retry_count = config.GetSetting(example::AppConfigName::RetryCount).Value<int>();
3030
std::cout << "Retry Count: " << retry_count << '\n';
3131

32-
std::string log_level = config.GetSetting(example::AppConfigName::LogLevel).Value<std::string>();
32+
auto log_level = config.GetSetting(example::AppConfigName::LogLevel).Value<std::string>();
3333
std::cout << "Log Level: " << log_level << '\n';
3434

3535
// Update a setting

src/GenericConfiguration.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ namespace config {
1919
* @brief Type trait to check if a serializer derives from IConfigurationSerializer
2020
*/
2121
template <typename E, typename Serializer>
22-
struct is_valid_serializer : std::is_base_of<IConfigurationSerializer<E>, Serializer> { };
22+
struct is_valid_serializer : std::is_base_of<IConfigurationSerializer<E>, Serializer> { }; // NOLINT(readability-identifier-naming)
2323

2424
/**
2525
* @brief Generic configuration implementation

src/JsonSerializer.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include <nlohmann/json_fwd.hpp>
88
#include <optional>
99
#include <ostream>
10+
#include <stdexcept>
1011
#include <string>
1112
#include <type_traits>
1213
#include <unordered_map>

src/Setting.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@
55
#include <stdexcept>
66
#include <string>
77
#include <type_traits>
8+
#include <typeinfo>
9+
#include <utility>
810
#include <variant>
911

1012
namespace config {
1113

12-
// Legacy variant type for backward compatibility
1314
using SettingValueType = std::variant<int, float, double, std::string, bool>;
1415

1516
// Forward declaration of Setting
@@ -37,7 +38,7 @@ using default_setting_type_t = typename default_setting_type<E, SettingVariant,
3738
* @brief Compile-time check if a type is valid for an enum value based on defaults
3839
*/
3940
template <typename E, typename SettingVariant, E EnumValue, typename T>
40-
inline constexpr bool is_valid_type_v = std::is_same_v<default_setting_type_t<E, SettingVariant, EnumValue>, T>;
41+
inline constexpr bool is_valid_type_v = std::is_same_v<default_setting_type_t<E, SettingVariant, EnumValue>, T>; // NOLINT(readability-identifier-naming)
4142

4243
/**
4344
* @brief Type trait to associate enum values with their types at compile time
@@ -48,7 +49,7 @@ inline constexpr bool is_valid_type_v = std::is_same_v<default_setting_type_t<E,
4849
* @tparam Enable SFINAE enabler
4950
*/
5051
template <typename E, E EnumValue, typename Enable = void>
51-
struct setting_type_trait {
52+
struct setting_type_trait { // NOLINT(readability-identifier-naming)
5253
// Default implementation provides a compile error
5354
static_assert(sizeof(E) == 0,
5455
"You must specialize setting_type_trait for your enum values");
@@ -73,7 +74,7 @@ using setting_type = typename setting_type_trait<E, EnumValue>::type;
7374
* @tparam T The type to check against
7475
*/
7576
template <typename E, E EnumValue, typename T>
76-
inline constexpr bool is_correct_type_v = std::is_same_v<setting_type<E, EnumValue>, T>;
77+
inline constexpr bool is_correct_type_v = std::is_same_v<setting_type<E, EnumValue>, T>; // NOLINT(readability-identifier-naming)
7778

7879
/**
7980
* @brief Generic Setting class that is strongly typed

0 commit comments

Comments
 (0)