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

removed c_str

parent b6c50bec
Loading
Loading
Loading
Loading
+6 −8
Original line number Diff line number Diff line
@@ -195,7 +195,7 @@ libhtmlpp::HtmlString& libhtmlpp::HtmlString::operator<<(const std::string &src)
}

libhtmlpp::HtmlString& libhtmlpp::HtmlString::operator<<(HtmlString src) {
    append(src.c_str());
    append(src._Data.data());
    return *this;
}

@@ -234,10 +234,8 @@ size_t libhtmlpp::HtmlString::size() const{
    return _Data.size();
}

const char * libhtmlpp::HtmlString::c_str(){
    _CStr=_Data;
    _CStr.push_back('\0');
    return _CStr.data();
const std::string libhtmlpp::HtmlString::str(){
    return _Data.data();
}

const std::vector<char>& libhtmlpp::HtmlString::data() {
@@ -571,7 +569,7 @@ void libhtmlpp::HtmlString::_serialelize(std::vector<char> in, libhtmlpp::HtmlEl
void libhtmlpp::HtmlEncode(const std::string &input, std::string &output){
    HtmlString tmp(output);
    HtmlEncode(input,&tmp);
    output=tmp.c_str();
    output=tmp.str();
}

void libhtmlpp::HtmlEncode(const std::string &input, HtmlString* output){
@@ -1262,7 +1260,7 @@ void libhtmlpp::HtmlPage::saveFile(libhtmlpp::HtmlElement &html,const char* path
        throw excp[HTMLException::Critical] << e.what();
    }

    fs << data.c_str();
    fs << data.str();

    fs.close();

@@ -1656,7 +1654,7 @@ void libhtmlpp::HtmlTable::insert(libhtmlpp::HtmlElement* element){
            HtmlString buf;
            Element *element;
            buf << "<td>";
            buf << ccol->Data.c_str();
            buf << ccol->Data.str();
            buf << "</td>";
            element=buf.parse();
            hrow.appendChild(element);
+3 −3
Original line number Diff line number Diff line
@@ -253,8 +253,9 @@ namespace libhtmlpp {
        size_t                    size() const;
        void                      clear();
        bool                      empty();
        const char *              c_str();

        const std::vector<char>&  data();
        const std::string                  str();

        libhtmlpp::Element *parse();
        bool                validate(std::string *err);
@@ -264,7 +265,6 @@ namespace libhtmlpp {
        Element             *_buildTree();
        void                 _buildtreenode(const DocElements *firstel,const DocElements *lastel);
        std::vector<char>    _Data;
        std::vector<char>    _CStr;
        std::stack<Element*> _Childs;
        friend void HtmlEncode(const std::string &input,HtmlString *output);
        friend class HtmlPage;
+2 −2
Original line number Diff line number Diff line
@@ -48,7 +48,7 @@ public:
    void printModify(){
        libhtmlpp::HtmlString html;
        libhtmlpp::print(&index2,html,true);
        std::cout << html.c_str() << std::endl;
        std::cout << html.str() << std::endl;
    }

    ~HtmlCopy(){
@@ -72,7 +72,7 @@ int main(int arc,char *argv[]){

        std::cout << "Orginal html:" << std::endl;
        libhtmlpp::print(&index,html,true);
        std::cout << html.c_str() << std::endl;
        std::cout << html.str() << std::endl;

        std::cout << "Modified html:" << std::endl;

+1 −1
Original line number Diff line number Diff line
@@ -41,7 +41,7 @@ int main(int arc,char *argv[]){
        page.loadFile(index,argv[1]);
        libhtmlpp::HtmlString html;
        libhtmlpp::print(&index,html,true);
        std::cout << html.c_str() << std::endl;
        std::cout << html.str() << std::endl;
        std::cout << Green << "Test Passed!" << NOCOLOR << std::endl;
    }catch(libhtmlpp::HTMLException &exp){
        std::cout << exp.what() << std::endl;