1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

Coding - Apply .clang-format formatting #286

Update empty method guards to new style with regex (see PR).
Used clang-format 18.1.8.
New actions to validate code formatting is added.
Update .clang-format with disabling of include sorting.
  It is temporary changes, then include will be sorted.
Apply formatting for /src and /tools folder.
The files with .hxx,.cxx,.lxx,.h,.pxx,.hpp,*.cpp extensions.
This commit is contained in:
dpasukhi
2025-01-25 20:15:22 +00:00
parent dbba6f1289
commit a5a7b3185b
14005 changed files with 1273539 additions and 1195567 deletions

View File

@@ -21,10 +21,7 @@
#include <Quantity_Date.hxx>
#include <TCollection_AsciiString.hxx>
//=======================================================================
// function : Schema
// purpose :
//=======================================================================
//=================================================================================================
Handle(Express_Schema)& Express::Schema()
{
@@ -37,13 +34,13 @@ Handle(Express_Schema)& Express::Schema()
// purpose : Write header of HXX or CXX file
//=======================================================================
void Express::WriteFileStamp (Standard_OStream& theOS)
void Express::WriteFileStamp(Standard_OStream& theOS)
{
static const char* EC_VERSION = "2.0";
OSD_Process aProcess;
Quantity_Date aCurTime = aProcess.SystemDate();
OSD_Environment anEnv ("EXPTOCAS_TIME");
OSD_Process aProcess;
Quantity_Date aCurTime = aProcess.SystemDate();
OSD_Environment anEnv("EXPTOCAS_TIME");
TCollection_AsciiString aTimeString = anEnv.Value();
if (aTimeString.IsEmpty())
{
@@ -54,10 +51,17 @@ void Express::WriteFileStamp (Standard_OStream& theOS)
aTimeString += aCurTime.Day();
}
theOS << "// Created on : " << aTimeString << "\n"
"// Created by: " << aProcess.UserName() << "\n"
"// Generator: ExpToCasExe (EXPRESS -> CASCADE/XSTEP Translator) V" << EC_VERSION << "\n"
"// Copyright (c) Open CASCADE " << aCurTime.Year() << "\n"
theOS << "// Created on : " << aTimeString
<< "\n"
"// Created by: "
<< aProcess.UserName()
<< "\n"
"// Generator: ExpToCasExe (EXPRESS -> CASCADE/XSTEP Translator) V"
<< EC_VERSION
<< "\n"
"// Copyright (c) Open CASCADE "
<< aCurTime.Year()
<< "\n"
"//\n"
"// This file is part of Open CASCADE Technology software library.\n"
"//\n"
@@ -72,34 +76,30 @@ void Express::WriteFileStamp (Standard_OStream& theOS)
"\n";
}
//=======================================================================
// function : WriteMethodStamp
// purpose :
//=======================================================================
//=================================================================================================
void Express::WriteMethodStamp (Standard_OStream& theOS, const TCollection_AsciiString& theName)
void Express::WriteMethodStamp(Standard_OStream& theOS, const TCollection_AsciiString& theName)
{
theOS << "\n"
"//=======================================================================\n"
"// function : " << theName << "\n"
"// function : "
<< theName
<< "\n"
"// purpose :\n"
"//=======================================================================\n"
"\n";
}
//=======================================================================
// function : ToStepName
// purpose :
//=======================================================================
//=================================================================================================
TCollection_AsciiString Express::ToStepName (const TCollection_AsciiString& theName)
TCollection_AsciiString Express::ToStepName(const TCollection_AsciiString& theName)
{
TCollection_AsciiString aStepName(theName);
for (Standard_Integer i = 2; i <= aStepName.Length(); i++)
{
if (isupper (aStepName.Value (i)))
if (isupper(aStepName.Value(i)))
{
aStepName.Insert (i++, '_');
aStepName.Insert(i++, '_');
}
}
aStepName.LowerCase();
@@ -107,23 +107,19 @@ TCollection_AsciiString Express::ToStepName (const TCollection_AsciiString& theN
return aStepName;
}
//=======================================================================
// function : GetPrefixEnum
// purpose :
//=======================================================================
//=================================================================================================
TCollection_AsciiString Express::EnumPrefix (const TCollection_AsciiString& theName)
TCollection_AsciiString Express::EnumPrefix(const TCollection_AsciiString& theName)
{
TCollection_AsciiString aStepName;
for (Standard_Integer i = 1; i <= theName.Length(); i++)
{
if (isupper (theName.Value (i)))
if (isupper(theName.Value(i)))
{
aStepName += theName.Value (i);
aStepName += theName.Value(i);
}
}
aStepName.LowerCase();
return aStepName;
}

View File

@@ -28,25 +28,25 @@ class TCollection_AsciiString;
class Express
{
public:
DEFINE_STANDARD_ALLOC
//! Returns (modifiable) handle to static schema object
Standard_EXPORT static Handle(Express_Schema)& Schema();
//! Writes standard copyright stamp (creation date/time, user, etc.)
Standard_EXPORT static void WriteFileStamp (Standard_OStream& theOS);
Standard_EXPORT static void WriteFileStamp(Standard_OStream& theOS);
//! Writes standard comment for method in CXX file
Standard_EXPORT static void WriteMethodStamp (Standard_OStream& theOS, const TCollection_AsciiString& theName);
Standard_EXPORT static void WriteMethodStamp(Standard_OStream& theOS,
const TCollection_AsciiString& theName);
//! Converts item name from CASCADE to STEP style
//! e.g. BoundedCurve -> bounded_curve
Standard_EXPORT static TCollection_AsciiString ToStepName (const TCollection_AsciiString& theName);
Standard_EXPORT static TCollection_AsciiString ToStepName(const TCollection_AsciiString& theName);
//! Converts item name from CASCADE to STEP style
//! e.g. BoundedCurve -> bounded_curve
Standard_EXPORT static TCollection_AsciiString EnumPrefix (const TCollection_AsciiString& theName);
Standard_EXPORT static TCollection_AsciiString EnumPrefix(const TCollection_AsciiString& theName);
};
#endif // _Express_HeaderFile

View File

@@ -20,52 +20,37 @@
IMPLEMENT_STANDARD_RTTIEXT(Express_Alias, Express_Item)
//=======================================================================
// function : Express_Alias
// purpose :
//=======================================================================
//=================================================================================================
Express_Alias::Express_Alias (const Standard_CString theName, const Handle(Express_Type)& theType)
: Express_Item (theName), myType (theType)
Express_Alias::Express_Alias(const Standard_CString theName, const Handle(Express_Type)& theType)
: Express_Item(theName),
myType(theType)
{
}
//=======================================================================
// function : Type
// purpose :
//=======================================================================
//=================================================================================================
const Handle(Express_Type)& Express_Alias::Type() const
{
return myType;
}
//=======================================================================
// function : CPPName
// purpose :
//=======================================================================
//=================================================================================================
const TCollection_AsciiString Express_Alias::CPPName() const
{
return myType->CPPName();
}
//=======================================================================
// function : GenerateClass
// purpose :
//=======================================================================
//=================================================================================================
Standard_Boolean Express_Alias::GenerateClass() const
{
Message::SendInfo() << "ALIAS " << Name() << " = " << Type()->CPPName() << " used; no generation is needed";
Message::SendInfo() << "ALIAS " << Name() << " = " << Type()->CPPName()
<< " used; no generation is needed";
return Standard_False;
}
//=======================================================================
// function : PropagateUse
// purpose :
//=======================================================================
//=================================================================================================
void Express_Alias::PropagateUse() const
{
}
void Express_Alias::PropagateUse() const {}

View File

@@ -26,9 +26,9 @@ class Express_Alias : public Express_Item
{
public:
//! Create ALIAS item and initialize it
Standard_EXPORT Express_Alias (const Standard_CString theName, const Handle(Express_Type)& theType);
Standard_EXPORT Express_Alias(const Standard_CString theName,
const Handle(Express_Type)& theType);
//! Returns aliased type
Standard_EXPORT const Handle(Express_Type)& Type() const;
@@ -45,11 +45,8 @@ public:
DEFINE_STANDARD_RTTIEXT(Express_Alias, Express_Item)
protected:
private:
Handle(Express_Type) myType;
};
#endif // _Express_Alias_HeaderFile

View File

@@ -19,19 +19,11 @@
IMPLEMENT_STANDARD_RTTIEXT(Express_Boolean, Express_PredefinedType)
//=======================================================================
// function : Express_Boolean
// purpose :
//=======================================================================
//=================================================================================================
Express_Boolean::Express_Boolean()
{
}
Express_Boolean::Express_Boolean() {}
//=======================================================================
// function : CPPName
// purpose :
//=======================================================================
//=================================================================================================
const TCollection_AsciiString Express_Boolean::CPPName() const
{

View File

@@ -24,7 +24,6 @@ class Express_Boolean : public Express_PredefinedType
{
public:
//! Empty constructor
Standard_EXPORT Express_Boolean();
@@ -34,9 +33,7 @@ public:
DEFINE_STANDARD_RTTIEXT(Express_Boolean, Express_PredefinedType)
protected:
private:
};
#endif // _Express_Boolean_HeaderFile

View File

@@ -19,58 +19,49 @@
IMPLEMENT_STANDARD_RTTIEXT(Express_ComplexType, Express_Type)
//=======================================================================
// function : Express_ComplexType
// purpose :
//=======================================================================
//=================================================================================================
Express_ComplexType::Express_ComplexType (const Standard_Integer theImin,
const Standard_Integer theImax,
const Handle(Express_Type)& theType)
Express_ComplexType::Express_ComplexType(const Standard_Integer theImin,
const Standard_Integer theImax,
const Handle(Express_Type)& theType)
{
myMin = theImin;
myMax = theImax;
myMin = theImin;
myMax = theImax;
myType = theType;
}
//=======================================================================
// function : Type
// purpose :
//=======================================================================
//=================================================================================================
const Handle(Express_Type)& Express_ComplexType::Type() const
{
return myType;
}
//=======================================================================
// function : CPPName
// purpose :
//=======================================================================
//=================================================================================================
const TCollection_AsciiString Express_ComplexType::CPPName() const
{
// check if array 2
Handle(Express_Type) aType = myType;
if (aType->IsKind (STANDARD_TYPE(Express_ComplexType)))
if (aType->IsKind(STANDARD_TYPE(Express_ComplexType)))
{
Handle(Express_ComplexType) aType2 = Handle(Express_ComplexType)::DownCast (aType);
aType = aType2->Type();
Handle(Express_ComplexType) aType2 = Handle(Express_ComplexType)::DownCast(aType);
aType = aType2->Type();
}
// parse name of array argument
TCollection_AsciiString aName = aType->CPPName();
Standard_Integer aSplitIdx = aName.Location (1, '_', 1, aName.Length());
TCollection_AsciiString aName = aType->CPPName();
Standard_Integer aSplitIdx = aName.Location(1, '_', 1, aName.Length());
TCollection_AsciiString aClassName;
if (aSplitIdx)
{
aClassName = aName.Split (aSplitIdx);
aClassName = aName.Split(aSplitIdx);
}
else
{
aClassName = aName;
}
Standard_Integer anIdx = aName.Location ("TCollection", 1, aName.Length());
Standard_Integer anIdx = aName.Location("TCollection", 1, aName.Length());
if (anIdx)
{
aName = "Interface_";
@@ -93,22 +84,17 @@ const TCollection_AsciiString Express_ComplexType::CPPName() const
return aName;
}
//=======================================================================
// function : Use
// purpose :
//=======================================================================
//=================================================================================================
Standard_Boolean Express_ComplexType::Use() const
{
return myType->Use();
}
//=======================================================================
// function : Use2
// purpose :
//=======================================================================
//=================================================================================================
void Express_ComplexType::Use2 (const TCollection_AsciiString& theRefName, const TCollection_AsciiString& theRefPack) const
void Express_ComplexType::Use2(const TCollection_AsciiString& theRefName,
const TCollection_AsciiString& theRefPack) const
{
myType->Use2 (theRefName, theRefPack);
myType->Use2(theRefName, theRefPack);
}

View File

@@ -26,11 +26,10 @@ class Express_ComplexType : public Express_Type
{
public:
//! Creates an object and initializes fields
Standard_EXPORT Express_ComplexType (const Standard_Integer theImin,
const Standard_Integer theImax,
const Handle(Express_Type)& theType);
Standard_EXPORT Express_ComplexType(const Standard_Integer theImin,
const Standard_Integer theImax,
const Handle(Express_Type)& theType);
//! Returns type of complex type items
Standard_EXPORT const Handle(Express_Type)& Type() const;
@@ -44,18 +43,17 @@ public:
//! Declares type as used by some item being generated.
//! Calls Use() for type of elements
Standard_EXPORT virtual void Use2 (const TCollection_AsciiString& theRefName, const TCollection_AsciiString& theRefPack) const Standard_OVERRIDE;
Standard_EXPORT virtual void Use2(const TCollection_AsciiString& theRefName,
const TCollection_AsciiString& theRefPack) const
Standard_OVERRIDE;
DEFINE_STANDARD_RTTIEXT(Express_ComplexType, Express_Type)
protected:
private:
Standard_Integer myMin;
Standard_Integer myMax;
Standard_Integer myMin;
Standard_Integer myMax;
Handle(Express_Type) myType;
};
#endif // _Express_ComplexType_HeaderFile

View File

@@ -18,6 +18,7 @@
#include <NCollection_DataMap.hxx>
#include <TCollection_AsciiString.hxx>
typedef NCollection_DataMap<TCollection_AsciiString, Handle(Express_Item)> Express_DataMapOfAsciiStringItem;
typedef NCollection_DataMap<TCollection_AsciiString, Handle(Express_Item)>
Express_DataMapOfAsciiStringItem;
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -32,13 +32,12 @@ 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 correspondingly.
Standard_EXPORT Express_Entity (const Standard_CString theName,
const Handle(TColStd_HSequenceOfHAsciiString)& theInherit,
const Handle(Express_HSequenceOfField)& theFields);
Standard_EXPORT Express_Entity(const Standard_CString theName,
const Handle(TColStd_HSequenceOfHAsciiString)& theInherit,
const Handle(Express_HSequenceOfField)& theFields);
//! Returns sequence of inherited classes (names)
Standard_EXPORT const Handle(TColStd_HSequenceOfHAsciiString)& SuperTypes() const;
@@ -51,10 +50,11 @@ public:
//! Returns number of fields (only own fields if inherited is False
//! and including fields of all supertypes if it is True)
Standard_EXPORT Standard_Integer NbFields (const Standard_Boolean theInherited = Standard_False) const;
Standard_EXPORT Standard_Integer
NbFields(const Standard_Boolean theInherited = Standard_False) const;
//! Sets abstruct flag for entity;
Standard_EXPORT void SetAbstractFlag (const Standard_Boolean theIsAbstract);
Standard_EXPORT void SetAbstractFlag(const Standard_Boolean theIsAbstract);
//! Returns abstract flag.
Standard_EXPORT inline Standard_Boolean AbstractFlag() const;
@@ -62,9 +62,7 @@ public:
DEFINE_STANDARD_RTTIEXT(Express_Entity, Express_Item)
protected:
private:
typedef NCollection_DataMap<TCollection_AsciiString, Standard_Integer> DataMapOfStringInteger;
//! Create HXX/CXX files from item
@@ -74,22 +72,22 @@ private:
Standard_EXPORT virtual void PropagateUse() const Standard_OVERRIDE;
//! Writes includes section of HXX
Standard_EXPORT Standard_Boolean writeIncludes (Standard_OStream& theOS) const;
Standard_EXPORT Standard_Boolean writeIncludes(Standard_OStream& theOS) const;
//! Writes code for reading all fields
Standard_EXPORT Standard_Integer writeRWReadCode (Standard_OStream& theOS,
Standard_EXPORT Standard_Integer writeRWReadCode(Standard_OStream& theOS,
const Standard_Integer theStart,
const Standard_Integer theOwn) const;
//! Writes code for writing all fields
Standard_EXPORT Standard_Integer writeRWWriteCode(Standard_OStream& theOS,
const Standard_Integer theStart,
const Standard_Integer theOwn) const;
//! Writes code for writing all fields
Standard_EXPORT Standard_Integer writeRWWriteCode (Standard_OStream& theOS,
const Standard_Integer theStart,
const Standard_Integer theOwn) const;
//! Writes code for adding shared entities to the graph
Standard_EXPORT Standard_Integer writeRWShareCode (Standard_OStream& theOS,
const Standard_Integer theStart,
const Standard_Integer theOwn) const;
Standard_EXPORT Standard_Integer writeRWShareCode(Standard_OStream& theOS,
const Standard_Integer theStart,
const Standard_Integer theOwn) const;
//! Writes arguments and code for method Init()
//! Mode identifies what code is being written:
@@ -98,17 +96,16 @@ private:
//! 2 - call (argument list)
//! 3 - implementation
//! 4 - call (argument list for RW)
Standard_EXPORT Standard_Integer makeInit (Standard_OStream& theOS,
const Standard_Integer theShift,
const Standard_Integer theOwn,
const Standard_Integer theMode) const;
Standard_EXPORT Standard_Integer makeInit(Standard_OStream& theOS,
const Standard_Integer theShift,
const Standard_Integer theOwn,
const Standard_Integer theMode) const;
private:
Handle(TColStd_HSequenceOfHAsciiString) mySupers;
Handle(Express_HSequenceOfEntity) myInherit;
Handle(Express_HSequenceOfField) myFields;
Standard_Boolean myIsAbstract;
Handle(Express_HSequenceOfEntity) myInherit;
Handle(Express_HSequenceOfField) myFields;
Standard_Boolean myIsAbstract;
};
#endif // _Express_Entity_HeaderFile

View File

@@ -24,30 +24,23 @@
IMPLEMENT_STANDARD_RTTIEXT(Express_Enum, Express_Item)
//=======================================================================
// function : Express_Enum
// purpose :
//=======================================================================
//=================================================================================================
Express_Enum::Express_Enum (const Standard_CString theName, const Handle(TColStd_HSequenceOfHAsciiString)& theNames)
: Express_Item (theName), myNames (theNames)
Express_Enum::Express_Enum(const Standard_CString theName,
const Handle(TColStd_HSequenceOfHAsciiString)& theNames)
: Express_Item(theName),
myNames(theNames)
{
}
//=======================================================================
// function : Names
// purpose :
//=======================================================================
//=================================================================================================
const Handle(TColStd_HSequenceOfHAsciiString)& Express_Enum::Names() const
{
return myNames;
}
//=======================================================================
// function : GenerateClass
// purpose :
//=======================================================================
//=================================================================================================
Standard_Boolean Express_Enum::GenerateClass() const
{
@@ -55,53 +48,55 @@ Standard_Boolean Express_Enum::GenerateClass() const
Message::SendInfo() << "Generating ENUMERATION " << aCPPName;
// create a package directory (if not yet exist)
OSD_Protection aProt (OSD_RWXD, OSD_RWXD, OSD_RX, OSD_RX);
OSD_Protection aProt(OSD_RWXD, OSD_RWXD, OSD_RX, OSD_RX);
TCollection_AsciiString aPack = GetPackageName();
OSD_Path aPath (aPack);
OSD_Directory aDir (aPath);
aDir.Build (aProt);
OSD_Path aPath(aPack);
OSD_Directory aDir(aPath);
aDir.Build(aProt);
aPack += "/";
aPack += aCPPName;
const Handle(OSD_FileSystem)& aFileSystem = OSD_FileSystem::DefaultFileSystem();
// Open HXX file
std::shared_ptr<std::ostream> aStreamPtr = aFileSystem->OpenOStream (aPack.Cat (".hxx"), std::ios::out | std::ios::ate);
std::shared_ptr<std::ostream> aStreamPtr =
aFileSystem->OpenOStream(aPack.Cat(".hxx"), std::ios::out | std::ios::ate);
Standard_OStream& anOS = *aStreamPtr;
// write header
Express::WriteFileStamp (anOS);
Express::WriteFileStamp(anOS);
// write defines
anOS << "#ifndef _" << aCPPName << "_HeaderFile\n"
"#define _" << aCPPName << "_HeaderFile\n"
anOS << "#ifndef _" << aCPPName
<< "_HeaderFile\n"
"#define _"
<< aCPPName
<< "_HeaderFile\n"
"\n"
"enum " << aCPPName << "\n"
"enum "
<< aCPPName
<< "\n"
"{\n";
TCollection_AsciiString aPrefix = Express::EnumPrefix (Name());
TCollection_AsciiString aPrefix = Express::EnumPrefix(Name());
for (Standard_Integer i = 1; i <= myNames->Length(); i++)
{
if (i > 1)
{
anOS << ",\n";
}
anOS << " " << GetPackageName() << "_" << aPrefix << myNames->Value (i)->String();
anOS << " " << GetPackageName() << "_" << aPrefix << myNames->Value(i)->String();
}
anOS << "\n"
"};\n"
"\n"
"#endif // _" << aCPPName << "_HeaderFile\n";
"#endif // _"
<< aCPPName << "_HeaderFile\n";
aStreamPtr.reset();
return Standard_False;
}
//=======================================================================
// function : PropagateUse
// purpose :
//=======================================================================
//=================================================================================================
void Express_Enum::PropagateUse() const
{
}
void Express_Enum::PropagateUse() const {}

View File

@@ -24,9 +24,9 @@ class Express_Enum : public Express_Item
{
public:
//! Create ENUM item and initialize it
Standard_EXPORT Express_Enum (const Standard_CString theName, const Handle(TColStd_HSequenceOfHAsciiString)& theNames);
Standard_EXPORT Express_Enum(const Standard_CString theName,
const Handle(TColStd_HSequenceOfHAsciiString)& theNames);
//! Returns names of enumeration variants
Standard_EXPORT const Handle(TColStd_HSequenceOfHAsciiString)& Names() const;
@@ -40,11 +40,8 @@ public:
DEFINE_STANDARD_RTTIEXT(Express_Enum, Express_Item)
protected:
private:
Handle(TColStd_HSequenceOfHAsciiString) myNames;
};
#endif // _Express_Enum_HeaderFile

View File

@@ -20,68 +20,50 @@
IMPLEMENT_STANDARD_RTTIEXT(Express_Field, Standard_Transient)
//=======================================================================
// function : Express_Field
// purpose :
//=======================================================================
//=================================================================================================
Express_Field::Express_Field (const Standard_CString theName,
const Handle(Express_Type)& theType,
const Standard_Boolean theOpt)
Express_Field::Express_Field(const Standard_CString theName,
const Handle(Express_Type)& theType,
const Standard_Boolean theOpt)
{
myName = new TCollection_HAsciiString (theName);
myName = new TCollection_HAsciiString(theName);
myType = theType;
myOpt = theOpt;
myOpt = theOpt;
}
//=======================================================================
// function : Express_Field
// purpose :
//=======================================================================
//=================================================================================================
Express_Field::Express_Field (const Handle(TCollection_HAsciiString)& theName,
const Handle(Express_Type)& theType,
const Standard_Boolean theOpt)
Express_Field::Express_Field(const Handle(TCollection_HAsciiString)& theName,
const Handle(Express_Type)& theType,
const Standard_Boolean theOpt)
{
myName = theName;
myType = theType;
myOpt = theOpt;
myOpt = theOpt;
}
//=======================================================================
// function : Name
// purpose :
//=======================================================================
//=================================================================================================
const TCollection_AsciiString& Express_Field::Name() const
{
return myName->String();
}
//=======================================================================
// function : HName
// purpose :
//=======================================================================
//=================================================================================================
Handle(TCollection_HAsciiString) Express_Field::HName() const
{
return myName;
}
//=======================================================================
// function : Type
// purpose :
//=======================================================================
//=================================================================================================
const Handle(Express_Type)& Express_Field::Type() const
{
return myType;
}
//=======================================================================
// function : IsOptional
// purpose :
//=======================================================================
//=================================================================================================
Standard_Boolean Express_Field::IsOptional() const
{

View File

@@ -25,16 +25,15 @@ class Express_Field : public Standard_Transient
{
public:
//! Create object and initialize it
Standard_EXPORT Express_Field(const Standard_CString theName,
const Handle(Express_Type)& theType,
const Standard_Boolean theOpt);
//! Create object and initialize it
Standard_EXPORT Express_Field (const Standard_CString theName,
const Handle(Express_Type)& theType,
const Standard_Boolean theOpt);
//! Create object and initialize it
Standard_EXPORT Express_Field (const Handle(TCollection_HAsciiString)& theName,
const Handle(Express_Type)& theType,
const Standard_Boolean theOpt);
Standard_EXPORT Express_Field(const Handle(TCollection_HAsciiString)& theName,
const Handle(Express_Type)& theType,
const Standard_Boolean theOpt);
//! Returns field name
Standard_EXPORT const TCollection_AsciiString& Name() const;
@@ -51,13 +50,10 @@ public:
DEFINE_STANDARD_RTTIEXT(Express_Field, Standard_Transient)
protected:
private:
Handle(TCollection_HAsciiString) myName;
Handle(Express_Type) myType;
Standard_Boolean myOpt;
Handle(Express_Type) myType;
Standard_Boolean myOpt;
};
#endif // _Express_Field_HeaderFile

View File

@@ -19,19 +19,11 @@
IMPLEMENT_STANDARD_RTTIEXT(Express_Integer, Express_PredefinedType)
//=======================================================================
// function : Express_Integer
// purpose :
//=======================================================================
//=================================================================================================
Express_Integer::Express_Integer()
{
}
Express_Integer::Express_Integer() {}
//=======================================================================
// function : CPPName
// purpose :
//=======================================================================
//=================================================================================================
const TCollection_AsciiString Express_Integer::CPPName() const
{

View File

@@ -24,7 +24,6 @@ class Express_Integer : public Express_PredefinedType
{
public:
//! Empty constructor
Standard_EXPORT Express_Integer();
@@ -34,9 +33,7 @@ public:
DEFINE_STANDARD_RTTIEXT(Express_Integer, Express_PredefinedType)
protected:
private:
};
#endif // _Express_Integer_HeaderFile

View File

@@ -23,62 +23,47 @@ IMPLEMENT_STANDARD_RTTIEXT(Express_Item, Standard_Transient)
Standard_Integer Express_Item::myIndex = -1;
//=======================================================================
// function : Express_Item
// purpose :
//=======================================================================
//=================================================================================================
Express_Item::Express_Item (const Standard_CString theName)
Express_Item::Express_Item(const Standard_CString theName)
{
myName = new TCollection_HAsciiString (theName);
myGenMode = GM_Undefined;
myShortName = new TCollection_HAsciiString;
myCategory = new TCollection_HAsciiString;
myhasCheck = Standard_False;
myName = new TCollection_HAsciiString(theName);
myGenMode = GM_Undefined;
myShortName = new TCollection_HAsciiString;
myCategory = new TCollection_HAsciiString;
myhasCheck = Standard_False;
myhasFillShared = Standard_False;
myLoopFlag = Standard_False;
myLoopFlag = Standard_False;
}
//=======================================================================
// function : Express_Item
// purpose :
//=======================================================================
//=================================================================================================
Express_Item::Express_Item (const Handle(TCollection_HAsciiString)& theName)
Express_Item::Express_Item(const Handle(TCollection_HAsciiString)& theName)
{
myName = theName;
myGenMode = GM_Undefined;
myShortName = new TCollection_HAsciiString;
myCategory = new TCollection_HAsciiString;
myhasCheck = Standard_False;
myName = theName;
myGenMode = GM_Undefined;
myShortName = new TCollection_HAsciiString;
myCategory = new TCollection_HAsciiString;
myhasCheck = Standard_False;
myhasFillShared = Standard_False;
myLoopFlag = Standard_False;
myLoopFlag = Standard_False;
}
//=======================================================================
// function : Name
// purpose :
//=======================================================================
//=================================================================================================
const TCollection_AsciiString& Express_Item::Name() const
{
return myName->String();
}
//=======================================================================
// function : HName
// purpose :
//=======================================================================
//=================================================================================================
Handle(TCollection_HAsciiString) Express_Item::HName() const
{
return myName;
}
//=======================================================================
// function : CPPName
// purpose :
//=======================================================================
//=================================================================================================
const TCollection_AsciiString Express_Item::CPPName() const
{
@@ -88,45 +73,34 @@ const TCollection_AsciiString Express_Item::CPPName() const
return aName;
}
//=======================================================================
// function : SetPackageName
// purpose :
//=======================================================================
//=================================================================================================
void Express_Item::SetPackageName (const TCollection_AsciiString& thePack)
void Express_Item::SetPackageName(const TCollection_AsciiString& thePack)
{
myPack = new TCollection_HAsciiString(thePack);
}
//=======================================================================
// function : GetPackageName
// purpose :
//=======================================================================
//=================================================================================================
const TCollection_AsciiString& Express_Item::GetPackageName() const
{
if (myPack.IsNull())
{
Message::SendWarning() << "Warning: item " << Name() << " still has no package assigned, used " << GetUnknownPackageName();
Message::SendWarning() << "Warning: item " << Name() << " still has no package assigned, used "
<< GetUnknownPackageName();
return GetUnknownPackageName();
}
return myPack->String();
}
//=======================================================================
// function : IsPackageNameSet
// purpose :
//=======================================================================
//=================================================================================================
Standard_Boolean Express_Item::IsPackageNameSet() const
{
return !myPack.IsNull();
}
//=======================================================================
// function : GetUnknownPackageName
// purpose :
//=======================================================================
//=================================================================================================
TCollection_AsciiString& Express_Item::GetUnknownPackageName()
{
@@ -135,40 +109,28 @@ TCollection_AsciiString& Express_Item::GetUnknownPackageName()
return aUnknownPackageName;
}
//=======================================================================
// function : GetGenMode
// purpose :
//=======================================================================
//=================================================================================================
Express_Item::GenMode Express_Item::GetGenMode() const
{
return myGenMode;
}
//=======================================================================
// function : SetGenMode
// purpose :
//=======================================================================
//=================================================================================================
void Express_Item::SetGenMode (const Express_Item::GenMode theGenMode)
void Express_Item::SetGenMode(const Express_Item::GenMode theGenMode)
{
myGenMode = theGenMode;
}
//=======================================================================
// function : ResetLoopFlag
// purpose :
//=======================================================================
//=================================================================================================
void Express_Item::ResetLoopFlag()
{
myLoopFlag = Standard_False;
}
//=======================================================================
// function : Generate
// purpose :
//=======================================================================
//=================================================================================================
Standard_Boolean Express_Item::Generate()
{
@@ -186,17 +148,14 @@ Standard_Boolean Express_Item::Generate()
std::cout << " ";
}
// sets the mode to generated before "GenerateClass" function to avoid looping
SetGenMode (GM_Generated);
SetGenMode(GM_Generated);
Standard_Boolean aRes = GenerateClass();
aShift--;
return aRes;
}
//=======================================================================
// function : Use
// purpose :
//=======================================================================
//=================================================================================================
Standard_Boolean Express_Item::Use()
{
@@ -205,17 +164,15 @@ Standard_Boolean Express_Item::Use()
{
return Standard_False;
}
SetGenMode (GM_GenByAlgo);
SetGenMode(GM_GenByAlgo);
return Generate();
}
//=======================================================================
// function : Use2
// purpose :
//=======================================================================
//=================================================================================================
void Express_Item::Use2 (const TCollection_AsciiString& theRefName, const TCollection_AsciiString& theRefPack)
void Express_Item::Use2(const TCollection_AsciiString& theRefName,
const TCollection_AsciiString& theRefPack)
{
if (myLoopFlag)
{
@@ -228,106 +185,78 @@ void Express_Item::Use2 (const TCollection_AsciiString& theRefName, const TColle
// issue a warning message if item does not have package assigned
if (!IsPackageNameSet())
{
Message::SendWarning() << "Warning: item " << Name() << " has no package assigned but used by " << theRefName << ", setting " << theRefPack;
SetPackageName (theRefPack);
Message::SendWarning() << "Warning: item " << Name() << " has no package assigned but used by "
<< theRefName << ", setting " << theRefPack;
SetPackageName(theRefPack);
}
PropagateUse();
}
//=======================================================================
// function : SetCategory
// purpose :
//=======================================================================
//=================================================================================================
void Express_Item::SetCategory (const Handle(TCollection_HAsciiString)& theCateg)
void Express_Item::SetCategory(const Handle(TCollection_HAsciiString)& theCateg)
{
myCategory = theCateg;
}
//=======================================================================
// function : Cartegory
// purpose :
//=======================================================================
//=================================================================================================
const TCollection_AsciiString& Express_Item::Category() const
{
return myCategory->String();
}
//=======================================================================
// function : SetShortName
// purpose :
//=======================================================================
//=================================================================================================
void Express_Item::SetShortName (const Handle(TCollection_HAsciiString)& theShName)
void Express_Item::SetShortName(const Handle(TCollection_HAsciiString)& theShName)
{
myShortName = theShName;
}
//=======================================================================
// function : ShortName
// purpose :
//=======================================================================
//=================================================================================================
Handle(TCollection_HAsciiString) Express_Item::ShortName() const
{
return myShortName;
}
//=======================================================================
// function : SetCheckFlag
// purpose :
//=======================================================================
void Express_Item::SetCheckFlag (const Standard_Boolean theCheckFlag)
//=================================================================================================
void Express_Item::SetCheckFlag(const Standard_Boolean theCheckFlag)
{
myhasCheck = theCheckFlag;
}
//=======================================================================
// function : CheckFlag
// purpose :
//=======================================================================
//=================================================================================================
Standard_Boolean Express_Item::CheckFlag() const
{
return myhasCheck;
}
//=======================================================================
// function : SetFillSharedFlag
// purpose :
//=======================================================================
//=================================================================================================
void Express_Item::SetFillSharedFlag (const Standard_Boolean theFillSharedFlag)
void Express_Item::SetFillSharedFlag(const Standard_Boolean theFillSharedFlag)
{
myhasFillShared = theFillSharedFlag;
}
//=======================================================================
// function : FillSharedFlag
// purpose :
//=======================================================================
//=================================================================================================
Standard_Boolean Express_Item::FillSharedFlag() const
{
return myhasFillShared;
}
//=======================================================================
// function : SetIndex
// purpose :
//=======================================================================
//=================================================================================================
void Express_Item::SetIndex (const Standard_Integer theIndex)
void Express_Item::SetIndex(const Standard_Integer theIndex)
{
myIndex = theIndex;
}
//=======================================================================
// function : Index
// purpose :
//=======================================================================
//=================================================================================================
Standard_Integer Express_Item::Index()
{

View File

@@ -29,15 +29,15 @@ class TCollection_HAsciiString;
//! and CXX files.
class Express_Item : public Standard_Transient
{
public:
enum GenMode
{
GM_NoGen, // Item in existed list - no need to generate
GM_GenByUser, // Item in new list - need to generate
GM_GenByAlgo, // Item isn't in any list but is used by needed item
GM_Undefined, // Item isn't in any list
GM_Generated // Item has been generated
GM_NoGen, // Item in existed list - no need to generate
GM_GenByUser, // Item in new list - need to generate
GM_GenByAlgo, // Item isn't in any list but is used by needed item
GM_Undefined, // Item isn't in any list
GM_Generated // Item has been generated
};
//! Returns item name
@@ -60,13 +60,13 @@ public:
Standard_EXPORT static TCollection_AsciiString& GetUnknownPackageName();
//! Sets package name
Standard_EXPORT void SetPackageName (const TCollection_AsciiString& thePack);
Standard_EXPORT void SetPackageName(const TCollection_AsciiString& thePack);
//! Returns item generation mode
Standard_EXPORT GenMode GetGenMode() const;
//! Change generation mode for item
Standard_EXPORT void SetGenMode (const GenMode theGenMode);
Standard_EXPORT void SetGenMode(const GenMode theGenMode);
//! Reset loop flag
Standard_EXPORT void ResetLoopFlag();
@@ -88,34 +88,35 @@ public:
Standard_EXPORT Standard_Boolean Use();
//! Mark Item as visited in PropagateUse flow and defined the package name if not set.
Standard_EXPORT void Use2 (const TCollection_AsciiString& theRefName, const TCollection_AsciiString& theRefPack);
Standard_EXPORT void Use2(const TCollection_AsciiString& theRefName,
const TCollection_AsciiString& theRefPack);
//! Set category for item
Standard_EXPORT void SetCategory (const Handle(TCollection_HAsciiString)& theCateg);
Standard_EXPORT void SetCategory(const Handle(TCollection_HAsciiString)& theCateg);
//! Get item category
Standard_EXPORT const TCollection_AsciiString& Category() const;
//! Set short name for item
Standard_EXPORT void SetShortName (const Handle(TCollection_HAsciiString)& theShName);
Standard_EXPORT void SetShortName(const Handle(TCollection_HAsciiString)& theShName);
//! Get item short name
Standard_EXPORT Handle(TCollection_HAsciiString) ShortName() const;
//! Set flag for presence of method Check in the class
Standard_EXPORT void SetCheckFlag (const Standard_Boolean theCheckFlag);
Standard_EXPORT void SetCheckFlag(const Standard_Boolean theCheckFlag);
//! Get flag resposible for presence of method Check in the class
Standard_EXPORT Standard_Boolean CheckFlag() const;
//! Set flag for presence of method FillShared in the class
Standard_EXPORT void SetFillSharedFlag (const Standard_Boolean theFillSharedFlag);
Standard_EXPORT void SetFillSharedFlag(const Standard_Boolean theFillSharedFlag);
//! Get flag resposible for presence of method FillShared in the class
Standard_EXPORT Standard_Boolean FillSharedFlag() const;
//! Set start entity index
Standard_EXPORT static void SetIndex (const Standard_Integer theIndex);
Standard_EXPORT static void SetIndex(const Standard_Integer theIndex);
//! Get current entity index
Standard_EXPORT static Standard_Integer Index();
@@ -123,28 +124,26 @@ public:
DEFINE_STANDARD_RTTIEXT(Express_Item, Standard_Transient)
protected:
//! Creates object and initializes fields PackageName and
//! CreateFlag by 0
Standard_EXPORT Express_Item(const Standard_CString theName);
//! Creates object and initializes fields PackageName and
//! CreateFlag by 0
Standard_EXPORT Express_Item (const Standard_CString theName);
//! Creates object and initializes fields PackageName and
//! CreateFlag by 0
Standard_EXPORT Express_Item (const Handle(TCollection_HAsciiString)& theName);
Standard_EXPORT Express_Item(const Handle(TCollection_HAsciiString)& theName);
private:
Handle(TCollection_HAsciiString) myName;
Handle(TCollection_HAsciiString) myPack;
// "Generate" mark. If is TRUE a class will be generated for the item
GenMode myGenMode;
// Flag to avoid looping
Standard_Boolean myLoopFlag;
Standard_Boolean myLoopFlag;
Handle(TCollection_HAsciiString) myShortName;
Handle(TCollection_HAsciiString) myCategory;
Standard_Boolean myhasCheck;
Standard_Boolean myhasFillShared;
static Standard_Integer myIndex;
Standard_Boolean myhasCheck;
Standard_Boolean myhasFillShared;
static Standard_Integer myIndex;
};
#endif // _Express_Item_HeaderFile

View File

@@ -19,52 +19,34 @@
IMPLEMENT_STANDARD_RTTIEXT(Express_Logical, Express_PredefinedType)
//=======================================================================
// function : Express_Logical
// purpose :
//=======================================================================
//=================================================================================================
Express_Logical::Express_Logical()
{
}
Express_Logical::Express_Logical() {}
//=======================================================================
// function : CPPName
// purpose :
//=======================================================================
//=================================================================================================
const TCollection_AsciiString Express_Logical::CPPName() const
{
return "StepData_Logical";
}
//=======================================================================
// function : IsStandard
// purpose :
//=======================================================================
//=================================================================================================
Standard_Boolean Express_Logical::IsStandard() const
{
return Standard_False;
}
//=======================================================================
// function : IsSimple
// purpose :
//=======================================================================
//=================================================================================================
Standard_Boolean Express_Logical::IsSimple() const
{
return Standard_True;
}
//=======================================================================
// function : IsHandle
// purpose :
//=======================================================================
//=================================================================================================
Standard_Boolean Express_Logical::IsHandle() const
{
return Standard_False;
}

View File

@@ -24,7 +24,6 @@ class Express_Logical : public Express_PredefinedType
{
public:
//! Empty constructor
Standard_EXPORT Express_Logical();
@@ -43,9 +42,7 @@ public:
DEFINE_STANDARD_RTTIEXT(Express_Logical, Express_PredefinedType)
protected:
private:
};
#endif // _Express_Logical_HeaderFile

View File

@@ -23,145 +23,110 @@
IMPLEMENT_STANDARD_RTTIEXT(Express_NamedType, Express_Type)
//=======================================================================
// function : Express_NamedType
// purpose :
//=======================================================================
//=================================================================================================
Express_NamedType::Express_NamedType (const Standard_CString theName)
Express_NamedType::Express_NamedType(const Standard_CString theName)
{
myName = new TCollection_HAsciiString (theName);
myName = new TCollection_HAsciiString(theName);
}
//=======================================================================
// function : Express_NamedType
// purpose :
//=======================================================================
//=================================================================================================
Express_NamedType::Express_NamedType (const Handle(TCollection_HAsciiString)& theName)
Express_NamedType::Express_NamedType(const Handle(TCollection_HAsciiString)& theName)
{
myName = theName;
}
//=======================================================================
// function : Name
// purpose :
//=======================================================================
//=================================================================================================
const TCollection_AsciiString& Express_NamedType::Name() const
{
return myName->String();
}
//=======================================================================
// function : HName
// purpose :
//=======================================================================
//=================================================================================================
Handle(TCollection_HAsciiString) Express_NamedType::HName() const
{
return myName;
}
//=======================================================================
// function : Item
// purpose :
//=======================================================================
//=================================================================================================
const Handle(Express_Item)& Express_NamedType::Item() const
{
return myItem;
}
//=======================================================================
// function : SetItem
// purpose :
//=======================================================================
//=================================================================================================
void Express_NamedType::SetItem (const Handle(Express_Item)& theItem)
void Express_NamedType::SetItem(const Handle(Express_Item)& theItem)
{
myItem = theItem;
}
//=======================================================================
// function : CPPName
// purpose :
//=======================================================================
//=================================================================================================
const TCollection_AsciiString Express_NamedType::CPPName() const
{
return myItem->CPPName();
}
//=======================================================================
// function : IsStandard
// purpose :
//=======================================================================
//=================================================================================================
Standard_Boolean Express_NamedType::IsStandard() const
{
if (myItem->IsKind (STANDARD_TYPE(Express_Alias)))
if (myItem->IsKind(STANDARD_TYPE(Express_Alias)))
{
Handle(Express_Alias) anAlias = Handle(Express_Alias)::DownCast (myItem);
Handle(Express_Alias) anAlias = Handle(Express_Alias)::DownCast(myItem);
return anAlias->Type()->IsStandard();
}
return Standard_False;
}
//=======================================================================
// function : IsSimple
// purpose :
//=======================================================================
//=================================================================================================
Standard_Boolean Express_NamedType::IsSimple() const
{
if (myItem->IsKind (STANDARD_TYPE(Express_Alias)))
if (myItem->IsKind(STANDARD_TYPE(Express_Alias)))
{
Handle(Express_Alias) anAlias = Handle(Express_Alias)::DownCast (myItem);
Handle(Express_Alias) anAlias = Handle(Express_Alias)::DownCast(myItem);
return anAlias->Type()->IsSimple();
}
if (myItem->IsKind (STANDARD_TYPE(Express_Enum)))
if (myItem->IsKind(STANDARD_TYPE(Express_Enum)))
{
return Standard_True;
}
return Standard_False; // SELECT & ENTITY
}
//=======================================================================
// function : IsHandle
// purpose :
//=======================================================================
//=================================================================================================
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);
Handle(Express_Alias) alias = Handle(Express_Alias)::DownCast(myItem);
return alias->Type()->IsHandle();
}
if (myItem->IsKind (STANDARD_TYPE(Express_Entity)))
if (myItem->IsKind(STANDARD_TYPE(Express_Entity)))
{
return Standard_True;
}
return Standard_False; // SELECT & ENUMERATION
}
//=======================================================================
// function : Use
// purpose :
//=======================================================================
//=================================================================================================
Standard_Boolean Express_NamedType::Use() const
{
return myItem->Use();
}
//=======================================================================
// function : Use2
// purpose :
//=======================================================================
//=================================================================================================
void Express_NamedType::Use2 (const TCollection_AsciiString& theRefName, const TCollection_AsciiString& theRefPack) const
void Express_NamedType::Use2(const TCollection_AsciiString& theRefName,
const TCollection_AsciiString& theRefPack) const
{
myItem->Use2 (theRefName, theRefPack);
myItem->Use2(theRefName, theRefPack);
}

View File

@@ -28,12 +28,11 @@ class Express_NamedType : public Express_Type
{
public:
//! Creates an object and initializes by name
Standard_EXPORT Express_NamedType(const Standard_CString theName);
//! Creates an object and initializes by name
Standard_EXPORT Express_NamedType (const Standard_CString theName);
//! Creates an object and initializes by name
Standard_EXPORT Express_NamedType (const Handle(TCollection_HAsciiString)& theName);
Standard_EXPORT Express_NamedType(const Handle(TCollection_HAsciiString)& theName);
//! Returns name of type (item in schema)
Standard_EXPORT const TCollection_AsciiString& Name() const;
@@ -45,7 +44,7 @@ public:
Standard_EXPORT const Handle(Express_Item)& Item() const;
//! Sets handle to referred item in schema
Standard_EXPORT void SetItem (const Handle(Express_Item)& theItem);
Standard_EXPORT void SetItem(const Handle(Express_Item)& theItem);
//! Returns CPP-style name of the type
Standard_EXPORT virtual const TCollection_AsciiString CPPName() const Standard_OVERRIDE;
@@ -65,17 +64,16 @@ public:
//! Declares type as used by some item being generated.
//! Calls Use() for referred item (found by name).
Standard_EXPORT virtual void Use2 (const TCollection_AsciiString& theRefName, const TCollection_AsciiString& theRefPack) const Standard_OVERRIDE;
Standard_EXPORT virtual void Use2(const TCollection_AsciiString& theRefName,
const TCollection_AsciiString& theRefPack) const
Standard_OVERRIDE;
DEFINE_STANDARD_RTTIEXT(Express_NamedType, Express_Type)
protected:
private:
Handle(TCollection_HAsciiString) myName;
Handle(Express_Item) myItem;
Handle(Express_Item) myItem;
};
#endif // _Express_NamedType_HeaderFile

View File

@@ -17,22 +17,13 @@
IMPLEMENT_STANDARD_RTTIEXT(Express_PredefinedType, Express_Type)
//=======================================================================
// function : Express_PredefinedType
// purpose :
//=======================================================================
//=================================================================================================
Express_PredefinedType::Express_PredefinedType()
{
}
Express_PredefinedType::Express_PredefinedType() {}
//=======================================================================
// function : IsStandard
// purpose :
//=======================================================================
//=================================================================================================
Standard_Boolean Express_PredefinedType::IsStandard() const
{
return Standard_True;
}

View File

@@ -23,19 +23,16 @@ 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

View File

@@ -17,21 +17,13 @@
#include <TCollection_AsciiString.hxx>
IMPLEMENT_STANDARD_RTTIEXT(Express_Real,Express_PredefinedType)
IMPLEMENT_STANDARD_RTTIEXT(Express_Real, Express_PredefinedType)
//=======================================================================
// function : Express_Real
// purpose :
//=======================================================================
//=================================================================================================
Express_Real::Express_Real()
{
}
Express_Real::Express_Real() {}
//=======================================================================
// function : CPPName
// purpose :
//=======================================================================
//=================================================================================================
const TCollection_AsciiString Express_Real::CPPName() const
{

View File

@@ -24,7 +24,6 @@ class Express_Real : public Express_PredefinedType
{
public:
//! Empty constructor
Standard_EXPORT Express_Real();
@@ -34,9 +33,7 @@ public:
DEFINE_STANDARD_RTTIEXT(Express_Real, Express_PredefinedType)
protected:
private:
};
#endif // _Express_Real_HeaderFile

View File

@@ -17,33 +17,22 @@
IMPLEMENT_STANDARD_RTTIEXT(Express_Reference, Express_Item)
//=======================================================================
// function : Express_Reference
// purpose :
//=======================================================================
//=================================================================================================
Express_Reference::Express_Reference (const Standard_CString theName,
const Handle(TColStd_HSequenceOfHAsciiString)& theTypes)
: Express_Item (theName)
Express_Reference::Express_Reference(const Standard_CString theName,
const Handle(TColStd_HSequenceOfHAsciiString)& theTypes)
: Express_Item(theName)
{
myTypes = theTypes;
}
//=======================================================================
// function : GenerateClass
// purpose : dummy method
//=======================================================================
//=================================================================================================
Standard_Boolean Express_Reference::GenerateClass() const
{
return Standard_False;
}
//=======================================================================
// function : PropagateUse
// purpose : dummy method
//=======================================================================
//=================================================================================================
void Express_Reference::PropagateUse() const
{
}
void Express_Reference::PropagateUse() const {}

View File

@@ -26,23 +26,16 @@ class Express_Reference : public Express_Item
{
public:
//! Create Reference item and initialize it
Standard_EXPORT Express_Reference (const Standard_CString theName,
const Handle(TColStd_HSequenceOfHAsciiString)& theTypes);
Standard_EXPORT Express_Reference(const Standard_CString theName,
const Handle(TColStd_HSequenceOfHAsciiString)& theTypes);
//! 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)
//! Return False
@@ -54,12 +47,9 @@ public:
DEFINE_STANDARD_RTTIEXT(Express_Reference, Express_Item)
protected:
private:
Handle(TColStd_HSequenceOfHAsciiString) myTypes;
Handle(Express_HSequenceOfItem) myItems;
Handle(Express_HSequenceOfItem) myItems;
};
#endif // _Express_Reference_HeaderFile

View File

@@ -29,81 +29,60 @@
IMPLEMENT_STANDARD_RTTIEXT(Express_Schema, Standard_Transient)
//=======================================================================
// function : Express_Schema
// purpose :
//=======================================================================
//=================================================================================================
Express_Schema::Express_Schema (const Standard_CString theName,
const Handle(Express_HSequenceOfItem)& theItems)
Express_Schema::Express_Schema(const Standard_CString theName,
const Handle(Express_HSequenceOfItem)& theItems)
{
myName = new TCollection_HAsciiString (theName);
myName = new TCollection_HAsciiString(theName);
myItems = theItems;
Prepare();
}
//=======================================================================
// function : Express_Schema
// purpose :
//=======================================================================
//=================================================================================================
Express_Schema::Express_Schema (const Handle(TCollection_HAsciiString)& theName,
const Handle(Express_HSequenceOfItem)& theItems)
Express_Schema::Express_Schema(const Handle(TCollection_HAsciiString)& theName,
const Handle(Express_HSequenceOfItem)& theItems)
{
myName = theName;
myName = theName;
myItems = theItems;
Prepare();
}
//=======================================================================
// function : Name
// purpose :
//=======================================================================
//=================================================================================================
const Handle(TCollection_HAsciiString)& Express_Schema::Name() const
{
return myName;
}
//=======================================================================
// function : Items
// purpose :
//=======================================================================
//=================================================================================================
const Handle(Express_HSequenceOfItem)& Express_Schema::Items() const
{
return myItems;
}
//=======================================================================
// function : NbItems
// purpose :
//=======================================================================
//=================================================================================================
Standard_Integer Express_Schema::NbItems() const
{
return myItems->Length();
}
//=======================================================================
// function : Item
// purpose :
//=======================================================================
//=================================================================================================
Handle(Express_Item) Express_Schema::Item (const Standard_Integer theNum) const
Handle(Express_Item) Express_Schema::Item(const Standard_Integer theNum) const
{
return myItems->Value (theNum);
return myItems->Value(theNum);
}
//=======================================================================
// function : Item
// purpose :
//=======================================================================
//=================================================================================================
Handle(Express_Item) Express_Schema::Item (const Standard_CString theName,
const Standard_Boolean theSilent) const
Handle(Express_Item) Express_Schema::Item(const Standard_CString theName,
const Standard_Boolean theSilent) const
{
if (!myDict.IsBound (theName))
if (!myDict.IsBound(theName))
{
if (!theSilent)
{
@@ -111,27 +90,21 @@ Handle(Express_Item) Express_Schema::Item (const Standard_CString theName,
}
return {};
}
return myDict.Find (theName);
return myDict.Find(theName);
}
//=======================================================================
// function : Item
// purpose :
//=======================================================================
//=================================================================================================
Handle(Express_Item) Express_Schema::Item (const TCollection_AsciiString& theName) const
Handle(Express_Item) Express_Schema::Item(const TCollection_AsciiString& theName) const
{
return Item (theName.ToCString());
return Item(theName.ToCString());
}
//=======================================================================
// function : Item
// purpose :
//=======================================================================
//=================================================================================================
Handle(Express_Item) Express_Schema::Item (const Handle(TCollection_HAsciiString)& theName) const
Handle(Express_Item) Express_Schema::Item(const Handle(TCollection_HAsciiString)& theName) const
{
return Item (theName->ToCString());
return Item(theName->ToCString());
}
//=======================================================================
@@ -140,7 +113,7 @@ Handle(Express_Item) Express_Schema::Item (const Handle(TCollection_HAsciiString
// 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)& theName)
static void nameToCasCade(const Handle(TCollection_HAsciiString)& theName)
{
if (theName.IsNull())
{
@@ -148,15 +121,15 @@ static void nameToCasCade (const Handle(TCollection_HAsciiString)& theName)
}
for (Standard_Integer i = 1; i <= theName->Length(); i++)
{
if (theName->Value (i) == '_')
if (theName->Value(i) == '_')
{
theName->Remove (i);
theName->Remove(i);
}
else if (i > 1)
{
continue;
}
theName->SetValue (i, UpperCase (theName->Value (i)));
theName->SetValue(i, UpperCase(theName->Value(i)));
}
}
@@ -165,17 +138,17 @@ static void nameToCasCade (const Handle(TCollection_HAsciiString)& theName)
// purpose : auxilary for Prepare()
// Convert names for Type object
//=======================================================================
static void nameToCasCade (const Handle(Express_Type)& theType)
static void nameToCasCade(const Handle(Express_Type)& theType)
{
if (theType->IsKind (STANDARD_TYPE(Express_NamedType)))
if (theType->IsKind(STANDARD_TYPE(Express_NamedType)))
{
const Handle(Express_NamedType) aNamedType = Handle(Express_NamedType)::DownCast (theType);
nameToCasCade (aNamedType->HName());
const Handle(Express_NamedType) aNamedType = Handle(Express_NamedType)::DownCast(theType);
nameToCasCade(aNamedType->HName());
}
else if (theType->IsKind (STANDARD_TYPE(Express_ComplexType)))
else if (theType->IsKind(STANDARD_TYPE(Express_ComplexType)))
{
const Handle(Express_ComplexType) aComplexType = Handle(Express_ComplexType)::DownCast (theType);
nameToCasCade (aComplexType->Type());
const Handle(Express_ComplexType) aComplexType = Handle(Express_ComplexType)::DownCast(theType);
nameToCasCade(aComplexType->Type());
}
}
@@ -199,132 +172,131 @@ void Express_Schema::Prepare()
for (Standard_Integer aNum = 1; aNum <= aNbItems; aNum++)
{
// get item
const Handle(Express_Item) anItem = Item (aNum);
const Handle(Express_Item) anItem = Item(aNum);
// change item name
nameToCasCade (anItem->HName());
nameToCasCade(anItem->HName());
// change names of referred types and other names
if (anItem->IsKind (STANDARD_TYPE(Express_Alias)))
if (anItem->IsKind(STANDARD_TYPE(Express_Alias)))
{
const Handle(Express_Alias) anAlias = Handle(Express_Alias)::DownCast (anItem);
nameToCasCade (anAlias->Type());
const Handle(Express_Alias) anAlias = Handle(Express_Alias)::DownCast(anItem);
nameToCasCade(anAlias->Type());
}
else if (anItem->IsKind (STANDARD_TYPE(Express_Select)))
else if (anItem->IsKind(STANDARD_TYPE(Express_Select)))
{
const Handle(Express_Select) aSelect = Handle(Express_Select)::DownCast (anItem);
const Handle(Express_Select) aSelect = Handle(Express_Select)::DownCast(anItem);
for (Standard_Integer i = 1; i <= aSelect->Names()->Length(); i++)
{
nameToCasCade (aSelect->Names()->Value (i));
nameToCasCade(aSelect->Names()->Value(i));
}
}
else if (anItem->IsKind (STANDARD_TYPE(Express_Enum)))
else if (anItem->IsKind(STANDARD_TYPE(Express_Enum)))
{
const Handle(Express_Enum) anEnum = Handle(Express_Enum)::DownCast (anItem);
const Handle(Express_Enum) anEnum = Handle(Express_Enum)::DownCast(anItem);
for (Standard_Integer i = 1; i <= anEnum->Names()->Length(); i++)
{
nameToCasCade (anEnum->Names()->Value (i));
nameToCasCade(anEnum->Names()->Value(i));
}
}
else if (anItem->IsKind (STANDARD_TYPE(Express_Entity)))
else if (anItem->IsKind(STANDARD_TYPE(Express_Entity)))
{
const Handle(Express_Entity) anEntity = Handle(Express_Entity)::DownCast (anItem);
const Handle(Express_Entity) anEntity = Handle(Express_Entity)::DownCast(anItem);
for (Standard_Integer i = 1; i <= anEntity->SuperTypes()->Length(); i++)
{
nameToCasCade (anEntity->SuperTypes()->Value (i));
nameToCasCade(anEntity->SuperTypes()->Value(i));
}
const Handle(Express_HSequenceOfField) aFields = anEntity->Fields();
for (Standard_Integer i = 1; i <= aFields->Length(); i++)
{
nameToCasCade (aFields->Value (i)->HName());
nameToCasCade (aFields->Value (i)->Type());
nameToCasCade(aFields->Value(i)->HName());
nameToCasCade(aFields->Value(i)->Type());
}
}
// add to dictionary
myDict.Bind (anItem->Name(), anItem);
myDict.Bind(anItem->Name(), anItem);
}
// set references to items from other items and types
for (Standard_Integer aNum = 1; aNum <= aNbItems; aNum++)
{
const Handle(Express_Item) anItem = Item (aNum);
const Handle(Express_Item) anItem = Item(aNum);
if (anItem->IsKind (STANDARD_TYPE(Express_Alias)))
if (anItem->IsKind(STANDARD_TYPE(Express_Alias)))
{
const Handle(Express_Alias) anAlias = Handle(Express_Alias)::DownCast (anItem);
PrepareType (anAlias->Type());
const Handle(Express_Alias) anAlias = Handle(Express_Alias)::DownCast(anItem);
PrepareType(anAlias->Type());
// for aliases, define package to avoid warnings
anAlias->SetPackageName ("Standard");
anAlias->SetPackageName("Standard");
continue;
}
else if (anItem->IsKind (STANDARD_TYPE(Express_Select)))
else if (anItem->IsKind(STANDARD_TYPE(Express_Select)))
{
const Handle(Express_Select) aSelect = Handle(Express_Select)::DownCast (anItem);
Handle(TColStd_HSequenceOfHAsciiString) aNames = aSelect->Names();
Handle(Express_HSequenceOfItem) anItems = aSelect->Items();
const Handle(Express_Select) aSelect = Handle(Express_Select)::DownCast(anItem);
Handle(TColStd_HSequenceOfHAsciiString) aNames = aSelect->Names();
Handle(Express_HSequenceOfItem) anItems = aSelect->Items();
for (Standard_Integer i = 1; i <= aNames->Length(); i++)
{
Handle(Express_Item) aSubItem = Item (aNames->Value (i));
Handle(Express_Item) aSubItem = Item(aNames->Value(i));
// if select refers to another select, expand it
if (aSubItem->IsKind (STANDARD_TYPE(Express_Select)))
if (aSubItem->IsKind(STANDARD_TYPE(Express_Select)))
{
Message::SendInfo() << "Info: SELECT " << anItem->Name() << " refers to another SELECT " << aSubItem->Name() << "; expanded";
const Handle(Express_Select) aSubSelect = Handle(Express_Select)::DownCast (aSubItem);
Standard_Integer j = 1;
Message::SendInfo() << "Info: SELECT " << anItem->Name() << " refers to another SELECT "
<< aSubItem->Name() << "; expanded";
const Handle(Express_Select) aSubSelect = Handle(Express_Select)::DownCast(aSubItem);
Standard_Integer j = 1;
for (; j <= aSubSelect->Names()->Length(); j++)
{
aNames->InsertBefore (i + j - 1, aSubSelect->Names()->Value (j));
aNames->InsertBefore(i + j - 1, aSubSelect->Names()->Value(j));
}
aNames->Remove (i + j - 1);
aNames->Remove(i + j - 1);
i--;
continue;
}
anItems->Append (aSubItem);
anItems->Append(aSubItem);
}
}
else if (anItem->IsKind (STANDARD_TYPE(Express_Entity)))
else if (anItem->IsKind(STANDARD_TYPE(Express_Entity)))
{
const Handle(Express_Entity) anEntity = Handle(Express_Entity)::DownCast (anItem);
Handle(TColStd_HSequenceOfHAsciiString) aNames = anEntity->SuperTypes();
Handle(Express_HSequenceOfEntity) anInhItems = anEntity->Inherit();
const Handle(Express_Entity) anEntity = Handle(Express_Entity)::DownCast(anItem);
Handle(TColStd_HSequenceOfHAsciiString) aNames = anEntity->SuperTypes();
Handle(Express_HSequenceOfEntity) anInhItems = anEntity->Inherit();
for (Standard_Integer i = 1; i <= aNames->Length(); i++)
{
Handle(Express_Entity) aSubEntity = Handle(Express_Entity)::DownCast (Item (aNames->Value (i)));
Handle(Express_Entity) aSubEntity =
Handle(Express_Entity)::DownCast(Item(aNames->Value(i)));
if (!aSubEntity.IsNull())
{
anInhItems->Append (aSubEntity);
anInhItems->Append(aSubEntity);
}
else
{
Message::SendFail() << "Error in " << anItem->Name() << ": supertype " << aNames->Value (i)->String() << " is not an ENTITY; ignored";
Message::SendFail() << "Error in " << anItem->Name() << ": supertype "
<< aNames->Value(i)->String() << " is not an ENTITY; ignored";
}
}
const Handle(Express_HSequenceOfField) aFields = anEntity->Fields();
for (Standard_Integer i = 1; i <= aFields->Length(); i++)
{
PrepareType (aFields->Value (i)->Type());
PrepareType(aFields->Value(i)->Type());
}
}
}
}
//=======================================================================
// function : PrepareType
// purpose :
//=======================================================================
//=================================================================================================
void Express_Schema::PrepareType (const Handle(Express_Type)& theType) const
void Express_Schema::PrepareType(const Handle(Express_Type)& theType) const
{
if (theType->IsKind (STANDARD_TYPE(Express_NamedType)))
if (theType->IsKind(STANDARD_TYPE(Express_NamedType)))
{
Handle(Express_NamedType) aNamedType = Handle(Express_NamedType)::DownCast (theType);
aNamedType->SetItem (Item (aNamedType->Name()));
Handle(Express_NamedType) aNamedType = Handle(Express_NamedType)::DownCast(theType);
aNamedType->SetItem(Item(aNamedType->Name()));
}
else if (theType->IsKind (STANDARD_TYPE(Express_ComplexType)))
else if (theType->IsKind(STANDARD_TYPE(Express_ComplexType)))
{
Handle(Express_ComplexType) aComplexType = Handle(Express_ComplexType)::DownCast (theType);
PrepareType (aComplexType->Type());
Handle(Express_ComplexType) aComplexType = Handle(Express_ComplexType)::DownCast(theType);
PrepareType(aComplexType->Type());
}
}

View File

@@ -31,16 +31,15 @@ class Express_Schema : public Standard_Transient
{
public:
//! Creates a schema with given name and given set of items
//! and calls Prepare()
Standard_EXPORT Express_Schema(const Standard_CString theName,
const Handle(Express_HSequenceOfItem)& theItems);
//! Creates a schema with given name and given set of items
//! and calls Prepare()
Standard_EXPORT Express_Schema (const Standard_CString theName,
const Handle(Express_HSequenceOfItem)& theItems);
//! Creates a schema with given name and given set of items
//! and calls Prepare()
Standard_EXPORT Express_Schema (const Handle(TCollection_HAsciiString)& theName,
const Handle(Express_HSequenceOfItem)& theItems);
Standard_EXPORT Express_Schema(const Handle(TCollection_HAsciiString)& theName,
const Handle(Express_HSequenceOfItem)& theItems);
//! Returns schema name
Standard_EXPORT const Handle(TCollection_HAsciiString)& Name() const;
@@ -52,24 +51,23 @@ public:
Standard_EXPORT Standard_Integer NbItems() const;
//! Returns item by index
Standard_EXPORT Handle(Express_Item) Item (const Standard_Integer theNum) const;
Standard_EXPORT Handle(Express_Item) Item(const Standard_Integer theNum) const;
//! Returns item by name
Standard_EXPORT Handle(Express_Item) Item (const Standard_CString theName,
const Standard_Boolean theSilent = Standard_False) const;
Standard_EXPORT Handle(Express_Item) Item(
const Standard_CString theName,
const Standard_Boolean theSilent = Standard_False) const;
//! Returns item by name
Standard_EXPORT Handle(Express_Item) Item (const TCollection_AsciiString& theName) const;
Standard_EXPORT Handle(Express_Item) Item(const TCollection_AsciiString& theName) const;
//! Returns item by name
Standard_EXPORT Handle(Express_Item) Item (const Handle(TCollection_HAsciiString)& theName) const;
Standard_EXPORT Handle(Express_Item) Item(const Handle(TCollection_HAsciiString)& theName) 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).
//! Then, makes a dictionary of item names and sets handles
@@ -79,14 +77,12 @@ private:
//! Prepares type for work by setting its handle to item in the
//! schema according to dictionary (for types which refer items
//! by name)
Standard_EXPORT void PrepareType (const Handle(Express_Type)& theType) const;
Standard_EXPORT void PrepareType(const Handle(Express_Type)& theType) const;
private:
Handle(TCollection_HAsciiString) myName;
Handle(Express_HSequenceOfItem) myItems;
Handle(Express_HSequenceOfItem) myItems;
Express_DataMapOfAsciiStringItem myDict;
};
#endif // _Express_Schema_HeaderFile

View File

@@ -31,74 +31,65 @@
IMPLEMENT_STANDARD_RTTIEXT(Express_Select, Express_Item)
//=======================================================================
// function : Express_Select
// purpose :
//=======================================================================
//=================================================================================================
Express_Select::Express_Select ( const Standard_CString theName,
const Handle(TColStd_HSequenceOfHAsciiString)& theNames)
: Express_Item (theName), myNames (theNames)
Express_Select::Express_Select(const Standard_CString theName,
const Handle(TColStd_HSequenceOfHAsciiString)& theNames)
: Express_Item(theName),
myNames(theNames)
{
myItems = new Express_HSequenceOfItem;
}
//=======================================================================
// function : Names
// purpose :
//=======================================================================
//=================================================================================================
const Handle(TColStd_HSequenceOfHAsciiString)& Express_Select::Names() const
{
return myNames;
}
//=======================================================================
// function : Items
// purpose :
//=======================================================================
//=================================================================================================
const Handle(Express_HSequenceOfItem)& Express_Select::Items() const
{
return myItems;
}
//=======================================================================
// function : GenerateClass
// purpose :
//=======================================================================
//=================================================================================================
Standard_Boolean Express_Select::GenerateClass() const
{
const TCollection_AsciiString aCPPName = CPPName();
Handle(TColStd_HSequenceOfInteger) aSeqMember = new TColStd_HSequenceOfInteger;
Handle(TColStd_HSequenceOfInteger) aSeqMember = new TColStd_HSequenceOfInteger;
Handle(TColStd_HSequenceOfInteger) aSeqEntities = new TColStd_HSequenceOfInteger;
for (Standard_Integer i = 1; i <= myItems->Length(); i++)
{
Handle(Express_Item) anItem = myItems->Value (i);
if (anItem->IsKind (STANDARD_TYPE(Express_Entity)) || anItem->IsKind (STANDARD_TYPE(Express_Select))
|| anItem->IsKind (STANDARD_TYPE(Express_Alias)) || anItem->IsKind (STANDARD_TYPE(Express_ComplexType)))
Handle(Express_Item) anItem = myItems->Value(i);
if (anItem->IsKind(STANDARD_TYPE(Express_Entity))
|| anItem->IsKind(STANDARD_TYPE(Express_Select))
|| anItem->IsKind(STANDARD_TYPE(Express_Alias))
|| anItem->IsKind(STANDARD_TYPE(Express_ComplexType)))
{
aSeqEntities->Append (i);
aSeqEntities->Append(i);
}
else
{
aSeqMember->Append (i);
aSeqMember->Append(i);
}
}
Message::SendInfo() << "Generating SELECT " << aCPPName;
if (!aSeqMember->IsEmpty())
{
Message::SendInfo() << "Generating SELECTMember " << aCPPName << "Member";
generateSelectMember (aSeqMember);
generateSelectMember(aSeqMember);
}
// create a package directory (if not yet exist)
OSD_Protection aProt (OSD_RWXD, OSD_RWXD, OSD_RX, OSD_RX);
OSD_Protection aProt(OSD_RWXD, OSD_RWXD, OSD_RX, OSD_RX);
TCollection_AsciiString aPack = GetPackageName();
OSD_Path aPath (aPack);
OSD_Directory aDir (aPath);
aDir.Build (aProt);
OSD_Path aPath(aPack);
OSD_Directory aDir(aPath);
aDir.Build(aProt);
aPack += "/";
aPack += aCPPName;
const Handle(OSD_FileSystem)& aFileSystem = OSD_FileSystem::DefaultFileSystem();
@@ -107,15 +98,19 @@ Standard_Boolean Express_Select::GenerateClass() const
// Step 1: generating HXX
{
// Open HXX file
std::shared_ptr<std::ostream> aStreamPtr = aFileSystem->OpenOStream (aPack.Cat (".hxx"), std::ios::out | std::ios::binary);
std::shared_ptr<std::ostream> aStreamPtr =
aFileSystem->OpenOStream(aPack.Cat(".hxx"), std::ios::out | std::ios::binary);
Standard_OStream& anOS = *aStreamPtr;
// write header
Express::WriteFileStamp (anOS);
Express::WriteFileStamp(anOS);
// write start define
anOS << "#ifndef _" << aCPPName << "_HeaderFile\n"
"#define _" << aCPPName << "_HeaderFile\n"
anOS << "#ifndef _" << aCPPName
<< "_HeaderFile\n"
"#define _"
<< aCPPName
<< "_HeaderFile\n"
"\n";
// write common includes
@@ -132,11 +127,11 @@ Standard_Boolean Express_Select::GenerateClass() const
for (Standard_Integer i = 1; i <= myItems->Length(); i++)
{
Handle(Express_Item) anItem = myItems->Value (i);
Handle(Express_Item) anItem = myItems->Value(i);
anItem->Use();
if (anItem->IsKind (STANDARD_TYPE(Express_Alias)))
if (anItem->IsKind(STANDARD_TYPE(Express_Alias)))
{
Handle(Express_Type) aType = Handle(Express_Alias)::DownCast (anItem)->Type();
Handle(Express_Type) aType = Handle(Express_Alias)::DownCast(anItem)->Type();
if (aType->IsStandard())
{
continue;
@@ -147,8 +142,11 @@ Standard_Boolean Express_Select::GenerateClass() const
anOS << "\n";
// class declaration
anOS << "//! Representation of STEP SELECT type " << Name() << "\n"
"class " << aCPPName << " : public StepData_SelectType\n"
anOS << "//! Representation of STEP SELECT type " << Name()
<< "\n"
"class "
<< aCPPName
<< " : public StepData_SelectType\n"
"{\n"
"\n"
"public:\n"
@@ -158,17 +156,20 @@ Standard_Boolean Express_Select::GenerateClass() const
// default constructor
anOS << " //! Empty constructor\n"
" Standard_EXPORT " << aCPPName << "();\n"
" Standard_EXPORT "
<< aCPPName
<< "();\n"
"\n";
// write common methods section
anOS << " //! Recognizes a kind of " << Name() << " select type\n";
for (Standard_Integer i = 1; i <= aSeqEntities->Length(); i++)
{
Standard_Integer anIdx = aSeqEntities->Value (i);
anOS << " //! -- " << i << " -> " << myNames->Value (anIdx)->String() << "\n";
Standard_Integer anIdx = aSeqEntities->Value(i);
anOS << " //! -- " << i << " -> " << myNames->Value(anIdx)->String() << "\n";
}
anOS << " Standard_EXPORT Standard_Integer CaseNum (const Handle(Standard_Transient)& theEnt) const Standard_OVERRIDE;\n"
anOS << " Standard_EXPORT Standard_Integer CaseNum (const Handle(Standard_Transient)& theEnt) "
"const Standard_OVERRIDE;\n"
"\n";
if (!aSeqMember->IsEmpty())
@@ -176,80 +177,99 @@ Standard_Boolean Express_Select::GenerateClass() const
anOS << " //! Recognizes items of select member " << Name() << "Member\n";
for (Standard_Integer i = 1; i <= aSeqMember->Length(); i++)
{
Standard_Integer anIdx = aSeqMember->Value (i);
anOS << " //! -- " << i << " -> " << myNames->Value (anIdx)->String() << "\n";
Standard_Integer anIdx = aSeqMember->Value(i);
anOS << " //! -- " << i << " -> " << myNames->Value(anIdx)->String() << "\n";
}
anOS << " //! -- 0 else\n"
" Standard_EXPORT virtual Standard_Integer CaseMem (const Handle(StepData_SelectMember)& theEnt) const Standard_OVERRIDE;\n"
" Standard_EXPORT virtual Standard_Integer CaseMem (const "
"Handle(StepData_SelectMember)& theEnt) const Standard_OVERRIDE;\n"
"\n"
" //! Returns a new select member the type " << Name() << "Member\n"
" Standard_EXPORT virtual Handle(StepData_SelectMember) NewMember() const Standard_OVERRIDE;\n"
" //! Returns a new select member the type "
<< Name()
<< "Member\n"
" Standard_EXPORT virtual Handle(StepData_SelectMember) NewMember() const "
"Standard_OVERRIDE;\n"
"\n";
}
// write methods get for entities
for (Standard_Integer i = 1; i <= aSeqEntities->Length(); i++)
{
Standard_Integer anIdx = aSeqEntities->Value (i);
Handle(Express_Item) anItem = myItems->Value (anIdx);
const TCollection_AsciiString& aName = anItem->Name();
anOS << " //! Returns Value as " << aName << " (or Null if another type)\n"
" Standard_EXPORT Handle(" << anItem->CPPName() << ") " << aName << "() const;\n"
Standard_Integer anIdx = aSeqEntities->Value(i);
Handle(Express_Item) anItem = myItems->Value(anIdx);
const TCollection_AsciiString& aName = anItem->Name();
anOS << " //! Returns Value as " << aName
<< " (or Null if another type)\n"
" Standard_EXPORT Handle("
<< anItem->CPPName() << ") " << aName
<< "() const;\n"
"\n";
}
// writes method set and get for enum , integer, real and string.
for (Standard_Integer i = 1; i <= aSeqMember->Length(); i++)
{
Standard_Integer anIdx = aSeqMember->Value (i);
Handle(Express_Item) anItem = myItems->Value (anIdx);
const TCollection_AsciiString& aName = anItem->Name();
Standard_Integer anIdx = aSeqMember->Value(i);
Handle(Express_Item) anItem = myItems->Value(anIdx);
const TCollection_AsciiString& aName = anItem->Name();
const TCollection_AsciiString& anItemCPPName = anItem->CPPName();
anOS << " //! Set Value for " << aName << "\n"
" Standard_EXPORT void Set" << aName << " (const " << anItemCPPName << " theVal);\n"
anOS << " //! Set Value for " << aName
<< "\n"
" Standard_EXPORT void Set"
<< aName << " (const " << anItemCPPName
<< " theVal);\n"
"\n"
" //! Returns Value as " << aName << " (or Null if another type)\n"
" " << anItemCPPName << " " << aName << "() const;\n"
" //! Returns Value as "
<< aName
<< " (or Null if another type)\n"
" "
<< anItemCPPName << " " << aName
<< "() const;\n"
"\n";
}
// write end
anOS << "};\n"
"#endif // _" << aCPPName << "_HeaderFile\n";
"#endif // _"
<< aCPPName << "_HeaderFile\n";
aStreamPtr.reset();
}
//===============================
// Step 2: generating CXX
{
// Open CXX file
std::shared_ptr<std::ostream> aStreamPtr = aFileSystem->OpenOStream (aPack.Cat (".cxx"), std::ios::out | std::ios::binary);
std::shared_ptr<std::ostream> aStreamPtr =
aFileSystem->OpenOStream(aPack.Cat(".cxx"), std::ios::out | std::ios::binary);
Standard_OStream& anOS = *aStreamPtr;
// write header
Express::WriteFileStamp (anOS);
Express::WriteFileStamp(anOS);
// write include section
anOS << "#include <" << aCPPName << ".hxx>\n";
if (!aSeqMember->IsEmpty())
{
anOS << "#include <" << aCPPName << "Member.hxx>\n"
anOS << "#include <" << aCPPName
<< "Member.hxx>\n"
"#include <TCollection_HAsciiString.hxx>\n";
}
for (Standard_Integer i = 1; i <= aSeqEntities->Length(); i++)
{
Standard_Integer anIdx = aSeqEntities->Value (i);
anOS << "#include <" << myItems->Value (anIdx)->CPPName() << ".hxx>\n";
Standard_Integer anIdx = aSeqEntities->Value(i);
anOS << "#include <" << myItems->Value(anIdx)->CPPName() << ".hxx>\n";
}
// write constructor
Express::WriteMethodStamp (anOS, aCPPName);
anOS << aCPPName << "::" << aCPPName << "()\n"
"{\n"
"}\n";
Express::WriteMethodStamp(anOS, aCPPName);
anOS << aCPPName << "::" << aCPPName
<< "()\n"
"{\n"
"}\n";
// write CaseNum method
Express::WriteMethodStamp (anOS, "CaseNum");
anOS << "Standard_Integer " << aCPPName << "::CaseNum (const Handle(Standard_Transient)& theEnt) const\n"
Express::WriteMethodStamp(anOS, "CaseNum");
anOS << "Standard_Integer " << aCPPName
<< "::CaseNum (const Handle(Standard_Transient)& theEnt) const\n"
"{\n";
if (!aSeqEntities->IsEmpty())
@@ -257,8 +277,9 @@ Standard_Boolean Express_Select::GenerateClass() const
anOS << " if (theEnt.IsNull()) return 0;\n";
for (Standard_Integer i = 1; i <= aSeqEntities->Length(); i++)
{
Standard_Integer anIdx = aSeqEntities->Value (i);
anOS << " if (theEnt->IsKind (STANDARD_TYPE(" << myItems->Value (anIdx)->CPPName() << "))) return " << i << ";\n";
Standard_Integer anIdx = aSeqEntities->Value(i);
anOS << " if (theEnt->IsKind (STANDARD_TYPE(" << myItems->Value(anIdx)->CPPName()
<< "))) return " << i << ";\n";
}
anOS << " return 0;\n"
"}\n";
@@ -272,62 +293,72 @@ Standard_Boolean Express_Select::GenerateClass() const
if (!aSeqMember->IsEmpty())
{
// write CaseMem method
Express::WriteMethodStamp (anOS, "CaseMem");
anOS << "Standard_Integer " << aCPPName << "::CaseMem (const Handle(StepData_SelectMember)& theEnt) const\n"
Express::WriteMethodStamp(anOS, "CaseMem");
anOS << "Standard_Integer " << aCPPName
<< "::CaseMem (const Handle(StepData_SelectMember)& theEnt) const\n"
"{\n"
" if (theEnt.IsNull()) return 0;\n";
for (int j = 1; j <= aSeqMember->Length(); j++)
{
Standard_Integer anIdx = aSeqMember->Value (j);
Standard_Integer anIdx = aSeqMember->Value(j);
if (j == 1)
{
anOS << " if (theEnt->Matches (\"" << myNames->Value (anIdx)->String() << "\")) return " << j << ";\n";
anOS << " if (theEnt->Matches (\"" << myNames->Value(anIdx)->String() << "\")) return "
<< j << ";\n";
}
else
{
anOS << " else if (theEnt->Matches (\"" << myNames->Value (anIdx)->String() << "\")) return " << j << ";\n";
anOS << " else if (theEnt->Matches (\"" << myNames->Value(anIdx)->String()
<< "\")) return " << j << ";\n";
}
}
anOS << " else return 0;\n"
"}\n";
// write NewMember method
Express::WriteMethodStamp (anOS, "NewMember");
anOS << "Handle(StepData_SelectMember) " << aCPPName << "::NewMember() const\n"
Express::WriteMethodStamp(anOS, "NewMember");
anOS << "Handle(StepData_SelectMember) " << aCPPName
<< "::NewMember() const\n"
"{\n"
" return new " << aCPPName << "Member;\n"
" return new "
<< aCPPName
<< "Member;\n"
"}\n";
}
// write methods Get for entities.
for (Standard_Integer i = 1; i <= aSeqEntities->Length(); i++)
{
Standard_Integer anIdx = aSeqEntities->Value (i);
Handle(Express_Item) anItem = myItems->Value (anIdx);
const TCollection_AsciiString& aName = anItem->Name();
Standard_Integer anIdx = aSeqEntities->Value(i);
Handle(Express_Item) anItem = myItems->Value(anIdx);
const TCollection_AsciiString& aName = anItem->Name();
const TCollection_AsciiString& anItemCPPName = anItem->CPPName();
Express::WriteMethodStamp (anOS, aName);
anOS << "Handle(" << anItemCPPName << ") " << aCPPName << "::" << aName << "() const\n"
Express::WriteMethodStamp(anOS, aName);
anOS << "Handle(" << anItemCPPName << ") " << aCPPName << "::" << aName
<< "() const\n"
"{\n"
" return Handle(" << anItemCPPName << ")::DownCast(Value());\n"
" return Handle("
<< anItemCPPName
<< ")::DownCast(Value());\n"
"}\n";
}
// write methods Set and Get for Integer, Real, String and Enum
for (Standard_Integer i = 1; i <= aSeqMember->Length(); i++)
{
Standard_Integer anIdx = aSeqMember->Value (i);
Handle(Express_Item) anItem = myItems->Value (anIdx);
const TCollection_AsciiString& aName = anItem->Name();
Standard_Integer anIdx = aSeqMember->Value(i);
Handle(Express_Item) anItem = myItems->Value(anIdx);
const TCollection_AsciiString& aName = anItem->Name();
const TCollection_AsciiString& anItemCPPName = anItem->CPPName();
TCollection_AsciiString aStamp = "Set";
TCollection_AsciiString aStamp = "Set";
aStamp += aName;
Express::WriteMethodStamp (anOS, aStamp);
Express::WriteMethodStamp(anOS, aStamp);
Standard_Boolean isString = (anItemCPPName.Location ("HAsciiString", 1, anItemCPPName.Length()) > 0);
Standard_Boolean isString =
(anItemCPPName.Location("HAsciiString", 1, anItemCPPName.Length()) > 0);
TCollection_AsciiString aNameFunc;
TCollection_AsciiString aFunc;
Standard_Boolean isEnum = anItem->IsKind (STANDARD_TYPE(Express_Enum));
Standard_Boolean isEnum = anItem->IsKind(STANDARD_TYPE(Express_Enum));
if (!isEnum)
{
if (isString)
@@ -337,11 +368,11 @@ Standard_Boolean Express_Select::GenerateClass() const
else
{
aNameFunc += anItemCPPName;
aFunc = aNameFunc;
Standard_Integer aSplitInd = aNameFunc.Location ("_", 1, anItemCPPName.Length());
aFunc = aNameFunc;
Standard_Integer aSplitInd = aNameFunc.Location("_", 1, anItemCPPName.Length());
if (aSplitInd)
{
aFunc = aNameFunc.Split (aSplitInd);
aFunc = aNameFunc.Split(aSplitInd);
}
}
}
@@ -349,17 +380,23 @@ Standard_Boolean Express_Select::GenerateClass() const
// write method set
if (isString)
{
anOS << "void " << aCPPName << "::Set" << aName << " (const Handle(" << anItemCPPName << ") &theVal)\n";
anOS << "void " << aCPPName << "::Set" << aName << " (const Handle(" << anItemCPPName
<< ") &theVal)\n";
}
else
{
anOS << "void " << aCPPName << "::Set" << aName << " (const " << anItemCPPName << " theVal)\n";
anOS << "void " << aCPPName << "::Set" << aName << " (const " << anItemCPPName
<< " theVal)\n";
}
anOS << "{\n"
" Handle(" << aCPPName << "Member) SelMem = Handle(" << aCPPName << "Member)::DownCast(Value());\n"
" Handle("
<< aCPPName << "Member) SelMem = Handle(" << aCPPName
<< "Member)::DownCast(Value());\n"
" if (SelMem.IsNull()) return;\n"
" Handle(TCollection_HAsciiString) aName = new TCollection_HAsciiString(\"" << aName << "\");\n"
" Handle(TCollection_HAsciiString) aName = new TCollection_HAsciiString(\""
<< aName
<< "\");\n"
" SelMem->SetName (aName->ToCString());\n";
if (isEnum)
{
@@ -376,7 +413,7 @@ Standard_Boolean Express_Select::GenerateClass() const
anOS << "}\n";
// write method get
Express::WriteMethodStamp (anOS, aName);
Express::WriteMethodStamp(anOS, aName);
if (isString)
{
anOS << "Handle(" << anItemCPPName << ") " << aCPPName << "::" << aName << "() const\n";
@@ -387,24 +424,31 @@ Standard_Boolean Express_Select::GenerateClass() const
}
anOS << "{\n"
" Handle(" << aCPPName << "Member) SelMem = Handle(" << aCPPName << "Member)::DownCast (Value());\n"
" Handle("
<< aCPPName << "Member) SelMem = Handle(" << aCPPName
<< "Member)::DownCast (Value());\n"
" if (SelMem.IsNull()) return 0;\n"
" Handle(TCollection_HAsciiString) aName = new TCollection_HAsciiString;\n"
" aName->AssignCat (SelMem->Name());\n"
" Handle(TCollection_HAsciiString) aNameItem = new TCollection_HAsciiString(\"" << aName << "\");\n"
" Handle(TCollection_HAsciiString) aNameItem = new TCollection_HAsciiString(\""
<< aName
<< "\");\n"
" if (aName->IsDifferent (aNameItem)) return 0;\n";
if (isEnum)
{
anOS << " Standard_Integer aNumIt = SelMem->Enum();\n"
" " << anItemCPPName << " aVal;\n"
" "
<< anItemCPPName
<< " aVal;\n"
" switch (aNumIt)\n"
" {\n";
Handle(Express_Enum) anEnum = Handle(Express_Enum)::DownCast (anItem);
Handle(Express_Enum) anEnum = Handle(Express_Enum)::DownCast(anItem);
Handle(TColStd_HSequenceOfHAsciiString) anEnItems = anEnum->Names();
TCollection_AsciiString aPrefix = Express::EnumPrefix (aName);
TCollection_AsciiString aPrefix = Express::EnumPrefix(aName);
for (Standard_Integer k = 1; k <= anEnItems->Length(); k++)
{
anOS << " case " << k << " : aVal = " << aName << "_" << aPrefix << anEnItems->Value (k)->String() << "; break;\n";
anOS << " case " << k << " : aVal = " << aName << "_" << aPrefix
<< anEnItems->Value(k)->String() << "; break;\n";
}
anOS << " default : return 0; break;\n"
" }\n";
@@ -421,7 +465,6 @@ Standard_Boolean Express_Select::GenerateClass() const
anOS << " return aVal;\n"
"}\n";
}
aStreamPtr.reset();
}
@@ -429,10 +472,7 @@ Standard_Boolean Express_Select::GenerateClass() const
return Standard_True;
}
//=======================================================================
// function : PropagateUse
// purpose :
//=======================================================================
//=================================================================================================
void Express_Select::PropagateUse() const
{
@@ -441,27 +481,25 @@ void Express_Select::PropagateUse() const
for (Standard_Integer i = 1; i <= myItems->Length(); i++)
{
Handle(Express_Item) anItem = myItems->Value (i);
anItem->Use2 (aName, aPack);
Handle(Express_Item) anItem = myItems->Value(i);
anItem->Use2(aName, aPack);
}
}
//=======================================================================
// function : GenerateSelectMember
// purpose :
//=======================================================================
//=================================================================================================
Standard_Boolean Express_Select::generateSelectMember (const Handle(TColStd_HSequenceOfInteger)& theSeqMember) const
Standard_Boolean Express_Select::generateSelectMember(
const Handle(TColStd_HSequenceOfInteger)& theSeqMember) const
{
TCollection_AsciiString aCPPname = CPPName();
aCPPname += "Member";
// create a package directory (if not yet exist)
OSD_Protection aProt (OSD_RWXD, OSD_RWXD, OSD_RX, OSD_RX);
OSD_Protection aProt(OSD_RWXD, OSD_RWXD, OSD_RX, OSD_RX);
TCollection_AsciiString aPack = GetPackageName();
OSD_Path aPath (aPack);
OSD_Directory aDir (aPath);
aDir.Build (aProt);
OSD_Path aPath(aPack);
OSD_Directory aDir(aPath);
aDir.Build(aProt);
aPack += "/";
aPack += aCPPname;
const Handle(OSD_FileSystem)& aFileSystem = OSD_FileSystem::DefaultFileSystem();
@@ -469,15 +507,19 @@ Standard_Boolean Express_Select::generateSelectMember (const Handle(TColStd_HSeq
// Step 1: generating HXX
{
// Open HXX file
std::shared_ptr<std::ostream> aStreamPtr = aFileSystem->OpenOStream (aPack.Cat (".hxx"), std::ios::out | std::ios::binary);
std::shared_ptr<std::ostream> aStreamPtr =
aFileSystem->OpenOStream(aPack.Cat(".hxx"), std::ios::out | std::ios::binary);
Standard_OStream& anOS = *aStreamPtr;
// write header
Express::WriteFileStamp (anOS);
Express::WriteFileStamp(anOS);
// write start define
anOS << "#ifndef _" << aCPPname << "_HeaderFile\n"
"#define _" << aCPPname << "_HeaderFile\n"
"\n";
anOS << "#ifndef _" << aCPPname
<< "_HeaderFile\n"
"#define _"
<< aCPPname
<< "_HeaderFile\n"
"\n";
// includes
anOS << "#include <Standard.hxx>\n"
@@ -487,18 +529,25 @@ Standard_Boolean Express_Select::generateSelectMember (const Handle(TColStd_HSeq
"#include <Standard_Integer.hxx>\n"
"#include <StepData_SelectNamed.hxx>\n"
"\n"
"DEFINE_STANDARD_HANDLE(" << aCPPname << ", StepData_SelectNamed)\n"
"\n";
"DEFINE_STANDARD_HANDLE("
<< aCPPname
<< ", StepData_SelectNamed)\n"
"\n";
// write start of declaration (inheritance)
anOS << " //! Representation of member for STEP SELECT type " << Name() << "\n"
"class " << aCPPname << " : public StepData_SelectNamed\n"
anOS << " //! Representation of member for STEP SELECT type " << Name()
<< "\n"
"class "
<< aCPPname
<< " : public StepData_SelectNamed\n"
"{\n"
"public:\n";
// write methods
anOS << " //! Empty constructor\n"
" Standard_EXPORT " << aCPPname << "();\n"
" Standard_EXPORT "
<< aCPPname
<< "();\n"
"\n"
" //! Returns True if has name\n"
" Standard_EXPORT virtual Standard_Boolean HasName() const Standard_OVERRIDE;\n"
@@ -507,10 +556,12 @@ Standard_Boolean Express_Select::generateSelectMember (const Handle(TColStd_HSeq
" Standard_EXPORT virtual Standard_CString Name() const Standard_OVERRIDE;\n"
"\n"
" //! Set name\n"
" Standard_EXPORT virtual Standard_Boolean SetName(const Standard_CString name) Standard_OVERRIDE;\n"
" Standard_EXPORT virtual Standard_Boolean SetName(const Standard_CString name) "
"Standard_OVERRIDE;\n"
"\n"
" //! Tells if the name of a SelectMember matches a given one;\n"
" Standard_EXPORT virtual Standard_Boolean Matches (const Standard_CString name) const Standard_OVERRIDE;\n"
" Standard_EXPORT virtual Standard_Boolean Matches (const Standard_CString name) "
"const Standard_OVERRIDE;\n"
"\n";
// write fields
@@ -519,52 +570,59 @@ Standard_Boolean Express_Select::generateSelectMember (const Handle(TColStd_HSeq
"\n";
// write end
anOS << "};\n"
"#endif // _" << aCPPname << "_HeaderFile\n";
"#endif // _"
<< aCPPname << "_HeaderFile\n";
aStreamPtr.reset();
}
//===============================
// Step 2: generating CXX
{
// Open CXX file
std::shared_ptr<std::ostream> aStreamPtr = aFileSystem->OpenOStream (aPack.Cat (".cxx"), std::ios::out | std::ios::binary);
std::shared_ptr<std::ostream> aStreamPtr =
aFileSystem->OpenOStream(aPack.Cat(".cxx"), std::ios::out | std::ios::binary);
Standard_OStream& anOS = *aStreamPtr;
// write header
Express::WriteFileStamp (anOS);
Express::WriteFileStamp(anOS);
// write include section
anOS << "#include <" << aCPPname << ".hxx>\n"
anOS << "#include <" << aCPPname
<< ".hxx>\n"
"#include <TCollection_HAsciiString.hxx>\n";
// write constructor
Express::WriteMethodStamp (anOS, aCPPname);
anOS << aCPPname << "::" << aCPPname << "() : myCase(0) \n"
Express::WriteMethodStamp(anOS, aCPPname);
anOS << aCPPname << "::" << aCPPname
<< "() : myCase(0) \n"
"{\n"
"}\n";
// write method HasName
Express::WriteMethodStamp (anOS, "HasName");
anOS << "Standard_Boolean " << aCPPname << "::HasName() const\n"
Express::WriteMethodStamp(anOS, "HasName");
anOS << "Standard_Boolean " << aCPPname
<< "::HasName() const\n"
"{\n"
" return myCase > 0;\n"
"}\n";
Standard_Boolean hasEnum = Standard_False;
// write method Name
Express::WriteMethodStamp (anOS, "Name");
anOS << "Standard_CString " << aCPPname << "::Name() const\n"
Express::WriteMethodStamp(anOS, "Name");
anOS << "Standard_CString " << aCPPname
<< "::Name() const\n"
"{\n"
" Handle(TCollection_HAsciiString) aName = new TCollection_HAsciiString;\n"
" switch (myCase)"
" {\n";
for (Standard_Integer i = 1; i <= theSeqMember->Length(); i++)
{
Standard_Integer anIdx = theSeqMember->Value (i);
Handle(Express_Item) anItem = myItems->Value (anIdx);
if (anItem->IsKind (STANDARD_TYPE(Express_Enum)))
Standard_Integer anIdx = theSeqMember->Value(i);
Handle(Express_Item) anItem = myItems->Value(anIdx);
if (anItem->IsKind(STANDARD_TYPE(Express_Enum)))
{
hasEnum = Standard_True;
}
anOS << " case " << i << " : aName->AssignCat (\"" << myNames->Value (anIdx)->String() << "\"); break;\n";
anOS << " case " << i << " : aName->AssignCat (\"" << myNames->Value(anIdx)->String()
<< "\"); break;\n";
}
anOS << " default : break;\n"
" }\n"
@@ -572,7 +630,7 @@ Standard_Boolean Express_Select::generateSelectMember (const Handle(TColStd_HSeq
"}\n";
// write static method for compare name
Express::WriteMethodStamp (anOS, "CompareNames");
Express::WriteMethodStamp(anOS, "CompareNames");
anOS << "static Standard_Integer CompareNames (const Standard_CString theName";
if (hasEnum)
{
@@ -587,32 +645,39 @@ Standard_Boolean Express_Select::generateSelectMember (const Handle(TColStd_HSeq
" if (!theName || theName[0] == \'/0\') aCase = 0;\n";
for (Standard_Integer i = 1; i <= theSeqMember->Length(); i++)
{
Standard_Integer anIdx = theSeqMember->Value (i);
Handle(Express_Item) anItem = myItems->Value (anIdx);
if (anItem->IsKind (STANDARD_TYPE(Express_Enum)))
Standard_Integer anIdx = theSeqMember->Value(i);
Handle(Express_Item) anItem = myItems->Value(anIdx);
if (anItem->IsKind(STANDARD_TYPE(Express_Enum)))
{
Handle(Express_Enum) en = Handle(Express_Enum)::DownCast (anItem);
Handle(Express_Enum) en = Handle(Express_Enum)::DownCast(anItem);
for (Standard_Integer k = 1; k <= en->Names()->Length(); k++)
{
anOS << " else if (!strcmp (theName, \"" << en->Names()->Value (k)->String() << "\"))\n"
anOS << " else if (!strcmp (theName, \"" << en->Names()->Value(k)->String()
<< "\"))\n"
" {\n"
" aCase = " << i << ";\n"
" theNumEn = " << k << ";\n"
" aCase = "
<< i
<< ";\n"
" theNumEn = "
<< k
<< ";\n"
" }\n";
}
}
else
{
anOS << " else if (!strcmp (theName, \"" << myNames->Value (anIdx)->String() << "\")) aCase = " << i << ";\n";
anOS << " else if (!strcmp (theName, \"" << myNames->Value(anIdx)->String()
<< "\")) aCase = " << i << ";\n";
}
}
anOS << " return aCase;\n"
"}\n";
// write method SetName
Express::WriteMethodStamp (anOS, "SetName");
anOS << "Standard_Boolean " << aCPPname << "::SetName (const Standard_CString theName) \n"
"{\n";
Express::WriteMethodStamp(anOS, "SetName");
anOS << "Standard_Boolean " << aCPPname
<< "::SetName (const Standard_CString theName) \n"
"{\n";
if (hasEnum)
{
anOS << " Standard_Integer aNumIt = 0;\n"
@@ -627,8 +692,9 @@ Standard_Boolean Express_Select::generateSelectMember (const Handle(TColStd_HSeq
"}\n";
// write method Matches
Express::WriteMethodStamp (anOS, "Matches");
anOS << "Standard_Boolean " << aCPPname << "::Matches (const Standard_CString theName) const\n"
Express::WriteMethodStamp(anOS, "Matches");
anOS << "Standard_Boolean " << aCPPname
<< "::Matches (const Standard_CString theName) const\n"
"{\n";
if (hasEnum)
{

View File

@@ -30,10 +30,9 @@ class Express_Select : public Express_Item
{
public:
//! Create SELECT item and initialize it
Standard_EXPORT Express_Select (const Standard_CString theName,
const Handle(TColStd_HSequenceOfHAsciiString)& theNames);
Standard_EXPORT Express_Select(const Standard_CString theName,
const Handle(TColStd_HSequenceOfHAsciiString)& theNames);
//! Returns names of types included in this SELECT
Standard_EXPORT const Handle(TColStd_HSequenceOfHAsciiString)& Names() const;
@@ -50,14 +49,12 @@ public:
DEFINE_STANDARD_RTTIEXT(Express_Select, Express_Item)
protected:
private:
Standard_EXPORT Standard_Boolean generateSelectMember (const Handle(TColStd_HSequenceOfInteger)& theSeqMember) const;
Standard_EXPORT Standard_Boolean
generateSelectMember(const Handle(TColStd_HSequenceOfInteger)& theSeqMember) const;
Handle(TColStd_HSequenceOfHAsciiString) myNames;
Handle(Express_HSequenceOfItem) myItems;
Handle(Express_HSequenceOfItem) myItems;
};
#endif // _Express_Select_HeaderFile

View File

@@ -18,32 +18,20 @@
IMPLEMENT_STANDARD_RTTIEXT(Express_String, Express_PredefinedType)
//=======================================================================
// function : Express_String
// purpose :
//=======================================================================
//=================================================================================================
Express_String::Express_String()
{
}
Express_String::Express_String() {}
//=======================================================================
// function : CPPName
// purpose :
//=======================================================================
//=================================================================================================
const TCollection_AsciiString Express_String::CPPName() const
{
return "TCollection_HAsciiString";
}
//=======================================================================
// function : IsStandard
// purpose :
//=======================================================================
//=================================================================================================
Standard_Boolean Express_String::IsStandard() const
{
return Standard_False;
}

View File

@@ -24,7 +24,6 @@ class Express_String : public Express_PredefinedType
{
public:
//! Empty constructor
Standard_EXPORT Express_String();
@@ -37,9 +36,7 @@ public:
DEFINE_STANDARD_RTTIEXT(Express_String, Express_PredefinedType)
protected:
private:
};
#endif // _Express_String_HeaderFile

View File

@@ -17,60 +17,38 @@
IMPLEMENT_STANDARD_RTTIEXT(Express_Type, Standard_Transient)
//=======================================================================
// function : Express_Type
// purpose :
//=======================================================================
//=================================================================================================
Express_Type::Express_Type()
{
}
Express_Type::Express_Type() {}
//=======================================================================
// function : IsStandard
// purpose :
//=======================================================================
//=================================================================================================
Standard_Boolean Express_Type::IsStandard() const
{
return Standard_False;
}
//=======================================================================
// function : IsSimple
// purpose :
//=======================================================================
//=================================================================================================
Standard_Boolean Express_Type::IsSimple() const
{
return IsStandard();
}
//=======================================================================
// function : IsHandle
// purpose :
//=======================================================================
//=================================================================================================
Standard_Boolean Express_Type::IsHandle() const
{
return !IsSimple();
}
//=======================================================================
// function : Use
// purpose :
//=======================================================================
//=================================================================================================
Standard_Boolean Express_Type::Use() const
{
return Standard_False;
}
//=======================================================================
// function : Use2
// purpose :
//=======================================================================
//=================================================================================================
void Express_Type::Use2 (const TCollection_AsciiString&, const TCollection_AsciiString&) const
{
}
void Express_Type::Use2(const TCollection_AsciiString&, const TCollection_AsciiString&) const {}

View File

@@ -24,7 +24,6 @@ class Express_Type : public Standard_Transient
{
public:
//! Returns CPP-style name of the type
Standard_EXPORT virtual const TCollection_AsciiString CPPName() const = 0;
@@ -47,17 +46,16 @@ 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 void Use2 (const TCollection_AsciiString& theRefName, const TCollection_AsciiString& theRefPack) const;
Standard_EXPORT virtual void Use2(const TCollection_AsciiString& theRefName,
const TCollection_AsciiString& theRefPack) const;
DEFINE_STANDARD_RTTIEXT(Express_Type, Standard_Transient)
protected:
//! Empty constructor
Standard_EXPORT Express_Type();
private:
};
#endif // _Express_Type_HeaderFile