diff options
author | claiff <claiff@mail.ru> | 2022-10-05 16:03:08 +0300 |
---|---|---|
committer | claiff <claiff@mail.ru> | 2022-10-05 16:03:08 +0300 |
commit | 8edef99a5b52643e0b919c424357752cbbc9a8dd (patch) | |
tree | c7ae9c113d29aa3350eca04f27a933bd3b5f769c /src/file/settings/checker_decorator.cpp | |
parent | 2b03fece7f5895591eabd2f04baa2df19b4c3417 (diff) | |
parent | 3f1f70a3b945605c6abb7d23f46042b963db243a (diff) | |
download | obmc-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.cpp | 42 |
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; + } +} |