Commit 1bba27cc authored by jan.koester's avatar jan.koester
Browse files

now works with pointern

parent b6863a5e
Loading
Loading
Loading
Loading
+24 −0
Changes for src/html.cpp: 24 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -502,10 +502,20 @@ void libhtmlpp::HtmlElement::appendChild(libhtmlpp::Element* el){
}

libhtmlpp::HtmlElement & libhtmlpp::HtmlElement::operator=(const libhtmlpp::Element& hel){
    delete _firstAttr;
    delete _childElement;
    delete _nextElement;
    _copy(nullptr,this,&hel);
    return *this;
}

libhtmlpp::HtmlElement & libhtmlpp::HtmlElement::operator=(const libhtmlpp::Element* hel){
    delete _firstAttr;
    delete _childElement;
    delete _nextElement;
    _copy(nullptr,this,hel);
    return *this;
}

namespace libhtmlpp {
    void _copy(const libhtmlpp::Element* prev,libhtmlpp::Element *dest,const libhtmlpp::Element *src){
@@ -585,10 +595,17 @@ void libhtmlpp::Element::insertAfter(libhtmlpp::Element* el){
}

libhtmlpp::Element& libhtmlpp::Element::operator=(const Element &hel){
    delete _nextElement;
    _copy(nullptr,this,&hel);
    return *this;
}

libhtmlpp::Element& libhtmlpp::Element::operator=(const Element *hel){
    delete _nextElement;
    _copy(nullptr,this,hel);
    return *this;
}

libhtmlpp::Element *libhtmlpp::Element::nextElement() const{
    return _nextElement;
}
@@ -628,10 +645,17 @@ libhtmlpp::TextElement::~TextElement(){
}

libhtmlpp::TextElement & libhtmlpp::TextElement::operator=(const libhtmlpp::Element& hel){
    delete _nextElement;
    _copy(nullptr,this,&hel);
    return *this;
}

libhtmlpp::TextElement & libhtmlpp::TextElement::operator=(const libhtmlpp::Element* hel){
    delete _nextElement;
    _copy(nullptr,this,hel);
    return *this;
}

void libhtmlpp::TextElement::setText(const char* txt){
    _Text=txt;
}
+3 −0
Changes for src/html.h: 3 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -53,6 +53,7 @@ namespace libhtmlpp {
        void insertBefore(Element* el);

        Element& operator=(const Element &hel);
        Element& operator=(const Element *hel);

        Element*       nextElement() const;
        Element*       prevElement() const;
@@ -78,6 +79,7 @@ namespace libhtmlpp {
        ~HtmlElement();

        HtmlElement& operator=(const Element &hel);
        HtmlElement& operator=(const Element *hel);

        void         setAttribute(const char* name, const char* value);
        void         setIntAttribute(const char* name, int value);
@@ -126,6 +128,7 @@ namespace libhtmlpp {
        ~TextElement();

        TextElement& operator=(const Element &hel);
        TextElement& operator=(const Element *hel);

        const char *getText();
        void        setText(const char *txt);