[DEV] update etk null

This commit is contained in:
Edouard DUPIN 2018-06-19 22:13:48 +02:00
parent a4b2688bda
commit f03ab09337
7 changed files with 27 additions and 27 deletions

View File

@ -21,12 +21,12 @@ eproperty::InterfaceData::~InterfaceData() {
// note this pointer is not allocated and not free at the end of the class // note this pointer is not allocated and not free at the end of the class
void eproperty::InterfaceData::add(eproperty::Property* _pointerOnProperty) { void eproperty::InterfaceData::add(eproperty::Property* _pointerOnProperty) {
if (_pointerOnProperty == nullptr) { if (_pointerOnProperty == null) {
EPROPERTY_ERROR("Try to link a nullptr properties"); EPROPERTY_ERROR("Try to link a null properties");
return; return;
} }
for (auto &it : m_list) { for (auto &it : m_list) {
if( it != nullptr if( it != null
&& it->getName() == _pointerOnProperty->getName()) { && it->getName() == _pointerOnProperty->getName()) {
EPROPERTY_CRITICAL("2 property can not have the same name ... ==> generate runtime error"); EPROPERTY_CRITICAL("2 property can not have the same name ... ==> generate runtime error");
} }
@ -35,8 +35,8 @@ void eproperty::InterfaceData::add(eproperty::Property* _pointerOnProperty) {
} }
void eproperty::InterfaceData::remove(eproperty::Property* _pointerOnProperty) { void eproperty::InterfaceData::remove(eproperty::Property* _pointerOnProperty) {
if (_pointerOnProperty == nullptr) { if (_pointerOnProperty == null) {
EPROPERTY_ERROR("Try to un-link a nullptr properties"); EPROPERTY_ERROR("Try to un-link a null properties");
return; return;
} }
auto it = m_list.begin(); auto it = m_list.begin();
@ -57,7 +57,7 @@ void eproperty::InterfaceData::clean() {
// the property set might be done with a pool of property, allone, the overhed is bigger ... // the property set might be done with a pool of property, allone, the overhed is bigger ...
bool eproperty::InterfaceData::set(const etk::String& _property, const etk::String& _value) { bool eproperty::InterfaceData::set(const etk::String& _property, const etk::String& _value) {
for (auto &it : m_list) { for (auto &it : m_list) {
if( it != nullptr if( it != null
&& it->getName() == _property) { && it->getName() == _property) {
it->setString(_value); it->setString(_value);
return true; return true;
@ -69,7 +69,7 @@ bool eproperty::InterfaceData::set(const etk::String& _property, const etk::Stri
etk::String eproperty::InterfaceData::get(const etk::String& _property) const { etk::String eproperty::InterfaceData::get(const etk::String& _property) const {
for (auto &it : m_list) { for (auto &it : m_list) {
if( it != nullptr if( it != null
&& it->getName() == _property) { && it->getName() == _property) {
return it->getString(); return it->getString();
} }
@ -80,7 +80,7 @@ etk::String eproperty::InterfaceData::get(const etk::String& _property) const {
void eproperty::InterfaceData::display(bool _changeOnly) const { void eproperty::InterfaceData::display(bool _changeOnly) const {
EPROPERTY_INFO(" Object properties:"); EPROPERTY_INFO(" Object properties:");
for (auto &it : m_list) { for (auto &it : m_list) {
if(it != nullptr) { if(it != null) {
etk::String paramName = it->getName(); etk::String paramName = it->getName();
etk::String paramVal = it->getString(); etk::String paramVal = it->getString();
etk::String paramInfo = it->getInfo(); etk::String paramInfo = it->getInfo();
@ -89,7 +89,7 @@ void eproperty::InterfaceData::display(bool _changeOnly) const {
EPROPERTY_INFO(" | param='" << paramName << "' value=" << paramVal << " (" << paramInfo << ")"); EPROPERTY_INFO(" | param='" << paramName << "' value=" << paramVal << " (" << paramInfo << ")");
} }
} else { } else {
EPROPERTY_INFO(" | param=nullptr"); EPROPERTY_INFO(" | param=null");
} }
} }
} }
@ -97,7 +97,7 @@ void eproperty::InterfaceData::display(bool _changeOnly) const {
etk::Map<etk::String, etk::String> eproperty::InterfaceData::getAll(bool _notIfDefault) const { etk::Map<etk::String, etk::String> eproperty::InterfaceData::getAll(bool _notIfDefault) const {
etk::Map<etk::String, etk::String> out; etk::Map<etk::String, etk::String> out;
for (auto &it : m_list) { for (auto &it : m_list) {
if(it != nullptr) { if(it != null) {
etk::String paramName = it->getName(); etk::String paramName = it->getName();
etk::String paramVal = it->getString(); etk::String paramVal = it->getString();
if ( _notIfDefault == false if ( _notIfDefault == false
@ -117,7 +117,7 @@ size_t eproperty::InterfaceData::size() const {
eproperty::Property* eproperty::InterfaceData::getRaw(const size_t& _id) const { eproperty::Property* eproperty::InterfaceData::getRaw(const size_t& _id) const {
if (_id >= m_list.size()) { if (_id >= m_list.size()) {
EPROPERTY_ERROR("Wrong ID for property list. " << _id << " >= " << m_list.size()); EPROPERTY_ERROR("Wrong ID for property list. " << _id << " >= " << m_list.size());
return nullptr; return null;
} }
return m_list[_id]; return m_list[_id];
} }
@ -128,6 +128,6 @@ eproperty::Property* eproperty::InterfaceData::getRaw(const etk::String _name) c
return it; return it;
} }
} }
return nullptr; return null;
} }

View File

@ -19,7 +19,7 @@ namespace eproperty {
etk::Map<etk::String, TYPE> m_list; //!< pointer on the list of all elements. etk::Map<etk::String, TYPE> m_list; //!< pointer on the list of all elements.
public: public:
/** /**
* @brief Create a parameter with List of element parameter (nullptr if none). * @brief Create a parameter with List of element parameter (null if none).
* @param[in] _owner reference on the parameter lister. * @param[in] _owner reference on the parameter lister.
* @param[in] _name Static name of the parameter. * @param[in] _name Static name of the parameter.
* @param[in] _defaultValue Default value of the parameter. * @param[in] _defaultValue Default value of the parameter.
@ -31,12 +31,12 @@ namespace eproperty {
const etk::String& _name, const etk::String& _name,
const TYPE& _defaultValue, const TYPE& _defaultValue,
const etk::String& _description="", const etk::String& _description="",
void (CLASS_TYPE::*_setObs)()=nullptr) : void (CLASS_TYPE::*_setObs)()=null) :
eproperty::PropertyType<TYPE>(_owner, _name, _defaultValue, _description, _setObs) { eproperty::PropertyType<TYPE>(_owner, _name, _defaultValue, _description, _setObs) {
}; };
/** /**
* @brief Create a parameter with List of element parameter (nullptr if none). * @brief Create a parameter with List of element parameter (null if none).
* @param[in] _defaultValue Default value of the parameter. * @param[in] _defaultValue Default value of the parameter.
*/ */
List(const TYPE& _defaultValue) : List(const TYPE& _defaultValue) :

View File

@ -13,13 +13,13 @@
void eproperty::Property::linkInterface() { void eproperty::Property::linkInterface() {
// add a reference on the current Property ... // add a reference on the current Property ...
if (m_interfaceLink != nullptr) { if (m_interfaceLink != null) {
m_interfaceLink->properties.add(this); m_interfaceLink->properties.add(this);
} }
} }
void eproperty::Property::unLinkInterface() { void eproperty::Property::unLinkInterface() {
if (m_interfaceLink != nullptr) { if (m_interfaceLink != null) {
m_interfaceLink->properties.remove(this); m_interfaceLink->properties.remove(this);
} }
} }
@ -86,7 +86,7 @@ etk::String eproperty::Property::getName() const {
} }
void eproperty::Property::notifyChange() const { void eproperty::Property::notifyChange() const {
if (m_setObserver != nullptr) { if (m_setObserver != null) {
m_setObserver(); m_setObserver();
} }
//m_interfaceLink.onPropertyChangeValue(); //m_interfaceLink.onPropertyChangeValue();

View File

@ -25,13 +25,13 @@ namespace eproperty {
public: public:
using Observer = etk::Function<void()>; //!< Local main object observer of changing value of the property using Observer = etk::Function<void()>; //!< Local main object observer of changing value of the property
protected: protected:
eproperty::Interface* m_interfaceLink = nullptr; //!< Base interface class to group all the property eproperty::Interface* m_interfaceLink = null; //!< Base interface class to group all the property
Observer m_setObserver; //!< Observer of the changing value Observer m_setObserver; //!< Observer of the changing value
etk::String m_name; //!< Name of the property etk::String m_name; //!< Name of the property
public: public:
/** /**
* @brief Basic property elements * @brief Basic property elements
* @param[in] _paramInterfaceLink Link on the esignal::Interface class to register parameter (can be nullptr) * @param[in] _paramInterfaceLink Link on the esignal::Interface class to register parameter (can be null)
* @param[in] _name Name of the parameter (must be unique if _paramInterfaceLink is define) * @param[in] _name Name of the parameter (must be unique if _paramInterfaceLink is define)
*/ */
Property(eproperty::Interface* _paramInterfaceLink, const etk::String& _name); Property(eproperty::Interface* _paramInterfaceLink, const etk::String& _name);

View File

@ -23,7 +23,7 @@ namespace eproperty {
public: public:
/** /**
* @brief Create a parameter with a specific type. * @brief Create a parameter with a specific type.
* @param[in] _owner Owner of the parameter (nullptr if none). * @param[in] _owner Owner of the parameter (null if none).
* @param[in] _name Static name of the parameter. * @param[in] _name Static name of the parameter.
* @param[in] _defaultValue Default value of the parameter. * @param[in] _defaultValue Default value of the parameter.
* @param[in] _description description of the parameter. * @param[in] _description description of the parameter.
@ -34,11 +34,11 @@ namespace eproperty {
const etk::String& _name, const etk::String& _name,
const TYPE& _defaultValue, const TYPE& _defaultValue,
const etk::String& _description = "", const etk::String& _description = "",
void (CLASS_TYPE::*_setObs)()=nullptr) : void (CLASS_TYPE::*_setObs)()=null) :
Property(_owner, _name), Property(_owner, _name),
m_value(_defaultValue), m_value(_defaultValue),
m_default(_defaultValue) { m_default(_defaultValue) {
if (_setObs != nullptr) { if (_setObs != null) {
setObserver([=](){(*_owner.*_setObs)();}); setObserver([=](){(*_owner.*_setObs)();});
} }
} }

View File

@ -22,7 +22,7 @@ namespace eproperty {
public: public:
/** /**
* @brief Create a parameter with a specific type. * @brief Create a parameter with a specific type.
* @param[in] _owner reference on the parameter lister (nullptr if none). * @param[in] _owner reference on the parameter lister (null if none).
* @param[in] _name Static name of the parameter. * @param[in] _name Static name of the parameter.
* @param[in] _defaultValue Default value of the parameter. * @param[in] _defaultValue Default value of the parameter.
* @param[in] _min Minumum value. * @param[in] _min Minumum value.
@ -37,7 +37,7 @@ namespace eproperty {
const TYPE& _min, const TYPE& _min,
const TYPE& _max, const TYPE& _max,
const etk::String& _description = "", const etk::String& _description = "",
void (CLASS_TYPE::*_setObs)()=nullptr) : void (CLASS_TYPE::*_setObs)()=null) :
eproperty::Value<TYPE>(_owner, _name, _defaultValue, _description, _setObs), eproperty::Value<TYPE>(_owner, _name, _defaultValue, _description, _setObs),
m_min(_min), m_min(_min),
m_max(_max) { m_max(_max) {

View File

@ -21,7 +21,7 @@ namespace eproperty {
public: public:
/** /**
* @brief Create a parameter with a specific type. * @brief Create a parameter with a specific type.
* @param[in] _owner Owner of the parameter (nullptr if none). * @param[in] _owner Owner of the parameter (null if none).
* @param[in] _name Static name of the parameter. * @param[in] _name Static name of the parameter.
* @param[in] _defaultValue Default value of the parameter. * @param[in] _defaultValue Default value of the parameter.
* @param[in] _description description of the parameter. * @param[in] _description description of the parameter.
@ -32,7 +32,7 @@ namespace eproperty {
const etk::String& _name, const etk::String& _name,
const TYPE& _defaultValue, const TYPE& _defaultValue,
const etk::String& _description = "", const etk::String& _description = "",
void (CLASS_TYPE::*_setObs)()=nullptr) : void (CLASS_TYPE::*_setObs)()=null) :
eproperty::PropertyType<TYPE>(_owner, _name, _defaultValue, _description, _setObs) { eproperty::PropertyType<TYPE>(_owner, _name, _defaultValue, _description, _setObs) {
} }