diff options
author | Shauren <shauren.trinity@gmail.com> | 2025-05-07 19:28:08 +0200 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2025-05-07 19:28:08 +0200 |
commit | ee251a94d62fb2132643f2787b5909012bebb6f9 (patch) | |
tree | ba84116657913c60b742d01560e9ce98e2edb37b /src/common/Configuration/Config.h | |
parent | b5c99939a82ed956cd185cd7a2ede838e2fdf23e (diff) |
Core/Config: Use std::string_view instead of std::string to lookup config values
Diffstat (limited to 'src/common/Configuration/Config.h')
-rw-r--r-- | src/common/Configuration/Config.h | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/common/Configuration/Config.h b/src/common/Configuration/Config.h index edf62eade83..740116b3ffc 100644 --- a/src/common/Configuration/Config.h +++ b/src/common/Configuration/Config.h @@ -15,8 +15,8 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef CONFIG_H -#define CONFIG_H +#ifndef TRINITYCORE_CONFIG_H +#define TRINITYCORE_CONFIG_H #include "Define.h" #include <string> @@ -43,19 +43,19 @@ public: bool Reload(std::vector<std::string>& errors); - std::string GetStringDefault(std::string const& name, const std::string& def, bool quiet = false) const; - bool GetBoolDefault(std::string const& name, bool def, bool quiet = false) const; - int32 GetIntDefault(std::string const& name, int32 def, bool quiet = false) const; - int64 GetInt64Default(std::string const& name, int64 def, bool quiet = false) const; - float GetFloatDefault(std::string const& name, float def, bool quiet = false) const; + std::string GetStringDefault(std::string_view name, std::string_view def, bool quiet = false) const; + bool GetBoolDefault(std::string_view name, bool def, bool quiet = false) const; + int32 GetIntDefault(std::string_view name, int32 def, bool quiet = false) const; + int64 GetInt64Default(std::string_view name, int64 def, bool quiet = false) const; + float GetFloatDefault(std::string_view name, float def, bool quiet = false) const; std::string const& GetFilename(); std::vector<std::string> const& GetArguments() const; std::vector<std::string> GetKeysByString(std::string const& name); private: - template<class T> - T GetValueDefault(std::string const& name, T def, bool quiet) const; + template<class T, class R = T> + R GetValueDefault(std::string_view const& name, T def, bool quiet) const; }; #define sConfigMgr ConfigMgr::instance() |