Loading src/html.cpp +50 −25 Changes for src/html.cpp: 50 added lines, 25 removed lines. Original line number Diff line number Diff line Loading @@ -141,6 +141,10 @@ libhtmlpp::HtmlString &libhtmlpp::HtmlString::operator<<(char src){ } const char *libhtmlpp::HtmlString::c_str() { _Cstr.clear(); for (HtmlElement* curel = _HtmlRootNode; curel; curel=curel->_nextElement) { _Cstr.append(curel->_TagName.c_str()); } return _Data.c_str(); } Loading @@ -155,31 +159,44 @@ void libhtmlpp::HtmlString::parse(){ _HtmlHeader.clear(); delete _HtmlRootNode; ssize_t pos = 0; HtmlElement *parent=nullptr; _buildTree(_HtmlRootNode,parent,--pos); } libhtmlpp::HtmlElement *libhtmlpp::HtmlString::_buildTree(HtmlElement *node,HtmlElement *parent,ssize_t &pos){ for (int i = 0; i < _HTableSize; ++i) { sys::array<char> el = _Data.substr(_HTable[i][0], (_HTable[i][2] - _HTable[i][0]) + 1); int ii; for (ii = 0; ii < el.length(); ++ii) { switch (el[ii]) { case ' ': goto TAGNAMEEND; case '>': --ii; goto TAGNAMEEND; default: break; } } TAGNAMEEND: sys::array<char> type = el.substr(1,ii); sys::cout << type << sys::endl; } _HtmlRootNode = _buildTree(pos); } libhtmlpp::HtmlElement *libhtmlpp::HtmlString::_buildTree(ssize_t &pos){ // size_t is=0, ie=(_HTableSize - 1); //TAGSTART: // size_t ii = 0; // sys::array<char> el; // for (size_t is = 0; is < (_HTableSize - 1); ++is) { // el = _Data.substr(_HTable[is][0], (_HTable[is][2] - _HTable[is][0]) + 1); // for (ii = 0; ii < el.length(); ++ii) { // switch (el[ii]) { // case ' ': // goto TAGNAMEEND; // case '>': // --ii; // goto TAGNAMEEND; // default: // break; // } // } // } // //TAGNAMEEND: // sys::array<char> type; // // if (el.substr(0,2) == "</") // type = el.substr(2, (ii-1)); // else { // if (ie != is) // goto TAGSTART; // } // // for (ie; ie < 0; --ie) { // // } // // return hel; return nullptr; } Loading Loading @@ -352,6 +369,14 @@ int libhtmlpp::HtmlElement::getIntAtributte(const char* name) { } libhtmlpp::HtmlElement::HtmlAttributes::HtmlAttributes() { _nextAttr = nullptr; } libhtmlpp::HtmlElement::HtmlAttributes::~HtmlAttributes() { delete _nextAttr; } libhtmlpp::HtmlTable::HtmlTable() { } Loading src/html.h +3 −1 Changes for src/html.h: 3 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -56,6 +56,7 @@ namespace libhtmlpp { sys::array<char> _Value; HtmlAttributes *_nextAttr; }; private: sys::array<char> _TagName; HtmlAttributes *_firstAttr; Loading Loading @@ -96,8 +97,9 @@ namespace libhtmlpp { private: void _InitString(); void _parseTree(); HtmlElement *_buildTree(HtmlElement *node,HtmlElement *parent,ssize_t &pos); HtmlElement *_buildTree(ssize_t &pos); sys::array<char> _Data; sys::array<char> _Cstr; ssize_t **_HTable; size_t _HTableSize; sys::array<char> _HtmlHeader; Loading test/csstest.cpp +2 −2 Changes for test/csstest.cpp: 2 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -38,7 +38,7 @@ void *__dso_handle __attribute__((__visibility__("hidden"))) __attribute__((weak int main(){ libhtmlpp::HtmlTable table; try{ table.setStyle(":;(),+~'"); table.setAttribute("Style",":;(),+~'"); sys::cout << Green << "Test Passed!" << NOCOLOR << sys::endl; }catch(...){ sys::cout << Red << "Test not Passed!" << NOCOLOR << sys::endl; Loading @@ -46,7 +46,7 @@ int main(){ } try{ table.setStyle("\""); table.setAttribute("Style", "\""); sys::cout << Red << "Test not Passed!" << NOCOLOR<< sys::endl; return -1; }catch(...){ Loading Loading
src/html.cpp +50 −25 Changes for src/html.cpp: 50 added lines, 25 removed lines. Original line number Diff line number Diff line Loading @@ -141,6 +141,10 @@ libhtmlpp::HtmlString &libhtmlpp::HtmlString::operator<<(char src){ } const char *libhtmlpp::HtmlString::c_str() { _Cstr.clear(); for (HtmlElement* curel = _HtmlRootNode; curel; curel=curel->_nextElement) { _Cstr.append(curel->_TagName.c_str()); } return _Data.c_str(); } Loading @@ -155,31 +159,44 @@ void libhtmlpp::HtmlString::parse(){ _HtmlHeader.clear(); delete _HtmlRootNode; ssize_t pos = 0; HtmlElement *parent=nullptr; _buildTree(_HtmlRootNode,parent,--pos); } libhtmlpp::HtmlElement *libhtmlpp::HtmlString::_buildTree(HtmlElement *node,HtmlElement *parent,ssize_t &pos){ for (int i = 0; i < _HTableSize; ++i) { sys::array<char> el = _Data.substr(_HTable[i][0], (_HTable[i][2] - _HTable[i][0]) + 1); int ii; for (ii = 0; ii < el.length(); ++ii) { switch (el[ii]) { case ' ': goto TAGNAMEEND; case '>': --ii; goto TAGNAMEEND; default: break; } } TAGNAMEEND: sys::array<char> type = el.substr(1,ii); sys::cout << type << sys::endl; } _HtmlRootNode = _buildTree(pos); } libhtmlpp::HtmlElement *libhtmlpp::HtmlString::_buildTree(ssize_t &pos){ // size_t is=0, ie=(_HTableSize - 1); //TAGSTART: // size_t ii = 0; // sys::array<char> el; // for (size_t is = 0; is < (_HTableSize - 1); ++is) { // el = _Data.substr(_HTable[is][0], (_HTable[is][2] - _HTable[is][0]) + 1); // for (ii = 0; ii < el.length(); ++ii) { // switch (el[ii]) { // case ' ': // goto TAGNAMEEND; // case '>': // --ii; // goto TAGNAMEEND; // default: // break; // } // } // } // //TAGNAMEEND: // sys::array<char> type; // // if (el.substr(0,2) == "</") // type = el.substr(2, (ii-1)); // else { // if (ie != is) // goto TAGSTART; // } // // for (ie; ie < 0; --ie) { // // } // // return hel; return nullptr; } Loading Loading @@ -352,6 +369,14 @@ int libhtmlpp::HtmlElement::getIntAtributte(const char* name) { } libhtmlpp::HtmlElement::HtmlAttributes::HtmlAttributes() { _nextAttr = nullptr; } libhtmlpp::HtmlElement::HtmlAttributes::~HtmlAttributes() { delete _nextAttr; } libhtmlpp::HtmlTable::HtmlTable() { } Loading
src/html.h +3 −1 Changes for src/html.h: 3 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -56,6 +56,7 @@ namespace libhtmlpp { sys::array<char> _Value; HtmlAttributes *_nextAttr; }; private: sys::array<char> _TagName; HtmlAttributes *_firstAttr; Loading Loading @@ -96,8 +97,9 @@ namespace libhtmlpp { private: void _InitString(); void _parseTree(); HtmlElement *_buildTree(HtmlElement *node,HtmlElement *parent,ssize_t &pos); HtmlElement *_buildTree(ssize_t &pos); sys::array<char> _Data; sys::array<char> _Cstr; ssize_t **_HTable; size_t _HTableSize; sys::array<char> _HtmlHeader; Loading
test/csstest.cpp +2 −2 Changes for test/csstest.cpp: 2 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -38,7 +38,7 @@ void *__dso_handle __attribute__((__visibility__("hidden"))) __attribute__((weak int main(){ libhtmlpp::HtmlTable table; try{ table.setStyle(":;(),+~'"); table.setAttribute("Style",":;(),+~'"); sys::cout << Green << "Test Passed!" << NOCOLOR << sys::endl; }catch(...){ sys::cout << Red << "Test not Passed!" << NOCOLOR << sys::endl; Loading @@ -46,7 +46,7 @@ int main(){ } try{ table.setStyle("\""); table.setAttribute("Style", "\""); sys::cout << Red << "Test not Passed!" << NOCOLOR<< sys::endl; return -1; }catch(...){ Loading