From 706128315206c53ee6e99bd099c57aebe193c731 Mon Sep 17 00:00:00 2001 From: skl Date: Fri, 27 Nov 2020 09:10:38 +0300 Subject: [PATCH] 0031481: Data Exchange - provide parser of STEP EXPRESS schema for generation of new STEP entities Formatting added files from package Express following OCCT Coding Rules --- src/Express/Express.cxx | 35 +- src/Express/Express.hxx | 2 - src/Express/Express_Alias.cxx | 10 +- src/Express/Express_Alias.hxx | 15 - src/Express/Express_Boolean.hxx | 18 - src/Express/Express_ComplexType.cxx | 55 +- src/Express/Express_ComplexType.hxx | 27 +- .../Express_DataMapOfAsciiStringItem.hxx | 6 +- src/Express/Express_Entity.cxx | 835 +++++++++++------- src/Express/Express_Entity.hxx | 40 +- src/Express/Express_Enum.cxx | 35 +- src/Express/Express_Enum.hxx | 16 - src/Express/Express_Field.cxx | 14 +- src/Express/Express_Field.hxx | 26 +- src/Express/Express_HSequenceOfEntity.hxx | 1 - src/Express/Express_HSequenceOfField.hxx | 1 - src/Express/Express_HSequenceOfItem.hxx | 1 - src/Express/Express_Integer.hxx | 17 - src/Express/Express_Item.cxx | 50 +- src/Express/Express_Item.hxx | 20 +- src/Express/Express_Logical.cxx | 2 +- src/Express/Express_Logical.hxx | 18 - src/Express/Express_NamedType.cxx | 28 +- src/Express/Express_NamedType.hxx | 21 +- src/Express/Express_PredefinedType.hxx | 17 - src/Express/Express_Real.cxx | 2 +- src/Express/Express_Real.hxx | 18 - src/Express/Express_Reference.cxx | 7 +- src/Express/Express_Reference.hxx | 21 +- src/Express/Express_Schema.cxx | 234 +++-- src/Express/Express_Schema.hxx | 18 +- src/Express/Express_Select.cxx | 450 ++++++---- src/Express/Express_Select.hxx | 15 - src/Express/Express_SequenceOfEntity.hxx | 1 - src/Express/Express_SequenceOfField.hxx | 1 - src/Express/Express_SequenceOfItem.hxx | 1 - src/Express/Express_String.hxx | 19 - src/Express/Express_Type.cxx | 5 +- src/Express/Express_Type.hxx | 20 +- 39 files changed, 1159 insertions(+), 963 deletions(-) diff --git a/src/Express/Express.cxx b/src/Express/Express.cxx index 6ac1793577..25f115bdf3 100644 --- a/src/Express/Express.cxx +++ b/src/Express/Express.cxx @@ -34,18 +34,21 @@ Handle(Express_Schema) &Express::Schema () //======================================================================= //function : WriteFileStamp -//purpose : +//purpose : Write header of HXX or CXX file //======================================================================= -// Write header of HXX or CXX file void Express::WriteFileStamp (Standard_OStream &os) { - static const char *EC_VERSION = "2.0"; + static const char* EC_VERSION = "2.0"; Standard_CString comm = "//"; TCollection_AsciiString timestring; - if ( getenv ( "EXPTOCAS_TIME" ) ) timestring = getenv ( "EXPTOCAS_TIME" ); - else { + if (getenv("EXPTOCAS_TIME")) + { + timestring = getenv("EXPTOCAS_TIME"); + } + else + { time_t curtime; time ( &curtime ); timestring = ctime ( &curtime ); @@ -93,12 +96,18 @@ void Express::WriteMethodStamp (Standard_OStream &os, const Handle(TCollection_H Handle(TCollection_HAsciiString) Express::ToStepName (const Handle(TCollection_HAsciiString) &name) { - Handle(TCollection_HAsciiString) stepname = new TCollection_HAsciiString ( name ); - for ( Standard_Integer i=2; i <= stepname->Length(); i++ ) - if ( isupper ( stepname->Value(i) ) ) stepname->Insert ( i++, '_' ); + Handle(TCollection_HAsciiString) stepname = new TCollection_HAsciiString(name); + for (Standard_Integer i = 2; i <= stepname->Length(); i++) + { + if (isupper(stepname->Value(i))) + { + stepname->Insert(i++, '_'); + } + } stepname->LowerCase(); return stepname; } + //======================================================================= //function : GetPrefixEnum //purpose : @@ -107,11 +116,13 @@ Handle(TCollection_HAsciiString) Express::ToStepName (const Handle(TCollection_H Handle(TCollection_HAsciiString) Express::EnumPrefix (const Handle(TCollection_HAsciiString) &name) { Handle(TCollection_HAsciiString) stepname = new TCollection_HAsciiString; - for ( Standard_Integer i=1; i <= name->Length(); i++ ) - if ( isupper ( name->Value(i) ) ) { - - stepname->AssignCat (new TCollection_HAsciiString(name->Value(i)) ); + for (Standard_Integer i = 1; i <= name->Length(); i++) + { + if (isupper(name->Value(i))) + { + stepname->AssignCat(new TCollection_HAsciiString(name->Value(i))); } + } stepname->LowerCase(); return stepname; } diff --git a/src/Express/Express.hxx b/src/Express/Express.hxx index 544b01d62f..053a3503a9 100644 --- a/src/Express/Express.hxx +++ b/src/Express/Express.hxx @@ -15,7 +15,6 @@ #define _Express_HeaderFile #include - #include #include @@ -32,7 +31,6 @@ public: DEFINE_STANDARD_ALLOC - //! Returns (modifiable) handle to static schema object Standard_EXPORT static Handle(Express_Schema)& Schema() ; diff --git a/src/Express/Express_Alias.cxx b/src/Express/Express_Alias.cxx index b270fe4706..1a09060dc2 100644 --- a/src/Express/Express_Alias.cxx +++ b/src/Express/Express_Alias.cxx @@ -23,9 +23,8 @@ IMPLEMENT_STANDARD_RTTIEXT(Express_Alias,Express_Item) //purpose : //======================================================================= -Express_Alias::Express_Alias (const Standard_CString name, - const Handle(Express_Type) &type) - : Express_Item(name), myType(type) +Express_Alias::Express_Alias(const Standard_CString name, const Handle(Express_Type) &type) + : Express_Item(name), myType(type) { } @@ -56,7 +55,8 @@ Handle(TCollection_HAsciiString) Express_Alias::CPPName () const Standard_Boolean Express_Alias::GenerateClass () const { -// std::cout << "Warning: writing ALIAS is not yet implemented, cannot generate " << Name()->ToCString() << std::endl; - std::cout << "ALIAS " << Name()->ToCString() << " = " << Type()->CPPName()->ToCString() << " used; no generation is needed" << std::endl; + //std::cout << "Warning: writing ALIAS is not yet implemented, cannot generate " << Name()->ToCString() << std::endl; + std::cout << "ALIAS " << Name()->ToCString() << " = " << Type()->CPPName()->ToCString() + << " used; no generation is needed" << std::endl; return Standard_False; } diff --git a/src/Express/Express_Alias.hxx b/src/Express/Express_Alias.hxx index 3498604d6d..d1c18ea3f2 100644 --- a/src/Express/Express_Alias.hxx +++ b/src/Express/Express_Alias.hxx @@ -20,14 +20,12 @@ class TCollection_HAsciiString; - //! Implements TYPE = type (alias) item of the EXPRESS //! schema, with interface for deferred Item class. class Express_Alias : public Express_Item { public: - //! Create ALIAS item and initialize it Standard_EXPORT Express_Alias(const Standard_CString name, const Handle(Express_Type)& type); @@ -41,28 +39,15 @@ public: //! Create HXX/CXX files from item Standard_EXPORT virtual Standard_Boolean GenerateClass() const Standard_OVERRIDE; - - - DEFINE_STANDARD_RTTIEXT(Express_Alias,Express_Item) protected: - - private: - Handle(Express_Type) myType; - }; - - - - - - #endif // _Express_Alias_HeaderFile diff --git a/src/Express/Express_Boolean.hxx b/src/Express/Express_Boolean.hxx index f97d846156..f859118c75 100644 --- a/src/Express/Express_Boolean.hxx +++ b/src/Express/Express_Boolean.hxx @@ -15,45 +15,27 @@ #define _Express_Boolean_HeaderFile #include - #include class TCollection_HAsciiString; - //! Implements EXPRESS type 'BOOLEAN' class Express_Boolean : public Express_PredefinedType { public: - //! Empty constructor Standard_EXPORT Express_Boolean(); //! Returns "Standard_Boolean" Standard_EXPORT virtual Handle(TCollection_HAsciiString) CPPName() const Standard_OVERRIDE; - - - DEFINE_STANDARD_RTTIEXT(Express_Boolean,Express_PredefinedType) protected: - - - private: - - - }; - - - - - - #endif // _Express_Boolean_HeaderFile diff --git a/src/Express/Express_ComplexType.cxx b/src/Express/Express_ComplexType.cxx index b5fc6b0eab..a233c99839 100644 --- a/src/Express/Express_ComplexType.cxx +++ b/src/Express/Express_ComplexType.cxx @@ -24,9 +24,10 @@ IMPLEMENT_STANDARD_RTTIEXT(Express_ComplexType,Express_Type) //purpose : //======================================================================= -Express_ComplexType::Express_ComplexType (const Standard_Integer imin, - const Standard_Integer imax, - const Handle(Express_Type) &type) +Express_ComplexType::Express_ComplexType ( + const Standard_Integer imin, + const Standard_Integer imax, + const Handle(Express_Type) &type) { myMin = imin; myMax = imax; @@ -52,28 +53,44 @@ Handle(TCollection_HAsciiString) Express_ComplexType::CPPName () const { // check if array 2 Handle(Express_Type) type = myType; - if ( type->IsKind ( STANDARD_TYPE(Express_ComplexType) ) ) { - Handle(Express_ComplexType) c2 = Handle(Express_ComplexType)::DownCast ( type ); + if (type->IsKind(STANDARD_TYPE(Express_ComplexType))) + { + Handle(Express_ComplexType) c2 = Handle(Express_ComplexType)::DownCast(type); type = c2->Type(); } // parse name of array argument Handle(TCollection_HAsciiString) name = type->CPPName(); - Standard_Integer split = name->Location ( 1, '_', 1, name->Length() ); + Standard_Integer split = name->Location(1, '_', 1, name->Length()); Handle(TCollection_HAsciiString) cls; - if ( split ) cls = name->Split ( split ); - else cls = name; + if (split) + { + cls = name->Split(split); + } + else + { + cls = name; + } Handle(TCollection_HAsciiString) str = new TCollection_HAsciiString("TCollection"); - Standard_Integer ind =name->Location(str,1,name->Length()); - if(ind) - name = new TCollection_HAsciiString ( "Interface_" ); + Standard_Integer ind = name->Location(str, 1, name->Length()); + if (ind) + { + name = new TCollection_HAsciiString("Interface_"); + } // generate name - if ( type->IsStandard() || ! split ) { - name = new TCollection_HAsciiString ( "TColStd_" ); + if (type->IsStandard() || !split) + { + name = new TCollection_HAsciiString("TColStd_"); + } + if (type == myType) + { + name->AssignCat("HArray1Of"); + } + else + { + name->AssignCat("HArray2Of"); } - if ( type == myType ) name->AssignCat ( "HArray1Of" ); - else name->AssignCat ( "HArray2Of" ); - name->AssignCat ( cls ); + name->AssignCat(cls); return name; } @@ -82,9 +99,9 @@ Handle(TCollection_HAsciiString) Express_ComplexType::CPPName () const //purpose : //======================================================================= -Standard_Boolean Express_ComplexType::Use (const Handle(TCollection_HAsciiString) &pack, - const Standard_Boolean defer) const +Standard_Boolean Express_ComplexType::Use( + const Handle(TCollection_HAsciiString) &pack, + const Standard_Boolean defer) const { - return myType->Use ( pack, defer ); } diff --git a/src/Express/Express_ComplexType.hxx b/src/Express/Express_ComplexType.hxx index e002575d38..3d7b2a372a 100644 --- a/src/Express/Express_ComplexType.hxx +++ b/src/Express/Express_ComplexType.hxx @@ -15,12 +15,9 @@ #define _Express_ComplexType_HeaderFile #include - #include - class TCollection_HAsciiString; - //! Base class for complex types (ARRAY, LIST, BAG, SET) //! in EXPRESS schema //! Stores type of elements and @@ -28,10 +25,12 @@ class Express_ComplexType : public Express_Type { public: - //! Creates an object and initializes fields - Standard_EXPORT Express_ComplexType(const Standard_Integer imin, const Standard_Integer imax, const Handle(Express_Type)& type); + Standard_EXPORT Express_ComplexType( + const Standard_Integer imin, + const Standard_Integer imax, + const Handle(Express_Type)& type); //! Returns type of complex type items Standard_EXPORT const Handle(Express_Type)& Type() const; @@ -41,32 +40,20 @@ public: //! Declares type as used by some item being generated. //! Calls Use() for type of elements - Standard_EXPORT virtual Standard_Boolean Use (const Handle(TCollection_HAsciiString)& pack, const Standard_Boolean defer = Standard_False) const Standard_OVERRIDE; - - - + Standard_EXPORT virtual Standard_Boolean Use( + const Handle(TCollection_HAsciiString)& pack, + const Standard_Boolean defer = Standard_False) const Standard_OVERRIDE; DEFINE_STANDARD_RTTIEXT(Express_ComplexType,Express_Type) protected: - - - private: - Standard_Integer myMin; Standard_Integer myMax; Handle(Express_Type) myType; - }; - - - - - - #endif // _Express_ComplexType_HeaderFile diff --git a/src/Express/Express_DataMapOfAsciiStringItem.hxx b/src/Express/Express_DataMapOfAsciiStringItem.hxx index 6098317471..b33454fe48 100644 --- a/src/Express/Express_DataMapOfAsciiStringItem.hxx +++ b/src/Express/Express_DataMapOfAsciiStringItem.hxx @@ -18,7 +18,9 @@ #include #include -typedef NCollection_DataMap Express_DataMapOfAsciiStringItem; -typedef NCollection_DataMap::Iterator Express_DataMapIteratorOfDataMapOfAsciiStringItem; +typedef NCollection_DataMap Express_DataMapOfAsciiStringItem; +typedef NCollection_DataMap::Iterator Express_DataMapIteratorOfDataMapOfAsciiStringItem; #endif diff --git a/src/Express/Express_Entity.cxx b/src/Express/Express_Entity.cxx index f507f4bfc6..30a8e3a999 100644 --- a/src/Express/Express_Entity.cxx +++ b/src/Express/Express_Entity.cxx @@ -43,16 +43,22 @@ IMPLEMENT_STANDARD_RTTIEXT(Express_Entity,Express_Item) //purpose : //======================================================================= -Express_Entity::Express_Entity (const Standard_CString name, - const Handle(TColStd_HSequenceOfHAsciiString) &inherit, - const Handle(Express_HSequenceOfField) &flds) - : Express_Item(name), mySupers(inherit), myFields(flds) - +Express_Entity::Express_Entity( + const Standard_CString name, + const Handle(TColStd_HSequenceOfHAsciiString) &inherit, + const Handle(Express_HSequenceOfField) &flds) + : Express_Item(name), mySupers(inherit), myFields(flds) { // make empty lists to avoid checking every time myInherit = new Express_HSequenceOfEntity; - if ( mySupers.IsNull() ) mySupers = new TColStd_HSequenceOfHAsciiString; - if ( myFields.IsNull() ) myFields = new Express_HSequenceOfField; + if (mySupers.IsNull()) + { + mySupers = new TColStd_HSequenceOfHAsciiString; + } + if (myFields.IsNull()) + { + myFields = new Express_HSequenceOfField; + } myisAbstract = Standard_False; } @@ -93,9 +99,12 @@ const Handle(Express_HSequenceOfField) &Express_Entity::Fields () const Standard_Integer Express_Entity::NbFields (const Standard_Boolean inherited) const { Standard_Integer num = myFields->Length(); - if ( inherited ) { - for ( Standard_Integer i=1; i <= myInherit->Length(); i++ ) - num += myInherit->Value(i)->NbFields ( inherited ); + if (inherited) + { + for (Standard_Integer i = 1; i <= myInherit->Length(); i++) + { + num += myInherit->Value(i)->NbFields(inherited); + } } return num; } @@ -105,15 +114,16 @@ Standard_Integer Express_Entity::NbFields (const Standard_Boolean inherited) con //purpose : //======================================================================= -static void WriteGetMethod (Standard_OStream &os, - const Handle(TCollection_HAsciiString) name, - const Handle(TCollection_HAsciiString) field, - const Handle(TCollection_HAsciiString) type, - const Standard_Boolean isHandle, - const Standard_Boolean /*isSimple*/) +static void WriteGetMethod( + Standard_OStream &os, + const Handle(TCollection_HAsciiString) name, + const Handle(TCollection_HAsciiString) field, + const Handle(TCollection_HAsciiString) type, + const Standard_Boolean isHandle, + const Standard_Boolean /*isSimple*/) { Handle(TCollection_HAsciiString) method = field;//new TCollection_HAsciiString ( "Get" ); -// method->AssignCat ( field ); + //method->AssignCat ( field ); Express::WriteMethodStamp ( os, method ); os << ( isHandle ? "Handle(" : "" ) << type->ToCString() << ( isHandle ? ") " : " " ) << name->ToCString() << "::" << method->ToCString() << " () const" << std::endl; @@ -125,19 +135,20 @@ static void WriteGetMethod (Standard_OStream &os, //purpose : //======================================================================= -static void WriteSetMethod (Standard_OStream &os, - const Handle(TCollection_HAsciiString) name, - const Handle(TCollection_HAsciiString) field, - const Handle(TCollection_HAsciiString) type, - const Standard_Boolean isHandle, - const Standard_Boolean isSimple) +static void WriteSetMethod( + Standard_OStream &os, + const Handle(TCollection_HAsciiString) name, + const Handle(TCollection_HAsciiString) field, + const Handle(TCollection_HAsciiString) type, + const Standard_Boolean isHandle, + const Standard_Boolean isSimple) { - Handle(TCollection_HAsciiString) method = new TCollection_HAsciiString ( "Set" ); - method->AssignCat ( field ); - Express::WriteMethodStamp ( os, method ); + Handle(TCollection_HAsciiString) method = new TCollection_HAsciiString("Set"); + method->AssignCat(field); + Express::WriteMethodStamp(os, method); os << "void " << name->ToCString() << "::" << method->ToCString() << " (const " << - ( isHandle ? "Handle(" : "" ) << type->ToCString() << ( isHandle ? ")" : "" ) << - ( isSimple ? "" : "&" ) << " the" << field->ToCString() << ")" << std::endl; + (isHandle ? "Handle(" : "") << type->ToCString() << (isHandle ? ")" : "") << + (isSimple ? "" : "&") << " the" << field->ToCString() << ")" << std::endl; os << "{" << std::endl << " my" << field->ToCString() << " = the" << field->ToCString() << ";\n}" << std::endl; } @@ -148,7 +159,7 @@ static void WriteSetMethod (Standard_OStream &os, static inline void WriteSpaces (Standard_OStream &os, Standard_Integer num) { - for ( Standard_Integer i=0; i < num; i++ ) os << " "; + for (Standard_Integer i = 0; i < num; i++) os << " "; } //======================================================================= @@ -180,11 +191,13 @@ Standard_Boolean Express_Entity::GenerateClass () const Express::WriteFileStamp ( os ); Handle(TCollection_HAsciiString) InheritName = new TCollection_HAsciiString("Standard_Transient"); - if (myInherit->Length() > 0) { // first inherited class will be actually inherited + if (myInherit->Length() > 0) + { // first inherited class will be actually inherited Handle(Express_Entity) it = myInherit->Value(1); it->Use(GetPackageName()); InheritName = it->CPPName(); - if (myInherit->Length() > 1) { + if (myInherit->Length() > 1) + { std::cout << "Warning: ENTITY " << Name()->ToCString() << " defined with multiple inheritance;" << std::endl; std::cout << "Warning: only first base class is actually inherited, others are made fields" << std::endl; } @@ -265,26 +278,40 @@ Standard_Boolean Express_Entity::GenerateClass () const os << std::endl; // write fields section - if ( myInherit->Length() >1 || myFields->Length() >0 ) { + if ( myInherit->Length() >1 || myFields->Length() >0 ) + { os << "private:" << std::endl; - for (Standard_Integer i = 2; i <= myInherit->Length(); i++) { + for (Standard_Integer i = 2; i <= myInherit->Length(); i++) + { Handle(Express_Entity) it = myInherit->Value(i); Handle(TCollection_HAsciiString) name = it->Name(); os << " Handle(" << it->CPPName()->ToCString() << ") my" << name->ToCString() << "; //!< supertype" << std::endl; } - for (Standard_Integer i = 1; i <= myFields->Length(); i++) { + for (Standard_Integer i = 1; i <= myFields->Length(); i++) + { Handle(Express_Field) field = myFields->Value(i); if (field->Type()->IsHandle()) + { os << " Handle(" << field->Type()->CPPName()->ToCString() << ") my" << field->Name()->ToCString() << ";"; + } else + { os << " " << field->Type()->CPPName()->ToCString() << " my" << field->Name()->ToCString() << ";"; - if (field->IsOptional()) os << " //!< optional"; + } + if (field->IsOptional()) + { + os << " //!< optional"; + } os << std::endl; } // optional fields: flag 'is field set' - for (Standard_Integer i = 1; i <= myFields->Length(); i++) { + for (Standard_Integer i = 1; i <= myFields->Length(); i++) + { Handle(Express_Field) field = myFields->Value(i); - if (!field->IsOptional()) continue; + if (!field->IsOptional()) + { + continue; + } os << " Standard_Boolean def" << field->Name()->ToCString() << "; //!< flag \"is " << field->Name()->ToCString() << " defined\"" << std::endl; } @@ -314,14 +341,16 @@ Standard_Boolean Express_Entity::GenerateClass () const Express::WriteMethodStamp ( os, CPPname ); os << CPPname->ToCString() << "::" << CPPname->ToCString() << " ()" << std::endl; os << "{" << std::endl; - for (Standard_Integer i=1; i <= myFields->Length(); i++ ) { + for (Standard_Integer i=1; i <= myFields->Length(); i++ ) + { Handle(Express_Field) field = myFields->Value ( i ); if ( field->IsOptional() ) os << " def" << field->Name()->ToCString() << " = Standard_False;" << std::endl; } os << "}" << std::endl; // write method Init() - if ( myInherit->Length() >1 || myFields->Length() >0 ) { + if ( myInherit->Length() >1 || myFields->Length() >0 ) + { Express::WriteMethodStamp ( os, new TCollection_HAsciiString ( "Init" ) ); os << "void " << CPPname->ToCString() << "::Init ("; MakeInit ( os, 13 + CPPname->Length(), Standard_True, 1 ); @@ -331,17 +360,22 @@ Standard_Boolean Express_Entity::GenerateClass () const } // write "methods" section - for (Standard_Integer i=2; i <= myInherit->Length(); i++ ) { + for (Standard_Integer i=2; i <= myInherit->Length(); i++ ) + { Handle(Express_Entity) it = myInherit->Value(i); WriteGetMethod ( os, CPPname, it->Name(), it->CPPName(), Standard_True, Standard_False ); WriteSetMethod ( os, CPPname, it->Name(), it->CPPName(), Standard_True, Standard_False ); } - for (Standard_Integer i=1; i <= myFields->Length(); i++ ) { + for (Standard_Integer i=1; i <= myFields->Length(); i++ ) + { Handle(Express_Field) field = myFields->Value ( i ); Handle(Express_Type) type = field->Type(); WriteGetMethod ( os, CPPname, field->Name(), type->CPPName(), type->IsHandle(), type->IsSimple() ); WriteSetMethod ( os, CPPname, field->Name(), type->CPPName(), type->IsHandle(), type->IsSimple() ); - if ( ! field->IsOptional() ) continue; + if (!field->IsOptional()) + { + continue; + } Handle(TCollection_HAsciiString) method = new TCollection_HAsciiString ( "Has" ); method->AssignCat ( field->Name() ); Express::WriteMethodStamp ( os, method ); @@ -401,7 +435,8 @@ Standard_Boolean Express_Entity::GenerateClass () const os << " Standard_EXPORT " << RWCPPName->ToCString() << "();" << std::endl << std::endl; // read step - os << " Standard_EXPORT void ReadStep(const Handle(StepData_StepReaderData)& data, const Standard_Integer num, Handle(Interface_Check)& ach, const Handle(" << + os << " Standard_EXPORT void ReadStep(const Handle(StepData_StepReaderData)& data," << + " const Standard_Integer num, Handle(Interface_Check)& ach, const Handle(" << CPPName()->ToCString() << ")& ent) const;" << std::endl << std::endl; // write step @@ -440,7 +475,7 @@ Standard_Boolean Express_Entity::GenerateClass () const os << RWCPPName->ToCString() << "::" << RWCPPName->ToCString() << "() {}" << std::endl << std::endl; // write method ReadStep - Express::WriteMethodStamp ( os, new TCollection_HAsciiString ( "ReadStep" ) ); + Express::WriteMethodStamp(os, new TCollection_HAsciiString("ReadStep")); os << "void " << RWCPPName->ToCString() << "::ReadStep (const Handle(StepData_StepReaderData)& data," << std::endl; WriteSpaces ( os, 17 + RWCPPName->Length() ); os << "const Standard_Integer num," << std::endl; @@ -452,9 +487,9 @@ Standard_Boolean Express_Entity::GenerateClass () const Standard_Integer nbFld = NbFields ( Standard_True ); os << " // Check number of parameters" << std::endl; - os << " if ( ! data->CheckNbParams(num," << nbFld << ",ach,\"" << - Express::ToStepName ( Name() )->ToCString() << "\") ) return;" << std::endl; - WriteRWReadCode ( os, 1, Standard_True ); // write code for reading inherited and own fields + os << " if ( ! data->CheckNbParams(num," << nbFld << ",ach,\"" << + Express::ToStepName(Name())->ToCString() << "\") ) return;" << std::endl; + WriteRWReadCode(os, 1, Standard_True); // write code for reading inherited and own fields os << std::endl; os << " // Initialize entity" << std::endl; os << " ent->Init("; @@ -468,7 +503,7 @@ Standard_Boolean Express_Entity::GenerateClass () const os << "const Handle(" << CPPname->ToCString() << ")& ent) const" << std::endl; os << "{" << std::endl; - WriteRWWriteCode ( os, 0, Standard_True ); // write code for writing inherited and own fields + WriteRWWriteCode(os, 0, Standard_True); // write code for writing inherited and own fields os << "}" << std::endl; // write method Share @@ -479,8 +514,9 @@ Standard_Boolean Express_Entity::GenerateClass () const os << "{" << std::endl; WriteRWShareCode ( os, 1, Standard_True ); // write code for filling graph of references os << "}" << std::endl; - if(CheckFlag()) { - Express::WriteMethodStamp ( os, new TCollection_HAsciiString ( "Check" ) ); + if(CheckFlag()) + { + Express::WriteMethodStamp(os, new TCollection_HAsciiString("Check")); os << "void " << RWCPPName->ToCString() << "::Check(const Handle(Standard_Transient)& entt," << std::endl; WriteSpaces ( os, 18 + RWCPPName->Length() ); os << "const Interface_ShareTool& shares,"<< std::endl; @@ -491,16 +527,17 @@ Standard_Boolean Express_Entity::GenerateClass () const os<<" Handle("<ToCString() << ") ent = Handle("<ToCString() <<")::DownCast(entt);"<< std::endl; os << "}" << std::endl; } - if(FillSharedFlag()) { - Express::WriteMethodStamp ( os, new TCollection_HAsciiString ( "FillShared" ) ); + if(FillSharedFlag()) + { + Express::WriteMethodStamp(os, new TCollection_HAsciiString("FillShared")); os << "void " << RWCPPName->ToCString() << "::Share(const Handle(Interface_InterfaceModel)& model," << std::endl; - WriteSpaces ( os, 18 + RWCPPName->Length() ); - os << "const Handle(Standard_Transient)& entt,"<< std::endl; - WriteSpaces ( os, 18 + RWCPPName->Length() ); - os << "Interface_EntityIterator& iter) const"<< std::endl; + WriteSpaces(os, 18 + RWCPPName->Length()); + os << "const Handle(Standard_Transient)& entt," << std::endl; + WriteSpaces(os, 18 + RWCPPName->Length()); + os << "Interface_EntityIterator& iter) const" << std::endl; os << "{" << std::endl; //DownCast entity to it's type - os<<" Handle("<ToCString() << ") ent = Handle("<ToCString() <<")::DownCast(entt)"<< std::endl; + os << " Handle(" << CPPname->ToCString() << ") ent = Handle(" << CPPname->ToCString() << ")::DownCast(entt)" << std::endl; os << "}" << std::endl; } @@ -514,14 +551,14 @@ Standard_Boolean Express_Entity::GenerateClass () const TCollection_AsciiString regDir = "Registration"; OSD_Path path_reg(regDir); OSD_Directory dir_reg(regDir); - dir_reg.Build ( prot ); + dir_reg.Build(prot); regDir += "/"; - + TCollection_AsciiString packname_inc = "inc.txt"; TCollection_AsciiString packname_rwinc = "rwinc.txt"; // write file with includes os.open(regDir.Cat(packname_inc).ToCString(), std::ios::app); - os <<"#include <" << CPPName()->ToCString() << ".hxx>" << std::endl; + os << "#include <" << CPPName()->ToCString() << ".hxx>" << std::endl; os.close(); // write file with RW includes os.open(regDir.Cat(packname_rwinc).ToCString(), std::ios::app); @@ -529,7 +566,8 @@ Standard_Boolean Express_Entity::GenerateClass () const os.close(); // generate data for entity registration - if (anIndex > 0) { + if (anIndex > 0) + { // StepAP214_Protocol.cxx TCollection_AsciiString packname_protocol = "protocol.txt"; os.open(regDir.Cat(packname_protocol).ToCString(), std::ios::app); @@ -566,7 +604,7 @@ Standard_Boolean Express_Entity::GenerateClass () const TCollection_AsciiString packname_reco = "reco.txt"; os.open(regDir.Cat(packname_reco).ToCString(), std::ios::app); os << " static TCollection_AsciiString Reco_" << Name()->ToCString() << "(\"" - << recoName->ToCString() << "\");" << std::endl; + << recoName->ToCString() << "\");" << std::endl; os.close(); //type bind TCollection_AsciiString packname_typebind = "typebind.txt"; @@ -611,25 +649,40 @@ Standard_Boolean Express_Entity::GenerateClass () const //purpose : //======================================================================= -Standard_Boolean Express_Entity::WriteIncludes (Standard_OStream &os, - DataMapOfStringInteger &dict) const +Standard_Boolean Express_Entity::WriteIncludes( + Standard_OStream &os, + DataMapOfStringInteger &dict) const { - for ( Standard_Integer i=1; i <= myInherit->Length(); i++ ) { + for (Standard_Integer i = 1; i <= myInherit->Length(); i++) + { Handle(Express_Entity) it = myInherit->Value(i); - it->WriteIncludes ( os, dict ); - if ( i <= 1 ) continue; + it->WriteIncludes(os, dict); + if (i <= 1) + { + continue; + } - if ( dict.IsBound ( it->CPPName()->String() ) ) continue; // avoid duplicating - dict.Bind ( it->CPPName()->String(), 1 ); - it->Use ( GetPackageName() ); + if (dict.IsBound(it->CPPName()->String())) + { + continue; // avoid duplicating + } + dict.Bind(it->CPPName()->String(), 1); + it->Use(GetPackageName()); os << "#include <" << it->CPPName()->ToCString() << ".hxx>" << std::endl; } - for (Standard_Integer i=1; i <= myFields->Length(); i++ ) { + for (Standard_Integer i = 1; i <= myFields->Length(); i++) + { Handle(Express_Type) type = myFields->Value(i)->Type(); - if ( dict.IsBound ( type->CPPName()->String() ) ) continue; // avoid duplicating - dict.Bind ( type->CPPName()->String(), 1 ); - type->Use ( GetPackageName() ); - if ( type->IsStandard() ) continue; + if (dict.IsBound(type->CPPName()->String())) + { + continue; // avoid duplicating + } + dict.Bind(type->CPPName()->String(), 1); + type->Use(GetPackageName()); + if (type->IsStandard()) + { + continue; + } os << "#include <" << type->CPPName()->ToCString() << ".hxx>" << std::endl; } return Standard_True; @@ -642,74 +695,109 @@ Standard_Boolean Express_Entity::WriteIncludes (Standard_OStream &os, void Express_Entity::WriteRWInclude (Standard_OStream &os, DataMapOfStringInteger &dict) const { - for ( Standard_Integer i=1; i <= myInherit->Length(); i++ ) { + for (Standard_Integer i = 1; i <= myInherit->Length(); i++) + { Handle(Express_Entity) it = myInherit->Value(i); - if ( i >1 ) { // include HXX for base classes which are implemented as fields + if (i > 1) + { // include HXX for base classes which are implemented as fields os << "#include <" << it->CPPName()->ToCString() << ".hxx>" << std::endl; } - it->WriteRWInclude ( os, dict ); + it->WriteRWInclude(os, dict); } - for (Standard_Integer i=1; i <= myFields->Length(); i++ ) { + for (Standard_Integer i = 1; i <= myFields->Length(); i++) + { Handle(Express_Type) type = myFields->Value(i)->Type(); - for ( Standard_Integer deep=0; deep < 10; deep++ ) { - if ( dict.IsBound ( type->CPPName()->String() ) ) break; // avoid duplicating - dict.Bind ( type->CPPName()->String(), 1 ); + for (Standard_Integer deep = 0; deep < 10; deep++) + { + if (dict.IsBound(type->CPPName()->String())) + { + break; // avoid duplicating + } + dict.Bind(type->CPPName()->String(), 1); os << "#include <" << type->CPPName()->ToCString() << ".hxx>" << std::endl; - - Handle(Express_ComplexType) complex = Handle(Express_ComplexType)::DownCast ( type ); + + Handle(Express_ComplexType) complex = Handle(Express_ComplexType)::DownCast(type); if (complex.IsNull()) + { break; + } type = complex->Type(); } } } //======================================================================= -//function : WriteRWReadField -//purpose : +//function : typeToSTEPName +//purpose : auxilary for WriteRWReadField //======================================================================= -static Handle(TCollection_HAsciiString) TypeToSTEPName (const Handle(Express_Type) &type) +static Handle(TCollection_HAsciiString) typeToSTEPName (const Handle(Express_Type) &type) { Handle(TCollection_HAsciiString) cppname = type->CPPName(); Handle(TCollection_HAsciiString) cls = cppname->Token ( "_", 2 ); - if ( cls->Length() <1 ) cls = cppname; - return Express::ToStepName ( cls ); + if (cls->Length() < 1) + { + cls = cppname; + } + return Express::ToStepName(cls); } -static void WriteRWReadField (Standard_OStream &os, - const Standard_CString index, - const Standard_CString STEPName, - const Standard_CString varname, - const Handle(Express_Type) &vartype, - const Standard_Integer lev, - const Standard_Boolean optional) +//======================================================================= +//function : WriteRWReadField +//purpose : +//======================================================================= + +static void WriteRWReadField( + Standard_OStream &os, + const Standard_CString index, + const Standard_CString STEPName, + const Standard_CString varname, + const Handle(Express_Type) &vartype, + const Standard_Integer lev, + const Standard_Boolean optional) { // indent TCollection_AsciiString shift ( " " ); Standard_Integer level = 0; - for (; level < lev; level++ ) shift += " "; + for (; level < lev; level++) + { + shift += " "; + } level += 2; // name of variable identifying number of parameter in data TCollection_AsciiString param ( "num" ); - if ( lev >0 ) param += TCollection_AsciiString ( lev ); + if (lev > 0) + { + param += TCollection_AsciiString(lev); + } // decode aliased types Handle(Express_Type) type = vartype; - while ( type->IsKind(STANDARD_TYPE(Express_NamedType)) ) { - Handle(Express_NamedType) named = Handle(Express_NamedType)::DownCast ( type ); - if ( ! named->Item()->IsKind(STANDARD_TYPE(Express_Alias)) ) break; - Handle(Express_Alias) alias = Handle(Express_Alias)::DownCast ( named->Item() ); + while (type->IsKind(STANDARD_TYPE(Express_NamedType))) + { + Handle(Express_NamedType) named = Handle(Express_NamedType)::DownCast(type); + if (!named->Item()->IsKind(STANDARD_TYPE(Express_Alias))) + { + break; + } + Handle(Express_Alias) alias = Handle(Express_Alias)::DownCast(named->Item()); type = alias->Type(); } - + // declare variable - if ( type->IsHandle() ) os << shift << "Handle(" << type->CPPName()->ToCString() << ") a"; - else os << shift << type->CPPName()->ToCString() << " a"; + if (type->IsHandle()) + { + os << shift << "Handle(" << type->CPPName()->ToCString() << ") a"; + } + else + { + os << shift << type->CPPName()->ToCString() << " a"; + } os << varname << ";" << std::endl; - if ( optional ) { + if (optional) + { os << shift << "Standard_Boolean has" << varname << " = Standard_True;" << std::endl; os << shift << "if ( data->IsParamDefined (" << param << "," << index << ") ) {" << std::endl; shift += " "; @@ -717,118 +805,145 @@ static void WriteRWReadField (Standard_OStream &os, } // read variable depending on its type - if ( type->IsKind(STANDARD_TYPE(Express_NamedType)) ) { - Handle(Express_NamedType) named = Handle(Express_NamedType)::DownCast ( type ); - if ( named->Item()->IsKind(STANDARD_TYPE(Express_Entity)) ) { + if (type->IsKind(STANDARD_TYPE(Express_NamedType))) + { + Handle(Express_NamedType) named = Handle(Express_NamedType)::DownCast(type); + if (named->Item()->IsKind(STANDARD_TYPE(Express_Entity))) + { os << shift << "data->ReadEntity (" << param << ", " << index << ", \"" << STEPName << - "\", ach, STANDARD_TYPE(" << named->CPPName()->ToCString() << "), a" << - varname << ");" << std::endl; + "\", ach, STANDARD_TYPE(" << named->CPPName()->ToCString() << "), a" << + varname << ");" << std::endl; } - else if ( named->Item()->IsKind(STANDARD_TYPE(Express_Select)) ) { + else if (named->Item()->IsKind(STANDARD_TYPE(Express_Select))) + { os << shift << "data->ReadEntity (" << param << ", " << index << ", \"" << STEPName << - "\", ach, a" << varname << ");" << std::endl; + "\", ach, a" << varname << ");" << std::endl; } - else if ( named->Item()->IsKind(STANDARD_TYPE(Express_Enum)) ) { - os << shift << "if (data->ParamType (" << param << ", " << - index << ") == Interface_ParamEnum) {" << std::endl; - os << shift << " Standard_CString text = data->ParamCValue(" << - param << ", " << index << ");" << std::endl; - Handle(Express_Enum) en = Handle(Express_Enum)::DownCast ( named->Item() ); + else if (named->Item()->IsKind(STANDARD_TYPE(Express_Enum))) + { + os << shift << "if (data->ParamType (" << param << ", " << + index << ") == Interface_ParamEnum) {" << std::endl; + os << shift << " Standard_CString text = data->ParamCValue(" << + param << ", " << index << ");" << std::endl; + Handle(Express_Enum) en = Handle(Express_Enum)::DownCast(named->Item()); Handle(TCollection_HAsciiString) prefix = Express::EnumPrefix(en->Name()); Handle(TColStd_HSequenceOfHAsciiString) names = en->Names(); TCollection_AsciiString enpack = en->GetPackageName()->String(); - for ( Standard_Integer i=1; i <= names->Length(); i++ ) { - Handle(TCollection_HAsciiString) ename = Express::ToStepName ( names->Value(i) ); - ename->UpperCase(); - os << shift << ( i==1 ? " if " : " else if" ) << - " (strcmp(text, \"." << ename->ToCString() << ".\")) a" << - varname << " = " << enpack.ToCString() << "_" << prefix->ToCString()<< - names->Value(i)->ToCString() << ";" << std::endl; + for (Standard_Integer i = 1; i <= names->Length(); i++) + { + Handle(TCollection_HAsciiString) ename = Express::ToStepName(names->Value(i)); + ename->UpperCase(); + os << shift << (i == 1 ? " if " : " else if") << + " (strcmp(text, \"." << ename->ToCString() << ".\")) a" << + varname << " = " << enpack.ToCString() << "_" << prefix->ToCString() << + names->Value(i)->ToCString() << ";" << std::endl; } os << shift << " else ach->AddFail(\"Parameter #" << index << " (" << - STEPName << ") has not allowed value\");" << std::endl; + STEPName << ") has not allowed value\");" << std::endl; os << shift << "}" << std::endl; os << shift << "else ach->AddFail(\"Parameter #" << index << " (" << - STEPName << ") is not enumeration\");" << std::endl; -// os << "!!! READING/WRITING ENUM NOT IMPLEMENTED !!!" << std::endl; -// std::cout << "Warning: Reading/Writing ENUMERATION not yet implemented (" << -// STEPName << ", " << varname << ", " << type->CPPName()->ToCString() << ")" << std::endl; + STEPName << ") is not enumeration\");" << std::endl; + //os << "!!! READING/WRITING ENUM NOT IMPLEMENTED !!!" << std::endl; + //std::cout << "Warning: Reading/Writing ENUMERATION not yet implemented (" << + //STEPName << ", " << varname << ", " << type->CPPName()->ToCString() << ")" << std::endl; } } - else if ( type->IsKind(STANDARD_TYPE(Express_ComplexType)) ) { - - Handle(Express_ComplexType) complex = Handle(Express_ComplexType)::DownCast ( type ); + else if (type->IsKind(STANDARD_TYPE(Express_ComplexType))) + { + Handle(Express_ComplexType) complex = Handle(Express_ComplexType)::DownCast(type); os << shift << "Standard_Integer sub" << index << " = 0;" << std::endl; - os << shift << "if ( data->ReadSubList (" << param << ", " << index << ", \"" << - STEPName << "\", ach, sub" << index << ") ) {" << std::endl; + os << shift << "if ( data->ReadSubList (" << param << ", " << index << ", \"" << + STEPName << "\", ach, sub" << index << ") ) {" << std::endl; os << shift << " Standard_Integer nb" << lev << " = data->NbParams(sub" << index << ");" << std::endl; TCollection_AsciiString iter = lev; - iter.Prepend ( "i" ); + iter.Prepend("i"); TCollection_AsciiString var = lev; var.Prepend("nIt"); - if ( complex->Type()->IsKind(STANDARD_TYPE(Express_ComplexType)) ) { // array 2 - Handle(Express_ComplexType) complex2 = Handle(Express_ComplexType)::DownCast ( complex->Type() ); + if (complex->Type()->IsKind(STANDARD_TYPE(Express_ComplexType))) + { // array 2 + Handle(Express_ComplexType) complex2 = Handle(Express_ComplexType)::DownCast(complex->Type()); TCollection_AsciiString jter = lev; - jter.Prepend ( "j" ); - os << shift << " Standard_Integer nbj" << lev << " = data->NbParams(data->ParamNumber(sub" << index << ",1));" << std::endl; - os << shift << " a" << varname << " = new " << type->CPPName()->ToCString() << " (1, nb" << lev << ", 1, nbj" << lev << ");" << std::endl; - os << shift << " for ( Standard_Integer " << iter << "=1; " << iter << " <= nb" << lev << "; " << iter << "++ ) {" << std::endl; + jter.Prepend("j"); + os << shift << " Standard_Integer nbj" << lev << + " = data->NbParams(data->ParamNumber(sub" << index << ",1));" << std::endl; + os << shift << " a" << varname << " = new " << type->CPPName()->ToCString() << + " (1, nb" << lev << ", 1, nbj" << lev << ");" << std::endl; + os << shift << " for ( Standard_Integer " << iter << "=1; " << iter << " <= nb" << lev << + "; " << iter << "++ ) {" << std::endl; os << shift << " Standard_Integer subj" << index << " = 0;" << std::endl; - os << shift << " if ( data->ReadSubList (sub" << index << ", " << iter << ", \"sub-part(" << - STEPName << ")\", ach, subj" << index << ") ) {" << std::endl; - os << shift << " Standard_Integer num" << level+2 << " = subj" << index << ";" << std::endl; - os << shift << " for ( Standard_Integer " << jter << "=1; " << jter << " <= nbj" << lev << "; " << jter << "++ ) {" << std::endl; - Handle(TCollection_HAsciiString) subName = TypeToSTEPName ( complex2->Type() ); - WriteRWReadField (os, jter.ToCString(), subName->ToCString(), var.ToCString(), complex2->Type(), level+2, Standard_False ); - os << shift << " a" << varname << "->SetValue(" << iter << "," << jter << ", a" << var << ");" << std::endl; + os << shift << " if ( data->ReadSubList (sub" << index << ", " << iter << ", \"sub-part(" << + STEPName << ")\", ach, subj" << index << ") ) {" << std::endl; + os << shift << " Standard_Integer num" << level + 2 << " = subj" << index << ";" << std::endl; + os << shift << " for ( Standard_Integer " << jter << "=1; " << jter << " <= nbj" << lev << + "; " << jter << "++ ) {" << std::endl; + Handle(TCollection_HAsciiString) subName = typeToSTEPName(complex2->Type()); + WriteRWReadField(os, jter.ToCString(), subName->ToCString(), var.ToCString(), + complex2->Type(), level + 2, Standard_False); + os << shift << " a" << varname << "->SetValue(" << iter << "," << + jter << ", a" << var << ");" << std::endl; os << shift << " }" << std::endl; os << shift << " }" << std::endl; - } - else { // simple array - os << shift << " a" << varname << " = new " << type->CPPName()->ToCString() << " (1, nb" << lev << ");" << std::endl; + } + else + { // simple array + os << shift << " a" << varname << " = new " << type->CPPName()->ToCString() << + " (1, nb" << lev << ");" << std::endl; os << shift << " Standard_Integer num" << level << " = sub" << index << ";" << std::endl; - os << shift << " for ( Standard_Integer " << iter << "=1; " << iter << " <= nb" << lev << "; " << iter << "++ ) {" << std::endl; - Handle(TCollection_HAsciiString) subName = TypeToSTEPName ( complex->Type() ); - WriteRWReadField (os, iter.ToCString(), subName->ToCString(), var.ToCString(), complex->Type(), level, Standard_False ); + os << shift << " for ( Standard_Integer " << iter << "=1; " << iter << " <= nb" << lev << + "; " << iter << "++ ) {" << std::endl; + Handle(TCollection_HAsciiString) subName = typeToSTEPName(complex->Type()); + WriteRWReadField(os, iter.ToCString(), subName->ToCString(), var.ToCString(), + complex->Type(), level, Standard_False); os << shift << " a" << varname << "->SetValue(" << iter << ", a" << var << ");" << std::endl; } os << shift << " }" << std::endl; os << shift << "}" << std::endl; } - else if ( type->IsKind(STANDARD_TYPE(Express_String)) ) { + else if (type->IsKind(STANDARD_TYPE(Express_String))) + { os << shift << "data->ReadString (" << param << ", " << index << ", \"" << STEPName << - "\", ach, a" << varname << ");" << std::endl; + "\", ach, a" << varname << ");" << std::endl; } - else if ( type->IsKind(STANDARD_TYPE(Express_Logical)) ) { + else if (type->IsKind(STANDARD_TYPE(Express_Logical))) + { os << shift << "data->ReadLogical (" << param << ", " << index << ", \"" << STEPName << - "\", ach, a" << varname << ");" << std::endl; + "\", ach, a" << varname << ");" << std::endl; } - else if ( type->IsKind(STANDARD_TYPE(Express_Boolean)) ) { + else if (type->IsKind(STANDARD_TYPE(Express_Boolean))) + { os << shift << "data->ReadBoolean (" << param << ", " << index << ", \"" << STEPName << - "\", ach, a" << varname << ");" << std::endl; + "\", ach, a" << varname << ");" << std::endl; } - else if ( type->IsKind(STANDARD_TYPE(Express_Number)) || - type->IsKind(STANDARD_TYPE(Express_Integer)) ) { + else if (type->IsKind(STANDARD_TYPE(Express_Number)) || type->IsKind(STANDARD_TYPE(Express_Integer))) + { os << shift << "data->ReadInteger (" << param << ", " << index << ", \"" << STEPName << - "\", ach, a" << varname << ");" << std::endl; + "\", ach, a" << varname << ");" << std::endl; } - else if ( type->IsKind(STANDARD_TYPE(Express_Real)) ) { + else if (type->IsKind(STANDARD_TYPE(Express_Real))) + { os << shift << "data->ReadReal (" << param << ", " << index << ", \"" << STEPName << - "\", ach, a" << varname << ");" << std::endl; + "\", ach, a" << varname << ");" << std::endl; } - if ( optional ) { - shift.Remove ( 1, 2 ); + if (optional) + { + shift.Remove(1, 2); os << shift << "}" << std::endl; os << shift << "else {" << std::endl; os << shift << " has" << varname << " = Standard_False;" << std::endl; os << shift << " a" << varname; if (type->IsHandle()) + { os << ".Nullify();"; + } else if (type->IsStandard()) + { os << " = 0;"; + } else + { os << " = " << type->CPPName()->ToCString() << "();"; + } os << std::endl; os << shift << "}" << std::endl; } @@ -846,22 +961,31 @@ Standard_Integer Express_Entity::WriteRWReadCode (Standard_OStream &os, Standard_Integer num = start; // write code for reading inherited fields - for ( Standard_Integer i=1; i <= myInherit->Length(); i++ ) - num = myInherit->Value(i)->WriteRWReadCode ( os, num, Standard_False ); + for (Standard_Integer i = 1; i <= myInherit->Length(); i++) + { + num = myInherit->Value(i)->WriteRWReadCode(os, num, Standard_False); + } // write code for reading own fields - if ( myFields->Length() >0 ) { + if ( myFields->Length() >0 ) + { if ( num >0 ) os << std::endl; os << " // " << ( own ? "Own" : "Inherited" ) << " fields of " << Name()->ToCString() << std::endl; } - for (Standard_Integer i = 1; i <= myFields->Length(); i++) { + for (Standard_Integer i = 1; i <= myFields->Length(); i++) + { Handle(Express_Field) field = myFields->Value(i); Handle(TCollection_HAsciiString) STEPName = Express::ToStepName(field->Name()); - if (!own) STEPName->Prepend(Express::ToStepName(Name()->Cat("."))); + if (!own) + { + STEPName->Prepend(Express::ToStepName(Name()->Cat("."))); + } Handle(TCollection_HAsciiString) varName = new TCollection_HAsciiString(field->Name()); - if (!own) varName->Prepend(Name()->Cat("_")); - + if (!own) + { + varName->Prepend(Name()->Cat("_")); + } os << std::endl; WriteRWReadField(os, TCollection_AsciiString(num).ToCString(), STEPName->ToCString(), varName->ToCString(), field->Type(), 0, field->IsOptional()); @@ -875,89 +999,106 @@ Standard_Integer Express_Entity::WriteRWReadCode (Standard_OStream &os, //purpose : //======================================================================= -static void WriteRWWriteField (Standard_OStream &os, - const Standard_CString varname, - const Handle(Express_Type) &vartype, - const Standard_Integer index, - const Standard_Integer lev) +static void WriteRWWriteField( + Standard_OStream &os, + const Standard_CString varname, + const Handle(Express_Type) &vartype, + const Standard_Integer index, + const Standard_Integer lev) { // indent TCollection_AsciiString shift ( " " ); Standard_Integer level = 0; - for (; level < lev; level++ ) shift += " "; + for (; level < lev; level++) + { + shift += " "; + } level++; // decode aliased types Handle(Express_Type) type = vartype; - while ( type->IsKind(STANDARD_TYPE(Express_NamedType)) ) { - Handle(Express_NamedType) named = Handle(Express_NamedType)::DownCast ( type ); - if ( ! named->Item()->IsKind(STANDARD_TYPE(Express_Alias)) ) break; - Handle(Express_Alias) alias = Handle(Express_Alias)::DownCast ( named->Item() ); + while (type->IsKind(STANDARD_TYPE(Express_NamedType))) + { + Handle(Express_NamedType) named = Handle(Express_NamedType)::DownCast(type); + if (!named->Item()->IsKind(STANDARD_TYPE(Express_Alias))) + { + break; + } + Handle(Express_Alias) alias = Handle(Express_Alias)::DownCast(named->Item()); type = alias->Type(); } - + // write variable depending on its type - if ( type->IsKind(STANDARD_TYPE(Express_ComplexType)) ) { - - Handle(Express_ComplexType) complex = Handle(Express_ComplexType)::DownCast ( type ); + if (type->IsKind(STANDARD_TYPE(Express_ComplexType))) + { + Handle(Express_ComplexType) complex = Handle(Express_ComplexType)::DownCast(type); type = complex->Type(); - TCollection_AsciiString var ( lev ); - var.Prepend ( "Var" ); + TCollection_AsciiString var(lev); + var.Prepend("Var"); os << shift << "SW.OpenSub();" << std::endl; os << shift << "for (Standard_Integer i" << index << "=1; i" << index << " <= "; - if ( type->IsKind(STANDARD_TYPE(Express_ComplexType)) ) { // array 2 - Handle(Express_ComplexType) complex2 = Handle(Express_ComplexType)::DownCast ( type ); + if (type->IsKind(STANDARD_TYPE(Express_ComplexType))) + { // array 2 + Handle(Express_ComplexType) complex2 = Handle(Express_ComplexType)::DownCast(type); type = complex2->Type(); os << varname << "->RowLength(); i" << index << "++ ) {" << std::endl; os << shift << " SW.NewLine(Standard_False);" << std::endl; os << shift << " SW.OpenSub();" << std::endl; os << shift << " for (Standard_Integer j" << index << "=1; j" << index << " <= " << - varname << "->ColLength(); j" << index << "++ ) {" << std::endl; - os << shift << " " << ( type->IsHandle() ? " Handle(" : " " ) << type->CPPName()->ToCString() << - ( type->IsHandle() ? ") " : " " ) << var.ToCString() << " = " << - varname << "->Value(i" << index << ",j" << index << ");" << std::endl; - WriteRWWriteField (os, var.ToCString(), type, index+1, level+1 ); + varname << "->ColLength(); j" << index << "++ ) {" << std::endl; + os << shift << " " << (type->IsHandle() ? " Handle(" : " ") << type->CPPName()->ToCString() << + (type->IsHandle() ? ") " : " ") << var.ToCString() << " = " << + varname << "->Value(i" << index << ",j" << index << ");" << std::endl; + WriteRWWriteField(os, var.ToCString(), type, index + 1, level + 1); os << shift << " }" << std::endl; os << shift << " SW.CloseSub();" << std::endl; - } - else { // simple array + } + else + { // simple array os << varname << "->Length(); i" << index << "++ ) {" << std::endl; - os << shift << ( type->IsHandle() ? " Handle(" : " " ) << type->CPPName()->ToCString() << - ( type->IsHandle() ? ") " : " " ) << var.ToCString() << " = " << - varname << "->Value(i" << index << ");" << std::endl; - WriteRWWriteField (os, var.ToCString(), type, index+1, level ); + os << shift << (type->IsHandle() ? " Handle(" : " ") << type->CPPName()->ToCString() << + (type->IsHandle() ? ") " : " ") << var.ToCString() << " = " << + varname << "->Value(i" << index << ");" << std::endl; + WriteRWWriteField(os, var.ToCString(), type, index + 1, level); } os << shift << "}" << std::endl; os << shift << "SW.CloseSub();" << std::endl; } - else if ( type->IsKind(STANDARD_TYPE(Express_Boolean)) ) { + else if (type->IsKind(STANDARD_TYPE(Express_Boolean))) + { os << shift << "SW.SendBoolean (" << varname << ");" << std::endl; } - else if ( type->IsKind(STANDARD_TYPE(Express_Logical)) ) { + else if (type->IsKind(STANDARD_TYPE(Express_Logical))) + { os << shift << "SW.SendLogical (" << varname << ");" << std::endl; } - else { - Handle(Express_NamedType) named = Handle(Express_NamedType)::DownCast ( type ); - if ( ! named.IsNull() && named->Item()->IsKind(STANDARD_TYPE(Express_Enum)) ) { - Handle(Express_Enum) en = Handle(Express_Enum)::DownCast ( named->Item() ); + else + { + Handle(Express_NamedType) named = Handle(Express_NamedType)::DownCast(type); + if (!named.IsNull() && named->Item()->IsKind(STANDARD_TYPE(Express_Enum))) + { + Handle(Express_Enum) en = Handle(Express_Enum)::DownCast(named->Item()); Handle(TCollection_HAsciiString) prefix = Express::EnumPrefix(en->Name()); - Handle(TColStd_HSequenceOfHAsciiString) names = en->Names(); TCollection_AsciiString enpack = en->GetPackageName()->String(); os << shift << "switch (" << varname << ") {" << std::endl; - for ( Standard_Integer i=1; i <= names->Length(); i++ ) { - Handle(TCollection_HAsciiString) ename = Express::ToStepName ( names->Value(i) ); - ename->UpperCase(); - os << shift << " case " << enpack.ToCString() << "_" << prefix->ToCString()<< - names->Value(i)->ToCString() << ": SW.SendEnum (\"." << - ename->ToCString() << ".\"); break;" << std::endl; + for (Standard_Integer i = 1; i <= names->Length(); i++) + { + Handle(TCollection_HAsciiString) ename = Express::ToStepName(names->Value(i)); + ename->UpperCase(); + os << shift << " case " << enpack.ToCString() << "_" << prefix->ToCString() << + names->Value(i)->ToCString() << ": SW.SendEnum (\"." << + ename->ToCString() << ".\"); break;" << std::endl; } os << shift << "}" << std::endl; } - else { + else + { os << shift << "SW.Send (" << varname; - if ( ! named.IsNull() && named->Item()->IsKind(STANDARD_TYPE(Express_Select)) ) - os << ".Value()"; + if (!named.IsNull() && named->Item()->IsKind(STANDARD_TYPE(Express_Select))) + { + os << ".Value()"; + } os << ");" << std::endl; } } @@ -968,46 +1109,63 @@ static void WriteRWWriteField (Standard_OStream &os, //purpose : //======================================================================= -Standard_Integer Express_Entity::WriteRWWriteCode (Standard_OStream &os, - const Standard_Integer start, - const Standard_Integer own) const +Standard_Integer Express_Entity::WriteRWWriteCode( + Standard_OStream &os, + const Standard_Integer start, + const Standard_Integer own) const { Standard_Integer num = start; // write code for writing inherited fields - for ( Standard_Integer i=1; i <= myInherit->Length(); i++ ) - num = myInherit->Value(i)->WriteRWWriteCode ( os, num, ( i >1 ? -1 : 1 ) ); + for (Standard_Integer i = 1; i <= myInherit->Length(); i++) + { + num = myInherit->Value(i)->WriteRWWriteCode(os, num, (i > 1 ? -1 : 1)); + } // write code for writing own fields - if ( myFields->Length() >0 ) { + if (myFields->Length() > 0) + { os << std::endl; os << " // " << ( own == 1 ? "Own" : "Inherited" ) << " fields of " << Name()->ToCString() << std::endl; } - for (Standard_Integer i=1; i <= myFields->Length(); i++ ) { + for (Standard_Integer i=1; i <= myFields->Length(); i++ ) + { Handle(Express_Field) field = myFields->Value(i); TCollection_AsciiString varName ( field->Name()->String() ); - if ( ! own ) varName.Prepend ( CPPName()->Cat ( "::" )->String() ); - else if ( own ==-1 ) { // inherited base class implemented as field + if (!own) + { + varName.Prepend(CPPName()->Cat("::")->String()); + } + else if (own == -1) + { // inherited base class implemented as field varName.Prepend ( Name()->Cat ( "()->" )->String() ); } varName.Prepend ( "ent->" ); varName.AssignCat ( "()" ); os << std::endl; - if ( field->IsOptional() ) { + if (field->IsOptional()) + { os << " if ( ent->"; - if ( ! own ) os << CPPName()->ToCString() << "::"; - else if ( own ==-1 ) os << Name()->ToCString() << "()->"; + if (!own) + { + os << CPPName()->ToCString() << "::"; + } + else if (own == -1) + { + os << Name()->ToCString() << "()->"; + } os << "Has" << field->Name()->ToCString() << "() ) {" << std::endl; } - WriteRWWriteField ( os, varName.ToCString(), field->Type(), num, ( field->IsOptional() ? 1 : 0 ) ); - if ( field->IsOptional() ) { + WriteRWWriteField(os, varName.ToCString(), field->Type(), num, (field->IsOptional() ? 1 : 0)); + if (field->IsOptional()) + { os << " }\n else SW.SendUndef();" << std::endl; } num++; } - + return num; } @@ -1016,53 +1174,67 @@ Standard_Integer Express_Entity::WriteRWWriteCode (Standard_OStream &os, //purpose : //======================================================================= -static Standard_Boolean WriteRWShareField (Standard_OStream &os, - const Standard_CString varname, - const Handle(Express_Type) &vartype, - const Standard_Integer index, - const Standard_Integer lev) +static Standard_Boolean WriteRWShareField( + Standard_OStream &os, + const Standard_CString varname, + const Handle(Express_Type) &vartype, + const Standard_Integer index, + const Standard_Integer lev) { // indent - TCollection_AsciiString shift ( " " ); + TCollection_AsciiString shift(" "); Standard_Integer level = 0; - for (; level < lev; level++ ) shift += " "; + for (; level < lev; level++) + { + shift += " "; + } level++; // decode aliased types Handle(Express_Type) type = vartype; - while ( type->IsKind(STANDARD_TYPE(Express_NamedType)) ) { - Handle(Express_NamedType) named = Handle(Express_NamedType)::DownCast ( type ); - if ( ! named->Item()->IsKind(STANDARD_TYPE(Express_Alias)) ) break; - Handle(Express_Alias) alias = Handle(Express_Alias)::DownCast ( named->Item() ); + while (type->IsKind(STANDARD_TYPE(Express_NamedType))) + { + Handle(Express_NamedType) named = Handle(Express_NamedType)::DownCast(type); + if (!named->Item()->IsKind(STANDARD_TYPE(Express_Alias))) + { + break; + } + Handle(Express_Alias) alias = Handle(Express_Alias)::DownCast(named->Item()); type = alias->Type(); } - + // write variable depending on its type - if ( type->IsKind(STANDARD_TYPE(Express_ComplexType)) ) { - Handle(Express_ComplexType) complex = Handle(Express_ComplexType)::DownCast ( type ); + if (type->IsKind(STANDARD_TYPE(Express_ComplexType))) + { + Handle(Express_ComplexType) complex = Handle(Express_ComplexType)::DownCast(type); type = complex->Type(); - TCollection_AsciiString var ( lev ); - var.Prepend ( "Var" ); + TCollection_AsciiString var(lev); + var.Prepend("Var"); std::ostringstream oos; - if ( ! WriteRWShareField (oos, var.ToCString(), type, index + 1, level ) ) + if (!WriteRWShareField(oos, var.ToCString(), type, index + 1, level)) + { return Standard_False; - os << shift << "for (Standard_Integer i" << index << "=1; i" << index << " <= " << - varname << "->Length(); i" << index << "++ ) {" << std::endl; - os << shift << ( type->IsHandle() ? " Handle(" : " " ) << type->CPPName()->ToCString() << - ( type->IsHandle() ? ") " : " " ) << var.ToCString() << " = " << - varname << "->Value(i" << index << ");" << std::endl; + } + os << shift << "for (Standard_Integer i" << index << "=1; i" << index << " <= " << + varname << "->Length(); i" << index << "++ ) {" << std::endl; + os << shift << (type->IsHandle() ? " Handle(" : " ") << type->CPPName()->ToCString() << + (type->IsHandle() ? ") " : " ") << var.ToCString() << " = " << + varname << "->Value(i" << index << ");" << std::endl; os << oos.str(); os << shift << "}" << std::endl; return Standard_True; } - if ( type->IsKind(STANDARD_TYPE(Express_NamedType)) ) { - Handle(Express_NamedType) named = Handle(Express_NamedType)::DownCast ( type ); - if ( named->Item()->IsKind(STANDARD_TYPE(Express_Entity)) ) { + if (type->IsKind(STANDARD_TYPE(Express_NamedType))) + { + Handle(Express_NamedType) named = Handle(Express_NamedType)::DownCast(type); + if (named->Item()->IsKind(STANDARD_TYPE(Express_Entity))) + { os << shift << "iter.AddItem (" << varname << ");" << std::endl; return Standard_True; } - if ( named->Item()->IsKind(STANDARD_TYPE(Express_Select)) ) { + if (named->Item()->IsKind(STANDARD_TYPE(Express_Select))) + { os << shift << "iter.AddItem (" << varname << ".Value());" << std::endl; return Standard_True; } @@ -1075,38 +1247,50 @@ static Standard_Boolean WriteRWShareField (Standard_OStream &os, //purpose : //======================================================================= -Standard_Integer Express_Entity::WriteRWShareCode (Standard_OStream &os, - const Standard_Integer start, - const Standard_Integer own) const +Standard_Integer Express_Entity::WriteRWShareCode( + Standard_OStream &os, + const Standard_Integer start, + const Standard_Integer own) const { Standard_Integer num = start; // write code for sharing inherited fields - for ( Standard_Integer i=1; i <= myInherit->Length(); i++ ) - num = myInherit->Value(i)->WriteRWShareCode ( os, num, ( i >1 ? -1 : Standard_False ) ); + for (Standard_Integer i = 1; i <= myInherit->Length(); i++) + { + num = myInherit->Value(i)->WriteRWShareCode(os, num, (i > 1 ? -1 : Standard_False)); + } // write code for sharing own fields - if ( myFields->Length() >0 ) { + if ( myFields->Length() >0 ) + { os << std::endl; os << " // " << ( own == 1 ? "Own" : "Inherited" ) << " fields of " << Name()->ToCString() << std::endl; } - for (Standard_Integer i=1; i <= myFields->Length(); i++ ) { + for (Standard_Integer i=1; i <= myFields->Length(); i++ ) + { Handle(Express_Field) field = myFields->Value(i); TCollection_AsciiString varName ( field->Name()->String() ); - if ( ! own ) varName.Prepend ( CPPName()->Cat ( "::" )->String() ); - else if ( own ==-1 ) { // inherited base class implemented as field + if (!own) + { + varName.Prepend(CPPName()->Cat("::")->String()); + } + else if ( own ==-1 ) + { // inherited base class implemented as field varName.Prepend ( Name()->Cat ( "()->" )->String() ); } varName.Prepend ( "ent->" ); varName.AssignCat ( "()" ); std::ostringstream oos; - if ( ! WriteRWShareField ( oos, varName.ToCString(), field->Type(), num, - ( field->IsOptional() ? 1 : 0 ) ) ) continue; + if (!WriteRWShareField(oos, varName.ToCString(), field->Type(), num, (field->IsOptional() ? 1 : 0))) + { + continue; + } num++; os << std::endl; - if ( field->IsOptional() ) { + if (field->IsOptional()) + { os << " if ( ent->"; if ( ! own ) os << CPPName()->ToCString() << "::"; else if ( own ==-1 ) os << Name()->ToCString() << "()->"; @@ -1114,7 +1298,8 @@ Standard_Integer Express_Entity::WriteRWShareCode (Standard_OStream &os, } os << oos.str(); - if ( field->IsOptional() ) { + if (field->IsOptional()) + { os << " }" << std::endl; } } @@ -1134,78 +1319,124 @@ Standard_Integer Express_Entity::MakeInit (Standard_OStream &os, Standard_Integer sh = shift; // write code for inherited fields - for (Standard_Integer i = 1; i <= myInherit->Length(); i++) { + for (Standard_Integer i = 1; i <= myInherit->Length(); i++) + { Handle(Express_Entity) ent = myInherit->Value(i); - if (mode == 3) { + if (mode == 3) + { Standard_Integer s = 0; - if (i > 1) { + if (i > 1) + { os << "\n my" << ent->Name()->ToCString() << " = new " << ent->CPPName()->ToCString() << ";"; os << "\n my" << ent->Name()->ToCString() << "->Init("; s = 12 + ent->Name()->Length(); } - else { + else + { os << "\n " << ent->CPPName()->ToCString() << "::Init("; s = 9 + ent->CPPName()->Length(); } ent->MakeInit(os, s, Standard_False, 2); os << ");"; } - else sh = ent->MakeInit(os, sh, (i > 1 ? -1 : Standard_False), mode); + else + { + sh = ent->MakeInit(os, sh, (i > 1 ? -1 : Standard_False), mode); + } } // write code for own fields - - for (Standard_Integer i=1; i <= myFields->Length(); i++ ) { + + for (Standard_Integer i = 1; i <= myFields->Length(); i++) + { Handle(Express_Field) field = myFields->Value(i); - Handle(TCollection_HAsciiString) varName = new TCollection_HAsciiString ( field->Name() ); - if ( own != 1 ) varName->Prepend ( Name()->Cat ( "_" ) ); + Handle(TCollection_HAsciiString) varName = new TCollection_HAsciiString(field->Name()); + if (own != 1) + { + varName->Prepend(Name()->Cat("_")); + } // make CR and indent TCollection_AsciiString space = ""; - for ( Standard_Integer sn=0; sn < abs(sh); sn++ ) space += " "; - Standard_Character delim = ( mode == 0 ? ',' : ( mode == 3 ? '\n' : ',' ) ); - if ( sh < 0 ) os << delim << "\n" << space; - else sh = -sh; - - if ( field->IsOptional() ) { - if ( mode == 0 ) os << "const Standard_Boolean has" << varName->ToCString() << ",\n" << space; - else if ( mode == 1 ) os << "const Standard_Boolean has" << varName->ToCString() << ",\n" << space; - else if ( mode == 2 || mode == 4) os << "has" << varName->ToCString() << ",\n" << space; + for (Standard_Integer sn = 0; sn < abs(sh); sn++) + { + space += " "; } - + Standard_Character delim = (mode == 0 ? ',' : (mode == 3 ? '\n' : ',')); + if (sh < 0) + { + os << delim << "\n" << space; + } + else + { + sh = -sh; + } + + if (field->IsOptional()) + { + if (mode == 0) + { + os << "const Standard_Boolean has" << varName->ToCString() << ",\n" << space; + } + else if (mode == 1) + { + os << "const Standard_Boolean has" << varName->ToCString() << ",\n" << space; + } + else if (mode == 2 || mode == 4) + { + os << "has" << varName->ToCString() << ",\n" << space; + } + } + // write field - if ( mode == 0 || mode ==1) { + if (mode == 0 || mode == 1) + { os << "const " << (field->Type()->IsHandle() ? "Handle(" : "") << field->Type()->CPPName()->ToCString() << (field->Type()->IsHandle() ? ")" : "") << (field->Type()->IsSimple() ? " the" : "& the") << varName->ToCString(); } - else if ( mode == 2 ) { + else if (mode == 2) + { os << "the" << varName->ToCString(); } - else if (mode == 4) { + else if (mode == 4) + { os << "a" << varName->ToCString(); } - else { - if (field->IsOptional()) { + else + { + if (field->IsOptional()) + { os << "def" << field->Name()->ToCString() << " = has" << varName->ToCString() << ";" << std::endl; os << " if (def" << field->Name()->ToCString() << ") {\n "; } os << "my" << field->Name()->ToCString() << " = the" << varName->ToCString() << ";"; - if (field->IsOptional()) { + if (field->IsOptional()) + { os << "\n }\n else my" << field->Name()->ToCString(); if (field->Type()->IsHandle()) + { os << ".Nullify();"; + } else if (field->Type()->IsStandard()) + { os << " = 0;"; + } else + { os << " = " << field->Type()->CPPName()->ToCString() << "();"; + } } } - if ( sh >0 ) sh = -sh; + if (sh > 0) + { + sh = -sh; + } } - + return sh; } + //======================================================================= //function : SetAbstractFlag //purpose : diff --git a/src/Express/Express_Entity.hxx b/src/Express/Express_Entity.hxx index 20ba8d2425..0fa231ee5c 100644 --- a/src/Express/Express_Entity.hxx +++ b/src/Express/Express_Entity.hxx @@ -25,7 +25,6 @@ class Express_HSequenceOfEntity; class Express_HSequenceOfField; class Dico_DictionaryOfInteger; - //! Implements ENTITY item of the EXPRESS //! schema, with interface for deferred Item class. class Express_Entity : public Express_Item @@ -33,11 +32,13 @@ class Express_Entity : public Express_Item public: - //! Create ENTITY item and initialize it //! flags hasCheck and hasFillShared mark if generated class has //! methods Check and FillShared cprrespondingly. - Standard_EXPORT Express_Entity(const Standard_CString name, const Handle(TColStd_HSequenceOfHAsciiString)& inherit, const Handle(Express_HSequenceOfField)& flds); + Standard_EXPORT Express_Entity( + const Standard_CString name, + const Handle(TColStd_HSequenceOfHAsciiString)& inherit, + const Handle(Express_HSequenceOfField)& flds); //! Returns sequence of inherited classes (names) Standard_EXPORT const Handle(TColStd_HSequenceOfHAsciiString)& SuperTypes() const; @@ -58,16 +59,10 @@ public: //! Returns abstract flag. Standard_EXPORT Standard_Boolean AbstractFlag() const; - - - DEFINE_STANDARD_RTTIEXT(Express_Entity,Express_Item) protected: - - - private: typedef NCollection_DataMap DataMapOfStringInteger; @@ -82,13 +77,22 @@ private: Standard_EXPORT void WriteRWInclude (Standard_OStream& os, DataMapOfStringInteger& dict) const; //! Writes code for reading all fields - Standard_EXPORT Standard_Integer WriteRWReadCode (Standard_OStream& os, const Standard_Integer start, const Standard_Integer own) const; + Standard_EXPORT Standard_Integer WriteRWReadCode( + Standard_OStream& os, + const Standard_Integer start, + const Standard_Integer own) const; //! Writes code for writing all fields - Standard_EXPORT Standard_Integer WriteRWWriteCode (Standard_OStream& os, const Standard_Integer start, const Standard_Integer own) const; + Standard_EXPORT Standard_Integer WriteRWWriteCode( + Standard_OStream& os, + const Standard_Integer start, + const Standard_Integer own) const; //! Writes code for adding shared entities to the graph - Standard_EXPORT Standard_Integer WriteRWShareCode (Standard_OStream& os, const Standard_Integer start, const Standard_Integer own) const; + Standard_EXPORT Standard_Integer WriteRWShareCode( + Standard_OStream& os, + const Standard_Integer start, + const Standard_Integer own) const; //! Writes arguments and code for method Init() //! Mode identifyes what code is being written: @@ -97,7 +101,11 @@ private: //! 2 - call (argument list) //! 3 - implementation //! 4 - call (argument list for RW) - Standard_EXPORT Standard_Integer MakeInit (Standard_OStream& os, const Standard_Integer shift, const Standard_Integer own, const Standard_Integer mode) const; + Standard_EXPORT Standard_Integer MakeInit( + Standard_OStream& os, + const Standard_Integer shift, + const Standard_Integer own, + const Standard_Integer mode) const; Handle(TColStd_HSequenceOfHAsciiString) mySupers; Handle(Express_HSequenceOfEntity) myInherit; @@ -105,10 +113,4 @@ private: Standard_Boolean myisAbstract; }; - - - - - - #endif // _Express_Entity_HeaderFile diff --git a/src/Express/Express_Enum.cxx b/src/Express/Express_Enum.cxx index 76d64c21a8..73d831c1f2 100644 --- a/src/Express/Express_Enum.cxx +++ b/src/Express/Express_Enum.cxx @@ -27,9 +27,10 @@ IMPLEMENT_STANDARD_RTTIEXT(Express_Enum,Express_Item) //purpose : //======================================================================= -Express_Enum::Express_Enum (const Standard_CString name, - const Handle(TColStd_HSequenceOfHAsciiString) &names) - : Express_Item(name), myNames(names) +Express_Enum::Express_Enum( + const Standard_CString name, + const Handle(TColStd_HSequenceOfHAsciiString) &names) + : Express_Item(name), myNames(names) { } @@ -51,18 +52,18 @@ const Handle(TColStd_HSequenceOfHAsciiString) &Express_Enum::Names () const Standard_Boolean Express_Enum::GenerateClass () const { std::cout << "Generating ENUMERATION " << CPPName()->ToCString() << std::endl; - + // create a package directory (if not yet exist) - OSD_Protection prot ( OSD_RX, OSD_RWX, OSD_RX, OSD_RX ); + OSD_Protection prot(OSD_RX, OSD_RWX, OSD_RX, OSD_RX); TCollection_AsciiString pack = GetPackageName()->String(); - OSD_Path path ( pack ); - OSD_Directory dir ( path ); - dir.Build ( prot ); + OSD_Path path(pack); + OSD_Directory dir(path); + dir.Build(prot); pack += "/"; pack += CPPName()->String(); - + // Open HXX file - std::ofstream os ( pack.Cat ( ".hxx" ).ToCString(), std::ios::out | std::ios::ate ); + std::ofstream os(pack.Cat(".hxx").ToCString(), std::ios::out | std::ios::ate); // write header Express::WriteFileStamp(os); @@ -74,15 +75,19 @@ Standard_Boolean Express_Enum::GenerateClass () const os << std::endl << "enum " << CPPName()->ToCString() << std::endl; os << "{" << std::endl; Handle(TCollection_HAsciiString) prefix = Express::EnumPrefix(Name()); - for ( Standard_Integer i = 1; i <= myNames->Length(); i++ ) { - if ( i > 1 ) os << "," << std::endl; - os << " " << GetPackageName()->ToCString() << "_" << prefix->ToCString() - << myNames->Value(i)->ToCString(); + for (Standard_Integer i = 1; i <= myNames->Length(); i++) + { + if (i > 1) + { + os << "," << std::endl; + } + os << " " << GetPackageName()->ToCString() << "_" << prefix->ToCString() + << myNames->Value(i)->ToCString(); } os << std::endl << "};" << std::endl; os << "#endif // _" << CPPName()->ToCString() << "_HeaderFile" << std::endl; os.close(); - + return Standard_False; } diff --git a/src/Express/Express_Enum.hxx b/src/Express/Express_Enum.hxx index fde36c4808..51ff17da29 100644 --- a/src/Express/Express_Enum.hxx +++ b/src/Express/Express_Enum.hxx @@ -19,14 +19,12 @@ #include #include - //! Implements TYPE ENUMERATION item of the EXPRESS //! schema, with interface for deferred Item class. class Express_Enum : public Express_Item { public: - //! Create ENUM item and initialize it Standard_EXPORT Express_Enum(const Standard_CString name, const Handle(TColStd_HSequenceOfHAsciiString)& names); @@ -37,28 +35,14 @@ public: //! Create HXX/CXX files from item Standard_EXPORT virtual Standard_Boolean GenerateClass() const Standard_OVERRIDE; - - - DEFINE_STANDARD_RTTIEXT(Express_Enum,Express_Item) protected: - - - private: - Handle(TColStd_HSequenceOfHAsciiString) myNames; - }; - - - - - - #endif // _Express_Enum_HeaderFile diff --git a/src/Express/Express_Field.cxx b/src/Express/Express_Field.cxx index 584a67fb34..981fa1bfd2 100644 --- a/src/Express/Express_Field.cxx +++ b/src/Express/Express_Field.cxx @@ -23,9 +23,10 @@ IMPLEMENT_STANDARD_RTTIEXT(Express_Field,Standard_Transient) //purpose : //======================================================================= -Express_Field::Express_Field (const Standard_CString name, - const Handle(Express_Type) &type, - const Standard_Boolean opt) +Express_Field::Express_Field( + const Standard_CString name, + const Handle(Express_Type) &type, + const Standard_Boolean opt) { myName = new TCollection_HAsciiString ( name ); myType = type; @@ -37,9 +38,10 @@ Express_Field::Express_Field (const Standard_CString name, //purpose : //======================================================================= -Express_Field::Express_Field (const Handle(TCollection_HAsciiString) &name, - const Handle(Express_Type) &type, - const Standard_Boolean opt) +Express_Field::Express_Field( + const Handle(TCollection_HAsciiString) &name, + const Handle(Express_Type) &type, + const Standard_Boolean opt) { myName = name; myType = type; diff --git a/src/Express/Express_Field.hxx b/src/Express/Express_Field.hxx index 05a1ceafbd..46d0489630 100644 --- a/src/Express/Express_Field.hxx +++ b/src/Express/Express_Field.hxx @@ -19,19 +19,23 @@ class TCollection_HAsciiString; class Express_Type; - //! Represents field of the ENTITY item in the EXPRESS schema class Express_Field : public Standard_Transient { public: - //! Create object and initialize it - Standard_EXPORT Express_Field(const Standard_CString name, const Handle(Express_Type)& type, const Standard_Boolean opt); + Standard_EXPORT Express_Field( + const Standard_CString name, + const Handle(Express_Type)& type, + const Standard_Boolean opt); //! Create object and initialize it - Standard_EXPORT Express_Field(const Handle(TCollection_HAsciiString)& name, const Handle(Express_Type)& type, const Standard_Boolean opt); + Standard_EXPORT Express_Field( + const Handle(TCollection_HAsciiString)& name, + const Handle(Express_Type)& type, + const Standard_Boolean opt); //! Returns field name Standard_EXPORT const Handle(TCollection_HAsciiString)& Name() const; @@ -42,30 +46,16 @@ public: //! Returns True if field is optional Standard_EXPORT Standard_Boolean IsOptional() const; - - - DEFINE_STANDARD_RTTIEXT(Express_Field,Standard_Transient) protected: - - - private: - Handle(TCollection_HAsciiString) myName; Handle(Express_Type) myType; Standard_Boolean myOpt; - }; - - - - - - #endif // _Express_Field_HeaderFile diff --git a/src/Express/Express_HSequenceOfEntity.hxx b/src/Express/Express_HSequenceOfEntity.hxx index 4d3ad2ffcd..649e818469 100644 --- a/src/Express/Express_HSequenceOfEntity.hxx +++ b/src/Express/Express_HSequenceOfEntity.hxx @@ -19,5 +19,4 @@ DEFINE_HSEQUENCE(Express_HSequenceOfEntity, Express_SequenceOfEntity) - #endif diff --git a/src/Express/Express_HSequenceOfField.hxx b/src/Express/Express_HSequenceOfField.hxx index 46ab070161..4fde3dee92 100644 --- a/src/Express/Express_HSequenceOfField.hxx +++ b/src/Express/Express_HSequenceOfField.hxx @@ -19,5 +19,4 @@ DEFINE_HSEQUENCE(Express_HSequenceOfField, Express_SequenceOfField) - #endif diff --git a/src/Express/Express_HSequenceOfItem.hxx b/src/Express/Express_HSequenceOfItem.hxx index 64909915b5..a6ea4fa99a 100644 --- a/src/Express/Express_HSequenceOfItem.hxx +++ b/src/Express/Express_HSequenceOfItem.hxx @@ -19,5 +19,4 @@ DEFINE_HSEQUENCE(Express_HSequenceOfItem, Express_SequenceOfItem) - #endif diff --git a/src/Express/Express_Integer.hxx b/src/Express/Express_Integer.hxx index 0490b5e1ea..ed19220231 100644 --- a/src/Express/Express_Integer.hxx +++ b/src/Express/Express_Integer.hxx @@ -19,41 +19,24 @@ #include class TCollection_HAsciiString; - //! Implements EXPRESS type 'INTEGER' class Express_Integer : public Express_PredefinedType { public: - //! Empty constructor Standard_EXPORT Express_Integer(); //! Returns "Standard_Integer" Standard_EXPORT virtual Handle(TCollection_HAsciiString) CPPName() const Standard_OVERRIDE; - - - DEFINE_STANDARD_RTTIEXT(Express_Integer,Express_PredefinedType) protected: - - - private: - - - }; - - - - - - #endif // _Express_Integer_HeaderFile diff --git a/src/Express/Express_Item.cxx b/src/Express/Express_Item.cxx index b2e9aed53f..79feabf3f0 100644 --- a/src/Express/Express_Item.cxx +++ b/src/Express/Express_Item.cxx @@ -67,7 +67,7 @@ const Handle(TCollection_HAsciiString) &Express_Item::Name () const Handle(TCollection_HAsciiString) Express_Item::CPPName () const { - Handle(TCollection_HAsciiString) name = GetPackageName ( Standard_True )->Cat ( "_" ); + Handle(TCollection_HAsciiString) name = GetPackageName(Standard_True)->Cat("_"); name->AssignCat ( myName ); return name; } @@ -89,7 +89,10 @@ void Express_Item::SetPackageName (const Handle(TCollection_HAsciiString) &pack) Handle(TCollection_HAsciiString) Express_Item::GetPackageName (const Standard_Boolean Auto) const { - if ( myPack.IsNull() && Auto ) return new TCollection_HAsciiString ( "StepStep" ); + if (myPack.IsNull() && Auto) + { + return new TCollection_HAsciiString("StepStep"); + } return myPack; } @@ -120,9 +123,14 @@ void Express_Item::SetMark (const Standard_Boolean mark) Standard_Boolean Express_Item::Generate () { - if ( ! GetMark() ) return Standard_False; - if ( GetPackageName().IsNull() ) - SetPackageName ( GetPackageName ( Standard_True ) ); + if (!GetMark()) + { + return Standard_False; + } + if (GetPackageName().IsNull()) + { + SetPackageName(GetPackageName(Standard_True)); + } SetMark ( Standard_False ); return GenerateClass(); } @@ -132,32 +140,42 @@ Standard_Boolean Express_Item::Generate () //purpose : //======================================================================= -Standard_Boolean Express_Item::Use (const Handle(TCollection_HAsciiString) &pack, - const Standard_Boolean defer) +Standard_Boolean Express_Item::Use( + const Handle(TCollection_HAsciiString) &pack, + const Standard_Boolean defer) { - if ( ! GetPackageName().IsNull() ) { + if (!GetPackageName().IsNull()) + { // issue a warning message if item from known package uses item from unknown package (StepStep) - if ( pack->String().IsDifferent ( "StepStep" ) && - GetPackageName()->String().IsEqual ( "StepStep" ) ) { - std::cout << "Warning: item " << Name()->ToCString() << " has no package assigned, but used from package " << pack->ToCString() << std::endl; + if (pack->String().IsDifferent("StepStep") && GetPackageName()->String().IsEqual("StepStep")) + { + std::cout << "Warning: item " << Name()->ToCString() << " has no package assigned, but used from package " + << pack->ToCString() << std::endl; } - return Standard_False; } // issue a warning message if type still does not have package assigned - if ( pack->String().IsDifferent ( "StepStep" ) ) { - std::cout << "Warning: item " << Name()->ToCString() << " has no package assigned, setting " << pack->ToCString() << std::endl; + if (pack->String().IsDifferent("StepStep")) + { + std::cout << "Warning: item " << Name()->ToCString() << " has no package assigned, setting " + << pack->ToCString() << std::endl; } SetPackageName ( pack ); SetMark ( Standard_True ); - if ( defer ) return Standard_False; + if (defer) + { + return Standard_False; + } // manage indent for cout in order to mark structure of calls static Standard_Integer shift=0; shift++; - for ( Standard_Integer i=0; i < shift; i++ ) std::cout << " "; + for (Standard_Integer i = 0; i < shift; i++) + { + std::cout << " "; + } Standard_Boolean res = Generate(); shift--; return res; diff --git a/src/Express/Express_Item.hxx b/src/Express/Express_Item.hxx index 1248a9ccf5..bba2a753aa 100644 --- a/src/Express/Express_Item.hxx +++ b/src/Express/Express_Item.hxx @@ -22,7 +22,6 @@ #include class TCollection_HAsciiString; - //! Base class for items of the schema. Stores a name of the class, //! package name and flag used to mark items for generation. //! Provides interface for writing generated class definitions to HXX @@ -42,7 +41,7 @@ public: //! Returns package name //! If not defined, returns NULL if auto is False (default) //! or "StepStep" if auto is True - Standard_EXPORT Handle(TCollection_HAsciiString) GetPackageName (const Standard_Boolean Auto = Standard_False) const; + Standard_EXPORT Handle(TCollection_HAsciiString) GetPackageName(const Standard_Boolean Auto = Standard_False) const; //! Sets package name Standard_EXPORT void SetPackageName (const Handle(TCollection_HAsciiString)& pack) ; @@ -66,7 +65,9 @@ public: //! by pack argument (supposing that it is package of item that uses //! current one) and Mark flag is set. Then, if defer is False, //! calls Generate(). - Standard_EXPORT Standard_Boolean Use (const Handle(TCollection_HAsciiString)& pack, const Standard_Boolean defer = Standard_False) ; + Standard_EXPORT Standard_Boolean Use( + const Handle(TCollection_HAsciiString)& pack, + const Standard_Boolean defer = Standard_False); //! Set category for item Standard_EXPORT void SetCategory (const Handle(TCollection_HAsciiString)& categ) ; @@ -98,13 +99,9 @@ public: //! Get current entity index Standard_EXPORT static Standard_Integer Index(); - - - DEFINE_STANDARD_RTTIEXT(Express_Item,Standard_Transient) protected: - //! Creates object and initialises fields PackageName and //! CreateFlag by 0 @@ -114,11 +111,8 @@ protected: //! CreateFlag by 0 Standard_EXPORT Express_Item(const Handle(TCollection_HAsciiString)& name); - - private: - Handle(TCollection_HAsciiString) myName; Handle(TCollection_HAsciiString) myPack; Standard_Boolean myMark; @@ -127,12 +121,6 @@ private: Standard_Boolean myhasCheck; Standard_Boolean myhasFillShared; - }; - - - - - #endif // _Express_Item_HeaderFile diff --git a/src/Express/Express_Logical.cxx b/src/Express/Express_Logical.cxx index 4b1e0a286d..d948a3ead9 100644 --- a/src/Express/Express_Logical.cxx +++ b/src/Express/Express_Logical.cxx @@ -34,7 +34,7 @@ Express_Logical::Express_Logical () Handle(TCollection_HAsciiString) Express_Logical::CPPName () const { - return new TCollection_HAsciiString ( "StepData_Logical" ); + return new TCollection_HAsciiString("StepData_Logical"); } //======================================================================= diff --git a/src/Express/Express_Logical.hxx b/src/Express/Express_Logical.hxx index 01fb3c5a7c..8d9109cbb2 100644 --- a/src/Express/Express_Logical.hxx +++ b/src/Express/Express_Logical.hxx @@ -15,18 +15,15 @@ #define _Express_Logical_HeaderFile #include - #include class TCollection_HAsciiString; - //! Implements EXPRESS type 'LOGICAL' class Express_Logical : public Express_PredefinedType { public: - //! Empty constructor Standard_EXPORT Express_Logical(); @@ -43,27 +40,12 @@ public: //! Return False Standard_EXPORT virtual Standard_Boolean IsHandle() const Standard_OVERRIDE; - - - DEFINE_STANDARD_RTTIEXT(Express_Logical,Express_PredefinedType) protected: - - - private: - - - }; - - - - - - #endif // _Express_Logical_HeaderFile diff --git a/src/Express/Express_NamedType.cxx b/src/Express/Express_NamedType.cxx index 7c6c345033..452a1773e2 100644 --- a/src/Express/Express_NamedType.cxx +++ b/src/Express/Express_NamedType.cxx @@ -88,8 +88,9 @@ Handle(TCollection_HAsciiString) Express_NamedType::CPPName () const Standard_Boolean Express_NamedType::IsStandard () const { - if ( myItem->IsKind(STANDARD_TYPE(Express_Alias)) ) { - Handle(Express_Alias) alias = Handle(Express_Alias)::DownCast ( myItem ); + if (myItem->IsKind(STANDARD_TYPE(Express_Alias))) + { + Handle(Express_Alias) alias = Handle(Express_Alias)::DownCast(myItem); return alias->Type()->IsStandard(); } return Standard_False; @@ -102,11 +103,15 @@ Standard_Boolean Express_NamedType::IsStandard () const Standard_Boolean Express_NamedType::IsSimple () const { - if ( myItem->IsKind(STANDARD_TYPE(Express_Alias)) ) { - Handle(Express_Alias) alias = Handle(Express_Alias)::DownCast ( myItem ); + if (myItem->IsKind(STANDARD_TYPE(Express_Alias))) + { + Handle(Express_Alias) alias = Handle(Express_Alias)::DownCast(myItem); return alias->Type()->IsSimple(); } - if ( myItem->IsKind(STANDARD_TYPE(Express_Enum)) ) return Standard_True; + if (myItem->IsKind(STANDARD_TYPE(Express_Enum))) + { + return Standard_True; + } return Standard_False; // SELECT & ENTITY } @@ -117,11 +122,15 @@ Standard_Boolean Express_NamedType::IsSimple () const Standard_Boolean Express_NamedType::IsHandle () const { - if ( myItem->IsKind(STANDARD_TYPE(Express_Alias)) ) { + if (myItem->IsKind(STANDARD_TYPE(Express_Alias))) + { Handle(Express_Alias) alias = Handle(Express_Alias)::DownCast ( myItem ); return alias->Type()->IsHandle(); } - if ( myItem->IsKind(STANDARD_TYPE(Express_Entity)) ) return Standard_True; + if (myItem->IsKind(STANDARD_TYPE(Express_Entity))) + { + return Standard_True; + } return Standard_False; // SELECT & ENUMERATION } @@ -130,8 +139,9 @@ Standard_Boolean Express_NamedType::IsHandle () const //purpose : //======================================================================= -Standard_Boolean Express_NamedType::Use (const Handle(TCollection_HAsciiString) &pack, - const Standard_Boolean defer) const +Standard_Boolean Express_NamedType::Use( + const Handle(TCollection_HAsciiString) &pack, + const Standard_Boolean defer) const { return myItem->Use ( pack, defer ); } diff --git a/src/Express/Express_NamedType.hxx b/src/Express/Express_NamedType.hxx index e43daf0541..884b4883a4 100644 --- a/src/Express/Express_NamedType.hxx +++ b/src/Express/Express_NamedType.hxx @@ -15,13 +15,11 @@ #define _Express_NamedType_HeaderFile #include - #include class TCollection_HAsciiString; class Express_Item; - //! Base class for complex types (ARRAY, LIST, BAG, SET) //! in EXPRESS schema //! Stores type of elements and @@ -29,7 +27,6 @@ class Express_NamedType : public Express_Type { public: - //! Creates an object and initializes by name Standard_EXPORT Express_NamedType(const Standard_CString name); @@ -60,31 +57,19 @@ public: //! Declares type as used by some item being generated. //! Calls Use() for referred item (found by name). - Standard_EXPORT virtual Standard_Boolean Use(const Handle(TCollection_HAsciiString)& pack, const Standard_Boolean defer = Standard_False) const Standard_OVERRIDE; - - - + Standard_EXPORT virtual Standard_Boolean Use( + const Handle(TCollection_HAsciiString)& pack, + const Standard_Boolean defer = Standard_False) const Standard_OVERRIDE; DEFINE_STANDARD_RTTIEXT(Express_NamedType,Express_Type) protected: - - - private: - Handle(TCollection_HAsciiString) myName; Handle(Express_Item) myItem; - }; - - - - - - #endif // _Express_NamedType_HeaderFile diff --git a/src/Express/Express_PredefinedType.hxx b/src/Express/Express_PredefinedType.hxx index 7f59a926ed..d32455b34f 100644 --- a/src/Express/Express_PredefinedType.hxx +++ b/src/Express/Express_PredefinedType.hxx @@ -15,7 +15,6 @@ #define _Express_PredefinedType_HeaderFile #include - #include //! Base class for predefined types (like NUMBER or STRING) @@ -24,35 +23,19 @@ class Express_PredefinedType : public Express_Type { public: - //! Returns True Standard_EXPORT virtual Standard_Boolean IsStandard() const Standard_OVERRIDE; - - - DEFINE_STANDARD_RTTIEXT(Express_PredefinedType,Express_Type) protected: - //! Empty constructor Standard_EXPORT Express_PredefinedType(); - - private: - - - }; - - - - - - #endif // _Express_PredefinedType_HeaderFile diff --git a/src/Express/Express_Real.cxx b/src/Express/Express_Real.cxx index 7ee5c21d70..878f78569e 100644 --- a/src/Express/Express_Real.cxx +++ b/src/Express/Express_Real.cxx @@ -34,5 +34,5 @@ Express_Real::Express_Real () Handle(TCollection_HAsciiString) Express_Real::CPPName () const { - return new TCollection_HAsciiString ( "Standard_Real" ); + return new TCollection_HAsciiString("Standard_Real"); } diff --git a/src/Express/Express_Real.hxx b/src/Express/Express_Real.hxx index 1d8deae96d..8f9d8acef5 100644 --- a/src/Express/Express_Real.hxx +++ b/src/Express/Express_Real.hxx @@ -15,45 +15,27 @@ #define _Express_Real_HeaderFile #include - #include class TCollection_HAsciiString; - //! Implements EXPRESS type 'REAL' class Express_Real : public Express_PredefinedType { public: - //! Empty constructor Standard_EXPORT Express_Real(); //! Returns "Standard_Real" Standard_EXPORT virtual Handle(TCollection_HAsciiString) CPPName() const Standard_OVERRIDE; - - - DEFINE_STANDARD_RTTIEXT(Express_Real,Express_PredefinedType) protected: - - - private: - - - }; - - - - - - #endif // _Express_Real_HeaderFile diff --git a/src/Express/Express_Reference.cxx b/src/Express/Express_Reference.cxx index 5671b21bf9..02b33f3eb3 100644 --- a/src/Express/Express_Reference.cxx +++ b/src/Express/Express_Reference.cxx @@ -22,9 +22,10 @@ IMPLEMENT_STANDARD_RTTIEXT(Express_Reference,Express_Item) //purpose : //======================================================================= -Express_Reference::Express_Reference (const Standard_CString name, - const Handle(TColStd_HSequenceOfHAsciiString) &types) - : Express_Item ( name ) +Express_Reference::Express_Reference( + const Standard_CString name, + const Handle(TColStd_HSequenceOfHAsciiString) &types) + : Express_Item(name) { myTypes = types; } diff --git a/src/Express/Express_Reference.hxx b/src/Express/Express_Reference.hxx index a0856e3062..d03e6ecc6a 100644 --- a/src/Express/Express_Reference.hxx +++ b/src/Express/Express_Reference.hxx @@ -21,47 +21,42 @@ class Express_HSequenceOfItem; - //! Implements REFERENCE FROM (list of types used from other schema) //! item of the EXPRESS schema, with interface for Item class. class Express_Reference : public Express_Item { public: - //! Create Reference item and initialize it Standard_EXPORT Express_Reference(const Standard_CString name, const Handle(TColStd_HSequenceOfHAsciiString)& types); //! Returns list of types referenced - const Handle(TColStd_HSequenceOfHAsciiString)& Types() const { return myTypes; } + const Handle(TColStd_HSequenceOfHAsciiString)& Types() const + { + return myTypes; + } //! Returns handle to sequence of items corresponding to //! listed types - const Handle(Express_HSequenceOfItem)& Items() const { return myItems; } + const Handle(Express_HSequenceOfItem)& Items() const + { + return myItems; + } //! Redefined to empty (in order to be able to instantiate) //! Returna False Standard_EXPORT virtual Standard_Boolean GenerateClass() const Standard_OVERRIDE; - - - DEFINE_STANDARD_RTTIEXT(Express_Reference,Express_Item) protected: - - - private: - Handle(TColStd_HSequenceOfHAsciiString) myTypes; Handle(Express_HSequenceOfItem) myItems; - }; - #endif // _Express_Reference_HeaderFile diff --git a/src/Express/Express_Schema.cxx b/src/Express/Express_Schema.cxx index 8a1e6a7f4a..9ee5314c2f 100644 --- a/src/Express/Express_Schema.cxx +++ b/src/Express/Express_Schema.cxx @@ -35,8 +35,9 @@ IMPLEMENT_STANDARD_RTTIEXT(Express_Schema,Standard_Transient) //purpose : //======================================================================= -Express_Schema::Express_Schema (const Standard_CString name, - const Handle(Express_HSequenceOfItem) &items) +Express_Schema::Express_Schema( + const Standard_CString name, + const Handle(Express_HSequenceOfItem) &items) { myName = new TCollection_HAsciiString ( name ); myItems = items; @@ -48,8 +49,9 @@ Express_Schema::Express_Schema (const Standard_CString name, //purpose : //======================================================================= -Express_Schema::Express_Schema (const Handle(TCollection_HAsciiString) &name, - const Handle(Express_HSequenceOfItem) &items) +Express_Schema::Express_Schema( + const Handle(TCollection_HAsciiString) &name, + const Handle(Express_HSequenceOfItem) &items) { myName = name; myItems = items; @@ -91,7 +93,7 @@ Standard_Integer Express_Schema::NbItems () const //purpose : //======================================================================= -Handle(Express_Item) Express_Schema::Item (const Standard_Integer num) const +Handle(Express_Item) Express_Schema::Item(const Standard_Integer num) const { return myItems->Value(num); } @@ -101,12 +103,16 @@ Handle(Express_Item) Express_Schema::Item (const Standard_Integer num) const //purpose : //======================================================================= -Handle(Express_Item) Express_Schema::Item (const Standard_CString name, - const Standard_Boolean silent) const +Handle(Express_Item) Express_Schema::Item( + const Standard_CString name, + const Standard_Boolean silent) const { - if ( ! myDict.IsBound ( name ) ) { - if ( ! silent ) + if (!myDict.IsBound(name)) + { + if (!silent) + { std::cout << "Error: attempt to access unknown item by name " << name << std::endl; + } return 0; } return myDict.Find (name); @@ -117,9 +123,9 @@ Handle(Express_Item) Express_Schema::Item (const Standard_CString name, //purpose : //======================================================================= -Handle(Express_Item) Express_Schema::Item (const TCollection_AsciiString &name) const +Handle(Express_Item) Express_Schema::Item(const TCollection_AsciiString &name) const { - return Item ( name.ToCString() ); + return Item(name.ToCString()); } //======================================================================= @@ -127,138 +133,184 @@ Handle(Express_Item) Express_Schema::Item (const TCollection_AsciiString &name) //purpose : //======================================================================= -Handle(Express_Item) Express_Schema::Item (const Handle(TCollection_HAsciiString) &name) const +Handle(Express_Item) Express_Schema::Item(const Handle(TCollection_HAsciiString) &name) const { - return Item ( name->ToCString() ); + return Item(name->ToCString()); } //======================================================================= -//function : Prepare -//purpose : +//function : nameToCasCade +//purpose : auxilary for Prepare() +// Convert STEP-style name (lowercase, with underscores) +// to CASCADE-style name (each word starts with uppercase, no intervals) //======================================================================= - -// Convert STEP-style name (lowercase, with underscores) -// to CASCADE-style name (each word starts with uppercase, no intervals) -static void NameToCasCade (const Handle(TCollection_HAsciiString) &name) +static void nameToCasCade (const Handle(TCollection_HAsciiString) &name) { - if ( name.IsNull() ) return; - for ( Standard_Integer i=1; i <= name->Length(); i++ ) { - if ( name->Value(i) == '_' ) { + if (name.IsNull()) + { + return; + } + for (Standard_Integer i = 1; i <= name->Length(); i++) + { + if ( name->Value(i) == '_' ) + { name->Remove ( i ); } - else if ( i >1 ) continue; + else if (i > 1) + { + continue; + } name->SetValue ( i, UpperCase ( name->Value(i) ) ); } } -// Convert names for Type object -static void NameToCasCade (const Handle(Express_Type) &type) +//======================================================================= +//function : nameToCasCade +//purpose : auxilary for Prepare() +// Convert names for Type object +//======================================================================= +static void nameToCasCade (const Handle(Express_Type) &type) { - if ( type->IsKind(STANDARD_TYPE(Express_NamedType)) ) { - const Handle(Express_NamedType) named = Handle(Express_NamedType)::DownCast ( type ); - NameToCasCade ( named->Name() ); + if (type->IsKind(STANDARD_TYPE(Express_NamedType))) + { + const Handle(Express_NamedType) named = Handle(Express_NamedType)::DownCast(type); + nameToCasCade(named->Name()); } - else if ( type->IsKind(STANDARD_TYPE(Express_ComplexType)) ) { - const Handle(Express_ComplexType) complex = Handle(Express_ComplexType)::DownCast ( type ); - NameToCasCade ( complex->Type() ); + else if (type->IsKind(STANDARD_TYPE(Express_ComplexType))) + { + const Handle(Express_ComplexType) complex = Handle(Express_ComplexType)::DownCast(type); + nameToCasCade(complex->Type()); } } -// Prepare data: convert names to CasCade, fill dictionary of typenames -// and set handles to items where they are referenced by names +//======================================================================= +//function : Prepare +//purpose : Prepare data: convert names to CasCade, fill dictionary of typenames +// and set handles to items where they are referenced by names +//======================================================================= + void Express_Schema::Prepare () { myDict.Clear(); - if ( myItems.IsNull() ) return; + if (myItems.IsNull()) + { + return; + } Standard_Integer nbItems = NbItems(); // convert names annd fill dictionary - for ( Standard_Integer num=1; num <= nbItems; num++ ) { + for ( Standard_Integer num=1; num <= nbItems; num++ ) + { // get item const Handle(Express_Item) item = Item(num); // change item name - NameToCasCade ( item->Name() ); + nameToCasCade ( item->Name() ); // change names of referred types and other names - if ( item->IsKind(STANDARD_TYPE(Express_Alias)) ) { - const Handle(Express_Alias) alias = Handle(Express_Alias)::DownCast ( item ); - NameToCasCade ( alias->Type() ); + if (item->IsKind(STANDARD_TYPE(Express_Alias))) + { + const Handle(Express_Alias) alias = Handle(Express_Alias)::DownCast(item); + nameToCasCade(alias->Type()); } - else if ( item->IsKind(STANDARD_TYPE(Express_Select)) ) { - const Handle(Express_Select) select = Handle(Express_Select)::DownCast ( item ); - for ( Standard_Integer i=1; i <= select->Names()->Length(); i++ ) - NameToCasCade ( select->Names()->Value(i) ); + else if (item->IsKind(STANDARD_TYPE(Express_Select))) + { + const Handle(Express_Select) select = Handle(Express_Select)::DownCast(item); + for (Standard_Integer i = 1; i <= select->Names()->Length(); i++) + { + nameToCasCade(select->Names()->Value(i)); + } } - else if ( item->IsKind(STANDARD_TYPE(Express_Enum)) ) { - const Handle(Express_Enum) en = Handle(Express_Enum)::DownCast ( item ); - for ( Standard_Integer i=1; i <= en->Names()->Length(); i++ ) - NameToCasCade ( en->Names()->Value(i) ); + else if (item->IsKind(STANDARD_TYPE(Express_Enum))) + { + const Handle(Express_Enum) en = Handle(Express_Enum)::DownCast(item); + for (Standard_Integer i = 1; i <= en->Names()->Length(); i++) + { + nameToCasCade(en->Names()->Value(i)); + } } - else if ( item->IsKind(STANDARD_TYPE(Express_Entity)) ) { - const Handle(Express_Entity) ent = Handle(Express_Entity)::DownCast ( item ); - for ( Standard_Integer i=1; i <= ent->SuperTypes()->Length(); i++ ) - NameToCasCade ( ent->SuperTypes()->Value(i) ); + else if (item->IsKind(STANDARD_TYPE(Express_Entity))) + { + const Handle(Express_Entity) ent = Handle(Express_Entity)::DownCast(item); + for (Standard_Integer i = 1; i <= ent->SuperTypes()->Length(); i++) + { + nameToCasCade(ent->SuperTypes()->Value(i)); + } const Handle(Express_HSequenceOfField) fields = ent->Fields(); - for (Standard_Integer i=1; i <= fields->Length(); i++ ) { - NameToCasCade ( fields->Value(i)->Name() ); - NameToCasCade ( fields->Value(i)->Type() ); + for (Standard_Integer i = 1; i <= fields->Length(); i++) + { + nameToCasCade(fields->Value(i)->Name()); + nameToCasCade(fields->Value(i)->Type()); } } // add to dictionary - myDict.Bind (item->Name()->String(), item); + myDict.Bind(item->Name()->String(), item); } // set references to items from other items and types - for (Standard_Integer num=1; num <= nbItems; num++ ) { + for (Standard_Integer num=1; num <= nbItems; num++ ) + { const Handle(Express_Item) item = Item(num); - if ( item->IsKind(STANDARD_TYPE(Express_Alias)) ) { + if ( item->IsKind(STANDARD_TYPE(Express_Alias)) ) + { const Handle(Express_Alias) alias = Handle(Express_Alias)::DownCast ( item ); PrepareType ( alias->Type() ); // for aliases, define package to avoid warnings alias->SetPackageName ( new TCollection_HAsciiString ( "Standard" ) ); continue; } - else if ( item->IsKind(STANDARD_TYPE(Express_Select)) ) { - const Handle(Express_Select) select = Handle(Express_Select)::DownCast ( item ); + else if (item->IsKind(STANDARD_TYPE(Express_Select))) + { + const Handle(Express_Select) select = Handle(Express_Select)::DownCast(item); Handle(TColStd_HSequenceOfHAsciiString) names = select->Names(); Handle(Express_HSequenceOfItem) items = select->Items(); - for ( Standard_Integer i=1; i <= names->Length(); i++ ) { - Handle(Express_Item) it = Item ( names->Value(i) ); - // if select refers to another select, expand it - if ( it->IsKind(STANDARD_TYPE(Express_Select)) ) { - std::cout << "Info: SELECT " << item->Name()->ToCString() << " refers to another SELECT " << - it->Name()->ToCString() << "; expanded" << std::endl; - const Handle(Express_Select) sel = Handle(Express_Select)::DownCast ( it ); + for (Standard_Integer i = 1; i <= names->Length(); i++) + { + Handle(Express_Item) it = Item(names->Value(i)); + // if select refers to another select, expand it + if (it->IsKind(STANDARD_TYPE(Express_Select))) + { + std::cout << "Info: SELECT " << item->Name()->ToCString() << " refers to another SELECT " << + it->Name()->ToCString() << "; expanded" << std::endl; + const Handle(Express_Select) sel = Handle(Express_Select)::DownCast(it); Standard_Integer j = 1; - for ( ; j <= sel->Names()->Length(); j++ ) - names->InsertBefore ( i+j-1, sel->Names()->Value(j) ); - names->Remove ( i+j-1 ); - i--; - continue; - } - items->Append ( it ); + for (; j <= sel->Names()->Length(); j++) + { + names->InsertBefore(i + j - 1, sel->Names()->Value(j)); + } + names->Remove(i + j - 1); + i--; + continue; + } + items->Append(it); } } - else if ( item->IsKind(STANDARD_TYPE(Express_Entity)) ) { - const Handle(Express_Entity) ent = Handle(Express_Entity)::DownCast ( item ); + else if ( item->IsKind(STANDARD_TYPE(Express_Entity)) ) + { + const Handle(Express_Entity) ent = Handle(Express_Entity)::DownCast(item); Handle(TColStd_HSequenceOfHAsciiString) names = ent->SuperTypes(); Handle(Express_HSequenceOfEntity) inh = ent->Inherit(); - for ( Standard_Integer i=1; i <= names->Length(); i++ ) { - Handle(Express_Entity) subent = Handle(Express_Entity)::DownCast ( Item ( names->Value(i) ) ); - if ( ! subent.IsNull() ) inh->Append ( subent ); - else + for (Standard_Integer i = 1; i <= names->Length(); i++) + { + Handle(Express_Entity) subent = Handle(Express_Entity)::DownCast(Item(names->Value(i))); + if (!subent.IsNull()) { - std::cout << "Error in " << item->Name()->ToCString() << ": supertype " << - names->Value(i)->ToCString() << " is not an ENTITY; ignored" << std::endl; + inh->Append(subent); + } + else + { + std::cout << "Error in " << item->Name()->ToCString() << ": supertype " << + names->Value(i)->ToCString() << " is not an ENTITY; ignored" << std::endl; } } const Handle(Express_HSequenceOfField) fields = ent->Fields(); - for (Standard_Integer i=1; i <= fields->Length(); i++ ) - PrepareType ( fields->Value(i)->Type() ); + for (Standard_Integer i = 1; i <= fields->Length(); i++) + { + PrepareType(fields->Value(i)->Type()); + } } } @@ -269,14 +321,16 @@ void Express_Schema::Prepare () //purpose : //======================================================================= -void Express_Schema::PrepareType (const Handle(Express_Type) &type) const +void Express_Schema::PrepareType(const Handle(Express_Type) &type) const { - if ( type->IsKind(STANDARD_TYPE(Express_NamedType)) ) { - Handle(Express_NamedType) named = Handle(Express_NamedType)::DownCast ( type ); - named->SetItem ( Item ( named->Name() ) ); + if (type->IsKind(STANDARD_TYPE(Express_NamedType))) + { + Handle(Express_NamedType) named = Handle(Express_NamedType)::DownCast(type); + named->SetItem(Item(named->Name())); } - else if ( type->IsKind(STANDARD_TYPE(Express_ComplexType)) ) { - Handle(Express_ComplexType) complex = Handle(Express_ComplexType)::DownCast ( type ); - PrepareType ( complex->Type() ); + else if (type->IsKind(STANDARD_TYPE(Express_ComplexType))) + { + Handle(Express_ComplexType) complex = Handle(Express_ComplexType)::DownCast(type); + PrepareType(complex->Type()); } } diff --git a/src/Express/Express_Schema.hxx b/src/Express/Express_Schema.hxx index 94551f2624..08ef991bc1 100644 --- a/src/Express/Express_Schema.hxx +++ b/src/Express/Express_Schema.hxx @@ -24,7 +24,6 @@ class Express_Item; class TCollection_AsciiString; class Express_Type; - //! Represents a schema as a list of items and provides general //! tools for generating HXX/CXX files (including dictionary of //! item names) @@ -32,7 +31,6 @@ class Express_Schema : public Standard_Transient { public: - //! Creates a schema with given name and given set of items //! and calls Prepare() @@ -40,7 +38,9 @@ public: //! Creates a schema with given name and given set of items //! and calls Prepare() - Standard_EXPORT Express_Schema(const Handle(TCollection_HAsciiString)& Name, const Handle(Express_HSequenceOfItem)& items); + Standard_EXPORT Express_Schema( + const Handle(TCollection_HAsciiString)& Name, + const Handle(Express_HSequenceOfItem)& items); //! Returns schema name Standard_EXPORT const Handle(TCollection_HAsciiString)& Name() const; @@ -55,7 +55,9 @@ public: Standard_EXPORT Handle(Express_Item) Item (const Standard_Integer num) const; //! Returns item by name - Standard_EXPORT Handle(Express_Item) Item (const Standard_CString name, const Standard_Boolean silent = Standard_False) const; + Standard_EXPORT Handle(Express_Item) Item( + const Standard_CString name, + const Standard_Boolean silent = Standard_False) const; //! Returns item by name Standard_EXPORT Handle(Express_Item) Item (const TCollection_AsciiString& name) const; @@ -63,18 +65,11 @@ public: //! Returns item by name Standard_EXPORT Handle(Express_Item) Item (const Handle(TCollection_HAsciiString)& name) const; - - - DEFINE_STANDARD_RTTIEXT(Express_Schema,Standard_Transient) protected: - - - private: - //! Prepares data for further work. Converts all item names //! from EXPRESS style (aaa_bb) to CASCADE style (AaaBb). @@ -90,6 +85,7 @@ private: Handle(TCollection_HAsciiString) myName; Handle(Express_HSequenceOfItem) myItems; Express_DataMapOfAsciiStringItem myDict; + }; #endif // _Express_Schema_HeaderFile diff --git a/src/Express/Express_Select.cxx b/src/Express/Express_Select.cxx index 2d8cdd4d31..ddee6e9f12 100644 --- a/src/Express/Express_Select.cxx +++ b/src/Express/Express_Select.cxx @@ -37,9 +37,10 @@ IMPLEMENT_STANDARD_RTTIEXT(Express_Select,Express_Item) //purpose : //======================================================================= -Express_Select::Express_Select (const Standard_CString name, - const Handle(TColStd_HSequenceOfHAsciiString) &names) - : Express_Item(name), myNames(names) +Express_Select::Express_Select( + const Standard_CString name, + const Handle(TColStd_HSequenceOfHAsciiString) &names) + : Express_Item(name), myNames(names) { myItems = new Express_HSequenceOfItem; } @@ -75,28 +76,34 @@ Standard_Boolean Express_Select::GenerateClass () const Handle(TColStd_HSequenceOfInteger) seqMember = new TColStd_HSequenceOfInteger; Handle(TColStd_HSequenceOfInteger) seqEntities = new TColStd_HSequenceOfInteger; - for ( Standard_Integer i=1; i <= myItems->Length(); i++ ) { + for (Standard_Integer i = 1; i <= myItems->Length(); i++) + { Handle(Express_Item) item = myItems->Value(i); if (item->IsKind(STANDARD_TYPE(Express_Entity)) || item->IsKind(STANDARD_TYPE(Express_Select)) || item->IsKind(STANDARD_TYPE(Express_Alias)) || item->IsKind(STANDARD_TYPE(Express_ComplexType))) - seqEntities->Append(i); - else seqMember->Append(i); - + { + seqEntities->Append(i); + } + else + { + seqMember->Append(i); + } } std::cout << "Generating SELECT " << CPPname->ToCString() << std::endl; - if(!seqMember->IsEmpty()) { - std::cout << "Generating SELECTMember " << CPPname->ToCString() << "Member"<< std::endl; + if (!seqMember->IsEmpty()) + { + std::cout << "Generating SELECTMember " << CPPname->ToCString() << "Member" << std::endl; GenerateSelectMember(seqMember); } // create a package directory (if not yet exist) - OSD_Protection prot ( OSD_RX, OSD_RWX, OSD_RX, OSD_RX ); + OSD_Protection prot(OSD_RX, OSD_RWX, OSD_RX, OSD_RX); TCollection_AsciiString pack = GetPackageName()->String(); - OSD_Path path ( pack ); - OSD_Directory dir ( path ); - dir.Build ( prot ); + OSD_Path path(pack); + OSD_Directory dir(path); + dir.Build(prot); pack += "/"; pack += CPPname->String(); - + //=============================== // Step 1: generating HXX @@ -124,14 +131,18 @@ Standard_Boolean Express_Select::GenerateClass () const os << "class StepData_SelectMember;" << std::endl; Standard_Integer jj = 1; - for (Standard_Integer i = 1; i <= myItems->Length(); i++) { + for (Standard_Integer i = 1; i <= myItems->Length(); i++) + { Handle(Express_Item) item = myItems->Value(i); item->Use(GetPackageName()); - if (item->IsKind(STANDARD_TYPE(Express_Alias))) { + if (item->IsKind(STANDARD_TYPE(Express_Alias))) + { Handle(Express_Type) type = Handle(Express_Alias)::DownCast(item)->Type(); TCollection_AsciiString ats = type->CPPName()->String(); if (type->IsStandard()) //(STANDARD_TYPE(Express_PredefinedType))) + { continue; + } } os << "class " << item->CPPName()->ToCString() << ";" << std::endl; jj++; @@ -155,16 +166,19 @@ Standard_Boolean Express_Select::GenerateClass () const // write common methods section os << " //! Recognizes a kind of " << Name()->ToCString() << " select type" << std::endl; - for (Standard_Integer i = 1; i <= seqEntities->Length(); i++) { + for (Standard_Integer i = 1; i <= seqEntities->Length(); i++) + { Standard_Integer ind = seqEntities->Value(i); os << " //! -- " << i << " -> " << myNames->Value(ind)->ToCString() << std::endl; } os << " Standard_EXPORT Standard_Integer CaseNum (const Handle(Standard_Transient)& ent) const Standard_OVERRIDE;" << std::endl; os << std::endl; - if(!seqMember->IsEmpty()) { + if(!seqMember->IsEmpty()) + { os << " //! Recognizes items of select member " << Name()->ToCString() << "Member" << std::endl; - for (Standard_Integer i = 1; i <= seqMember->Length(); i++) { + for (Standard_Integer i = 1; i <= seqMember->Length(); i++) + { Standard_Integer ind = seqMember->Value(i); os << " //! -- " << i << " -> " << myNames->Value(ind)->ToCString() << std::endl; } @@ -178,17 +192,20 @@ Standard_Boolean Express_Select::GenerateClass () const } // write methods get for entities - for (Standard_Integer i = 1; i <= seqEntities->Length(); i++) { + for (Standard_Integer i = 1; i <= seqEntities->Length(); i++) + { Standard_Integer ind = seqEntities->Value(i); Handle(Express_Item) item = myItems->Value(ind); Handle(TCollection_HAsciiString) name = item->Name(); os << " //! Returns Value as " << name->ToCString() << " (or Null if another type)" << std::endl; - os << " Standard_EXPORT Handle(" << item->CPPName()->ToCString() << ") " << name->ToCString() << "() const;" << std::endl; + os << " Standard_EXPORT Handle(" << item->CPPName()->ToCString() << ") " << + name->ToCString() << "() const;" << std::endl; os << std::endl; } // writes method set and get for enum , integer, real and string. - for (Standard_Integer i = 1; i <= seqMember->Length(); i++) { + for (Standard_Integer i = 1; i <= seqMember->Length(); i++) + { Standard_Integer ind = seqMember->Value(i); Handle(Express_Item) item = myItems->Value(ind); Handle(TCollection_HAsciiString) name = item->Name(); @@ -217,14 +234,15 @@ Standard_Boolean Express_Select::GenerateClass () const // write include section os << "#include <" << CPPname->ToCString() << ".hxx>" << std::endl; - if(!seqMember->IsEmpty()) { + if(!seqMember->IsEmpty()) + { os << "#include <" << CPPName()->ToCString() << "Member.hxx>"<< std::endl; os << "#include "<< std::endl; } - for (Standard_Integer i = 1; i <= seqEntities->Length(); i++) { + for (Standard_Integer i = 1; i <= seqEntities->Length(); i++) + { Standard_Integer ind = seqEntities->Value(i); - os << "#include <" << - myItems->Value(ind)->CPPName()->ToCString() << ".hxx>" << std::endl; + os << "#include <" << myItems->Value(ind)->CPPName()->ToCString() << ".hxx>" << std::endl; } // write constructor @@ -233,153 +251,193 @@ Standard_Boolean Express_Select::GenerateClass () const os << "{" << std::endl << "}" << std::endl; // write CaseNum method - Express::WriteMethodStamp ( os, new TCollection_HAsciiString ( "CaseNum" ) ); - os << "Standard_Integer " << CPPname->ToCString() << "::CaseNum (const Handle(Standard_Transient)& ent) const" << std::endl; + Express::WriteMethodStamp(os, new TCollection_HAsciiString("CaseNum")); + os << "Standard_Integer " << CPPname->ToCString() << + "::CaseNum (const Handle(Standard_Transient)& ent) const" << std::endl; os << "{" << std::endl; - if(!seqEntities->IsEmpty()) { + if(!seqEntities->IsEmpty()) + { os << " if (ent.IsNull()) return 0;" << std::endl; - for (Standard_Integer i=1; i <= seqEntities->Length(); i++ ) { + for (Standard_Integer i = 1; i <= seqEntities->Length(); i++) + { Standard_Integer ind = seqEntities->Value(i); - os << " if (ent->IsKind(STANDARD_TYPE(" << + os << " if (ent->IsKind(STANDARD_TYPE(" << myItems->Value(ind)->CPPName()->ToCString() << "))) return " << i << ";" << std::endl; } os << " return 0;\n}" << std::endl; } - else os << " return 0;\n}" << std::endl; + else + { + os << " return 0;\n}" << std::endl; + } - if(!seqMember->IsEmpty()) { //gka for AP209 + if (!seqMember->IsEmpty()) + { //gka for AP209 //write CaseMem method - Express::WriteMethodStamp ( os, new TCollection_HAsciiString ( "CaseMem" ) ); - os<<"Standard_Integer "<ToCString()<<"::CaseMem (const Handle(StepData_SelectMember)& ent) const"<< std::endl; - os<<"{"<< std::endl; - os<<" if(ent.IsNull()) return 0;"<< std::endl; + Express::WriteMethodStamp(os, new TCollection_HAsciiString("CaseMem")); + os << "Standard_Integer " << CPPname->ToCString() << + "::CaseMem (const Handle(StepData_SelectMember)& ent) const" << std::endl; + os << "{" << std::endl; + os << " if(ent.IsNull()) return 0;" << std::endl; //os<<" Handle("<< CPPName()->ToCString()<<"Member sm = Handle("<ToCString()<<"Member)::DownCast(ent);"<< std::endl; //os<<" if(sm.IsNull()) return 0;"<< std::endl; //os<<" Handle(TCollection_HAsciiString) name;"<< std::endl; - for( int j = 1; j<= seqMember->Length(); j++) { + for (int j = 1; j <= seqMember->Length(); j++) + { Standard_Integer ind = seqMember->Value(j); //os<<" name = new TCollection_HAsciiString(\""<Value(ind)->ToCString()<<"\");"<< std::endl; - if(j ==1) - os<<" if(ent->Matches(\""<Value(ind)->ToCString()<< "\")) return "<Matches(\""<Value(ind)->ToCString()<< "\")) return "<Matches(\"" << myNames->Value(ind)->ToCString() << "\")) return " << j << ";" << std::endl; + } + else + { + os << " else if(ent->Matches(\"" << myNames->Value(ind)->ToCString() << "\")) return " << j << ";" << std::endl; + } } - os<<" else return 0;"<< std::endl; - os<<"}"<< std::endl; - + os << " else return 0;" << std::endl; + os << "}" << std::endl; + //write NewMember method - Express::WriteMethodStamp ( os, new TCollection_HAsciiString ( "NewMember" ) ); - os<<"Handle(StepData_SelectMember) "<ToCString()<<"::NewMember() const"<< std::endl; - os<<"{"<< std::endl; - os<<" return new "<ToCString()<<"Member;"<< std::endl; - os<<"}"<< std::endl; - + Express::WriteMethodStamp(os, new TCollection_HAsciiString("NewMember")); + os << "Handle(StepData_SelectMember) " << CPPname->ToCString() << "::NewMember() const" << std::endl; + os << "{" << std::endl; + os << " return new " << CPPname->ToCString() << "Member;" << std::endl; + os << "}" << std::endl; } - // write methods Get for entities. - for (Standard_Integer i=1; i <= seqEntities->Length(); i++ ) { + for (Standard_Integer i = 1; i <= seqEntities->Length(); i++) + { Standard_Integer ind = seqEntities->Value(i); Handle(Express_Item) item = myItems->Value(ind); - Express::WriteMethodStamp ( os, item->Name() ); + Express::WriteMethodStamp(os, item->Name()); os << "Handle(" << item->CPPName()->ToCString() << ") " << CPPname->ToCString() << - "::" << item->Name()->ToCString() << " () const" << std::endl; + "::" << item->Name()->ToCString() << " () const" << std::endl; os << "{\n return Handle(" << item->CPPName()->ToCString() << ")::DownCast(Value());\n}" << std::endl; } //write methods Set and Get for Integer, Real, String and Enum - for (Standard_Integer i=1; i <= seqMember->Length(); i++ ) { + for (Standard_Integer i = 1; i <= seqMember->Length(); i++) + { Standard_Integer ind = seqMember->Value(i); Handle(Express_Item) item = myItems->Value(ind); Handle(TCollection_HAsciiString) stamp = new TCollection_HAsciiString("Set"); stamp->AssignCat(item->Name()); - Express::WriteMethodStamp ( os, stamp ); - - Standard_Boolean isString = (item->CPPName()->String().Location("HAsciiString",1,item->CPPName()->Length()) > 0); + Express::WriteMethodStamp(os, stamp); + + Standard_Boolean isString = (item->CPPName()->String().Location("HAsciiString", 1, item->CPPName()->Length()) > 0); Handle(TCollection_HAsciiString) nameFunc = new TCollection_HAsciiString; Handle(TCollection_HAsciiString) Func = new TCollection_HAsciiString; Standard_Boolean isEnum = item->IsKind(STANDARD_TYPE(Express_Enum)); - if(!isEnum) { - if(isString) + if (!isEnum) + { + if (isString) + { Func->AssignCat("String"); - else { + } + else + { nameFunc->AssignCat(item->CPPName()); Func = nameFunc; - Standard_Integer splitind = nameFunc->String().Location("_",1,item->CPPName()->Length()); - if(splitind) + Standard_Integer splitind = nameFunc->String().Location("_", 1, item->CPPName()->Length()); + if (splitind) + { Func = nameFunc->Split(splitind); + } } } - + //write method set - if(isString) { - os << "void "<ToCString() << - "::" << "Set"<Name()->ToCString() << " (const Handle("<CPPName()->ToCString() << ") &val)" << std::endl; + if (isString) + { + os << "void " << CPPname->ToCString() << "::" << "Set" << item->Name()->ToCString() << + " (const Handle(" << item->CPPName()->ToCString() << ") &val)" << std::endl; + } + else + { + os << "void " << CPPname->ToCString() << "::" << "Set" << item->Name()->ToCString() << + " (const " << item->CPPName()->ToCString() << " val)" << std::endl; } - else - os << "void "<ToCString() << - "::" << "Set"<Name()->ToCString() << " (const "<CPPName()->ToCString() << " val)" << std::endl; - os<<"{"<< std::endl; - - os<< " Handle("<ToCString()<<"Member) SelMem = Handle(" << CPPname->ToCString()<<"Member)::DownCast(Value());"<< std::endl; - os<<" if(SelMem.IsNull()) return;"<< std::endl; - os<<" Handle(TCollection_HAsciiString) name = new TCollection_HAsciiString(\""<Name()->ToCString()<<"\");"<< std::endl; - os<<" SelMem->SetName(name->ToCString());"<< std::endl; - if(isEnum) - os<<" SelMem->SetEnum((Standard_Integer)val);"<< std::endl; - else if(isString) - os<<" SelMem->Set"<ToCString()<<"(val->ToCString());"<< std::endl; - else - os<<" SelMem->Set"<ToCString()<<"(val);"<< std::endl; - - os<<"}"<< std::endl; - + os << "{" << std::endl; + os << " Handle(" << CPPname->ToCString() << "Member) SelMem = Handle(" << + CPPname->ToCString() << "Member)::DownCast(Value());" << std::endl; + os << " if(SelMem.IsNull()) return;" << std::endl; + os << " Handle(TCollection_HAsciiString) name = new TCollection_HAsciiString(\"" << + item->Name()->ToCString() << "\");" << std::endl; + os << " SelMem->SetName(name->ToCString());" << std::endl; + if (isEnum) + { + os << " SelMem->SetEnum((Standard_Integer)val);" << std::endl; + } + else if (isString) + { + os << " SelMem->Set" << Func->ToCString() << "(val->ToCString());" << std::endl; + } + else + { + os << " SelMem->Set" << Func->ToCString() << "(val);" << std::endl; + } + os << "}" << std::endl; + //write method get - Express::WriteMethodStamp ( os, item->Name() ); - if(isString) - os << "Handle("<CPPName()->ToCString() << ") "<ToCString() << - "::" << item->Name()->ToCString() << " () const" << std::endl; - else - os << item->CPPName()->ToCString() << " "<ToCString() << - "::" << item->Name()->ToCString() << " () const" << std::endl; - - os<<"{"<< std::endl; - os<< " Handle("<ToCString()<<"Member) SelMem = Handle(" << CPPname->ToCString()<<"Member)::DownCast(Value());"<< std::endl; - os<<" if(SelMem.IsNull()) return 0;"<< std::endl; - os<<" Handle(TCollection_HAsciiString) name = new TCollection_HAsciiString;"<< std::endl; - os<<" name->AssignCat(SelMem->Name());"<< std::endl; - os<<" Handle(TCollection_HAsciiString) nameitem = new TCollection_HAsciiString(\""<Name()->ToCString()<<"\");"<< std::endl; - os<<" if(name->IsDifferent(nameitem)) return 0;"<< std::endl; - if(isEnum) { + Express::WriteMethodStamp(os, item->Name()); + if (isString) + { + os << "Handle(" << item->CPPName()->ToCString() << ") " << CPPname->ToCString() << + "::" << item->Name()->ToCString() << " () const" << std::endl; + } + else + { + os << item->CPPName()->ToCString() << " " << CPPname->ToCString() << + "::" << item->Name()->ToCString() << " () const" << std::endl; + } + + os << "{" << std::endl; + os << " Handle(" << CPPname->ToCString() << "Member) SelMem = Handle(" << CPPname->ToCString() << + "Member)::DownCast(Value());" << std::endl; + os << " if(SelMem.IsNull()) return 0;" << std::endl; + os << " Handle(TCollection_HAsciiString) name = new TCollection_HAsciiString;" << std::endl; + os << " name->AssignCat(SelMem->Name());" << std::endl; + os << " Handle(TCollection_HAsciiString) nameitem = new TCollection_HAsciiString(\"" << + item->Name()->ToCString() << "\");" << std::endl; + os << " if(name->IsDifferent(nameitem)) return 0;" << std::endl; + if (isEnum) + { //nameFunc.AssignCat(item->Name()->ToCString()); - os<<" Standard_Integer numit = SelMem->Enum();"<< std::endl; - os<<" "<CPPName()->ToCString()<<" val;"<< std::endl; - os<<" switch(numit) {"<< std::endl; + os << " Standard_Integer numit = SelMem->Enum();" << std::endl; + os << " " << item->CPPName()->ToCString() << " val;" << std::endl; + os << " switch(numit) {" << std::endl; Handle(Express_Enum) Enum = Handle(Express_Enum)::DownCast(item); - Handle(TColStd_HSequenceOfHAsciiString) enitems = Enum->Names(); + Handle(TColStd_HSequenceOfHAsciiString) enitems = Enum->Names(); Handle(TCollection_HAsciiString) prefix = Express::EnumPrefix(item->Name()); - for(Standard_Integer k = 1; k <= enitems->Length(); k++) - os<<" case "<ToCString()<Value(k)->ToCString()<<"; break;"<< std::endl; - os<<" default : return 0;break;"<< std::endl; - os<<" }"<< std::endl; + for (Standard_Integer k = 1; k <= enitems->Length(); k++) + { + os << " case " << k << " : val = " << item->Name()->ToCString() << "_" << prefix->ToCString() << + enitems->Value(k)->ToCString() << "; break;" << std::endl; + } + os << " default : return 0;break;" << std::endl; + os << " }" << std::endl; } - else if(isString) { - os<<" Handle(TCollection_HAsciiString) val = new TCollection_HAsciiString;"<< std::endl; - os<<" val->AssignCat(SelMem->String());"<< std::endl; + else if (isString) + { + os << " Handle(TCollection_HAsciiString) val = new TCollection_HAsciiString;" << std::endl; + os << " val->AssignCat(SelMem->String());" << std::endl; } - - else - os<<" "<CPPName()->ToCString()<<" val = SelMem->"<ToCString()<<"();"<< std::endl; - - - os<<" return val;"<< std::endl; - os<<"}"<< std::endl; - + else + { + os << " " << item->CPPName()->ToCString() << " val = SelMem->" << Func->ToCString() << "();" << std::endl; + } + + os << " return val;" << std::endl; + os << "}" << std::endl; + } // close CXX os.close(); - + return Standard_True; } //======================================================================= @@ -432,12 +490,12 @@ Standard_Boolean Express_Select::GenerateClass () const os << "class " << CPPname->ToCString() << " : public StepData_SelectNamed" << std::endl; os << "{" << std::endl; os << "public:" << std::endl; - - // write methods + + // write methods os << " //! Empty constructor" << std::endl; os << " Standard_EXPORT " << CPPname->ToCString() << "();" << std::endl; os << std::endl; - + os << " //! Returns True if has name" << std::endl; os << " Standard_EXPORT virtual Standard_Boolean HasName() const Standard_OVERRIDE;" << std::endl; os << std::endl; @@ -445,15 +503,17 @@ Standard_Boolean Express_Select::GenerateClass () const os << " Standard_EXPORT virtual Standard_CString Name() const Standard_OVERRIDE;" << std::endl; os << std::endl; os << " //! Set name" << std::endl; - os << " Standard_EXPORT virtual Standard_Boolean SetName(const Standard_CString name) Standard_OVERRIDE;" << std::endl; + os << " Standard_EXPORT virtual Standard_Boolean SetName(const Standard_CString name) Standard_OVERRIDE;" + << std::endl; os << std::endl; os << " //! Tells if the name of a SelectMember matches a given one;" << std::endl; - os << " Standard_EXPORT virtual Standard_Boolean Matches(const Standard_CString name) const Standard_OVERRIDE;" << std::endl; + os << " Standard_EXPORT virtual Standard_Boolean Matches(const Standard_CString name) const Standard_OVERRIDE;" + << std::endl; os << std::endl; //write fields - os <<"private:"<< std::endl; - os << " Standard_Integer myCase;"<< std::endl<< std::endl; + os << "private:" << std::endl; + os << " Standard_Integer myCase;" << std::endl << std::endl; // write end os << "};" << std::endl; os << "#endif // _" << CPPname->ToCString() << "_HeaderFile" << std::endl; @@ -462,101 +522,117 @@ Standard_Boolean Express_Select::GenerateClass () const //=============================== // Step 2: generating CXX // Open CXX file - os.open ( pack.Cat ( ".cxx" ).ToCString() ); + os.open(pack.Cat(".cxx").ToCString()); // write header - Express::WriteFileStamp ( os ); + Express::WriteFileStamp(os); // write include section os << "#include <" << CPPname->ToCString() << ".hxx>" << std::endl; - os << "#include "<< std::endl; + os << "#include " << std::endl; // write constructor - Express::WriteMethodStamp ( os, CPPname ); + Express::WriteMethodStamp(os, CPPname); os << CPPname->ToCString() << "::" << CPPname->ToCString() << " () : myCase(0) " << std::endl; os << "{" << std::endl << "}" << std::endl; - + //write method HasName - Express::WriteMethodStamp ( os, new TCollection_HAsciiString ("HasName") ); - os<<"Standard_Boolean "<ToCString()<<"::HasName() const"<< std::endl; + Express::WriteMethodStamp(os, new TCollection_HAsciiString("HasName")); + os << "Standard_Boolean " << CPPname->ToCString() << "::HasName() const" << std::endl; os << "{" << std::endl; - os<< " return myCase > 0;"<< std::endl; - os<< "}" << std::endl; - + os << " return myCase > 0;" << std::endl; + os << "}" << std::endl; + Standard_Boolean hasEnum = Standard_False; //write method Name - Express::WriteMethodStamp ( os, new TCollection_HAsciiString ("Name") ); - os<<"Standard_CString "<ToCString()<<"::Name() const"<< std::endl; + Express::WriteMethodStamp(os, new TCollection_HAsciiString("Name")); + os << "Standard_CString " << CPPname->ToCString() << "::Name() const" << std::endl; os << "{" << std::endl; - os << " Handle(TCollection_HAsciiString) aName = new TCollection_HAsciiString;"<< std::endl; - os << " switch(myCase) {"<< std::endl; + os << " Handle(TCollection_HAsciiString) aName = new TCollection_HAsciiString;" << std::endl; + os << " switch(myCase) {" << std::endl; Standard_Integer i = 1; - for( i = 1; i <= seqMember->Length(); i++) { + for (i = 1; i <= seqMember->Length(); i++) + { Standard_Integer ind = seqMember->Value(i); Handle(Express_Item) item = myItems->Value(ind); - if(item->IsKind(STANDARD_TYPE(Express_Enum))) + if (item->IsKind(STANDARD_TYPE(Express_Enum))) + { hasEnum = Standard_True; - os << " case "<AssignCat(\""<Value(ind)->ToCString()<<"\"); break;"<< std::endl; + } + os << " case " << i << " : aName->AssignCat(\"" << myNames->Value(ind)->ToCString() << "\"); break;" << std::endl; } - os << " default : break;"<< std::endl; - os<<" }"<< std::endl; - os<<" return aName->ToCString();"<< std::endl; - os<< "}" << std::endl; - + os << " default : break;" << std::endl; + os << " }" << std::endl; + os << " return aName->ToCString();" << std::endl; + os << "}" << std::endl; + //write static method for compare name - Express::WriteMethodStamp ( os, new TCollection_HAsciiString ("CompareNames") ); - os<<"static Standard_Integer CompareNames(const Standard_CString name"; - if(hasEnum) - os<<",Standard_Integer &numen) "<< std::endl; + Express::WriteMethodStamp(os, new TCollection_HAsciiString("CompareNames")); + os << "static Standard_Integer CompareNames(const Standard_CString name"; + if (hasEnum) + { + os << ",Standard_Integer &numen) " << std::endl; + } else - os<<")"<< std::endl; + { + os << ")" << std::endl; + } os << "{" << std::endl; - os << " Standard_Integer thecase = 0;"<< std::endl; - os << " if (!name || name[0] == \'/0\') thecase = 0;"<< std::endl; - for( i = 1; i <= seqMember->Length(); i++) { + os << " Standard_Integer thecase = 0;" << std::endl; + os << " if (!name || name[0] == \'/0\') thecase = 0;" << std::endl; + for (i = 1; i <= seqMember->Length(); i++) + { Standard_Integer ind = seqMember->Value(i); Handle(Express_Item) item = myItems->Value(ind); - if(item->IsKind(STANDARD_TYPE(Express_Enum))) { + if (item->IsKind(STANDARD_TYPE(Express_Enum))) + { Handle(Express_Enum) en = Handle(Express_Enum)::DownCast(item); - for(Standard_Integer k =1 ; k <= en->Names()->Length();k++) { - os<<" else if(!strcmp (name,\""<Names()->Value(k)->ToCString()<<"\")) { "<< std::endl; - os<<" thecase = "<Names()->Length(); k++) + { + os << " else if(!strcmp (name,\"" << en->Names()->Value(k)->ToCString() << "\")) { " << std::endl; + os << " thecase = " << i << ";" << std::endl; + os << " numen = " << k << ";" << std::endl; + os << " }" << std::endl; } } else - os<<" else if(!strcmp (name,\""<Value(ind)->ToCString()<<"\")) thecase = "<Value(ind)->ToCString() << "\")) thecase = " << i << ";" << std::endl; + } } - os << " return thecase;"<< std::endl; + os << " return thecase;" << std::endl; os << "}" << std::endl; - + //write method SetName - Express::WriteMethodStamp ( os, new TCollection_HAsciiString ("SetName") ); - os<<"Standard_Boolean "<ToCString()<<"::SetName(const Standard_CString name) "<< std::endl; + Express::WriteMethodStamp(os, new TCollection_HAsciiString("SetName")); + os << "Standard_Boolean " << CPPname->ToCString() << "::SetName(const Standard_CString name) " << std::endl; os << "{" << std::endl; - if(hasEnum) { - os << " Standard_Integer numit = 0;"<< std::endl; - os << " myCase = CompareNames(name,numit);"<< std::endl; - - os << " if (numit) SetInteger(numit);"<< std::endl; + if (hasEnum) + { + os << " Standard_Integer numit = 0;" << std::endl; + os << " myCase = CompareNames(name,numit);" << std::endl; + os << " if (numit) SetInteger(numit);" << std::endl; } else - os << " myCase = CompareNames(name);"<< std::endl; - os << " return (myCase >0);"<< std::endl; - - os<< "}" << std::endl; + { + os << " myCase = CompareNames(name);" << std::endl; + } + os << " return (myCase >0);" << std::endl; + os << "}" << std::endl; + //write method Matches - Express::WriteMethodStamp ( os, new TCollection_HAsciiString ("Matches") ); - os<<"Standard_Boolean "<ToCString()<<"::Matches(const Standard_CString name) const"<< std::endl; + Express::WriteMethodStamp(os, new TCollection_HAsciiString("Matches")); + os << "Standard_Boolean " << CPPname->ToCString() << "::Matches(const Standard_CString name) const" << std::endl; os << "{" << std::endl; - if(hasEnum) { - os << " Standard_Integer numit = 0;"<< std::endl; - os<< " Standard_Integer thecase = CompareNames(name,numit);"<< std::endl; + if (hasEnum) + { + os << " Standard_Integer numit = 0;" << std::endl; + os << " Standard_Integer thecase = CompareNames(name,numit);" << std::endl; } else - os<< " Standard_Integer thecase = CompareNames(name);"<< std::endl; - os << " return (thecase > 0);"<< std::endl; + { + os << " Standard_Integer thecase = CompareNames(name);" << std::endl; + } + os << " return (thecase > 0);" << std::endl; os << "}" << std::endl; return Standard_True; -} + } diff --git a/src/Express/Express_Select.hxx b/src/Express/Express_Select.hxx index 3113c13694..da8878715e 100644 --- a/src/Express/Express_Select.hxx +++ b/src/Express/Express_Select.hxx @@ -30,7 +30,6 @@ class Express_Select : public Express_Item { public: - //! Create SELECT item and initialize it Standard_EXPORT Express_Select(const Standard_CString name, const Handle(TColStd_HSequenceOfHAsciiString)& names); @@ -44,31 +43,17 @@ public: //! Create HXX/CXX files from item Standard_EXPORT virtual Standard_Boolean GenerateClass() const Standard_OVERRIDE; - - - DEFINE_STANDARD_RTTIEXT(Express_Select,Express_Item) protected: - - - private: - Standard_EXPORT Standard_Boolean GenerateSelectMember (const Handle(TColStd_HSequenceOfInteger)& seqMember) const; Handle(TColStd_HSequenceOfHAsciiString) myNames; Handle(Express_HSequenceOfItem) myItems; - }; - - - - - - #endif // _Express_Select_HeaderFile diff --git a/src/Express/Express_SequenceOfEntity.hxx b/src/Express/Express_SequenceOfEntity.hxx index 42e4d71721..621e6dd1a1 100644 --- a/src/Express/Express_SequenceOfEntity.hxx +++ b/src/Express/Express_SequenceOfEntity.hxx @@ -19,5 +19,4 @@ typedef NCollection_Sequence Express_SequenceOfEntity; - #endif diff --git a/src/Express/Express_SequenceOfField.hxx b/src/Express/Express_SequenceOfField.hxx index 69e67a9f46..77f6150585 100644 --- a/src/Express/Express_SequenceOfField.hxx +++ b/src/Express/Express_SequenceOfField.hxx @@ -19,5 +19,4 @@ typedef NCollection_Sequence Express_SequenceOfField; - #endif diff --git a/src/Express/Express_SequenceOfItem.hxx b/src/Express/Express_SequenceOfItem.hxx index 66ad4d515b..4ab9afd9ea 100644 --- a/src/Express/Express_SequenceOfItem.hxx +++ b/src/Express/Express_SequenceOfItem.hxx @@ -19,5 +19,4 @@ typedef NCollection_Sequence Express_SequenceOfItem; - #endif diff --git a/src/Express/Express_String.hxx b/src/Express/Express_String.hxx index 09c2af920e..55be6b9b2c 100644 --- a/src/Express/Express_String.hxx +++ b/src/Express/Express_String.hxx @@ -15,19 +15,15 @@ #define _Express_String_HeaderFile #include - #include - class TCollection_HAsciiString; - //! Implements EXPRESS type 'STRING' class Express_String : public Express_PredefinedType { public: - //! Empty constructor Standard_EXPORT Express_String(); @@ -37,27 +33,12 @@ public: //! Returns False Standard_EXPORT virtual Standard_Boolean IsStandard() const Standard_OVERRIDE; - - - DEFINE_STANDARD_RTTIEXT(Express_String,Express_PredefinedType) protected: - - - private: - - - }; - - - - - - #endif // _Express_String_HeaderFile diff --git a/src/Express/Express_Type.cxx b/src/Express/Express_Type.cxx index 77a7db8da1..f7b37ea475 100644 --- a/src/Express/Express_Type.cxx +++ b/src/Express/Express_Type.cxx @@ -61,8 +61,9 @@ Standard_Boolean Express_Type::IsHandle () const //purpose : //======================================================================= -Standard_Boolean Express_Type::Use (const Handle(TCollection_HAsciiString) &, - const Standard_Boolean ) const +Standard_Boolean Express_Type::Use( + const Handle(TCollection_HAsciiString) &, + const Standard_Boolean ) const { return Standard_False; } diff --git a/src/Express/Express_Type.hxx b/src/Express/Express_Type.hxx index 2268d0e386..0053edb45d 100644 --- a/src/Express/Express_Type.hxx +++ b/src/Express/Express_Type.hxx @@ -24,7 +24,6 @@ class Express_Type : public Standard_Transient { public: - //! Returns CPP-style name of the type Standard_EXPORT virtual Handle(TCollection_HAsciiString) CPPName() const = 0; @@ -43,32 +42,19 @@ public: //! Declares type as used by some item being generated. //! Calls Use() for all referred types and schema items. //! Default instantiation does nothing - Standard_EXPORT virtual Standard_Boolean Use (const Handle(TCollection_HAsciiString)& pack, const Standard_Boolean defer = Standard_False) const; - - - + Standard_EXPORT virtual Standard_Boolean Use( + const Handle(TCollection_HAsciiString)& pack, + const Standard_Boolean defer = Standard_False) const; DEFINE_STANDARD_RTTIEXT(Express_Type,Standard_Transient) protected: - //! Empty constructor Standard_EXPORT Express_Type(); - - private: - - - }; - - - - - - #endif // _Express_Type_HeaderFile -- 2.39.5