diff --git a/include/orm/tiny/concerns/buildssoftdeletes.hpp b/include/orm/tiny/concerns/buildssoftdeletes.hpp index a3c2ab514..ed92d7687 100644 --- a/include/orm/tiny/concerns/buildssoftdeletes.hpp +++ b/include/orm/tiny/concerns/buildssoftdeletes.hpp @@ -77,17 +77,13 @@ namespace Concerns /*! Restore all trashed models (call update on deleted_at column, set to null). */ std::tuple restore(); - /*! Alias for the WithoutTrashed constraint. */ - constexpr static auto WithoutTrashed = TrashedType::WITHOUT_TRASHED; - /*! Alias for the WithTrashed constraint. */ - constexpr static auto WithTrashed = TrashedType::WITH_TRASHED; - /*! Alias for the OnlyTrashed constraint. */ - constexpr static auto OnlyTrashed = TrashedType::ONLY_TRASHED; - /*! Get the currently applied soft deletes constraint on the TinyBuilder. */ inline TrashedType currentSoftDeletes() const noexcept; protected: + /*! Expose the TrashedType enum. */ + using enum TrashedType; + /*! Get the "deleted at" column for the builder (fully qualified if joins are defined). */ QString getDeletedAtColumn(Builder &builder) const; @@ -96,7 +92,7 @@ namespace Concerns Builder &applySoftDeletes(); /*! Stores the currently applied soft deletes constraint on the TinyBuilder. */ - TrashedType m_trashed = WithoutTrashed; + TrashedType m_trashed = WITHOUT_TRASHED; /*! Is the default soft deletes constraint on the TinyBuilder enabled? */ bool m_withSoftDeletes = false; @@ -162,7 +158,7 @@ namespace Concerns Builder & BuildsSoftDeletes::withoutTrashed() { - m_trashed = WithoutTrashed; + m_trashed = WITHOUT_TRASHED; /* Disable the default soft deletes constraint on the TinyBuilder because manually overridden and we are applying another whereNull clause here. */ @@ -182,7 +178,7 @@ namespace Concerns if (!withTrashed) return withoutTrashed(); - m_trashed = WithTrashed; + m_trashed = WITH_TRASHED; // Disable the default soft deletes constraint on the TinyBuilder (withoutTrashed) disableSoftDeletes(); @@ -194,7 +190,7 @@ namespace Concerns Builder & BuildsSoftDeletes::onlyTrashed() { - m_trashed = OnlyTrashed; + m_trashed = ONLY_TRASHED; /* Disable the default soft deletes constraint on the TinyBuilder because manually overridden and we are applying another whereNotNull clause here. */ diff --git a/include/orm/tiny/model.hpp b/include/orm/tiny/model.hpp index 8877c1ad1..c7f07aeb8 100644 --- a/include/orm/tiny/model.hpp +++ b/include/orm/tiny/model.hpp @@ -423,13 +423,17 @@ namespace Orm::Tiny /*! Method to call in the incrementOrDecrement(). */ enum struct IncrementOrDecrement : quint8 { + /*! Call the increment() method. */ INCREMENT, + /*! Call the decrement() method. */ DECREMENT, }; /*! Call the increment() method. */ constexpr static auto Increment = IncrementOrDecrement::INCREMENT; /*! Call the decrement() method. */ constexpr static auto Decrement = IncrementOrDecrement::DECREMENT; + /* Don't use using enum here as it can't name dependent type. + See: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1099r5.html */ /*! Run the increment or decrement method on the model. */ template requires std::is_arithmetic_v diff --git a/tom/include/tom/application.hpp b/tom/include/tom/application.hpp index aaabf30c0..0bc90ed00 100644 --- a/tom/include/tom/application.hpp +++ b/tom/include/tom/application.hpp @@ -179,12 +179,8 @@ namespace Concerns /*! Show a command not defined error wall. */ ShowErrorWall, }; - /*! Show all commands list using the list command. */ - constexpr static CommandNotFound - ShowCommandsList = CommandNotFound::ShowCommandsList; - /*! Show a command not defined error wall. */ - constexpr static CommandNotFound - ShowErrorWall = CommandNotFound::ShowErrorWall; + /*! Expose the CommandNotFound enum. */ + using enum CommandNotFound; /*! Get the command name including the guess command name logic. */ QString getCommandName(const QString &name, CommandNotFound notFound); diff --git a/tom/include/tom/commands/completecommand.hpp b/tom/include/tom/commands/completecommand.hpp index 0889f842f..064520513 100644 --- a/tom/include/tom/commands/completecommand.hpp +++ b/tom/include/tom/commands/completecommand.hpp @@ -81,18 +81,20 @@ namespace Tom::Commands getCommandOptionsSignature(const std::optional &command) const; /*! Option type (long/short). */ - enum struct OptionType : qint8 + enum struct OptionType : quint8 { - UNDEFINED = -1, + /*! Consider both long and short option arguments. */ + ANY, + /*! Long option argument. */ LONG, + /*! Short option argument. */ SHORT, }; - constexpr static auto UNDEFINED = OptionType::UNDEFINED; - constexpr static auto LONG = OptionType::LONG; - constexpr static auto SHORT = OptionType::SHORT; + /*! Expose the OptionType enum. */ + using enum OptionType; /*! Determine whether the given word is an option argument. */ - static bool isOptionArgument(const QString &wordArg, OptionType type = UNDEFINED); + static bool isOptionArgument(const QString &wordArg, OptionType type = ANY); /*! Determine whether the given word is a long option argument. */ inline static bool isLongOption(const QString &wordArg); /*! Determine whether the given word is a short option argument. */ diff --git a/tom/include/tom/concerns/interactswithio.hpp b/tom/include/tom/concerns/interactswithio.hpp index d9b57c5ac..a42a4c913 100644 --- a/tom/include/tom/concerns/interactswithio.hpp +++ b/tom/include/tom/concerns/interactswithio.hpp @@ -78,22 +78,19 @@ namespace Concerns /*! Verbosity levels. */ enum struct Verbosity : quint8 { + /*! Quiet verbosity. */ Quiet = 0x0001, + /*! Normal verbosity (default). */ Normal = 0x0002, + /*! Verbose verbosity. */ Verbose = 0x0004, + /*! Very verbose verbosity. */ VeryVerbose = 0x0008, + /*! Debug verbosity. */ Debug = 0x0010, }; - /*! Quiet verbosity. */ - constexpr static Verbosity Quiet = Verbosity::Quiet; - /*! Normal verbosity (default). */ - constexpr static Verbosity Normal = Verbosity::Normal; - /*! Verbose verbosity. */ - constexpr static Verbosity Verbose = Verbosity::Verbose; - /*! Very verbose verbosity. */ - constexpr static Verbosity VeryVerbose = Verbosity::VeryVerbose; - /*! Debug verbosity. */ - constexpr static Verbosity Debug = Verbosity::Debug; + /*! Expose the Verbosity enum. */ + using enum Verbosity; /*! Write a string as standard output. */ const InteractsWithIO &line(const QString &string, bool newline = true, diff --git a/tom/src/tom/commands/completecommand.cpp b/tom/src/tom/commands/completecommand.cpp index ceea170b7..74f2a2aaa 100644 --- a/tom/src/tom/commands/completecommand.cpp +++ b/tom/src/tom/commands/completecommand.cpp @@ -666,7 +666,8 @@ bool CompleteCommand::isOptionArgument(const QString &wordArg, const OptionType const auto isLong = wordArg.startsWith(DoubleDash); const auto isShort = isLong ? false : wordArg.startsWith(DASH); - if (type == UNDEFINED) + // Consider both long and short option arguments + if (type == ANY) return isLong || isShort; if (type == LONG)