summaryrefslogtreecommitdiff
path: root/src/file/settings/parser.cpp
diff options
context:
space:
mode:
authorclaiff <claiff@mail.ru>2022-10-05 16:02:06 +0300
committerclaiff <claiff@mail.ru>2022-10-05 16:02:06 +0300
commit3f1f70a3b945605c6abb7d23f46042b963db243a (patch)
treec7ae9c113d29aa3350eca04f27a933bd3b5f769c /src/file/settings/parser.cpp
parent9ed43c1057eeec6a01b8fdfd4d2ee54f9df39670 (diff)
parent43e721305c866ad4b2c4c35d1133f169e41dd49b (diff)
downloadobmc-sila-smtp-3f1f70a3b945605c6abb7d23f46042b963db243a.tar.xz
Merge branch 'devtool' into refactor/3009refactor/3009
Diffstat (limited to 'src/file/settings/parser.cpp')
-rw-r--r--src/file/settings/parser.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/file/settings/parser.cpp b/src/file/settings/parser.cpp
new file mode 100644
index 0000000..b692ac3
--- /dev/null
+++ b/src/file/settings/parser.cpp
@@ -0,0 +1,20 @@
+#include "parser.hpp"
+
+namespace smtp::file::parser
+{
+ ParseResult Settings::Parse( std::string const& line ) const
+ {
+ static constexpr char DELIMITER = '=';
+ static constexpr size_t ZERO_POSITION = 0;
+ static constexpr size_t NEXT_POSITION = 1;
+
+ auto position = line.find(DELIMITER);
+ if( position == std::string::npos)
+ {
+ return {};
+ }
+ auto first_part = line.substr( ZERO_POSITION, position );
+ auto second_part = line.substr(position + NEXT_POSITION, line.length());
+ return {first_part, second_part};
+ }
+}