Ejemplo n.º 1
0
Any& Any::operator=( const Any& any )
{
  if( &any != this )
  {
    if( NULL == any.mContainer )
    {
      delete mContainer;
      mContainer = NULL;
    }
    else
    {
      AnyContainerBase* tmp = mContainer;

      if( NULL != mContainer )
      {
        // Check if two Any types have the same type. Avoids assignments of values with different types.
        if( mContainer->GetType() != any.GetType() )
        {
          AssertAlways( "Any::operator=( const Any& Any ). Trying to assign two values with different types." );
        }
      }

      // Clone the correct templated object
      mContainer = any.mContainer->mCloneFunc( *any.mContainer );

      // Deletes previous container.
      delete tmp;
    }
  }

  return *this;
}
Ejemplo n.º 2
0
/*------------------------------------------------------------------------------
unregister a button handler
------------------------------------------------------------------------------*/
void InputManager::UnbindInput( Button::Type button, InputState::Type state, InputCallbackFn callback ) {
    uint16_t index = m_bindingInUseHead;
    while( index != 0xffff ) {
        InputBindingNode *node = &m_bindings[ index ];
        if( node->m_binding.Equals( button, state, callback ) ) {
           FreeBinding( node );
           return;
        }
        index = node->m_next;
    }
    AssertAlways( "this input handler isn't registered" );
}