Replace NULL by nullptr

This commit is contained in:
Jan Möbius
2019-05-29 10:11:42 +02:00
parent f1b31421dd
commit b083f32a23
31 changed files with 84 additions and 84 deletions

View File

@@ -70,7 +70,7 @@ protected:
public:
AutoPropertyHandleT()
: m_(NULL), own_property_(false)
: m_(nullptr), own_property_(false)
{}
AutoPropertyHandleT(const Self& _other)

View File

@@ -434,7 +434,7 @@ public:
const value_type* data() const {
if( data_.empty() )
return 0;
return nullptr;
return (value_type*) &data_[0];
}

View File

@@ -102,8 +102,8 @@ public:
{
Properties::iterator p_it=properties_.begin(), p_end=properties_.end();
int idx=0;
for ( ; p_it!=p_end && *p_it!=NULL; ++p_it, ++idx ) {};
if (p_it==p_end) properties_.push_back(NULL);
for ( ; p_it!=p_end && *p_it!=nullptr; ++p_it, ++idx ) {};
if (p_it==p_end) properties_.push_back(nullptr);
properties_[idx] = new PropertyT<T>(_name);
return BasePropHandleT<T>(idx);
}
@@ -115,11 +115,11 @@ public:
Properties::const_iterator p_it = properties_.begin();
for (int idx=0; p_it != properties_.end(); ++p_it, ++idx)
{
if (*p_it != NULL &&
if (*p_it != nullptr &&
(*p_it)->name() == _name //skip deleted properties
// Skip type check
#ifndef OM_FORCE_STATIC_CAST
&& dynamic_cast<PropertyT<T>*>(properties_[idx]) != NULL //check type
&& dynamic_cast<PropertyT<T>*>(properties_[idx]) != nullptr //check type
#endif
)
{
@@ -134,23 +134,23 @@ public:
Properties::const_iterator p_it = properties_.begin();
for (int idx=0; p_it != properties_.end(); ++p_it, ++idx)
{
if (*p_it != NULL && (*p_it)->name() == _name) //skip deleted properties
if (*p_it != nullptr && (*p_it)->name() == _name) //skip deleted properties
{
return *p_it;
}
}
return NULL;
return nullptr;
}
template <class T> PropertyT<T>& property(BasePropHandleT<T> _h)
{
assert(_h.idx() >= 0 && _h.idx() < (int)properties_.size());
assert(properties_[_h.idx()] != NULL);
assert(properties_[_h.idx()] != nullptr);
#ifdef OM_FORCE_STATIC_CAST
return *static_cast <PropertyT<T>*> (properties_[_h.idx()]);
#else
PropertyT<T>* p = dynamic_cast<PropertyT<T>*>(properties_[_h.idx()]);
assert(p != NULL);
assert(p != nullptr);
return *p;
#endif
}
@@ -159,12 +159,12 @@ public:
template <class T> const PropertyT<T>& property(BasePropHandleT<T> _h) const
{
assert(_h.idx() >= 0 && _h.idx() < (int)properties_.size());
assert(properties_[_h.idx()] != NULL);
assert(properties_[_h.idx()] != nullptr);
#ifdef OM_FORCE_STATIC_CAST
return *static_cast<PropertyT<T>*>(properties_[_h.idx()]);
#else
PropertyT<T>* p = dynamic_cast<PropertyT<T>*>(properties_[_h.idx()]);
assert(p != NULL);
assert(p != nullptr);
return *p;
#endif
}
@@ -174,7 +174,7 @@ public:
{
assert(_h.idx() >= 0 && _h.idx() < (int)properties_.size());
delete properties_[_h.idx()];
properties_[_h.idx()] = NULL;
properties_[_h.idx()] = nullptr;
}
@@ -281,8 +281,8 @@ protected: // generic add/get
{
Properties::iterator p_it=properties_.begin(), p_end=properties_.end();
size_t idx=0;
for (; p_it!=p_end && *p_it!=NULL; ++p_it, ++idx) {};
if (p_it==p_end) properties_.push_back(NULL);
for (; p_it!=p_end && *p_it!=nullptr; ++p_it, ++idx) {};
if (p_it==p_end) properties_.push_back(nullptr);
properties_[idx] = _bp;
return idx;
}
@@ -290,18 +290,18 @@ protected: // generic add/get
BaseProperty& _property( size_t _idx )
{
assert( _idx < properties_.size());
assert( properties_[_idx] != NULL);
assert( properties_[_idx] != nullptr);
BaseProperty *p = properties_[_idx];
assert( p != NULL );
assert( p != nullptr );
return *p;
}
const BaseProperty& _property( size_t _idx ) const
{
assert( _idx < properties_.size());
assert( properties_[_idx] != NULL);
assert( properties_[_idx] != nullptr);
BaseProperty *p = properties_[_idx];
assert( p != NULL );
assert( p != nullptr );
return *p;
}