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) #if !defined(MAGNUM_BUILD_DEPRECATED) || defined(DOXYGEN_GENERATING_OUTPUT)
Containers::Optional<MaterialData> Containers::Optional<MaterialData>
#else #else
OptionalButAlsoPointer<MaterialData> Implementation::OptionalButAlsoPointer<MaterialData>
#endif #endif
AbstractImporter::material(const UnsignedInt id) { AbstractImporter::material(const UnsignedInt id) {
CORRADE_ASSERT(isOpened(), "Trade::AbstractImporter::material(): no file opened", {}); 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 */ /* GCC 4.8 and clang-cl needs an explicit conversion here */
#ifdef MAGNUM_BUILD_DEPRECATED #ifdef MAGNUM_BUILD_DEPRECATED
return OptionalButAlsoPointer<MaterialData>{std::move(material)}; return Implementation::OptionalButAlsoPointer<MaterialData>{std::move(material)};
#else #else
return material; return material;
#endif #endif
@ -1259,7 +1259,7 @@ Containers::Optional<MaterialData> AbstractImporter::doMaterial(UnsignedInt) {
#if !defined(MAGNUM_BUILD_DEPRECATED) || defined(DOXYGEN_GENERATING_OUTPUT) #if !defined(MAGNUM_BUILD_DEPRECATED) || defined(DOXYGEN_GENERATING_OUTPUT)
Containers::Optional<MaterialData> Containers::Optional<MaterialData>
#else #else
OptionalButAlsoPointer<MaterialData> Implementation::OptionalButAlsoPointer<MaterialData>
#endif #endif
AbstractImporter::material(const std::string& name) { AbstractImporter::material(const std::string& name) {
CORRADE_ASSERT(isOpened(), "Trade::AbstractImporter::material(): no file opened", {}); 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); MAGNUM_TRADE_EXPORT Debug& operator<<(Debug& debug, ImporterFlags value);
#if defined(MAGNUM_BUILD_DEPRECATED) && !defined(DOXYGEN_GENERATING_OUTPUT) #ifdef MAGNUM_BUILD_DEPRECATED
/* Could be a concrete type as only MaterialData need this, but that would namespace Implementation {
mean I'd need to include MaterialData here */ /* Could be a concrete type as only MaterialData need this, but that would
template<class T> struct OptionalButAlsoPointer: Containers::Optional<T> { mean I'd need to include MaterialData here */
/*implicit*/ OptionalButAlsoPointer() = default; template<class T> struct OptionalButAlsoPointer: Containers::Optional<T> {
/*implicit*/ OptionalButAlsoPointer(Containers::Optional<T>&& optional): Containers::Optional<T>{std::move(optional)} {} /*implicit*/ OptionalButAlsoPointer() = default;
CORRADE_DEPRECATED("use Containers::Optional instead of Containers::Pointer for a MaterialData") /*implicit*/ operator Containers::Pointer<T>() && { /*implicit*/ OptionalButAlsoPointer(Containers::Optional<T>&& optional): Containers::Optional<T>{std::move(optional)} {}
return Containers::Pointer<T>{new T{std::move(**this)}}; 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 #endif
/** /**
@ -1417,7 +1419,7 @@ class MAGNUM_TRADE_EXPORT AbstractImporter: public PluginManager::AbstractManagi
#if !defined(MAGNUM_BUILD_DEPRECATED) || defined(DOXYGEN_GENERATING_OUTPUT) #if !defined(MAGNUM_BUILD_DEPRECATED) || defined(DOXYGEN_GENERATING_OUTPUT)
Containers::Optional<MaterialData> Containers::Optional<MaterialData>
#else #else
OptionalButAlsoPointer<MaterialData> Implementation::OptionalButAlsoPointer<MaterialData>
#endif #endif
material(UnsignedInt id); material(UnsignedInt id);
@ -1434,7 +1436,7 @@ class MAGNUM_TRADE_EXPORT AbstractImporter: public PluginManager::AbstractManagi
#if !defined(MAGNUM_BUILD_DEPRECATED) || defined(DOXYGEN_GENERATING_OUTPUT) #if !defined(MAGNUM_BUILD_DEPRECATED) || defined(DOXYGEN_GENERATING_OUTPUT)
Containers::Optional<MaterialData> Containers::Optional<MaterialData>
#else #else
OptionalButAlsoPointer<MaterialData> Implementation::OptionalButAlsoPointer<MaterialData>
#endif #endif
material(const std::string& name); material(const std::string& name);

Loading…
Cancel
Save