Skip to content

Commit

Permalink
OgreAny: deprecate all but any_cast
Browse files Browse the repository at this point in the history
  • Loading branch information
paroj committed Jan 11, 2017
1 parent 156cc1d commit 550be32
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
14 changes: 7 additions & 7 deletions Components/HLMS/src/OgreHlmsManager.cpp
Expand Up @@ -66,7 +66,7 @@ namespace Ogre
if (hlmsMatBindingAny.isEmpty())
continue;

HlmsMatBindingMap* hlmsMatBindingMap = hlmsMatBindingAny.get<HlmsMatBindingMap*>();
HlmsMatBindingMap* hlmsMatBindingMap = any_cast<HlmsMatBindingMap*>(hlmsMatBindingAny);

HlmsMatBindingMap::iterator bindingIt = hlmsMatBindingMap->begin();
HlmsMatBindingMap::iterator bindingItEnd = hlmsMatBindingMap->end();
Expand All @@ -89,7 +89,7 @@ namespace Ogre
if (hlmsMatBindingAny.isEmpty())
continue;

HlmsMatBindingMap* hlmsMatBindingMap = hlmsMatBindingAny.get<HlmsMatBindingMap*>();
HlmsMatBindingMap* hlmsMatBindingMap = any_cast<HlmsMatBindingMap*>(hlmsMatBindingAny);

HlmsMatBindingMap::iterator bindingIt = hlmsMatBindingMap->begin();
HlmsMatBindingMap::iterator bindingItEnd = hlmsMatBindingMap->end();
Expand Down Expand Up @@ -176,7 +176,7 @@ namespace Ogre
return;

// get the bounded material for the current pass
HlmsMatBindingMap* hlmsMatBindingMap = hlmsMatBindingAny.get<HlmsMatBindingMap*>();
HlmsMatBindingMap* hlmsMatBindingMap = any_cast<HlmsMatBindingMap*>(hlmsMatBindingAny);
HlmsMatBindingMap::iterator bindingIt = hlmsMatBindingMap->find(pass->getName());
if (bindingIt != hlmsMatBindingMap->end())
{
Expand All @@ -202,7 +202,7 @@ namespace Ogre
}
else
{
hlmsMatMap = rend->getUserObjectBindings().getUserAny(HLMS_KEY).get<HlmsMatBindingMap*>();
hlmsMatMap = any_cast<HlmsMatBindingMap*>(rend->getUserObjectBindings().getUserAny(HLMS_KEY));
}

(*hlmsMatMap)[passName] = material;
Expand All @@ -212,7 +212,7 @@ namespace Ogre
{
if (!rend->getUserObjectBindings().getUserAny(HLMS_KEY).isEmpty())
{
HlmsMatBindingMap* hlmsMatMap = rend->getUserObjectBindings().getUserAny(HLMS_KEY).get<HlmsMatBindingMap*>();
HlmsMatBindingMap* hlmsMatMap = any_cast<HlmsMatBindingMap*>(rend->getUserObjectBindings().getUserAny(HLMS_KEY));
hlmsMatMap->erase(passName);

// if the hasmap is empty delete it
Expand All @@ -236,7 +236,7 @@ namespace Ogre
for (; bindingIt != bindingItEnd; bindingIt++)
{
Renderable* rend = *bindingIt;
HlmsMatBindingMap* hlmsMatMap = rend->getUserObjectBindings().getUserAny(HLMS_KEY).get<HlmsMatBindingMap*>();
HlmsMatBindingMap* hlmsMatMap = any_cast<HlmsMatBindingMap*>(rend->getUserObjectBindings().getUserAny(HLMS_KEY));
hlmsMatMap->erase(passName);

// if the hasmap is empty delete it
Expand All @@ -253,7 +253,7 @@ namespace Ogre
{
if (!rend->getUserObjectBindings().getUserAny(HLMS_KEY).isEmpty())
{
HlmsMatBindingMap* hlmsMatMap = rend->getUserObjectBindings().getUserAny(HLMS_KEY).get<HlmsMatBindingMap*>();
HlmsMatBindingMap* hlmsMatMap = any_cast<HlmsMatBindingMap*>(rend->getUserObjectBindings().getUserAny(HLMS_KEY));
return hlmsMatMap->find(passName) != hlmsMatMap->end();
}

Expand Down
1 change: 1 addition & 0 deletions OgreMain/include/Ogre.i
Expand Up @@ -101,6 +101,7 @@
%ignore Ogre::SharedPtr::isNull;
%ignore Ogre::SharedPtr::setUseCount;
%include "OgreSharedPtr.h"
%ignore Ogre::Any::getType; // deprecated
%include "OgreAny.h"
%include "OgreIteratorWrapper.h"
%include "OgreMath.h"
Expand Down
6 changes: 3 additions & 3 deletions OgreMain/include/OgreAny.h
Expand Up @@ -118,7 +118,7 @@ namespace Ogre
}

/// @deprecated use type() instead
const std::type_info& getType() const { return type(); }
OGRE_DEPRECATED const std::type_info& getType() const { return type(); }

inline friend std::ostream& operator <<
( std::ostream& o, const Any& v )
Expand Down Expand Up @@ -203,14 +203,14 @@ namespace Ogre
public:
/// @deprecated use Ogre::any_cast instead
template<typename ValueType>
ValueType operator()() const
OGRE_DEPRECATED ValueType operator()() const
{
return any_cast<ValueType>(*this);
}

/// @deprecated use Ogre::any_cast instead
template <typename ValueType>
ValueType get(void) const
OGRE_DEPRECATED ValueType get(void) const
{
return any_cast<ValueType>(*this);
}
Expand Down

0 comments on commit 550be32

Please sign in to comment.