Next part of formatting added files following OCCT Coding Rules.
// Load list of (class name, package name) from the file
// Package names and optional mark flag are set to items in the schema
-static Standard_Boolean LoadList (const char file[], const Handle(Express_Schema) schema,
- const Standard_Boolean mark)
+static Standard_Boolean LoadList(
+ const char file[],
+ const Handle(Express_Schema) schema,
+ const Standard_Boolean mark)
{
FILE *fd_pack = fopen ( file, "r" );
- if ( ! fd_pack ) {
+ if (!fd_pack)
+ {
std::cout << "Warning: cannot open " << file << std::endl;
return Standard_False;
}
std::cout << "Loading " << file << "..";
char string[200];
- while ( fgets ( string, 199, fd_pack ) ) {
- char *s = string, *name=0;
+ while (fgets(string, 199, fd_pack))
+ {
+ char *s = string, *name = 0;
Standard_Integer ind = 0;
- while ( *s && ! ( ind = strcspn ( s, " \t\r\n" ) ) ) s++;
- if ( ! *s ) continue;
+ while (*s && !(ind = strcspn(s, " \t\r\n")))
+ {
+ s++;
+ }
+ if (!*s)
+ {
+ continue;
+ }
name = s;
name[ind] = '\0';
- Handle(Express_Item) item = schema->Item ( name, Standard_True );
- if ( item.IsNull() ) continue; // silently skip any class name not in schema
+ Handle(Express_Item) item = schema->Item(name, Standard_True);
+ if (item.IsNull())
+ {
+ continue; // silently skip any class name not in schema
+ }
s += ind + 1;
- while ( *s && ! ( ind = strcspn ( s, " \t\r\n" ) ) ) s++;
- if ( ! *s ) continue;
+ while (*s && !(ind = strcspn(s, " \t\r\n")))
+ {
+ s++;
+ }
+ if (!*s)
+ {
+ continue;
+ }
s[ind] = '\0';
- Handle(TCollection_HAsciiString) pack = new TCollection_HAsciiString ( s );
- if ( ! item->GetPackageName().IsNull() && item->GetPackageName()->IsDifferent ( pack ) ) {
+ Handle(TCollection_HAsciiString) pack = new TCollection_HAsciiString(s);
+ if (!item->GetPackageName().IsNull() && item->GetPackageName()->IsDifferent(pack))
+ {
std::cout << "\nWarning: Package is redefined for item " << name << std::endl;
}
- item->SetPackageName ( pack );
- if ( mark ) item->SetMark ( Standard_True );
+ item->SetPackageName(pack);
+ if (mark)
+ {
+ item->SetMark(Standard_True);
+ }
//gka ----------------------------------------------
//filling additional field shortname for item
//and setting flags marked presence of methods Check and FillShared.
//fields in the text file situate in the next way:
//name package_name shortname check_flag(0 or 1) fillshared_flag(0 or 1)
-
+
s += ind + 1;
Handle(TCollection_HAsciiString) shortname = new TCollection_HAsciiString;
Standard_Boolean hasShortName = Standard_False;
- while ( *s && ! ( ind = strcspn ( s, " \t\r\n" ) ) ) s++;
- if ( ! *s ) continue;
+ while (*s && !(ind = strcspn(s, " \t\r\n")))
+ {
+ s++;
+ }
+ if (!*s)
+ {
+ continue;
+ }
s[ind] = '\0';
//set CheckFlag or shortname
- if(*s == '0' || *s == '1') {
+ if (*s == '0' || *s == '1')
+ {
Standard_Boolean hasCheck = (*s == '0' ? Standard_False : Standard_True);
item->SetCheckFlag(hasCheck);
}
- else {
- if(*s != '-')
- shortname->SetValue(1,s);
- if(shortname->Length() >0)
- item->SetShortName(shortname);
+ else
+ {
+ if (*s != '-')
+ {
+ shortname->SetValue(1, s);
+ }
+ if (shortname->Length() > 0)
+ {
+ item->SetShortName(shortname);
+ }
hasShortName = Standard_True;
}
-
+
s += ind + 1;
//set FillSharedFlag or shortname
- while ( *s && ! ( ind = strcspn ( s, " \t\r\n" ) ) ) s++;
- if ( ! *s ) continue;
+ while (*s && !(ind = strcspn(s, " \t\r\n")))
+ {
+ s++;
+ }
+ if (!*s)
+ {
+ continue;
+ }
s[ind] = '\0';
- if(!hasShortName) {
- if(*s == '0' || *s == '1') {
+ if (!hasShortName)
+ {
+ if (*s == '0' || *s == '1')
+ {
Standard_Boolean hasFillShared = (*s == '0' ? Standard_False : Standard_True);
item->SetFillSharedFlag(hasFillShared);
}
- else {
- if(*s != '-')
- shortname->SetValue(1,s);
- if(shortname->Length() >0)
+ else
+ {
+ if (*s != '-')
+ {
+ shortname->SetValue(1, s);
+ }
+ if (shortname->Length() > 0)
+ {
item->SetShortName(shortname);
+ }
hasShortName = Standard_True;
}
-
+
s += ind + 1;
//set short name
- while ( *s && ! ( ind = strcspn ( s, " \t\r\n" ) ) ) s++;
- if ( ! *s ) continue;
+ while (*s && !(ind = strcspn(s, " \t\r\n")))
+ {
+ s++;
+ }
+ if (!*s)
+ {
+ continue;
+ }
s[ind] = '\0';
}
- if(!hasShortName) {
- if(*s != '-')
- shortname->SetValue(1,s);
- if(shortname->Length() >0)
+ if (!hasShortName)
+ {
+ if (*s != '-')
+ {
+ shortname->SetValue(1, s);
+ }
+ if (shortname->Length() > 0)
+ {
item->SetShortName(shortname);
-
+ }
s += ind + 1;
//set Category
- while ( *s && ! ( ind = strcspn ( s, " \t\r\n" ) ) ) s++;
- if ( ! *s ) continue;
+ while (*s && !(ind = strcspn(s, " \t\r\n")))
+ {
+ s++;
+ }
+ if (!*s)
+ {
+ continue;
+ }
s[ind] = '\0';
}
Handle(TCollection_HAsciiString) category = new TCollection_HAsciiString;
- category->SetValue(1,s);
- if(category->Length()>0)
+ category->SetValue(1, s);
+ if (category->Length() > 0)
+ {
item->SetCategory(category);
+ }
//-----------------------------------------------------
-
-
}
std::cout << " Done" << std::endl;
-
- fclose ( fd_pack );
+
+ fclose(fd_pack);
return Standard_True;
}
// MAIN program
-Standard_Integer main ( const Standard_Integer argc, const char *argv[] )
+Standard_Integer main(const Standard_Integer argc, const char *argv[])
{
- if ( argc <2 ) {
+ if ( argc <2 )
+ {
std::cout << "EXPRESS -> CASCADE/XSTEP classes generator 3.0" << std::endl;
std::cout << "Use: ExpToCas <schema.exp> [<create.lst> [<packaging.lst> [start_index]]]" << std::endl;
std::cout << "Where: " << std::endl;
std::cout << " in the form of the list (one item per line) \"<TypeName> <Package>\"" << std::endl;
std::cout << " If package not defined for some type, \"StepStep\" assumed" << std::endl;
std::cout << "- start_index - a first number for auxiliary generated files with data" << std::endl;
- std::cout << " to copy into StepAP214_Protocol.cxx, RWStepAP214_GeneralModule.cxx and RWStepAP214_ReadWriteModule.cxx" << std::endl;
+ std::cout << " to copy into StepAP214_Protocol.cxx, RWStepAP214_GeneralModule.cxx and"
+ <<" RWStepAP214_ReadWriteModule.cxx" << std::endl;
return 0;
}
//=================================
// Step 1: parsing EXPRESS file
// open schema file
- FILE *fin = fopen ( argv[1], "rt" );
- if ( ! fin ) {
+ FILE *fin = fopen(argv[1], "rt");
+ if (!fin)
+ {
std::cout << "Error: Cannot open " << argv[1] << std::endl;
return 0;
}
// parse
std::cout << "Starting parsing " << argv[1] << std::endl;
- Handle(Express_Schema) schema = ec_parse ( fin );
- fclose ( fin );
+ Handle(Express_Schema) schema = ec_parse(fin);
+ fclose(fin);
- if ( schema.IsNull() ) {
+ if (schema.IsNull())
+ {
std::cout << "Error: Parsing finished with no result" << std::endl;
return 0;
}
- else std::cout << "Schema " << schema->Name()->ToCString() << " successfully parsed" << std::endl;
+ else
+ {
+ std::cout << "Schema " << schema->Name()->ToCString() << " successfully parsed" << std::endl;
+ }
//=================================
// Step 2: Prepare data for creating classes
-
+
// load packaging information
- if ( argc >3 ) {
- if ( ! LoadList ( argv[3], schema, Standard_False ) ) return 0;
+ if (argc > 3)
+ {
+ if (!LoadList(argv[3], schema, Standard_False))
+ {
+ return 0;
+ }
}
-
+
// load list of classes to generate
TColStd_SequenceOfInteger seq;
- if ( argc >2 ) {
- if ( argv[2][0] =='-' ) { // set mark for all items
- for ( Standard_Integer num=1; num <= schema->NbItems(); num++ )
- schema->Item ( num )->SetMark(Standard_True);
+ if (argc > 2)
+ {
+ if (argv[2][0] == '-')
+ { // set mark for all items
+ for (Standard_Integer num = 1; num <= schema->NbItems(); num++)
+ {
+ schema->Item(num)->SetMark(Standard_True);
+ }
+ }
+ else if (!LoadList(argv[2], schema, Standard_True))
+ {
+ return 0;
}
- else if ( ! LoadList ( argv[2], schema, Standard_True ) ) return 0;
}
Standard_Integer anIndex = -1;
if (argc > 4)
+ {
anIndex = atoi(argv[4]);
+ }
//=================================
// Step 3: Iterate by items and generate classes
Standard_Boolean done = Standard_False;
Standard_Integer nbgen = 0;
Express_Item::SetIndex(anIndex);
- do {
+ do
+ {
done = Standard_False;
- for ( Standard_Integer num=1; num <= schema->NbItems(); num++ ) {
- if ( ! schema->Item ( num )->GetMark() ) continue;
- nbgen += schema->Item ( num )->Generate();
+ for (Standard_Integer num = 1; num <= schema->NbItems(); num++)
+ {
+ if (!schema->Item(num)->GetMark())
+ {
+ continue;
+ }
+ nbgen += schema->Item(num)->Generate();
done = Standard_True;
-// std::cout << num << ": " << schema->Item(num)->CPPName()->ToCString() << std::endl;
+ //std::cout << num << ": " << schema->Item(num)->CPPName()->ToCString() << std::endl;
}
- } while ( done );
-// std::cout << "Finished; total " << nbgen << " classes generated" << std::endl;
+ } while (done);
+ //std::cout << "Finished; total " << nbgen << " classes generated" << std::endl;
return 1;
}
#ifdef _MSC_VER
//purpose :
//=======================================================================
-Handle(Express_Schema) &Express::Schema ()
+Handle(Express_Schema) &Express::Schema()
{
static Handle(Express_Schema) schema;
return schema;
//purpose : Write header of HXX or CXX file
//=======================================================================
-void Express::WriteFileStamp (Standard_OStream &os)
+void Express::WriteFileStamp(Standard_OStream &theOS)
{
static const char* EC_VERSION = "2.0";
timestring = ctime ( &curtime );
timestring.ChangeAll ( '\n', ' ' );
}
- os << comm << " Created on : " << timestring << std::endl;
+ theOS << comm << " Created on : " << timestring << std::endl;
OSD_Process aProcess;
- os << comm << " Created by: " << aProcess.UserName().ToCString() << std::endl;
- os << comm << " Generator: Express (EXPRESS -> CASCADE/XSTEP Translator) V" << EC_VERSION << std::endl;
- os << comm << " Copyright (c) Open CASCADE 2020" << std::endl;
- os << comm << std::endl;
- os << comm << " This file is part of Open CASCADE Technology software library." << std::endl;
- os << comm << std::endl;
- os << comm << " This library is free software; you can redistribute it and/or modify it under" << std::endl;
- os << comm << " the terms of the GNU Lesser General Public License version 2.1 as published" << std::endl;
- os << comm << " by the Free Software Foundation, with special exception defined in the file" << std::endl;
- os << comm << " OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT" << std::endl;
- os << comm << " distribution for complete text of the license and disclaimer of any warranty." << std::endl;
- os << comm << std::endl;
- os << comm << " Alternatively, this file may be used under the terms of Open CASCADE" << std::endl;
- os << comm << " commercial license or contractual agreement." << std::endl;
- os << std::endl;
+ theOS << comm << " Created by: " << aProcess.UserName().ToCString() << std::endl;
+ theOS << comm << " Generator: Express (EXPRESS -> CASCADE/XSTEP Translator) V" << EC_VERSION << std::endl;
+ theOS << comm << " Copyright (c) Open CASCADE 2020" << std::endl;
+ theOS << comm << std::endl;
+ theOS << comm << " This file is part of Open CASCADE Technology software library." << std::endl;
+ theOS << comm << std::endl;
+ theOS << comm << " This library is free software; you can redistribute it and/or modify it under" << std::endl;
+ theOS << comm << " the terms of the GNU Lesser General Public License version 2.1 as published" << std::endl;
+ theOS << comm << " by the Free Software Foundation, with special exception defined in the file" << std::endl;
+ theOS << comm << " OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT" << std::endl;
+ theOS << comm << " distribution for complete text of the license and disclaimer of any warranty." << std::endl;
+ theOS << comm << std::endl;
+ theOS << comm << " Alternatively, this file may be used under the terms of Open CASCADE" << std::endl;
+ theOS << comm << " commercial license or contractual agreement." << std::endl;
+ theOS << std::endl;
}
//=======================================================================
//purpose :
//=======================================================================
-void Express::WriteMethodStamp (Standard_OStream &os, const Handle(TCollection_HAsciiString) &name)
+void Express::WriteMethodStamp(Standard_OStream &theOS, const Handle(TCollection_HAsciiString) &theName)
{
- os << std::endl;
- os << "//=======================================================================" << std::endl;
- os << "//function : " << name->ToCString() << std::endl;
- os << "//purpose : " << std::endl;
- os << "//=======================================================================" << std::endl;
- os << std::endl;
+ theOS << std::endl;
+ theOS << "//=======================================================================" << std::endl;
+ theOS << "//function : " << theName->ToCString() << std::endl;
+ theOS << "//purptheOSe : " << std::endl;
+ theOS << "//=======================================================================" << std::endl;
+ theOS << std::endl;
}
//=======================================================================
//purpose :
//=======================================================================
-Handle(TCollection_HAsciiString) Express::ToStepName (const Handle(TCollection_HAsciiString) &name)
+Handle(TCollection_HAsciiString) Express::ToStepName(const Handle(TCollection_HAsciiString) &theName)
{
- Handle(TCollection_HAsciiString) stepname = new TCollection_HAsciiString(name);
+ Handle(TCollection_HAsciiString) stepname = new TCollection_HAsciiString(theName);
for (Standard_Integer i = 2; i <= stepname->Length(); i++)
{
if (isupper(stepname->Value(i)))
//purpose :
//=======================================================================
-Handle(TCollection_HAsciiString) Express::EnumPrefix (const Handle(TCollection_HAsciiString) &name)
+Handle(TCollection_HAsciiString) Express::EnumPrefix(const Handle(TCollection_HAsciiString) &theName)
{
Handle(TCollection_HAsciiString) stepname = new TCollection_HAsciiString;
- for (Standard_Integer i = 1; i <= name->Length(); i++)
+ for (Standard_Integer i = 1; i <= theName->Length(); i++)
{
- if (isupper(name->Value(i)))
+ if (isupper(theName->Value(i)))
{
- stepname->AssignCat(new TCollection_HAsciiString(name->Value(i)));
+ stepname->AssignCat(new TCollection_HAsciiString(theName->Value(i)));
}
}
stepname->LowerCase();
DEFINE_STANDARD_ALLOC
//! Returns (modifiable) handle to static schema object
- Standard_EXPORT static Handle(Express_Schema)& Schema() ;
+ Standard_EXPORT static Handle(Express_Schema)& Schema();
//! Writes standard copyright stamp (creation date/time, user, etc.)
- Standard_EXPORT static void WriteFileStamp (Standard_OStream& os) ;
+ Standard_EXPORT static void WriteFileStamp (Standard_OStream& theOS);
//! Writes standard comment for method in CXX file
- Standard_EXPORT static void WriteMethodStamp (Standard_OStream& os, const Handle(TCollection_HAsciiString)& name) ;
+ Standard_EXPORT static void WriteMethodStamp (Standard_OStream& theOS,
+ const Handle(TCollection_HAsciiString)& theName);
//! Converts item name from CASCADE to STEP style
//! e.g. BoundedCurve -> bounded_curve
- Standard_EXPORT static Handle(TCollection_HAsciiString) ToStepName (const Handle(TCollection_HAsciiString)& name) ;
+ Standard_EXPORT static Handle(TCollection_HAsciiString) ToStepName (const Handle(TCollection_HAsciiString)& theName);
//! Converts item name from CASCADE to STEP style
//! e.g. BoundedCurve -> bounded_curve
- Standard_EXPORT static Handle(TCollection_HAsciiString) EnumPrefix (const Handle(TCollection_HAsciiString)& name) ;
+ Standard_EXPORT static Handle(TCollection_HAsciiString) EnumPrefix (const Handle(TCollection_HAsciiString)& theName);
};
#endif // _Express_HeaderFile
//purpose :
//=======================================================================
-Express_Alias::Express_Alias(const Standard_CString name, const Handle(Express_Type) &type)
- : Express_Item(name), myType(type)
+Express_Alias::Express_Alias(const Standard_CString theName, const Handle(Express_Type) &theType)
+ : Express_Item(theName), myType(theType)
{
}
//purpose :
//=======================================================================
-const Handle(Express_Type) &Express_Alias::Type () const
+const Handle(Express_Type) &Express_Alias::Type() const
{
return myType;
}
//purpose :
//=======================================================================
-Handle(TCollection_HAsciiString) Express_Alias::CPPName () const
+Handle(TCollection_HAsciiString) Express_Alias::CPPName() const
{
return myType->CPPName();
}
//purpose :
//=======================================================================
-Standard_Boolean Express_Alias::GenerateClass () const
+Standard_Boolean Express_Alias::GenerateClass() const
{
//std::cout << "Warning: writing ALIAS is not yet implemented, cannot generate " << Name()->ToCString() << std::endl;
std::cout << "ALIAS " << Name()->ToCString() << " = " << Type()->CPPName()->ToCString()
public:
//! Create ALIAS item and initialize it
- Standard_EXPORT Express_Alias(const Standard_CString name, const Handle(Express_Type)& type);
+ Standard_EXPORT Express_Alias(const Standard_CString theName, const Handle(Express_Type)& theType);
//! Returns aliased type
Standard_EXPORT const Handle(Express_Type)& Type() const;
Handle(TCollection_HAsciiString) Express_Boolean::CPPName () const
{
- return new TCollection_HAsciiString ( "Standard_Boolean" );
+ return new TCollection_HAsciiString("Standard_Boolean");
}
//purpose :
//=======================================================================
-Express_ComplexType::Express_ComplexType (
- const Standard_Integer imin,
- const Standard_Integer imax,
- const Handle(Express_Type) &type)
+Express_ComplexType::Express_ComplexType(
+ const Standard_Integer theImin,
+ const Standard_Integer theImax,
+ const Handle(Express_Type) &theType)
{
- myMin = imin;
- myMax = imax;
- myType = type;
+ myMin = theImin;
+ myMax = theImax;
+ myType = theType;
}
//=======================================================================
//purpose :
//=======================================================================
-const Handle(Express_Type) &Express_ComplexType::Type () const
+const Handle(Express_Type) &Express_ComplexType::Type() const
{
return myType;
}
//purpose :
//=======================================================================
-Handle(TCollection_HAsciiString) Express_ComplexType::CPPName () const
+Handle(TCollection_HAsciiString) Express_ComplexType::CPPName() const
{
// check if array 2
- Handle(Express_Type) type = myType;
- if (type->IsKind(STANDARD_TYPE(Express_ComplexType)))
+ Handle(Express_Type) aType = myType;
+ if (aType->IsKind(STANDARD_TYPE(Express_ComplexType)))
{
- Handle(Express_ComplexType) c2 = Handle(Express_ComplexType)::DownCast(type);
- type = c2->Type();
+ Handle(Express_ComplexType) c2 = Handle(Express_ComplexType)::DownCast(aType);
+ aType = c2->Type();
}
// parse name of array argument
- Handle(TCollection_HAsciiString) name = type->CPPName();
- Standard_Integer split = name->Location(1, '_', 1, name->Length());
+ Handle(TCollection_HAsciiString) aName = aType->CPPName();
+ Standard_Integer split = aName->Location(1, '_', 1, aName->Length());
Handle(TCollection_HAsciiString) cls;
if (split)
{
- cls = name->Split(split);
+ cls = aName->Split(split);
}
else
{
- cls = name;
+ cls = aName;
}
Handle(TCollection_HAsciiString) str = new TCollection_HAsciiString("TCollection");
- Standard_Integer ind = name->Location(str, 1, name->Length());
+ Standard_Integer ind = aName->Location(str, 1, aName->Length());
if (ind)
{
- name = new TCollection_HAsciiString("Interface_");
+ aName = new TCollection_HAsciiString("Interface_");
}
// generate name
- if (type->IsStandard() || !split)
+ if (aType->IsStandard() || !split)
{
- name = new TCollection_HAsciiString("TColStd_");
+ aName = new TCollection_HAsciiString("TColStd_");
}
- if (type == myType)
+ if (aType == myType)
{
- name->AssignCat("HArray1Of");
+ aName->AssignCat("HArray1Of");
}
else
{
- name->AssignCat("HArray2Of");
+ aName->AssignCat("HArray2Of");
}
- name->AssignCat(cls);
- return name;
+ aName->AssignCat(cls);
+ return aName;
}
//=======================================================================
//=======================================================================
Standard_Boolean Express_ComplexType::Use(
- const Handle(TCollection_HAsciiString) &pack,
- const Standard_Boolean defer) const
+ const Handle(TCollection_HAsciiString) &thePack,
+ const Standard_Boolean theDefer) const
{
- return myType->Use ( pack, defer );
+ return myType->Use(thePack, theDefer);
}
//! Creates an object and initializes fields
Standard_EXPORT Express_ComplexType(
- const Standard_Integer imin,
- const Standard_Integer imax,
- const Handle(Express_Type)& type);
+ 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;
//! Declares type as used by some item being generated.
//! Calls Use() for type of elements
Standard_EXPORT virtual Standard_Boolean Use(
- const Handle(TCollection_HAsciiString)& pack,
- const Standard_Boolean defer = Standard_False) const Standard_OVERRIDE;
+ const Handle(TCollection_HAsciiString)& thePack,
+ const Standard_Boolean theDefer = Standard_False) const Standard_OVERRIDE;
DEFINE_STANDARD_RTTIEXT(Express_ComplexType,Express_Type)
//=======================================================================
Express_Entity::Express_Entity(
- const Standard_CString name,
- const Handle(TColStd_HSequenceOfHAsciiString) &inherit,
- const Handle(Express_HSequenceOfField) &flds)
- : Express_Item(name), mySupers(inherit), myFields(flds)
+ const Standard_CString theName,
+ const Handle(TColStd_HSequenceOfHAsciiString)& theInherit,
+ const Handle(Express_HSequenceOfField)& theFields)
+ : Express_Item(theName), mySupers(theInherit), myFields(theFields)
{
// make empty lists to avoid checking every time
myInherit = new Express_HSequenceOfEntity;
//purpose :
//=======================================================================
-const Handle(TColStd_HSequenceOfHAsciiString) &Express_Entity::SuperTypes () const
+const Handle(TColStd_HSequenceOfHAsciiString)& Express_Entity::SuperTypes() const
{
return mySupers;
}
//purpose :
//=======================================================================
-const Handle(Express_HSequenceOfEntity) &Express_Entity::Inherit () const
+const Handle(Express_HSequenceOfEntity)& Express_Entity::Inherit() const
{
return myInherit;
}
//purpose :
//=======================================================================
-const Handle(Express_HSequenceOfField) &Express_Entity::Fields () const
+const Handle(Express_HSequenceOfField)& Express_Entity::Fields () const
{
return myFields;
}
//purpose :
//=======================================================================
-Standard_Integer Express_Entity::NbFields (const Standard_Boolean inherited) const
+Standard_Integer Express_Entity::NbFields(const Standard_Boolean theInherited) const
{
Standard_Integer num = myFields->Length();
- if (inherited)
+ if (theInherited)
{
for (Standard_Integer i = 1; i <= myInherit->Length(); i++)
{
- num += myInherit->Value(i)->NbFields(inherited);
+ num += myInherit->Value(i)->NbFields(theInherited);
}
}
return num;
//purpose :
//=======================================================================
-static void WriteGetMethod(
+static void writeGetMethod(
Standard_OStream &os,
const Handle(TCollection_HAsciiString) name,
const Handle(TCollection_HAsciiString) field,
//purpose :
//=======================================================================
-static void WriteSetMethod(
+static void writeSetMethod(
Standard_OStream &os,
const Handle(TCollection_HAsciiString) name,
const Handle(TCollection_HAsciiString) field,
//purpose :
//=======================================================================
-static inline void WriteSpaces (Standard_OStream &os, Standard_Integer num)
+static inline void writeSpaces (Standard_OStream &os, Standard_Integer num)
{
for (Standard_Integer i = 0; i < num; i++) os << " ";
}
// Step 1: generating HXX
// Open HXX file
- std::ofstream os ( pack.Cat ( ".hxx" ).ToCString() );
+ std::ofstream os(pack.Cat(".hxx").ToCString());
// write header
- Express::WriteFileStamp ( os );
+ Express::WriteFileStamp(os);
Handle(TCollection_HAsciiString) InheritName = new TCollection_HAsciiString("Standard_Transient");
if (myInherit->Length() > 0)
// write includes section (also creates all used types)
DataMapOfStringInteger dict;
- WriteIncludes(os, dict);
+ writeIncludes(os, dict);
os << std::endl;
os << "DEFINE_STANDARD_HANDLE(" << CPPname->ToCString() << ", " << InheritName->ToCString() << ")" << std::endl;
if ( myInherit->Length() > 1 || myFields->Length() > 0 ) {
os << " //! Initialize all fields (own and inherited)" << std::endl;
os << " Standard_EXPORT void Init(";
- MakeInit ( os, 28, Standard_True, 0 );
+ makeInit(os, 28, Standard_True, 0);
os << ");" << std::endl;
os << std::endl;
}
// write methods Get/Set
- for ( Standard_Integer i=2; i <= myInherit->Length(); i++ ) {
+ for (Standard_Integer i = 2; i <= myInherit->Length(); i++)
+ {
Handle(Express_Entity) it = myInherit->Value(i);
Handle(TCollection_HAsciiString) name = it->Name();
os << " //! Returns data for supertype " << name->ToCString() << std::endl;
<< " (const Handle(" << it->CPPName()->ToCString() << ")& the"<< name->ToCString() << ");" << std::endl;
os << std::endl;
}
- for (Standard_Integer i = 1; i <= myFields->Length(); i++) {
+ for (Standard_Integer i = 1; i <= myFields->Length(); i++)
+ {
Handle(Express_Field) field = myFields->Value(i);
os << " //! Returns field " << field->Name()->ToCString() << std::endl;
if (field->Type()->IsHandle())
+ {
os << " Standard_EXPORT Handle(" << field->Type()->CPPName()->ToCString() << ") "
- << field->Name()->ToCString() << "() const;" << std::endl;
+ << field->Name()->ToCString() << "() const;" << std::endl;
+ }
else
+ {
os << " Standard_EXPORT " << field->Type()->CPPName()->ToCString() << " "
- << field->Name()->ToCString() << "() const;" << std::endl;
+ << field->Name()->ToCString() << "() const;" << std::endl;
+ }
os << " //! Sets field " << field->Name()->ToCString() << std::endl;
if (field->Type()->IsHandle())
+ {
os << " Standard_EXPORT void Set" << field->Name()->ToCString() << " (const Handle("
<< field->Type()->CPPName()->ToCString() << ")& the" << field->Name()->ToCString() << ");" << std::endl;
+ }
else
+ {
os << " Standard_EXPORT void Set" << field->Name()->ToCString() << " (const "
- << field->Type()->CPPName()->ToCString() << " the" << field->Name()->ToCString() << ");" << std::endl;
- if (field->IsOptional()) {
+ << field->Type()->CPPName()->ToCString() << " the" << field->Name()->ToCString() << ");" << std::endl;
+ }
+ if (field->IsOptional())
+ {
os << " //! Returns True if optional field " << field->Name()->ToCString() << " is defined" << std::endl;
os << " Standard_EXPORT Standard_Boolean Has" << field->Name()->ToCString() << "() const;" << std::endl;
}
os << std::endl;
// write fields section
- if ( myInherit->Length() >1 || myFields->Length() >0 )
+ if (myInherit->Length() > 1 || myFields->Length() > 0)
{
os << "private:" << std::endl << std::endl;
for (Standard_Integer i = 2; i <= myInherit->Length(); i++)
{
continue;
}
- os << " Standard_Boolean def" << field->Name()->ToCString() << "; //!< flag \"is " <<
+ os << " Standard_Boolean myHas" << field->Name()->ToCString() << "; //!< flag \"is " <<
field->Name()->ToCString() << " defined\"" << std::endl;
}
os << std::endl;
// Step 2: generating CXX
// Open CXX file
- os.open ( pack.Cat ( ".cxx" ).ToCString() );
+ os.open(pack.Cat(".cxx").ToCString());
// write header
- Express::WriteFileStamp ( os );
+ Express::WriteFileStamp(os);
// write include section
os << "#include <" << CPPname->ToCString() << ".hxx>" << std::endl;
for (Standard_Integer i = 1; i <= myFields->Length(); i++)
{
Handle(Express_Field) field = myFields->Value(i);
- if (field->IsOptional()) os << " def" << field->Name()->ToCString() << " = Standard_False;" << std::endl;
+ if (field->IsOptional()) os << " myHas" << field->Name()->ToCString() << " = Standard_False;" << std::endl;
}
os << "}" << std::endl;
{
Express::WriteMethodStamp(os, new TCollection_HAsciiString("Init"));
os << "void " << CPPname->ToCString() << "::Init (";
- MakeInit(os, 13 + CPPname->Length(), Standard_True, 1);
+ makeInit(os, 13 + CPPname->Length(), Standard_True, 1);
os << ")\n{";
- MakeInit(os, -2, Standard_True, 3);
+ makeInit(os, -2, Standard_True, 3);
os << "\n}" << std::endl;
}
for (Standard_Integer i = 2; i <= myInherit->Length(); i++)
{
Handle(Express_Entity) it = myInherit->Value(i);
- WriteGetMethod(os, CPPname, it->Name(), it->CPPName(), Standard_True, Standard_False);
- WriteSetMethod(os, CPPname, it->Name(), it->CPPName(), Standard_True, Standard_False);
+ writeGetMethod(os, CPPname, it->Name(), it->CPPName(), Standard_True, Standard_False);
+ writeSetMethod(os, CPPname, it->Name(), it->CPPName(), Standard_True, Standard_False);
}
for (Standard_Integer i = 1; i <= myFields->Length(); i++)
{
Handle(Express_Field) field = myFields->Value(i);
Handle(Express_Type) type = field->Type();
- WriteGetMethod(os, CPPname, field->Name(), type->CPPName(), type->IsHandle(), type->IsSimple());
- WriteSetMethod(os, CPPname, field->Name(), type->CPPName(), type->IsHandle(), type->IsSimple());
+ writeGetMethod(os, CPPname, field->Name(), type->CPPName(), type->IsHandle(), type->IsSimple());
+ writeSetMethod(os, CPPname, field->Name(), type->CPPName(), type->IsHandle(), type->IsSimple());
if (!field->IsOptional())
{
continue;
method->AssignCat(field->Name());
Express::WriteMethodStamp(os, method);
os << "Standard_Boolean " << CPPname->ToCString() << "::" << method->ToCString() << " () const" << std::endl;
- os << "{" << std::endl << " return def" << field->Name()->ToCString() << ";\n}" << std::endl;
+ os << "{" << std::endl << " return myHas" << field->Name()->ToCString() << ";\n}" << std::endl;
}
// close
// Step 4: generating CXX for Read/Write tool
// Open CXX file
- os.open ( pack.Cat ( ".cxx" ).ToCString() );
+ os.open(pack.Cat(".cxx").ToCString());
// write header
- Express::WriteFileStamp ( os );
+ Express::WriteFileStamp(os);
// write include section
os << "#include <" << RWCPPName->ToCString() << ".hxx>" << std::endl;
os << "#include <Interface_EntityIterator.hxx>" << std::endl;
os << "#include <StepData_StepReaderData.hxx>" << std::endl;
os << "#include <StepData_StepWriter.hxx>" << std::endl;
- WriteRWInclude ( os, dict );
+ writeRWInclude(os, dict);
// write constructor
Express::WriteMethodStamp ( os, RWCPPName );
os << RWCPPName->ToCString() << "::" << RWCPPName->ToCString() << "() {}" << std::endl << std::endl;
if (RWCPPName->Length() < 40)
{
os << "void " << RWCPPName->ToCString() << "::ReadStep (const Handle(StepData_StepReaderData)& data," << std::endl;
- WriteSpaces(os, 17 + RWCPPName->Length());
+ writeSpaces(os, 17 + RWCPPName->Length());
os << "const Standard_Integer num," << std::endl;
- WriteSpaces(os, 17 + RWCPPName->Length());
+ writeSpaces(os, 17 + RWCPPName->Length());
os << "Handle(Interface_Check)& ach," << std::endl;
- WriteSpaces(os, 17 + RWCPPName->Length());
+ writeSpaces(os, 17 + RWCPPName->Length());
os << "const Handle(" << CPPname->ToCString() << ")& ent) const" << std::endl;
}
else
os << " {" << std::endl;
os << " return;" << std::endl;
os << " }" << std::endl;
- WriteRWReadCode(os, 1, Standard_True); // write code for reading inherited and own fields
+ writeRWReadCode(os, 1, Standard_True); // write code for reading inherited and own fields
os << std::endl;
os << " // Initialize entity" << std::endl;
os << " ent->Init(";
- MakeInit ( os, 12, Standard_True, 4 );
+ makeInit(os, 12, Standard_True, 4);
os << ");\n}" << std::endl;
// write method WriteStep
- Express::WriteMethodStamp ( os, new TCollection_HAsciiString ( "WriteStep" ) );
+ Express::WriteMethodStamp(os, new TCollection_HAsciiString("WriteStep"));
if (RWCPPName->Length() < 40)
{
os << "void " << RWCPPName->ToCString() << "::WriteStep (StepData_StepWriter& SW," << std::endl;
- WriteSpaces(os, 18 + RWCPPName->Length());
+ writeSpaces(os, 18 + RWCPPName->Length());
os << "const Handle(" << CPPname->ToCString() << ")& ent) const" << std::endl;
}
else
}
os << "{" << std::endl;
- WriteRWWriteCode(os, 0, Standard_True); // write code for writing inherited and own fields
+ writeRWWriteCode(os, 0, Standard_True); // write code for writing inherited and own fields
os << "}" << std::endl;
// write method Share
- Express::WriteMethodStamp ( os, new TCollection_HAsciiString ( "Share" ) );
+ Express::WriteMethodStamp(os, new TCollection_HAsciiString("Share"));
if (RWCPPName->Length() < 40)
{
os << "void " << RWCPPName->ToCString() << "::Share (const Handle(" << CPPname->ToCString() << ")& ent," << std::endl;
- WriteSpaces(os, 14 + RWCPPName->Length());
+ writeSpaces(os, 14 + RWCPPName->Length());
os << "Interface_EntityIterator& iter) const" << std::endl;
}
else
os << " Interface_EntityIterator& iter) const" << std::endl;
}
os << "{" << std::endl;
- WriteRWShareCode ( os, 1, Standard_True ); // write code for filling graph of references
+ writeRWShareCode ( os, 1, Standard_True ); // write code for filling graph of references
os << "}" << std::endl;
if(CheckFlag())
{
Express::WriteMethodStamp(os, new TCollection_HAsciiString("Check"));
os << "void " << RWCPPName->ToCString() << "::Check(const Handle(Standard_Transient)& entt," << std::endl;
- WriteSpaces ( os, 18 + RWCPPName->Length() );
+ writeSpaces ( os, 18 + RWCPPName->Length() );
os << "const Interface_ShareTool& shares,"<< std::endl;
- WriteSpaces ( os, 18 + RWCPPName->Length() );
+ writeSpaces ( os, 18 + RWCPPName->Length() );
os << "Interface_Check& check) const"<< std::endl;
os << "{" << std::endl;
//DownCast entity to it's type
{
Express::WriteMethodStamp(os, new TCollection_HAsciiString("FillShared"));
os << "void " << RWCPPName->ToCString() << "::Share(const Handle(Interface_InterfaceModel)& model," << std::endl;
- WriteSpaces(os, 18 + RWCPPName->Length());
+ writeSpaces(os, 18 + RWCPPName->Length());
os << "const Handle(Standard_Transient)& entt," << std::endl;
- WriteSpaces(os, 18 + RWCPPName->Length());
+ writeSpaces(os, 18 + RWCPPName->Length());
os << "Interface_EntityIterator& iter) const" << std::endl;
os << "{" << std::endl;
//DownCast entity to it's type
//purpose :
//=======================================================================
-Standard_Boolean Express_Entity::WriteIncludes(
- Standard_OStream &os,
- DataMapOfStringInteger &dict) const
+Standard_Boolean Express_Entity::writeIncludes(
+ Standard_OStream& theOs,
+ DataMapOfStringInteger& theDict) const
{
for (Standard_Integer i = 1; i <= myInherit->Length(); i++)
{
Handle(Express_Entity) it = myInherit->Value(i);
- it->WriteIncludes(os, dict);
+ it->writeIncludes(theOs, theDict);
if (i <= 1)
{
continue;
}
- if (dict.IsBound(it->CPPName()->String()))
+ if (theDict.IsBound(it->CPPName()->String()))
{
continue; // avoid duplicating
}
- dict.Bind(it->CPPName()->String(), 1);
+ theDict.Bind(it->CPPName()->String(), 1);
it->Use(GetPackageName());
- os << "#include <" << it->CPPName()->ToCString() << ".hxx>" << std::endl;
+ theOs << "#include <" << it->CPPName()->ToCString() << ".hxx>" << std::endl;
}
for (Standard_Integer i = 1; i <= myFields->Length(); i++)
{
Handle(Express_Type) type = myFields->Value(i)->Type();
- if (dict.IsBound(type->CPPName()->String()))
+ if (theDict.IsBound(type->CPPName()->String()))
{
continue; // avoid duplicating
}
- dict.Bind(type->CPPName()->String(), 1);
+ theDict.Bind(type->CPPName()->String(), 1);
type->Use(GetPackageName());
if (type->IsStandard())
{
continue;
}
- os << "#include <" << type->CPPName()->ToCString() << ".hxx>" << std::endl;
+ theOs << "#include <" << type->CPPName()->ToCString() << ".hxx>" << std::endl;
}
return Standard_True;
}
//purpose :
//=======================================================================
-void Express_Entity::WriteRWInclude (Standard_OStream &os, DataMapOfStringInteger &dict) const
+void Express_Entity::writeRWInclude (Standard_OStream& theOs, DataMapOfStringInteger& theDict) const
{
for (Standard_Integer i = 1; i <= myInherit->Length(); i++)
{
Handle(Express_Entity) it = myInherit->Value(i);
if (i > 1)
{ // include HXX for base classes which are implemented as fields
- os << "#include <" << it->CPPName()->ToCString() << ".hxx>" << std::endl;
+ theOs << "#include <" << it->CPPName()->ToCString() << ".hxx>" << std::endl;
}
- it->WriteRWInclude(os, dict);
+ it->writeRWInclude(theOs, theDict);
}
for (Standard_Integer i = 1; i <= myFields->Length(); i++)
{
Handle(Express_Type) type = myFields->Value(i)->Type();
for (Standard_Integer deep = 0; deep < 10; deep++)
{
- if (dict.IsBound(type->CPPName()->String()))
+ if (theDict.IsBound(type->CPPName()->String()))
{
break; // avoid duplicating
}
- dict.Bind(type->CPPName()->String(), 1);
- os << "#include <" << type->CPPName()->ToCString() << ".hxx>" << std::endl;
+ theDict.Bind(type->CPPName()->String(), 1);
+ theOs << "#include <" << type->CPPName()->ToCString() << ".hxx>" << std::endl;
Handle(Express_ComplexType) complex = Handle(Express_ComplexType)::DownCast(type);
if (complex.IsNull())
//purpose : auxilary for WriteRWReadField
//=======================================================================
-static Handle(TCollection_HAsciiString) typeToSTEPName (const Handle(Express_Type) &type)
+static Handle(TCollection_HAsciiString) typeToSTEPName(const Handle(Express_Type)& theType)
{
- Handle(TCollection_HAsciiString) cppname = type->CPPName();
- Handle(TCollection_HAsciiString) cls = cppname->Token ( "_", 2 );
+ Handle(TCollection_HAsciiString) cppname = theType->CPPName();
+ Handle(TCollection_HAsciiString) cls = cppname->Token("_", 2);
if (cls->Length() < 1)
{
cls = cppname;
//purpose :
//=======================================================================
-static void WriteRWReadField(
- Standard_OStream &os,
+static void writeRWReadField(
+ Standard_OStream& theOs,
const Standard_CString index,
const Standard_CString STEPName,
const Standard_CString varname,
- const Handle(Express_Type) &vartype,
+ const Handle(Express_Type)& vartype,
const Standard_Integer lev,
const Standard_Boolean optional)
{
// indent
- TCollection_AsciiString shift ( " " );
+ TCollection_AsciiString shift(" ");
Standard_Integer level = 0;
for (; level < lev; level++)
{
level += 2;
// name of variable identifying number of parameter in data
- TCollection_AsciiString param ( "num" );
+ TCollection_AsciiString param("num");
if (lev > 0)
{
param += TCollection_AsciiString(lev);
// declare variable
if (type->IsHandle())
{
- os << shift << "Handle(" << type->CPPName()->ToCString() << ") a";
+ theOs << shift << "Handle(" << type->CPPName()->ToCString() << ") a";
}
else
{
- os << shift << type->CPPName()->ToCString() << " a";
+ theOs << shift << type->CPPName()->ToCString() << " a";
}
- os << varname << ";" << std::endl;
+ theOs << varname << ";" << std::endl;
if (optional)
{
- os << shift << "Standard_Boolean has" << varname << " = Standard_True;" << std::endl;
- os << shift << "if (data->IsParamDefined(" << param << ", " << index << "))" << std::endl;
- os << shift << "{" << std::endl;
+ theOs << shift << "Standard_Boolean has" << varname << " = Standard_True;" << std::endl;
+ theOs << shift << "if (data->IsParamDefined(" << param << ", " << index << "))" << std::endl;
+ theOs << shift << "{" << std::endl;
shift += " ";
level++;
}
Handle(Express_NamedType) named = Handle(Express_NamedType)::DownCast(type);
if (named->Item()->IsKind(STANDARD_TYPE(Express_Entity)))
{
- os << shift << "data->ReadEntity(" << param << ", " << index << ", \"" << STEPName << "\", ach," << std::endl;
- os << shift << " STANDARD_TYPE(" << named->CPPName()->ToCString() << "), a" << varname << ");" << std::endl;
+ theOs << shift << "data->ReadEntity(" << param << ", " << index << ", \"" << STEPName << "\", ach," << std::endl;
+ theOs << shift << " STANDARD_TYPE(" << named->CPPName()->ToCString() << "), a" << varname << ");" << std::endl;
}
else if (named->Item()->IsKind(STANDARD_TYPE(Express_Select)))
{
- os << shift << "data->ReadEntity(" << param << ", " << index << ", \"" << STEPName <<
+ theOs << shift << "data->ReadEntity(" << param << ", " << index << ", \"" << STEPName <<
"\", ach, a" << varname << ");" << std::endl;
}
else if (named->Item()->IsKind(STANDARD_TYPE(Express_Enum)))
{
- os << shift << "if (data->ParamType(" << param << ", " <<
+ theOs << shift << "if (data->ParamType(" << param << ", " <<
index << ") == Interface_ParamEnum)" << std::endl;
- os << shift << "{" << std::endl;
- os << shift << " Standard_CString text = data->ParamCValue(" <<
+ theOs << shift << "{" << std::endl;
+ theOs << shift << " Standard_CString text = data->ParamCValue(" <<
param << ", " << index << ");" << std::endl;
Handle(Express_Enum) en = Handle(Express_Enum)::DownCast(named->Item());
Handle(TCollection_HAsciiString) prefix = Express::EnumPrefix(en->Name());
{
Handle(TCollection_HAsciiString) ename = Express::ToStepName(names->Value(i));
ename->UpperCase();
- os << shift << (i == 1 ? " if " : " else if") <<
+ theOs << shift << (i == 1 ? " if " : " else if") <<
" (strcmp(text, \"." << ename->ToCString() << ".\")) a" <<
varname << " = " << enpack.ToCString() << "_" << prefix->ToCString() <<
names->Value(i)->ToCString() << ";" << std::endl;
}
- os << shift << " else" << std::endl;
- os << shift << " {" << std::endl;
- os << shift << " ach->AddFail(\"Parameter #" << index << " (" << STEPName
+ theOs << shift << " else" << std::endl;
+ theOs << shift << " {" << std::endl;
+ theOs << shift << " ach->AddFail(\"Parameter #" << index << " (" << STEPName
<< ") has not allowed value\");" << std::endl;
- os << shift << " }" << std::endl;
- os << shift << "}" << std::endl;
- os << shift << "else" << std::endl;
- os << shift << "{" << std::endl;
- os << shift << " ach->AddFail(\"Parameter #" << index << " (" << STEPName
+ theOs << shift << " }" << std::endl;
+ theOs << shift << "}" << std::endl;
+ theOs << shift << "else" << std::endl;
+ theOs << shift << "{" << std::endl;
+ theOs << shift << " ach->AddFail(\"Parameter #" << index << " (" << STEPName
<< ") is not enumeration\");" << std::endl;
- os << shift << "}" << std::endl;
- //os << "!!! READING/WRITING ENUM NOT IMPLEMENTED !!!" << std::endl;
+ theOs << shift << "}" << std::endl;
+ //theOs << "!!! READING/WRITING ENUM NOT IMPLEMENTED !!!" << std::endl;
//std::cout << "Warning: Reading/Writing ENUMERATION not yet implemented (" <<
//STEPName << ", " << varname << ", " << type->CPPName()->ToCString() << ")" << std::endl;
}
else if (type->IsKind(STANDARD_TYPE(Express_ComplexType)))
{
Handle(Express_ComplexType) complex = Handle(Express_ComplexType)::DownCast(type);
- os << shift << "Standard_Integer sub" << index << " = 0;" << std::endl;
- os << shift << "if (data->ReadSubList(" << param << ", " << index << ", \"" <<
+ theOs << shift << "Standard_Integer sub" << index << " = 0;" << std::endl;
+ theOs << shift << "if (data->ReadSubList(" << param << ", " << index << ", \"" <<
STEPName << "\", ach, sub" << index << "))" << std::endl;
- os << shift << "{" << std::endl;
- os << shift << " Standard_Integer nb" << lev << " = data->NbParams(sub" << index << ");" << std::endl;
+ theOs << shift << "{" << std::endl;
+ theOs << shift << " Standard_Integer nb" << lev << " = data->NbParams(sub" << index << ");" << std::endl;
TCollection_AsciiString iter = lev;
iter.Prepend("i");
TCollection_AsciiString var = lev;
Handle(Express_ComplexType) complex2 = Handle(Express_ComplexType)::DownCast(complex->Type());
TCollection_AsciiString jter = lev;
jter.Prepend("j");
- os << shift << " Standard_Integer nbj" << lev <<
+ theOs << shift << " Standard_Integer nbj" << lev <<
" = data->NbParams(data->ParamNumber(sub" << index << ",1));" << std::endl;
- os << shift << " a" << varname << " = new " << type->CPPName()->ToCString() <<
+ theOs << shift << " a" << varname << " = new " << type->CPPName()->ToCString() <<
"(1, nb" << lev << ", 1, nbj" << lev << ");" << std::endl;
- os << shift << " for (Standard_Integer " << iter << " = 1; " << iter << " <= nb"
+ theOs << shift << " for (Standard_Integer " << iter << " = 1; " << iter << " <= nb"
<< lev << "; " << iter << "++)" << std::endl;
- os << shift << " {" << std::endl;
- os << shift << " Standard_Integer subj" << index << " = 0;" << std::endl;
- os << shift << " if ( data->ReadSubList (sub" << index << ", " << iter << ", \"sub-part(" <<
+ theOs << shift << " {" << std::endl;
+ theOs << shift << " Standard_Integer subj" << index << " = 0;" << std::endl;
+ theOs << shift << " if ( data->ReadSubList (sub" << index << ", " << iter << ", \"sub-part(" <<
STEPName << ")\", ach, subj" << index << ") ) {" << std::endl;
- os << shift << " Standard_Integer num" << level + 2 << " = subj" << index << ";" << std::endl;
- os << shift << " for (Standard_Integer " << jter << " = 1; " << jter << " <= nbj" << lev <<
+ theOs << shift << " Standard_Integer num" << level + 2 << " = subj" << index << ";" << std::endl;
+ theOs << shift << " for (Standard_Integer " << jter << " = 1; " << jter << " <= nbj" << lev <<
"; " << jter << "++)" << std::endl;
- os << shift << " {" << std::endl;
+ theOs << shift << " {" << std::endl;
Handle(TCollection_HAsciiString) subName = typeToSTEPName(complex2->Type());
- WriteRWReadField(os, jter.ToCString(), subName->ToCString(), var.ToCString(),
+ writeRWReadField(theOs, jter.ToCString(), subName->ToCString(), var.ToCString(),
complex2->Type(), level + 2, Standard_False);
- os << shift << " a" << varname << "->SetValue(" << iter << "," <<
+ theOs << shift << " a" << varname << "->SetValue(" << iter << "," <<
jter << ", a" << var << ");" << std::endl;
- os << shift << " }" << std::endl;
- os << shift << " }" << std::endl;
+ theOs << shift << " }" << std::endl;
+ theOs << shift << " }" << std::endl;
}
else
{ // simple array
- os << shift << " a" << varname << " = new " << type->CPPName()->ToCString() <<
+ theOs << shift << " a" << varname << " = new " << type->CPPName()->ToCString() <<
"(1, nb" << lev << ");" << std::endl;
- os << shift << " Standard_Integer num" << level << " = sub" << index << ";" << std::endl;
- os << shift << " for (Standard_Integer " << iter << " = 1; " << iter << " <= nb" << lev <<
+ theOs << shift << " Standard_Integer num" << level << " = sub" << index << ";" << std::endl;
+ theOs << shift << " for (Standard_Integer " << iter << " = 1; " << iter << " <= nb" << lev <<
"; " << iter << "++)" << std::endl;
- os << shift << " {" << std::endl;
+ theOs << shift << " {" << std::endl;
Handle(TCollection_HAsciiString) subName = typeToSTEPName(complex->Type());
- WriteRWReadField(os, iter.ToCString(), subName->ToCString(), var.ToCString(),
+ writeRWReadField(theOs, iter.ToCString(), subName->ToCString(), var.ToCString(),
complex->Type(), level, Standard_False);
- os << shift << " a" << varname << "->SetValue(" << iter << ", a" << var << ");" << std::endl;
+ theOs << shift << " a" << varname << "->SetValue(" << iter << ", a" << var << ");" << std::endl;
}
- os << shift << " }" << std::endl;
- os << shift << "}" << std::endl;
+ theOs << shift << " }" << std::endl;
+ theOs << shift << "}" << std::endl;
}
else if (type->IsKind(STANDARD_TYPE(Express_String)))
{
if (strlen(STEPName) + strlen(varname) < 70)
{
- os << shift << "data->ReadString(" << param << ", " << index << ", \"" << STEPName <<
+ theOs << shift << "data->ReadString(" << param << ", " << index << ", \"" << STEPName <<
"\", ach, a" << varname << ");" << std::endl;
}
else
{
- os << shift << "data->ReadString(" << param << ", " << index << ", \"" << STEPName << "\", ach," << std::endl;
- os << shift << " a" << varname << ");" << std::endl;
+ theOs << shift << "data->ReadString(" << param << ", " << index << ", \"" << STEPName << "\", ach," << std::endl;
+ theOs << shift << " a" << varname << ");" << std::endl;
}
}
else if (type->IsKind(STANDARD_TYPE(Express_Logical)))
{
- os << shift << "data->ReadLogical(" << param << ", " << index << ", \"" << STEPName <<
+ theOs << shift << "data->ReadLogical(" << param << ", " << index << ", \"" << STEPName <<
"\", ach, a" << varname << ");" << std::endl;
}
else if (type->IsKind(STANDARD_TYPE(Express_Boolean)))
{
- os << shift << "data->ReadBoolean(" << param << ", " << index << ", \"" << STEPName <<
+ theOs << shift << "data->ReadBoolean(" << param << ", " << index << ", \"" << STEPName <<
"\", ach, a" << varname << ");" << std::endl;
}
else if (type->IsKind(STANDARD_TYPE(Express_Number)) || type->IsKind(STANDARD_TYPE(Express_Integer)))
{
- os << shift << "data->ReadInteger(" << param << ", " << index << ", \"" << STEPName <<
+ theOs << shift << "data->ReadInteger(" << param << ", " << index << ", \"" << STEPName <<
"\", ach, a" << varname << ");" << std::endl;
}
else if (type->IsKind(STANDARD_TYPE(Express_Real)))
{
- os << shift << "data->ReadReal(" << param << ", " << index << ", \"" << STEPName <<
+ theOs << shift << "data->ReadReal(" << param << ", " << index << ", \"" << STEPName <<
"\", ach, a" << varname << ");" << std::endl;
}
if (optional)
{
shift.Remove(1, 2);
- os << shift << "}" << std::endl;
- os << shift << "else" << std::endl;
- os << shift << "{" << std::endl;
- os << shift << " has" << varname << " = Standard_False;" << std::endl;
- os << shift << " a" << varname;
+ theOs << shift << "}" << std::endl;
+ theOs << shift << "else" << std::endl;
+ theOs << shift << "{" << std::endl;
+ theOs << shift << " has" << varname << " = Standard_False;" << std::endl;
+ theOs << shift << " a" << varname;
if (type->IsHandle())
{
- os << ".Nullify();";
+ theOs << ".Nullify();";
}
else if (type->IsStandard())
{
- os << " = 0;";
+ theOs << " = 0;";
}
else
{
- os << " = " << type->CPPName()->ToCString() << "();";
+ theOs << " = " << type->CPPName()->ToCString() << "();";
}
- os << std::endl;
- os << shift << "}" << std::endl;
+ theOs << std::endl;
+ theOs << shift << "}" << std::endl;
}
}
//purpose :
//=======================================================================
-Standard_Integer Express_Entity::WriteRWReadCode (Standard_OStream &os,
- const Standard_Integer start,
- const Standard_Integer own) const
+Standard_Integer Express_Entity::writeRWReadCode (Standard_OStream& theOs,
+ const Standard_Integer theStart,
+ const Standard_Integer theOwn) const
{
- Standard_Integer num = start;
+ Standard_Integer num = theStart;
// write code for reading inherited fields
for (Standard_Integer i = 1; i <= myInherit->Length(); i++)
{
- num = myInherit->Value(i)->WriteRWReadCode(os, num, Standard_False);
+ num = myInherit->Value(i)->writeRWReadCode(theOs, num, Standard_False);
}
// write code for reading own fields
if ( myFields->Length() >0 )
{
- if ( num >0 ) os << std::endl;
- os << " // " << ( own ? "Own" : "Inherited" ) << " fields of " << Name()->ToCString() << std::endl;
+ if ( num >0 ) theOs << std::endl;
+ theOs << " // " << (theOwn ? "Own" : "Inherited") << " fields of " << Name()->ToCString() << std::endl;
}
for (Standard_Integer i = 1; i <= myFields->Length(); i++)
{
Handle(Express_Field) field = myFields->Value(i);
Handle(TCollection_HAsciiString) STEPName = Express::ToStepName(field->Name());
- if (!own)
+ if (!theOwn)
{
STEPName->Prepend(Express::ToStepName(Name()->Cat(".")));
}
Handle(TCollection_HAsciiString) varName = new TCollection_HAsciiString(field->Name());
- if (!own)
+ if (!theOwn)
{
varName->Prepend(Name()->Cat("_"));
}
- os << std::endl;
- WriteRWReadField(os, TCollection_AsciiString(num).ToCString(), STEPName->ToCString(),
+ theOs << std::endl;
+ writeRWReadField(theOs, TCollection_AsciiString(num).ToCString(), STEPName->ToCString(),
varName->ToCString(), field->Type(), 0, field->IsOptional());
num++;
}
//purpose :
//=======================================================================
-static void WriteRWWriteField(
- Standard_OStream &os,
+static void writeRWWriteField(
+ Standard_OStream &theOs,
const Standard_CString varname,
const Handle(Express_Type) &vartype,
const Standard_Integer index,
const Standard_Integer lev)
{
// indent
- TCollection_AsciiString shift ( " " );
+ TCollection_AsciiString shift(" ");
Standard_Integer level = 0;
for (; level < lev; level++)
{
type = complex->Type();
TCollection_AsciiString var(lev);
var.Prepend("Var");
- os << shift << "SW.OpenSub();" << std::endl;
- os << shift << "for (Standard_Integer i" << index << " = 1; i" << index << " <= ";
+ theOs << shift << "SW.OpenSub();" << std::endl;
+ theOs << shift << "for (Standard_Integer i" << index << " = 1; i" << index << " <= ";
if (type->IsKind(STANDARD_TYPE(Express_ComplexType)))
{ // array 2
Handle(Express_ComplexType) complex2 = Handle(Express_ComplexType)::DownCast(type);
type = complex2->Type();
- os << varname << "->RowLength(); i" << index << "++)" << std::endl;
- os << shift << "{" << std::endl;
- os << shift << " SW.NewLine(Standard_False);" << std::endl;
- os << shift << " SW.OpenSub();" << std::endl;
- os << shift << " for (Standard_Integer j" << index << " = 1; j" << index << " <= " <<
+ theOs << varname << "->RowLength(); i" << index << "++)" << std::endl;
+ theOs << shift << "{" << std::endl;
+ theOs << shift << " SW.NewLine(Standard_False);" << std::endl;
+ theOs << shift << " SW.OpenSub();" << std::endl;
+ theOs << shift << " for (Standard_Integer j" << index << " = 1; j" << index << " <= " <<
varname << "->ColLength(); j" << index << "++)" << std::endl;
- os << shift << " {" << std::endl;
- os << shift << " " << (type->IsHandle() ? " Handle(" : " ") << type->CPPName()->ToCString() <<
+ theOs << shift << " {" << std::endl;
+ theOs << shift << " " << (type->IsHandle() ? " Handle(" : " ") << type->CPPName()->ToCString() <<
(type->IsHandle() ? ") " : " ") << var.ToCString() << " = " <<
varname << "->Value(i" << index << ",j" << index << ");" << std::endl;
- WriteRWWriteField(os, var.ToCString(), type, index + 1, level + 1);
- os << shift << " }" << std::endl;
- os << shift << " SW.CloseSub();" << std::endl;
+ writeRWWriteField(theOs, var.ToCString(), type, index + 1, level + 1);
+ theOs << shift << " }" << std::endl;
+ theOs << shift << " SW.CloseSub();" << std::endl;
}
else
{ // simple array
- os << varname << "->Length(); i" << index << "++)" << std::endl;
- os << shift << "{" << std::endl;
- os << shift << (type->IsHandle() ? " Handle(" : " ") << type->CPPName()->ToCString() <<
+ theOs << varname << "->Length(); i" << index << "++)" << std::endl;
+ theOs << shift << "{" << std::endl;
+ theOs << shift << (type->IsHandle() ? " Handle(" : " ") << type->CPPName()->ToCString() <<
(type->IsHandle() ? ") " : " ") << var.ToCString() << " = " <<
varname << "->Value(i" << index << ");" << std::endl;
- WriteRWWriteField(os, var.ToCString(), type, index + 1, level);
+ writeRWWriteField(theOs, var.ToCString(), type, index + 1, level);
}
- os << shift << "}" << std::endl;
- os << shift << "SW.CloseSub();" << std::endl;
+ theOs << shift << "}" << std::endl;
+ theOs << shift << "SW.CloseSub();" << std::endl;
}
else if (type->IsKind(STANDARD_TYPE(Express_Boolean)))
{
- os << shift << "SW.SendBoolean(" << varname << ");" << std::endl;
+ theOs << shift << "SW.SendBoolean(" << varname << ");" << std::endl;
}
else if (type->IsKind(STANDARD_TYPE(Express_Logical)))
{
- os << shift << "SW.SendLogical(" << varname << ");" << std::endl;
+ theOs << shift << "SW.SendLogical(" << varname << ");" << std::endl;
}
else
{
Handle(TCollection_HAsciiString) prefix = Express::EnumPrefix(en->Name());
Handle(TColStd_HSequenceOfHAsciiString) names = en->Names();
TCollection_AsciiString enpack = en->GetPackageName()->String();
- os << shift << "switch (" << varname << ")" << std::endl;
- os << shift << "{" << std::endl;
+ theOs << shift << "switch (" << varname << ")" << std::endl;
+ theOs << shift << "{" << std::endl;
for (Standard_Integer i = 1; i <= names->Length(); i++)
{
Handle(TCollection_HAsciiString) ename = Express::ToStepName(names->Value(i));
ename->UpperCase();
- os << shift << " case " << enpack.ToCString() << "_" << prefix->ToCString() <<
+ theOs << shift << " case " << enpack.ToCString() << "_" << prefix->ToCString() <<
names->Value(i)->ToCString() << ": SW.SendEnum(\"." <<
ename->ToCString() << ".\"); break;" << std::endl;
}
- os << shift << "}" << std::endl;
+ theOs << shift << "}" << std::endl;
}
else
{
- os << shift << "SW.Send(" << varname;
+ theOs << shift << "SW.Send(" << varname;
if (!named.IsNull() && named->Item()->IsKind(STANDARD_TYPE(Express_Select)))
{
- os << ".Value()";
+ theOs << ".Value()";
}
- os << ");" << std::endl;
+ theOs << ");" << std::endl;
}
}
}
//purpose :
//=======================================================================
-Standard_Integer Express_Entity::WriteRWWriteCode(
- Standard_OStream &os,
- const Standard_Integer start,
- const Standard_Integer own) const
+Standard_Integer Express_Entity::writeRWWriteCode(
+ Standard_OStream &theOs,
+ const Standard_Integer theStart,
+ const Standard_Integer theOwn) const
{
- Standard_Integer num = start;
+ Standard_Integer num = theStart;
// write code for writing inherited fields
for (Standard_Integer i = 1; i <= myInherit->Length(); i++)
{
- num = myInherit->Value(i)->WriteRWWriteCode(os, num, (i > 1 ? -1 : 1));
+ num = myInherit->Value(i)->writeRWWriteCode(theOs, num, (i > 1 ? -1 : 1));
}
// write code for writing own fields
if (myFields->Length() > 0)
{
- os << std::endl;
- os << " // " << ( own == 1 ? "Own" : "Inherited" ) << " fields of " << Name()->ToCString() << std::endl;
+ theOs << std::endl;
+ theOs << " // " << (theOwn == 1 ? "Own" : "Inherited") << " fields of " << Name()->ToCString() << std::endl;
}
for (Standard_Integer i = 1; i <= myFields->Length(); i++)
{
Handle(Express_Field) field = myFields->Value(i);
TCollection_AsciiString varName ( field->Name()->String() );
- if (!own)
+ if (!theOwn)
{
varName.Prepend(CPPName()->Cat("::")->String());
}
- else if (own == -1)
+ else if (theOwn == -1)
{ // inherited base class implemented as field
varName.Prepend ( Name()->Cat ( "()->" )->String() );
}
varName.Prepend ( "ent->" );
varName.AssignCat ( "()" );
- os << std::endl;
+ theOs << std::endl;
if (field->IsOptional())
{
- os << " if (ent->";
- if (!own)
+ theOs << " if (ent->";
+ if (!theOwn)
{
- os << CPPName()->ToCString() << "::";
+ theOs << CPPName()->ToCString() << "::";
}
- else if (own == -1)
+ else if (theOwn == -1)
{
- os << Name()->ToCString() << "()->";
+ theOs << Name()->ToCString() << "()->";
}
- os << "Has" << field->Name()->ToCString() << "())" << std::endl;
- os << " {" << std::endl;
+ theOs << "Has" << field->Name()->ToCString() << "())" << std::endl;
+ theOs << " {" << std::endl;
}
- WriteRWWriteField(os, varName.ToCString(), field->Type(), num, (field->IsOptional() ? 1 : 0));
+ writeRWWriteField(theOs, varName.ToCString(), field->Type(), num, (field->IsOptional() ? 1 : 0));
if (field->IsOptional())
{
- os << " }" << std::endl;
- os << " else" << std::endl;
- os << " {" << std::endl;
- os << " SW.SendUndef();" << std::endl;
- os << " }" << std::endl;
+ theOs << " }" << std::endl;
+ theOs << " else" << std::endl;
+ theOs << " {" << std::endl;
+ theOs << " SW.SendUndef();" << std::endl;
+ theOs << " }" << std::endl;
}
num++;
}
//purpose :
//=======================================================================
-static Standard_Boolean WriteRWShareField(
- Standard_OStream &os,
+static Standard_Boolean writeRWShareField(
+ Standard_OStream &theOs,
const Standard_CString varname,
const Handle(Express_Type) &vartype,
const Standard_Integer index,
TCollection_AsciiString var(lev);
var.Prepend("Var");
std::ostringstream oos;
- if (!WriteRWShareField(oos, var.ToCString(), type, index + 1, level))
+ if (!writeRWShareField(oos, var.ToCString(), type, index + 1, level))
{
return Standard_False;
}
- os << shift << "for (Standard_Integer i" << index << " = 1; i" << index << " <= " <<
+ theOs << shift << "for (Standard_Integer i" << index << " = 1; i" << index << " <= " <<
varname << "->Length(); i" << index << "++)" << std::endl;
- os << shift << "{" << std::endl;
- os << shift << (type->IsHandle() ? " Handle(" : " ") << type->CPPName()->ToCString() <<
+ theOs << shift << "{" << std::endl;
+ theOs << shift << (type->IsHandle() ? " Handle(" : " ") << type->CPPName()->ToCString() <<
(type->IsHandle() ? ") " : " ") << var.ToCString() << " = " <<
varname << "->Value(i" << index << ");" << std::endl;
- os << oos.str();
- os << shift << "}" << std::endl;
+ theOs << oos.str();
+ theOs << shift << "}" << std::endl;
return Standard_True;
}
if (type->IsKind(STANDARD_TYPE(Express_NamedType)))
Handle(Express_NamedType) named = Handle(Express_NamedType)::DownCast(type);
if (named->Item()->IsKind(STANDARD_TYPE(Express_Entity)))
{
- os << shift << "iter.AddItem(" << varname << ");" << std::endl;
+ theOs << shift << "iter.AddItem(" << varname << ");" << std::endl;
return Standard_True;
}
if (named->Item()->IsKind(STANDARD_TYPE(Express_Select)))
{
- os << shift << "iter.AddItem(" << varname << ".Value());" << std::endl;
+ theOs << shift << "iter.AddItem(" << varname << ".Value());" << std::endl;
return Standard_True;
}
}
//purpose :
//=======================================================================
-Standard_Integer Express_Entity::WriteRWShareCode(
- Standard_OStream &os,
- const Standard_Integer start,
- const Standard_Integer own) const
+Standard_Integer Express_Entity::writeRWShareCode(
+ Standard_OStream &theOs,
+ const Standard_Integer theStart,
+ const Standard_Integer theOwn) const
{
- Standard_Integer num = start;
+ Standard_Integer num = theStart;
// write code for sharing inherited fields
for (Standard_Integer i = 1; i <= myInherit->Length(); i++)
{
- num = myInherit->Value(i)->WriteRWShareCode(os, num, (i > 1 ? -1 : Standard_False));
+ num = myInherit->Value(i)->writeRWShareCode(theOs, num, (i > 1 ? -1 : Standard_False));
}
// write code for sharing own fields
if ( myFields->Length() >0 )
{
- os << std::endl;
- os << " // " << ( own == 1 ? "Own" : "Inherited" ) << " fields of " << Name()->ToCString() << std::endl;
+ theOs << std::endl;
+ theOs << " // " << (theOwn == 1 ? "Own" : "Inherited") << " fields of " << Name()->ToCString() << std::endl;
}
for (Standard_Integer i = 1; i <= myFields->Length(); i++)
{
Handle(Express_Field) field = myFields->Value(i);
TCollection_AsciiString varName(field->Name()->String());
- if (!own)
+ if (!theOwn)
{
varName.Prepend(CPPName()->Cat("::")->String());
}
- else if (own == -1)
+ else if (theOwn == -1)
{ // inherited base class implemented as field
varName.Prepend(Name()->Cat("()->")->String());
}
varName.AssignCat("()");
std::ostringstream oos;
- if (!WriteRWShareField(oos, varName.ToCString(), field->Type(), num, (field->IsOptional() ? 1 : 0)))
+ if (!writeRWShareField(oos, varName.ToCString(), field->Type(), num, (field->IsOptional() ? 1 : 0)))
{
continue;
}
num++;
- os << std::endl;
+ theOs << std::endl;
if (field->IsOptional())
{
- os << " if (ent->";
- if (!own) os << CPPName()->ToCString() << "::";
- else if (own == -1) os << Name()->ToCString() << "()->";
- os << "Has" << field->Name()->ToCString() << "())" << std::endl;
- os << " {" << std::endl;
+ theOs << " if (ent->";
+ if (!theOwn) theOs << CPPName()->ToCString() << "::";
+ else if (theOwn == -1) theOs << Name()->ToCString() << "()->";
+ theOs << "Has" << field->Name()->ToCString() << "())" << std::endl;
+ theOs << " {" << std::endl;
}
- os << oos.str();
+ theOs << oos.str();
if (field->IsOptional())
{
- os << " }" << std::endl;
+ theOs << " }" << std::endl;
}
}
return num;
//purpose :
//=======================================================================
-Standard_Integer Express_Entity::MakeInit (Standard_OStream &os,
- const Standard_Integer shift,
- const Standard_Integer own,
- const Standard_Integer mode) const
+Standard_Integer Express_Entity::makeInit (Standard_OStream &theOs,
+ const Standard_Integer theShift,
+ const Standard_Integer theOwn,
+ const Standard_Integer theMode) const
{
- Standard_Integer sh = shift;
+ Standard_Integer sh = theShift;
// write code for inherited fields
for (Standard_Integer i = 1; i <= myInherit->Length(); i++)
{
Handle(Express_Entity) ent = myInherit->Value(i);
- if (mode == 3)
+ if (theMode == 3)
{
Standard_Integer s = 0;
if (i > 1)
{
- os << "\n my" << ent->Name()->ToCString() << " = new " << ent->CPPName()->ToCString() << ";";
- os << "\n my" << ent->Name()->ToCString() << "->Init(";
+ theOs << "\n my" << ent->Name()->ToCString() << " = new " << ent->CPPName()->ToCString() << ";";
+ theOs << "\n my" << ent->Name()->ToCString() << "->Init(";
s = 12 + ent->Name()->Length();
}
else
{
- os << "\n " << ent->CPPName()->ToCString() << "::Init(";
+ theOs << "\n " << ent->CPPName()->ToCString() << "::Init(";
s = 9 + ent->CPPName()->Length();
}
- ent->MakeInit(os, s, Standard_False, 2);
- os << ");";
+ ent->makeInit(theOs, s, Standard_False, 2);
+ theOs << ");";
}
else
{
- sh = ent->MakeInit(os, sh, (i > 1 ? -1 : Standard_False), mode);
+ sh = ent->makeInit(theOs, sh, (i > 1 ? -1 : Standard_False), theMode);
}
}
{
Handle(Express_Field) field = myFields->Value(i);
Handle(TCollection_HAsciiString) varName = new TCollection_HAsciiString(field->Name());
- if (own != 1)
+ if (theOwn != 1)
{
varName->Prepend(Name()->Cat("_"));
}
{
space += " ";
}
- Standard_Character delim = (mode == 0 ? ',' : (mode == 3 ? '\n' : ','));
+ Standard_Character delim = (theMode == 0 ? ',' : (theMode == 3 ? '\n' : ','));
if (sh < 0)
{
- if (i == 1 && myInherit->Length() == 0 && mode == 3)
+ if (i == 1 && myInherit->Length() == 0 && theMode == 3)
{
- os << delim << space;
+ theOs << delim << space;
}
else
{
- os << delim << "\n" << space;
+ theOs << delim << "\n" << space;
}
}
else
if (field->IsOptional())
{
- if (mode == 0)
+ if (theMode == 0)
{
- os << "const Standard_Boolean has" << varName->ToCString() << ",\n" << space;
+ theOs << "const Standard_Boolean theHas" << varName->ToCString() << ",\n" << space;
}
- else if (mode == 1)
+ else if (theMode == 1)
{
- os << "const Standard_Boolean has" << varName->ToCString() << ",\n" << space;
+ theOs << "const Standard_Boolean theHas" << varName->ToCString() << ",\n" << space;
}
- else if (mode == 2 || mode == 4)
+ else if (theMode == 2 || theMode == 4)
{
- os << "has" << varName->ToCString() << ",\n" << space;
+ theOs << "has" << varName->ToCString() << ",\n" << space;
}
}
// write field
- if (mode == 0 || mode == 1)
+ if (theMode == 0 || theMode == 1)
{
- os << "const " << (field->Type()->IsHandle() ? "Handle(" : "") <<
+ theOs << "const " << (field->Type()->IsHandle() ? "Handle(" : "") <<
field->Type()->CPPName()->ToCString() << (field->Type()->IsHandle() ? ")" : "") <<
(field->Type()->IsSimple() ? " the" : "& the") << varName->ToCString();
}
- else if (mode == 2)
+ else if (theMode == 2)
{
- os << "the" << varName->ToCString();
+ theOs << "the" << varName->ToCString();
}
- else if (mode == 4)
+ else if (theMode == 4)
{
- os << "a" << varName->ToCString();
+ theOs << "a" << varName->ToCString();
}
else
{
if (field->IsOptional())
{
- os << "def" << field->Name()->ToCString() << " = has" << varName->ToCString() << ";" << std::endl;
- os << " if (def" << field->Name()->ToCString() << ")" << std::endl;
- os << " {" << std::endl;
- os << " my" << field->Name()->ToCString() << " = the" << varName->ToCString() << ";";
- os << "\n }" << std::endl;
- os << " else" << std::endl;
- os << " {" << std::endl;
- os << " my" << field->Name()->ToCString();
+ theOs << "myHas" << field->Name()->ToCString() << " = theHas" << varName->ToCString() << ";" << std::endl;
+ theOs << " if (myHas" << field->Name()->ToCString() << ")" << std::endl;
+ theOs << " {" << std::endl;
+ theOs << " my" << field->Name()->ToCString() << " = the" << varName->ToCString() << ";";
+ theOs << "\n }" << std::endl;
+ theOs << " else" << std::endl;
+ theOs << " {" << std::endl;
+ theOs << " my" << field->Name()->ToCString();
if (field->Type()->IsHandle())
{
- os << ".Nullify();";
+ theOs << ".Nullify();";
}
else if (field->Type()->IsStandard())
{
- os << " = 0;";
+ theOs << " = 0;";
}
else
{
- os << " = " << field->Type()->CPPName()->ToCString() << "();";
+ theOs << " = " << field->Type()->CPPName()->ToCString() << "();";
}
- os << "\n }";
+ theOs << "\n }";
}
else
{
- os << "my" << field->Name()->ToCString() << " = the" << varName->ToCString() << ";";
+ theOs << "my" << field->Name()->ToCString() << " = the" << varName->ToCString() << ";";
}
}
if (sh > 0)
//! flags hasCheck and hasFillShared mark if generated class has
//! methods Check and FillShared cprrespondingly.
Standard_EXPORT Express_Entity(
- const Standard_CString name,
- const Handle(TColStd_HSequenceOfHAsciiString)& inherit,
- const Handle(Express_HSequenceOfField)& flds);
+ 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;
//! 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 inherited = 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 isAbstract) ;
+ Standard_EXPORT void SetAbstractFlag (const Standard_Boolean theIsAbstract) ;
//! Returns abstract flag.
Standard_EXPORT Standard_Boolean AbstractFlag() const;
Standard_EXPORT virtual Standard_Boolean GenerateClass() const Standard_OVERRIDE;
//! Writes includes section of HXX
- Standard_EXPORT Standard_Boolean WriteIncludes (Standard_OStream& os, DataMapOfStringInteger& dict) const;
+ Standard_EXPORT Standard_Boolean writeIncludes(Standard_OStream& theOs, DataMapOfStringInteger& theDict) const;
//! Writes #include declarations for RW class
- Standard_EXPORT void WriteRWInclude (Standard_OStream& os, DataMapOfStringInteger& dict) const;
+ Standard_EXPORT void writeRWInclude(Standard_OStream& theOs, DataMapOfStringInteger& theDict) const;
//! Writes code for reading all fields
- Standard_EXPORT Standard_Integer WriteRWReadCode(
- Standard_OStream& os,
- const Standard_Integer start,
- const Standard_Integer own) const;
+ Standard_EXPORT Standard_Integer writeRWReadCode(
+ Standard_OStream& theOs,
+ const Standard_Integer theStart,
+ const Standard_Integer theOwn) const;
//! Writes code for writing all fields
- Standard_EXPORT Standard_Integer WriteRWWriteCode(
- Standard_OStream& os,
- const Standard_Integer start,
- const Standard_Integer own) const;
+ Standard_EXPORT Standard_Integer writeRWWriteCode(
+ Standard_OStream& 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& os,
- const Standard_Integer start,
- const Standard_Integer own) 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 identifyes what code is being written:
//! 2 - call (argument list)
//! 3 - implementation
//! 4 - call (argument list for RW)
- Standard_EXPORT Standard_Integer MakeInit(
- Standard_OStream& os,
- const Standard_Integer shift,
- const Standard_Integer own,
- const Standard_Integer mode) const;
+ Standard_EXPORT Standard_Integer makeInit(
+ Standard_OStream& theOs,
+ const Standard_Integer theShift,
+ const Standard_Integer theOwn,
+ const Standard_Integer theMode) const;
Handle(TColStd_HSequenceOfHAsciiString) mySupers;
Handle(Express_HSequenceOfEntity) myInherit;
//=======================================================================
Express_Enum::Express_Enum(
- const Standard_CString name,
- const Handle(TColStd_HSequenceOfHAsciiString) &names)
- : Express_Item(name), myNames(names)
+ const Standard_CString theName,
+ const Handle(TColStd_HSequenceOfHAsciiString) &theNames)
+ : Express_Item(theName), myNames(theNames)
{
}
//purpose :
//=======================================================================
-const Handle(TColStd_HSequenceOfHAsciiString) &Express_Enum::Names () const
+const Handle(TColStd_HSequenceOfHAsciiString) &Express_Enum::Names() const
{
return myNames;
}
//purpose :
//=======================================================================
-Standard_Boolean Express_Enum::GenerateClass () const
+Standard_Boolean Express_Enum::GenerateClass() const
{
std::cout << "Generating ENUMERATION " << CPPName()->ToCString() << std::endl;
public:
//! Create ENUM item and initialize it
- Standard_EXPORT Express_Enum(const Standard_CString name, const Handle(TColStd_HSequenceOfHAsciiString)& names);
+ 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;
//=======================================================================
Express_Field::Express_Field(
- const Standard_CString name,
- const Handle(Express_Type) &type,
- const Standard_Boolean opt)
+ const Standard_CString theName,
+ const Handle(Express_Type) &theType,
+ const Standard_Boolean theOpt)
{
- myName = new TCollection_HAsciiString ( name );
- myType = type;
- myOpt = opt;
+ myName = new TCollection_HAsciiString(theName);
+ myType = theType;
+ myOpt = theOpt;
}
//=======================================================================
//=======================================================================
Express_Field::Express_Field(
- const Handle(TCollection_HAsciiString) &name,
- const Handle(Express_Type) &type,
- const Standard_Boolean opt)
+ const Handle(TCollection_HAsciiString) &theName,
+ const Handle(Express_Type) &theType,
+ const Standard_Boolean theOpt)
{
- myName = name;
- myType = type;
- myOpt = opt;
+ myName = theName;
+ myType = theType;
+ myOpt = theOpt;
}
//=======================================================================
//purpose :
//=======================================================================
-const Handle(TCollection_HAsciiString) &Express_Field::Name () const
+const Handle(TCollection_HAsciiString) &Express_Field::Name() const
{
return myName;
}
//purpose :
//=======================================================================
-const Handle(Express_Type) &Express_Field::Type () const
+const Handle(Express_Type) &Express_Field::Type() const
{
return myType;
}
//purpose :
//=======================================================================
-Standard_Boolean Express_Field::IsOptional () const
+Standard_Boolean Express_Field::IsOptional() const
{
return myOpt;
}
//! Create object and initialize it
Standard_EXPORT Express_Field(
- const Standard_CString name,
- const Handle(Express_Type)& type,
- const Standard_Boolean opt);
+ 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)& name,
- const Handle(Express_Type)& type,
- const Standard_Boolean opt);
+ const Handle(TCollection_HAsciiString)& theName,
+ const Handle(Express_Type)& theType,
+ const Standard_Boolean theOpt);
//! Returns field name
Standard_EXPORT const Handle(TCollection_HAsciiString)& Name() const;
//purpose :
//=======================================================================
-Express_Integer::Express_Integer ()
+Express_Integer::Express_Integer()
{
}
//purpose :
//=======================================================================
-Handle(TCollection_HAsciiString) Express_Integer::CPPName () const
+Handle(TCollection_HAsciiString) Express_Integer::CPPName() const
{
- return new TCollection_HAsciiString ( "Standard_Integer" );
+ return new TCollection_HAsciiString("Standard_Integer");
}
//purpose :
//=======================================================================
-Express_Item::Express_Item (const Standard_CString name)
+Express_Item::Express_Item(const Standard_CString theName)
{
- myName = new TCollection_HAsciiString ( name );
+ myName = new TCollection_HAsciiString(theName);
myMark = Standard_False;
myShortName = new TCollection_HAsciiString;
myCategory = new TCollection_HAsciiString;
//purpose :
//=======================================================================
-Express_Item::Express_Item (const Handle(TCollection_HAsciiString) &name)
+Express_Item::Express_Item (const Handle(TCollection_HAsciiString) &theName)
{
- myName = name;
+ myName = theName;
myMark = Standard_False;
myShortName = new TCollection_HAsciiString;
myCategory = new TCollection_HAsciiString;
//purpose :
//=======================================================================
-const Handle(TCollection_HAsciiString) &Express_Item::Name () const
+const Handle(TCollection_HAsciiString) &Express_Item::Name() const
{
return myName;
}
//purpose :
//=======================================================================
-Handle(TCollection_HAsciiString) Express_Item::CPPName () const
+Handle(TCollection_HAsciiString) Express_Item::CPPName() const
{
Handle(TCollection_HAsciiString) name = GetPackageName(Standard_True)->Cat("_");
- name->AssignCat ( myName );
+ name->AssignCat(myName);
return name;
}
//purpose :
//=======================================================================
-void Express_Item::SetPackageName (const Handle(TCollection_HAsciiString) &pack)
+void Express_Item::SetPackageName(const Handle(TCollection_HAsciiString) &thePack)
{
- myPack = pack;
+ myPack = thePack;
}
//=======================================================================
//purpose :
//=======================================================================
-Handle(TCollection_HAsciiString) Express_Item::GetPackageName (const Standard_Boolean Auto) const
+Handle(TCollection_HAsciiString) Express_Item::GetPackageName(const Standard_Boolean theAuto) const
{
- if (myPack.IsNull() && Auto)
+ if (myPack.IsNull() && theAuto)
{
return new TCollection_HAsciiString("StepStep");
}
//purpose :
//=======================================================================
-Standard_Boolean Express_Item::GetMark () const
+Standard_Boolean Express_Item::GetMark() const
{
return myMark;
}
//purpose :
//=======================================================================
-void Express_Item::SetMark (const Standard_Boolean mark)
+void Express_Item::SetMark (const Standard_Boolean theMark)
{
- myMark = mark;
+ myMark = theMark;
}
//=======================================================================
//purpose :
//=======================================================================
-Standard_Boolean Express_Item::Generate ()
+Standard_Boolean Express_Item::Generate()
{
if (!GetMark())
{
{
SetPackageName(GetPackageName(Standard_True));
}
- SetMark ( Standard_False );
+ SetMark(Standard_False);
return GenerateClass();
}
//=======================================================================
Standard_Boolean Express_Item::Use(
- const Handle(TCollection_HAsciiString) &pack,
- const Standard_Boolean defer)
+ const Handle(TCollection_HAsciiString) &thePack,
+ const Standard_Boolean theDefer)
{
if (!GetPackageName().IsNull())
{
// issue a warning message if item from known package uses item from unknown package (StepStep)
- if (pack->String().IsDifferent("StepStep") && GetPackageName()->String().IsEqual("StepStep"))
+ if (thePack->String().IsDifferent("StepStep") && GetPackageName()->String().IsEqual("StepStep"))
{
std::cout << "Warning: item " << Name()->ToCString() << " has no package assigned, but used from package "
- << pack->ToCString() << std::endl;
+ << thePack->ToCString() << std::endl;
}
return Standard_False;
}
// issue a warning message if type still does not have package assigned
- if (pack->String().IsDifferent("StepStep"))
+ if (thePack->String().IsDifferent("StepStep"))
{
std::cout << "Warning: item " << Name()->ToCString() << " has no package assigned, setting "
- << pack->ToCString() << std::endl;
+ << thePack->ToCString() << std::endl;
}
- SetPackageName ( pack );
- SetMark ( Standard_True );
- if (defer)
+ SetPackageName(thePack);
+ SetMark(Standard_True);
+ if (theDefer)
{
return Standard_False;
}
//purpose :
//=======================================================================
- void Express_Item::SetCategory(const Handle(TCollection_HAsciiString)& categ)
+ void Express_Item::SetCategory(const Handle(TCollection_HAsciiString)& theCateg)
{
- myCategory = categ;
+ myCategory = theCateg;
}
//=======================================================================
//purpose :
//=======================================================================
- void Express_Item::SetShortName(const Handle(TCollection_HAsciiString)& shname)
+ void Express_Item::SetShortName(const Handle(TCollection_HAsciiString)& theShName)
{
- myShortName = shname;
+ myShortName = theShName;
}
//=======================================================================
Handle(TCollection_HAsciiString) Express_Item::ShortName() const
{
- return myShortName;
+ return myShortName;
}
//=======================================================================
//function : SetCheckFlag
//purpose :
//=======================================================================
- void Express_Item::SetCheckFlag(const Standard_Boolean checkFlag)
+ void Express_Item::SetCheckFlag(const Standard_Boolean theCheckFlag)
{
- myhasCheck = checkFlag;
+ myhasCheck = theCheckFlag;
}
//=======================================================================
//purpose :
//=======================================================================
- void Express_Item::SetFillSharedFlag(const Standard_Boolean fillsharedFlag)
+ void Express_Item::SetFillSharedFlag(const Standard_Boolean theFillSharedFlag)
{
- myhasFillShared = fillsharedFlag;
+ myhasFillShared = theFillSharedFlag;
}
//=======================================================================
//! Returns package name
//! If not defined, returns NULL if auto is False (default)
//! or "StepStep" if auto is True
- Standard_EXPORT Handle(TCollection_HAsciiString) GetPackageName(const Standard_Boolean Auto = Standard_False) const;
+ Standard_EXPORT Handle(TCollection_HAsciiString) GetPackageName(const Standard_Boolean theAuto = Standard_False) const;
//! Sets package name
- Standard_EXPORT void SetPackageName (const Handle(TCollection_HAsciiString)& pack) ;
+ Standard_EXPORT void SetPackageName (const Handle(TCollection_HAsciiString)& thePack) ;
//! Returns True if item is marked for generation
Standard_EXPORT Standard_Boolean GetMark() const;
//! Change generation mark flag
- Standard_EXPORT void SetMark (const Standard_Boolean mark) ;
+ Standard_EXPORT void SetMark (const Standard_Boolean theMark) ;
//! General interface for creating HXX/CXX files from item
Standard_EXPORT virtual Standard_Boolean GenerateClass() const = 0;
//! current one) and Mark flag is set. Then, if defer is False,
//! calls Generate().
Standard_EXPORT Standard_Boolean Use(
- const Handle(TCollection_HAsciiString)& pack,
- const Standard_Boolean defer = Standard_False);
+ const Handle(TCollection_HAsciiString)& thePack,
+ const Standard_Boolean theDefer = Standard_False);
//! Set category for item
- Standard_EXPORT void SetCategory (const Handle(TCollection_HAsciiString)& categ) ;
+ Standard_EXPORT void SetCategory (const Handle(TCollection_HAsciiString)& theCateg) ;
//! Get item category
Standard_EXPORT Handle(TCollection_HAsciiString) Category() const;
//! Set short name for item
- Standard_EXPORT void SetShortName (const Handle(TCollection_HAsciiString)& shname) ;
+ 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 checkFlag) ;
+ 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 fillsharedFlag) ;
+ 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;
//purpose :
//=======================================================================
-Express_Logical::Express_Logical ()
+Express_Logical::Express_Logical()
{
}
//purpose :
//=======================================================================
-Handle(TCollection_HAsciiString) Express_Logical::CPPName () const
+Handle(TCollection_HAsciiString) Express_Logical::CPPName() const
{
return new TCollection_HAsciiString("StepData_Logical");
}
//purpose :
//=======================================================================
-Standard_Boolean Express_Logical::IsStandard () const
+Standard_Boolean Express_Logical::IsStandard() const
{
return Standard_False;
}
//purpose :
//=======================================================================
-Standard_Boolean Express_Logical::IsSimple () const
+Standard_Boolean Express_Logical::IsSimple() const
{
return Standard_True;
}
//purpose :
//=======================================================================
-Standard_Boolean Express_Logical::IsHandle () const
+Standard_Boolean Express_Logical::IsHandle() const
{
return Standard_False;
}
//purpose :
//=======================================================================
-Express_NamedType::Express_NamedType (const Standard_CString name)
+Express_NamedType::Express_NamedType(const Standard_CString theName)
{
- myName = new TCollection_HAsciiString ( name );
+ myName = new TCollection_HAsciiString(theName);
}
//=======================================================================
//purpose :
//=======================================================================
-Express_NamedType::Express_NamedType (const Handle(TCollection_HAsciiString) &name)
+Express_NamedType::Express_NamedType(const Handle(TCollection_HAsciiString)& theName)
{
- myName = name;
+ myName = theName;
}
//=======================================================================
//purpose :
//=======================================================================
-const Handle(TCollection_HAsciiString) &Express_NamedType::Name () const
+const Handle(TCollection_HAsciiString)& Express_NamedType::Name() const
{
return myName;
}
//purpose :
//=======================================================================
-const Handle(Express_Item) &Express_NamedType::Item () const
+const Handle(Express_Item) &Express_NamedType::Item() const
{
return myItem;
}
//purpose :
//=======================================================================
-void Express_NamedType::SetItem (const Handle(Express_Item) &it)
+void Express_NamedType::SetItem (const Handle(Express_Item)& theItem)
{
- myItem = it;
+ myItem = theItem;
}
//=======================================================================
//purpose :
//=======================================================================
-Handle(TCollection_HAsciiString) Express_NamedType::CPPName () const
+Handle(TCollection_HAsciiString) Express_NamedType::CPPName() const
{
return myItem->CPPName();
}
//purpose :
//=======================================================================
-Standard_Boolean Express_NamedType::IsStandard () const
+Standard_Boolean Express_NamedType::IsStandard() const
{
if (myItem->IsKind(STANDARD_TYPE(Express_Alias)))
{
//purpose :
//=======================================================================
-Standard_Boolean Express_NamedType::IsSimple () const
+Standard_Boolean Express_NamedType::IsSimple() const
{
if (myItem->IsKind(STANDARD_TYPE(Express_Alias)))
{
//purpose :
//=======================================================================
-Standard_Boolean Express_NamedType::IsHandle () const
+Standard_Boolean Express_NamedType::IsHandle() const
{
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)))
//=======================================================================
Standard_Boolean Express_NamedType::Use(
- const Handle(TCollection_HAsciiString) &pack,
- const Standard_Boolean defer) const
+ const Handle(TCollection_HAsciiString)& thePack,
+ const Standard_Boolean theDefer) const
{
- return myItem->Use ( pack, defer );
+ return myItem->Use(thePack, theDefer);
}
public:
//! Creates an object and initializes by name
- Standard_EXPORT Express_NamedType(const Standard_CString name);
+ Standard_EXPORT Express_NamedType(const Standard_CString theName);
//! Creates an object and initializes by name
- Standard_EXPORT Express_NamedType(const Handle(TCollection_HAsciiString)& name);
+ Standard_EXPORT Express_NamedType(const Handle(TCollection_HAsciiString)& theName);
//! Returns name of type (item in schema)
Standard_EXPORT const Handle(TCollection_HAsciiString)& Name() const;
Standard_EXPORT const Handle(Express_Item)& Item() const;
//! Sets handle to referred item in schema
- Standard_EXPORT void SetItem (const Handle(Express_Item)& it) ;
+ Standard_EXPORT void SetItem (const Handle(Express_Item)& theItem) ;
//! Returns CPP-style name of the type
Standard_EXPORT virtual Handle(TCollection_HAsciiString) CPPName() const Standard_OVERRIDE;
//! Declares type as used by some item being generated.
//! Calls Use() for referred item (found by name).
Standard_EXPORT virtual Standard_Boolean Use(
- const Handle(TCollection_HAsciiString)& pack,
- const Standard_Boolean defer = Standard_False) const Standard_OVERRIDE;
+ const Handle(TCollection_HAsciiString)& thePack,
+ const Standard_Boolean theDefer = Standard_False) const Standard_OVERRIDE;
DEFINE_STANDARD_RTTIEXT(Express_NamedType,Express_Type)
//purpose :
//=======================================================================
-Express_PredefinedType::Express_PredefinedType ()
+Express_PredefinedType::Express_PredefinedType()
{
}
//purpose :
//=======================================================================
-Standard_Boolean Express_PredefinedType::IsStandard () const
+Standard_Boolean Express_PredefinedType::IsStandard() const
{
return Standard_True;
}
//purpose :
//=======================================================================
-Express_Real::Express_Real ()
+Express_Real::Express_Real()
{
}
//purpose :
//=======================================================================
-Handle(TCollection_HAsciiString) Express_Real::CPPName () const
+Handle(TCollection_HAsciiString) Express_Real::CPPName() const
{
return new TCollection_HAsciiString("Standard_Real");
}
//=======================================================================
Express_Reference::Express_Reference(
- const Standard_CString name,
- const Handle(TColStd_HSequenceOfHAsciiString) &types)
- : Express_Item(name)
+ const Standard_CString theName,
+ const Handle(TColStd_HSequenceOfHAsciiString) &theTypes)
+ : Express_Item(theName)
{
- myTypes = types;
+ myTypes = theTypes;
}
//=======================================================================
//purpose : dummy method
//=======================================================================
-Standard_Boolean Express_Reference::GenerateClass () const
+Standard_Boolean Express_Reference::GenerateClass() const
{
return Standard_False;
}
public:
//! Create Reference item and initialize it
- Standard_EXPORT Express_Reference(const Standard_CString name, const Handle(TColStd_HSequenceOfHAsciiString)& types);
+ Standard_EXPORT Express_Reference(const Standard_CString theName,
+ const Handle(TColStd_HSequenceOfHAsciiString)& theTypes);
//! Returns list of types referenced
const Handle(TColStd_HSequenceOfHAsciiString)& Types() const
//=======================================================================
Express_Schema::Express_Schema(
- const Standard_CString name,
- const Handle(Express_HSequenceOfItem) &items)
+ const Standard_CString theName,
+ const Handle(Express_HSequenceOfItem)& theItems)
{
- myName = new TCollection_HAsciiString ( name );
- myItems = items;
+ myName = new TCollection_HAsciiString(theName);
+ myItems = theItems;
Prepare();
}
//=======================================================================
Express_Schema::Express_Schema(
- const Handle(TCollection_HAsciiString) &name,
- const Handle(Express_HSequenceOfItem) &items)
+ const Handle(TCollection_HAsciiString)& theName,
+ const Handle(Express_HSequenceOfItem)& theItems)
{
- myName = name;
- myItems = items;
+ myName = theName;
+ myItems = theItems;
Prepare();
}
//purpose :
//=======================================================================
-const Handle(TCollection_HAsciiString) &Express_Schema::Name () const
+const Handle(TCollection_HAsciiString)& Express_Schema::Name() const
{
return myName;
}
//purpose :
//=======================================================================
-const Handle(Express_HSequenceOfItem) &Express_Schema::Items () const
+const Handle(Express_HSequenceOfItem)& Express_Schema::Items() const
{
return myItems;
}
//purpose :
//=======================================================================
-Standard_Integer Express_Schema::NbItems () const
+Standard_Integer Express_Schema::NbItems() const
{
return myItems->Length();
}
//purpose :
//=======================================================================
-Handle(Express_Item) Express_Schema::Item(const Standard_Integer num) const
+Handle(Express_Item) Express_Schema::Item(const Standard_Integer theNum) const
{
- return myItems->Value(num);
+ return myItems->Value(theNum);
}
//=======================================================================
//=======================================================================
Handle(Express_Item) Express_Schema::Item(
- const Standard_CString name,
- const Standard_Boolean silent) const
+ const Standard_CString theName,
+ const Standard_Boolean theSilent) const
{
- if (!myDict.IsBound(name))
+ if (!myDict.IsBound(theName))
{
- if (!silent)
+ if (!theSilent)
{
- std::cout << "Error: attempt to access unknown item by name " << name << std::endl;
+ std::cout << "Error: attempt to access unknown item by name " << theName << std::endl;
}
return 0;
}
- return myDict.Find (name);
+ return myDict.Find(theName);
}
//=======================================================================
//purpose :
//=======================================================================
-Handle(Express_Item) Express_Schema::Item(const TCollection_AsciiString &name) const
+Handle(Express_Item) Express_Schema::Item(const TCollection_AsciiString& theName) const
{
- return Item(name.ToCString());
+ return Item(theName.ToCString());
}
//=======================================================================
//purpose :
//=======================================================================
-Handle(Express_Item) Express_Schema::Item(const Handle(TCollection_HAsciiString) &name) const
+Handle(Express_Item) Express_Schema::Item(const Handle(TCollection_HAsciiString)& theName) const
{
- return Item(name->ToCString());
+ return Item(theName->ToCString());
}
//=======================================================================
// Convert STEP-style name (lowercase, with underscores)
// to CASCADE-style name (each word starts with uppercase, no intervals)
//=======================================================================
-static void nameToCasCade (const Handle(TCollection_HAsciiString) &name)
+static void nameToCasCade (const Handle(TCollection_HAsciiString)& theName)
{
- if (name.IsNull())
+ if (theName.IsNull())
{
return;
}
- for (Standard_Integer i = 1; i <= name->Length(); i++)
+ for (Standard_Integer i = 1; i <= theName->Length(); i++)
{
- if ( name->Value(i) == '_' )
+ if (theName->Value(i) == '_')
{
- name->Remove ( i );
+ theName->Remove(i);
}
else if (i > 1)
{
continue;
}
- name->SetValue ( i, UpperCase ( name->Value(i) ) );
+ theName->SetValue(i, UpperCase(theName->Value(i)));
}
}
//purpose : auxilary for Prepare()
// Convert names for Type object
//=======================================================================
-static void nameToCasCade (const Handle(Express_Type) &type)
+static void nameToCasCade (const Handle(Express_Type)& theType)
{
- if (type->IsKind(STANDARD_TYPE(Express_NamedType)))
+ if (theType->IsKind(STANDARD_TYPE(Express_NamedType)))
{
- const Handle(Express_NamedType) named = Handle(Express_NamedType)::DownCast(type);
+ const Handle(Express_NamedType) named = Handle(Express_NamedType)::DownCast(theType);
nameToCasCade(named->Name());
}
- else if (type->IsKind(STANDARD_TYPE(Express_ComplexType)))
+ else if (theType->IsKind(STANDARD_TYPE(Express_ComplexType)))
{
- const Handle(Express_ComplexType) complex = Handle(Express_ComplexType)::DownCast(type);
+ const Handle(Express_ComplexType) complex = Handle(Express_ComplexType)::DownCast(theType);
nameToCasCade(complex->Type());
}
}
// and set handles to items where they are referenced by names
//=======================================================================
-void Express_Schema::Prepare ()
+void Express_Schema::Prepare()
{
myDict.Clear();
if (myItems.IsNull())
Standard_Integer nbItems = NbItems();
// convert names annd fill dictionary
- for ( Standard_Integer num=1; num <= nbItems; num++ )
+ for (Standard_Integer num = 1; num <= nbItems; num++)
{
// get item
const Handle(Express_Item) item = Item(num);
}
// set references to items from other items and types
- for (Standard_Integer num=1; num <= nbItems; num++ )
+ for (Standard_Integer num = 1; num <= nbItems; num++)
{
const Handle(Express_Item) item = Item(num);
- if ( item->IsKind(STANDARD_TYPE(Express_Alias)) )
+ if (item->IsKind(STANDARD_TYPE(Express_Alias)))
{
- const Handle(Express_Alias) alias = Handle(Express_Alias)::DownCast ( item );
- PrepareType ( alias->Type() );
+ const Handle(Express_Alias) alias = Handle(Express_Alias)::DownCast(item);
+ PrepareType(alias->Type());
// for aliases, define package to avoid warnings
- alias->SetPackageName ( new TCollection_HAsciiString ( "Standard" ) );
+ alias->SetPackageName(new TCollection_HAsciiString("Standard"));
continue;
}
else if (item->IsKind(STANDARD_TYPE(Express_Select)))
items->Append(it);
}
}
- else if ( item->IsKind(STANDARD_TYPE(Express_Entity)) )
+ else if (item->IsKind(STANDARD_TYPE(Express_Entity)))
{
const Handle(Express_Entity) ent = Handle(Express_Entity)::DownCast(item);
Handle(TColStd_HSequenceOfHAsciiString) names = ent->SuperTypes();
//purpose :
//=======================================================================
-void Express_Schema::PrepareType(const Handle(Express_Type) &type) const
+void Express_Schema::PrepareType(const Handle(Express_Type)& theType) const
{
- if (type->IsKind(STANDARD_TYPE(Express_NamedType)))
+ if (theType->IsKind(STANDARD_TYPE(Express_NamedType)))
{
- Handle(Express_NamedType) named = Handle(Express_NamedType)::DownCast(type);
+ Handle(Express_NamedType) named = Handle(Express_NamedType)::DownCast(theType);
named->SetItem(Item(named->Name()));
}
- else if (type->IsKind(STANDARD_TYPE(Express_ComplexType)))
+ else if (theType->IsKind(STANDARD_TYPE(Express_ComplexType)))
{
- Handle(Express_ComplexType) complex = Handle(Express_ComplexType)::DownCast(type);
+ Handle(Express_ComplexType) complex = Handle(Express_ComplexType)::DownCast(theType);
PrepareType(complex->Type());
}
}
//! Creates a schema with given name and given set of items
//! and calls Prepare()
- Standard_EXPORT Express_Schema(const Standard_CString Name, const Handle(Express_HSequenceOfItem)& items);
+ 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)& Name,
- const Handle(Express_HSequenceOfItem)& items);
+ const Handle(TCollection_HAsciiString)& theName,
+ const Handle(Express_HSequenceOfItem)& theItems);
//! Returns schema name
Standard_EXPORT const Handle(TCollection_HAsciiString)& Name() const;
Standard_EXPORT Standard_Integer NbItems() const;
//! Returns item by index
- Standard_EXPORT Handle(Express_Item) Item (const Standard_Integer num) 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 name,
- const Standard_Boolean silent = Standard_False) const;
+ const Standard_CString theName,
+ const Standard_Boolean theSilent = Standard_False) const;
//! Returns item by name
- Standard_EXPORT Handle(Express_Item) Item (const TCollection_AsciiString& name) 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)& name) const;
+ Standard_EXPORT Handle(Express_Item) Item(const Handle(TCollection_HAsciiString)& theName) const;
DEFINE_STANDARD_RTTIEXT(Express_Schema,Standard_Transient)
//! 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)& type) const;
+ Standard_EXPORT void PrepareType (const Handle(Express_Type)& theType) const;
Handle(TCollection_HAsciiString) myName;
Handle(Express_HSequenceOfItem) myItems;
//=======================================================================
Express_Select::Express_Select(
- const Standard_CString name,
- const Handle(TColStd_HSequenceOfHAsciiString) &names)
- : Express_Item(name), myNames(names)
+ const Standard_CString theName,
+ const Handle(TColStd_HSequenceOfHAsciiString) &theNames)
+ : Express_Item(theName), myNames(theNames)
{
myItems = new Express_HSequenceOfItem;
}
//purpose :
//=======================================================================
-const Handle(TColStd_HSequenceOfHAsciiString) &Express_Select::Names () const
+const Handle(TColStd_HSequenceOfHAsciiString) &Express_Select::Names() const
{
return myNames;
}
//purpose :
//=======================================================================
-const Handle(Express_HSequenceOfItem) &Express_Select::Items () const
+const Handle(Express_HSequenceOfItem) &Express_Select::Items() const
{
return myItems;
}
//purpose :
//=======================================================================
-Standard_Boolean Express_Select::GenerateClass () const
+Standard_Boolean Express_Select::GenerateClass() const
{
Handle(TCollection_HAsciiString) CPPname = CPPName();
if (!seqMember->IsEmpty())
{
std::cout << "Generating SELECTMember " << CPPname->ToCString() << "Member" << std::endl;
- GenerateSelectMember(seqMember);
+ generateSelectMember(seqMember);
}
// create a package directory (if not yet exist)
OSD_Protection prot(OSD_RX, OSD_RWX, OSD_RX, OSD_RX);
// Step 1: generating HXX
// Open HXX file
- std::ofstream os ( pack.Cat ( ".hxx" ).ToCString() );
+ std::ofstream os(pack.Cat(".hxx").ToCString());
// write header
- Express::WriteFileStamp ( os );
+ Express::WriteFileStamp(os);
// write start define
os << "#ifndef _" << CPPname->ToCString() << "_HeaderFile" << std::endl;
// Step 2: generating CXX
// Open CXX file
- os.open ( pack.Cat ( ".cxx" ).ToCString() );
+ os.open(pack.Cat(".cxx").ToCString());
// write header
- Express::WriteFileStamp ( os );
+ Express::WriteFileStamp(os);
// write include section
os << "#include <" << CPPname->ToCString() << ".hxx>" << std::endl;
}
// write constructor
- Express::WriteMethodStamp ( os, CPPname );
+ Express::WriteMethodStamp(os, CPPname);
os << CPPname->ToCString() << "::" << CPPname->ToCString() << " ()" << std::endl;
os << "{" << std::endl << "}" << std::endl;
//purpose :
//=======================================================================
- Standard_Boolean Express_Select::GenerateSelectMember(const Handle(TColStd_HSequenceOfInteger)& seqMember) const
+ Standard_Boolean Express_Select::generateSelectMember(const Handle(TColStd_HSequenceOfInteger)& theSeqMember) const
{
Handle(TCollection_HAsciiString) CPPname = new TCollection_HAsciiString;
CPPname->AssignCat(CPPName());
os << " Handle(TCollection_HAsciiString) aName = new TCollection_HAsciiString;" << std::endl;
os << " switch(myCase) {" << std::endl;
Standard_Integer i = 1;
- for (i = 1; i <= seqMember->Length(); i++)
+ for (i = 1; i <= theSeqMember->Length(); i++)
{
- Standard_Integer ind = seqMember->Value(i);
+ Standard_Integer ind = theSeqMember->Value(i);
Handle(Express_Item) item = myItems->Value(ind);
if (item->IsKind(STANDARD_TYPE(Express_Enum)))
{
os << "{" << std::endl;
os << " Standard_Integer thecase = 0;" << std::endl;
os << " if (!name || name[0] == \'/0\') thecase = 0;" << std::endl;
- for (i = 1; i <= seqMember->Length(); i++)
+ for (i = 1; i <= theSeqMember->Length(); i++)
{
- Standard_Integer ind = seqMember->Value(i);
+ Standard_Integer ind = theSeqMember->Value(i);
Handle(Express_Item) item = myItems->Value(ind);
if (item->IsKind(STANDARD_TYPE(Express_Enum)))
{
}
else
{
- os << " else if(!strcmp (name,\"" << myNames->Value(ind)->ToCString() << "\")) thecase = " << i << ";" << std::endl;
+ os << " else if(!strcmp (name,\"" << myNames->Value(ind)->ToCString()
+ << "\")) thecase = " << i << ";" << std::endl;
}
}
os << " return thecase;" << std::endl;
public:
//! Create SELECT item and initialize it
- Standard_EXPORT Express_Select(const Standard_CString name, const Handle(TColStd_HSequenceOfHAsciiString)& names);
+ 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;
private:
- Standard_EXPORT Standard_Boolean GenerateSelectMember (const Handle(TColStd_HSequenceOfInteger)& seqMember) const;
+ Standard_EXPORT Standard_Boolean generateSelectMember(const Handle(TColStd_HSequenceOfInteger)& theSeqMember) const;
Handle(TColStd_HSequenceOfHAsciiString) myNames;
Handle(Express_HSequenceOfItem) myItems;
//purpose :
//=======================================================================
-Express_String::Express_String ()
+Express_String::Express_String()
{
}
//purpose :
//=======================================================================
-Handle(TCollection_HAsciiString) Express_String::CPPName () const
+Handle(TCollection_HAsciiString) Express_String::CPPName() const
{
- return new TCollection_HAsciiString ( "TCollection_HAsciiString" );
+ return new TCollection_HAsciiString("TCollection_HAsciiString");
}
//=======================================================================
//purpose :
//=======================================================================
-Standard_Boolean Express_String::IsStandard () const
+Standard_Boolean Express_String::IsStandard() const
{
return Standard_False;
}
//purpose :
//=======================================================================
-Express_Type::Express_Type ()
+Express_Type::Express_Type()
{
}
//purpose :
//=======================================================================
-Standard_Boolean Express_Type::IsStandard () const
+Standard_Boolean Express_Type::IsStandard() const
{
return Standard_False;
}
//purpose :
//=======================================================================
-Standard_Boolean Express_Type::IsSimple () const
+Standard_Boolean Express_Type::IsSimple() const
{
return IsStandard();
}
//purpose :
//=======================================================================
-Standard_Boolean Express_Type::IsHandle () const
+Standard_Boolean Express_Type::IsHandle() const
{
- return ! IsSimple();
+ return !IsSimple();
}
//=======================================================================
//! Calls Use() for all referred types and schema items.
//! Default instantiation does nothing
Standard_EXPORT virtual Standard_Boolean Use(
- const Handle(TCollection_HAsciiString)& pack,
- const Standard_Boolean defer = Standard_False) const;
+ const Handle(TCollection_HAsciiString)& thePack,
+ const Standard_Boolean theDefer = Standard_False) const;
DEFINE_STANDARD_RTTIEXT(Express_Type,Standard_Transient)