From b30d1d96c5f0bdb077fdd6c8cb08f533b12048d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Fri, 3 Aug 2012 15:36:25 +0200 Subject: [PATCH] Moved Set utility class to Corrade, since it's now C++11 enabled. --- src/Framebuffer.h | 7 ++- src/Set.h | 113 ----------------------------------- src/Trade/AbstractImporter.h | 4 +- 3 files changed, 6 insertions(+), 118 deletions(-) delete mode 100644 src/Set.h diff --git a/src/Framebuffer.h b/src/Framebuffer.h index f1a382567..f88a47637 100644 --- a/src/Framebuffer.h +++ b/src/Framebuffer.h @@ -19,11 +19,12 @@ * @brief Class Magnum::Framebuffer */ +#include + #include "BufferedImage.h" #include "CubeMapTexture.h" #include "Image.h" #include "Renderbuffer.h" -#include "Set.h" namespace Magnum { @@ -75,7 +76,7 @@ class MAGNUM_EXPORT Framebuffer { Stencil = GL_STENCIL_BUFFER_BIT /**< Stencil value */ }; - typedef Set ClearMask; /**< @brief Mask for clearing */ + typedef Corrade::Utility::Set ClearMask; /**< @brief Mask for clearing */ /** * @brief %Framebuffer target @@ -181,7 +182,7 @@ class MAGNUM_EXPORT Framebuffer { * @brief Output mask for blitting * @requires_gl30 Extension @extension{EXT,framebuffer_object} */ - typedef Set BlitMask; + typedef Corrade::Utility::Set BlitMask; /** @brief Set feature */ static void setFeature(Feature feature, bool enabled); diff --git a/src/Set.h b/src/Set.h deleted file mode 100644 index c693c8a33..000000000 --- a/src/Set.h +++ /dev/null @@ -1,113 +0,0 @@ -#ifndef Magnum_Set_h -#define Magnum_Set_h -/* - Copyright © 2010, 2011, 2012 Vladimír Vondruš - - This file is part of Magnum. - - Magnum is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License version 3 - only, as published by the Free Software Foundation. - - Magnum is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License version 3 for more details. -*/ - -/** @file - * @brief Class Magnum::Set - */ - -namespace Magnum { - -/** @ingroup utility -@brief %Set -@tparam T Enum type -@tparam U Underlying type of the enum - -Provides strongly-typed set-like functionality for strongly typed enums, such -as binary OR and AND operations. The only requirement for enum type is that -all the values must be binary exclusive. - -Desired usage is via typedef'ing and then calling SET_OPERATORS() macro with -the resulting type as parameter to have all the operators implemented. -@code -enum class State: unsigned char { - Ready = 0x01, - Waiting = 0x02, - Done = 0x04 -}; - -typedef Set States; -SET_OPERATORS(States) -@endcode -*/ -template class Set { - public: - typedef T Type; /**< @brief Enum type */ - typedef U UnderlyingType; /**< @brief Underlying type of the enum */ - - /** @brief Create empty set */ - inline constexpr Set(): value() {} - - /** @brief Create set from one value */ - inline constexpr Set(T value): value(static_cast(value)) {} - - /** @brief Union of two sets */ - inline constexpr Set operator|(Set other) const { - return Set(value | other.value); - } - - /** @brief Union two sets and assign */ - inline Set& operator|=(Set other) { - value |= other.value; - return *this; - } - - /** @brief Intersection of two sets */ - inline constexpr Set operator&(Set other) const { - return Set(value & other.value); - } - - /** @brief Intersect two sets and assign */ - inline Set& operator&=(Set other) { - value &= other.value; - return *this; - } - - /** @brief Set complement */ - inline constexpr Set operator~() const { - return Set(~value); - } - - /** @brief Value as boolean */ - inline constexpr explicit operator bool() const { - return value == 0; - } - - /** @brief Value in underlying type */ - inline constexpr explicit operator UnderlyingType() const { - return value; - } - - private: - inline constexpr explicit Set(UnderlyingType type): value(type) {} - - UnderlyingType value; -}; - -/** @hideinitializer -@brief Define out-of-class operators for given Set implementation -*/ -#define SET_OPERATORS(class) \ - inline constexpr class operator|(class::Type a, class b) { \ - return b | a; \ - } \ - inline constexpr class operator&(class::Type a, class b) { \ - return b & a; \ - } - -} - -#endif diff --git a/src/Trade/AbstractImporter.h b/src/Trade/AbstractImporter.h index dc0677a78..03f3d0729 100644 --- a/src/Trade/AbstractImporter.h +++ b/src/Trade/AbstractImporter.h @@ -19,10 +19,10 @@ * @brief Class Magnum::Trade::AbstractImporter */ +#include #include #include "ImageData.h" -#include "Set.h" namespace Magnum { namespace Trade { @@ -65,7 +65,7 @@ class MAGNUM_EXPORT AbstractImporter: public Corrade::PluginManager::Plugin { }; /** @brief Set of features supported by this importer */ - typedef Set Features; + typedef Corrade::Utility::Set Features; /** @brief Constructor */ inline AbstractImporter(Corrade::PluginManager::AbstractPluginManager* manager = nullptr, const std::string& plugin = ""): Plugin(manager, plugin) {}