[libcalamares] Add a clear() to GlobalStorage

While this isn't useful in production, it makes tests a lot
simpler to write since you don't have to wrestle with
creating new GS objects in order to start fresh.
This commit is contained in:
Adriaan de Groot 2023-11-12 22:41:02 +01:00
parent f07e31de29
commit d9aeb88275
2 changed files with 10 additions and 0 deletions

View File

@ -88,6 +88,13 @@ GlobalStorage::remove( const QString& key )
return nItems; return nItems;
} }
void
GlobalStorage::clear()
{
WriteLock l( this );
m.clear();
}
QVariant QVariant
GlobalStorage::value( const QString& key ) const GlobalStorage::value( const QString& key ) const
{ {

View File

@ -70,6 +70,9 @@ public:
*/ */
int remove( const QString& key ); int remove( const QString& key );
/// @brief Clears all keys in this GS object
void clear();
/** @brief dump keys and values to the debug log /** @brief dump keys and values to the debug log
* *
* All the keys and their values are written to the debug log. * All the keys and their values are written to the debug log.