]> OCCT Git - occt-wok.git/commitdiff
0024023: Revamp the OCCT Handle
authorabv <abv@opencascade.com>
Sun, 28 Jun 2015 11:00:51 +0000 (14:00 +0300)
committerabv <abv@opencascade.com>
Sun, 28 Jun 2015 11:00:51 +0000 (14:00 +0300)
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

src/CPPExt/CPPExt_MPV.cxx
src/CPPExt/CPPExt_Package.cxx
src/CPPExt/CPPExt_Template.edl
src/CPPExt/CPPExt_Transient.cxx

index 2b7f6ee3ca2b041ef5b758c66bf86e79a74af10b..a4c7aa3ebc74898da9c77ca172b8a6fa9f27ea9b 100755 (executable)
@@ -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");
index 520e72e5feb2c262a6cc0d19e50f6019a90ecb37..7fc2aeb46cdf8d553eb540cd6a7a66b25c14de0f 100755 (executable)
@@ -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());
index 998ee49196886514f87c94fa6a965c09c18bf624..847125e581dfb4c274d357fd21a1b435fac5b712 100755 (executable)
@@ -200,7 +200,7 @@ $#define _%Class_HeaderFile
 $
 $#include <Standard.hxx>
 $#include <Standard_DefineAlloc.hxx>
-$#include <Standard_Macro.hxx>
+$#include <Standard_Handle.hxx>
 $
 $%TICIncludes
 $
@@ -413,7 +413,8 @@ $#include <Standard_DefineException.hxx>
 $#include <Standard_SStream.hxx>
 $#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
index 531617df05c5514424f905b63b8491b56986a23b..f1444ec72d06af069685b776a8648dee98bdaa79 100755 (executable)
@@ -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");