summaryrefslogtreecommitdiff
path: root/lib/persistence.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/persistence.cpp')
-rw-r--r--lib/persistence.cpp29
1 files changed, 19 insertions, 10 deletions
diff --git a/lib/persistence.cpp b/lib/persistence.cpp
index b85bff2..405c7ec 100644
--- a/lib/persistence.cpp
+++ b/lib/persistence.cpp
@@ -38,7 +38,7 @@ namespace Persistence {
PersistenceSelect::PersistenceSelect(const std::string & n) : name {n} { }
PersistenceStore::NameAction
- PersistenceSelect::setName(const std::string_view key)
+ PersistenceSelect::setName(const std::string_view key, const Selection &)
{
return (key == name) ? NameAction::Push : NameAction::Ignore;
}
@@ -51,16 +51,19 @@ namespace Persistence {
PersistenceWrite::PersistenceWrite(const Writer & o, bool sh) : out {o}, shared {sh} { }
PersistenceStore::NameAction
- PersistenceWrite::setName(const std::string_view key)
- {
- if (!first) {
- out.nextValue();
- }
- else {
- first = false;
+ PersistenceWrite::setName(const std::string_view key, const Selection & s)
+ {
+ if (s.needsWrite()) {
+ if (!first) {
+ out.nextValue();
+ }
+ else {
+ first = false;
+ }
+ out.pushKey(key);
+ return NameAction::HandleAndContinue;
}
- out.pushKey(key);
- return NameAction::HandleAndContinue;
+ return NameAction::Ignore;
}
void
@@ -135,6 +138,12 @@ namespace Persistence {
{
}
+ bool
+ Selection::needsWrite() const
+ {
+ return true;
+ }
+
void
Selection::write(const Writer &) const
{