Loading src/html.cpp +14 −18 Original line number Diff line number Diff line Loading @@ -86,10 +86,6 @@ namespace libhtmlpp { nextel = nullptr; prevel = nullptr; element = nullptr; delete nextel; delete element; delete prevel; } }; }; Loading Loading @@ -185,6 +181,7 @@ libhtmlpp::HtmlString& libhtmlpp::HtmlString::operator<<(const std::string &src) } libhtmlpp::HtmlString& libhtmlpp::HtmlString::operator<<(HtmlString src) { if(src._Data.data()) append(src._Data.data()); return *this; } Loading @@ -198,7 +195,7 @@ libhtmlpp::HtmlString& libhtmlpp::HtmlString::operator<<(int src) { libhtmlpp::HtmlString& libhtmlpp::HtmlString::operator<<(unsigned int src) { char buf[255]; snprintf(buf, 255, "%ul", src); snprintf(buf, 255, "%u", src); append(buf); return *this; } Loading Loading @@ -515,7 +512,6 @@ BUILDTREE_STARTLOOP: ft->element->_nextElement=nullptr; delete ft->element; } delete ft; ft=next; } Loading Loading @@ -596,7 +592,7 @@ GETTAGEND: std::copy(in.begin()+kstart,in.begin()+kend,std::back_inserter(key)); if(vend-vstart>0){ if(vend!=std::string::npos && vstart!=std::string::npos){ std::copy(in.begin()+vstart,in.begin()+vend,std::back_inserter(val)); } Loading Loading @@ -1288,7 +1284,7 @@ int libhtmlpp::ScriptElement::getType() const{ libhtmlpp::SvgElement::SvgElement() : HtmlElement("svg"){ } libhtmlpp::SvgElement::SvgElement(const SvgElement &svgsrc) : HtmlElement("script"){ libhtmlpp::SvgElement::SvgElement(const SvgElement &svgsrc) : HtmlElement("svg"){ _copy(this,&svgsrc); } Loading Loading @@ -1754,6 +1750,7 @@ void libhtmlpp::HtmlElement::setAttribute(const std::string &name, const std::st for (Attributes* curattr = _firstAttr; curattr; curattr=curattr->_nextAttr) { if ( std::equal(name.begin(),name.end(),curattr->_Key.begin()) ) { cattr = curattr; cattr->_Value.clear(); } } if (!cattr) { Loading @@ -1765,11 +1762,9 @@ void libhtmlpp::HtmlElement::setAttribute(const std::string &name, const std::st _lastAttr = _firstAttr; } cattr = _lastAttr; cattr->_Key.resize(name.length()); std::copy(name.begin(),name.end(),cattr->_Key.begin() ); std::copy(name.begin(),name.end(),std::back_inserter(cattr->_Key) ); } cattr->_Value.resize(value.length()); std::copy(value.begin(),value.end(),cattr->_Value.begin()); std::copy(value.begin(),value.end(),std::back_inserter(cattr->_Value)); } void libhtmlpp::HtmlElement::setIntAttribute(const std::string& name, int value) { Loading @@ -1785,14 +1780,15 @@ const std::string libhtmlpp::HtmlElement::getAtributte(const std::string& name) continue; } if (!curattr->_Key.empty() && std::equal(name.begin(), name.end(), curattr->_Key.begin())) { if (std::equal(name.begin(), name.end(), curattr->_Key.begin())) { return std::string(curattr->_Value.begin(), curattr->_Value.end()); } } return ""; } int libhtmlpp::HtmlElement::getIntAtributte(const std::string& name) { int libhtmlpp::HtmlElement::getIntAtributte(const std::string& name) const { return atoi(getAtributte(name).c_str()); } Loading Loading @@ -1889,10 +1885,10 @@ void libhtmlpp::HtmlTable::deleteRow(size_t pos){ try{ Row *prev=&(*this)[pos-1]; prev->_nextRow=drow->_nextRow; }catch(...){} drow->_nextRow=nullptr; --_count; delete drow; }catch(...){} } libhtmlpp::HtmlTable::Column::Column(){ Loading src/html.h +1 −1 Original line number Diff line number Diff line Loading @@ -101,7 +101,7 @@ namespace libhtmlpp { const std::string getAtributte(const std::string &name) const; int getIntAtributte(const std::string &name); int getIntAtributte(const std::string &name) const; void insertChild(const Element* el); void insertChild(const Element& el); Loading Loading
src/html.cpp +14 −18 Original line number Diff line number Diff line Loading @@ -86,10 +86,6 @@ namespace libhtmlpp { nextel = nullptr; prevel = nullptr; element = nullptr; delete nextel; delete element; delete prevel; } }; }; Loading Loading @@ -185,6 +181,7 @@ libhtmlpp::HtmlString& libhtmlpp::HtmlString::operator<<(const std::string &src) } libhtmlpp::HtmlString& libhtmlpp::HtmlString::operator<<(HtmlString src) { if(src._Data.data()) append(src._Data.data()); return *this; } Loading @@ -198,7 +195,7 @@ libhtmlpp::HtmlString& libhtmlpp::HtmlString::operator<<(int src) { libhtmlpp::HtmlString& libhtmlpp::HtmlString::operator<<(unsigned int src) { char buf[255]; snprintf(buf, 255, "%ul", src); snprintf(buf, 255, "%u", src); append(buf); return *this; } Loading Loading @@ -515,7 +512,6 @@ BUILDTREE_STARTLOOP: ft->element->_nextElement=nullptr; delete ft->element; } delete ft; ft=next; } Loading Loading @@ -596,7 +592,7 @@ GETTAGEND: std::copy(in.begin()+kstart,in.begin()+kend,std::back_inserter(key)); if(vend-vstart>0){ if(vend!=std::string::npos && vstart!=std::string::npos){ std::copy(in.begin()+vstart,in.begin()+vend,std::back_inserter(val)); } Loading Loading @@ -1288,7 +1284,7 @@ int libhtmlpp::ScriptElement::getType() const{ libhtmlpp::SvgElement::SvgElement() : HtmlElement("svg"){ } libhtmlpp::SvgElement::SvgElement(const SvgElement &svgsrc) : HtmlElement("script"){ libhtmlpp::SvgElement::SvgElement(const SvgElement &svgsrc) : HtmlElement("svg"){ _copy(this,&svgsrc); } Loading Loading @@ -1754,6 +1750,7 @@ void libhtmlpp::HtmlElement::setAttribute(const std::string &name, const std::st for (Attributes* curattr = _firstAttr; curattr; curattr=curattr->_nextAttr) { if ( std::equal(name.begin(),name.end(),curattr->_Key.begin()) ) { cattr = curattr; cattr->_Value.clear(); } } if (!cattr) { Loading @@ -1765,11 +1762,9 @@ void libhtmlpp::HtmlElement::setAttribute(const std::string &name, const std::st _lastAttr = _firstAttr; } cattr = _lastAttr; cattr->_Key.resize(name.length()); std::copy(name.begin(),name.end(),cattr->_Key.begin() ); std::copy(name.begin(),name.end(),std::back_inserter(cattr->_Key) ); } cattr->_Value.resize(value.length()); std::copy(value.begin(),value.end(),cattr->_Value.begin()); std::copy(value.begin(),value.end(),std::back_inserter(cattr->_Value)); } void libhtmlpp::HtmlElement::setIntAttribute(const std::string& name, int value) { Loading @@ -1785,14 +1780,15 @@ const std::string libhtmlpp::HtmlElement::getAtributte(const std::string& name) continue; } if (!curattr->_Key.empty() && std::equal(name.begin(), name.end(), curattr->_Key.begin())) { if (std::equal(name.begin(), name.end(), curattr->_Key.begin())) { return std::string(curattr->_Value.begin(), curattr->_Value.end()); } } return ""; } int libhtmlpp::HtmlElement::getIntAtributte(const std::string& name) { int libhtmlpp::HtmlElement::getIntAtributte(const std::string& name) const { return atoi(getAtributte(name).c_str()); } Loading Loading @@ -1889,10 +1885,10 @@ void libhtmlpp::HtmlTable::deleteRow(size_t pos){ try{ Row *prev=&(*this)[pos-1]; prev->_nextRow=drow->_nextRow; }catch(...){} drow->_nextRow=nullptr; --_count; delete drow; }catch(...){} } libhtmlpp::HtmlTable::Column::Column(){ Loading
src/html.h +1 −1 Original line number Diff line number Diff line Loading @@ -101,7 +101,7 @@ namespace libhtmlpp { const std::string getAtributte(const std::string &name) const; int getIntAtributte(const std::string &name); int getIntAtributte(const std::string &name) const; void insertChild(const Element* el); void insertChild(const Element& el); Loading