src/class.cpp
/*!
 * \fn int inheritanceLevel(const Class& type) const
 * \brief returns the level of inheritance of this class to a given class
 *
 * If this class is not derived from \a type, this function returns -1; 
 * otherwise, this function returns the depth between this class and \a type 
 * in the inheritance tree.
 * 
 * A return value of 0 indicates that this class equals \a type ; 
 * a return value of 1 indicates a direct inheritance; and so on.
 */
\fn int inheritanceLevel(const Class& type) const
\brief returns the level of inheritance of this class to a given class

If this class is not derived from \a type, this function returns -1;
otherwise, this function returns the depth between this class and \a type
in the inheritance tree.

A return value of 0 indicates that this class equals \a type ;
a return value of 1 indicates a direct inheritance; and so on.
\ fn int inheritanceLevel ( const Class& type ) const \ brief returns the level of inheritance of this class to a given class If this class is not derived from \ a type this function returns - 1 ; otherwise this function returns the depth between this class and \ a type in the inheritance tree . A return value of 0 indicates that this class equals \ a type ; a return value of 1 indicates a direct inheritance ; and so on .
int Class::inheritanceLevel(const Class& type) const
{
  if (*this == type)
    return 0;
  Class p = parent();
  if (p.isNull())
    return -1;
  int lvl = p.inheritanceLevel(type);
  return lvl == -1 ? -1 : 1 + lvl;
}
int Class :: inheritanceLevel ( const Class & type ) const { if ( * this == type ) return 0 ; Class p = parent ( ) ; if ( p . isNull ( ) ) return -1 ; int lvl = p . inheritanceLevel ( type ) ; return lvl == -1 ? -1 : 1 + lvl ; }
\fn int inheritanceLevel(const Class& type) const
 \brief returns the level of inheritance of this class to a given class
\ fn int inheritanceLevel ( const Class& type ) const \ brief returns the level of inheritance of this class to a given class