1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-29 14:00:49 +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

@@ -158,8 +158,7 @@ Standard_Integer TDF_Attribute::UntilTransaction() const
if (IsForgotten()) return myTransaction;
else if (IsBackuped()) return myNext->myTransaction - 1;
else if (IsValid()) return myLabelNode->Data()->Transaction();
Standard_DomainError::Raise("The attribute structure is wrong.");
return 0;
throw Standard_DomainError("The attribute structure is wrong.");
}
@@ -253,7 +252,7 @@ void TDF_Attribute::Backup()
aMess = "Attribute \"";
aMess += DynamicType()->Name();
aMess += "\" is changed outside transaction";
Standard_ImmutableObject::Raise(aMess.ToCString());
throw Standard_ImmutableObject(aMess.ToCString());
}
const Standard_Integer currentTransaction =
@@ -297,7 +296,7 @@ void TDF_Attribute::RemoveBackup()
{
#ifdef OCCT_DEBUG
if (myBackup.IsNull())
Standard_DomainError::Raise("Impossible to remove a nonexistent backup.");
throw Standard_DomainError("Impossible to remove a nonexistent backup.");
#endif
myBackup->BeforeRemoval();
myBackup->myLabelNode = NULL; // Absolutly necessary!

View File

@@ -194,8 +194,7 @@ void TDF_CopyTool::CopyAttributes
if (tAtt->IsInstance(sAtt->DynamicType()))
aAttMap.Bind(sAtt,tAtt);
else
Standard_TypeMismatch::Raise
("TDF_CopyTool: Cannot paste to a different type attribute.");
throw Standard_TypeMismatch("TDF_CopyTool: Cannot paste to a different type attribute.");
}
}
}

View File

