From 0a9437e8dc31214bfe8f0c53e3e227929d86870e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milie=20Feral?= Date: Thu, 22 Nov 2018 09:57:20 +0100 Subject: [PATCH] [ion] Storage: add a method destroyAllRecords --- ion/include/ion/storage.h | 1 + ion/src/shared/storage.cpp | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/ion/include/ion/storage.h b/ion/include/ion/storage.h index c118fe123..80ba0f2a9 100644 --- a/ion/include/ion/storage.h +++ b/ion/include/ion/storage.h @@ -98,6 +98,7 @@ public: Record recordBaseNamedWithExtensions(const char * baseName, const char * extension[], size_t numberOfExtensions); // Record destruction + void destroyAllRecords(); void destroyRecordWithBaseNameAndExtension(const char * baseName, const char * extension); void destroyRecordsWithExtension(const char * extension); diff --git a/ion/src/shared/storage.cpp b/ion/src/shared/storage.cpp index c40e42184..57bbf98e3 100644 --- a/ion/src/shared/storage.cpp +++ b/ion/src/shared/storage.cpp @@ -214,6 +214,11 @@ Storage::Record Storage::recordBaseNamedWithExtensions(const char * baseName, co return Record(); } +void Storage::destroyAllRecords() { + overrideSizeAtPosition(m_buffer, 0); + notifyChangeToDelegate(); +} + void Storage::destroyRecordWithBaseNameAndExtension(const char * baseName, const char * extension) { recordBaseNamedWithExtension(baseName, extension).destroy(); }