Base: modernize C++11

* remove redundant void-arg
* use nullptr
* replace deprecated headers
This commit is contained in:
wmayer
2022-01-25 20:21:30 +01:00
parent 6c29c65013
commit cad0d01883
72 changed files with 628 additions and 633 deletions

View File

@@ -23,7 +23,7 @@
#include "PreCompiled.h"
#ifndef _PreComp_
# include <assert.h>
# include <cassert>
#endif
/// Here the FreeCAD includes sorted by Base,App,Gui......
@@ -42,7 +42,7 @@ struct Base::TypeData
TypeData(const char *theName,
const Type type = Type::badType(),
const Type theParent = Type::badType(),
Type::instantiationMethod method = 0
Type::instantiationMethod method = nullptr
):name(theName),parent(theParent),type(type),instMethod(method) { }
std::string name;
@@ -82,7 +82,7 @@ Type::~Type()
{
}
void *Type::createInstance(void)
void *Type::createInstance()
{
return (typedata[index]->instMethod)();
}
@@ -97,7 +97,7 @@ void *Type::createInstanceByName(const char* TypeName, bool bLoadModule)
// now the type should be in the type map
Type t = fromName(TypeName);
if (t == badType())
return 0;
return nullptr;
return t.createInstance();
}
@@ -131,7 +131,7 @@ string Type::getModuleName(const char* ClassName)
return string();
}
Type Type::badType(void)
Type Type::badType()
{
Type bad;
bad.index = 0;
@@ -153,7 +153,7 @@ const Type Type::createType(const Type parent, const char *name, instantiationMe
}
void Type::init(void)
void Type::init()
{
assert(Type::typedata.size() == 0);
@@ -164,7 +164,7 @@ void Type::init(void)
}
void Type::destruct(void)
void Type::destruct()
{
for(std::vector<TypeData*>::const_iterator it = typedata.begin();it!= typedata.end();++it)
delete *it;
@@ -192,12 +192,12 @@ Type Type::fromKey(unsigned int key)
return Type::badType();
}
const char *Type::getName(void) const
const char *Type::getName() const
{
return typedata[index]->name.c_str();
}
const Type Type::getParent(void) const
const Type Type::getParent() const
{
return typedata[index]->parent;
}
@@ -230,7 +230,7 @@ int Type::getAllDerivedFrom(const Type type, std::vector<Type> & List)
return cnt;
}
int Type::getNumTypes(void)
int Type::getNumTypes()
{
return typedata.size();
}