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

0026937: Eliminate NO_CXX_EXCEPTION macro support

Macro NO_CXX_EXCEPTION was removed from code.
Method Raise() was replaced by explicit throw statement.
Method Standard_Failure::Caught() was replaced by normal C++mechanism of exception transfer.
Method Standard_Failure::Caught() is deprecated now.
Eliminated empty constructors.
Updated samples.
Eliminate empty method ChangeValue from NCollection_Map class.
Removed not operable methods from NCollection classes.
This commit is contained in:
ski
2017-02-02 16:35:21 +03:00
committed by apn
parent 0c63f2f8b9
commit 9775fa6110
1146 changed files with 4860 additions and 6183 deletions

View File

@@ -30,14 +30,12 @@ Standard_Integer StepData_FieldList::NbFields () const
const StepData_Field& StepData_FieldList::Field (const Standard_Integer) const
{
Standard_OutOfRange::Raise("StepData_FieldList : Field");
return nulfild;
throw Standard_OutOfRange("StepData_FieldList : Field");
}
StepData_Field& StepData_FieldList::CField (const Standard_Integer)
{
Standard_OutOfRange::Raise("StepData_FieldList : CField");
return nulfild;
throw Standard_OutOfRange("StepData_FieldList : CField");
}

View File

@@ -23,12 +23,12 @@ Standard_Integer StepData_FieldList1::NbFields () const
const StepData_Field& StepData_FieldList1::Field (const Standard_Integer num) const
{
if (num != 1) Standard_OutOfRange::Raise("StepData_FieldList1 : Field");
if (num != 1) throw Standard_OutOfRange("StepData_FieldList1 : Field");
return thefield;
}
StepData_Field& StepData_FieldList1::CField (const Standard_Integer num)
{
if (num != 1) Standard_OutOfRange::Raise("StepData_FieldList1 : CField");
if (num != 1) throw Standard_OutOfRange("StepData_FieldList1 : CField");
return thefield;
}

View File

@@ -30,12 +30,12 @@ Standard_Integer StepData_FieldListD::NbFields () const
const StepData_Field& StepData_FieldListD::Field (const Standard_Integer num) const
{
if (thefields.IsNull()) Standard_OutOfRange::Raise("StepData_FieldListD::Field");
if (thefields.IsNull()) throw Standard_OutOfRange("StepData_FieldListD::Field");
return thefields->Value(num);
}
StepData_Field& StepData_FieldListD::CField (const Standard_Integer num)
{
if (thefields.IsNull()) Standard_OutOfRange::Raise("StepData_FieldListD::Field");
if (thefields.IsNull()) throw Standard_OutOfRange("StepData_FieldListD::Field");
return thefields->ChangeValue(num);
}

View File

@@ -77,8 +77,7 @@ static StepData_Field bid;
ent = Member(i);
if (ent->HasField (name)) return ent->Field (name);
}
Interface_InterfaceMismatch::Raise("StepData_Plex : Field");
return bid; // pour faire plaisir au compilo
throw Interface_InterfaceMismatch("StepData_Plex : Field");
}
@@ -90,8 +89,7 @@ static StepData_Field bid;
ent = Member(i);
if (ent->HasField (name)) return ent->CField (name);
}
Interface_InterfaceMismatch::Raise("StepData_Plex : Field");
return bid; // pour faire plaisir au compilo
throw Interface_InterfaceMismatch("StepData_Plex : Field");
}

View File

