Skip to content

Commit

Permalink
ChaosMod: Stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
pongo1231 committed Aug 25, 2023
1 parent 6e84292 commit bd0d813
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions ChaosMod/Util/OptionsFile.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class OptionsFile
}
}

template <typename T> inline T ReadValue(std::vector<std::string> keys, T defaultValue) const
template <typename T> inline T ReadValue(const std::vector<std::string> &keys, T defaultValue) const
{
for (const auto &key : keys)
{
Expand All @@ -93,7 +93,7 @@ class OptionsFile
return defaultValue;
}

inline std::string ReadValueString(std::vector<std::string> keys, const std::string &defaultValue = {}) const
inline std::string ReadValueString(const std::vector<std::string> &keys, const std::string &defaultValue = {}) const
{
for (const auto &key : keys)
{
Expand Down
6 changes: 3 additions & 3 deletions ChaosMod/Util/OptionsManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,19 @@ class OptionsManager
m_TwitchFile.Reset();
}

template <typename T> inline T GetConfigValue(std::vector<std::string> keys, T defaultValue)
template <typename T> inline T GetConfigValue(const std::vector<std::string> &keys, T defaultValue)
{
return GetOptionValue(m_ConfigFile, keys, defaultValue);
}

template <typename T> inline T GetVotingValue(std::vector<std::string> keys, T defaultValue)
template <typename T> inline T GetVotingValue(const std::vector<std::string> &keys, T defaultValue)
{
return GetOptionValue(m_TwitchFile, keys, defaultValue);
}

private:
template <typename T>
inline T GetOptionValue(const OptionsFile &optionsFile, std::vector<std::string> keys, T defaultValue = T())
inline T GetOptionValue(const OptionsFile &optionsFile, const std::vector<std::string> &keys, T defaultValue = {})
{
if constexpr (std::is_same<typename std::remove_const<T>::type, std::string>()
|| std::is_same<typename std::remove_const<T>::type, char *>())
Expand Down

1 comment on commit bd0d813

@ReiDaTecnologia
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

10/10 description

Please sign in to comment.