diff options
author | Jannis M. Hoffmann <jannis@fehcom.de> | 2023-10-11 19:28:50 +0200 |
---|---|---|
committer | Jannis M. Hoffmann <jannis@fehcom.de> | 2023-10-11 19:28:50 +0200 |
commit | 3ea7edf8c9bf7583c426178d4aaff4fb5b736bd2 (patch) | |
tree | ae78ebf9e9d1f70da8a6fdad1504063644ee8f1e /src/operator-fetch.cc | |
parent | 1a7c572099edf744d6bb67318cff215de3fcd897 (diff) |
use some enum classes
move ParseResult to recursivedescent.h
Diffstat (limited to 'src/operator-fetch.cc')
-rw-r--r-- | src/operator-fetch.cc | 42 |
1 files changed, 23 insertions, 19 deletions
diff --git a/src/operator-fetch.cc b/src/operator-fetch.cc index be6cbba..7de2fbb 100644 --- a/src/operator-fetch.cc +++ b/src/operator-fetch.cc @@ -1,8 +1,8 @@ /** - * @file operator-fetch.cc - * @brief Implementation of the FETCH command - * @author Andreas Aardal Hanssen - * @date 2002-2005 + * @file operator-fetch.cc + * @brief Implementation of the FETCH command + * @author Andreas Aardal Hanssen + * @date 2002-2005 */ #include "convert.h" @@ -22,6 +22,10 @@ using namespace Binc; using std::string; using std::vector; +constexpr auto ACCEPT = Parser::ParseResult::ACCEPT; +constexpr auto ERROR = Parser::ParseResult::ERROR; +constexpr auto REJECT = Parser::ParseResult::REJECT; + namespace { void outputFlags(const Message &message) { @@ -62,7 +66,7 @@ const string FetchOperator::getName() const return "FETCH"; } -int FetchOperator::getState() const +Session::State FetchOperator::getState() const { return Session::SELECTED; } @@ -358,14 +362,14 @@ Operator::ProcessResult FetchOperator::process(Depot &depot, Request &request) | PendingUpdates::RECENT, true); - return OK; + return Operator::ProcessResult::OK; } -Operator::ParseResult FetchOperator::parse(Request &c_in) const +Parser::ParseResult FetchOperator::parse(Request &c_in) { Session &session = Session::getInstance(); - Operator::ParseResult res; + Parser::ParseResult res; if ((res = expectSPACE()) != ACCEPT) { session.setLastError("Expected SPACE after FETCH"); return res; @@ -428,11 +432,11 @@ Operator::ParseResult FetchOperator::parse(Request &c_in) const return ACCEPT; } -Operator::ParseResult FetchOperator::expectSectionText(BincImapParserFetchAtt &f_in) const +Parser::ParseResult FetchOperator::expectSectionText(BincImapParserFetchAtt &f_in) const { Session &session = Session::getInstance(); - Operator::ParseResult res; + Parser::ParseResult res; if ((res = expectThisString("HEADER")) == ACCEPT) { f_in.sectiontext = "HEADER"; @@ -454,17 +458,17 @@ Operator::ParseResult FetchOperator::expectSectionText(BincImapParserFetchAtt &f } else if ((res = expectThisString("TEXT")) == ACCEPT) { f_in.sectiontext = "TEXT"; } else { - return REJECT; + return Parser::ParseResult::REJECT; } return ACCEPT; } -Operator::ParseResult FetchOperator::expectSection(BincImapParserFetchAtt &f_in) const +Parser::ParseResult FetchOperator::expectSection(BincImapParserFetchAtt &f_in) const { Session &session = Session::getInstance(); - Operator::ParseResult res; + Parser::ParseResult res; if ((res = expectThisString("[")) != ACCEPT) return REJECT; if ((res = expectSectionText(f_in)) != ACCEPT) { @@ -508,11 +512,11 @@ Operator::ParseResult FetchOperator::expectSection(BincImapParserFetchAtt &f_in) return ACCEPT; } -Operator::ParseResult FetchOperator::expectHeaderList(BincImapParserFetchAtt &f_in) const +Parser::ParseResult FetchOperator::expectHeaderList(BincImapParserFetchAtt &f_in) const { Session &session = Session::getInstance(); - Operator::ParseResult res; + Parser::ParseResult res; if ((res = expectThisString("(")) != ACCEPT) return REJECT; string header_fld_name; @@ -538,10 +542,10 @@ Operator::ParseResult FetchOperator::expectHeaderList(BincImapParserFetchAtt &f_ return ACCEPT; } -Operator::ParseResult FetchOperator::expectOffset(BincImapParserFetchAtt &f_in) const +Parser::ParseResult FetchOperator::expectOffset(BincImapParserFetchAtt &f_in) const { Session &session = Session::getInstance(); - Operator::ParseResult res; + Parser::ParseResult res; if ((res = expectThisString("<")) != ACCEPT) return REJECT; @@ -572,9 +576,9 @@ Operator::ParseResult FetchOperator::expectOffset(BincImapParserFetchAtt &f_in) return ACCEPT; } -Operator::ParseResult FetchOperator::expectFetchAtt(BincImapParserFetchAtt &f_in) const +Parser::ParseResult FetchOperator::expectFetchAtt(BincImapParserFetchAtt &f_in) const { - Operator::ParseResult res; + Parser::ParseResult res; Session &session = Session::getInstance(); |