From: abv Date: Sun, 28 Jun 2015 11:00:51 +0000 (+0300) Subject: 0024023: Revamp the OCCT Handle X-Git-Url: http://git.dev.opencascade.org/gitweb/?a=commitdiff_plain;h=4d04ec6b1b2a0471571b4adbfd676c26943e82dd;p=occt-wok.git 0024023: Revamp the OCCT Handle Avoid inclusion of class header if only its handle is used (forward declaration is sufficient in most cases). Templates corrected to be compatible with new handles --- diff --git a/src/CPPExt/CPPExt_MPV.cxx b/src/CPPExt/CPPExt_MPV.cxx index 2b7f6ee..a4c7aa3 100755 --- a/src/CPPExt/CPPExt_MPV.cxx +++ b/src/CPPExt/CPPExt_MPV.cxx @@ -350,7 +350,16 @@ void CPP_MPVClass(const Handle(MS_MetaSchema)& aMeta, if (!CPP_HaveHandleHeaders()) { - aName = CPP_WithoutHandleSuffix (aName); +// aName = CPP_WithoutHandleSuffix (aName); +/**/ + // do not include any header instead of "Handle_...hxx" + // forward declaration will be added separately and will be sufficient + Handle(TCollection_HAsciiString) aNonHandledName = CPP_WithoutHandleSuffix (aName); + if (! aNonHandledName->IsSameString (aName)) + { + continue; + } +/**/ } api->AddVariable (VIClass, aName->ToCString()); api->Apply (VTICIncludes, "Include"); diff --git a/src/CPPExt/CPPExt_Package.cxx b/src/CPPExt/CPPExt_Package.cxx index 520e72e..7fc2aeb 100755 --- a/src/CPPExt/CPPExt_Package.cxx +++ b/src/CPPExt/CPPExt_Package.cxx @@ -230,9 +230,18 @@ void CPP_Package(const Handle(MS_MetaSchema)& aMeta, continue; } - //if (!CPP_HaveHandleHeaders()) + if (!CPP_HaveHandleHeaders()) { - aName = CPP_WithoutHandleSuffix (aName); +// aName = CPP_WithoutHandleSuffix (aName); +/**/ + // do not include any header instead of "Handle_...hxx" + // forward declaration will be added separately and will be sufficient + Handle(TCollection_HAsciiString) aNonHandledName = CPP_WithoutHandleSuffix (aName); + if (! aNonHandledName->IsSameString (aName)) + { + continue; + } +/**/ } api->AddVariable (VIClass, aName->ToCString()); diff --git a/src/CPPExt/CPPExt_Template.edl b/src/CPPExt/CPPExt_Template.edl index 998ee49..847125e 100755 --- a/src/CPPExt/CPPExt_Template.edl +++ b/src/CPPExt/CPPExt_Template.edl @@ -200,7 +200,7 @@ $#define _%Class_HeaderFile $ $#include $#include -$#include +$#include $ $%TICIncludes $ @@ -413,7 +413,8 @@ $#include $#include $#include <%Inherits.hxx> $ -$DEFINE_STANDARD_EXCEPTION(%Class, %Inherits) +$class %Class; +$DEFINE_STANDARD_HANDLE(%Class, %Inherits) $ $#if !defined No_Exception && !defined No_%Class $ #define %Class_Raise_if(CONDITION, MESSAGE) \ @@ -422,6 +423,8 @@ $#else $ #define %Class_Raise_if(CONDITION, MESSAGE) $#endif $ +$DEFINE_STANDARD_EXCEPTION(%Class, %Inherits) +$ $#endif // _%Class_HeaderFile @end; @@ -451,11 +454,11 @@ $#define %DName_hxx <%DBaseValue.hxx> @end; @template ItemConstraintHandle(%DName,%DValue) is -$#define Handle_%DName Handle_%DValue +$#define Handle_%DName Handle(%DValue) @end; @template ItemHandleDefine (%DName,%DValue) is -$#define Handle_%DName Handle_%DValue +$#define Handle_%DName Handle(%DValue) @end; @template Undefine(%DName) is @@ -488,7 +491,7 @@ $%Class(%Arguments)\^ @end; @template MethodHeader(%Virtual,%RetSpec,%Return,%And,%MethodName,%Arguments,%MetSpec) is -$%Virtual %RetSpec %Return%And %MethodName(%Arguments) %MetSpec\^ +$%Virtual%RetSpec%Return%And %MethodName(%Arguments)%MetSpec\^ @end; @template ExternalConstructorHeader(%Class,%Arguments) is @@ -496,7 +499,7 @@ $%Class::%Class(%Arguments)\^ @end; @template ExternalMethodHeader(%Class,%Virtual,%RetSpec,%Return,%And,%MethodName,%Arguments,%MetSpec) is -$%Virtual %RetSpec %Return%And %Class::%MethodName(%Arguments) %MetSpec\^ +$%Virtual%RetSpec%Return%And %Class::%MethodName(%Arguments)%MetSpec\^ @end; @template MethodTemplateDec(%MethodComment,%Method) is diff --git a/src/CPPExt/CPPExt_Transient.cxx b/src/CPPExt/CPPExt_Transient.cxx index 531617d..f1444ec 100755 --- a/src/CPPExt/CPPExt_Transient.cxx +++ b/src/CPPExt/CPPExt_Transient.cxx @@ -380,7 +380,16 @@ void CPP_TransientClass(const Handle(MS_MetaSchema)& aMeta, if (!CPP_HaveHandleHeaders()) { - aName = CPP_WithoutHandleSuffix (aName); +// aName = CPP_WithoutHandleSuffix (aName); +/**/ + // do not include any header instead of "Handle_...hxx" + // forward declaration will be added separately and will be sufficient + Handle(TCollection_HAsciiString) aNonHandledName = CPP_WithoutHandleSuffix (aName); + if (! aNonHandledName->IsSameString (aName)) + { + continue; + } +/**/ } api->AddVariable (VIClass, aName->ToCString()); api->Apply (VTICIncludes, "Include");