aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/dataloader
diff options
context:
space:
mode:
author Hop311 <Hop3114@gmail.com>2024-07-19 21:35:31 +0200
committer GitHub <noreply@github.com>2024-07-19 21:35:31 +0200
commitd1f3a96b72dd06b5f97dd4643e5f016a02b42ea6 (patch)
tree38015e5729afbb98cf520e2cf26d8a4623d32f2f /src/openvic-simulation/dataloader
parente0518bee9b4c164f40716a8033b5e207c2060c0b (diff)
parent03647d2249f72b6545628bb844685f87c4581062 (diff)
Merge pull request #176 from OpenVicProject/format-cleanup
Cleanup: inheritance, const movable variables, code formatting
Diffstat (limited to 'src/openvic-simulation/dataloader')
-rw-r--r--src/openvic-simulation/dataloader/NodeTools.cpp1
-rw-r--r--src/openvic-simulation/dataloader/NodeTools.hpp2
-rw-r--r--src/openvic-simulation/dataloader/Vic2PathSearch.cpp6
-rw-r--r--src/openvic-simulation/dataloader/Vic2PathSearch_Windows.hpp6
4 files changed, 7 insertions, 8 deletions
diff --git a/src/openvic-simulation/dataloader/NodeTools.cpp b/src/openvic-simulation/dataloader/NodeTools.cpp
index 25c5041..ad130ad 100644
--- a/src/openvic-simulation/dataloader/NodeTools.cpp
+++ b/src/openvic-simulation/dataloader/NodeTools.cpp
@@ -104,7 +104,6 @@ static NodeCallback auto _expect_string(Callback<ovdl::symbol<char>> auto callba
return _expect_type<ast::StringValue>(_abstract_symbol_node_callback<ast::StringValue>(callback, allow_empty));
}
-
node_callback_t NodeTools::expect_identifier_or_string(callback_t<std::string_view> callback, bool allow_empty) {
return [callback, allow_empty](ast::NodeCPtr node) -> bool {
if (node != nullptr) {
diff --git a/src/openvic-simulation/dataloader/NodeTools.hpp b/src/openvic-simulation/dataloader/NodeTools.hpp
index 30cba65..18faffb 100644
--- a/src/openvic-simulation/dataloader/NodeTools.hpp
+++ b/src/openvic-simulation/dataloader/NodeTools.hpp
@@ -25,7 +25,7 @@
namespace OpenVic {
namespace ast {
using namespace ovdl::v2script::ast;
- using NodeCPtr = const Node*;
+ using NodeCPtr = Node const*;
constexpr std::string_view get_type_name(NodeKind kind) {
#define NODE_CASE(Node) \
diff --git a/src/openvic-simulation/dataloader/Vic2PathSearch.cpp b/src/openvic-simulation/dataloader/Vic2PathSearch.cpp
index bc30b6e..ccd55d1 100644
--- a/src/openvic-simulation/dataloader/Vic2PathSearch.cpp
+++ b/src/openvic-simulation/dataloader/Vic2PathSearch.cpp
@@ -42,7 +42,7 @@ static constexpr bool path_equals(std::string_view lhs, std::string_view rhs) {
template<typename T>
concept is_filename = std::same_as<T, std::filesystem::path> || std::convertible_to<T, std::string_view>;
-static bool filename_equals(const is_filename auto& lhs, const is_filename auto& rhs) {
+static bool filename_equals(is_filename auto const& lhs, is_filename auto const& rhs) {
auto left = [&lhs] {
if constexpr (std::same_as<std::decay_t<decltype(lhs)>, std::filesystem::path>) {
return lhs.filename().string();
@@ -230,7 +230,7 @@ static fs::path _search_for_game_path(fs::path hint_path = {}) {
// Array of strings contain "0" to std::to_string(max_amount_of_steam_libraries - 1)
static constexpr auto library_indexes = OpenVic::ConstexprIntToStr::make_itosv_array<max_amount_of_steam_libraries>();
- for (const auto& index : library_indexes) {
+ for (auto const& index : library_indexes) {
decltype(current_node) node = std::nullopt;
auto it = current_node.value().find(index);
@@ -336,7 +336,7 @@ static fs::path _search_for_game_path(fs::path hint_path = {}) {
fs::path Dataloader::search_for_game_path(fs::path hint_path) {
struct fshash {
- size_t operator()(const std::filesystem::path& p) const noexcept {
+ size_t operator()(std::filesystem::path const& p) const noexcept {
return std::filesystem::hash_value(p);
}
};
diff --git a/src/openvic-simulation/dataloader/Vic2PathSearch_Windows.hpp b/src/openvic-simulation/dataloader/Vic2PathSearch_Windows.hpp
index 37991b6..cfb3651 100644
--- a/src/openvic-simulation/dataloader/Vic2PathSearch_Windows.hpp
+++ b/src/openvic-simulation/dataloader/Vic2PathSearch_Windows.hpp
@@ -55,7 +55,7 @@ namespace OpenVic::Windows {
template<typename T>
concept has_data = requires(T t) {
- { t.data() } -> std::convertible_to<const typename T::value_type*>;
+ { t.data() } -> std::convertible_to<typename T::value_type const*>;
};
class RegistryKey {
@@ -116,7 +116,7 @@ namespace OpenVic::Windows {
DWORD data_size;
DWORD type;
- const auto& wide_value = [&value_name]() -> has_data auto {
+ auto const& wide_value = [&value_name]() -> has_data auto {
if constexpr (std::is_same_v<CHAR_T, char>) {
return convert(value_name);
} else {
@@ -161,7 +161,7 @@ namespace OpenVic::Windows {
}
template<either_char_type RCHAR_T, either_char_type CHAR_T, either_char_type CHAR_T2>
- std::basic_string<RCHAR_T> ReadRegValue(HKEY root, const CHAR_T* key, const CHAR_T2* name) {
+ std::basic_string<RCHAR_T> ReadRegValue(HKEY root, CHAR_T const* key, CHAR_T2 const* name) {
auto key_sv = std::basic_string_view(key);
auto name_sv = std::basic_string_view(name);