Commit 3901a88f authored by Jan Koester's avatar Jan Koester
Browse files

changes for new systempp

parent 5a2deb84
Loading
Loading
Loading
Loading
+1 −2
Changes for CMakeLists.txt: 1 added line, 2 removed lines.
Original line number Diff line number Diff line
@@ -13,8 +13,7 @@ set(CMAKE_CXX_FLAGS
    "-fPIC\
    ${CMAKE_CXX_FLAGS} \
    -Wall\
    -nostdlib \
    -nodefaultlibs"
    -nostdlib"
)

configure_file(config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h)
+2 −2
Changes for src/CMakeLists.txt: 2 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -19,8 +19,8 @@ add_library(htmlpp-static STATIC ${libhtmlSrcs} )
generate_export_header(htmlpp)


target_link_libraries(htmlpp systempp)
target_link_libraries(htmlpp-static systempp)    
target_link_libraries(htmlpp ${systempp_LIBRARIES})
target_link_libraries(htmlpp-static ${systempp_LIBRARIES})


SET(CMAKE_INSTALL_LIBDIR lib CACHE PATH "Output directory for libraries")
+4 −3
Changes for src/exception.cpp: 4 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -25,7 +25,8 @@
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *******************************************************************************/

#include <stddef.h>
#include <stdlib.h>
#include <string.h>

#include "utils.h"
#include "exception.h"
@@ -99,7 +100,7 @@ libhtmlpp::HTMLException& libhtmlpp::HTMLException::asign(const char *src){
        _lastMessage=_lastMessage->_nextMessage;
    }
    _lastMessage->_CType=_curCType;
    _lastMessage->_BufferSize=sys::getlen(src);
    _lastMessage->_BufferSize=strlen(src);
    _lastMessage->_Buffer=new char[_lastMessage->_BufferSize+1];
    sys::scopy(src,src+_lastMessage->_BufferSize+1,_lastMessage->_Buffer);
    return *this;