@@ -118,9 +118,9 @@ void TDF_Delta::BeforeOrAfterApply(const Standard_Boolean before) const
cout<<"AttributeDelta type = "<<itr.Value()->DynamicType()->Name();
cout<<" Attribute type = "<<itr.Value()->Attribute()->DynamicType()->Name()<<endl;;
if (before)
Standard_ConstructionError::Raise("BeforeUndo(): dead lock.");
cout<<"BeforeUndo(): dead lock."<<endl;
else
Standard_ConstructionError::Raise("AfterUndo(): dead lock.");
cout<<"AfterUndo(): dead lock."<<endl;
}
#endif
for (itr.Initialize(ADlist); itr.More(); itr.Next()) {

View File

@@ -38,7 +38,7 @@
//=======================================================================
void TDF_Label::Imported(const Standard_Boolean aStatus) const
{
if (IsNull()) Standard_NullObject::Raise("A null Label has no status.");
if (IsNull()) throw Standard_NullObject("A null Label has no status.");
if (myLabelNode->IsImported() != aStatus) {
myLabelNode->Imported(aStatus);
for (TDF_ChildIterator itr(*this, Standard_True);
@@ -57,7 +57,7 @@ Standard_Boolean TDF_Label::FindAttribute
(const Standard_GUID& anID,
Handle(TDF_Attribute)& anAttribute) const
{
if (IsNull()) Standard_NullObject::Raise("A null Label has no attribute.");
if (IsNull()) throw Standard_NullObject("A null Label has no attribute.");
TDF_AttributeIterator itr (myLabelNode); // Without removed attributes.
for ( ; itr.More(); itr.Next()) {
if (itr.Value()->ID() == anID) {
@@ -101,7 +101,7 @@ Standard_Boolean TDF_Label::FindAttribute
Standard_Integer TDF_Label::Depth() const
{
if (IsNull()) Standard_NullObject::Raise("A null Label has no depth.");
if (IsNull()) throw Standard_NullObject("A null Label has no depth.");
return myLabelNode->Depth();
}
@@ -120,7 +120,7 @@ Standard_Boolean TDF_Label::IsDescendant(const TDF_Label& aLabel) const
TDF_LabelNode* lp2 = myLabelNode;
#ifdef OCCT_DEBUG
if ((lp1 == NULL) || (lp2 == NULL))
Standard_NullObject::Raise("A null label has no ancestor nor descendant.");
throw Standard_NullObject("A null label has no ancestor nor descendant.");
#endif
if ((lp1 != NULL) && (lp2 != NULL)) {
const Standard_Integer d1 = lp1->Depth();
@@ -143,7 +143,7 @@ Standard_Boolean TDF_Label::IsDescendant(const TDF_Label& aLabel) const
const TDF_Label TDF_Label::Root() const
{
if (IsNull()) Standard_NullObject::Raise("A null Label has no root.");
if (IsNull()) throw Standard_NullObject("A null Label has no root.");
return myLabelNode->RootNode();
}
@@ -155,7 +155,7 @@ const TDF_Label TDF_Label::Root() const
Standard_Integer TDF_Label::NbChildren() const
{
if (IsNull()) Standard_NullObject::Raise("A null Label has no children.");
if (IsNull()) throw Standard_NullObject("A null Label has no children.");
Standard_Integer n = 0;
if (myLabelNode->FirstChild() != NULL)
for (TDF_ChildIterator itr(*this); itr.More(); itr.Next()) ++n;
@@ -173,9 +173,9 @@ TDF_Label TDF_Label::FindChild
const Standard_Boolean create) const
{
if (IsNull())
Standard_NullObject::Raise("A null Label has no child.");
throw Standard_NullObject("A null Label has no child.");
if (create && ((Depth()+1) & TDF_LabelNodeFlagsMsk))
Standard_OutOfRange::Raise("Depth value out of range");
throw Standard_OutOfRange("Depth value out of range");
return FindOrAddChild(aTag,create);
}
@@ -212,7 +212,7 @@ Standard_Boolean TDF_Label::IsAttribute(const Standard_GUID& anID) const
Standard_Boolean TDF_Label::HasAttribute() const
{
if (IsNull()) Standard_NullObject::Raise("A null Label has no attribute.");
if (IsNull()) throw Standard_NullObject("A null Label has no attribute.");
if (!myLabelNode->FirstAttribute().IsNull()) {
TDF_AttributeIterator itr (myLabelNode); // Without removed attributes.
@@ -229,7 +229,7 @@ Standard_Boolean TDF_Label::HasAttribute() const
Standard_Integer TDF_Label::NbAttributes() const
{
if (IsNull()) Standard_NullObject::Raise("A null Label has no attribute.");
if (IsNull()) throw Standard_NullObject("A null Label has no attribute.");
Standard_Integer n = 0;
if (!myLabelNode->FirstAttribute().IsNull())
for (TDF_AttributeIterator itr (myLabelNode); itr.More(); itr.Next()) ++n;
@@ -247,7 +247,7 @@ Standard_Integer TDF_Label::NbAttributes() const
Standard_Integer TDF_Label::Transaction() const
{
if (IsNull()) Standard_NullObject::Raise("A null Label has no transaction.");
if (IsNull()) throw Standard_NullObject("A null Label has no transaction.");
return myLabelNode->Data()->Transaction();
}
@@ -540,15 +540,15 @@ void TDF_Label::AddToNode (const TDF_LabelNodePtr& toNode,
aMess = "Attribute \"";
aMess += anAttribute->DynamicType()->Name();
aMess += "\" is added to label outside transaction";
Standard_ImmutableObject::Raise(aMess.ToCString());
throw Standard_ImmutableObject(aMess.ToCString());
}
if (!anAttribute->Label().IsNull())
Standard_DomainError::Raise("Attribute to add is already attached to a label.");
throw Standard_DomainError("Attribute to add is already attached to a label.");
Handle(TDF_Attribute) dummyAtt;
//if (Find(anAttribute->ID(),dummyAtt))
if (FindAttribute(anAttribute->ID(),dummyAtt))
Standard_DomainError::Raise("This label has already such an attribute.");
throw Standard_DomainError("This label has already such an attribute.");
anAttribute->myTransaction = toNode->Data()->Transaction(); /// myData->Transaction();
anAttribute->mySavedTransaction = 0;
@@ -579,12 +579,11 @@ void TDF_Label::ForgetFromNode (const TDF_LabelNodePtr& fromNode,
aMess = "Attribute \"";
aMess += anAttribute->DynamicType()->Name();
aMess += "\" is removed from label outside transaction";
Standard_ImmutableObject::Raise(aMess.ToCString());
throw Standard_ImmutableObject(aMess.ToCString());
}
if (fromNode != anAttribute->Label().myLabelNode)
Standard_DomainError::Raise
("Attribute to forget not attached to my label.");
throw Standard_DomainError("Attribute to forget not attached to my label.");
Standard_Integer curTrans = fromNode->Data()->Transaction();
if (!anAttribute->IsForgotten()) {
@@ -633,13 +632,11 @@ void TDF_Label::ResumeToNode (const TDF_LabelNodePtr& toNode,
const Handle(TDF_Attribute)& anAttribute) const
{
if (anAttribute.IsNull())
Standard_NullObject::Raise("The attribute is a null handle.");
throw Standard_NullObject("The attribute is a null handle.");
if (!anAttribute->Label().IsNull())
Standard_NullObject::Raise
("Cannot resume an attribute already attached to a label.");
throw Standard_NullObject("Cannot resume an attribute already attached to a label.");
if (!anAttribute->IsForgotten())
Standard_DomainError::Raise
("Cannot resume an unforgotten attribute.");
throw Standard_DomainError("Cannot resume an unforgotten attribute.");
AddToNode(toNode, anAttribute); // vro
anAttribute->Resume();

View File

@@ -94,9 +94,9 @@ Standard_Integer TDF_Transaction::Open()
cout<<"Transaction "<<myName<<" opens #"<<myDF->Transaction()+1<<endl;
#endif
if (IsOpen())
Standard_DomainError::Raise("This transaction is already open.");
throw Standard_DomainError("This transaction is already open.");
if (myDF.IsNull())
Standard_NullObject::Raise("Null TDF_Data.");
throw Standard_NullObject("Null TDF_Data.");
return myUntilTransaction = myDF->OpenTransaction();
}