mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-04 13:13:25 +03:00
0026715: Problems in reading STEP short names in complex entities
Add function to find next part of complex entity by name or short name. Add missing short names. Test cases for issue CR26715
This commit is contained in:
@@ -401,6 +401,43 @@ Standard_Boolean StepData_StepReaderData::NamedForComplex
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NamedForComplex
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean StepData_StepReaderData::NamedForComplex
|
||||
(const Standard_CString theName, const Standard_CString theShortName,
|
||||
const Standard_Integer num0, Standard_Integer& num,
|
||||
Handle(Interface_Check)& ach) const
|
||||
{
|
||||
Standard_Integer n = (num <= 0 ? num0 : NextForComplex(num));
|
||||
if ((n!=0) && !(stepstrcmp(RecordType(n).ToCString(),theName) &&
|
||||
stepstrcmp(RecordType(n).ToCString(), theShortName)))
|
||||
{ num = n; return Standard_True; }
|
||||
|
||||
if (n == 0)
|
||||
NamedForComplex (theName, theShortName, num0, n, ach);
|
||||
//entities are not in alphabetical order
|
||||
Handle(String) errmess = new String("Parameter n0.%d (%s) not a LIST");
|
||||
sprintf (txtmes,errmess->ToCString(), num0, theName);
|
||||
for (n = num0; n > 0; n = NextForComplex(n)) {
|
||||
if (!(stepstrcmp(RecordType(n).ToCString(),theName) &&
|
||||
stepstrcmp(RecordType(n).ToCString(), theShortName))) {
|
||||
num = n;
|
||||
errmess = new String("Complex Record n0.%d, member type %s not in alphabetic order");
|
||||
sprintf (txtmes,errmess->ToCString(), num0, theName);
|
||||
ach->AddWarning(txtmes,errmess->ToCString());
|
||||
return Standard_False;
|
||||
}
|
||||
}
|
||||
num = 0;
|
||||
errmess = new String("Complex Record n0.%d, member type %s not found");
|
||||
sprintf (txtmes,errmess->ToCString(), num0, theName);
|
||||
ach->AddFail (txtmes,errmess->ToCString());
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
// ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ##
|
||||
|
||||
|
||||
|
@@ -120,6 +120,23 @@ public:
|
||||
//! Returns True if alphabetic order, False else
|
||||
Standard_EXPORT Standard_Boolean NamedForComplex (const Standard_CString name, const Standard_Integer num0, Standard_Integer& num, Handle(Interface_Check)& ach) const;
|
||||
|
||||
//! Determines the first component which brings a given name, or
|
||||
//! short name for a Complex Type Entity
|
||||
//! <num0> is the very first record of this entity
|
||||
//! <num> is given the last NextNamedForComplex, starts at zero
|
||||
//! it is returned as the newly found number
|
||||
//! Hence, in the normal case, NextNamedForComplex starts by num0
|
||||
//! if <num> is zero, else by NextForComplex(num)
|
||||
//! If the alphabetic order is not respected, it restarts from
|
||||
//! num0 and loops on NextForComplex until finding <name>
|
||||
//! In case of "non-alphabetic order", <ach> is filled with a
|
||||
//! Warning for this name
|
||||
//! In case of "not-found at all", <ach> is filled with a Fail,
|
||||
//! and <num> is returned as zero
|
||||
//!
|
||||
//! Returns True if alphabetic order, False else
|
||||
Standard_EXPORT Standard_Boolean NamedForComplex (const Standard_CString theName, const Standard_CString theShortName, const Standard_Integer num0, Standard_Integer& num, Handle(Interface_Check)& ach) const;
|
||||
|
||||
//! Checks Count of Parameters of record <num> to equate <nbreq>
|
||||
//! If this Check is successful, returns True
|
||||
//! Else, fills <ach> with an Error Message then returns False
|
||||
|
Reference in New Issue
Block a user