1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-03-03 12:09:39 +00:00
openmw/components/settings/settings.hpp
elsid c7b95d1c9e
Fix build with GCC 13.1.1
openmw/apps/openmw/mwinput/controlswitch.hpp:32:49: error: ‘uint32_t’ has not been declared
   32 |         void readRecord(ESM::ESMReader& reader, uint32_t type);
      |                                                 ^~~~~~~~

openmw/apps/esmtool/labels.hpp:63:25: error: ‘uint32_t’ was not declared in this scope
   63 | std::string recordFlags(uint32_t flags);
      |                         ^~~~~~~~

openmw/components/detournavigator/recastmesh.hpp:91:14: error: ‘uint8_t’ in namespace ‘std’ does not name a type; did you mean ‘wint_t’?
   91 |         std::uint8_t mLength;
      |              ^~~~~~~
      |              wint_t

openmw/components/platform/file.hpp:9:23: error: found ‘:’ in nested-name-specifier, expected ‘::’
    9 |     enum class Handle : intptr_t
      |                       ^
      |                       ::

openmw/components/settings/settings.hpp:63:21: error: ‘int64_t’ in namespace ‘std’ does not name a type
   63 |         static std::int64_t getInt64(std::string_view setting, std::string_view category);
      |                     ^~~~~~~

openmw/components/esm/common.cpp:5:38: error: ‘uint32_t’ in namespace ‘std’ does not name a type; did you mean ‘wint_t’?
    5 |     std::string printName(const std::uint32_t typeId)
      |                                      ^~~~~~~~
      |                                      wint_t
2023-05-28 19:09:36 +02:00

86 lines
3.4 KiB
C++

#ifndef COMPONENTS_SETTINGS_H
#define COMPONENTS_SETTINGS_H
#include "categories.hpp"
#include <set>
#include <map>
#include <string>
#include <string_view>
#include <vector>
#include <cstdint>
#include <osg/Vec2f>
#include <osg/Vec3f>
namespace Files
{
struct ConfigurationManager;
}
namespace Settings
{
enum class WindowMode
{
Fullscreen = 0,
WindowedFullscreen,
Windowed
};
///
/// \brief Settings management (can change during runtime)
///
class Manager
{
public:
static CategorySettingValueMap mDefaultSettings;
static CategorySettingValueMap mUserSettings;
static CategorySettingVector mChangedSettings;
///< tracks all the settings that were changed since the last apply() call
static void clear();
///< clears all settings and default settings
static std::string load(const Files::ConfigurationManager& cfgMgr, bool loadEditorSettings = false);
///< load settings from all active config dirs. Returns the path of the last loaded file.
static void saveUser (const std::string& file);
///< save user settings to file
static void resetPendingChanges();
///< resets the list of all pending changes
static void resetPendingChanges(const CategorySettingVector& filter);
///< resets only the pending changes listed in the filter
static CategorySettingVector getPendingChanges();
///< returns the list of changed settings
static CategorySettingVector getPendingChanges(const CategorySettingVector& filter);
///< returns the list of changed settings intersecting with the filter
static int getInt(std::string_view setting, std::string_view category);
static std::int64_t getInt64(std::string_view setting, std::string_view category);
static float getFloat(std::string_view setting, std::string_view category);
static double getDouble(std::string_view setting, std::string_view category);
static std::string getString(std::string_view setting, std::string_view category);
static std::vector<std::string> getStringArray(std::string_view setting, std::string_view category);
static bool getBool(std::string_view setting, std::string_view category);
static osg::Vec2f getVector2(std::string_view setting, std::string_view category);
static osg::Vec3f getVector3(std::string_view setting, std::string_view category);
static void setInt(std::string_view setting, std::string_view category, int value);
static void setInt64(std::string_view setting, std::string_view category, std::int64_t value);
static void setFloat(std::string_view setting, std::string_view category, float value);
static void setDouble(std::string_view setting, std::string_view category, double value);
static void setString(std::string_view setting, std::string_view category, const std::string& value);
static void setStringArray(std::string_view setting, std::string_view category, const std::vector<std::string> &value);
static void setBool(std::string_view setting, std::string_view category, bool value);
static void setVector2(std::string_view setting, std::string_view category, osg::Vec2f value);
static void setVector3(std::string_view setting, std::string_view category, osg::Vec3f value);
};
}
#endif // COMPONENTS_SETTINGS_H