Import: modernize C++11
* use nullptr
This commit is contained in:
@@ -121,7 +121,7 @@ static std::string labelName(TDF_Label label) {
|
||||
}
|
||||
|
||||
static void printLabel(TDF_Label label, Handle(XCAFDoc_ShapeTool) aShapeTool,
|
||||
Handle(XCAFDoc_ColorTool) aColorTool, const char *msg = 0)
|
||||
Handle(XCAFDoc_ColorTool) aColorTool, const char *msg = nullptr)
|
||||
{
|
||||
if(label.IsNull() || !FC_LOG_INSTANCE.isEnabled(FC_LOGLEVEL_LOG))
|
||||
return;
|
||||
@@ -171,7 +171,7 @@ static void dumpLabels(TDF_Label label, Handle(XCAFDoc_ShapeTool) aShapeTool,
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
ImportOCAF2::ImportOCAF2(Handle(TDocStd_Document) h, App::Document* d, const std::string& name)
|
||||
: pDoc(h), pDocument(d), default_name(name), sequencer(0)
|
||||
: pDoc(h), pDocument(d), default_name(name), sequencer(nullptr)
|
||||
{
|
||||
aShapeTool = XCAFDoc_DocumentTool::ShapeTool (pDoc->Main());
|
||||
aColorTool = XCAFDoc_DocumentTool::ColorTool(pDoc->Main());
|
||||
@@ -303,7 +303,7 @@ App::DocumentObject *ImportOCAF2::expandShape(
|
||||
App::Document *doc, TDF_Label label, const TopoDS_Shape &shape)
|
||||
{
|
||||
if(shape.IsNull() || !TopExp_Explorer(shape,TopAbs_VERTEX).More())
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
// When saved as compound, STEP file does not support instance sharing,
|
||||
// meaning that even if the source compound may contain child shapes of
|
||||
@@ -338,7 +338,7 @@ App::DocumentObject *ImportOCAF2::expandShape(
|
||||
}
|
||||
}
|
||||
if(objs.empty())
|
||||
return 0;
|
||||
return nullptr;
|
||||
auto compound = static_cast<Part::Compound2*>(doc->addObject("Part::Compound2","Compound"));
|
||||
compound->Links.setValues(objs);
|
||||
// compound->Visibility.setValue(false);
|
||||
@@ -346,7 +346,7 @@ App::DocumentObject *ImportOCAF2::expandShape(
|
||||
return compound;
|
||||
}
|
||||
Info info;
|
||||
info.obj = 0;
|
||||
info.obj = nullptr;
|
||||
createObject(doc,label,shape,info,false);
|
||||
return info.obj;
|
||||
}
|
||||
@@ -557,7 +557,7 @@ App::DocumentObject* ImportOCAF2::loadShapes()
|
||||
ImportLegacy legacy(*this);
|
||||
legacy.setMerge(merge);
|
||||
legacy.loadShapes();
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if(FC_LOG_INSTANCE.isEnabled(FC_LOGLEVEL_LOG))
|
||||
@@ -567,7 +567,7 @@ App::DocumentObject* ImportOCAF2::loadShapes()
|
||||
aShapeTool->GetShapes(labels);
|
||||
Base::SequencerLauncher seq("Importing...",labels.Length());
|
||||
FC_MSG("free shape count " << labels.Length());
|
||||
sequencer = showProgress?&seq:0;
|
||||
sequencer = showProgress?&seq:nullptr;
|
||||
|
||||
labels.Clear();
|
||||
myShapes.clear();
|
||||
@@ -595,7 +595,7 @@ App::DocumentObject* ImportOCAF2::loadShapes()
|
||||
vis.push_back(aColorTool->IsVisible(label));
|
||||
}
|
||||
}
|
||||
App::DocumentObject *ret = 0;
|
||||
App::DocumentObject *ret = nullptr;
|
||||
if(objs.size()==1) {
|
||||
ret = objs.front();
|
||||
}else {
|
||||
@@ -624,7 +624,7 @@ App::DocumentObject* ImportOCAF2::loadShapes()
|
||||
ret = feature;
|
||||
ret->recomputeFeature(true);
|
||||
}
|
||||
sequencer = 0;
|
||||
sequencer = nullptr;
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -690,7 +690,7 @@ App::DocumentObject *ImportOCAF2::loadShape(App::Document *doc,
|
||||
TDF_Label label, const TopoDS_Shape &shape, bool baseOnly, bool newDoc)
|
||||
{
|
||||
if(shape.IsNull())
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
auto baseShape = shape.Located(TopLoc_Location());
|
||||
auto it = myShapes.find(baseShape);
|
||||
@@ -705,7 +705,7 @@ App::DocumentObject *ImportOCAF2::loadShape(App::Document *doc,
|
||||
else
|
||||
res = createAssembly(doc,baseLabel,baseShape,info,newDoc);
|
||||
if(!res)
|
||||
return 0;
|
||||
return nullptr;
|
||||
setObjectName(info,baseLabel);
|
||||
it = myShapes.emplace(baseShape,info).first;
|
||||
}
|
||||
@@ -1122,22 +1122,22 @@ void ExportOCAF2::exportObjects(std::vector<App::DocumentObject*> &objs, const c
|
||||
myNames.clear();
|
||||
mySetups.clear();
|
||||
if(objs.size()==1)
|
||||
exportObject(objs.front(),0,TDF_Label());
|
||||
exportObject(objs.front(),nullptr,TDF_Label());
|
||||
else {
|
||||
auto label = aShapeTool->NewShape();
|
||||
App::Document *doc = 0;
|
||||
App::Document *doc = nullptr;
|
||||
bool sameDoc = true;
|
||||
for(auto obj : objs) {
|
||||
if(doc)
|
||||
sameDoc = sameDoc && doc==obj->getDocument();
|
||||
else
|
||||
doc = obj->getDocument();
|
||||
exportObject(obj,0,label);
|
||||
exportObject(obj,nullptr,label);
|
||||
}
|
||||
|
||||
if(!name && doc && sameDoc)
|
||||
name = doc->getName();
|
||||
setName(label,0,name);
|
||||
setName(label,nullptr,name);
|
||||
}
|
||||
|
||||
if(FC_LOG_INSTANCE.isEnabled(FC_LOGLEVEL_LOG))
|
||||
@@ -1153,7 +1153,7 @@ TDF_Label ExportOCAF2::exportObject(App::DocumentObject* parentObj,
|
||||
const char *sub, TDF_Label parent, const char *name)
|
||||
{
|
||||
App::DocumentObject *obj;
|
||||
auto shape = Part::Feature::getTopoShape(parentObj,sub,false,0,&obj,false,!sub);
|
||||
auto shape = Part::Feature::getTopoShape(parentObj,sub,false,nullptr,&obj,false,!sub);
|
||||
if(!obj || shape.isNull()) {
|
||||
if (obj)
|
||||
FC_WARN(obj->getFullName() << " has null shape");
|
||||
@@ -1214,7 +1214,7 @@ TDF_Label ExportOCAF2::exportObject(App::DocumentObject* parentObj,
|
||||
setupObject(label,name?parentObj:obj,shape,prefix,name);
|
||||
return label;
|
||||
}
|
||||
auto next = linked->getLinkedObject(false,0,false,depth++);
|
||||
auto next = linked->getLinkedObject(false,nullptr,false,depth++);
|
||||
if(!next || linked==next)
|
||||
break;
|
||||
linked = next;
|
||||
@@ -1258,7 +1258,7 @@ TDF_Label ExportOCAF2::exportObject(App::DocumentObject* parentObj,
|
||||
label = aShapeTool->AddShape(shape.getShape(),Standard_False, Standard_False);
|
||||
auto o = name?parentObj:obj;
|
||||
if(o!=linked)
|
||||
setupObject(label,linked,shape,prefix,0,true);
|
||||
setupObject(label,linked,shape,prefix,nullptr,true);
|
||||
setupObject(label,o,shape,prefix,name,true);
|
||||
}
|
||||
|
||||
@@ -1278,9 +1278,9 @@ TDF_Label ExportOCAF2::exportObject(App::DocumentObject* parentObj,
|
||||
// check for link array
|
||||
auto linkArray = obj->getLinkedObject(true)->getExtensionByType<App::LinkBaseExtension>(true);
|
||||
if(linkArray && (linkArray->getShowElementValue() || !linkArray->getElementCountValue()))
|
||||
linkArray = 0;
|
||||
linkArray = nullptr;
|
||||
for(auto &subobj : subs) {
|
||||
App::DocumentObject *parentGrp = 0;
|
||||
App::DocumentObject *parentGrp = nullptr;
|
||||
std::string childName;
|
||||
auto sobj = obj->resolve(subobj.c_str(),&parentGrp,&childName);
|
||||
if(!sobj) {
|
||||
@@ -1303,7 +1303,7 @@ TDF_Label ExportOCAF2::exportObject(App::DocumentObject* parentObj,
|
||||
if(!vis && !exportHidden)
|
||||
continue;
|
||||
|
||||
TDF_Label childLabel = exportObject(obj,subobj.c_str(),label,linkArray?childName.c_str():0);
|
||||
TDF_Label childLabel = exportObject(obj,subobj.c_str(),label,linkArray?childName.c_str():nullptr);
|
||||
if(childLabel.IsNull())
|
||||
continue;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user