Extenions: Drop virtual inheritance

Due to problems onthe windows platform the virtual inheritance approach must be dropped. NExt to the already reimplemented proeprty interface the Type interface is reimplemented too. This change allows to revert some earlier changes.
This commit is contained in:
Stefan Tröger
2016-10-03 12:06:32 +02:00
committed by wmayer
parent a79b48bbcc
commit 3a51404dd5
24 changed files with 147 additions and 105 deletions

View File

@@ -104,25 +104,29 @@ public:
};
/**
* Template that works just like dynamic_cast, but expects the argument to
* inherit from Base::BaseClass. Note thst for base class this is exactly the same as a dynamic_cast.
* The reason for that is that it is not possible to static_cast base to anything in the inheritance
* chain after PropertyContainer. The reason for this is the used virtual inheritance.
* However, the function can be overload for different cast between objects in the inheritnce
* chain after PropertyContainer, for example from DocumentObject to all its derived types-
*
*/
* Template that works just like dynamic_cast, but expects the argument to
* inherit from Base::BaseClass.
*
*/
template<typename T> T * freecad_dynamic_cast(Base::BaseClass * t)
{
return dynamic_cast<T*>(t);
if (t && t->isDerivedFrom(T::getClassTypeId()))
return static_cast<T*>(t);
else
return 0;
}
/**
* See explaination above
* Template that works just like dynamic_cast, but expects the argument to
* inherit from a const Base::BaseClass.
*
*/
template<typename T> const T * freecad_dynamic_cast(const Base::BaseClass * t)
{
return dynamic_cast<const T*>(t);
if (t && t->isDerivedFrom(T::getClassTypeId()))
return static_cast<const T*>(t);
else
return 0;
}