Commit a2ad46e9 authored by jan.koester's avatar jan.koester
Browse files

some fixes

parent 32df2eaf
Loading
Loading
Loading
Loading
+6 −4
Changes for src/exception.cpp: 6 added lines, 4 removed lines.
Original line number Diff line number Diff line
@@ -37,6 +37,8 @@ libhtmlpp::HTMLException::HTMLException() {
};

libhtmlpp::HTMLException::HTMLException(const HTMLException &exp){
    msg=exp.msg;
    curCType = exp.curCType;
}

libhtmlpp::HTMLException::~HTMLException(){
@@ -50,8 +52,8 @@ const char* libhtmlpp::HTMLException::what(){
    return msg.c_str();
}

libhtmlpp::HTMLException& libhtmlpp::HTMLException::asign(const char *src){
    msg.assign(src);
libhtmlpp::HTMLException& libhtmlpp::HTMLException::append(const char *src){
    msg.append(src);
    return *this;   
}

@@ -61,12 +63,12 @@ libhtmlpp::HTMLException& libhtmlpp::HTMLException::operator[](int errtype){
}

libhtmlpp::HTMLException& libhtmlpp::HTMLException::operator<<(const char *src){
    return asign(src);
    return append(src);
};

libhtmlpp::HTMLException& libhtmlpp::HTMLException::operator<<(int src){
    char buffer[255];
    snprintf(buffer,255,"%d",src);
    msg.assign(buffer);
    msg.append(buffer);
    return *this;
}
+1 −1
Changes for src/exception.h: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -57,7 +57,7 @@ namespace libhtmlpp {
        
        enum Type {Note,Warning,Error,Critical};
        
        HTMLException& asign(const char *src);
        HTMLException& append(const char *src);
        HTMLException& operator[](int errtype);
        HTMLException& operator<<(const char *src);
        HTMLException& operator<<(int src);
+7 −4
Changes for src/html.cpp: 7 added lines, 4 removed lines.
Original line number Diff line number Diff line
@@ -182,7 +182,7 @@ libhtmlpp::HtmlElement* libhtmlpp::HtmlString::parse() {
    _RootNode = _buildTree(pos);
    return _RootNode;
}
#include <iostream>

libhtmlpp::HtmlElement* libhtmlpp::HtmlString::_buildTree(ssize_t& pos) {
    DocElements *firstEl = nullptr, *lastEl = nullptr;

@@ -253,7 +253,8 @@ libhtmlpp::HtmlElement* libhtmlpp::HtmlString::_buildTree(ssize_t& pos) {
                    DocElements* endcurel = nullptr;

                    while (endcurel) {
                        if (!curel->terminator) {
                        if (!curel->terminator &&
                            curel->data.substr(1,curel->data.length()-1) == parent->data) {
                            endcurel = curel;
                        }
                        curel = curel->nextel;
@@ -261,6 +262,8 @@ libhtmlpp::HtmlElement* libhtmlpp::HtmlString::_buildTree(ssize_t& pos) {

                    if (endcurel)
                        parent->elhtml->_nextElement = endcurel->elhtml;
                    else if(curel->nextel)
                        parent->elhtml->_nextElement = curel->nextel->elhtml;
                    break;
                }
		    }
@@ -288,14 +291,14 @@ libhtmlpp::HtmlElement* libhtmlpp::HtmlString::_buildTreeElement(libhtmlpp::DocE
void libhtmlpp::HtmlString::_serialelize(std::string in, libhtmlpp::HtmlElement **out) {
    size_t i,s=0;

    for (i = 0; i < in.length(); ++i) {
    for (i = 0; i <= in.length(); ++i) {
        if(in[i] == '/'){
            ++s;
            continue;
        }else if (in[i] == ' ') {
            *out = new HtmlElement(in.substr(s, i-s).c_str());
            break;
        }else if (i == (in.length()-1)){
        }else if (i == in.length()){
            *out = new HtmlElement(in.substr(s, i-s).c_str());
            break;
        }
+3 −3

File changed.

Contains only whitespace changes.