Add removeAll to preferences (#987)

This removes all keys except for .type.
This commit is contained in:
Austin Shalit
2018-05-16 22:50:35 -04:00
committed by Peter Johnson
parent 2e0709f05b
commit f90e429bf9
4 changed files with 43 additions and 0 deletions

View File

@@ -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);
}
}
}