mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-19 13:40:49 +03:00
0024023: Revamp the OCCT Handle -- downcast (automatic)
Automatic update by command "occt_upgrade . -downcast" C-style cast of Handle to that of derived type (now illegal) is replaced by call to DownCast() Const reference local variables of Handle type initialized by result of DownCast are replaced by normal variables.
This commit is contained in:
@@ -109,7 +109,7 @@ void TNaming_DeltaOnModification::Apply()
|
||||
{
|
||||
|
||||
Handle(TDF_Attribute) TDFAttribute = Attribute();
|
||||
Handle(TNaming_NamedShape) NS = (*((Handle(TNaming_NamedShape)*)&TDFAttribute));
|
||||
Handle(TNaming_NamedShape) NS = Handle(TNaming_NamedShape)::DownCast (TDFAttribute);
|
||||
|
||||
|
||||
// If there is no attribute, reinsert the previous. Otherwise a new one
|
||||
|
@@ -422,7 +422,7 @@ Handle(TDF_DeltaOnModification) TNaming_NamedShape::DeltaOnModification
|
||||
(const Handle(TDF_Attribute)& anOldAttribute) const
|
||||
{
|
||||
|
||||
return new TNaming_DeltaOnModification(*((Handle(TNaming_NamedShape)*)&anOldAttribute));
|
||||
return new TNaming_DeltaOnModification(Handle(TNaming_NamedShape)::DownCast (anOldAttribute));
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
|
@@ -153,7 +153,7 @@ static Standard_Boolean IsSpecificCase(const TDF_Label& F, const TopoDS_Shape&
|
||||
}
|
||||
|
||||
for(;cit.More();cit.Next()) {
|
||||
const Handle(TNaming_NamedShape)& NS = Handle(TNaming_NamedShape)::DownCast(cit.Value());
|
||||
Handle(TNaming_NamedShape) NS (Handle(TNaming_NamedShape)::DownCast(cit.Value()));
|
||||
if(!NS.IsNull()) {
|
||||
TopoDS_Shape aS = TNaming_Tool::CurrentShape(NS);
|
||||
if(aS.IsNull()) continue;
|
||||
|
@@ -587,7 +587,7 @@ void TNaming_Tool::FindShape(const TDF_LabelMap& Valid,
|
||||
#ifdef OCCT_DEBUG
|
||||
// Standard_Integer nbExtArgs = extArgs.Extent();
|
||||
#endif
|
||||
const Handle(TNaming_NamedShape)& anExtArg = Handle(TNaming_NamedShape)::DownCast(itr.Key());
|
||||
Handle(TNaming_NamedShape) anExtArg (Handle(TNaming_NamedShape)::DownCast(itr.Key()));
|
||||
const Handle(TNaming_NamedShape)& aCurrentExtArg = TNaming_Tool::CurrentNamedShape(anExtArg);
|
||||
if (!aCurrentExtArg.IsNull() && !aCurrentExtArg->IsEmpty())
|
||||
extArgs.Append(aCurrentExtArg);
|
||||
|
@@ -132,8 +132,8 @@ void TNaming_Translator::DumpMap(const Standard_Boolean isWrite) const
|
||||
T == STANDARD_TYPE (TopoDS_TCompSolid)|| T == STANDARD_TYPE (TopoDS_TCompound))
|
||||
{
|
||||
if(isWrite) {
|
||||
const Handle(TopoDS_TShape)& key = Handle(TopoDS_TShape)::DownCast(myMap.FindKey(i));
|
||||
const Handle(TopoDS_TShape)& item = Handle(TopoDS_TShape)::DownCast(myMap.FindFromIndex(i));
|
||||
Handle(TopoDS_TShape) key (Handle(TopoDS_TShape)::DownCast(myMap.FindKey(i)));
|
||||
Handle(TopoDS_TShape) item (Handle(TopoDS_TShape)::DownCast(myMap.FindFromIndex(i)));
|
||||
TopoDS_Shape S1; S1.TShape(key);
|
||||
TopoDS_Shape S2; S2.TShape(item);
|
||||
BRepTools::Write(S1, keyname.Cat(i).ToCString());
|
||||
|
Reference in New Issue
Block a user