@@ -36,7 +36,7 @@ Standard_Boolean StepData_SelectType::Matches
{
if (ent.IsNull()) thevalue.Nullify();
else if (!Matches(ent))
Standard_TypeMismatch::Raise ("StepData : SelectType, SetValue");
throw Standard_TypeMismatch("StepData : SelectType, SetValue");
else thevalue = ent;
}
@@ -97,7 +97,7 @@ Standard_Boolean StepData_SelectType::Matches
void StepData_SelectType::SetInt (const Standard_Integer val)
{
DeclareAndCast(StepData_SelectMember,sm,thevalue);
if (sm.IsNull()) Standard_TypeMismatch::Raise ("StepData : SelectType, SetInt");
if (sm.IsNull()) throw Standard_TypeMismatch("StepData : SelectType, SetInt");
sm->SetInt (val);
}
@@ -110,7 +110,7 @@ static Handle(StepData_SelectMember) SelectVal
DeclareAndCast(StepData_SelectMember,sm,thevalue);
if (!sm.IsNull()) {
if (name && name[0] != '\0')
if (!sm->SetName(name)) Standard_TypeMismatch::Raise ("StepData : SelectType, SetInteger");
if (!sm->SetName(name)) throw Standard_TypeMismatch("StepData : SelectType, SetInteger");
}
else if (name && name[0] != '\0') {
Handle(StepData_SelectNamed) sn = new StepData_SelectNamed;
@@ -136,7 +136,7 @@ static Handle(StepData_SelectMember) SelectVal
{
Handle(StepData_SelectMember) sm = SelectVal (thevalue,name,0);
sm->SetInteger (val);
if (CaseMem (sm) == 0) Standard_TypeMismatch::Raise ("StepData : SelectType, SetInteger");
if (CaseMem (sm) == 0) throw Standard_TypeMismatch("StepData : SelectType, SetInteger");
thevalue = sm;
}
@@ -152,7 +152,7 @@ static Handle(StepData_SelectMember) SelectVal
{
Handle(StepData_SelectMember) sm = SelectVal (thevalue,name,0);
sm->SetBoolean (val);
if (CaseMem (sm) == 0) Standard_TypeMismatch::Raise ("StepData : SelectType, SetBoolean");
if (CaseMem (sm) == 0) throw Standard_TypeMismatch("StepData : SelectType, SetBoolean");
thevalue = sm;
}
@@ -168,7 +168,7 @@ static Handle(StepData_SelectMember) SelectVal
{
Handle(StepData_SelectMember) sm = SelectVal (thevalue,name,0);
sm->SetLogical (val);
if (CaseMem (sm) == 0) Standard_TypeMismatch::Raise ("StepData : SelectType, SetLogical");
if (CaseMem (sm) == 0) throw Standard_TypeMismatch("StepData : SelectType, SetLogical");
thevalue = sm;
}
@@ -184,7 +184,7 @@ Standard_Real StepData_SelectType::Real () const
{
Handle(StepData_SelectMember) sm = SelectVal (thevalue,name,1);
sm->SetReal (val);
if (CaseMem (sm) == 0) Standard_TypeMismatch::Raise ("StepData : SelectType, SetReal");
if (CaseMem (sm) == 0) throw Standard_TypeMismatch("StepData : SelectType, SetReal");
thevalue = sm;
}

View File

@@ -56,14 +56,14 @@ StepData_Simple::StepData_Simple (const Handle(StepData_ESDescr)& descr)
const StepData_Field& StepData_Simple::Field (const Standard_CString name) const
{
Standard_Integer num = ESDescr()->Rank (name);
if (num == 0) Interface_InterfaceMismatch::Raise("StepData_Simple : Field");
if (num == 0) throw Interface_InterfaceMismatch("StepData_Simple : Field");
return FieldNum (num);
}
StepData_Field& StepData_Simple::CField (const Standard_CString name)
{
Standard_Integer num = ESDescr()->Rank (name);
if (num == 0) Interface_InterfaceMismatch::Raise("StepData_Simple : Field");
if (num == 0) throw Interface_InterfaceMismatch("StepData_Simple : Field");
return CFieldNum (num);
}

View File

@@ -97,10 +97,10 @@ void StepData_StepReaderTool::Prepare (const Standard_Boolean optim)
stepdat->SetEntityNumbers(optim);
SetEntities();
}
catch(Standard_Failure) {
catch(Standard_Failure const& anException) {
Handle(Message_Messenger) sout = Message::DefaultMessenger();
sout << " Exception Raised during Preparation :\n";
sout << Standard_Failure::Caught()->GetMessageString();
sout << anException.GetMessageString();
sout << "\n Now, trying to continue, but with presomption of failure\n";
}
}

View File

