[DEV] update nullptr in null (specific etk)

This commit is contained in:
Edouard DUPIN 2018-06-19 22:15:52 +02:00
parent ec7f6cc1f1
commit 8e12c92ba0
19 changed files with 181 additions and 181 deletions

View File

@ -13,12 +13,12 @@
ejson::Array::Array(ememory::SharedPtr<ejson::internal::Value> _internalValue) : ejson::Array::Array(ememory::SharedPtr<ejson::internal::Value> _internalValue) :
ejson::Value(_internalValue) { ejson::Value(_internalValue) {
if (m_data == nullptr) { if (m_data == null) {
return; return;
} }
if (m_data->getType() != ejson::valueType::array) { if (m_data->getType() != ejson::valueType::array) {
// try to set wrong type inside ... ==> remove it ... // try to set wrong type inside ... ==> remove it ...
m_data = nullptr; m_data = null;
} }
} }
@ -38,48 +38,48 @@ ejson::Array& ejson::Array::operator= (const ejson::Array& _obj) {
} }
size_t ejson::Array::size() const { size_t ejson::Array::size() const {
if (m_data == nullptr) { if (m_data == null) {
EJSON_DEBUG("Can not size (nullptr) ..."); EJSON_DEBUG("Can not size (null) ...");
return 0; return 0;
} }
return static_cast<const ejson::internal::Array*>(m_data.get())->size(); return static_cast<const ejson::internal::Array*>(m_data.get())->size();
} }
ejson::Value ejson::Array::operator[] (size_t _id) { ejson::Value ejson::Array::operator[] (size_t _id) {
if (m_data == nullptr) { if (m_data == null) {
EJSON_DEBUG("Can not get (nullptr) ..."); EJSON_DEBUG("Can not get (null) ...");
return ejson::Value(nullptr); return ejson::Value(null);
} }
return ejson::Value(static_cast<ejson::internal::Array*>(m_data.get())->get(_id)); return ejson::Value(static_cast<ejson::internal::Array*>(m_data.get())->get(_id));
} }
const ejson::Value ejson::Array::operator[] (size_t _id) const { const ejson::Value ejson::Array::operator[] (size_t _id) const {
if (m_data == nullptr) { if (m_data == null) {
EJSON_DEBUG("Can not get (nullptr) ..."); EJSON_DEBUG("Can not get (null) ...");
return ejson::Value(nullptr);; return ejson::Value(null);;
} }
return ejson::Value(static_cast<const ejson::internal::Array*>(m_data.get())->get(_id)); return ejson::Value(static_cast<const ejson::internal::Array*>(m_data.get())->get(_id));
} }
bool ejson::Array::add(const ejson::Value& _element) { bool ejson::Array::add(const ejson::Value& _element) {
if (m_data == nullptr) { if (m_data == null) {
EJSON_DEBUG("Can not add (nullptr) ..."); EJSON_DEBUG("Can not add (null) ...");
return false; return false;
} }
return static_cast<ejson::internal::Array*>(m_data.get())->add(_element.m_data); return static_cast<ejson::internal::Array*>(m_data.get())->add(_element.m_data);
} }
void ejson::Array::remove(size_t _id) { void ejson::Array::remove(size_t _id) {
if (m_data == nullptr) { if (m_data == null) {
EJSON_DEBUG("Can not remove (nullptr) ..."); EJSON_DEBUG("Can not remove (null) ...");
return; return;
} }
static_cast<ejson::internal::Array*>(m_data.get())->remove(_id); static_cast<ejson::internal::Array*>(m_data.get())->remove(_id);
} }
ejson::Array::iterator ejson::Array::remove(const ejson::Array::iterator& _it) { ejson::Array::iterator ejson::Array::remove(const ejson::Array::iterator& _it) {
if (m_data == nullptr) { if (m_data == null) {
EJSON_DEBUG("Can not remove (nullptr) ..."); EJSON_DEBUG("Can not remove (null) ...");
return _it; return _it;
} }
static_cast<ejson::internal::Array*>(m_data.get())->remove(_it.getId()); static_cast<ejson::internal::Array*>(m_data.get())->remove(_it.getId());

View File

@ -44,13 +44,13 @@ namespace ejson {
/** /**
* @brief get the pointer on an element reference with his ID. * @brief get the pointer on an element reference with his ID.
* @param[in] _id Id of the element. * @param[in] _id Id of the element.
* @return nullptr if the element does not exist. * @return null if the element does not exist.
*/ */
ejson::Value operator[] (size_t _id); ejson::Value operator[] (size_t _id);
/** /**
* @brief get the pointer on an element reference with his ID. * @brief get the pointer on an element reference with his ID.
* @param[in] _id Id of the element. * @param[in] _id Id of the element.
* @return nullptr if the element does not exist. * @return null if the element does not exist.
*/ */
const ejson::Value operator[] (size_t _id) const; const ejson::Value operator[] (size_t _id) const;
/** /**

View File

@ -11,12 +11,12 @@
ejson::Boolean::Boolean(ememory::SharedPtr<ejson::internal::Value> _internalValue) : ejson::Boolean::Boolean(ememory::SharedPtr<ejson::internal::Value> _internalValue) :
ejson::Value(_internalValue) { ejson::Value(_internalValue) {
if (m_data == nullptr) { if (m_data == null) {
return; return;
} }
if (m_data->getType() != ejson::valueType::boolean) { if (m_data->getType() != ejson::valueType::boolean) {
// try to set wrong type inside ... ==> remove it ... // try to set wrong type inside ... ==> remove it ...
m_data = nullptr; m_data = null;
} }
} }
@ -36,16 +36,16 @@ ejson::Boolean& ejson::Boolean::operator= (const ejson::Boolean& _obj) {
} }
void ejson::Boolean::set(bool _value) { void ejson::Boolean::set(bool _value) {
if (m_data == nullptr) { if (m_data == null) {
EJSON_DEBUG("Can not set (nullptr) ..."); EJSON_DEBUG("Can not set (null) ...");
return; return;
} }
static_cast<ejson::internal::Boolean*>(m_data.get())->set(_value); static_cast<ejson::internal::Boolean*>(m_data.get())->set(_value);
} }
bool ejson::Boolean::get(bool _errorValue) const { bool ejson::Boolean::get(bool _errorValue) const {
if (m_data == nullptr) { if (m_data == null) {
EJSON_DEBUG("Can not get (nullptr) ..."); EJSON_DEBUG("Can not get (null) ...");
return _errorValue; return _errorValue;
} }
return static_cast<const ejson::internal::Boolean*>(m_data.get())->get(); return static_cast<const ejson::internal::Boolean*>(m_data.get())->get();

View File

@ -10,12 +10,12 @@
ejson::Document::Document(ememory::SharedPtr<ejson::internal::Value> _internalValue) : ejson::Document::Document(ememory::SharedPtr<ejson::internal::Value> _internalValue) :
ejson::Object(_internalValue) { ejson::Object(_internalValue) {
if (m_data == nullptr) { if (m_data == null) {
return; return;
} }
if (m_data->getType() != ejson::valueType::document) { if (m_data->getType() != ejson::valueType::document) {
// try to set wrong type inside ... ==> remove it ... // try to set wrong type inside ... ==> remove it ...
m_data = nullptr; m_data = null;
} }
} }
@ -35,40 +35,40 @@ ejson::Document& ejson::Document::operator= (const ejson::Document& _obj) {
} }
bool ejson::Document::parse(const etk::String& _data) { bool ejson::Document::parse(const etk::String& _data) {
if (m_data == nullptr) { if (m_data == null) {
EJSON_DEBUG("Can not parse (nullptr) ..."); EJSON_DEBUG("Can not parse (null) ...");
return false; return false;
} }
return static_cast<ejson::internal::Document*>(m_data.get())->parse(_data); return static_cast<ejson::internal::Document*>(m_data.get())->parse(_data);
} }
bool ejson::Document::generate(etk::String& _data) { bool ejson::Document::generate(etk::String& _data) {
if (m_data == nullptr) { if (m_data == null) {
EJSON_DEBUG("Can not generate (nullptr) ..."); EJSON_DEBUG("Can not generate (null) ...");
return false; return false;
} }
return static_cast<ejson::internal::Document*>(m_data.get())->generate(_data); return static_cast<ejson::internal::Document*>(m_data.get())->generate(_data);
} }
bool ejson::Document::load(const etk::String& _file) { bool ejson::Document::load(const etk::String& _file) {
if (m_data == nullptr) { if (m_data == null) {
EJSON_DEBUG("Can not load (nullptr) ..."); EJSON_DEBUG("Can not load (null) ...");
return false; return false;
} }
return static_cast<ejson::internal::Document*>(m_data.get())->load(_file); return static_cast<ejson::internal::Document*>(m_data.get())->load(_file);
} }
bool ejson::Document::store(const etk::String& _file) { bool ejson::Document::store(const etk::String& _file) {
if (m_data == nullptr) { if (m_data == null) {
EJSON_DEBUG("Can not store (nullptr) ..."); EJSON_DEBUG("Can not store (null) ...");
return false; return false;
} }
return static_cast<ejson::internal::Document*>(m_data.get())->store(_file); return static_cast<ejson::internal::Document*>(m_data.get())->store(_file);
} }
bool ejson::Document::storeSafe(const etk::String& _file) { bool ejson::Document::storeSafe(const etk::String& _file) {
if (m_data == nullptr) { if (m_data == null) {
EJSON_DEBUG("Can not store (nullptr) ..."); EJSON_DEBUG("Can not store (null) ...");
return false; return false;
} }
bool done = static_cast<ejson::internal::Document*>(m_data.get())->store(_file+".tmp"); bool done = static_cast<ejson::internal::Document*>(m_data.get())->store(_file+".tmp");
@ -79,24 +79,24 @@ bool ejson::Document::storeSafe(const etk::String& _file) {
} }
void ejson::Document::setDisplayError(bool _value){ void ejson::Document::setDisplayError(bool _value){
if (m_data == nullptr) { if (m_data == null) {
EJSON_DEBUG("Can not setDisplayError (nullptr) ..."); EJSON_DEBUG("Can not setDisplayError (null) ...");
return; return;
} }
static_cast<ejson::internal::Document*>(m_data.get())->setDisplayError(_value); static_cast<ejson::internal::Document*>(m_data.get())->setDisplayError(_value);
} }
bool ejson::Document::getDisplayError() { bool ejson::Document::getDisplayError() {
if (m_data == nullptr) { if (m_data == null) {
EJSON_DEBUG("Can not getDisplayError (nullptr) ..."); EJSON_DEBUG("Can not getDisplayError (null) ...");
return false; return false;
} }
return static_cast<ejson::internal::Document*>(m_data.get())->getDisplayError(); return static_cast<ejson::internal::Document*>(m_data.get())->getDisplayError();
} }
void ejson::Document::displayError() { void ejson::Document::displayError() {
if (m_data == nullptr) { if (m_data == null) {
EJSON_DEBUG("Can not displayError (nullptr) ..."); EJSON_DEBUG("Can not displayError (null) ...");
return; return;
} }
static_cast<ejson::internal::Document*>(m_data.get())->displayError(); static_cast<ejson::internal::Document*>(m_data.get())->displayError();

View File

@ -9,12 +9,12 @@
ejson::Null::Null(ememory::SharedPtr<ejson::internal::Value> _internalValue) : ejson::Null::Null(ememory::SharedPtr<ejson::internal::Value> _internalValue) :
ejson::Value(_internalValue) { ejson::Value(_internalValue) {
if (m_data == nullptr) { if (m_data == null) {
return; return;
} }
if (m_data->getType() != ejson::valueType::null) { if (m_data->getType() != ejson::valueType::null) {
// try to set wrong type inside ... ==> remove it ... // try to set wrong type inside ... ==> remove it ...
m_data = nullptr; m_data = null;
} }
} }

View File

@ -10,12 +10,12 @@
ejson::Number::Number(ememory::SharedPtr<ejson::internal::Value> _internalValue) : ejson::Number::Number(ememory::SharedPtr<ejson::internal::Value> _internalValue) :
ejson::Value(_internalValue) { ejson::Value(_internalValue) {
if (m_data == nullptr) { if (m_data == null) {
return; return;
} }
if (m_data->getType() != ejson::valueType::number) { if (m_data->getType() != ejson::valueType::number) {
// try to set wrong type inside ... ==> remove it ... // try to set wrong type inside ... ==> remove it ...
m_data = nullptr; m_data = null;
} }
} }
@ -35,56 +35,56 @@ ejson::Number& ejson::Number::operator= (const ejson::Number& _obj) {
} }
void ejson::Number::set(double _value) { void ejson::Number::set(double _value) {
if (m_data == nullptr) { if (m_data == null) {
EJSON_DEBUG("Can not set (nullptr) ..."); EJSON_DEBUG("Can not set (null) ...");
return; return;
} }
static_cast<ejson::internal::Number*>(m_data.get())->set(_value); static_cast<ejson::internal::Number*>(m_data.get())->set(_value);
} }
void ejson::Number::set(uint64_t _value) { void ejson::Number::set(uint64_t _value) {
if (m_data == nullptr) { if (m_data == null) {
EJSON_DEBUG("Can not set (nullptr) ..."); EJSON_DEBUG("Can not set (null) ...");
return; return;
} }
static_cast<ejson::internal::Number*>(m_data.get())->set(_value); static_cast<ejson::internal::Number*>(m_data.get())->set(_value);
} }
void ejson::Number::set(int64_t _value) { void ejson::Number::set(int64_t _value) {
if (m_data == nullptr) { if (m_data == null) {
EJSON_DEBUG("Can not set (nullptr) ..."); EJSON_DEBUG("Can not set (null) ...");
return; return;
} }
static_cast<ejson::internal::Number*>(m_data.get())->set(_value); static_cast<ejson::internal::Number*>(m_data.get())->set(_value);
} }
double ejson::Number::get(double _errorValue) const { double ejson::Number::get(double _errorValue) const {
if (m_data == nullptr) { if (m_data == null) {
EJSON_DEBUG("Can not get (nullptr) ..."); EJSON_DEBUG("Can not get (null) ...");
return _errorValue; return _errorValue;
} }
return static_cast<const ejson::internal::Number*>(m_data.get())->get(); return static_cast<const ejson::internal::Number*>(m_data.get())->get();
} }
uint64_t ejson::Number::getU64(uint64_t _errorValue) const { uint64_t ejson::Number::getU64(uint64_t _errorValue) const {
if (m_data == nullptr) { if (m_data == null) {
EJSON_DEBUG("Can not get (nullptr) ..."); EJSON_DEBUG("Can not get (null) ...");
return _errorValue; return _errorValue;
} }
return static_cast<const ejson::internal::Number*>(m_data.get())->getU64(); return static_cast<const ejson::internal::Number*>(m_data.get())->getU64();
} }
int64_t ejson::Number::getI64(int64_t _errorValue) const { int64_t ejson::Number::getI64(int64_t _errorValue) const {
if (m_data == nullptr) { if (m_data == null) {
EJSON_DEBUG("Can not get (nullptr) ..."); EJSON_DEBUG("Can not get (null) ...");
return _errorValue; return _errorValue;
} }
return static_cast<const ejson::internal::Number*>(m_data.get())->getI64(); return static_cast<const ejson::internal::Number*>(m_data.get())->getI64();
} }
ejson::internal::Number::type ejson::Number::getType() const { ejson::internal::Number::type ejson::Number::getType() const {
if (m_data == nullptr) { if (m_data == null) {
EJSON_DEBUG("Can not get (nullptr) ..."); EJSON_DEBUG("Can not get (null) ...");
return ejson::internal::Number::type::tDouble; return ejson::internal::Number::type::tDouble;
} }
return static_cast<const ejson::internal::Number*>(m_data.get())->getType(); return static_cast<const ejson::internal::Number*>(m_data.get())->getType();

View File

@ -10,13 +10,13 @@
ejson::Object::Object(ememory::SharedPtr<ejson::internal::Value> _internalValue) : ejson::Object::Object(ememory::SharedPtr<ejson::internal::Value> _internalValue) :
ejson::Value(_internalValue) { ejson::Value(_internalValue) {
if (m_data == nullptr) { if (m_data == null) {
return; return;
} }
if ( m_data->getType() != ejson::valueType::object if ( m_data->getType() != ejson::valueType::object
&& m_data->getType() != ejson::valueType::document) { && m_data->getType() != ejson::valueType::document) {
// try to set wrong type inside ... ==> remove it ... // try to set wrong type inside ... ==> remove it ...
m_data = nullptr; m_data = null;
} }
} }
@ -42,96 +42,96 @@ ejson::Object& ejson::Object::operator= (const ejson::Object& _obj) {
} }
bool ejson::Object::valueExist(const etk::String& _name) const { bool ejson::Object::valueExist(const etk::String& _name) const {
if (m_data == nullptr) { if (m_data == null) {
EJSON_DEBUG("Can not exist (nullptr) ..."); EJSON_DEBUG("Can not exist (null) ...");
return false; return false;
} }
return static_cast<const ejson::internal::Object*>(m_data.get())->exist(_name); return static_cast<const ejson::internal::Object*>(m_data.get())->exist(_name);
} }
ejson::Value ejson::Object::operator[] (const etk::String& _name) { ejson::Value ejson::Object::operator[] (const etk::String& _name) {
if (m_data == nullptr) { if (m_data == null) {
EJSON_DEBUG("Can not operator[] (nullptr) ..."); EJSON_DEBUG("Can not operator[] (null) ...");
return ejson::Value(nullptr); return ejson::Value(null);
} }
return ejson::Value(static_cast<ejson::internal::Object*>(m_data.get())->get(_name)); return ejson::Value(static_cast<ejson::internal::Object*>(m_data.get())->get(_name));
} }
const ejson::Value ejson::Object::operator[] (const etk::String& _name) const { const ejson::Value ejson::Object::operator[] (const etk::String& _name) const {
if (m_data == nullptr) { if (m_data == null) {
EJSON_DEBUG("Can not operator[] (nullptr) ..."); EJSON_DEBUG("Can not operator[] (null) ...");
return ejson::Value(nullptr); return ejson::Value(null);
} }
return ejson::Value(static_cast<const ejson::internal::Object*>(m_data.get())->get(_name)); return ejson::Value(static_cast<const ejson::internal::Object*>(m_data.get())->get(_name));
} }
etk::Vector<etk::String> ejson::Object::getKeys() const { etk::Vector<etk::String> ejson::Object::getKeys() const {
if (m_data == nullptr) { if (m_data == null) {
EJSON_DEBUG("Can not getKeys (nullptr) ..."); EJSON_DEBUG("Can not getKeys (null) ...");
return etk::Vector<etk::String>(); return etk::Vector<etk::String>();
} }
return static_cast<const ejson::internal::Object*>(m_data.get())->getKeys(); return static_cast<const ejson::internal::Object*>(m_data.get())->getKeys();
} }
size_t ejson::Object::size() const { size_t ejson::Object::size() const {
if (m_data == nullptr) { if (m_data == null) {
EJSON_DEBUG("Can not size (nullptr) ..."); EJSON_DEBUG("Can not size (null) ...");
return 0; return 0;
} }
return static_cast<const ejson::internal::Object*>(m_data.get())->size(); return static_cast<const ejson::internal::Object*>(m_data.get())->size();
} }
ejson::Value ejson::Object::operator[] (size_t _id) { ejson::Value ejson::Object::operator[] (size_t _id) {
if (m_data == nullptr) { if (m_data == null) {
EJSON_DEBUG("Can not operator[] (nullptr) ..."); EJSON_DEBUG("Can not operator[] (null) ...");
return ejson::Value(nullptr); return ejson::Value(null);
} }
return ejson::Value(static_cast<ejson::internal::Object*>(m_data.get())->get(_id)); return ejson::Value(static_cast<ejson::internal::Object*>(m_data.get())->get(_id));
} }
const ejson::Value ejson::Object::operator[] (size_t _id) const { const ejson::Value ejson::Object::operator[] (size_t _id) const {
if (m_data == nullptr) { if (m_data == null) {
EJSON_DEBUG("Can not operator[] (nullptr) ..."); EJSON_DEBUG("Can not operator[] (null) ...");
return ejson::Value(nullptr); return ejson::Value(null);
} }
return ejson::Value(static_cast<const ejson::internal::Object*>(m_data.get())->get(_id)); return ejson::Value(static_cast<const ejson::internal::Object*>(m_data.get())->get(_id));
} }
etk::String ejson::Object::getKey(size_t _id) const { etk::String ejson::Object::getKey(size_t _id) const {
if (m_data == nullptr) { if (m_data == null) {
EJSON_DEBUG("Can not getKey (nullptr) ..."); EJSON_DEBUG("Can not getKey (null) ...");
return ""; return "";
} }
return static_cast<const ejson::internal::Object*>(m_data.get())->getKey(_id); return static_cast<const ejson::internal::Object*>(m_data.get())->getKey(_id);
} }
bool ejson::Object::add(const etk::String& _name, const ejson::Value& _value) { bool ejson::Object::add(const etk::String& _name, const ejson::Value& _value) {
if (m_data == nullptr) { if (m_data == null) {
EJSON_DEBUG("Can not add (nullptr) ..."); EJSON_DEBUG("Can not add (null) ...");
return false; return false;
} }
return static_cast<ejson::internal::Object*>(m_data.get())->add(_name, _value.m_data); return static_cast<ejson::internal::Object*>(m_data.get())->add(_name, _value.m_data);
} }
void ejson::Object::remove(const etk::String& _name) { void ejson::Object::remove(const etk::String& _name) {
if (m_data == nullptr) { if (m_data == null) {
EJSON_DEBUG("Can not remove (nullptr) ..."); EJSON_DEBUG("Can not remove (null) ...");
return; return;
} }
static_cast<ejson::internal::Object*>(m_data.get())->remove(_name); static_cast<ejson::internal::Object*>(m_data.get())->remove(_name);
} }
void ejson::Object::remove(size_t _id) { void ejson::Object::remove(size_t _id) {
if (m_data == nullptr) { if (m_data == null) {
EJSON_DEBUG("Can not remove (nullptr) ..."); EJSON_DEBUG("Can not remove (null) ...");
return; return;
} }
static_cast<ejson::internal::Object*>(m_data.get())->remove(_id); static_cast<ejson::internal::Object*>(m_data.get())->remove(_id);
} }
ejson::Object::iterator ejson::Object::remove(const ejson::Object::iterator& _it) { ejson::Object::iterator ejson::Object::remove(const ejson::Object::iterator& _it) {
if (m_data == nullptr) { if (m_data == null) {
EJSON_DEBUG("Can not remove (nullptr) ..."); EJSON_DEBUG("Can not remove (null) ...");
return _it; return _it;
} }
static_cast<ejson::internal::Object*>(m_data.get())->remove(_it.getId()); static_cast<ejson::internal::Object*>(m_data.get())->remove(_it.getId());

View File

@ -9,12 +9,12 @@
ejson::String::String(ememory::SharedPtr<ejson::internal::Value> _internalValue) : ejson::String::String(ememory::SharedPtr<ejson::internal::Value> _internalValue) :
ejson::Value(_internalValue) { ejson::Value(_internalValue) {
if (m_data == nullptr) { if (m_data == null) {
return; return;
} }
if (m_data->getType() != ejson::valueType::string) { if (m_data->getType() != ejson::valueType::string) {
// try to set wrong type inside ... ==> remove it ... // try to set wrong type inside ... ==> remove it ...
m_data = nullptr; m_data = null;
} }
} }
@ -34,16 +34,16 @@ ejson::String& ejson::String::operator= (const ejson::String& _obj) {
} }
void ejson::String::set(const etk::String& _value) { void ejson::String::set(const etk::String& _value) {
if (m_data == nullptr) { if (m_data == null) {
EJSON_DEBUG("Can not set (nullptr) ..."); EJSON_DEBUG("Can not set (null) ...");
return; return;
} }
static_cast<ejson::internal::String*>(m_data.get())->set(_value); static_cast<ejson::internal::String*>(m_data.get())->set(_value);
} }
etk::String ejson::String::get(const etk::String& _errorValue) const { etk::String ejson::String::get(const etk::String& _errorValue) const {
if (m_data == nullptr) { if (m_data == null) {
EJSON_DEBUG("Can not get (nullptr) ..."); EJSON_DEBUG("Can not get (null) ...");
return _errorValue; return _errorValue;
} }
return static_cast<const ejson::internal::String*>(m_data.get())->get(); return static_cast<const ejson::internal::String*>(m_data.get())->get();

View File

@ -10,7 +10,7 @@
#include <ejson/Document.hpp> #include <ejson/Document.hpp>
ejson::Value ejson::empty() { ejson::Value ejson::empty() {
return ejson::Value(ememory::SharedPtr<ejson::internal::Value>(nullptr)); return ejson::Value(ememory::SharedPtr<ejson::internal::Value>(null));
} }
@ -28,7 +28,7 @@ etk::Stream& ejson::operator <<(etk::Stream& _os, const ejson::Value& _obj) {
} }
enum ejson::valueType ejson::Value::getType() const { enum ejson::valueType ejson::Value::getType() const {
if (m_data == nullptr) { if (m_data == null) {
EJSON_DEBUG("Can not get type ..."); EJSON_DEBUG("Can not get type ...");
return ejson::valueType::unknow; return ejson::valueType::unknow;
} }
@ -36,7 +36,7 @@ enum ejson::valueType ejson::Value::getType() const {
} }
bool ejson::Value::exist() const { bool ejson::Value::exist() const {
if (m_data == nullptr) { if (m_data == null) {
return false; return false;
} }
return true; return true;
@ -44,8 +44,8 @@ bool ejson::Value::exist() const {
etk::String ejson::Value::generateHumanString() const { etk::String ejson::Value::generateHumanString() const {
etk::String out; etk::String out;
if (m_data == nullptr) { if (m_data == null) {
EJSON_DEBUG("Can not remove (nullptr) ..."); EJSON_DEBUG("Can not remove (null) ...");
return out; return out;
} }
static_cast<const ejson::internal::Value*>(m_data.get())->iGenerate(out, 0); static_cast<const ejson::internal::Value*>(m_data.get())->iGenerate(out, 0);
@ -54,8 +54,8 @@ etk::String ejson::Value::generateHumanString() const {
etk::String ejson::Value::generateMachineString() const { etk::String ejson::Value::generateMachineString() const {
etk::String out; etk::String out;
if (m_data == nullptr) { if (m_data == null) {
EJSON_DEBUG("Can not remove (nullptr) ..."); EJSON_DEBUG("Can not remove (null) ...");
return out; return out;
} }
static_cast<const ejson::internal::Value*>(m_data.get())->iMachineGenerate(out); static_cast<const ejson::internal::Value*>(m_data.get())->iMachineGenerate(out);
@ -64,7 +64,7 @@ etk::String ejson::Value::generateMachineString() const {
/* /*
ejson::FilePos ejson::Value::getPos() const { ejson::FilePos ejson::Value::getPos() const {
if (m_data == nullptr) { if (m_data == null) {
return ejson::FilePos(0,0); return ejson::FilePos(0,0);
} }
return m_data->getPos(); return m_data->getPos();
@ -77,7 +77,7 @@ ejson::Value::Value(const ememory::SharedPtr<ejson::internal::Value>& _internalV
} }
ejson::Value::Value() : ejson::Value::Value() :
m_data(nullptr) { m_data(null) {
} }
@ -131,8 +131,8 @@ const ejson::Null ejson::Value::toNull() const{
} }
void ejson::Value::display() const { void ejson::Value::display() const {
if (m_data == nullptr) { if (m_data == null) {
EJSON_DEBUG("Can not Display (nullptr) ..."); EJSON_DEBUG("Can not Display (null) ...");
return; return;
} }
return m_data->display(); return m_data->display();
@ -140,7 +140,7 @@ void ejson::Value::display() const {
bool ejson::Value::isDocument() const { bool ejson::Value::isDocument() const {
if (m_data == nullptr) { if (m_data == null) {
return false; return false;
} }
enum ejson::valueType type = m_data->getType(); enum ejson::valueType type = m_data->getType();
@ -148,42 +148,42 @@ bool ejson::Value::isDocument() const {
} }
bool ejson::Value::isArray() const { bool ejson::Value::isArray() const {
if (m_data == nullptr) { if (m_data == null) {
return false; return false;
} }
return m_data->getType() == ejson::valueType::array; return m_data->getType() == ejson::valueType::array;
} }
bool ejson::Value::isObject() const { bool ejson::Value::isObject() const {
if (m_data == nullptr) { if (m_data == null) {
return false; return false;
} }
return m_data->getType() == ejson::valueType::object; return m_data->getType() == ejson::valueType::object;
} }
bool ejson::Value::isString() const { bool ejson::Value::isString() const {
if (m_data == nullptr) { if (m_data == null) {
return false; return false;
} }
return m_data->getType() == ejson::valueType::string; return m_data->getType() == ejson::valueType::string;
} }
bool ejson::Value::isNumber() const { bool ejson::Value::isNumber() const {
if (m_data == nullptr) { if (m_data == null) {
return false; return false;
} }
return m_data->getType() == ejson::valueType::number; return m_data->getType() == ejson::valueType::number;
} }
bool ejson::Value::isBoolean() const { bool ejson::Value::isBoolean() const {
if (m_data == nullptr) { if (m_data == null) {
return false; return false;
} }
return m_data->getType() == ejson::valueType::boolean; return m_data->getType() == ejson::valueType::boolean;
} }
bool ejson::Value::isNull() const { bool ejson::Value::isNull() const {
if (m_data == nullptr) { if (m_data == null) {
return false; return false;
} }
return m_data->getType() == ejson::valueType::null; return m_data->getType() == ejson::valueType::null;
@ -191,24 +191,24 @@ bool ejson::Value::isNull() const {
void ejson::Value::clear() { void ejson::Value::clear() {
if (m_data == nullptr) { if (m_data == null) {
EJSON_DEBUG("Can not Clear (nullptr) ..."); EJSON_DEBUG("Can not Clear (null) ...");
return; return;
} }
return m_data->clear(); return m_data->clear();
} }
bool ejson::Value::transfertIn(ejson::Value& _obj) { bool ejson::Value::transfertIn(ejson::Value& _obj) {
if (m_data == nullptr) { if (m_data == null) {
EJSON_DEBUG("Can not transfert In (nullptr) ..."); EJSON_DEBUG("Can not transfert In (null) ...");
return false; return false;
} }
return m_data->transfertIn(_obj.m_data); return m_data->transfertIn(_obj.m_data);
} }
ejson::Value ejson::Value::clone() const { ejson::Value ejson::Value::clone() const {
if (m_data == nullptr) { if (m_data == null) {
EJSON_DEBUG("Can not transfert In (nullptr) ..."); EJSON_DEBUG("Can not transfert In (null) ...");
return ejson::Value(m_data); return ejson::Value(m_data);
} }
return ejson::Value(m_data->clone()); return ejson::Value(m_data->clone());

View File

@ -67,72 +67,72 @@ namespace ejson {
bool exist() const; bool exist() const;
/** /**
* @brief Cast the element in a Document if it is possible. * @brief Cast the element in a Document if it is possible.
* @return pointer on the class or nullptr. * @return pointer on the class or null.
*/ */
ejson::Document toDocument(); ejson::Document toDocument();
/** /**
* @brief Cast the element in a Document if it is possible. * @brief Cast the element in a Document if it is possible.
* @return CONST pointer on the class or nullptr. * @return CONST pointer on the class or null.
*/ */
const ejson::Document toDocument() const; const ejson::Document toDocument() const;
/** /**
* @brief Cast the element in a Array if it is possible. * @brief Cast the element in a Array if it is possible.
* @return pointer on the class or nullptr. * @return pointer on the class or null.
*/ */
ejson::Array toArray(); ejson::Array toArray();
/** /**
* @brief Cast the element in a Array if it is possible. * @brief Cast the element in a Array if it is possible.
* @return CONST pointer on the class or nullptr. * @return CONST pointer on the class or null.
*/ */
const ejson::Array toArray() const; const ejson::Array toArray() const;
/** /**
* @brief Cast the element in a Object if it is possible. * @brief Cast the element in a Object if it is possible.
* @return pointer on the class or nullptr. * @return pointer on the class or null.
*/ */
ejson::Object toObject(); ejson::Object toObject();
/** /**
* @brief Cast the element in a Object if it is possible. * @brief Cast the element in a Object if it is possible.
* @return CONST pointer on the class or nullptr. * @return CONST pointer on the class or null.
*/ */
const ejson::Object toObject() const; const ejson::Object toObject() const;
/** /**
* @brief Cast the element in a String if it is possible. * @brief Cast the element in a String if it is possible.
* @return pointer on the class or nullptr. * @return pointer on the class or null.
*/ */
ejson::String toString(); ejson::String toString();
/** /**
* @brief Cast the element in a String if it is possible. * @brief Cast the element in a String if it is possible.
* @return CONST pointer on the class or nullptr. * @return CONST pointer on the class or null.
*/ */
const ejson::String toString() const; const ejson::String toString() const;
/** /**
* @brief Cast the element in a Number if it is possible. * @brief Cast the element in a Number if it is possible.
* @return pointer on the class or nullptr. * @return pointer on the class or null.
*/ */
ejson::Number toNumber(); ejson::Number toNumber();
/** /**
* @brief Cast the element in a Number if it is possible. * @brief Cast the element in a Number if it is possible.
* @return CONST pointer on the class or nullptr. * @return CONST pointer on the class or null.
*/ */
const ejson::Number toNumber() const; const ejson::Number toNumber() const;
/** /**
* @brief Cast the element in a Boolean if it is possible. * @brief Cast the element in a Boolean if it is possible.
* @return pointer on the class or nullptr. * @return pointer on the class or null.
*/ */
ejson::Boolean toBoolean(); ejson::Boolean toBoolean();
/** /**
* @brief Cast the element in a Boolean if it is possible. * @brief Cast the element in a Boolean if it is possible.
* @return CONST pointer on the class or nullptr. * @return CONST pointer on the class or null.
*/ */
const ejson::Boolean toBoolean() const; const ejson::Boolean toBoolean() const;
/** /**
* @brief Cast the element in a Null if it is possible. * @brief Cast the element in a Null if it is possible.
* @return pointer on the class or nullptr. * @return pointer on the class or null.
*/ */
ejson::Null toNull(); ejson::Null toNull();
/** /**
* @brief Cast the element in a Null if it is possible. * @brief Cast the element in a Null if it is possible.
* @return CONST pointer on the class or nullptr. * @return CONST pointer on the class or null.
*/ */
const ejson::Null toNull() const; const ejson::Null toNull() const;
@ -184,7 +184,7 @@ namespace ejson {
bool transfertIn(ejson::Value& _obj); bool transfertIn(ejson::Value& _obj);
/** /**
* @brief Copy the curent node and all the child in the curent one. * @brief Copy the curent node and all the child in the curent one.
* @return nullptr in an error occured, the pointer on the element otherwise * @return null in an error occured, the pointer on the element otherwise
*/ */
ejson::Value clone() const; ejson::Value clone() const;
public: public:

View File

@ -51,7 +51,7 @@ bool ejson::internal::Array::iParse(const etk::String& _data, size_t& _pos, ejso
// find an object: // find an object:
EJSON_PARSE_ELEMENT("find Object"); EJSON_PARSE_ELEMENT("find Object");
ememory::SharedPtr<ejson::internal::Object> tmpElement = ejson::internal::Object::create(); ememory::SharedPtr<ejson::internal::Object> tmpElement = ejson::internal::Object::create();
if (tmpElement == nullptr) { if (tmpElement == null) {
EJSON_CREATE_ERROR(_doc, _data, iii, _filePos, "Allocation error in object"); EJSON_CREATE_ERROR(_doc, _data, iii, _filePos, "Allocation error in object");
_pos=iii; _pos=iii;
return false; return false;
@ -63,7 +63,7 @@ bool ejson::internal::Array::iParse(const etk::String& _data, size_t& _pos, ejso
// find a string: // find a string:
EJSON_PARSE_ELEMENT("find String quoted"); EJSON_PARSE_ELEMENT("find String quoted");
ememory::SharedPtr<ejson::internal::String> tmpElement = ejson::internal::String::create(); ememory::SharedPtr<ejson::internal::String> tmpElement = ejson::internal::String::create();
if (tmpElement == nullptr) { if (tmpElement == null) {
EJSON_CREATE_ERROR(_doc, _data, iii, _filePos, "Allocation error in String"); EJSON_CREATE_ERROR(_doc, _data, iii, _filePos, "Allocation error in String");
_pos=iii; _pos=iii;
return false; return false;
@ -74,7 +74,7 @@ bool ejson::internal::Array::iParse(const etk::String& _data, size_t& _pos, ejso
// find a list: // find a list:
EJSON_PARSE_ELEMENT("find List"); EJSON_PARSE_ELEMENT("find List");
ememory::SharedPtr<ejson::internal::Array> tmpElement = ejson::internal::Array::create(); ememory::SharedPtr<ejson::internal::Array> tmpElement = ejson::internal::Array::create();
if (tmpElement == nullptr) { if (tmpElement == null) {
EJSON_CREATE_ERROR(_doc, _data, iii, _filePos, "Allocation error in Array"); EJSON_CREATE_ERROR(_doc, _data, iii, _filePos, "Allocation error in Array");
_pos=iii; _pos=iii;
return false; return false;
@ -95,7 +95,7 @@ bool ejson::internal::Array::iParse(const etk::String& _data, size_t& _pos, ejso
// find boolean: // find boolean:
EJSON_PARSE_ELEMENT("find Boolean"); EJSON_PARSE_ELEMENT("find Boolean");
ememory::SharedPtr<ejson::internal::Boolean> tmpElement = ejson::internal::Boolean::create(); ememory::SharedPtr<ejson::internal::Boolean> tmpElement = ejson::internal::Boolean::create();
if (tmpElement == nullptr) { if (tmpElement == null) {
EJSON_CREATE_ERROR(_doc, _data, iii, _filePos, "Allocation error in Boolean"); EJSON_CREATE_ERROR(_doc, _data, iii, _filePos, "Allocation error in Boolean");
_pos=iii; _pos=iii;
return false; return false;
@ -110,7 +110,7 @@ bool ejson::internal::Array::iParse(const etk::String& _data, size_t& _pos, ejso
// find null: // find null:
EJSON_PARSE_ELEMENT("find Null"); EJSON_PARSE_ELEMENT("find Null");
ememory::SharedPtr<ejson::internal::Null> tmpElement = ejson::internal::Null::create(); ememory::SharedPtr<ejson::internal::Null> tmpElement = ejson::internal::Null::create();
if (tmpElement == nullptr) { if (tmpElement == null) {
EJSON_CREATE_ERROR(_doc, _data, iii, _filePos, "Allocation error in Boolean"); EJSON_CREATE_ERROR(_doc, _data, iii, _filePos, "Allocation error in Boolean");
_pos = iii; _pos = iii;
return false; return false;
@ -121,7 +121,7 @@ bool ejson::internal::Array::iParse(const etk::String& _data, size_t& _pos, ejso
// find number: // find number:
EJSON_PARSE_ELEMENT("find Number"); EJSON_PARSE_ELEMENT("find Number");
ememory::SharedPtr<ejson::internal::Number> tmpElement = ejson::internal::Number::create(); ememory::SharedPtr<ejson::internal::Number> tmpElement = ejson::internal::Number::create();
if (tmpElement == nullptr) { if (tmpElement == null) {
EJSON_CREATE_ERROR(_doc, _data, iii, _filePos, "Allocation error in Boolean"); EJSON_CREATE_ERROR(_doc, _data, iii, _filePos, "Allocation error in Boolean");
_pos=iii; _pos=iii;
return false; return false;
@ -157,7 +157,7 @@ bool ejson::internal::Array::iGenerate(etk::String& _data, size_t _indent) const
} else { } else {
for (size_t iii=0; iii<m_value.size() ; iii++) { for (size_t iii=0; iii<m_value.size() ; iii++) {
const ememory::SharedPtr<ejson::internal::Value> tmp = m_value[iii]; const ememory::SharedPtr<ejson::internal::Value> tmp = m_value[iii];
if (tmp == nullptr) { if (tmp == null) {
continue; continue;
} }
if ( tmp->getType() == ejson::valueType::object if ( tmp->getType() == ejson::valueType::object
@ -187,7 +187,7 @@ bool ejson::internal::Array::iGenerate(etk::String& _data, size_t _indent) const
if (false == oneLine) { if (false == oneLine) {
addIndent(_data, _indent); addIndent(_data, _indent);
} }
if (m_value[iii] != nullptr) { if (m_value[iii] != null) {
m_value[iii]->iGenerate(_data, _indent+1); m_value[iii]->iGenerate(_data, _indent+1);
if (iii<m_value.size()-1) { if (iii<m_value.size()-1) {
_data += ","; _data += ",";
@ -210,7 +210,7 @@ void ejson::internal::Array::iMachineGenerate(etk::String& _data) const {
_data += "["; _data += "[";
bool needComa = false; bool needComa = false;
for (size_t iii=0; iii<m_value.size() ; iii++) { for (size_t iii=0; iii<m_value.size() ; iii++) {
if (m_value[iii] == nullptr) { if (m_value[iii] == null) {
continue; continue;
} }
if (needComa == true) { if (needComa == true) {
@ -235,8 +235,8 @@ const ememory::SharedPtr<ejson::internal::Value> ejson::internal::Array::get(siz
} }
bool ejson::internal::Array::add(ememory::SharedPtr<ejson::internal::Value> _element) { bool ejson::internal::Array::add(ememory::SharedPtr<ejson::internal::Value> _element) {
if (_element == nullptr) { if (_element == null) {
EJSON_ERROR("Request add on an nullptr pointer"); EJSON_ERROR("Request add on an null pointer");
return false; return false;
} }
m_value.pushBack(_element); m_value.pushBack(_element);
@ -252,8 +252,8 @@ void ejson::internal::Array::remove(size_t _id) {
bool ejson::internal::Array::transfertIn(ememory::SharedPtr<ejson::internal::Value> _obj) { bool ejson::internal::Array::transfertIn(ememory::SharedPtr<ejson::internal::Value> _obj) {
if (_obj == nullptr) { if (_obj == null) {
EJSON_ERROR("Request transfer on an nullptr pointer"); EJSON_ERROR("Request transfer on an null pointer");
return false; return false;
} }
if (_obj->getType() != ejson::valueType::array) { if (_obj->getType() != ejson::valueType::array) {
@ -273,13 +273,13 @@ bool ejson::internal::Array::transfertIn(ememory::SharedPtr<ejson::internal::Val
// TODO : Manage error ... // TODO : Manage error ...
ememory::SharedPtr<ejson::internal::Value> ejson::internal::Array::clone() const { ememory::SharedPtr<ejson::internal::Value> ejson::internal::Array::clone() const {
ememory::SharedPtr<ejson::internal::Array> output = ejson::internal::Array::create(); ememory::SharedPtr<ejson::internal::Array> output = ejson::internal::Array::create();
if (output == nullptr) { if (output == null) {
EJSON_ERROR("Allocation error ..."); EJSON_ERROR("Allocation error ...");
return ememory::SharedPtr<ejson::internal::Value>(); return ememory::SharedPtr<ejson::internal::Value>();
} }
for (size_t iii=0; iii<m_value.size(); ++iii) { for (size_t iii=0; iii<m_value.size(); ++iii) {
ememory::SharedPtr<const ejson::internal::Value> val = m_value[iii]; ememory::SharedPtr<const ejson::internal::Value> val = m_value[iii];
if (val == nullptr) { if (val == null) {
continue; continue;
} }
output->add(val->clone()); output->add(val->clone());

View File

@ -38,13 +38,13 @@ namespace ejson {
/** /**
* @brief get the pointer on an element reference with his ID. * @brief get the pointer on an element reference with his ID.
* @param[in] _id Id of the element. * @param[in] _id Id of the element.
* @return nullptr if the element does not exist. * @return null if the element does not exist.
*/ */
ememory::SharedPtr<ejson::internal::Value> get(size_t _id); ememory::SharedPtr<ejson::internal::Value> get(size_t _id);
/** /**
* @brief get the const pointer on an element reference with his ID. * @brief get the const pointer on an element reference with his ID.
* @param[in] _id Id of the element. * @param[in] _id Id of the element.
* @return nullptr if the element does not exist. * @return null if the element does not exist.
*/ */
const ememory::SharedPtr<ejson::internal::Value> get(size_t _id) const; const ememory::SharedPtr<ejson::internal::Value> get(size_t _id) const;
/** /**

View File

@ -73,7 +73,7 @@ void ejson::internal::Boolean::iMachineGenerate(etk::String& _data) const {
bool ejson::internal::Boolean::transfertIn(ememory::SharedPtr<ejson::internal::Value> _obj) { bool ejson::internal::Boolean::transfertIn(ememory::SharedPtr<ejson::internal::Value> _obj) {
if (_obj == nullptr) { if (_obj == null) {
EJSON_ERROR("Request transfer on an NULL pointer"); EJSON_ERROR("Request transfer on an NULL pointer");
return false; return false;
} }
@ -90,7 +90,7 @@ bool ejson::internal::Boolean::transfertIn(ememory::SharedPtr<ejson::internal::V
ememory::SharedPtr<ejson::internal::Value> ejson::internal::Boolean::clone() const { ememory::SharedPtr<ejson::internal::Value> ejson::internal::Boolean::clone() const {
ememory::SharedPtr<ejson::internal::Boolean> output = ejson::internal::Boolean::create(m_value); ememory::SharedPtr<ejson::internal::Boolean> output = ejson::internal::Boolean::create(m_value);
if (output == nullptr) { if (output == null) {
EJSON_ERROR("Allocation error ..."); EJSON_ERROR("Allocation error ...");
return ememory::SharedPtr<ejson::internal::Value>(); return ememory::SharedPtr<ejson::internal::Value>();
} }

View File

@ -46,8 +46,8 @@ void ejson::internal::Null::iMachineGenerate(etk::String& _data) const {
bool ejson::internal::Null::transfertIn(ememory::SharedPtr<ejson::internal::Value> _obj) { bool ejson::internal::Null::transfertIn(ememory::SharedPtr<ejson::internal::Value> _obj) {
if (_obj == nullptr) { if (_obj == null) {
EJSON_ERROR("Request transfer on an nullptr pointer"); EJSON_ERROR("Request transfer on an null pointer");
return false; return false;
} }
if (_obj->getType() == ejson::valueType::null) { if (_obj->getType() == ejson::valueType::null) {
@ -59,7 +59,7 @@ bool ejson::internal::Null::transfertIn(ememory::SharedPtr<ejson::internal::Valu
ememory::SharedPtr<ejson::internal::Value> ejson::internal::Null::clone() const { ememory::SharedPtr<ejson::internal::Value> ejson::internal::Null::clone() const {
ememory::SharedPtr<ejson::internal::Null> output = ejson::internal::Null::create(); ememory::SharedPtr<ejson::internal::Null> output = ejson::internal::Null::create();
if (output == nullptr) { if (output == null) {
EJSON_ERROR("Allocation error ..."); EJSON_ERROR("Allocation error ...");
return ememory::SharedPtr<ejson::internal::Value>(); return ememory::SharedPtr<ejson::internal::Value>();
} }

View File

@ -116,8 +116,8 @@ void ejson::internal::Number::iMachineGenerate(etk::String& _data) const {
bool ejson::internal::Number::transfertIn(ememory::SharedPtr<ejson::internal::Value> _obj) { bool ejson::internal::Number::transfertIn(ememory::SharedPtr<ejson::internal::Value> _obj) {
if (_obj == nullptr) { if (_obj == null) {
EJSON_ERROR("Request transfer on an nullptr pointer"); EJSON_ERROR("Request transfer on an null pointer");
return false; return false;
} }
if (_obj->getType() != ejson::valueType::number) { if (_obj->getType() != ejson::valueType::number) {
@ -156,7 +156,7 @@ ememory::SharedPtr<ejson::internal::Value> ejson::internal::Number::clone() cons
output = ejson::internal::Number::create(m_valueU64); output = ejson::internal::Number::create(m_valueU64);
break; break;
} }
if (output == nullptr) { if (output == null) {
EJSON_ERROR("Allocation error ..."); EJSON_ERROR("Allocation error ...");
return ememory::SharedPtr<ejson::internal::Value>(); return ememory::SharedPtr<ejson::internal::Value>();
} }

View File

@ -122,7 +122,7 @@ bool ejson::internal::Object::iParse(const etk::String& _data, size_t& _pos, ejs
// find an object: // find an object:
EJSON_PARSE_ELEMENT("find Object"); EJSON_PARSE_ELEMENT("find Object");
ememory::SharedPtr<ejson::internal::Object> tmpElement = ejson::internal::Object::create(); ememory::SharedPtr<ejson::internal::Object> tmpElement = ejson::internal::Object::create();
if (tmpElement == nullptr) { if (tmpElement == null) {
EJSON_CREATE_ERROR(_doc, _data, iii, _filePos, "Allocation error in object"); EJSON_CREATE_ERROR(_doc, _data, iii, _filePos, "Allocation error in object");
_pos=iii; _pos=iii;
return false; return false;
@ -135,7 +135,7 @@ bool ejson::internal::Object::iParse(const etk::String& _data, size_t& _pos, ejs
// find a string: // find a string:
EJSON_PARSE_ELEMENT("find String quoted"); EJSON_PARSE_ELEMENT("find String quoted");
ememory::SharedPtr<ejson::internal::String> tmpElement = ejson::internal::String::create(); ememory::SharedPtr<ejson::internal::String> tmpElement = ejson::internal::String::create();
if (tmpElement == nullptr) { if (tmpElement == null) {
EJSON_CREATE_ERROR(_doc, _data, iii, _filePos, "Allocation error in String"); EJSON_CREATE_ERROR(_doc, _data, iii, _filePos, "Allocation error in String");
_pos=iii; _pos=iii;
return false; return false;
@ -147,7 +147,7 @@ bool ejson::internal::Object::iParse(const etk::String& _data, size_t& _pos, ejs
// find a list: // find a list:
EJSON_PARSE_ELEMENT("find List"); EJSON_PARSE_ELEMENT("find List");
ememory::SharedPtr<ejson::internal::Array> tmpElement = ejson::internal::Array::create(); ememory::SharedPtr<ejson::internal::Array> tmpElement = ejson::internal::Array::create();
if (tmpElement == nullptr) { if (tmpElement == null) {
EJSON_CREATE_ERROR(_doc, _data, iii, _filePos, "Allocation error in Array"); EJSON_CREATE_ERROR(_doc, _data, iii, _filePos, "Allocation error in Array");
_pos=iii; _pos=iii;
return false; return false;
@ -160,7 +160,7 @@ bool ejson::internal::Object::iParse(const etk::String& _data, size_t& _pos, ejs
// find boolean: // find boolean:
EJSON_PARSE_ELEMENT("find Boolean"); EJSON_PARSE_ELEMENT("find Boolean");
ememory::SharedPtr<ejson::internal::Boolean> tmpElement = ejson::internal::Boolean::create(); ememory::SharedPtr<ejson::internal::Boolean> tmpElement = ejson::internal::Boolean::create();
if (tmpElement == nullptr) { if (tmpElement == null) {
EJSON_CREATE_ERROR(_doc, _data, iii, _filePos, "Allocation error in Boolean"); EJSON_CREATE_ERROR(_doc, _data, iii, _filePos, "Allocation error in Boolean");
_pos=iii; _pos=iii;
return false; return false;
@ -172,7 +172,7 @@ bool ejson::internal::Object::iParse(const etk::String& _data, size_t& _pos, ejs
// find null: // find null:
EJSON_PARSE_ELEMENT("find Null"); EJSON_PARSE_ELEMENT("find Null");
ememory::SharedPtr<ejson::internal::Null> tmpElement = ejson::internal::Null::create(); ememory::SharedPtr<ejson::internal::Null> tmpElement = ejson::internal::Null::create();
if (tmpElement == nullptr) { if (tmpElement == null) {
EJSON_CREATE_ERROR(_doc, _data, iii, _filePos, "Allocation error in Boolean"); EJSON_CREATE_ERROR(_doc, _data, iii, _filePos, "Allocation error in Boolean");
_pos=iii; _pos=iii;
return false; return false;
@ -184,7 +184,7 @@ bool ejson::internal::Object::iParse(const etk::String& _data, size_t& _pos, ejs
// find number: // find number:
EJSON_PARSE_ELEMENT("find Number"); EJSON_PARSE_ELEMENT("find Number");
ememory::SharedPtr<ejson::internal::Number> tmpElement = ejson::internal::Number::create(); ememory::SharedPtr<ejson::internal::Number> tmpElement = ejson::internal::Number::create();
if (tmpElement == nullptr) { if (tmpElement == null) {
EJSON_CREATE_ERROR(_doc, _data, iii, _filePos, "Allocation error in Boolean"); EJSON_CREATE_ERROR(_doc, _data, iii, _filePos, "Allocation error in Boolean");
_pos=iii; _pos=iii;
return false; return false;
@ -221,7 +221,7 @@ bool ejson::internal::Object::iGenerate(etk::String& _data, size_t _indent) cons
} else { } else {
for (size_t iii=0; iii<m_value.size() ; iii++) { for (size_t iii=0; iii<m_value.size() ; iii++) {
const ememory::SharedPtr<ejson::internal::Value> tmp = m_value.getValue(iii); const ememory::SharedPtr<ejson::internal::Value> tmp = m_value.getValue(iii);
if (tmp == nullptr) { if (tmp == null) {
continue; continue;
} }
if ( tmp->getType() == ejson::valueType::object if ( tmp->getType() == ejson::valueType::object
@ -327,7 +327,7 @@ etk::String ejson::internal::Object::getKey(size_t _id) const {
} }
bool ejson::internal::Object::add(const etk::String& _name, ememory::SharedPtr<ejson::internal::Value> _value) { bool ejson::internal::Object::add(const etk::String& _name, ememory::SharedPtr<ejson::internal::Value> _value) {
if (_value == nullptr) { if (_value == null) {
return false; return false;
} }
if (_name.size() == 0) { if (_name.size() == 0) {
@ -350,8 +350,8 @@ void ejson::internal::Object::remove(size_t _id) {
} }
bool ejson::internal::Object::transfertIn(ememory::SharedPtr<ejson::internal::Value> _obj) { bool ejson::internal::Object::transfertIn(ememory::SharedPtr<ejson::internal::Value> _obj) {
if (_obj == nullptr) { if (_obj == null) {
EJSON_ERROR("Request transfer on an nullptr pointer"); EJSON_ERROR("Request transfer on an null pointer");
return false; return false;
} }
if ( _obj->getType() != ejson::valueType::object if ( _obj->getType() != ejson::valueType::object
@ -370,7 +370,7 @@ bool ejson::internal::Object::transfertIn(ememory::SharedPtr<ejson::internal::Va
} }
bool ejson::internal::Object::cloneIn(ememory::SharedPtr<ejson::internal::Object>& _obj) const { bool ejson::internal::Object::cloneIn(ememory::SharedPtr<ejson::internal::Object>& _obj) const {
if (_obj == nullptr) { if (_obj == null) {
return false; return false;
} }
_obj->clear(); _obj->clear();
@ -388,14 +388,14 @@ ememory::SharedPtr<ejson::internal::Value> ejson::internal::Object::clone() cons
ememory::SharedPtr<ejson::internal::Object> ejson::internal::Object::cloneObj() const { ememory::SharedPtr<ejson::internal::Object> ejson::internal::Object::cloneObj() const {
ememory::SharedPtr<ejson::internal::Object> output = ejson::internal::Object::create(); ememory::SharedPtr<ejson::internal::Object> output = ejson::internal::Object::create();
if (output == nullptr) { if (output == null) {
EJSON_ERROR("Allocation error ..."); EJSON_ERROR("Allocation error ...");
return ememory::SharedPtr<ejson::internal::Object>(); return ememory::SharedPtr<ejson::internal::Object>();
} }
for (size_t iii=0; iii<m_value.size(); ++iii) { for (size_t iii=0; iii<m_value.size(); ++iii) {
ememory::SharedPtr<ejson::internal::Value> val = m_value.getValue(iii); ememory::SharedPtr<ejson::internal::Value> val = m_value.getValue(iii);
etk::String key = m_value.getKey(iii); etk::String key = m_value.getKey(iii);
if (val == nullptr) { if (val == null) {
continue; continue;
} }
output->add(key, val->clone()); output->add(key, val->clone());

View File

@ -47,13 +47,13 @@ namespace ejson {
/** /**
* @brief get the sub element with his name (no cast check) * @brief get the sub element with his name (no cast check)
* @param[in] _name name of the object * @param[in] _name name of the object
* @return pointer on the element requested or nullptr if it not the corect type or does not existed * @return pointer on the element requested or null if it not the corect type or does not existed
*/ */
ememory::SharedPtr<ejson::internal::Value> get(const etk::String& _name); ememory::SharedPtr<ejson::internal::Value> get(const etk::String& _name);
/** /**
* @brief get the sub element with his name (no cast check) * @brief get the sub element with his name (no cast check)
* @param[in] _name name of the object * @param[in] _name name of the object
* @return pointer on the element requested or nullptr if it not the corect type or does not existed * @return pointer on the element requested or null if it not the corect type or does not existed
*/ */
const ememory::SharedPtr<ejson::internal::Value> get(const etk::String& _name) const; const ememory::SharedPtr<ejson::internal::Value> get(const etk::String& _name) const;
public: public:
@ -70,13 +70,13 @@ namespace ejson {
/** /**
* @brief get the pointer on an element reference with his ID. * @brief get the pointer on an element reference with his ID.
* @param[in] _id Id of the element. * @param[in] _id Id of the element.
* @return nullptr if the element does not exist. * @return null if the element does not exist.
*/ */
ememory::SharedPtr<ejson::internal::Value> get(size_t _id); ememory::SharedPtr<ejson::internal::Value> get(size_t _id);
/** /**
* @brief get the pointer on an element reference with his ID. * @brief get the pointer on an element reference with his ID.
* @param[in] _id Id of the element. * @param[in] _id Id of the element.
* @return nullptr if the element does not exist. * @return null if the element does not exist.
*/ */
const ememory::SharedPtr<ejson::internal::Value> get(size_t _id) const; const ememory::SharedPtr<ejson::internal::Value> get(size_t _id) const;
/** /**

View File

@ -92,8 +92,8 @@ void ejson::internal::String::iMachineGenerate(etk::String& _data) const {
} }
bool ejson::internal::String::transfertIn(ememory::SharedPtr<ejson::internal::Value> _obj) { bool ejson::internal::String::transfertIn(ememory::SharedPtr<ejson::internal::Value> _obj) {
if (_obj == nullptr) { if (_obj == null) {
EJSON_ERROR("Request transfer on an nullptr pointer"); EJSON_ERROR("Request transfer on an null pointer");
return false; return false;
} }
if (_obj->getType() != ejson::valueType::string) { if (_obj->getType() != ejson::valueType::string) {
@ -108,7 +108,7 @@ bool ejson::internal::String::transfertIn(ememory::SharedPtr<ejson::internal::Va
ememory::SharedPtr<ejson::internal::Value> ejson::internal::String::clone() const { ememory::SharedPtr<ejson::internal::Value> ejson::internal::String::clone() const {
ememory::SharedPtr<ejson::internal::String> output = ejson::internal::String::create(m_value); ememory::SharedPtr<ejson::internal::String> output = ejson::internal::String::create(m_value);
if (output == nullptr) { if (output == null) {
EJSON_ERROR("Allocation error ..."); EJSON_ERROR("Allocation error ...");
return ememory::SharedPtr<ejson::internal::Value>(); return ememory::SharedPtr<ejson::internal::Value>();
} }

View File

@ -141,7 +141,7 @@ namespace ejson {
virtual bool transfertIn(ememory::SharedPtr<ejson::internal::Value> _obj); virtual bool transfertIn(ememory::SharedPtr<ejson::internal::Value> _obj);
/** /**
* @brief Copy the curent node and all the child in the curent one. * @brief Copy the curent node and all the child in the curent one.
* @return nullptr in an error occured, the pointer on the element otherwise * @return null in an error occured, the pointer on the element otherwise
*/ */
virtual ememory::SharedPtr<ejson::internal::Value> clone() const; virtual ememory::SharedPtr<ejson::internal::Value> clone() const;
protected: protected: