[DEBUG] fix the use of ememory
This commit is contained in:
parent
233c303d93
commit
d2a9a09acb
@ -25,8 +25,8 @@ std::ostream& exml::operator <<(std::ostream& _os, const exml::Node& _obj) {
|
||||
}
|
||||
|
||||
|
||||
exml::Node::Node(ememory::SharedPtr<exml::internal::Node> _internalNode) :
|
||||
m_data(_internalNode) {
|
||||
exml::Node::Node(const ememory::SharedPtr<exml::internal::Node>& _internalNode) :
|
||||
m_data(ememory::constPointerCast<exml::internal::Node>(_internalNode)) {
|
||||
// nothing to DO ...
|
||||
}
|
||||
|
||||
|
@ -38,7 +38,7 @@ namespace exml {
|
||||
* @brief basic element of a xml structure
|
||||
* @param[in] _internalNode Internal reference of the Node
|
||||
*/
|
||||
Node(ememory::SharedPtr<exml::internal::Node> _internalNode);
|
||||
Node(const ememory::SharedPtr<exml::internal::Node>& _internalNode);
|
||||
/**
|
||||
* @brief basic element of a xml structure
|
||||
*/
|
||||
|
@ -55,8 +55,8 @@ namespace exml {
|
||||
ememory::SharedPtr<exml::internal::Attribute> toAttribute() override {
|
||||
return ememory::staticPointerCast<exml::internal::Attribute>(sharedFromThis());
|
||||
};
|
||||
ememory::SharedPtr<const exml::internal::Attribute> toAttribute() const override {
|
||||
return ememory::staticPointerCast<const exml::internal::Attribute>(sharedFromThis());
|
||||
const ememory::SharedPtr<exml::internal::Attribute> toAttribute() const override {
|
||||
return ememory::staticPointerCast<exml::internal::Attribute>(sharedFromThis());
|
||||
};
|
||||
void clear() override;
|
||||
};
|
||||
|
@ -38,8 +38,8 @@ namespace exml {
|
||||
ememory::SharedPtr<exml::internal::Comment> toComment() override {
|
||||
return ememory::staticPointerCast<exml::internal::Comment>(sharedFromThis());
|
||||
}
|
||||
ememory::SharedPtr<const exml::internal::Comment> toComment() const override {
|
||||
return ememory::staticPointerCast<const exml::internal::Comment>(sharedFromThis());
|
||||
const ememory::SharedPtr<exml::internal::Comment> toComment() const override {
|
||||
return ememory::staticPointerCast<exml::internal::Comment>(sharedFromThis());
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -38,8 +38,8 @@ namespace exml {
|
||||
ememory::SharedPtr<exml::internal::Declaration> toDeclaration() override {
|
||||
return ememory::staticPointerCast<exml::internal::Declaration>(sharedFromThis());
|
||||
};
|
||||
ememory::SharedPtr<const exml::internal::Declaration> toDeclaration() const override {
|
||||
return ememory::staticPointerCast<const exml::internal::Declaration>(sharedFromThis());
|
||||
const ememory::SharedPtr<exml::internal::Declaration> toDeclaration() const override {
|
||||
return ememory::staticPointerCast<exml::internal::Declaration>(sharedFromThis());
|
||||
};
|
||||
};
|
||||
/**
|
||||
|
@ -112,8 +112,8 @@ namespace exml {
|
||||
ememory::SharedPtr<exml::internal::Document> toDocument() override {
|
||||
return ememory::staticPointerCast<exml::internal::Document>(sharedFromThis());
|
||||
}
|
||||
ememory::SharedPtr<const exml::internal::Document> toDocument() const override {
|
||||
return ememory::staticPointerCast<const exml::internal::Document>(sharedFromThis());
|
||||
const ememory::SharedPtr<exml::internal::Document> toDocument() const override {
|
||||
return ememory::staticPointerCast<exml::internal::Document>(sharedFromThis());
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ ememory::SharedPtr<exml::internal::Node> exml::internal::Element::getNode(int32_
|
||||
return m_listSub[_id];
|
||||
}
|
||||
|
||||
ememory::SharedPtr<const exml::internal::Node> exml::internal::Element::getNode(int32_t _id) const {
|
||||
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;
|
||||
@ -59,8 +59,8 @@ ememory::SharedPtr<exml::internal::Element> exml::internal::Element::getElement(
|
||||
return tmpp->toElement();
|
||||
}
|
||||
|
||||
ememory::SharedPtr<const exml::internal::Element> exml::internal::Element::getElement(int32_t _id) const {
|
||||
ememory::SharedPtr<const exml::internal::Node> tmpp = getNode(_id);
|
||||
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;
|
||||
}
|
||||
@ -84,7 +84,7 @@ ememory::SharedPtr<exml::internal::Element> exml::internal::Element::getNamed(co
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ememory::SharedPtr<const exml::internal::Element> exml::internal::Element::getNamed(const std::string& _name) const {
|
||||
const ememory::SharedPtr<exml::internal::Element> exml::internal::Element::getNamed(const std::string& _name) const {
|
||||
if (_name.size() == 0) {
|
||||
return nullptr;
|
||||
}
|
||||
@ -163,7 +163,7 @@ bool exml::internal::Element::iGenerate(std::string& _data, int32_t _indent) con
|
||||
if( m_listSub.size() == 1
|
||||
&& m_listSub[0] != nullptr
|
||||
&& m_listSub[0]->getType() == exml::nodeType::text
|
||||
&& std::dynamic_pointer_cast<exml::internal::Text>(m_listSub[0])->countLines() == 1) {
|
||||
&& ememory::dynamicPointerCast<exml::internal::Text>(m_listSub[0])->countLines() == 1) {
|
||||
_data += ">";
|
||||
m_listSub[0]->iGenerate(_data,0);
|
||||
EXML_VERBOSE(" generate : '" << _data << "'");
|
||||
|
@ -72,7 +72,7 @@ namespace exml {
|
||||
* @param[in] _id Id of the element.
|
||||
* @return Pointer on node.
|
||||
*/
|
||||
ememory::SharedPtr<const Node> getNode(int32_t _id) const;
|
||||
const ememory::SharedPtr<Node> getNode(int32_t _id) const;
|
||||
/**
|
||||
* @brief get the element casted in Element (if the node is not an element return NULL).
|
||||
* @param[in] _id Id of the element.
|
||||
@ -84,7 +84,7 @@ namespace exml {
|
||||
* @param[in] _id Id of the element.
|
||||
* @return Pointer on the element or NULL.
|
||||
*/
|
||||
ememory::SharedPtr<const Element> getElement(int32_t _id) const;// TODO : DEPRECATED ... not use anymore ...
|
||||
const ememory::SharedPtr<Element> getElement(int32_t _id) const;// TODO : DEPRECATED ... not use anymore ...
|
||||
/**
|
||||
* @brief get an element with his name (work only with exml::internal::Element)
|
||||
* @param[in] _name Name of the element that is requested
|
||||
@ -96,7 +96,7 @@ namespace exml {
|
||||
* @param[in] _name Name of the element that is requested
|
||||
* @return Pointer on the element or NULL.
|
||||
*/
|
||||
ememory::SharedPtr<const Element> getNamed(const std::string& _name) const;
|
||||
const ememory::SharedPtr<Element> getNamed(const std::string& _name) const;
|
||||
/**
|
||||
* @brief get the internal data of the element (if the element has some sub node thay are converted in xml string == > like this it is not needed to use <![CDATA[...]]>
|
||||
* @return the curent data string. if Only one text node, then we get the parssed data (no & ...) if more than one node, then we transform &,",',<,> in xml normal text...
|
||||
@ -129,8 +129,8 @@ namespace exml {
|
||||
ememory::SharedPtr<exml::internal::Element> toElement() override {
|
||||
return ememory::staticPointerCast<exml::internal::Element>(sharedFromThis());
|
||||
}
|
||||
ememory::SharedPtr<const exml::internal::Element> toElement() const override {
|
||||
return ememory::staticPointerCast<const exml::internal::Element>(sharedFromThis());
|
||||
const ememory::SharedPtr<exml::internal::Element> toElement() const override {
|
||||
return ememory::staticPointerCast<exml::internal::Element>(sharedFromThis());
|
||||
}
|
||||
void clear() override;
|
||||
};
|
||||
|
@ -5,6 +5,12 @@
|
||||
*/
|
||||
|
||||
#include <exml/internal/Node.h>
|
||||
#include <exml/internal/Document.h>
|
||||
#include <exml/internal/Attribute.h>
|
||||
#include <exml/internal/Comment.h>
|
||||
#include <exml/internal/Declaration.h>
|
||||
#include <exml/internal/Element.h>
|
||||
#include <exml/internal/Text.h>
|
||||
#include <exml/debug.h>
|
||||
|
||||
static bool isWhiteChar(char32_t _val) {
|
||||
@ -131,7 +137,7 @@ ememory::SharedPtr<exml::internal::Document> exml::internal::Node::toDocument()
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ememory::SharedPtr<const exml::internal::Document> exml::internal::Node::toDocument() const {
|
||||
const ememory::SharedPtr<exml::internal::Document> exml::internal::Node::toDocument() const {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -139,7 +145,7 @@ ememory::SharedPtr<exml::internal::Attribute> exml::internal::Node::toAttribute(
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ememory::SharedPtr<const exml::internal::Attribute> exml::internal::Node::toAttribute() const {
|
||||
const ememory::SharedPtr<exml::internal::Attribute> exml::internal::Node::toAttribute() const {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -147,7 +153,7 @@ ememory::SharedPtr<exml::internal::Comment> exml::internal::Node::toComment() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ememory::SharedPtr<const exml::internal::Comment> exml::internal::Node::toComment() const {
|
||||
const ememory::SharedPtr<exml::internal::Comment> exml::internal::Node::toComment() const {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -155,7 +161,7 @@ ememory::SharedPtr<exml::internal::Declaration> exml::internal::Node::toDeclarat
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ememory::SharedPtr<const exml::internal::Declaration> exml::internal::Node::toDeclaration() const {
|
||||
const ememory::SharedPtr<exml::internal::Declaration> exml::internal::Node::toDeclaration() const {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -163,7 +169,7 @@ ememory::SharedPtr<exml::internal::Element> exml::internal::Node::toElement() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ememory::SharedPtr<const exml::internal::Element> exml::internal::Node::toElement() const {
|
||||
const ememory::SharedPtr<exml::internal::Element> exml::internal::Node::toElement() const {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -171,7 +177,7 @@ ememory::SharedPtr<exml::internal::Text> exml::internal::Node::toText() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ememory::SharedPtr<const exml::internal::Text> exml::internal::Node::toText() const{
|
||||
const ememory::SharedPtr<exml::internal::Text> exml::internal::Node::toText() const{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -143,7 +143,7 @@ namespace exml {
|
||||
* @brief Cast the element in a Document if it is possible.
|
||||
* @return CONST pointer on the class or nullptr.
|
||||
*/
|
||||
virtual ememory::SharedPtr<const exml::internal::Document> toDocument() const;
|
||||
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.
|
||||
@ -153,7 +153,7 @@ namespace exml {
|
||||
* @brief Cast the element in a Attribute if it is possible.
|
||||
* @return CONST pointer on the class or nullptr.
|
||||
*/
|
||||
virtual ememory::SharedPtr<const exml::internal::Attribute> toAttribute() const;
|
||||
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.
|
||||
@ -163,7 +163,7 @@ namespace exml {
|
||||
* @brief Cast the element in a Comment if it is possible.
|
||||
* @return CONST pointer on the class or nullptr.
|
||||
*/
|
||||
virtual ememory::SharedPtr<const exml::internal::Comment> toComment() const;
|
||||
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.
|
||||
@ -173,7 +173,7 @@ namespace exml {
|
||||
* @brief Cast the element in a Declaration if it is possible.
|
||||
* @return CONST pointer on the class or nullptr.
|
||||
*/
|
||||
virtual ememory::SharedPtr<const exml::internal::Declaration> toDeclaration() const;
|
||||
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.
|
||||
@ -183,7 +183,7 @@ namespace exml {
|
||||
* @brief Cast the element in a Element if it is possible.
|
||||
* @return CONST pointer on the class or nullptr.
|
||||
*/
|
||||
virtual ememory::SharedPtr<const exml::internal::Element> toElement() const;
|
||||
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.
|
||||
@ -193,7 +193,7 @@ namespace exml {
|
||||
* @brief Cast the element in a Text if it is possible.
|
||||
* @return CONST pointer on the class or nullptr.
|
||||
*/
|
||||
virtual ememory::SharedPtr<const exml::internal::Text> toText() const;
|
||||
virtual const ememory::SharedPtr<exml::internal::Text> toText() const;
|
||||
|
||||
/**
|
||||
* @brief check if the node is a exml::internal::Document
|
||||
|
@ -49,8 +49,8 @@ namespace exml {
|
||||
ememory::SharedPtr<exml::internal::Text> toText() override {
|
||||
return ememory::staticPointerCast<exml::internal::Text>(sharedFromThis());
|
||||
};
|
||||
ememory::SharedPtr<const exml::internal::Text> toText() const override {
|
||||
return ememory::staticPointerCast<const exml::internal::Text>(sharedFromThis());
|
||||
const ememory::SharedPtr<exml::internal::Text> toText() const override {
|
||||
return ememory::staticPointerCast<exml::internal::Text>(sharedFromThis());
|
||||
};
|
||||
};
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user