Loading src/html.cpp +34 −6 Original line number Diff line number Diff line Loading @@ -621,7 +621,13 @@ libhtmlpp::HtmlElement::HtmlElement(const libhtmlpp::HtmlElement* hel) : HtmlEle } libhtmlpp::HtmlElement::~HtmlElement(){ Attributes *cura=_firstAttr; if(_prevElement) _prevElement->_nextElement=_nextElement; _nextElement=nullptr; Element *cur=this; DELETEELEMENT: if(cur->_Type==HtmlEl){ Attributes *cura=((HtmlElement*)cur)->_firstAttr; while(cura){ Attributes *next=cura->_nextAttr; cura->_nextAttr=nullptr; Loading @@ -630,6 +636,28 @@ libhtmlpp::HtmlElement::~HtmlElement(){ } } std::stack<Element*> childs; if(cur->_Type==HtmlEl && ((HtmlElement*)cur)->_childElement){ cur=((HtmlElement*)cur)->_childElement; while(cur){ Element *next=cur->nextElement(); cur->_nextElement=nullptr; cur->_prevElement=nullptr; if(cur->_Type==HtmlEl && ((HtmlElement*)cur)->_childElement){ childs.push(((HtmlElement*)cur)->_childElement); ((HtmlElement*)cur)->_childElement=nullptr; } delete cur; cur=next; } } if(!childs.empty()){ cur=childs.top(); goto DELETEELEMENT; } } void libhtmlpp::HtmlElement::setTagname(const char* name){ std::copy(name,name+strlen(name),std::insert_iterator<std::vector<char>>(_TagName,_TagName.begin()) ); } Loading Loading
src/html.cpp +34 −6 Original line number Diff line number Diff line Loading @@ -621,7 +621,13 @@ libhtmlpp::HtmlElement::HtmlElement(const libhtmlpp::HtmlElement* hel) : HtmlEle } libhtmlpp::HtmlElement::~HtmlElement(){ Attributes *cura=_firstAttr; if(_prevElement) _prevElement->_nextElement=_nextElement; _nextElement=nullptr; Element *cur=this; DELETEELEMENT: if(cur->_Type==HtmlEl){ Attributes *cura=((HtmlElement*)cur)->_firstAttr; while(cura){ Attributes *next=cura->_nextAttr; cura->_nextAttr=nullptr; Loading @@ -630,6 +636,28 @@ libhtmlpp::HtmlElement::~HtmlElement(){ } } std::stack<Element*> childs; if(cur->_Type==HtmlEl && ((HtmlElement*)cur)->_childElement){ cur=((HtmlElement*)cur)->_childElement; while(cur){ Element *next=cur->nextElement(); cur->_nextElement=nullptr; cur->_prevElement=nullptr; if(cur->_Type==HtmlEl && ((HtmlElement*)cur)->_childElement){ childs.push(((HtmlElement*)cur)->_childElement); ((HtmlElement*)cur)->_childElement=nullptr; } delete cur; cur=next; } } if(!childs.empty()){ cur=childs.top(); goto DELETEELEMENT; } } void libhtmlpp::HtmlElement::setTagname(const char* name){ std::copy(name,name+strlen(name),std::insert_iterator<std::vector<char>>(_TagName,_TagName.begin()) ); } Loading