MapLibre Native Core
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
settings.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include <mapbox/compatibility/value.hpp>
4 
5 #include <memory>
6 
7 namespace mbgl {
8 namespace platform {
9 
10 #define DECLARE_MAPBOX_SETTING(name, value) constexpr const char* name = "mapbox_" #value
11 
12 // The value for EXPERIMENTAL_THREAD_PRIORITY_* keys, must be a double.
13 DECLARE_MAPBOX_SETTING(EXPERIMENTAL_THREAD_PRIORITY_WORKER, thread_priority_worker);
14 DECLARE_MAPBOX_SETTING(EXPERIMENTAL_THREAD_PRIORITY_FILE, thread_priority_file);
15 DECLARE_MAPBOX_SETTING(EXPERIMENTAL_THREAD_PRIORITY_NETWORK, thread_priority_network);
16 DECLARE_MAPBOX_SETTING(EXPERIMENTAL_THREAD_PRIORITY_DATABASE, thread_priority_database);
17 
19 class Settings final {
20 public:
22  static Settings& getInstance() noexcept;
23 
25  void set(const std::string& key, mapbox::base::Value value) noexcept;
26 
29  void set(const mapbox::base::ValueObject& values) noexcept;
30 
33  mapbox::base::Value get(const std::string& key) const noexcept;
34 
37  mapbox::base::ValueObject get(const std::vector<std::string>& keys) const noexcept;
38 
39 private:
40  Settings();
41 
42 private:
43  class Impl;
44  std::unique_ptr<Impl> impl;
45 };
46 
47 } // namespace platform
48 } // namespace mbgl
Settings class provides non-persistent, in-process key-value storage.
Definition: settings.hpp:19
static Settings & getInstance() noexcept
Returns singleton instance.
void set(const std::string &key, mapbox::base::Value value) noexcept
Sets setting value for a specified key.
mapbox::base::Value get(const std::string &key) const noexcept
DECLARE_MAPBOX_SETTING(EXPERIMENTAL_THREAD_PRIORITY_WORKER, thread_priority_worker)
Definition: actor.hpp:15
mapbox::base::Value Value
Definition: feature.hpp:11
Definition: tile_id.hpp:256