From 08c95883e9c9f367902ccf188576d03abcac2731 Mon Sep 17 00:00:00 2001 From: Techjar Date: Sat, 29 Feb 2020 01:37:26 -0500 Subject: [PATCH] Common/IniFile: Add Exists function for section name only --- Source/Core/Common/IniFile.cpp | 5 +++++ Source/Core/Common/IniFile.h | 1 + 2 files changed, 6 insertions(+) diff --git a/Source/Core/Common/IniFile.cpp b/Source/Core/Common/IniFile.cpp index 9023db682c..4e150cb6aa 100644 --- a/Source/Core/Common/IniFile.cpp +++ b/Source/Core/Common/IniFile.cpp @@ -176,6 +176,11 @@ bool IniFile::DeleteSection(std::string_view section_name) return false; } +bool IniFile::Exists(std::string_view section_name) const +{ + return GetSection(section_name) != nullptr; +} + bool IniFile::Exists(std::string_view section_name, std::string_view key) const { const Section* section = GetSection(section_name); diff --git a/Source/Core/Common/IniFile.h b/Source/Core/Common/IniFile.h index c791e546a8..cdcd48c7ef 100644 --- a/Source/Core/Common/IniFile.h +++ b/Source/Core/Common/IniFile.h @@ -119,6 +119,7 @@ public: bool Save(const std::string& filename); + bool Exists(std::string_view section_name) const; // Returns true if key exists in section bool Exists(std::string_view section_name, std::string_view key) const;