Commit 563e416f authored by Jan Möbius's avatar Jan Möbius
Browse files

Use nullptr

parent b0476b16
......@@ -113,16 +113,16 @@ bool getTargetPolylines( std::vector<PolyLine*>& _polylines )
bool getObject( int _identifier , PolyLineObject*& _object ) {
if ( _identifier == BaseObject::NOOBJECT ) {
_object = 0;
_object = nullptr;
return false;
}
// Get object by using the map accelerated plugin function
BaseObjectData* object = 0;
BaseObjectData* object = nullptr;
PluginFunctions::getObject(_identifier,object);
_object = dynamic_cast< PolyLineObject* >(object);
return ( _object != 0 );
return ( _object !=nullptr );
}
......@@ -135,27 +135,27 @@ PolyLine* polyLine( BaseObjectData* _object ) {
PolyLineObject* object = dynamic_cast< PolyLineObject* >(_object);
return object->line();
} else
return 0;
return nullptr;
}
PolyLineObject* polyLineObject( BaseObjectData* _object ) {
if ( ! _object->dataType(DATA_POLY_LINE) )
return 0;
return nullptr;
return dynamic_cast< PolyLineObject* >( _object );
}
PolyLineObject* polyLineObject( int _objectId ) {
if (_objectId == BaseObject::NOOBJECT)
return 0;
return nullptr;
// Get object by using the map accelerated plugin function
BaseObjectData* object = 0;
PluginFunctions::getObject(_objectId,object);
if ( object == 0 )
return 0;
if ( object == nullptr )
return nullptr;
PolyLineObject* meshObject = dynamic_cast< PolyLineObject* >(object);
......
......@@ -68,8 +68,8 @@
*/
PolyLineObject::PolyLineObject() :
BaseObjectData( ),
line_(NULL),
lineNode_(NULL)
line_(nullptr),
lineNode_(nullptr)
{
setDataType(DATA_POLY_LINE);
init();
......@@ -103,15 +103,15 @@ PolyLineObject::~PolyLineObject()
deleteData();
// Delete the Mesh only, if this object contains a mesh
if ( line_ != NULL) {
if ( line_ != nullptr) {
delete line_;
line_ = NULL;
line_ = nullptr;
} else {
std::cerr << "Destructor error : Line already deleted" << std::endl;
}
// No need to delete the scenegraph Nodes as this will be managed by baseplugin
lineNode_ = NULL;
lineNode_ = nullptr;
}
/** Cleanup Function for Line Objects. Deletes the contents of the whole object and
......@@ -119,16 +119,16 @@ PolyLineObject::~PolyLineObject()
*/
void PolyLineObject::cleanup() {
// Delete the Line only, if this object contains a line
if ( line_ != NULL) {
if ( line_ != nullptr) {
delete line_;
line_ = NULL;
line_ = nullptr;
} else {
std::cerr << "Cleanup error : Line already deleted" << std::endl;
}
BaseObjectData::cleanup();
lineNode_ = NULL;
lineNode_ = nullptr;
setDataType(DATA_POLY_LINE);
......@@ -162,8 +162,8 @@ void PolyLineObject::init(PolyLine* _line) {
line()->request_vertex_fhandles();
if ( materialNode() == NULL)
std::cerr << "Error when creating Line Object! materialNode is NULL!" << std::endl;
if ( materialNode() == nullptr)
std::cerr << "Error when creating Line Object! materialNode is nullptr!" << std::endl;
lineNode_ = new ACG::SceneGraph::PolyLineNodeT< PolyLine >(*line_, materialNode() , "NEW LineNode");
......
......@@ -119,11 +119,11 @@ bool getObject( int _identifier , PolyLineCollectionObject*& _object ) {
}*/
// Get object by using the map accelerated plugin function
BaseObjectData* object = 0;
BaseObjectData* object = nullptr;
PluginFunctions::getObject(_identifier,object);
_object = dynamic_cast< PolyLineCollectionObject* >(object);
return ( _object != 0 );
return ( _object != nullptr );
}
......@@ -136,24 +136,24 @@ PolyLineCollection* polyLineCollection( BaseObjectData* _object ) {
PolyLineCollectionObject* object = dynamic_cast< PolyLineCollectionObject* >(_object);
return object->collection();
} else
return 0;
return nullptr;
}
PolyLineCollectionObject* polyLineCollectionObject( BaseObjectData* _object ) {
if ( ! _object->dataType(DATA_POLY_LINE_COLLECTION) )
return 0;
return nullptr;
return dynamic_cast< PolyLineCollectionObject* >( _object );
}
PolyLineCollectionObject* polyLineCollectionObject( int _objectId ) {
// Get object by using the map accelerated plugin function
BaseObjectData* object = 0;
BaseObjectData* object = nullptr;
PluginFunctions::getObject(_objectId,object);
if ( object == 0 )
return 0;
if ( object == nullptr )
return nullptr;
PolyLineCollectionObject* meshObject = dynamic_cast< PolyLineCollectionObject* >(object);
......
......@@ -69,8 +69,8 @@
*/
PolyLineCollectionObject::PolyLineCollectionObject() :
BaseObjectData( ),
collection_(NULL),
collectionNode_(NULL)
collection_(nullptr),
collectionNode_(nullptr)
{
setDataType(DATA_POLY_LINE_COLLECTION);
init();
......@@ -103,15 +103,15 @@ PolyLineCollectionObject::~PolyLineCollectionObject()
deleteData();
// Delete the collection only, if this object contains a collection
if ( collection_ != NULL) {
if ( collection_ != nullptr) {
delete collection_;
collection_ = NULL;
collection_ = nullptr;
} else {
std::cerr << "Destructor error : Line Collection already deleted" << std::endl;
}
// No need to delete the scenegraph Nodes as this will be managed by BasePlugin
collectionNode_ = NULL;
collectionNode_ = nullptr;
}
/** Cleanup Function for Collection Objects. Deletes the contents of the whole object and
......@@ -120,16 +120,16 @@ PolyLineCollectionObject::~PolyLineCollectionObject()
void PolyLineCollectionObject::cleanup() {
// Delete the Collection only, if this object contains a Collection
if ( collection_ != NULL) {
if ( collection_ != nullptr) {
delete collection_;
collection_ = NULL;
collection_ = nullptr;
} else {
std::cerr << "Cleanup error : Line already deleted" << std::endl;
}
BaseObjectData::cleanup();
collectionNode_ = NULL;
collectionNode_ = nullptr;
setDataType(DATA_POLY_LINE_COLLECTION);
......@@ -157,8 +157,8 @@ void PolyLineCollectionObject::init(PolyLineCollection* _collection) {
// request default properties (managed by the polyline collection)
if ( materialNode() == NULL)
std::cerr << "Error when creating Line Object! materialNode is NULL!" << std::endl;
if ( materialNode() == nullptr)
std::cerr << "Error when creating Line Object! materialNode is nullptr!" << std::endl;
collectionNode_ = new ACG::SceneGraph::PolyLineCollectionNodeT< PolyLineCollection >(*collection_, materialNode() , "NEW PolyLineCollection");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment