mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-07-06 03:31:43 +00:00
[wpilib] Preferences: Set Persistent in Init methods (#4025)
Fixes #4018
This commit is contained in:
@@ -87,6 +87,7 @@ void Preferences::PutString(std::string_view key, std::string_view value) {
|
|||||||
void Preferences::InitString(std::string_view key, std::string_view value) {
|
void Preferences::InitString(std::string_view key, std::string_view value) {
|
||||||
auto entry = ::GetInstance().table->GetEntry(key);
|
auto entry = ::GetInstance().table->GetEntry(key);
|
||||||
entry.SetDefaultString(value);
|
entry.SetDefaultString(value);
|
||||||
|
entry.SetPersistent();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Preferences::SetInt(std::string_view key, int value) {
|
void Preferences::SetInt(std::string_view key, int value) {
|
||||||
@@ -102,6 +103,7 @@ void Preferences::PutInt(std::string_view key, int value) {
|
|||||||
void Preferences::InitInt(std::string_view key, int value) {
|
void Preferences::InitInt(std::string_view key, int value) {
|
||||||
auto entry = ::GetInstance().table->GetEntry(key);
|
auto entry = ::GetInstance().table->GetEntry(key);
|
||||||
entry.SetDefaultDouble(value);
|
entry.SetDefaultDouble(value);
|
||||||
|
entry.SetPersistent();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Preferences::SetDouble(std::string_view key, double value) {
|
void Preferences::SetDouble(std::string_view key, double value) {
|
||||||
@@ -117,6 +119,7 @@ void Preferences::PutDouble(std::string_view key, double value) {
|
|||||||
void Preferences::InitDouble(std::string_view key, double value) {
|
void Preferences::InitDouble(std::string_view key, double value) {
|
||||||
auto entry = ::GetInstance().table->GetEntry(key);
|
auto entry = ::GetInstance().table->GetEntry(key);
|
||||||
entry.SetDefaultDouble(value);
|
entry.SetDefaultDouble(value);
|
||||||
|
entry.SetPersistent();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Preferences::SetFloat(std::string_view key, float value) {
|
void Preferences::SetFloat(std::string_view key, float value) {
|
||||||
@@ -132,6 +135,7 @@ void Preferences::PutFloat(std::string_view key, float value) {
|
|||||||
void Preferences::InitFloat(std::string_view key, float value) {
|
void Preferences::InitFloat(std::string_view key, float value) {
|
||||||
auto entry = ::GetInstance().table->GetEntry(key);
|
auto entry = ::GetInstance().table->GetEntry(key);
|
||||||
entry.SetDefaultDouble(value);
|
entry.SetDefaultDouble(value);
|
||||||
|
entry.SetPersistent();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Preferences::SetBoolean(std::string_view key, bool value) {
|
void Preferences::SetBoolean(std::string_view key, bool value) {
|
||||||
@@ -147,6 +151,7 @@ void Preferences::PutBoolean(std::string_view key, bool value) {
|
|||||||
void Preferences::InitBoolean(std::string_view key, bool value) {
|
void Preferences::InitBoolean(std::string_view key, bool value) {
|
||||||
auto entry = ::GetInstance().table->GetEntry(key);
|
auto entry = ::GetInstance().table->GetEntry(key);
|
||||||
entry.SetDefaultBoolean(value);
|
entry.SetDefaultBoolean(value);
|
||||||
|
entry.SetPersistent();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Preferences::SetLong(std::string_view key, int64_t value) {
|
void Preferences::SetLong(std::string_view key, int64_t value) {
|
||||||
@@ -162,6 +167,7 @@ void Preferences::PutLong(std::string_view key, int64_t value) {
|
|||||||
void Preferences::InitLong(std::string_view key, int64_t value) {
|
void Preferences::InitLong(std::string_view key, int64_t value) {
|
||||||
auto entry = ::GetInstance().table->GetEntry(key);
|
auto entry = ::GetInstance().table->GetEntry(key);
|
||||||
entry.SetDefaultDouble(value);
|
entry.SetDefaultDouble(value);
|
||||||
|
entry.SetPersistent();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Preferences::ContainsKey(std::string_view key) {
|
bool Preferences::ContainsKey(std::string_view key) {
|
||||||
|
|||||||
@@ -109,6 +109,7 @@ public final class Preferences {
|
|||||||
public static void initString(String key, String value) {
|
public static void initString(String key, String value) {
|
||||||
NetworkTableEntry entry = m_table.getEntry(key);
|
NetworkTableEntry entry = m_table.getEntry(key);
|
||||||
entry.setDefaultString(value);
|
entry.setDefaultString(value);
|
||||||
|
entry.setPersistent();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -144,6 +145,7 @@ public final class Preferences {
|
|||||||
public static void initInt(String key, int value) {
|
public static void initInt(String key, int value) {
|
||||||
NetworkTableEntry entry = m_table.getEntry(key);
|
NetworkTableEntry entry = m_table.getEntry(key);
|
||||||
entry.setDefaultDouble(value);
|
entry.setDefaultDouble(value);
|
||||||
|
entry.setPersistent();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -179,6 +181,7 @@ public final class Preferences {
|
|||||||
public static void initDouble(String key, double value) {
|
public static void initDouble(String key, double value) {
|
||||||
NetworkTableEntry entry = m_table.getEntry(key);
|
NetworkTableEntry entry = m_table.getEntry(key);
|
||||||
entry.setDefaultDouble(value);
|
entry.setDefaultDouble(value);
|
||||||
|
entry.setPersistent();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -214,6 +217,7 @@ public final class Preferences {
|
|||||||
public static void initFloat(String key, float value) {
|
public static void initFloat(String key, float value) {
|
||||||
NetworkTableEntry entry = m_table.getEntry(key);
|
NetworkTableEntry entry = m_table.getEntry(key);
|
||||||
entry.setDefaultDouble(value);
|
entry.setDefaultDouble(value);
|
||||||
|
entry.setPersistent();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -249,6 +253,7 @@ public final class Preferences {
|
|||||||
public static void initBoolean(String key, boolean value) {
|
public static void initBoolean(String key, boolean value) {
|
||||||
NetworkTableEntry entry = m_table.getEntry(key);
|
NetworkTableEntry entry = m_table.getEntry(key);
|
||||||
entry.setDefaultBoolean(value);
|
entry.setDefaultBoolean(value);
|
||||||
|
entry.setPersistent();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -284,6 +289,7 @@ public final class Preferences {
|
|||||||
public static void initLong(String key, long value) {
|
public static void initLong(String key, long value) {
|
||||||
NetworkTableEntry entry = m_table.getEntry(key);
|
NetworkTableEntry entry = m_table.getEntry(key);
|
||||||
entry.setDefaultDouble(value);
|
entry.setDefaultDouble(value);
|
||||||
|
entry.setPersistent();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user