[DEV] update etk null

This commit is contained in:
Edouard DUPIN 2018-06-19 22:13:47 +02:00
parent ec1b6f5318
commit 7ae4ea7215
18 changed files with 167 additions and 167 deletions

View File

@ -10,12 +10,12 @@
exml::Attribute::Attribute(ememory::SharedPtr<exml::internal::Node> _internalNode) :
exml::Node(_internalNode) {
if (m_data == nullptr) {
if (m_data == null) {
return;
}
if (m_data->isAttribute() == false) {
// try to set wrong type inside ... ==> remove it ...
m_data = nullptr;
m_data = null;
}
}
@ -24,8 +24,8 @@ exml::Attribute::Attribute(const exml::Attribute& _obj) :
}
/*
exml::Attribute::Attribute(nullptr) :
exml::Node(nullptr) {
exml::Attribute::Attribute(null) :
exml::Node(null) {
}
*/
@ -40,33 +40,33 @@ exml::Attribute& exml::Attribute::operator= (const exml::Attribute& _obj) {
}
void exml::Attribute::setName(const etk::String& _name){
if (m_data == nullptr) {
EXML_DEBUG(" can not setName (nullptr) ...");
if (m_data == null) {
EXML_DEBUG(" can not setName (null) ...");
return;
}
static_cast<exml::internal::Attribute*>(m_data.get())->setName(_name);
}
const etk::String& exml::Attribute::getName() const {
if (m_data == nullptr) {
if (m_data == null) {
static etk::String errorValue = "";
EXML_DEBUG(" can not setName (nullptr) ...");
EXML_DEBUG(" can not setName (null) ...");
return errorValue;
}
return static_cast<const exml::internal::Attribute*>(m_data.get())->getName();
}
void exml::Attribute::clear() {
if (m_data == nullptr) {
EXML_DEBUG(" can not setName (nullptr) ...");
if (m_data == null) {
EXML_DEBUG(" can not setName (null) ...");
return;
}
static_cast<exml::internal::Attribute*>(m_data.get())->clear();
}
etk::Pair<etk::String, etk::String> exml::Attribute::getPair() const {
if (m_data == nullptr) {
EXML_DEBUG(" can not setName (nullptr) ...");
if (m_data == null) {
EXML_DEBUG(" can not setName (null) ...");
return etk::Pair<etk::String, etk::String>("","");
}
return etk::Pair<etk::String, etk::String>(static_cast<const exml::internal::Attribute*>(m_data.get())->getName(),

View File

@ -28,7 +28,7 @@ namespace exml {
* @brief Copy constructor
* @param[in] _obj Object to copy
*/
// TODO : Attribute(nullptr);
// TODO : Attribute(null);
/**
* @brief Copy constructor
* @param[in] _obj Object to copy

View File

@ -27,7 +27,7 @@ exml::AttributeListData::AttributeListData(exml::AttributeList* _list) :
}
size_t exml::AttributeListData::size() const {
if (m_data->m_data == nullptr) {
if (m_data->m_data == null) {
EXML_DEBUG(" can not sizeAttribute ...");
return 0;
}
@ -36,40 +36,40 @@ size_t exml::AttributeListData::size() const {
}
exml::Attribute exml::AttributeListData::operator[] (int32_t _id) {
if (m_data->m_data == nullptr) {
EXML_DEBUG(" can not getAttr (nullptr) ...");
return exml::Attribute(ememory::SharedPtr<exml::internal::Attribute>(nullptr));
if (m_data->m_data == null) {
EXML_DEBUG(" can not getAttr (null) ...");
return exml::Attribute(ememory::SharedPtr<exml::internal::Attribute>(null));
}
return exml::Attribute(static_cast<exml::internal::AttributeList*>(m_data->m_data.get())->getAttr(_id));
}
const exml::Attribute exml::AttributeListData::operator[] (int32_t _id) const {
if (m_data->m_data == nullptr) {
EXML_DEBUG(" can not getAttr (nullptr) ...");
return exml::Attribute(ememory::SharedPtr<exml::internal::Attribute>(nullptr));
if (m_data->m_data == null) {
EXML_DEBUG(" can not getAttr (null) ...");
return exml::Attribute(ememory::SharedPtr<exml::internal::Attribute>(null));
}
return exml::Attribute(static_cast<exml::internal::AttributeList*>(m_data->m_data.get())->getAttr(_id));
}
etk::Pair<etk::String, etk::String> exml::AttributeListData::getPair(int32_t _id) const {
if (m_data->m_data == nullptr) {
EXML_DEBUG(" can not getAttrPair (nullptr) ...");
if (m_data->m_data == null) {
EXML_DEBUG(" can not getAttrPair (null) ...");
return etk::Pair<etk::String, etk::String>("","");
}
return static_cast<exml::internal::AttributeList*>(m_data->m_data.get())->getAttrPair(_id);
}
void exml::AttributeListData::add(exml::Attribute _attr) {
if (m_data->m_data == nullptr) {
EXML_DEBUG(" can not appendAttribute (nullptr) ...");
if (m_data->m_data == null) {
EXML_DEBUG(" can not appendAttribute (null) ...");
return;
}
static_cast<exml::internal::AttributeList*>(m_data->m_data.get())->appendAttribute(_attr.getInternalAttribute());
}
const etk::String& exml::AttributeListData::operator[](const etk::String& _name) const {
if (m_data->m_data == nullptr) {
EXML_DEBUG(" can not getAttribute (nullptr) ...");
if (m_data->m_data == null) {
EXML_DEBUG(" can not getAttribute (null) ...");
static etk::String errorValue("");
return errorValue;
}
@ -77,24 +77,24 @@ const etk::String& exml::AttributeListData::operator[](const etk::String& _name)
}
bool exml::AttributeListData::exist(const etk::String& _name) const {
if (m_data->m_data == nullptr) {
EXML_DEBUG(" can not getAttribute (nullptr) ...");
if (m_data->m_data == null) {
EXML_DEBUG(" can not getAttribute (null) ...");
return false;
}
return static_cast<exml::internal::AttributeList*>(m_data->m_data.get())->existAttribute(_name);
}
bool exml::AttributeListData::remove(const etk::String& _name) {
if (m_data->m_data == nullptr) {
EXML_DEBUG(" can not removeAttribute (nullptr) ...");
if (m_data->m_data == null) {
EXML_DEBUG(" can not removeAttribute (null) ...");
return false;
}
return static_cast<exml::internal::AttributeList*>(m_data->m_data.get())->removeAttribute(_name);
}
void exml::AttributeListData::set(const etk::String& _name, const etk::String& _value) {
if (m_data->m_data == nullptr) {
EXML_DEBUG(" can not setAttribute (nullptr) ...");
if (m_data->m_data == null) {
EXML_DEBUG(" can not setAttribute (null) ...");
return;
}
static_cast<exml::internal::AttributeList*>(m_data->m_data.get())->setAttribute(_name, _value);

View File

@ -16,11 +16,11 @@ namespace exml {
*/
class AttributeListData {
private:
exml::AttributeList* m_data; //!< Pointer on the Attribute list class (must not be nullptr)
exml::AttributeList* m_data; //!< Pointer on the Attribute list class (must not be null)
public:
/**
* @brief Constructor on the AttributeListData class
* @param[in] _list Point on the parrent class (must not be nullptr)
* @param[in] _list Point on the parrent class (must not be null)
*/
AttributeListData(exml::AttributeList* _list);
public:

View File

@ -10,12 +10,12 @@
exml::Comment::Comment(ememory::SharedPtr<exml::internal::Node> _internalNode) :
exml::Node(_internalNode) {
if (m_data == nullptr) {
if (m_data == null) {
return;
}
if (m_data->isComment() == false) {
// try to set wrong type inside ... ==> remove it ...
m_data = nullptr;
m_data = null;
}
}

View File

@ -10,12 +10,12 @@
exml::Declaration::Declaration(ememory::SharedPtr<exml::internal::Node> _internalNode) :
exml::AttributeList(_internalNode) {
if (m_data == nullptr) {
if (m_data == null) {
return;
}
if (m_data->isDeclaration() == false) {
// try to set wrong type inside ... ==> remove it ...
m_data = nullptr;
m_data = null;
}
}
@ -39,13 +39,13 @@ exml::Declaration& exml::Declaration::operator= (const exml::Declaration& _obj)
exml::DeclarationXML::DeclarationXML(ememory::SharedPtr<exml::internal::Node> _internalNode) :
exml::Declaration(_internalNode) {
if (m_data == nullptr) {
if (m_data == null) {
return;
}
// TODO: Do it better
if (m_data->isDeclaration() == false) {
// try to set wrong type inside ... ==> remove it ...
m_data = nullptr;
m_data = null;
}
}

View File

@ -10,12 +10,12 @@
exml::Document::Document(ememory::SharedPtr<exml::internal::Node> _internalNode) :
exml::Element(_internalNode) {
if (m_data == nullptr) {
if (m_data == null) {
return;
}
if (m_data->isDocument() == false) {
// try to set wrong type inside ... ==> remove it ...
m_data = nullptr;
m_data = null;
}
}
@ -35,80 +35,80 @@ exml::Document& exml::Document::operator= (const exml::Document& _obj) {
}
bool exml::Document::parse(const etk::String& _data) {
if (m_data == nullptr) {
EXML_DEBUG("Can not parse (nullptr) ...");
if (m_data == null) {
EXML_DEBUG("Can not parse (null) ...");
return false;
}
return static_cast<exml::internal::Document*>(m_data.get())->parse(_data);
}
bool exml::Document::generate(etk::String& _data) {
if (m_data == nullptr) {
EXML_DEBUG("Can not generate (nullptr) ...");
if (m_data == null) {
EXML_DEBUG("Can not generate (null) ...");
return false;
}
return static_cast<exml::internal::Document*>(m_data.get())->generate(_data);
}
bool exml::Document::load(const etk::String& _file) {
if (m_data == nullptr) {
EXML_DEBUG("Can not load (nullptr) ...");
if (m_data == null) {
EXML_DEBUG("Can not load (null) ...");
return false;
}
return static_cast<exml::internal::Document*>(m_data.get())->load(_file);
}
bool exml::Document::store(const etk::String& _file) {
if (m_data == nullptr) {
EXML_DEBUG("Can not store (nullptr) ...");
if (m_data == null) {
EXML_DEBUG("Can not store (null) ...");
return false;
}
return static_cast<exml::internal::Document*>(m_data.get())->store(_file);
}
void exml::Document::display() {
if (m_data == nullptr) {
EXML_DEBUG("Can not display (nullptr) ...");
if (m_data == null) {
EXML_DEBUG("Can not display (null) ...");
return;
}
static_cast<exml::internal::Document*>(m_data.get())->display();
}
void exml::Document::setCaseSensitive(bool _val) {
if (m_data == nullptr) {
EXML_DEBUG("Can not setCaseSensitive (nullptr) ...");
if (m_data == null) {
EXML_DEBUG("Can not setCaseSensitive (null) ...");
return;
}
static_cast<exml::internal::Document*>(m_data.get())->setCaseSensitive(_val);
}
bool exml::Document::getCaseSensitive() const {
if (m_data == nullptr) {
EXML_DEBUG("Can not getCaseSensitive (nullptr) ...");
if (m_data == null) {
EXML_DEBUG("Can not getCaseSensitive (null) ...");
return false;
}
return static_cast<const exml::internal::Document*>(m_data.get())->getCaseSensitive();
}
void exml::Document::setDisplayError(bool _value){
if (m_data == nullptr) {
EXML_DEBUG("Can not setDisplayError (nullptr) ...");
if (m_data == null) {
EXML_DEBUG("Can not setDisplayError (null) ...");
return;
}
static_cast<exml::internal::Document*>(m_data.get())->setDisplayError(_value);
}
bool exml::Document::getDisplayError() {
if (m_data == nullptr) {
EXML_DEBUG("Can not getDisplayError (nullptr) ...");
if (m_data == null) {
EXML_DEBUG("Can not getDisplayError (null) ...");
return false;
}
return static_cast<exml::internal::Document*>(m_data.get())->getDisplayError();
}
void exml::Document::displayError() {
if (m_data == nullptr) {
EXML_DEBUG("Can not displayError (nullptr) ...");
if (m_data == null) {
EXML_DEBUG("Can not displayError (null) ...");
return;
}
static_cast<exml::internal::Document*>(m_data.get())->displayError();

View File

@ -12,13 +12,13 @@
exml::Element::Element(const ememory::SharedPtr<exml::internal::Node>& _internalNode) :
exml::AttributeList(_internalNode),
nodes(this) {
if (m_data == nullptr) {
if (m_data == null) {
return;
}
if ( m_data->isElement() == false
&& m_data->isDocument() == false) {
// try to set wrong type inside ... ==> remove it ...
m_data = nullptr;
m_data = null;
}
}
@ -61,7 +61,7 @@ exml::ElementData::ElementData(exml::Element* _elem) :
}
size_t exml::ElementData::size() const {
if (m_data->m_data == nullptr) {
if (m_data->m_data == null) {
EXML_DEBUG(" can not get type ...");
return 0;
}
@ -69,7 +69,7 @@ size_t exml::ElementData::size() const {
}
enum exml::nodeType exml::ElementData::getType(int32_t _id) const {
if (m_data->m_data == nullptr) {
if (m_data->m_data == null) {
EXML_DEBUG(" can not get type ...");
return exml::nodeType::unknow;
}
@ -77,7 +77,7 @@ enum exml::nodeType exml::ElementData::getType(int32_t _id) const {
}
exml::Node exml::ElementData::operator[](int32_t _id) {
if (m_data->m_data == nullptr) {
if (m_data->m_data == null) {
EXML_DEBUG(" can not get type ...");
return exml::Node();
}
@ -85,7 +85,7 @@ exml::Node exml::ElementData::operator[](int32_t _id) {
}
const exml::Node exml::ElementData::operator[](int32_t _id) const {
if (m_data->m_data == nullptr) {
if (m_data->m_data == null) {
EXML_DEBUG(" can not get type ...");
return exml::Node();
}
@ -93,7 +93,7 @@ const exml::Node exml::ElementData::operator[](int32_t _id) const {
}
exml::Element exml::ElementData::operator[](const etk::String& _name) {
if (m_data->m_data == nullptr) {
if (m_data->m_data == null) {
EXML_DEBUG(" can not get type ...");
return exml::Element();
}
@ -101,7 +101,7 @@ exml::Element exml::ElementData::operator[](const etk::String& _name) {
}
const exml::Element exml::ElementData::operator[] (const etk::String& _name) const {
if (m_data->m_data == nullptr) {
if (m_data->m_data == null) {
EXML_DEBUG(" can not get type ...");
return exml::Element();
}
@ -109,7 +109,7 @@ const exml::Element exml::ElementData::operator[] (const etk::String& _name) con
}
void exml::ElementData::add(const exml::Node& _node) {
if (m_data->m_data == nullptr) {
if (m_data->m_data == null) {
EXML_DEBUG(" can not APPEND on null element ...");
return;
}
@ -117,7 +117,7 @@ void exml::ElementData::add(const exml::Node& _node) {
}
void exml::ElementData::remove(const etk::String& _nodeName) {
if (m_data->m_data == nullptr) {
if (m_data->m_data == null) {
EXML_DEBUG(" can not APPEND on null element ...");
return;
}
@ -125,7 +125,7 @@ void exml::ElementData::remove(const etk::String& _nodeName) {
}
etk::String exml::Element::getText() const {
if (m_data == nullptr) {
if (m_data == null) {
EXML_DEBUG(" can not APPEND on null element ...");
return "";
}
@ -133,7 +133,7 @@ etk::String exml::Element::getText() const {
}
void exml::Element::clear() {
if (m_data == nullptr) {
if (m_data == null) {
EXML_DEBUG(" can not CLEAR on null element ...");
return;
}

View File

@ -19,11 +19,11 @@ namespace exml {
*/
class ElementData {
private:
exml::Element* m_data; //!< Pointer on the exml::Element class (must not be nullptr)
exml::Element* m_data; //!< Pointer on the exml::Element class (must not be null)
public:
/**
* @brief constructor on the ElementData class
* @param[in] _list Get pointer on the exml::Element class (must not be nullptr)
* @param[in] _list Get pointer on the exml::Element class (must not be null)
*/
ElementData(exml::Element* _list);
public:

View File

@ -31,26 +31,26 @@ exml::Node::Node(const ememory::SharedPtr<exml::internal::Node>& _internalNode)
}
exml::Node::Node() :
m_data(nullptr) {
m_data(null) {
}
bool exml::Node::exist() const {
if (m_data == nullptr) {
if (m_data == null) {
return false;
}
return true;
}
exml::FilePos exml::Node::getPos() const {
if (m_data == nullptr) {
if (m_data == null) {
return exml::FilePos(0,0);
}
return m_data->getPos();
}
void exml::Node::setValue(etk::String _value) {
if (m_data == nullptr) {
if (m_data == null) {
EXML_ERROR(" can not set value: '" << _value << "'");
return;
}
@ -58,7 +58,7 @@ void exml::Node::setValue(etk::String _value) {
}
const etk::String& exml::Node::getValue() const {
if (m_data == nullptr) {
if (m_data == null) {
static etk::String errorString = "";
EXML_DEBUG(" can not get value ...");
return errorString;
@ -67,7 +67,7 @@ const etk::String& exml::Node::getValue() const {
}
enum exml::nodeType exml::Node::getType() const {
if (m_data == nullptr) {
if (m_data == null) {
EXML_DEBUG("Can not get type ...");
return exml::nodeType::unknow;
}
@ -123,49 +123,49 @@ const exml::Text exml::Node::toText() const {
}
bool exml::Node::isDocument() const {
if (m_data == nullptr) {
if (m_data == null) {
return false;
}
return m_data->isDocument();
}
bool exml::Node::isAttribute() const {
if (m_data == nullptr) {
if (m_data == null) {
return false;
}
return m_data->isAttribute();
}
bool exml::Node::isComment() const {
if (m_data == nullptr) {
if (m_data == null) {
return false;
}
return m_data->isComment();
}
bool exml::Node::isDeclaration() const {
if (m_data == nullptr) {
if (m_data == null) {
return false;
}
return m_data->isDeclaration();
}
bool exml::Node::isElement() const {
if (m_data == nullptr) {
if (m_data == null) {
return false;
}
return m_data->isElement() || m_data->isDocument();
}
bool exml::Node::isText() const {
if (m_data == nullptr) {
if (m_data == null) {
return false;
}
return m_data->isText();
}
void exml::Node::clear() {
if (m_data == nullptr) {
if (m_data == null) {
return;
}
return m_data->clear();

View File

@ -77,62 +77,62 @@ namespace exml {
enum nodeType getType() const;
/**
* @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.
*/
exml::Document toDocument();
/**
* @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 exml::Document toDocument() const;
/**
* @brief Cast the element in a Attribute if it is possible.
* @return pointer on the class or nullptr.
* @return pointer on the class or null.
*/
exml::Attribute toAttribute();
/**
* @brief Cast the element in a Attribute if it is possible.
* @return CONST pointer on the class or nullptr.
* @return CONST pointer on the class or null.
*/
const exml::Attribute toAttribute() const;
/**
* @brief Cast the element in a Comment if it is possible.
* @return pointer on the class or nullptr.
* @return pointer on the class or null.
*/
exml::Comment toComment();
/**
* @brief Cast the element in a Comment if it is possible.
* @return CONST pointer on the class or nullptr.
* @return CONST pointer on the class or null.
*/
const exml::Comment toComment() const;
/**
* @brief Cast the element in a Declaration if it is possible.
* @return pointer on the class or nullptr.
* @return pointer on the class or null.
*/
exml::Declaration toDeclaration();
/**
* @brief Cast the element in a Declaration if it is possible.
* @return CONST pointer on the class or nullptr.
* @return CONST pointer on the class or null.
*/
const exml::Declaration toDeclaration() const;
/**
* @brief Cast the element in a Element if it is possible.
* @return pointer on the class or nullptr.
* @return pointer on the class or null.
*/
exml::Element toElement();
/**
* @brief Cast the element in a Element if it is possible.
* @return CONST pointer on the class or nullptr.
* @return CONST pointer on the class or null.
*/
const exml::Element toElement() const;
/**
* @brief Cast the element in a Text if it is possible.
* @return pointer on the class or nullptr.
* @return pointer on the class or null.
*/
exml::Text toText();
/**
* @brief Cast the element in a Text if it is possible.
* @return CONST pointer on the class or nullptr.
* @return CONST pointer on the class or null.
*/
const exml::Text toText() const;
/**

View File

@ -10,12 +10,12 @@
exml::Text::Text(ememory::SharedPtr<exml::internal::Node> _internalNode) :
exml::Node(_internalNode) {
if (m_data == nullptr) {
if (m_data == null) {
return;
}
if (m_data->isText() == false) {
// try to set wrong type inside ... ==> remove it ...
m_data = nullptr;
m_data = null;
}
}

View File

@ -10,7 +10,7 @@
ememory::SharedPtr<exml::internal::Attribute> exml::internal::AttributeList::getAttr(int32_t _id) {
if ( _id < 0
|| size_t(_id) >= m_listAttribute.size()) {
return nullptr;
return null;
}
return m_listAttribute[_id];
}
@ -18,14 +18,14 @@ ememory::SharedPtr<exml::internal::Attribute> exml::internal::AttributeList::get
ememory::SharedPtr<const exml::internal::Attribute> exml::internal::AttributeList::getAttr(int32_t _id) const {
if ( _id < 0
|| size_t(_id) >= m_listAttribute.size()) {
return nullptr;
return null;
}
return m_listAttribute[_id];
}
etk::Pair<etk::String, etk::String> exml::internal::AttributeList::getAttrPair(int32_t _id) const {
ememory::SharedPtr<const exml::internal::Attribute> att = getAttr(_id);
if (att == nullptr) {
if (att == null) {
return etk::makePair<etk::String, etk::String>("","");
}
return etk::makePair(att->getName(),att->getValue());
@ -33,7 +33,7 @@ etk::Pair<etk::String, etk::String> exml::internal::AttributeList::getAttrPair(i
void exml::internal::AttributeList::appendAttribute(const ememory::SharedPtr<exml::internal::Attribute>& _attr) {
if (_attr == nullptr) {
if (_attr == null) {
EXML_ERROR("Try to set an empty node");
return;
}
@ -52,7 +52,7 @@ const etk::String& exml::internal::AttributeList::getAttribute(const etk::String
return errorReturn;
}
for (size_t iii=0; iii<m_listAttribute.size(); iii++) {
if( m_listAttribute[iii] != nullptr
if( m_listAttribute[iii] != null
&& m_listAttribute[iii]->getName() == _name) {
return m_listAttribute[iii]->getValue();
}
@ -66,7 +66,7 @@ bool exml::internal::AttributeList::existAttribute(const etk::String& _name) con
return false;
}
for (size_t iii=0; iii<m_listAttribute.size(); ++iii) {
if( m_listAttribute[iii] != nullptr
if( m_listAttribute[iii] != null
&& m_listAttribute[iii]->getName() == _name) {
return true;
}
@ -80,7 +80,7 @@ bool exml::internal::AttributeList::removeAttribute(const etk::String& _name) {
}
auto it = m_listAttribute.begin();
while (it != m_listAttribute.end()) {
if (*it == nullptr) {
if (*it == null) {
it = m_listAttribute.erase(it);
continue;
}
@ -96,7 +96,7 @@ bool exml::internal::AttributeList::removeAttribute(const etk::String& _name) {
void exml::internal::AttributeList::setAttribute(const etk::String& _name, const etk::String& _value) {
// check if attribute already det :
for (size_t iii=0; iii<m_listAttribute.size(); ++iii) {
if( m_listAttribute[iii] != nullptr
if( m_listAttribute[iii] != null
&& m_listAttribute[iii]->getName() == _name) {
// update the value :
m_listAttribute[iii]->setValue(_value);
@ -104,7 +104,7 @@ void exml::internal::AttributeList::setAttribute(const etk::String& _name, const
}
}
ememory::SharedPtr<exml::internal::Attribute> attr = exml::internal::Attribute::create(_name, _value);
if (attr == nullptr) {
if (attr == null) {
EXML_ERROR("memory allocation error...");
}
m_listAttribute.pushBack(attr);
@ -112,7 +112,7 @@ void exml::internal::AttributeList::setAttribute(const etk::String& _name, const
bool exml::internal::AttributeList::iGenerate(etk::String& _data, int32_t _indent) const {
for (size_t iii=0; iii<m_listAttribute.size(); iii++) {
if (m_listAttribute[iii] != nullptr) {
if (m_listAttribute[iii] != null) {
m_listAttribute[iii]->iGenerate(_data, _indent);
}
}

View File

@ -77,7 +77,7 @@ bool exml::internal::Declaration::iParse(const etk::String& _data, int32_t& _pos
if (checkAvaillable(_data[iii], true) == true) {
// we find an attibute == > create an element and parse it:
ememory::SharedPtr<exml::internal::Attribute> attribute = exml::internal::Attribute::create();
if (attribute == nullptr) {
if (attribute == null) {
CREATE_ERROR(_doc, _data, _pos, _filePos, " Allocation error ...");
return false;
}

View File

@ -24,7 +24,7 @@ exml::internal::Document::Document() :
bool exml::internal::Document::iGenerate(etk::String& _data, int32_t _indent) const {
for (size_t iii=0; iii<m_listSub.size(); iii++) {
if (m_listSub[iii] != nullptr) {
if (m_listSub[iii] != null) {
m_listSub[iii]->iGenerate(_data, _indent);
}
}

View File

@ -28,7 +28,7 @@ ememory::SharedPtr<exml::internal::Element> exml::internal::Element::create(cons
enum exml::nodeType exml::internal::Element::getType(int32_t _id) const {
ememory::SharedPtr<const exml::internal::Node> tmpp = getNode(_id);
if (tmpp == nullptr) {
if (tmpp == null) {
return exml::nodeType::unknow;
}
return tmpp->getType();
@ -37,7 +37,7 @@ enum exml::nodeType exml::internal::Element::getType(int32_t _id) const {
ememory::SharedPtr<exml::internal::Node> exml::internal::Element::getNode(int32_t _id) {
if ( _id <0
|| (size_t)_id>=m_listSub.size()) {
return nullptr;
return null;
}
return m_listSub[_id];
}
@ -45,7 +45,7 @@ ememory::SharedPtr<exml::internal::Node> exml::internal::Element::getNode(int32_
const ememory::SharedPtr<exml::internal::Node> exml::internal::Element::getNode(int32_t _id) const {
if ( _id <0
|| (size_t)_id>=m_listSub.size()) {
return nullptr;
return null;
}
return m_listSub[_id];
}
@ -53,56 +53,56 @@ const ememory::SharedPtr<exml::internal::Node> exml::internal::Element::getNode(
ememory::SharedPtr<exml::internal::Element> exml::internal::Element::getElement(int32_t _id) {
ememory::SharedPtr<exml::internal::Node> tmpp = getNode(_id);
if (tmpp == nullptr) {
return nullptr;
if (tmpp == null) {
return null;
}
return tmpp->toElement();
}
const ememory::SharedPtr<exml::internal::Element> exml::internal::Element::getElement(int32_t _id) const {
const ememory::SharedPtr<exml::internal::Node> tmpp = getNode(_id);
if (tmpp == nullptr) {
return nullptr;
if (tmpp == null) {
return null;
}
return tmpp->toElement();
}
ememory::SharedPtr<exml::internal::Element> exml::internal::Element::getNamed(const etk::String& _name) {
if (_name.size() == 0) {
return nullptr;
return null;
}
for (size_t iii=0; iii<m_listSub.size(); iii++) {
if( m_listSub[iii] != nullptr
if( m_listSub[iii] != null
&& m_listSub[iii]->getType() == exml::nodeType::element
&& m_listSub[iii]->getValue() == _name) {
if (m_listSub[iii] == nullptr) {
return nullptr;
if (m_listSub[iii] == null) {
return null;
}
return m_listSub[iii]->toElement();
}
}
return nullptr;
return null;
}
const ememory::SharedPtr<exml::internal::Element> exml::internal::Element::getNamed(const etk::String& _name) const {
if (_name.size() == 0) {
return nullptr;
return null;
}
for (size_t iii=0; iii<m_listSub.size(); iii++) {
if( m_listSub[iii] != nullptr
if( m_listSub[iii] != null
&& m_listSub[iii]->getType() == exml::nodeType::element
&& m_listSub[iii]->getValue() == _name) {
if (m_listSub[iii] == nullptr) {
return nullptr;
if (m_listSub[iii] == null) {
return null;
}
return m_listSub[iii]->toElement();
}
}
return nullptr;
return null;
}
void exml::internal::Element::append(const ememory::SharedPtr<exml::internal::Node>& _node) {
if (_node == nullptr) {
if (_node == null) {
EXML_ERROR("Try to set an empty node");
return;
}
@ -125,7 +125,7 @@ void exml::internal::Element::remove(const etk::String& _nodeName) {
}
auto it = m_listSub.begin();
while (it != m_listSub.end()) {
if (*it == nullptr) {
if (*it == null) {
it = m_listSub.erase(it);
} else if ((*it)->getValue() == _nodeName) {
it = m_listSub.erase(it);
@ -145,7 +145,7 @@ etk::String exml::internal::Element::getText() const {
}
} else {
for (size_t iii=0; iii<m_listSub.size(); iii++) {
if (m_listSub[iii] != nullptr) {
if (m_listSub[iii] != null) {
m_listSub[iii]->iGenerate(res, 0);
}
}
@ -161,7 +161,7 @@ bool exml::internal::Element::iGenerate(etk::String& _data, int32_t _indent) con
if (m_listSub.size()>0) {
if( m_listSub.size() == 1
&& m_listSub[0] != nullptr
&& m_listSub[0] != null
&& m_listSub[0]->getType() == exml::nodeType::text
&& ememory::dynamicPointerCast<exml::internal::Text>(m_listSub[0])->countLines() == 1) {
_data += ">";
@ -171,7 +171,7 @@ bool exml::internal::Element::iGenerate(etk::String& _data, int32_t _indent) con
_data += ">\n";
for (size_t iii=0; iii<m_listSub.size(); iii++) {
if (m_listSub[iii] != nullptr) {
if (m_listSub[iii] != null) {
m_listSub[iii]->iGenerate(_data, _indent+1);
}
}
@ -236,7 +236,7 @@ bool exml::internal::Element::subParse(const etk::String& _data, int32_t& _pos,
}
// Find declaration balise
ememory::SharedPtr<exml::internal::Declaration> declaration = exml::internal::Declaration::create(tmpname);
if (declaration == nullptr) {
if (declaration == null) {
CREATE_ERROR(_doc, _data, _pos, _filePos, "Allocation Error...");
return false;
}
@ -269,7 +269,7 @@ bool exml::internal::Element::subParse(const etk::String& _data, int32_t& _pos,
++tmpPos;
// find comment:
ememory::SharedPtr<exml::internal::Comment> comment = exml::internal::Comment::create();
if (comment == nullptr) {
if (comment == null) {
CREATE_ERROR(_doc, _data, _pos, _filePos, "Allocation error ...");
return false;
}
@ -298,7 +298,7 @@ bool exml::internal::Element::subParse(const etk::String& _data, int32_t& _pos,
tmpPos+=6;
// find text:
ememory::SharedPtr<exml::internal::TextCDATA> text = exml::internal::TextCDATA::create();
if (text == nullptr) {
if (text == null) {
CREATE_ERROR(_doc, _data, _pos, _filePos, "Allocation error ...");
return false;
}
@ -387,7 +387,7 @@ bool exml::internal::Element::subParse(const etk::String& _data, int32_t& _pos,
//EXML_INFO("find node named : '" << tmpname << "'");
// find text:
ememory::SharedPtr<exml::internal::Element> element = exml::internal::Element::create(tmpname);
if (element == nullptr) {
if (element == null) {
CREATE_ERROR(_doc, _data, _pos, _filePos, "Allocation error ...");
return false;
}
@ -418,7 +418,7 @@ bool exml::internal::Element::subParse(const etk::String& _data, int32_t& _pos,
} else {
// find data == > parse it...
ememory::SharedPtr<exml::internal::Text> text = exml::internal::Text::create();
if (text == nullptr) {
if (text == null) {
CREATE_ERROR(_doc, _data, _pos, _filePos, "Allocation error ...");
return false;
}
@ -476,7 +476,7 @@ bool exml::internal::Element::iParse(const etk::String& _data,
if (checkAvaillable(_data[iii], true) == true) {
// we find an attibute == > create an element and parse it:
ememory::SharedPtr<exml::internal::Attribute> attribute = exml::internal::Attribute::create();
if (attribute == nullptr) {
if (attribute == null) {
CREATE_ERROR(_doc, _data, _pos, _filePos, "Allocation error ...");
return false;
}

View File

@ -134,51 +134,51 @@ enum exml::nodeType exml::internal::Node::getType() const {
}
ememory::SharedPtr<exml::internal::Document> exml::internal::Node::toDocument() {
return nullptr;
return null;
}
const ememory::SharedPtr<exml::internal::Document> exml::internal::Node::toDocument() const {
return nullptr;
return null;
}
ememory::SharedPtr<exml::internal::Attribute> exml::internal::Node::toAttribute() {
return nullptr;
return null;
}
const ememory::SharedPtr<exml::internal::Attribute> exml::internal::Node::toAttribute() const {
return nullptr;
return null;
}
ememory::SharedPtr<exml::internal::Comment> exml::internal::Node::toComment() {
return nullptr;
return null;
}
const ememory::SharedPtr<exml::internal::Comment> exml::internal::Node::toComment() const {
return nullptr;
return null;
}
ememory::SharedPtr<exml::internal::Declaration> exml::internal::Node::toDeclaration() {
return nullptr;
return null;
}
const ememory::SharedPtr<exml::internal::Declaration> exml::internal::Node::toDeclaration() const {
return nullptr;
return null;
}
ememory::SharedPtr<exml::internal::Element> exml::internal::Node::toElement() {
return nullptr;
return null;
}
const ememory::SharedPtr<exml::internal::Element> exml::internal::Node::toElement() const {
return nullptr;
return null;
}
ememory::SharedPtr<exml::internal::Text> exml::internal::Node::toText() {
return nullptr;
return null;
}
const ememory::SharedPtr<exml::internal::Text> exml::internal::Node::toText() const{
return nullptr;
return null;
}
bool exml::internal::Node::isDocument() const {

View File

@ -136,62 +136,62 @@ namespace exml {
public:
/**
* @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.
*/
virtual ememory::SharedPtr<exml::internal::Document> toDocument();
/**
* @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.
*/
virtual const ememory::SharedPtr<exml::internal::Document> toDocument() const;
/**
* @brief Cast the element in a Attribute if it is possible.
* @return pointer on the class or nullptr.
* @return pointer on the class or null.
*/
virtual ememory::SharedPtr<exml::internal::Attribute> toAttribute();
/**
* @brief Cast the element in a Attribute if it is possible.
* @return CONST pointer on the class or nullptr.
* @return CONST pointer on the class or null.
*/
virtual const ememory::SharedPtr<exml::internal::Attribute> toAttribute() const;
/**
* @brief Cast the element in a Comment if it is possible.
* @return pointer on the class or nullptr.
* @return pointer on the class or null.
*/
virtual ememory::SharedPtr<exml::internal::Comment> toComment();
/**
* @brief Cast the element in a Comment if it is possible.
* @return CONST pointer on the class or nullptr.
* @return CONST pointer on the class or null.
*/
virtual const ememory::SharedPtr<exml::internal::Comment> toComment() const;
/**
* @brief Cast the element in a Declaration if it is possible.
* @return pointer on the class or nullptr.
* @return pointer on the class or null.
*/
virtual ememory::SharedPtr<exml::internal::Declaration> toDeclaration();
/**
* @brief Cast the element in a Declaration if it is possible.
* @return CONST pointer on the class or nullptr.
* @return CONST pointer on the class or null.
*/
virtual const ememory::SharedPtr<exml::internal::Declaration> toDeclaration() const;
/**
* @brief Cast the element in a Element if it is possible.
* @return pointer on the class or nullptr.
* @return pointer on the class or null.
*/
virtual ememory::SharedPtr<exml::internal::Element> toElement();
/**
* @brief Cast the element in a Element if it is possible.
* @return CONST pointer on the class or nullptr.
* @return CONST pointer on the class or null.
*/
virtual const ememory::SharedPtr<exml::internal::Element> toElement() const;
/**
* @brief Cast the element in a Text if it is possible.
* @return pointer on the class or nullptr.
* @return pointer on the class or null.
*/
virtual ememory::SharedPtr<exml::internal::Text> toText();
/**
* @brief Cast the element in a Text if it is possible.
* @return CONST pointer on the class or nullptr.
* @return CONST pointer on the class or null.
*/
virtual const ememory::SharedPtr<exml::internal::Text> toText() const;