@@ -116,7 +117,7 @@ libhtmlpp::HTMLException& libhtmlpp::HTMLException::operator<<(const char *src){

libhtmlpp::HTMLException& libhtmlpp::HTMLException::operator<<(int src){
    char *buf=new char[sizeof(int)+1];
    sys::itoa(src,buf);
    itoa(src,buf);
    asign(buf);
    delete[] buf;
    return *this;
+17 −14
Changes for src/html.cpp: 17 added lines, 14 removed lines.
Original line number Diff line number Diff line
@@ -25,6 +25,9 @@ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*******************************************************************************/

#include <stdio.h>
#include <stdlib.h>

#include <systempp/sysconsole.h>
#include <systempp/sysfile.h>
#include <systempp/sysutils.h>
@@ -50,8 +53,8 @@ libhtmlpp::HtmlString::HtmlString(){

libhtmlpp::HtmlString::HtmlString(char *header){
    _InitString();
    _HtmlHeader=new char[sys::getlen(header)+1];
    sys::scopy(header,header+sys::getlen(header)+1,_HtmlHeader);
    _HtmlHeader=new char[strlen(header)+1];
    sys::scopy(header,header+strlen(header)+1,_HtmlHeader);
}

libhtmlpp::HtmlString::~HtmlString(){
@@ -68,7 +71,7 @@ void libhtmlpp::HtmlString::push_back(const char src){
}

void libhtmlpp::HtmlString::assign(const char* src) {
    assign(src,sys::getlen(src));
    assign(src,strlen(src));
}

void libhtmlpp::HtmlString::insert(size_t pos, char src){
@@ -114,7 +117,7 @@ libhtmlpp::HtmlString &libhtmlpp::HtmlString::operator<<(const char* src){

libhtmlpp::HtmlString &libhtmlpp::HtmlString::operator<<(int src){
    char *buf=new char[sizeof(int)+1];
    sys::itoa(src,buf);
    itoa(src,buf);
    assign(buf);
    delete[] buf;
    return *this;
@@ -122,7 +125,7 @@ libhtmlpp::HtmlString &libhtmlpp::HtmlString::operator<<(int src){

libhtmlpp::HtmlString &libhtmlpp::HtmlString::operator<<(unsigned int src){
    char *buf=new char[sizeof(int)+1];
    sys::ultoa(src,buf);
    ultoa(src,buf);
    assign(buf);
    delete[] buf;
    return *this;
@@ -130,7 +133,7 @@ libhtmlpp::HtmlString &libhtmlpp::HtmlString::operator<<(unsigned int src){

libhtmlpp::HtmlString &libhtmlpp::HtmlString::operator<<(unsigned long src){
    char *buf=new char[sizeof(int)+1];
    sys::ultoa(src,buf);
    ultoa(src,buf);
    assign(buf);
    delete[] buf;
    return *this;
@@ -260,12 +263,12 @@ libhtmlpp::HtmlElement *libhtmlpp::HtmlString::_buildTree(HtmlElement *node,Html
        int ret=_serialzeTags(_HTable[pos][0],_HTable[pos][2],&tag,tagsize);
        if(node){
            if(ret==HTMLELEMENT){
                if(sys::ncompare(node->_Tag,sys::getlen(node->_Tag),
                if(sys::ncompare(node->_Tag,strlen(node->_Tag),
                                         tag,tagsize)==0){
                    node->_nextElement=parent;
                }
            }else if(ret==HTMLTERMELEMENT){
                if(!node->_Child && sys::ncompare(node->_Tag,sys::getlen(node->_Tag),
                if(!node->_Child && sys::ncompare(node->_Tag,strlen(node->_Tag),
                                                          tag,tagsize)==0){
                    parent=node->_nextElement;
                    node->_nextElement=nullptr;
@@ -431,9 +434,9 @@ const char *libhtmlpp::HtmlPage::printHtml(){
void libhtmlpp::HtmlPage::loadFile(const char* path){
    delete _HtmlDocument;
    _HtmlDocument= new HtmlString();
    sys::file fs;
//    sys::file fs;
    try{
        fs.open(path,0);
//        fs.open(path,0);
    }catch(sys::SystemException &e){
        HTMLException excp;
        throw excp[HTMLException::Critical] << e.what();
@@ -456,7 +459,7 @@ void libhtmlpp::HtmlPage::loadFile(const char* path){

void libhtmlpp::HtmlElement::setID(const char *id){
    HTMLException excp;
    if(!setter(id,sys::getlen(id),&_ID)){
    if(!setter(id,strlen(id),&_ID)){
        excp[HTMLException::Error] << "HtmlElement can't id: " << id;
        throw excp;        
    }
@@ -464,7 +467,7 @@ void libhtmlpp::HtmlElement::setID(const char *id){

void libhtmlpp::HtmlElement::setClass(const char *cname){
    HTMLException excp;
    if(!setter(cname,sys::getlen(cname),&_Class)){
    if(!setter(cname,strlen(cname),&_Class)){
        excp[HTMLException::Error] << "HtmlElement can't class name: " << cname;
        throw excp;          
    }
@@ -472,7 +475,7 @@ void libhtmlpp::HtmlElement::setClass(const char *cname){

void libhtmlpp::HtmlElement::setStyle(const char *css){
    HTMLException excp;
    if(!setter(css,sys::getlen(css),&_Style,":;(),+~'")){
    if(!setter(css,strlen(css),&_Style,":;(),+~'")){
        excp[HTMLException::Error] << "HtmlElement can't set Style: " << css;
        throw excp;          
    }
@@ -480,7 +483,7 @@ void libhtmlpp::HtmlElement::setStyle(const char *css){

void libhtmlpp::HtmlElement::setComment(const char* comment){
    HTMLException excp;
    if(!setter(comment,sys::getlen(comment),&_Style,":;(),+~'")){
    if(!setter(comment,strlen(comment),&_Style,":;(),+~'")){
        excp[HTMLException::Error] << "HtmlElement can't set Comment: " << comment;
        throw excp;          
    }    
+2 −2
Changes for src/html.h: 2 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -25,9 +25,9 @@ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*******************************************************************************/

#include <systempp/sysarray.h>
#include <type.h>

#include <sys/types.h>
#include <systempp/sysarray.h>

#pragma once

Loading