From: kgv Date: Tue, 18 Mar 2014 07:27:30 +0000 (+0400) Subject: 0024557: Improve formatting of HXX files generated by WOK X-Git-Url: http://git.dev.opencascade.org/gitweb/?a=commitdiff_plain;h=cccdfecbe68b9b7f1ab0cc47dc2869370cd5e24a;p=occt-wok.git 0024557: Improve formatting of HXX files generated by WOK Remove extra spaces at the beginning of the line. Apply 2 spaces indentation for method comments. Add newline after each method declaration. Do not generate
tags; treat single dot as empty line. Drop occasional backslashes at the of the comment. Improve class headers templates to meet OCCT coding style. Remove #ifdefs around #includes in generated HXX. --- diff --git a/src/CDLFront/CDLFront.cxx b/src/CDLFront/CDLFront.cxx index 3207d64..16bb830 100755 --- a/src/CDLFront/CDLFront.cxx +++ b/src/CDLFront/CDLFront.cxx @@ -209,6 +209,7 @@ namespace static Handle(TColStd_HSequenceOfHAsciiString) TheListOfName = new TColStd_HSequenceOfHAsciiString(); static Handle(TColStd_HSequenceOfHAsciiString) TheListOfCplusplus = new TColStd_HSequenceOfHAsciiString(); static Handle(TColStd_HSequenceOfHAsciiString) TheListOfComments = new TColStd_HSequenceOfHAsciiString(); + static Standard_Boolean TheIsEmptyLineInComment = Standard_False; static Handle(TColStd_HSequenceOfInteger) TheListOfCPPType = new TColStd_HSequenceOfInteger(); static Handle(TColStd_HSequenceOfHAsciiString) TheListOfInteger = new TColStd_HSequenceOfHAsciiString(); @@ -303,6 +304,7 @@ void CDL_InitVariable() TheListOfName = new TColStd_HSequenceOfHAsciiString(); TheListOfCplusplus = new TColStd_HSequenceOfHAsciiString(); TheListOfComments = new TColStd_HSequenceOfHAsciiString(); + TheIsEmptyLineInComment = Standard_False; TheListOfCPPType = new TColStd_HSequenceOfInteger(); TheListOfInteger = new TColStd_HSequenceOfHAsciiString(); TheListOfGlobalUsed.Nullify(); @@ -369,8 +371,9 @@ void Type_Name(char* aName) //function : CheckCommentListIsEmpty //purpose : //======================================================================= -void CheckCommentListIsEmpty (const char* /*theFunctionName*/) +void CheckCommentListIsEmpty (const char* theFunctionName) { + (void )theFunctionName; if (TheListOfComments->IsEmpty()) { return; @@ -713,35 +716,83 @@ void Add_Type() TheListOfPackages->Append(aPackName); } -void add_documentation(char* comment) +void add_documentation (char* theComment) { - Handle(TCollection_HAsciiString) aComment; - Handle(TCollection_HAsciiString) aRealComment; - Standard_Integer pos; - aComment = new TCollection_HAsciiString(comment); - pos = aComment->Location(1,':',1,aComment->Length()); - aRealComment = aComment->SubString(pos + 1, aComment->Length()); + Handle(TCollection_HAsciiString) aComment = new TCollection_HAsciiString (theComment); + Standard_Integer aPos = aComment->Location (1, ':', 1, aComment->Length()); + Handle(TCollection_HAsciiString) aRealComment = aComment->SubString (aPos + 1, aComment->Length()); aRealComment->RightAdjust(); - if (!aRealComment->IsEmpty()) + aRealComment->LeftAdjust(); + if (aRealComment->String() == ".") + { + aRealComment->Clear(); + } + for (; !aRealComment->IsEmpty() + && aRealComment->Value (aRealComment->Length()) == '\\'; ) { - aRealComment->AssignCat ("
"); - aRealComment->Insert(1,"//!"); - TheListOfComments->Append(aRealComment); + // should not appear in comments + aRealComment->Remove (aRealComment->Length()); } + if (aRealComment->IsEmpty()) + { + TheIsEmptyLineInComment = !TheListOfComments->IsEmpty(); + return; + } + + if (!TheListOfComments->IsEmpty() + && TheIsEmptyLineInComment) + { + TheListOfComments->Append (new TCollection_HAsciiString ("\n//!")); + } + TheIsEmptyLineInComment = Standard_False; + aRealComment->Insert (1, TheListOfComments->IsEmpty() ? "//! " : "\n//! "); + TheListOfComments->Append (aRealComment); } -void add_documentation1(char* comment) +void add_documentation1 (char* theComment) { - while ( *comment && IsSpace(*comment)) comment++; - while ( *comment == '-' ) comment++; - if ( ! *comment ) return; + while (*theComment != '\0' + && IsSpace (*theComment)) + { + ++theComment; + } + while (*theComment == '-') + { + ++theComment; + } + if (*theComment == '\0') + { + return; + } - Handle(TCollection_HAsciiString) aRealComment; - aRealComment = new TCollection_HAsciiString(comment); + Handle(TCollection_HAsciiString) aRealComment = new TCollection_HAsciiString (theComment); aRealComment->RightAdjust(); - aRealComment->AssignCat ("
"); - aRealComment->Insert(1,"\n//!"); - TheListOfComments->Append(aRealComment); + aRealComment->LeftAdjust(); + if (aRealComment->String() == ".") + { + aRealComment->Clear(); + } + for (; !aRealComment->IsEmpty() + && aRealComment->Value (aRealComment->Length()) == '\\'; ) + { + // should not appear in comments + aRealComment->Remove (aRealComment->Length()); + } + if (aRealComment->IsEmpty()) + { + TheIsEmptyLineInComment = !TheListOfComments->IsEmpty(); + return; + } + + if (!TheListOfComments->IsEmpty() + && TheIsEmptyLineInComment) + { + TheListOfComments->Append (new TCollection_HAsciiString ("\n//!")); + } + TheIsEmptyLineInComment = Standard_False; + aRealComment->Insert (1, "\n//! "); + TheListOfComments->Append (aRealComment); + TheIsEmptyLineInComment = Standard_False; } //======================================================================= @@ -2356,20 +2407,21 @@ void add_cpp_comment_to_method() } else { - int aCommentType; - Standard_Integer i, aNbCPP; - Handle(TCollection_HAsciiString) aCP; - - for(i = 1; i <= TheListOfComments->Length(); ++i) + Standard_Boolean isFirst = Standard_True; + for (Standard_Integer aLineIter = 1; aLineIter <= TheListOfComments->Length(); ++aLineIter) { - TheMethod->SetComment(TheListOfComments->Value(i)); + Handle(TCollection_HAsciiString) aLine = TheListOfComments->ChangeValue (aLineIter); + aLine->Insert (aLine->Value (1) != '\n' ? 1 : 2, isFirst ? "\n " : " "); + TheMethod->SetComment (aLine); + isFirst = Standard_False; } TheListOfComments->Clear(); - aNbCPP=TheListOfCplusplus->Length(); - for(i = 1; i <= aNbCPP; ++i) + Handle(TCollection_HAsciiString) aCP; + const Standard_Integer aNbCPP = TheListOfCplusplus->Length(); + for(Standard_Integer i = 1; i <= aNbCPP; ++i) { - aCommentType = TheListOfCPPType->Value(i); + Standard_Integer aCommentType = TheListOfCPPType->Value(i); // switch (aCommentType) { diff --git a/src/CPPClient/CPPClient_General.edl b/src/CPPClient/CPPClient_General.edl index 57f0015..3440b61 100755 --- a/src/CPPClient/CPPClient_General.edl +++ b/src/CPPClient/CPPClient_General.edl @@ -12,10 +12,14 @@ -- ============== @template Include(%IClass,%Suffix) is +$#include <%IClass.%Suffix> +@end; + +@template IncludeSafe(%IClass,%Suffix) is $#ifndef _%IClass_HeaderFile $#include <%IClass.%Suffix> $#endif -@end; +@end; @template IncludeNoSafe(%IClass,%Suffix) is $#include <%IClass.%Suffix> diff --git a/src/CPPClient/CPPClient_Template.edl b/src/CPPClient/CPPClient_Template.edl index 9df4fd0..bda55ad 100755 --- a/src/CPPClient/CPPClient_Template.edl +++ b/src/CPPClient/CPPClient_Template.edl @@ -12,12 +12,8 @@ $ $#ifndef _Handle_%Class_HeaderFile $#define _Handle_%Class_HeaderFile $ -$#ifndef _Standard_DefineHandle_HeaderFile $#include -$#endif -$#ifndef _Handle_%Inherits_HeaderFile $#include -$#endif $ $class Standard_Transient; $class Handle(Standard_Type); @@ -43,12 +39,9 @@ $#define _%Interface_Standard_Transient_HeaderFile $ $#include $ -$#ifndef _FrontEnd_EngineAdaptor_HeaderFile $#include -$#endif -$#ifndef _FrontEnd_HExternRef_HeaderFile $#include -$#endif +$ $extern Handle(FrontEnd_EngineAdaptor) __NullEngineAdaptor; $extern FrontEnd_FHandle __NullFHandle; $Standard_EXPORT Handle_Standard_Type& %Interface_Standard_Transient_Type_(); @@ -81,34 +74,15 @@ $// Please do not edit this file; modify original file instead. $// The copyright and license terms as defined for the original file apply to $// this header file considered to be the "object code" form of the original source. $// -$#ifndef _%Interface_Standard_Transient_HeaderFile $#include <%Interface_Standard_Transient.hxx> -$#endif -$ -$#ifndef _FrontEnd_EngineAdaptor_HeaderFile $#include -$#endif -$#ifndef _FrontEnd_ExternRef_HeaderFile $#include -$#endif -$#ifndef _FrontEnd_HExternRef_HeaderFile $#include -$#endif -$#ifndef _FrontEnd_FHandle_HeaderFile $#include -$#endif -$#ifndef _FrontEnd_Method_HeaderFile $#include -$#endif -$#ifndef _FrontEnd_InstanceMet_HeaderFile $#include -$#endif -$#ifndef _FrontEnd_ClassMet_HeaderFile $#include -$#endif -$#ifndef _FrontEnd_CreateMet_HeaderFile $#include -$#endif $ $Handle_Standard_Type& %Interface_Standard_Transient_Type_() ${ @@ -148,15 +122,9 @@ $#ifndef _%Interface_Standard_Persistent_HeaderFile $#define _%Interface_Standard_Persistent_HeaderFile $#include $ -$#ifndef _FrontEnd_EngineAdaptor_HeaderFile $#include -$#endif -$#ifndef _FrontEnd_HExternRef_HeaderFile $#include -$#endif -$#ifndef _%Interface_Standard_Storable_HeaderFile $#include <%Interface_Standard_Storable.hxx> -$#endif $ $extern Handle(FrontEnd_EngineAdaptor) __NullEngineAdaptor; $extern FrontEnd_FHandle __NullFHandle; @@ -166,19 +134,20 @@ $class %Interface_Standard_Persistent: public FrontEnd_HExternRef{ $ $public: $ -$ %Interface_Standard_Persistent(const FrontEnd_FHandle& _aRef, const Handle(FrontEnd_EngineAdaptor)& _anEng) -$ : FrontEnd_HExternRef(_aRef,_anEng) +$ %Interface_Standard_Persistent (const FrontEnd_FHandle& _aRef, +$ const Handle(FrontEnd_EngineAdaptor)& _anEng) +$ : FrontEnd_HExternRef (_aRef, _anEng) $ { $ } $ -$ const Handle(Standard_Type)& DynamicType() const -$ { -$ return STANDARD_TYPE(%Interface_Standard_Persistent) ; +$ const Handle(Standard_Type)& DynamicType() const +$ { +$ return STANDARD_TYPE(%Interface_Standard_Persistent); $ } $ -$ Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const -$ { -$ return (STANDARD_TYPE(%Interface_Standard_Persistent) == AType || FrontEnd_HExternRef::IsKind(AType)); +$ Standard_Boolean IsKind(const Handle(Standard_Type)& theType) const +$ { +$ return (STANDARD_TYPE(%Interface_Standard_Persistent) == theType || FrontEnd_HExternRef::IsKind (theType)); $ } $}; $ @@ -192,33 +161,15 @@ $// Please do not edit this file; modify original file instead. $// The copyright and license terms as defined for the original file apply to $// this header file considered to be the "object code" form of the original source. $// -$#ifndef _%Interface_Standard_Persistent_HeaderFile $#include <%Interface_Standard_Persistent.hxx> -$#endif -$#ifndef _FrontEnd_EngineAdaptor_HeaderFile $#include -$#endif -$#ifndef _FrontEnd_ExternRef_HeaderFile $#include -$#endif -$#ifndef _FrontEnd_HExternRef_HeaderFile $#include -$#endif -$#ifndef _FrontEnd_FHandle_HeaderFile $#include -$#endif -$#ifndef _FrontEnd_Method_HeaderFile $#include -$#endif -$#ifndef _FrontEnd_InstanceMet_HeaderFile $#include -$#endif -$#ifndef _FrontEnd_ClassMet_HeaderFile $#include -$#endif -$#ifndef _FrontEnd_CreateMet_HeaderFile $#include -$#endif $ $Handle_Standard_Type& %Interface_Standard_Persistent_Type_() ${ @@ -260,18 +211,11 @@ $// Please do not edit this file; modify original file instead. $// The copyright and license terms as defined for the original file apply to $// this header file considered to be the "object code" form of the original source. $// -$#ifndef _FrontEnd_EngineAdaptor_HeaderFile $#include -$#endif -$#ifndef _FrontEnd_ExternRef_HeaderFile $#include -$#endif -$#ifndef _Standard_Integer_HeaderFile $#include -$#endif -$#ifndef _FrontEnd_FHandle_HeaderFile $#include -$#endif +$ $#ifndef _%Interface_Standard_Storable_HeaderFile $#define _%Interface_Standard_Storable_HeaderFile $Standard_EXPORT Handle_Standard_Type& %Interface_Standard_Storable_Type_(); @@ -301,33 +245,15 @@ $// Please do not edit this file; modify original file instead. $// The copyright and license terms as defined for the original file apply to $// this header file considered to be the "object code" form of the original source. $// -$#ifndef _%Interface_Standard_Storable_HeaderFile $#include <%Interface_Standard_Storable.hxx> -$#endif -$#ifndef _FrontEnd_EngineAdaptor_HeaderFile $#include -$#endif -$#ifndef _FrontEnd_ExternRef_HeaderFile $#include -$#endif -$#ifndef _FrontEnd_HExternRef_HeaderFile $#include -$#endif -$#ifndef _FrontEnd_FHandle_HeaderFile $#include -$#endif -$#ifndef _FrontEnd_Method_HeaderFile $#include -$#endif -$#ifndef _FrontEnd_InstanceMet_HeaderFile $#include -$#endif -$#ifndef _FrontEnd_ClassMet_HeaderFile $#include -$#endif -$#ifndef _FrontEnd_CreateMet_HeaderFile $#include -$#endif $ $Handle_Standard_Type& %Interface_Standard_Storable_Type_() ${ @@ -380,91 +306,61 @@ $#ifndef _%Interface_MMgt_TShared_HeaderFile $#define _%Interface_MMgt_TShared_HeaderFile $#include $ -$#ifndef _FrontEnd_EngineAdaptor_HeaderFile $#include -$#endif -$ -$#ifndef _%Interface_Standard_Transient_HeaderFile $#include <%Interface_Standard_Transient.hxx> -$#endif $ $extern Handle(FrontEnd_EngineAdaptor) __NullEngineAdaptor; $extern FrontEnd_FHandle __NullFHandle; $class Handle_Standard_Type; $Standard_EXPORT Handle_Standard_Type& %Interface_MMgt_TShared_Type_(); $ -$#ifndef _%Interface_Standard_Transient_HeaderFile $#include <%Interface_Standard_Transient.hxx> -$#endif -$#ifndef _Standard_Address_HeaderFile $#include -$#endif -$#ifndef _Standard_Integer_HeaderFile $#include -$#endif $ $Standard_EXPORT Handle_Standard_Type& %Interface_MMgt_TShared_Type_(); $ -$class %Interface_MMgt_TShared: public %Interface_Standard_Transient { +$class %Interface_MMgt_TShared : public %Interface_Standard_Transient +${ $ $public: -$ %Interface_MMgt_TShared(const FrontEnd_FHandle& _aRef, const Handle(FrontEnd_EngineAdaptor)& _anEng) -$ : %Interface_Standard_Transient(_aRef,_anEng) -$ { -$ } +$ %Interface_MMgt_TShared (const FrontEnd_FHandle& _aRef, const Handle(FrontEnd_EngineAdaptor)& _anEng) +$ : %Interface_Standard_Transient (_aRef, _anEng) +$ { +$ } $ -$ const Handle(Standard_Type)& DynamicType() const -$ { -$ return STANDARD_TYPE(%Interface_MMgt_TShared) ; +$ const Handle(Standard_Type)& DynamicType() const +$ { +$ return STANDARD_TYPE(%Interface_MMgt_TShared); $ } $ -$ Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const -$ { -$ return (STANDARD_TYPE(%Interface_MMgt_TShared) == AType || %Interface_Standard_Transient::IsKind(AType)); +$ Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const +$ { +$ return (STANDARD_TYPE(%Interface_MMgt_TShared) == AType || %Interface_Standard_Transient::IsKind(AType)); $ } +$ $}; $ -$#endif +$#endif // _%Interface_MMgt_TShared_HeaderFile @end; @template MemoryRootClientCXX(%Interface) is $ -$#ifndef _%Interface_MMgt_TShared_HeaderFile $#include <%Interface_MMgt_TShared.hxx> -$#endif -$#ifndef _FrontEnd_EngineAdaptor_HeaderFile $#include -$#endif -$#ifndef _FrontEnd_ExternRef_HeaderFile $#include -$#endif -$#ifndef _FrontEnd_HExternRef_HeaderFile $#include -$#endif -$#ifndef _FrontEnd_FHandle_HeaderFile $#include -$#endif -$#ifndef _FrontEnd_Method_HeaderFile $#include -$#endif -$#ifndef _FrontEnd_InstanceMet_HeaderFile $#include -$#endif -$#ifndef _FrontEnd_ClassMet_HeaderFile $#include -$#endif -$#ifndef _FrontEnd_CreateMet_HeaderFile $#include -$#endif -$ -$ $ $Handle_Standard_Type& %Interface_MMgt_TShared_Type_() ${ -$ static Handle_Standard_Type aType1 = STANDARD_TYPE(%Interface_Standard_Transient); +$ static Handle_Standard_Type aType1 = STANDARD_TYPE(%Interface_Standard_Transient); $ static Handle_Standard_Type aType2 = STANDARD_TYPE(FrontEnd_HExternRef); -$ if ( aType1.IsNull()) aType1 = STANDARD_TYPE(%Interface_Standard_Transient); -$ +$ if (aType1.IsNull()) aType1 = STANDARD_TYPE(%Interface_Standard_Transient); $ $ static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,NULL}; $ static Handle_Standard_Type _aType = new Standard_Type("%Interface_MMgt_TShared", @@ -476,17 +372,15 @@ $ $ return _aType; $} $ -$ -$const Handle(%Interface_MMgt_TShared) Handle(%Interface_MMgt_TShared)::DownCast(const Handle(Standard_Transient)& AnObject) +$const Handle(%Interface_MMgt_TShared) Handle(%Interface_MMgt_TShared)::DownCast(const Handle(Standard_Transient)& theObject) ${ -$ Handle(%Interface_MMgt_TShared) _anOtherObject; -$ -$ if (!AnObject.IsNull()) -$ if (AnObject->IsKind(STANDARD_TYPE(%Interface_MMgt_TShared))) { -$ _anOtherObject = Handle(%Interface_MMgt_TShared)((Handle(%Interface_MMgt_TShared)&)AnObject); -$ } -$ -$ return _anOtherObject; +$ Handle(%Interface_MMgt_TShared) anOtherObject; +$ if (!theObject.IsNull() +$ && theObject->IsKind(STANDARD_TYPE(%Interface_MMgt_TShared))) +$ { +$ anOtherObject = Handle(%Interface_MMgt_TShared)((Handle(%Interface_MMgt_TShared)&)theObject); +$ } +$ return anOtherObject; $} $ $Handle(%Interface_MMgt_TShared)::~Handle(%Interface_MMgt_TShared)(){} @@ -502,15 +396,9 @@ $#ifndef _%Class_HeaderFile $#define _%Class_HeaderFile $#include $ -$#ifndef _FrontEnd_EngineAdaptor_HeaderFile $#include -$#endif -$#ifndef _FrontEnd_MID_HeaderFile $#include -$#endif -$#ifndef _%Inherits_HeaderFile $#include <%Inherits.hxx> -$#endif $ $class Handle_Standard_Type; $Standard_EXPORT Handle_Standard_Type& %Class_Type_(); @@ -519,28 +407,30 @@ $extern FrontEnd_FHandle __NullFHandle; $ $%Includes $ -$class %Class: public %Inherits { +$class %Class : public %Inherits +${ $ $public: $ %Methods $ -$ %Class(const FrontEnd_FHandle& _aRef, const Handle(FrontEnd_EngineAdaptor)& _anEng) -$ : %Inherits(_aRef,_anEng) -$ { -$ } +$ %Class (const FrontEnd_FHandle& theRef, +$ const Handle(FrontEnd_EngineAdaptor)& theEng) +$ : %Inherits (theRef, theEng) +$ { +$ } $ -$ const Handle(Standard_Type)& DynamicType() const -$ { -$ return STANDARD_TYPE(%Class); -$ } +$ const Handle(Standard_Type)& DynamicType() const +$ { +$ return STANDARD_TYPE(%Class); +$ } $ -$ Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const -$ { -$ return (STANDARD_TYPE(%Class) == AType || %Inherits::IsKind(AType)); -$ } +$ Standard_Boolean IsKind (const Handle(Standard_Type)& theType) const +$ { +$ return (STANDARD_TYPE(%Class) == theType || %Inherits::IsKind (theType)); +$ } $}; $ -$#endif +$#endif // _%Class_HeaderFile @end; @template RefClassClientCXX(%Class,%Inherits,%Methods,%Includes,%TypeMgt) is @@ -549,47 +439,28 @@ $// Please do not edit this file; modify original file instead. $// The copyright and license terms as defined for the original file apply to $// this header file considered to be the "object code" form of the original source. $ -$#ifndef _%Class_HeaderFile $#include <%Class.hxx> -$#endif -$#ifndef _FrontEnd_EngineAdaptor_HeaderFile $#include -$#endif -$#ifndef _FrontEnd_ExternRef_HeaderFile $#include -$#endif -$#ifndef _FrontEnd_HExternRef_HeaderFile $#include -$#endif -$#ifndef _FrontEnd_FHandle_HeaderFile $#include -$#endif -$#ifndef _FrontEnd_Method_HeaderFile $#include -$#endif -$#ifndef _FrontEnd_InstanceMet_HeaderFile $#include -$#endif -$#ifndef _FrontEnd_ClassMet_HeaderFile $#include -$#endif -$#ifndef _FrontEnd_CreateMet_HeaderFile $#include -$#endif $ $%Includes $ $%TypeMgt $ -$const Handle(%Class) Handle(%Class)::DownCast(const Handle(Standard_Transient)& AnObject) +$const Handle(%Class) Handle(%Class)::DownCast (const Handle(Standard_Transient)& theObject) ${ -$ Handle(%Class) _anOtherObject; -$ -$ if (!AnObject.IsNull()) -$ if (AnObject->IsKind(STANDARD_TYPE(%Class))) { -$ _anOtherObject = Handle(%Class)((Handle(%Class)&)AnObject); -$ } -$ +$ Handle(%Class) anOtherObject; +$ if (!theObject.IsNull() +$ && theObject->IsKind(STANDARD_TYPE(%Class))) +$ { +$ anOtherObject = Handle(%Class)((Handle(%Class)&)theObject); +$ } $ return _anOtherObject; $} $ @@ -607,32 +478,30 @@ $ $// $#ifndef _%Class_HeaderFile $#define _%Class_HeaderFile -$#ifndef _FrontEnd_EngineAdaptor_HeaderFile +$ $#include -$#endif -$#ifndef _%Inherits_HeaderFile $#include <%Inherits.hxx> -$#endif -$#ifndef _FrontEnd_MID_HeaderFile $#include -$#endif +$ $extern Handle(FrontEnd_EngineAdaptor) __NullEngineAdaptor; $extern FrontEnd_FHandle __NullFHandle; $%Includes $ -$class %Class: public %Inherits { +$class %Class : public %Inherits +${ $ $public: -$ %Methods +$ %Methods $ -$ %Class(const FrontEnd_FHandle&) %InheritsTrick {} -$ %Class(const FrontEnd_FHandle& _aRef, const Handle(FrontEnd_EngineAdaptor)& _anEng) -$ : %Inherits(_aRef,_anEng) -$ { -$ } +$ %Class (const FrontEnd_FHandle&) %InheritsTrick {} +$ %Class (const FrontEnd_FHandle& theRef, +$ const Handle(FrontEnd_EngineAdaptor)& theEng) +$ : %Inherits (theRef, theEng) +$ { +$ } $}; $ -$#endif +$#endif // _%Class_HeaderFile @end; @template ValueClassClientCXX(%Class,%Methods,%Includes) is @@ -641,33 +510,15 @@ $// Please do not edit this file; modify original file instead. $// The copyright and license terms as defined for the original file apply to $// this header file considered to be the "object code" form of the original source. $ -$#ifndef _%Class_HeaderFile $#include <%Class.hxx> -$#endif -$#ifndef _FrontEnd_EngineAdaptor_HeaderFile $#include -$#endif -$#ifndef _FrontEnd_ExternRef_HeaderFile $#include -$#endif -$#ifndef _FrontEnd_HExternRef_HeaderFile $#include -$#endif -$#ifndef _FrontEnd_FHandle_HeaderFile $#include -$#endif -$#ifndef _FrontEnd_Method_HeaderFile $#include -$#endif -$#ifndef _FrontEnd_InstanceMet_HeaderFile $#include -$#endif -$#ifndef _FrontEnd_ClassMet_HeaderFile $#include -$#endif -$#ifndef _FrontEnd_CreateMet_HeaderFile $#include -$#endif $ $%Includes $ @@ -682,22 +533,20 @@ $// this header file considered to be the "object code" form of the original sou $// $#ifndef _%Class_HeaderFile $#define _%Class_HeaderFile -$#ifndef _FrontEnd_EngineAdaptor_HeaderFile +$ $#include -$#endif -$#ifndef _FrontEnd_MID_HeaderFile $#include -$#endif +$ $extern Handle(FrontEnd_EngineAdaptor) __NullEngineAdaptor; $%Includes $ -$class %Class { -$ +$class %Class +${ $public: -$ %Methods +$ %Methods $}; $ -$#endif +$#endif // _%Class_HeaderFile @end; @template PackageClientCXX(%Class,%Methods,%Includes) is @@ -706,27 +555,13 @@ $// Please do not edit this file; modify original file instead. $// The copyright and license terms as defined for the original file apply to $// this header file considered to be the "object code" form of the original source. $ -$#ifndef _%Class_HeaderFile $#include <%Class.hxx> -$#endif -$#ifndef _FrontEnd_EngineAdaptor_HeaderFile $#include -$#endif -$#ifndef _FrontEnd_ExternRef_HeaderFile $#include -$#endif -$#ifndef _FrontEnd_HExternRef_HeaderFile $#include -$#endif -$#ifndef _FrontEnd_FHandle_HeaderFile $#include -$#endif -$#ifndef _FrontEnd_Method_HeaderFile $#include -$#endif -$#ifndef _FrontEnd_PackageMet_HeaderFile $#include -$#endif $ $%Includes $ @@ -742,16 +577,14 @@ $// $#ifndef _%Class_HeaderFile $#define _%Class_HeaderFile $ -$enum %Class { -$ %Values +$enum %Class +${ +$ %Values $}; $ -$ -$#ifndef _Standard_PrimitiveTypes_HeaderFile $#include -$#endif $ -$#endif +$#endif // _%Class_HeaderFile @end; -- method header @@ -914,10 +747,10 @@ $ if ( %Nb.IsNull()) %Nb = STANDARD_TYPE(%Ancestors); $Handle_Standard_Type& %TMgtClass_Type_() ${ $ %TMgtInherits -$ static Handle_Standard_Type aTypeT = STANDARD_TYPE(Standard_Transient); +$ static Handle_Standard_Type aTypeT = STANDARD_TYPE(Standard_Transient); $ static Handle_Standard_Type aTypeTs = STANDARD_TYPE(MMgt_TShared); -$ static Handle_Standard_Type aTypeR = STANDARD_TYPE(FrontEnd_HExternRef); -$ static Handle_Standard_Transient _Ancestors[]= {%Ancestors aTypeR,aTypeTs,aTypeT,NULL}; +$ static Handle_Standard_Type aTypeR = STANDARD_TYPE(FrontEnd_HExternRef); +$ static Handle_Standard_Transient _Ancestors[]= {%Ancestors aTypeR, aTypeTs, aTypeT, NULL}; $ static Handle_Standard_Type _aType = new Standard_Type("%TMgtClass", $ sizeof(%TMgtClass), $ 1, diff --git a/src/CPPExt/CPPExt.cxx b/src/CPPExt/CPPExt.cxx index d181940..9babe31 100755 --- a/src/CPPExt/CPPExt.cxx +++ b/src/CPPExt/CPPExt.cxx @@ -1046,3 +1046,13 @@ void CPP_Extract(const Handle(MS_MetaSchema)& aMeta, } } +Handle(TCollection_HAsciiString) CPP_WithoutHandleSuffix (const Handle(TCollection_HAsciiString)& theName) +{ + const Standard_Integer aSuffLen = Standard_Integer(sizeof("Handle_") - 1); + if (theName->Length() > aSuffLen + && theName->SubString (1, aSuffLen)->String() == "Handle_") + { + return theName->SubString (aSuffLen + 1, theName->Length()); + } + return theName; +} diff --git a/src/CPPExt/CPPExt_Define.hxx b/src/CPPExt/CPPExt_Define.hxx index 17c8d6a..b91c2c8 100755 --- a/src/CPPExt/CPPExt_Define.hxx +++ b/src/CPPExt/CPPExt_Define.hxx @@ -100,4 +100,7 @@ void CPP_ClassTypeMgt(const Handle(MS_MetaSchema)& aMeta, const Handle(MS_Class)& aClass, const Standard_CString var); +//! Auxiliary function to remove Handle_ suffix +Handle(TCollection_HAsciiString) CPP_WithoutHandleSuffix (const Handle(TCollection_HAsciiString)& theName); + #endif diff --git a/src/CPPExt/CPPExt_Package.cxx b/src/CPPExt/CPPExt_Package.cxx index 5c78f76..f0305d5 100755 --- a/src/CPPExt/CPPExt_Package.cxx +++ b/src/CPPExt/CPPExt_Package.cxx @@ -62,7 +62,8 @@ void CPP_PackageDerivated(const Handle(MS_MetaSchema)& , api->AddVariable(VSuffix,"hxx"); for (i = 1; i <= inclist->Length(); i++) { - api->AddVariable(VIClass,inclist->Value(i)->ToCString()); + Handle(TCollection_HAsciiString) aName = CPP_WithoutHandleSuffix (inclist->Value (i)); + api->AddVariable (VIClass, aName->ToCString()); api->Apply(VoutClass,"Include"); result->AssignCat(api->GetVariableValue(VoutClass)); } diff --git a/src/CPPExt/CPPExt_Standard.edl b/src/CPPExt/CPPExt_Standard.edl index e1e90e2..ef916e1 100755 --- a/src/CPPExt/CPPExt_Standard.edl +++ b/src/CPPExt/CPPExt_Standard.edl @@ -7,178 +7,167 @@ $#ifndef _Handle_Standard_Transient_HeaderFile $#define _Handle_Standard_Transient_HeaderFile $ -$#ifndef _Standard_Macro_HeaderFile $#include -$#endif -$#ifndef _Standard_PrimitiveTypes_HeaderFile $#include -$#endif -$#ifndef _Standard_Transient_proto_HeaderFile $#include -$#endif $ $class Standard_Transient; $class Handle_Standard_Type; $ -$Standard_Integer HashCode(const Handle(Standard_Transient)& ,const Standard_Integer); +$Standard_Integer HashCode(const Handle(Standard_Transient)& , const Standard_Integer ); $ $class Handle(Standard_Transient) -$ { -$ private: -$ -$ Standard_Transient *entity; -$ -$ void RaiseNullObject(const Standard_CString S) const; -$ -$ void BeginScope() const -$ { -$ if (entity != 0) entity->count++; -$ } -$ -$ void EndScope() -$ { -$ if (entity != 0) -$ { -$ entity->count--; -$ if (entity->count == 0) { -$ entity->Delete(); -$ entity = 0; -$ } -$ } -$ } -$ -$ -$ public: -$ -$ Handle(Standard_Transient)() -$ { -$ entity = 0; -$ } -$ -$ Handle(Standard_Transient)(const Handle(Standard_Transient)& aTid) -$ { -$ entity = aTid.entity; -$ BeginScope(); -$ } -$ -$ Handle(Standard_Transient)(const Standard_Transient *anItem) -$ { -$ if (!anItem) -$ entity = 0; -$ else -$ entity = (Standard_Transient *)anItem; -$ BeginScope(); -$ } -$ void Dump(Standard_OStream& out) const; -$ ~Handle(Standard_Transient)(); -$ -$ void ShallowDump(Standard_OStream&) const; -$ -$ int operator==(const Handle(Standard_Transient)& right) const -$ { -$ return entity == right.entity; -$ } -$ -$ int operator==(const Standard_Transient *right) const -$ { -$ return entity == (Standard_Transient *)right; -$ } -$ -$ friend int operator==(const Standard_Transient *left, const Handle(Standard_Transient)& right) -$ { -$ return left == right.entity; -$ } -$ -$ int operator!=(const Handle(Standard_Transient)& right) const -$ { -$ return entity != right.entity; -$ } -$ -$ int operator!=(const Standard_Transient *right) const -$ { -$ return entity != right; -$ } -$ -$ friend int operator!=(const Standard_Transient *left, const Handle(Standard_Transient)& right) -$ { -$ return left != right.entity; -$ } -$ -$ void Nullify() -$ { -$ EndScope(); -$ entity = 0; -$ } +${ +$private: $ -$ Standard_Boolean IsNull() const -$ { -$ return entity == 0; -$ } +$ Standard_Transient* entity; $ -$ protected: +$ void RaiseNullObject (const Standard_CString S) const; $ -$ Standard_Transient* Access() const -$ { -$ return entity; -$ } -$ -$ Standard_Transient* ControlAccess() const -$ { -$ return entity; -$ } +$ void BeginScope() const +$ { +$ if (entity != 0) entity->count++; +$ } $ -$ void Assign(const Standard_Transient *anItem) +$ void EndScope() +$ { +$ if (entity != 0) +$ { +$ entity->count--; +$ if (entity->count == 0) $ { -$ EndScope(); -$ if (!anItem) -$ entity = 0; -$ else -$ entity = (Standard_Transient *)anItem; -$ entity = (Standard_Transient *)anItem; -$ BeginScope(); -$ } -$ -$ -$ public: -$ -$ operator Standard_Transient*() -$ { -$ return Access(); -$ } -$ +$ entity->Delete(); +$ entity = 0; +$ } +$ } +$ } +$ +$public: +$ +$ Handle(Standard_Transient)() +$ { +$ entity = 0; +$ } +$ +$ Handle(Standard_Transient)(const Handle(Standard_Transient)& theTid) +$ { +$ entity = theTid.entity; +$ BeginScope(); +$ } +$ +$ Handle(Standard_Transient)(const Standard_Transient* theItem) +$ { +$ if (!theItem) +$ entity = 0; +$ else +$ entity = (Standard_Transient* )theItem; +$ BeginScope(); +$ } +$ +$ void Dump (Standard_OStream& out) const; +$ ~Handle(Standard_Transient)(); +$ +$ void ShallowDump (Standard_OStream&) const; +$ +$ bool operator== (const Handle(Standard_Transient)& theRight) const +$ { +$ return entity == theRight.entity; +$ } +$ +$ bool operator== (const Standard_Transient* theRight) const +$ { +$ return entity == (Standard_Transient* )theRight; +$ } +$ +$ friend bool operator== (const Standard_Transient* theLeft, +$ const Handle(Standard_Transient)& theRight) +$ { +$ return theLeft == theRight.entity; +$ } +$ +$ bool operator!= (const Handle(Standard_Transient)& theRight) const +$ { +$ return entity != theRight.entity; +$ } +$ +$ bool operator!= (const Standard_Transient* theRight) const +$ { +$ return entity != theRight; +$ } +$ +$ friend bool operator!= (const Standard_Transient* theLeft, +$ const Handle(Standard_Transient)& theRight) +$ { +$ return theLeft != theRight.entity; +$ } +$ +$ void Nullify() +$ { +$ EndScope(); +$ entity = 0; +$ } +$ +$ Standard_Boolean IsNull() const +$ { +$ return entity == 0; +$ } +$ +$protected: +$ +$ Standard_Transient* Access() const +$ { +$ return entity; +$ } +$ +$ Standard_Transient* ControlAccess() const +$ { +$ return entity; +$ } +$ +$ void Assign (const Standard_Transient* theItem) +$ { +$ EndScope(); +$ entity = (Standard_Transient* )theItem; +$ BeginScope(); +$ } +$ +$public: +$ +$ operator Standard_Transient*() +$ { +$ return Access(); +$ } +$ +$ Handle(Standard_Transient)& operator= (const Handle(Standard_Transient)& theHandle); +$ Handle(Standard_Transient)& operator= (const Standard_Transient* theItem); +$ +$ Standard_Transient* operator->() +$ { +$ return ControlAccess(); +$ } +$ +$ Standard_Transient* operator->() const +$ { +$ return ControlAccess(); +$ } +$ +$ Standard_Transient& operator*() +$ { +$ return *(ControlAccess()); +$ } +$ +$ const Standard_Transient& operator*() const +$ { +$ return *(ControlAccess()); +$ } +$ +$ static const Handle(Standard_Transient) DownCast (const Handle(Standard_Transient)& theObject); +$ +$ friend void ShallowDump (const Handle_Standard_Transient&, Standard_OStream&); $ -$ Handle(Standard_Transient)& operator=(const Handle(Standard_Transient)& aHandle); -$ Handle(Standard_Transient)& operator=(const Standard_Transient* anItem); -$ -$ Standard_Transient* operator->() -$ { -$ return ControlAccess(); -$ } -$ -$ Standard_Transient* operator->() const -$ { -$ return ControlAccess(); -$ } -$ -$ Standard_Transient& operator*() -$ { -$ return *(ControlAccess()); -$ } -$ -$ const Standard_Transient& operator*() const -$ { -$ return *(ControlAccess()); -$ } -$ -$ static const Handle(Standard_Transient) DownCast(const Handle(Standard_Transient)& AnObject); -$ -$ friend void ShallowDump(const Handle_Standard_Transient&,Standard_OStream&); -$ -$ }; +$}; $ -$#ifndef _Standard_Type_HeaderFile $#include -$#endif $ $#endif @end; @@ -187,68 +176,54 @@ $#endif $#ifndef _Standard_Transient_HeaderFile $#define _Standard_Transient_HeaderFile $ -$#ifndef _Handle_Standard_Transient_HeaderFile $#include -$#endif -$#ifndef _Standard_PrimitiveTypes_HeaderFile $#include -$#endif -$#ifndef _Standard_Transient_proto_HeaderFile $#include -$#endif -$#ifndef _Standard_Type_HeaderFile $#include -$#endif $ -$#endif +$#endif @end; @template StandardErrorHandler is -$//============================================================================ -$//==== Titre: Standard_ErrorHandler.hxx -$//==== Role : the header file of class "Standard_ErrorHandler". -$//==== define the syntaxe "try" and "catch". -$//============================================================================ +$#ifndef _Standard_ErrorHandler_HeaderFile +$#define _Standard_ErrorHandler_HeaderFile $ -$#ifndef _Standard_ErrorHandler_HeaderFile -$#define _Standard_ErrorHandler_HeaderFile -$ -$#ifndef _Standard_Failure_HeaderFile $#include -$#endif $ $#include $#include $ -$class Standard_ErrorHandler +$//! Define the syntaxe "try" and "catch". +$class Standard_ErrorHandler ${ -$ friend class Standard_Failure; // To execute the raise exception. +$ friend class Standard_Failure; // To execute the raise exception $ -$ public: -$ -$ Standard_ErrorHandler(); -$ ~Standard_ErrorHandler(); -$ Standard_Boolean Catches (const Handle(Standard_Type)&); +$public: $ -$ private: -$ static void Abort(); -$ static void Error(const Handle(Standard_Failure)&); -$ static Handle(Standard_Failure) LastCaughtError(); +$ Standard_ErrorHandler(); +$ ~Standard_ErrorHandler(); +$ Standard_Boolean Catches (const Handle(Standard_Type)& ); $ -$ //==== The fields =========================================================== -$ private: -$ Standard_ErrorHandler* Previous; -$ Handle(Standard_Failure) CaughtError; +$private: $ -$ public: -$ jmp_buf Label; +$ static void Abort(); +$ static void Error (const Handle(Standard_Failure)& ); +$ static Handle(Standard_Failure) LastCaughtError(); $ -$}; +$private: +$ +$ Standard_ErrorHandler* Previous; +$ Handle(Standard_Failure) CaughtError; +$ +$public: $ +$ jmp_buf Label; +$ +$}; $ $#include $ -$#endif +$#endif // _Standard_ErrorHandler_HeaderFile @end; @template StandardSStream is @@ -258,18 +233,19 @@ $ $#include $ $class Handle_Standard_Type; -$ $Handle_Standard_Type& Standard_SStream_Type_(); $ -$class Standard_SStream : public strstreambase, public ostream { +$class Standard_SStream : public strstreambase, public ostream +${ $ -$ public: -$ Standard_SStream(); -$ Standard_SStream(ostream& ); +$public: +$ Standard_SStream(); +$ Standard_SStream(ostream& ); $ -$ ~Standard_SStream(); +$ ~Standard_SStream(); $}; -$#endif +$ +$#endif // _Standard_SStream_HeaderFile @end; @template StandardIStream is @@ -278,14 +254,11 @@ $#define _Standard_IStream_HeaderFile $ $#include $ -$ $class Handle_Standard_Type; -$ $Handle_Standard_Type& Standard_IStream_Type_(); -$ $#define Standard_IStream istream $ -$#endif +$#endif // _Standard_IStream_HeaderFile @end; @template StandardOStream is @@ -294,14 +267,11 @@ $#define _Standard_OStream_HeaderFile $ $#include $ -$ $class Handle_Standard_Type; -$ $Handle_Standard_Type& Standard_OStream_Type_(); -$ $#define Standard_OStream ostream $ -$#endif +$#endif // _Standard_OStream_HeaderFile @end; @template HandleStandardPersistent is @@ -314,7 +284,8 @@ $//============================================================================ $ $#ifndef _Handle_Standard_Persistent_HeaderFile $#define _Handle_Standard_Persistent_HeaderFile +$ $#include $ -$#endif +$#endif // _Handle_Standard_Persistent_HeaderFile @end; diff --git a/src/CPPExt/CPPExt_Storable.cxx b/src/CPPExt/CPPExt_Storable.cxx index 5c4ae62..29a524c 100755 --- a/src/CPPExt/CPPExt_Storable.cxx +++ b/src/CPPExt/CPPExt_Storable.cxx @@ -183,7 +183,8 @@ void CPP_StorableDerivated(const Handle(MS_MetaSchema)& aMeta, api->AddVariable(VSuffix,"hxx"); for (i = 1; i <= inclist->Length(); i++) { - api->AddVariable(VIClass,inclist->Value(i)->ToCString()); + Handle(TCollection_HAsciiString) aName = CPP_WithoutHandleSuffix (inclist->Value (i)); + api->AddVariable (VIClass, aName->ToCString()); api->Apply(VoutClass,"Include"); result->AssignCat(api->GetVariableValue(VoutClass)); } diff --git a/src/CPPExt/CPPExt_Template.edl b/src/CPPExt/CPPExt_Template.edl index 0e307ed..d25e974 100755 --- a/src/CPPExt/CPPExt_Template.edl +++ b/src/CPPExt/CPPExt_Template.edl @@ -17,28 +17,20 @@ $ $#ifndef _Handle_%HTName_HeaderFile $#define _Handle_%HTName_HeaderFile $ -$#ifndef _Standard_HeaderFile $#include -$#endif -$#ifndef _Standard_DefineHandle_HeaderFile $#include -$#endif -$ -$#ifndef _Handle_%HTInherits_HeaderFile $#include -$#endif $ $class Standard_Transient; $class Handle(Standard_Type); $class Handle(%HTInherits); $class %HTName; $ -$DEFINE_STANDARD_HANDLE(%HTName,%HTInherits) +$DEFINE_STANDARD_HANDLE(%HTName, %HTInherits) $ -$#endif +$#endif // _Handle_%HTName_HeaderFile @end; - -- =============================== -- extraction of a transient class -- =============================== @@ -66,20 +58,15 @@ $ $#ifndef _%Class_HeaderFile $#define _%Class_HeaderFile $ -$#ifndef _Standard_HeaderFile $#include -$#endif -$#ifndef _Standard_DefineHandle_HeaderFile $#include -$#endif -$#ifndef _Handle_%Class_HeaderFile $#include -$#endif $ $%TICIncludes $ $%ClassComment -$class %Class : public %Inherits { +$class %Class : public %Inherits +${ $ $public: $ @@ -104,10 +91,9 @@ $%TICDefines $%TICInlineIncludes $%TICUndefines $ -$// other Inline functions and methods (like "C++: function call" methods) $%TICSuppMethod $ -$#endif +$#endif // _%Class_HeaderFile @end; @template TransientIxx (%Class,%Suffix,%Supplement,%TypeMgt,%Methods) is @@ -118,9 +104,7 @@ $// this header file considered to be the "object code" form of the original sou $ $#include <%Class.%Suffix> $ -$#ifndef _Standard_Type_HeaderFile $#include -$#endif $ $%Supplement $ @@ -156,20 +140,15 @@ $ $#ifndef _%Class_HeaderFile $#define _%Class_HeaderFile $ -$#ifndef _Standard_HeaderFile $#include -$#endif -$#ifndef _Standard_DefineAlloc_HeaderFile $#include -$#endif -$#ifndef _Standard_Macro_HeaderFile $#include -$#endif $ $%TICIncludes $ $%ClassComment -$class %Class %Inherits { +$class %Class %Inherits +${ $public: $ $ DEFINE_STANDARD_ALLOC @@ -178,7 +157,6 @@ $%TICPublicmets $ $%TICPublicfriends $ -$ $protected: $ $%TICProtectedmets @@ -197,10 +175,9 @@ $%TICDefines $%TICInlineIncludes $%TICUndefines $ -$// other Inline functions and methods (like "C++: function call" methods) $%TICSuppMethod $ -$#endif +$#endif // _%Class_HeaderFile @end; @template MPVIxx (%Class,%Suffix,%Supplement,%Methods) is @@ -243,22 +220,17 @@ $ $#ifndef _%Class_HeaderFile $#define _%Class_HeaderFile $ -$#ifndef _Standard_HeaderFile $#include -$#endif -$#ifndef _Standard_DefineAlloc_HeaderFile $#include -$#endif -$#ifndef _Standard_Macro_HeaderFile $#include -$#endif $ $%TICIncludes $ $Standard_EXPORT const Handle(Standard_Type)& STANDARD_TYPE(%Class); $ $%ClassComment -$class %Class %Inherits { +$class %Class %Inherits +${ $ $public: $ @@ -283,10 +255,9 @@ $%TICDefines $%TICInlineIncludes $%TICUndefines $ -$// other Inline functions and methods (like "C++: function call" methods) $%TICSuppMethod $ -$#endif +$#endif // _%Class_HeaderFile @end; @template StorableIxx(%Class,%Suffix,%Supplement,%Methods) is @@ -297,9 +268,7 @@ $// this header file considered to be the "object code" form of the original sou $ $#include <%Class.%Suffix> $ -$#ifndef _Standard_Type_HeaderFile $#include -$#endif $ $%Supplement $ @@ -319,16 +288,15 @@ $ $#ifndef _%Class_HeaderFile $#define _%Class_HeaderFile $ +$#include +$ $%EnumComment -$enum %Class { +$enum %Class +${ $%Values $}; $ -$#ifndef _Standard_PrimitiveTypes_HeaderFile -$#include -$#endif -$ -$#endif +$#endif // _%Class_HeaderFile @end; @template EnumCXX(%Class,%Values,%Nb) is @@ -347,16 +315,14 @@ $ $#ifndef _%Class_HeaderFile $#define _%Class_HeaderFile $ -$#ifndef _%Inherits_HeaderFile $#include <%Inherits.hxx> -$#endif $ $typedef %Inherits %Class; $%HandleTypedef $ $#define %Class_Type_() %Inherits_Type_() $ -$#endif +$#endif // _%Class_HeaderFile @end; -- ================== @@ -373,10 +339,9 @@ $#ifndef _%Class_HeaderFile $#define _%Class_HeaderFile $ $class %Inherits; -$ $typedef %Inherits* %Class; $ -$#endif +$#endif // _%Class_HeaderFile @end; -- ===================== @@ -391,36 +356,23 @@ $ $#ifndef _%Class_HeaderFile $#define _%Class_HeaderFile $ -$#ifndef _Standard_HeaderFile $#include -$#endif -$#ifndef _Standard_DefineHandle_HeaderFile $#include -$#endif -$#ifndef _Standard_DefineException_HeaderFile $#include -$#endif -$#ifndef _Standard_SStream_HeaderFile $#include -$#endif -$ -$#ifndef _%Inherits_HeaderFile $#include <%Inherits.hxx> -$#endif -$#ifndef _Handle_%Class_HeaderFile $#include -$#endif $ $#if !defined No_Exception && !defined No_%Class -$#define %Class_Raise_if(CONDITION,MESSAGE) \ +$ #define %Class_Raise_if(CONDITION, MESSAGE) \ $ if (CONDITION) %Class::Raise(MESSAGE); $#else -$#define %Class_Raise_if(CONDITION,MESSAGE) +$ #define %Class_Raise_if(CONDITION, MESSAGE) $#endif $ -$DEFINE_STANDARD_EXCEPTION(%Class,%Inherits) +$DEFINE_STANDARD_EXCEPTION(%Class, %Inherits) $ -$#endif +$#endif // _%Class_HeaderFile @end; @template ExceptionMethod(%Class) is @@ -432,9 +384,7 @@ $IMPLEMENT_STANDARD_EXCEPTION(%Class) -- ============== @template Include(%IClass,%Suffix) is -$#ifndef _%IClass_HeaderFile $#include <%IClass.%Suffix> -$#endif @end; @template IncludeNoSafe(%IClass,%Suffix) is diff --git a/src/CPPExt/CPPExt_TemplateCSFDB.edl b/src/CPPExt/CPPExt_TemplateCSFDB.edl index 5f5ea02..6e49636 100755 --- a/src/CPPExt/CPPExt_TemplateCSFDB.edl +++ b/src/CPPExt/CPPExt_TemplateCSFDB.edl @@ -16,18 +16,10 @@ $ $#ifndef _Handle_%HPName_HeaderFile $#define _Handle_%HPName_HeaderFile $ -$#ifndef _Standard_Macro_HeaderFile $#include -$#endif -$#ifndef _Standard_DefineHandle_HeaderFile $#include -$#endif -$#ifndef _Standard_HeaderFile $#include -$#endif -$#ifndef _Handle_%HPInherits_HeaderFile $#include -$#endif $ $class Standard_Persistent; $class Handle(Standard_Type); @@ -62,22 +54,15 @@ $ $#ifndef _%Class_HeaderFile $#define _%Class_HeaderFile $ -$#ifndef _Standard_Macro_HeaderFile $#include -$#endif -$#ifndef _Standard_DefineHandle_HeaderFile $#include -$#endif -$#ifndef _Standard_HeaderFile $#include -$#endif -$#ifndef _Handle_%Class_HeaderFile $#include -$#endif $ $%TICIncludes $ -$class %Class : public %Inherits { +$class %Class : public %Inherits +${ $ $public: $ @@ -102,10 +87,9 @@ $%TICDefines $%TICInlineIncludes $%TICUndefines $ -$// other Inline functions and methods (like "C++: function call" methods) $%TICSuppMethod $ -$#endif +$#endif // _%Class_HeaderFile @end; @template PersistentCSFDBIxx(%Class,%Suffix,%Supplement,%TypeMgt,%Methods) is @@ -116,9 +100,7 @@ $// this header file considered to be the "object code" form of the original sou $ $#include <%Class.%Suffix> $ -$#ifndef _Standard_Type_HeaderFile $#include -$#endif $ $%Supplement $ @@ -168,4 +150,3 @@ $// DBC_VArray : field $// $#endif @end; - diff --git a/src/CPPExt/CPPExt_TemplateOBJS.edl b/src/CPPExt/CPPExt_TemplateOBJS.edl index d2faf5b..9d1dd0e 100755 --- a/src/CPPExt/CPPExt_TemplateOBJS.edl +++ b/src/CPPExt/CPPExt_TemplateOBJS.edl @@ -32,60 +32,58 @@ $#pragma pointer_size restore $#endif $#endif $ -$#ifndef _Handle_%HPInherits_HeaderFile $#include -$#endif $ $class Oid_%HPName; $class %HPName; $ -$class Handle_%HPName: public Handle_%HPInherits { +$class Handle_%HPName: public Handle_%HPInherits +${ $ $public: $ -$ Handle_%HPName(); -$ Handle_%HPName(const Handle_%HPName& AnObject); -$ Handle_%HPName(const %HPName_ptr AnObject); -$ Standard_EXPORT ~Handle_%HPName(); -$ Handle_%HPName& operator=(const Handle_%HPName& AnObject); -$ Standard_EXPORT Handle_%HPName& operator=(const %HPName_ptr AnObject); -$ Standard_EXPORT static const Handle_%HPName DownCast(const Handle_Standard_Persistent&); -$ Standard_Boolean operator==(const Handle_%HPName& AnObject) const ; -$ Standard_Boolean operator!=(const Handle_%HPName& AnObject) const; -$ Oid_%HPName* operator->() const; +$ Handle_%HPName(); +$ Handle_%HPName(const Handle_%HPName& AnObject); +$ Handle_%HPName(const %HPName_ptr AnObject); +$ Standard_EXPORT ~Handle_%HPName(); +$ Handle_%HPName& operator=(const Handle_%HPName& AnObject); +$ Standard_EXPORT Handle_%HPName& operator=(const %HPName_ptr AnObject); +$ Standard_EXPORT static const Handle_%HPName DownCast(const Handle_Standard_Persistent&); +$ Standard_Boolean operator==(const Handle_%HPName& AnObject) const ; +$ Standard_Boolean operator!=(const Handle_%HPName& AnObject) const; +$ Oid_%HPName* operator->() const; $}; $ -$ $Handle_%HPName::Handle_%HPName() ${ $} $ -$Handle_%HPName::Handle_%HPName(const Handle_%HPName& AnObject) -$ : Handle_%HPInherits(AnObject) +$Handle_%HPName::Handle_%HPName (const Handle_%HPName& theObject) +$: Handle_%HPInherits (theObject) ${ $} $ -$Handle_%HPName::Handle_%HPName(const %HPName_ptr AnObject) -$ : Handle_%HPInherits((const %HPInherits_ptr)AnObject) +$Handle_%HPName::Handle_%HPName (const %HPName_ptr theObject) +$: Handle_%HPInherits ((const %HPInherits_ptr)theObject) ${ $} $ -$Handle_%HPName& Handle_%HPName::operator=(const Handle_%HPName& AnObject) +$Handle_%HPName& Handle_%HPName::operator= (const Handle_%HPName& theObject) ${ -$ Identifier=AnObject.Identifier; return *this; +$ Identifier = theObject.Identifier; return *this; $} $ -$Standard_Boolean Handle_%HPName::operator==(const Handle_%HPName& AnObject)const +$Standard_Boolean Handle_%HPName::operator== (const Handle_%HPName& theObject) const ${ -$ return Identifier==AnObject.Identifier; +$ return Identifier == theObject.Identifier; $} $ -$Standard_Boolean Handle_%HPName::operator!=(const Handle_%HPName& AnObject)const +$Standard_Boolean Handle_%HPName::operator!= (const Handle_%HPName& theObject) const ${ -$ return Identifier!=AnObject.Identifier; +$ return Identifier != theObject.Identifier; $} $ -$Oid_%HPName* Handle_%HPName::operator->() const +$Oid_%HPName* Handle_%HPName::operator->() const ${ $ return (Oid_%HPName*)(void*)&(((Handle_%HPName_ptr)this)->Identifier); $} @@ -134,16 +132,15 @@ $#pragma pointer_size restore $#endif $#endif $ -$#ifndef _Handle_%Class_HeaderFile $#include -$#endif $ $%TICIncludes $#ifndef _Standard_ImmutableObject_HeaderFile $#include $#endif $ -$class Oid_%Class : public Oid_%Inherits { +$class Oid_%Class : public Oid_%Inherits +${ $ $friend class %Class; $%TICPublicfriends @@ -151,8 +148,8 @@ $ $public: $ $%TICOidpubMet -$Oid_%Class() {}; -$~Oid_%Class() {}; +$ Oid_%Class() {}; +$ ~Oid_%Class() {}; $ $protected: $ diff --git a/src/CPPExt/CPPExt_TemplateOBJY.edl b/src/CPPExt/CPPExt_TemplateOBJY.edl index 578f731..91edd94 100755 --- a/src/CPPExt/CPPExt_TemplateOBJY.edl +++ b/src/CPPExt/CPPExt_TemplateOBJY.edl @@ -113,16 +113,13 @@ $// $#ifndef _%Class_HeaderFile $#define _%Class_HeaderFile $ -$#ifndef _Handle_%Class_HeaderFile $#include -$#endif $ $%TICIncludes -$#ifndef _Standard_ImmutableObject_HeaderFile $#include -$#endif $ -$class Oid_%Class : public Oid_%Inherits { +$class Oid_%Class : public Oid_%Inherits +${ $ $friend class %Class; $%TICPublicfriends @@ -130,8 +127,8 @@ $ $public: $ $%TICOidpubMet -$Oid_%Class() {}; -$~Oid_%Class() {}; +$ Oid_%Class() {}; +$ ~Oid_%Class() {}; $ $protected: $ @@ -142,20 +139,17 @@ $ $%TICOidpriMet $}; $ -$class %Class : public %Inherits { +$class %Class : public %Inherits +${ $ $friend class Oid_%Class; $ $public: $ -$ // Methods PUBLIC -$ // $%TICPublicmets $ $%TICPublicfriends $ -$ // Type management -$ // $ friend Handle_Standard_Type& %Class_Type_(); $ const Handle(Standard_Type)& DynamicType() const; $ Standard_Boolean IsKind(const Handle(Standard_Type)&) const; @@ -163,22 +157,14 @@ $ void* operator new(size_t); $ $protected: $ -$ // Methods PROTECTED -$ // $%TICProtectedmets $ -$ // Fields PROTECTED -$ // $%TICProtectedfields $ $private: $ -$ // Methods PRIVATE -$ // $%TICPrivatemets $ -$ // Fields PRIVATE -$ // $%TICPrivatefields $%TICPrivatefriends $}; @@ -187,8 +173,6 @@ $%TICDefines $%TICInlineIncludes $%TICUndefines $ -$// other Inline functions and methods (like "C++: function call or Oid methods" methods) -$// $%TICSuppMethod $ $#endif @@ -202,27 +186,24 @@ $// this header file considered to be the "object code" form of the original sou $// $#include <%Class.%Suffix> $ -$#ifndef _Standard_TypeMismatch_HeaderFile $#include -$#endif $ $%Supplement $ $%TypeMgt $ -$ // new operator -$ // -$ void* %Class::operator new (size_t ASize) -$ { -$ Standard_Container _aContainer = PreNew(); -$ return (opiNewObj(ASize,ooTypeN(%Class),_aContainer)); -$ } -$ -$ Handle_%Class& Handle_%Class::operator=(const %Class* AnObject) -$ { -$ Identifier = AnObject; -$ return *this; -$ } +$// new operator +$void* %Class::operator new (size_t theSize) +${ +$ Standard_Container _aContainer = PreNew(); +$ return (opiNewObj(theSize, ooTypeN(%Class),_aContainer)); +$} +$ +$Handle_%Class& Handle_%Class::operator= (const %Class* theObject) +${ +$ Identifier = theObject; +$ return *this; +$} $ $%Methods @end; diff --git a/src/CPPExt/CPPExt_Transient.cxx b/src/CPPExt/CPPExt_Transient.cxx index ab35dca..c0ff2dd 100755 --- a/src/CPPExt/CPPExt_Transient.cxx +++ b/src/CPPExt/CPPExt_Transient.cxx @@ -86,8 +86,10 @@ void CPP_TransientDerivated(const Handle(MS_MetaSchema)& aMeta, api->AddVariable(VSuffix,"hxx"); - for (i = 1; i <= inclist->Length(); i++) { - api->AddVariable(VIClass,inclist->Value(i)->ToCString()); + for (i = 1; i <= inclist->Length(); i++) + { + Handle(TCollection_HAsciiString) aName = CPP_WithoutHandleSuffix (inclist->Value (i)); + api->AddVariable (VIClass, aName->ToCString()); api->Apply(VoutClass,"Include"); result->AssignCat(api->GetVariableValue(VoutClass)); } @@ -368,14 +370,19 @@ void CPP_TransientClass(const Handle(MS_MetaSchema)& aMeta, api->AddVariable(VSuffix,"hxx"); - for (i = 1; i <= List->Length(); i++) { - if (!List->Value(i)->IsSameString(theClass->FullName())) { - api->AddVariable(VIClass,List->Value(i)->ToCString()); - api->Apply(VTICIncludes,"Include"); - publics->AssignCat(api->GetVariableValue(VTICIncludes)); + for (i = 1; i <= List->Length(); i++) + { + Handle(TCollection_HAsciiString) aName = List->Value (i); + if (aName->IsSameString (theClass->FullName())) + { + continue; } - } + ///aName = CPP_WithoutHandleSuffix (aName); + api->AddVariable (VIClass, aName->ToCString()); + api->Apply (VTICIncludes, "Include"); + publics->AssignCat (api->GetVariableValue (VTICIncludes)); + } for (i = 1; i <= incp->Length(); i++) { if (!incp->Value(i)->IsSameString(theClass->FullName())) {