@@ -119,7 +119,7 @@ void StepData_StepWriter::SetScope (const Standard_Integer numscope,
{
Standard_Integer nb = themodel->NbEntities();
if (numscope <= 0 || numscope > nb || numin <= 0 || numin > nb)
Interface_InterfaceMismatch::Raise("StepWriter : SetScope, out of range");
throw Interface_InterfaceMismatch("StepWriter : SetScope, out of range");
if (thescopenext.IsNull()) {
thescopebeg = new TColStd_HArray1OfInteger (1,nb); thescopebeg->Init(0);
thescopeend = new TColStd_HArray1OfInteger (1,nb); thescopeend->Init(0);
@@ -130,7 +130,7 @@ void StepData_StepWriter::SetScope (const Standard_Integer numscope,
cout << "StepWriter : SetScope (scope : " << numscope << " entity : "
<< numin << "), Entity already in a Scope"<<endl;
#endif
Interface_InterfaceMismatch::Raise("StepWriter : SetScope, already set");
throw Interface_InterfaceMismatch("StepWriter : SetScope, already set");
}
thescopenext->SetValue(numin,-1); // nouvelle fin de scope
if (thescopebeg->Value(numscope) == 0) thescopebeg->SetValue(numscope,numin);
@@ -258,7 +258,7 @@ void StepData_StepWriter::SendHeader ()
void StepData_StepWriter::SendData ()
{
if (thesect) Interface_InterfaceMismatch::Raise("StepWriter : Data section");
if (thesect) throw Interface_InterfaceMismatch("StepWriter : Data section");
NewLine(Standard_False);
thefile->Append (new TCollection_HAsciiString("DATA;"));
thesect = Standard_True;
@@ -284,7 +284,7 @@ void StepData_StepWriter::EndSec ()
void StepData_StepWriter::EndFile ()
{
if (thesect) Interface_InterfaceMismatch::Raise("StepWriter : EndFile");
if (thesect) throw Interface_InterfaceMismatch("StepWriter : EndFile");
NewLine(Standard_False);
thefile->Append (new TCollection_HAsciiString("END-ISO-10303-21;"));
thesect = Standard_False;
@@ -489,7 +489,7 @@ void StepData_StepWriter::Comment (const Standard_Boolean mode)
void StepData_StepWriter::SendComment(const Handle(TCollection_HAsciiString)& text)
{
if (!thecomm) Interface_InterfaceMismatch::Raise("StepWriter : Comment");
if (!thecomm) throw Interface_InterfaceMismatch("StepWriter : Comment");
AddString(text->ToCString(),text->Length());
}
@@ -501,7 +501,7 @@ void StepData_StepWriter::SendComment(const Handle(TCollection_HAsciiString)& te
void StepData_StepWriter::SendComment (const Standard_CString text)
{
if (!thecomm) Interface_InterfaceMismatch::Raise("StepWriter : Comment");
if (!thecomm) throw Interface_InterfaceMismatch("StepWriter : Comment");
AddString(text,(Standard_Integer) strlen(text));
}
@@ -515,8 +515,7 @@ void StepData_StepWriter::StartEntity(const TCollection_AsciiString& atype)
{
if (atype.Length() == 0) return;
if (themult) {
if (thelevel != 1) Interface_InterfaceMismatch::Raise
("StepWriter : StartEntity"); // decompte de parentheses mauvais ...
if (thelevel != 1) throw Interface_InterfaceMismatch("StepWriter : StartEntity"); // decompte de parentheses mauvais ...
AddString(textendlist);
AddString(" ",1); //skl 29.01.2003
}
@@ -876,7 +875,7 @@ void StepData_StepWriter::Send (const Handle(Standard_Transient)& val)
char lident[20];
// Undefined ?
if (val.IsNull()) {
// Interface_InterfaceMismatch::Raise("StepWriter : Sending Null Reference");
// throw Interface_InterfaceMismatch("StepWriter : Sending Null Reference");
thechecks.CCheck(thenum)->AddFail("Null Reference");
SendUndef();
Comment(Standard_True);
@@ -906,7 +905,7 @@ void StepData_StepWriter::Send (const Handle(Standard_Transient)& val)
Comment(Standard_True);
SendComment(" UNKNOWN REF ");
Comment(Standard_False);
// Interface_InterfaceMismatch::Raise("StepWriter : Sending Unknown Reference");
// throw Interface_InterfaceMismatch("StepWriter : Sending Unknown Reference");
}
}
// Cas normal : une bonne Entite, on envoie son Ident.
@@ -1062,8 +1061,7 @@ void StepData_StepWriter::SendDerived ()
void StepData_StepWriter::EndEntity ()
{
if (thelevel != 1) Interface_InterfaceMismatch::Raise
("StepWriter : EndEntity"); // decompte de parentheses mauvais ...
if (thelevel != 1) throw Interface_InterfaceMismatch("StepWriter : EndEntity"); // decompte de parentheses mauvais ...
AddString(textendent);
thelevel = 0; // on garde theindval : sera traite au prochain NewLine
Standard_Boolean indent = theindent; theindent = Standard_False;