mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-03 17:56:21 +03:00
Restored possibility to have out-of-line implementation of DynamicCast() and STANDART_TYPE(): - Macro STANDARD_TYPE() now resolves to function get_type_descriptor() of the class - Macro DEFINE_STANDARD_RTTI is replaced by two variants: - DEFINE_STANDARD_RTTI_INLINE works as before, defining DynamicCast() and get_type_descriptor() as inline functions - DEFINE_STANDARD_RTTIEXT declares DynamicCast() and get_type_descriptor() as exported - Macro IMPLEMENT_STANDARD_RTTIEXT provides definition of DynamicCast() and get_type_descriptor() for a class Upgrade script amended to replace DEFINE_STANDARD_RTTI by pair of DEFINE_STANDARD_RTTIEXT / IMPLEMENT_STANDARD_RTTIEXT if source file with the same name as header is found in the same folder, and by DEFINE_STANDARD_RTTI_INLINE if either source is not found or class is defined in the source (i.e. not in header) Upgrade tool improved to recognize include statements with path prefix, like #include <occt/gp_Pnt.hxx> Code corrected to eliminate warnings reported by upgrade tool. Template of CXX file for testing upgrade tool added. Documentation of upgrade procedure updated.
68 lines
1.8 KiB
Plaintext
68 lines
1.8 KiB
Plaintext
// This is sample C++ file intended for testing and verifyig automatic upgrade
|
|
// script. Copy it with extension .cxx and apply upgrade procedure to see
|
|
// the result, as follows:
|
|
// > upgrade.bat -src=./adm -inc=./src -recurse -all
|
|
|
|
// Include of Geom_Line.hxx and Geom_Plane.hxx should be added below
|
|
#include <gp.hxx>
|
|
|
|
//========================================================================
|
|
// OCCT 7.0
|
|
//========================================================================
|
|
|
|
//------------------------------------------------------------------------
|
|
// Option -rtti
|
|
//------------------------------------------------------------------------
|
|
|
|
// Should be replaced by <Standard_Type.hxx>
|
|
#include <Standard_DefineHandle.hxx>
|
|
|
|
class A_0
|
|
{
|
|
}
|
|
|
|
class B_1 :
|
|
public A_0
|
|
{
|
|
// second argument "A_0" should be added
|
|
DEFINE_STANDARD_RTTI(B_1)
|
|
};
|
|
|
|
class C_2 : public Standard_Transient, B_1
|
|
{
|
|
// second argument "Standard_Transient" should be added
|
|
DEFINE_STANDARD_RTTI(C_2)
|
|
};
|
|
|
|
void for_rtti ()
|
|
{
|
|
Handle(Geom_Curve) aCurve = new Geom_Line (gp::Origin(), gp::DZ());
|
|
Handle(Geom_Line) aLine = Handle(Geom_Line)::DownCast (aCurve);
|
|
}
|
|
|
|
// should be removed
|
|
IMPLEMENT_DOWNCAST(A)
|
|
IMPLEMENT_STANDARD_RTTIEXT(A, B)
|
|
|
|
//------------------------------------------------------------------------
|
|
// Option -fwd
|
|
//------------------------------------------------------------------------
|
|
|
|
// force safe mode used for Qt objects
|
|
Q_OBJECT
|
|
slots:
|
|
|
|
// these includes should be recognized as corresponding to forward declarations
|
|
#include <occt/TColStd_HArray1OfReal.hxx>
|
|
|
|
// these declarations should be just removed
|
|
class Handle(TColStd_HArray1OfReal);
|
|
|
|
// should be replaced by include of corresponding header
|
|
class TColStd_Array1OfReal;
|
|
class Handle(Geom_Curve);
|
|
|
|
// check that trailing spaces at the following line are preserved
|
|
void ff();
|
|
|