mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
Add removeAll to preferences (#987)
This removes all keys except for .type.
This commit is contained in:
committed by
Peter Johnson
parent
2e0709f05b
commit
f90e429bf9
@@ -222,3 +222,14 @@ bool Preferences::ContainsKey(wpi::StringRef key) {
|
||||
* @param key the key
|
||||
*/
|
||||
void Preferences::Remove(wpi::StringRef key) { m_table->Delete(key); }
|
||||
|
||||
/**
|
||||
* Remove all preferences.
|
||||
*/
|
||||
void Preferences::RemoveAll() {
|
||||
for (auto preference : GetKeys()) {
|
||||
if (preference != ".type") {
|
||||
Remove(preference);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user