Commit 22dba756 authored by jan.koester's avatar jan.koester
Browse files

comment no more elemnts

parent 1f5b67bb
Loading
Loading
Loading
Loading
+10 −9
Changes for src/html.cpp: 10 added lines, 9 removed lines.
Original line number Diff line number Diff line
@@ -264,9 +264,6 @@ void libhtmlpp::HtmlString::_serialelize(sys::array<char> in, HtmlElement **out)
        }else if (i == (in.length()-1)){
            *out = new HtmlElement(in.substr(s, i-s).c_str());
            break;
        }else if (in.substr(i,(i+3)-i) == "!--") {
            (*out) = new HtmlComment(in.substr(in.length() - 1).c_str());
            return;
        }
    }

@@ -332,10 +329,14 @@ void libhtmlpp::HtmlString::_parseTree(){
    for (size_t i = 0; i < _Data.size(); ++i) {
        switch (_Data[i]) {
        case HTMLTAG_OPEN:
            if (_Data.substr(i, 4) != "<!--") {
                ++opentag;
            }
            break;
        case HTMLTAG_CLOSE:
            if (_Data.substr(i - 2, 3) != "-->") {
                ++closetag;
            }
            break;
        default:
            break;
@@ -363,13 +364,16 @@ void libhtmlpp::HtmlString::_parseTree(){
    for(size_t ii=0; ii<_Data.size(); ++ii){
        switch(_Data[ii]){
            case HTMLTAG_OPEN:
                if (_Data.substr(ii, 4) != "<!--") {
                    open = true;
                    _HTable[ip][0] = ii;
                }
                break;
            case HTMLTAG_TERMINATE:
                _HTable[ip][1]=ii;
                break;
            case HTMLTAG_CLOSE:
                if (_Data.substr(ii - 2, 3) != "-->") {
                    if (!open) {
                        excp[HTMLException::Error] << "HtmlString: parseTree parse Error couldn't fid opentag";
                        throw excp;
@@ -377,6 +381,7 @@ void libhtmlpp::HtmlString::_parseTree(){
                    _HTable[ip][2] = ii;
                    ++ip;
                    open = false;
                }
                break;
            default:
                break;
@@ -513,18 +518,14 @@ libhtmlpp::HtmlElement::HtmlAttributes::~HtmlAttributes() {
    delete _nextAttr;
}

libhtmlpp::HtmlComment::HtmlComment(const char* comment) : HtmlElement("!--") {
libhtmlpp::HtmlText::HtmlText() {

}

libhtmlpp::HtmlComment::~HtmlComment() {
libhtmlpp::HtmlText::~HtmlText() {

}

const char* libhtmlpp::HtmlComment::printHtmlElement() {
    return _Cstr.c_str();
};

libhtmlpp::HtmlTable::HtmlTable() : HtmlElement("table") {
}

+8 −6
Changes for src/html.h: 8 added lines, 6 removed lines.
Original line number Diff line number Diff line
@@ -127,14 +127,16 @@ namespace libhtmlpp {
        HtmlElement         *_RootNode;
    };

    class HtmlComment : public HtmlElement {
    class HtmlText{
    public:
        HtmlComment(const char *comment);
        ~HtmlComment();
        const char* printHtmlElement();
        HtmlText();
        ~HtmlText();
        void insertTextBefore();
        void insertTextAfter();
    private:
        sys::array<char> _Cstr;
        sys::array<char> _Comment;
        sys::array<char>  _Text;
        bool              _Before;
        HtmlElement      *_Element;
    };

    class HtmlDivLayer : public HtmlElement {