summaryrefslogtreecommitdiff
path: root/src/file/settings/checker_decorator.cpp
diff options
context:
space:
mode:
authorclaiff <claiff@mail.ru>2022-10-05 16:03:08 +0300
committerclaiff <claiff@mail.ru>2022-10-05 16:03:08 +0300
commit8edef99a5b52643e0b919c424357752cbbc9a8dd (patch)
treec7ae9c113d29aa3350eca04f27a933bd3b5f769c /src/file/settings/checker_decorator.cpp
parent2b03fece7f5895591eabd2f04baa2df19b4c3417 (diff)
parent3f1f70a3b945605c6abb7d23f46042b963db243a (diff)
downloadobmc-sila-smtp-8edef99a5b52643e0b919c424357752cbbc9a8dd.tar.xz
Merge branch 'refactor/3009'
Diffstat (limited to 'src/file/settings/checker_decorator.cpp')
-rw-r--r--src/file/settings/checker_decorator.cpp42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/file/settings/checker_decorator.cpp b/src/file/settings/checker_decorator.cpp
new file mode 100644
index 0000000..ef560ad
--- /dev/null
+++ b/src/file/settings/checker_decorator.cpp
@@ -0,0 +1,42 @@
+#include "checker_decorator.hpp"
+
+namespace smtp::file::settings
+{
+
+ //
+ //Constructors
+ //
+
+ CheckerDecorator::CheckerDecorator( checker::RegistratorSettings const& registrator_errors )
+ : mRegistratorErrors( registrator_errors )
+ {
+ }
+
+ //
+ //Public methods
+ //
+
+ manage::SettingsFileDataType CheckerDecorator::Read() const
+ {
+ manage::SettingsFileDataType result;
+ if(!mBase)
+ {
+ return result;
+ }
+ result = mBase->Read();
+ return mRegistratorErrors.Check( result ) ? result : manage::SettingsFileDataType{};
+ }
+
+ bool CheckerDecorator::Write( manage::SettingsFileDataType const& settings_fields ) const
+ {
+ if( !mBase )
+ {
+ return false;
+ }
+ if( mRegistratorErrors.Check( settings_fields ) )
+ {
+ return mBase->Write(settings_fields);
+ }
+ return false;
+ }
+}