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-create.cc | |
parent | 1a7c572099edf744d6bb67318cff215de3fcd897 (diff) |
use some enum classes
move ParseResult to recursivedescent.h
Diffstat (limited to 'src/operator-create.cc')
-rw-r--r-- | src/operator-create.cc | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/operator-create.cc b/src/operator-create.cc index 4269c7a..399e740 100644 --- a/src/operator-create.cc +++ b/src/operator-create.cc @@ -26,29 +26,30 @@ const std::string CreateOperator::getName() const return "CREATE"; } -int CreateOperator::getState() const +Session::State CreateOperator::getState() const { - return Session::AUTHENTICATED | Session::SELECTED; + return Session::State(Session::AUTHENTICATED | Session::SELECTED); } Operator::ProcessResult CreateOperator::process(Depot &depot, Request &command) { if (depot.createMailbox(command.getMailbox())) { - return OK; + return Operator::ProcessResult::OK; } else { Session &session = Session::getInstance(); session.setLastError(depot.getLastError()); - return NO; + return Operator::ProcessResult::NO; } } -Operator::ParseResult CreateOperator::parse(Request &c_in) const +Parser::ParseResult CreateOperator::parse(Request &c_in) { + constexpr auto ACCEPT = Parser::ParseResult::ACCEPT; Session &session = Session::getInstance(); - if (c_in.getUidMode()) return REJECT; + if (c_in.getUidMode()) return Parser::ParseResult::REJECT; - Operator::ParseResult res; + Parser::ParseResult res; if ((res = expectSPACE()) != ACCEPT) { session.setLastError("Expected SPACE after CREATE"); return res; |