diff --git a/esignal/Base.cpp b/esignal/Base.cpp index 12aad7f..33af05a 100644 --- a/esignal/Base.cpp +++ b/esignal/Base.cpp @@ -33,7 +33,7 @@ void esignal::BaseInternal::setDescription(const etk::String& _desc) { } esignal::Base::Base() : - m_data(nullptr) { + m_data(null) { } @@ -42,7 +42,7 @@ esignal::Base::~Base() { } const etk::String& esignal::Base::getName() const { - if (m_data != nullptr) { + if (m_data != null) { return m_data->getName(); } static etk::String noValue; @@ -50,7 +50,7 @@ const etk::String& esignal::Base::getName() const { } const etk::String& esignal::Base::getDescription() const { - if (m_data != nullptr) { + if (m_data != null) { return m_data->getDescription(); } static etk::String noValue; @@ -58,7 +58,7 @@ const etk::String& esignal::Base::getDescription() const { } void esignal::Base::setPeriodic(bool _state) { - if (m_data != nullptr) { + if (m_data != null) { m_data->setPeriodic(_state); } } diff --git a/esignal/Connection.cpp b/esignal/Connection.cpp index ccdb73c..73c014e 100644 --- a/esignal/Connection.cpp +++ b/esignal/Connection.cpp @@ -7,7 +7,7 @@ #include esignal::Connection::Connection(): - m_data(nullptr), + m_data(null), m_uid(0) { } @@ -36,7 +36,7 @@ esignal::Connection& esignal::Connection::operator=(esignal::Connection&& _obj) esignal::Connection::~Connection() { ememory::SharedPtr ref = m_data.lock(); - if (ref == nullptr) { + if (ref == null) { return; } ref->disconnect(m_uid); @@ -46,7 +46,7 @@ esignal::Connection::~Connection() { void esignal::Connection::disconnect() { ememory::SharedPtr ref = m_data.lock(); - if (ref == nullptr) { + if (ref == null) { return; } ref->disconnect(m_uid); diff --git a/esignal/InterfaceData.cpp b/esignal/InterfaceData.cpp index e9e00e3..8356242 100644 --- a/esignal/InterfaceData.cpp +++ b/esignal/InterfaceData.cpp @@ -19,8 +19,8 @@ esignal::InterfaceData::~InterfaceData() { // note this pointer is not allocated and not free at the end of the class void esignal::InterfaceData::add(esignal::Base* _pointerOnSignal) { - if (_pointerOnSignal == nullptr) { - ESIGNAL_ERROR("Try to link a nullptr parameters"); + if (_pointerOnSignal == null) { + ESIGNAL_ERROR("Try to link a null parameters"); return; } m_list.pushBack(_pointerOnSignal); @@ -29,7 +29,7 @@ void esignal::InterfaceData::add(esignal::Base* _pointerOnSignal) { void esignal::InterfaceData::remove(esignal::Base* _pointerOnSignal) { auto it = m_list.begin(); while (it != m_list.end()) { - if ( *it == nullptr + if ( *it == null || *it == _pointerOnSignal) { it = m_list.erase(it); } else { @@ -41,7 +41,7 @@ void esignal::InterfaceData::remove(esignal::Base* _pointerOnSignal) { etk::Vector esignal::InterfaceData::getAll() const { etk::Vector out; for (auto &it : m_list) { - if(it != nullptr) { + if(it != null) { out.pushBack(it->getName()); } } @@ -49,12 +49,12 @@ etk::Vector esignal::InterfaceData::getAll() const { } void esignal::InterfaceData::disconnect(const ememory::SharedPtr& _object) { - if (_object == nullptr) { - ESIGNAL_ERROR("Input ERROR nullptr pointer Object ..."); + if (_object == null) { + ESIGNAL_ERROR("Input ERROR null pointer Object ..."); return; } for(auto &it : m_list) { - if (it == nullptr) { + if (it == null) { continue; } it->disconnectShared(_object); diff --git a/esignal/Signal.hpp b/esignal/Signal.hpp index 736e78d..cd0b4b6 100644 --- a/esignal/Signal.hpp +++ b/esignal/Signal.hpp @@ -150,7 +150,7 @@ namespace esignal { * @param[in] _name Static name of the signal. * @param[in] _description Description of the signal. */ - Signal(esignal::BaseInternal::ObserverConnection _countObs=nullptr, + Signal(esignal::BaseInternal::ObserverConnection _countObs=null, const etk::String& _name="", const etk::String& _description=""); /** @@ -216,7 +216,7 @@ namespace esignal { */ template< class OBSERVER_TYPE > esignal::Connection connect(OBSERVER_TYPE&& _observer) { - if (m_data == nullptr) { + if (m_data == null) { return esignal::Connection(); } ememory::SharedPtr> pointer = ememory::staticPointerCast>(m_data); @@ -233,7 +233,7 @@ namespace esignal { esignal::Connection connect(CLASS_TYPE* _class, FUNC_TYPE _func, FUNC_ARGS_TYPE... _args) { - if (m_data == nullptr) { + if (m_data == null) { return esignal::Connection(); } ememory::SharedPtr> pointer = ememory::staticPointerCast>(m_data); @@ -249,7 +249,7 @@ namespace esignal { void connect(const ememory::SharedPtr& _class, void (CLASS_TYPE::*_func)(const T_ARGS&..., FUNC_ARGS_TYPE...), FUNC_ARGS_TYPE... _args) { - if (m_data == nullptr) { + if (m_data == null) { return; } ememory::SharedPtr> pointer = ememory::staticPointerCast>(m_data); @@ -261,7 +261,7 @@ namespace esignal { * @param[in] _args Argument data to emit. */ void emit(const T_ARGS&... _args) { - if (m_data == nullptr) { + if (m_data == null) { return; } ememory::SharedPtr> pointer = ememory::staticPointerCast>(m_data); @@ -273,7 +273,7 @@ namespace esignal { * @param[in] _obj Link with the object to check */ void disconnectShared(const ememory::SharedPtr& _obj) override { - if (m_data == nullptr) { + if (m_data == null) { return;; } m_data->disconnectShared(_obj); @@ -283,7 +283,7 @@ namespace esignal { * @return The count of observer. */ size_t size() const { - if (m_data == nullptr) { + if (m_data == null) { return 0; } return m_data->size(); @@ -294,7 +294,7 @@ namespace esignal { * @return false No observers. */ bool empty() const { - if (m_data == nullptr) { + if (m_data == null) { return true; } return m_data->empty(); @@ -303,7 +303,7 @@ namespace esignal { * @brief Clear all connectd observers. */ void clear() { - if (m_data == nullptr) { + if (m_data == null) { return; } m_data->clear(); @@ -319,7 +319,7 @@ esignal::Connection esignal::SignalInternal::connect(OBSERVER_TYPE&& ememory::UniquePtr executer(ETK_NEW(Executor, etk::forward(_observer))); size_t uid = executer->m_uid; m_executors.pushBack(etk::move(executer)); - if (m_connectionObserver!=nullptr) { + if (m_connectionObserver!=null) { m_connectionObserver(m_executors.size()); } ESIGNAL_DEBUG(" '" << getName() << "' new count: " << m_executors.size()); @@ -332,8 +332,8 @@ esignal::Connection esignal::SignalInternal::connect(CLASS_TYPE* _cla FUNC_TYPE _func, FUNC_ARGS_TYPE... _arg) { ESIGNAL_DEBUG("esignal: '" << getName() << "' try connect: '" << getName() << "' (reference)"); - if (_class == nullptr) { - ESIGNAL_ERROR(" '" << getName() << "' Class pointer in nullptr"); + if (_class == null) { + ESIGNAL_ERROR(" '" << getName() << "' Class pointer in null"); return esignal::Connection(); } ememory::UniquePtr executer(ETK_NEW(Executor, [=](const T_ARGS& ... _argBase){ @@ -341,7 +341,7 @@ esignal::Connection esignal::SignalInternal::connect(CLASS_TYPE* _cla })); size_t uid = executer->m_uid; m_executors.pushBack(etk::move(executer)); - if (m_connectionObserver != nullptr) { + if (m_connectionObserver != null) { m_connectionObserver(m_executors.size()); } ESIGNAL_DEBUG(" '" << getName() << "' new count: " << m_executors.size()); @@ -354,12 +354,12 @@ void esignal::SignalInternal::connect(const ememory::SharedPtr obj2 = ememory::dynamicPointerCast(_class); - if (obj2 == nullptr) { + if (obj2 == null) { ESIGNAL_ERROR("Can not connect signal ..."); return; } @@ -369,7 +369,7 @@ void esignal::SignalInternal::connect(const ememory::SharedPtr::Signal(CLASS_TYPE* _class, FUNC_TYPE _func, const etk::String& _name, const etk::String& _description): - m_signalInterfaceLink(nullptr) { + m_signalInterfaceLink(null) { // nothing to do - if (_func != nullptr) { + if (_func != null) { esignal::Base::m_data = ememory::makeShared>([=](size_t _val){(*_class.*_func)(_val);}); } else { - esignal::Base::m_data = ememory::makeShared>(nullptr); + esignal::Base::m_data = ememory::makeShared>(null); } - if (esignal::Base::m_data != nullptr) { + if (esignal::Base::m_data != null) { esignal::Base::m_data->setName(_name); esignal::Base::m_data->setDescription(_description); } m_signalInterfaceLink = _class; // add a reference on the current signal ... - if (m_signalInterfaceLink != nullptr) { + if (m_signalInterfaceLink != null) { m_signalInterfaceLink->signals.add(this); } } @@ -410,14 +410,14 @@ esignal::Signal::Signal(CLASS_TYPE* _class, FUNC_TYPE _func, const etk::String& _name, const etk::String& _description): - m_signalInterfaceLink(nullptr) { + m_signalInterfaceLink(null) { // nothing to do - if (_func != nullptr) { + if (_func != null) { esignal::Base::m_data = ememory::makeShared>([=](size_t _val){(*_class.*_func)(_val);}); } else { - esignal::Base::m_data = ememory::makeShared>(nullptr); + esignal::Base::m_data = ememory::makeShared>(null); } - if (esignal::Base::m_data != nullptr) { + if (esignal::Base::m_data != null) { esignal::Base::m_data->setName(_name); esignal::Base::m_data->setDescription(_description); } diff --git a/esignal/details/Signal.hxx b/esignal/details/Signal.hxx index a64aeea..ff8718e 100644 --- a/esignal/details/Signal.hxx +++ b/esignal/details/Signal.hxx @@ -9,7 +9,7 @@ template esignal::Signal::~Signal() { - if (m_signalInterfaceLink != nullptr) { + if (m_signalInterfaceLink != null) { m_signalInterfaceLink->signals.remove(this); } } @@ -19,10 +19,10 @@ esignal::Signal::Signal(esignal::BaseInternal::ObserverConnection _co const etk::String& _name, const etk::String& _description): esignal::Base(), - m_signalInterfaceLink(nullptr) { + m_signalInterfaceLink(null) { // create internal data assiciated: m_data = ememory::makeShared>(etk::move(_countObs)); - if (esignal::Base::m_data != nullptr) { + if (esignal::Base::m_data != null) { esignal::Base::m_data->setName(_name); esignal::Base::m_data->setDescription(_description); } @@ -34,13 +34,13 @@ esignal::Signal::Signal(esignal::Interface* _signalInterfaceLink, const etk::String& _description): m_signalInterfaceLink(_signalInterfaceLink) { // create internal data assiciated: - m_data = ememory::makeShared>(nullptr); - if (esignal::Base::m_data != nullptr) { + m_data = ememory::makeShared>(null); + if (esignal::Base::m_data != null) { esignal::Base::m_data->setName(_name); esignal::Base::m_data->setDescription(_description); } // add a reference on the current signal ... - if (m_signalInterfaceLink != nullptr) { + if (m_signalInterfaceLink != null) { m_signalInterfaceLink->signals.add(this); } } @@ -67,7 +67,7 @@ void esignal::SignalInternal::emit(const T_ARGS&... _args) { bool haveRemove = false; auto it = m_executors.begin(); while (it != m_executors.end()) { - if ( *it == nullptr + if ( *it == null || (*it)->m_removed == true) { it = m_executors.erase(it); haveRemove = true; @@ -76,7 +76,7 @@ void esignal::SignalInternal::emit(const T_ARGS&... _args) { ++it; } if (haveRemove == true) { - if (m_connectionObserver!=nullptr) { + if (m_connectionObserver!=null) { m_connectionObserver(m_executors.size()); } } @@ -92,7 +92,7 @@ void esignal::SignalInternal::removeIfPossible() { bool haveRemove = false; auto it = m_executors.begin(); while (it != m_executors.end()) { - if ( *it == nullptr + if ( *it == null || (*it)->m_removed == true) { it = m_executors.erase(it); haveRemove = true; @@ -101,7 +101,7 @@ void esignal::SignalInternal::removeIfPossible() { ++it; } if (haveRemove == true) { - if (m_connectionObserver!=nullptr) { + if (m_connectionObserver!=null) { m_connectionObserver(m_executors.size()); } } @@ -186,7 +186,7 @@ template void esignal::SignalInternal::ExecutorShared::emit(const T_ARGS&... _values) { // TODO: maybe an error if the object is not manage by the same thread. ememory::SharedPtr destObject = m_object.lock(); - if (destObject == nullptr) { + if (destObject == null) { Executor::m_removed = true; return; } @@ -203,7 +203,7 @@ void esignal::SignalInternal::ExecutorShared::emit(const T_ARGS&... _ template bool esignal::SignalInternal::ExecutorShared::isSharedPtr(const ememory::SharedPtr& _obj) { ememory::SharedPtr destObject = m_object.lock(); - if (destObject == nullptr) { + if (destObject == null) { return true; } if (destObject == _obj) { diff --git a/test/test_isignal.cpp b/test/test_isignal.cpp index 7f1f8c3..feb658f 100644 --- a/test/test_isignal.cpp +++ b/test/test_isignal.cpp @@ -105,7 +105,7 @@ TEST(test_isignal_counter, localbasicInterfaceGetListSignal) { TEST(test_isignal_counter, localbasicInterfaceDisconnectNullPtr) { testISignal localClass; - localClass.signals.disconnect(nullptr); + localClass.signals.disconnect(null); } TEST(test_isignal_counter, localbasicInterfaceDisconnectSharedPtr) { diff --git a/test/test_signal_class_func.cpp b/test/test_signal_class_func.cpp index 761e42d..82653a3 100644 --- a/test/test_signal_class_func.cpp +++ b/test/test_signal_class_func.cpp @@ -19,7 +19,7 @@ class testCallback { etk::String m_string; bool m_void; testCallback() { - m_emptyFunctor = nullptr; + m_emptyFunctor = null; m_void = false; m_int32 = 0; m_string = ""; @@ -105,7 +105,7 @@ TEST(test_signal_class_func, localbasicNameDesc) { } TEST(test_signal_class_func, localNullClass) { - testCallback* localClass = nullptr; + testCallback* localClass = null; esignal::Signal<> signal; EXPECT_EQ(signal.size(), 0); EXPECT_EQ(signal.empty(), true); diff --git a/test/test_signal_shared_ptr_func.cpp b/test/test_signal_shared_ptr_func.cpp index de418e0..8a4c589 100644 --- a/test/test_signal_shared_ptr_func.cpp +++ b/test/test_signal_shared_ptr_func.cpp @@ -19,7 +19,7 @@ class testCallbackShared : public ememory::EnableSharedFromThis