From 95e65ac83084e7c2993c4fecdb1f28f44ffd55af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sat, 23 Jun 2012 03:49:10 +0200 Subject: [PATCH] AbstractImporter: strongly-typed Feature enum. Function features() now returns strongly-typed set. --- src/Trade/AbstractImporter.h | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/src/Trade/AbstractImporter.h b/src/Trade/AbstractImporter.h index 6e78bd18e..022ed5fac 100644 --- a/src/Trade/AbstractImporter.h +++ b/src/Trade/AbstractImporter.h @@ -21,6 +21,7 @@ #include "PluginManager/Plugin.h" #include "ImageData.h" +#include "Set.h" namespace Magnum { namespace Trade { @@ -52,20 +53,24 @@ class MAGNUM_EXPORT AbstractImporter: public Corrade::PluginManager::Plugin { PLUGIN_INTERFACE("cz.mosra.magnum.Trade.AbstractImporter/0.1") public: - /** @brief Features supported by this importer */ - enum Feature { + /** + * @brief Features supported by this importer + * + * @see Features, features() + */ + enum class Feature { OpenFile = 0x01, /**< Can open files specified by filename */ OpenStream = 0x02 /**< Can open files from input streams */ }; + /** @brief Set of features supported by this importer */ + typedef Set Features; + /** @brief Constructor */ inline AbstractImporter(Corrade::PluginManager::AbstractPluginManager* manager = nullptr, const std::string& plugin = ""): Plugin(manager, plugin) {} - /** - * @brief Features supported by this importer - * @return OR-ed combination of values from Feature enum. - */ - virtual int features() const = 0; + /** @brief Features supported by this importer */ + virtual Features features() const = 0; /** * @brief Open file @@ -224,6 +229,8 @@ class MAGNUM_EXPORT AbstractImporter: public Corrade::PluginManager::Plugin { /*@}*/ }; +SET_OPERATORS(AbstractImporter::Features) + }} #endif