From 29596baa92a136486ec3709e073db3eb9615c6d2 Mon Sep 17 00:00:00 2001 From: amai2012 Date: Thu, 1 Aug 2019 20:56:02 +0200 Subject: [PATCH] Refactoring: Convert enum Direction to enum class --- lib/library.h | 4 ++-- test/testlibrary.cpp | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/library.h b/lib/library.h index a795b90d8..68a8c2ee4 100644 --- a/lib/library.h +++ b/lib/library.h @@ -248,7 +248,7 @@ public: optional(false), variadic(false), iteratorInfo(), - direction(DIR_UNKNOWN) { + direction(Direction::DIR_UNKNOWN) { } bool notbool; @@ -282,7 +282,7 @@ public: }; std::vector minsizes; - enum Direction { + enum class Direction { DIR_IN, ///< Input to called function. Data is treated as read-only. DIR_OUT, ///< Output to caller. Data is passed by reference or address and is potentially written. DIR_INOUT, ///< Input to called function, and output to caller. Data is passed by reference or address and is potentially modified. diff --git a/test/testlibrary.cpp b/test/testlibrary.cpp index bf34a06bf..89ef70646 100644 --- a/test/testlibrary.cpp +++ b/test/testlibrary.cpp @@ -294,10 +294,10 @@ private: tokenList.createTokens(istr); tokenList.front()->next()->astOperand1(tokenList.front()); - ASSERT_EQUALS(Library::ArgumentChecks::Direction::DIR_IN, library.getArgDirection(tokenList.front(), 1)); - ASSERT_EQUALS(Library::ArgumentChecks::Direction::DIR_OUT, library.getArgDirection(tokenList.front(), 2)); - ASSERT_EQUALS(Library::ArgumentChecks::Direction::DIR_INOUT, library.getArgDirection(tokenList.front(), 3)); - ASSERT_EQUALS(Library::ArgumentChecks::Direction::DIR_UNKNOWN, library.getArgDirection(tokenList.front(), 4)); + ASSERT(Library::ArgumentChecks::Direction::DIR_IN == library.getArgDirection(tokenList.front(), 1)); + ASSERT(Library::ArgumentChecks::Direction::DIR_OUT == library.getArgDirection(tokenList.front(), 2)); + ASSERT(Library::ArgumentChecks::Direction::DIR_INOUT == library.getArgDirection(tokenList.front(), 3)); + ASSERT(Library::ArgumentChecks::Direction::DIR_UNKNOWN == library.getArgDirection(tokenList.front(), 4)); } void function_arg_valid() const {