summaryrefslogtreecommitdiff
path: root/src/file/settings/checker_decorator.cpp
diff options
context:
space:
mode:
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;
+ }
+}