Gui: Use isBad() instead of comparing types with ==
This commit is contained in:
@@ -44,7 +44,7 @@ FilterOrigin::FilterOrigin() : FilterBase()
|
||||
bool FilterOrigin::goFilter(const Vertex &vertexIn, const Graph &graphIn, const GraphLinkContainer &linkIn) const
|
||||
{
|
||||
Base::Type originType = Base::Type::fromName("App::Origin");
|
||||
assert (originType != Base::Type::badType());
|
||||
assert (!originType.isBad());
|
||||
//if child of origin hide.
|
||||
InEdgeIterator it, itEnd;
|
||||
for (boost::tie(it, itEnd) = boost::in_edges(vertexIn, graphIn); it != itEnd; ++it)
|
||||
@@ -72,7 +72,7 @@ bool FilterTyped::goFilter(const Gui::DAG::Vertex& vertexIn, const Graph& graphI
|
||||
if (type.empty())
|
||||
return false;
|
||||
Base::Type theType = Base::Type::fromName(type.c_str());
|
||||
if (theType == Base::Type::badType())
|
||||
if (theType.isBad())
|
||||
return false;
|
||||
|
||||
const GraphLinkRecord &sourceRecord = findRecord(vertexIn, linkIn);
|
||||
|
||||
@@ -1186,11 +1186,11 @@ void Model::visiblyIsolate(Gui::DAG::Vertex sourceIn)
|
||||
std::vector<Base::Type> out;
|
||||
Base::Type type;
|
||||
type = Base::Type::fromName("App::DocumentObjectGroup");
|
||||
if (type != Base::Type::badType()) out.push_back(type);
|
||||
if (!type.isBad()) out.push_back(type);
|
||||
type = Base::Type::fromName("App::Part");
|
||||
if (type != Base::Type::badType()) out.push_back(type);
|
||||
if (!type.isBad()) out.push_back(type);
|
||||
type = Base::Type::fromName("PartDesign::Body");
|
||||
if (type != Base::Type::badType()) out.push_back(type);
|
||||
if (!type.isBad()) out.push_back(type);
|
||||
|
||||
return out;
|
||||
};
|
||||
|
||||
@@ -441,7 +441,7 @@ void DlgAddPropertyVarSet::checkGroup() {
|
||||
void DlgAddPropertyVarSet::checkType() {
|
||||
std::string type = ui->comboBoxType->currentText().toStdString();
|
||||
|
||||
if (Base::Type::fromName(type.c_str()) == Base::Type::badType()) {
|
||||
if (Base::Type::fromName(type.c_str()).isBad()) {
|
||||
throw CreatePropertyException("Invalid name");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -190,7 +190,7 @@ Base::Type DlgExpressionInput::determineTypeVarSet()
|
||||
bool DlgExpressionInput::typeOkForVarSet()
|
||||
{
|
||||
std::string unitType = impliedUnit.getTypeString();
|
||||
return determineTypeVarSet() != Base::Type::badType();
|
||||
return !determineTypeVarSet().isBad();
|
||||
}
|
||||
|
||||
void DlgExpressionInput::initializeVarSets()
|
||||
|
||||
@@ -330,7 +330,7 @@ std::vector<SelectionObject> SelectionSingleton::getObjectList(const char* pDocN
|
||||
std::map<App::DocumentObject*,size_t> SortMap;
|
||||
|
||||
// check the type
|
||||
if (typeId == Base::Type::badType())
|
||||
if (typeId.isBad())
|
||||
return temp;
|
||||
|
||||
App::Document *pcDoc = nullptr;
|
||||
@@ -519,7 +519,7 @@ vector<App::DocumentObject*> SelectionSingleton::getObjectsOfType(const Base::Ty
|
||||
std::vector<App::DocumentObject*> SelectionSingleton::getObjectsOfType(const char* typeName, const char* pDocName, ResolveMode resolve) const
|
||||
{
|
||||
Base::Type typeId = Base::Type::fromName(typeName);
|
||||
if (typeId == Base::Type::badType())
|
||||
if (typeId.isBad())
|
||||
return {};
|
||||
return getObjectsOfType(typeId, pDocName, resolve);
|
||||
}
|
||||
@@ -541,7 +541,7 @@ unsigned int SelectionSingleton::countObjectsOfType(const Base::Type& typeId, co
|
||||
unsigned int SelectionSingleton::countObjectsOfType(const char* typeName, const char* pDocName, ResolveMode resolve) const
|
||||
{
|
||||
Base::Type typeId = Base::Type::fromName(typeName);
|
||||
if (typeId == Base::Type::badType())
|
||||
if (typeId.isBad())
|
||||
return 0;
|
||||
return countObjectsOfType(typeId, pDocName, resolve);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user