aboutsummaryrefslogtreecommitdiffstats
path: root/common/settings.h
diff options
context:
space:
mode:
Diffstat (limited to 'common/settings.h')
-rw-r--r--common/settings.h27
1 files changed, 19 insertions, 8 deletions
diff --git a/common/settings.h b/common/settings.h
index 0c4a67db..b57947c9 100644
--- a/common/settings.h
+++ b/common/settings.h
@@ -45,19 +45,30 @@ class Settings
return defaultValue;
}
- template <typename T> void set(const char *name, T value)
- {
- IdString id = ctx->id(name);
- auto pair = ctx->settings.emplace(id, std::to_string(value));
- if (!pair.second) {
- ctx->settings[pair.first->first] = value;
- }
- }
+ template <typename T> void set(const char *name, T value);
private:
Context *ctx;
};
+template <typename T> inline void Settings::set(const char *name, T value)
+{
+ IdString id = ctx->id(name);
+ auto pair = ctx->settings.emplace(id, std::to_string(value));
+ if (!pair.second) {
+ ctx->settings[pair.first->first] = value;
+ }
+}
+
+template <> inline void Settings::set<std::string>(const char *name, std::string value)
+{
+ IdString id = ctx->id(name);
+ auto pair = ctx->settings.emplace(id, value);
+ if (!pair.second) {
+ ctx->settings[pair.first->first] = value;
+ }
+}
+
NEXTPNR_NAMESPACE_END
#endif // SETTINGS_H