1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-30 18:25:16 +01:00
Files
OpenRCT2/src/openrct2/config/IniReader.hpp
Hielke Morsink 0cf256ac9e Ready copyright notice for clang-format
Clang-format sees the text behind `#pragma region` as code and formats it. Instead of stating the copyright and date there, it's now in the comment block right below it. The text "Copyright" is left in the `#pragma region` line, as clang-format sees it as a single identifier.

I took the opportunity to normalize the dates, and add the copyright notice to the source files where it was missing them (except for third-party and the generated resources.h file).
2018-06-15 14:07:34 +02:00

47 lines
1.6 KiB
C++

/*****************************************************************************
* Copyright (c) 2014-2018 OpenRCT2 developers
*
* For a complete list of all authors, please refer to contributors.md
* Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2
*
* OpenRCT2 is licensed under the GNU General Public License version 3.
*****************************************************************************/
#pragma once
#include <string>
#include "../common.h"
interface IStream;
template <typename T> struct IConfigEnum;
interface IIniReader
{
virtual ~IIniReader() = default;
virtual bool ReadSection(const std::string &name) abstract;
virtual bool GetBoolean(const std::string &name, bool defaultValue) const abstract;
virtual sint32 GetSint32(const std::string &name, sint32 defaultValue) const abstract;
virtual float GetFloat(const std::string &name, float defaultValue) const abstract;
virtual std::string GetString(const std::string &name, const std::string &defaultValue) const abstract;
virtual bool TryGetString(const std::string &name, std::string * outValue) const abstract;
template<typename T>
T GetEnum(const std::string &name, T defaultValue, const IConfigEnum<T> &configEnum) const
{
std::string szValue;
if (!TryGetString(name, &szValue))
{
return defaultValue;
}
return configEnum.GetValue(szValue, defaultValue);
}
utf8 * GetCString(const std::string &name, const utf8 * defaultValue) const;
};
IIniReader * CreateIniReader(IStream * stream);
IIniReader * CreateDefaultIniReader();