Browse Source

Trade: hide the deprecated OptionalButAlsoPointer helper.

Not useful to have it directly in the Trade namespace.
pull/556/head
Vladimír Vondruš 4 years ago
parent
commit
5352361e0c
  1. 6
      src/Magnum/Trade/AbstractImporter.cpp
  2. 26
      src/Magnum/Trade/AbstractImporter.h

6
src/Magnum/Trade/AbstractImporter.cpp

@ -1232,7 +1232,7 @@ std::string AbstractImporter::doMaterialName(UnsignedInt) { return {}; }
#if !defined(MAGNUM_BUILD_DEPRECATED) || defined(DOXYGEN_GENERATING_OUTPUT)
Containers::Optional<MaterialData>
#else
OptionalButAlsoPointer<MaterialData>
Implementation::OptionalButAlsoPointer<MaterialData>
#endif
AbstractImporter::material(const UnsignedInt id) {
CORRADE_ASSERT(isOpened(), "Trade::AbstractImporter::material(): no file opened", {});
@ -1246,7 +1246,7 @@ AbstractImporter::material(const UnsignedInt id) {
/* GCC 4.8 and clang-cl needs an explicit conversion here */
#ifdef MAGNUM_BUILD_DEPRECATED
return OptionalButAlsoPointer<MaterialData>{std::move(material)};
return Implementation::OptionalButAlsoPointer<MaterialData>{std::move(material)};
#else
return material;
#endif
@ -1259,7 +1259,7 @@ Containers::Optional<MaterialData> AbstractImporter::doMaterial(UnsignedInt) {
#if !defined(MAGNUM_BUILD_DEPRECATED) || defined(DOXYGEN_GENERATING_OUTPUT)
Containers::Optional<MaterialData>
#else
OptionalButAlsoPointer<MaterialData>
Implementation::OptionalButAlsoPointer<MaterialData>
#endif
AbstractImporter::material(const std::string& name) {
CORRADE_ASSERT(isOpened(), "Trade::AbstractImporter::material(): no file opened", {});

26
src/Magnum/Trade/AbstractImporter.h

@ -138,16 +138,18 @@ MAGNUM_TRADE_EXPORT Debug& operator<<(Debug& debug, ImporterFlag value);
*/
MAGNUM_TRADE_EXPORT Debug& operator<<(Debug& debug, ImporterFlags value);
#if defined(MAGNUM_BUILD_DEPRECATED) && !defined(DOXYGEN_GENERATING_OUTPUT)
/* Could be a concrete type as only MaterialData need this, but that would
mean I'd need to include MaterialData here */
template<class T> struct OptionalButAlsoPointer: Containers::Optional<T> {
/*implicit*/ OptionalButAlsoPointer() = default;
/*implicit*/ OptionalButAlsoPointer(Containers::Optional<T>&& optional): Containers::Optional<T>{std::move(optional)} {}
CORRADE_DEPRECATED("use Containers::Optional instead of Containers::Pointer for a MaterialData") /*implicit*/ operator Containers::Pointer<T>() && {
return Containers::Pointer<T>{new T{std::move(**this)}};
}
};
#ifdef MAGNUM_BUILD_DEPRECATED
namespace Implementation {
/* Could be a concrete type as only MaterialData need this, but that would
mean I'd need to include MaterialData here */
template<class T> struct OptionalButAlsoPointer: Containers::Optional<T> {
/*implicit*/ OptionalButAlsoPointer() = default;
/*implicit*/ OptionalButAlsoPointer(Containers::Optional<T>&& optional): Containers::Optional<T>{std::move(optional)} {}
CORRADE_DEPRECATED("use Containers::Optional instead of Containers::Pointer for a MaterialData") /*implicit*/ operator Containers::Pointer<T>() && {
return Containers::Pointer<T>{new T{std::move(**this)}};
}
};
}
#endif
/**
@ -1417,7 +1419,7 @@ class MAGNUM_TRADE_EXPORT AbstractImporter: public PluginManager::AbstractManagi
#if !defined(MAGNUM_BUILD_DEPRECATED) || defined(DOXYGEN_GENERATING_OUTPUT)
Containers::Optional<MaterialData>
#else
OptionalButAlsoPointer<MaterialData>
Implementation::OptionalButAlsoPointer<MaterialData>
#endif
material(UnsignedInt id);
@ -1434,7 +1436,7 @@ class MAGNUM_TRADE_EXPORT AbstractImporter: public PluginManager::AbstractManagi
#if !defined(MAGNUM_BUILD_DEPRECATED) || defined(DOXYGEN_GENERATING_OUTPUT)
Containers::Optional<MaterialData>
#else
OptionalButAlsoPointer<MaterialData>
Implementation::OptionalButAlsoPointer<MaterialData>
#endif
material(const std::string& name);

Loading…
Cancel
Save