From: konrad Date: Sun, 26 Sep 2010 19:01:43 +0000 (+0000) Subject: move the PACK Qt port to a more Qt like include mode X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=45b07ab0d6b193781ace81f295a93baaac73287f;p=web%2Fkonrad%2Fpack.git move the PACK Qt port to a more Qt like include mode git-svn-id: https://silmor.de/svn/softmagic/pack/trunk@591 6e3c4bff-ac9f-4ac1-96c5-d2ea494d3e33 --- diff --git a/qtbase/include/Nullable b/qtbase/include/Nullable new file mode 100644 index 0000000..013b50f --- /dev/null +++ b/qtbase/include/Nullable @@ -0,0 +1 @@ +#include "nullable.h" \ No newline at end of file diff --git a/qtbase/include/WException b/qtbase/include/WException new file mode 100644 index 0000000..37c0fac --- /dev/null +++ b/qtbase/include/WException @@ -0,0 +1 @@ +#include "exception.h" \ No newline at end of file diff --git a/qtbase/include/WHelper b/qtbase/include/WHelper new file mode 100644 index 0000000..fd0b5ec --- /dev/null +++ b/qtbase/include/WHelper @@ -0,0 +1 @@ +#include "helper.h" \ No newline at end of file diff --git a/qtbase/include/WInterface b/qtbase/include/WInterface new file mode 100644 index 0000000..0775374 --- /dev/null +++ b/qtbase/include/WInterface @@ -0,0 +1 @@ +#include "interface.h" \ No newline at end of file diff --git a/qtbase/include/WObject b/qtbase/include/WObject new file mode 100644 index 0000000..d52452b --- /dev/null +++ b/qtbase/include/WObject @@ -0,0 +1 @@ +#include "object.h" \ No newline at end of file diff --git a/qtbase/include/WTransaction b/qtbase/include/WTransaction new file mode 100644 index 0000000..34e3143 --- /dev/null +++ b/qtbase/include/WTransaction @@ -0,0 +1 @@ +#include "transaction.h" \ No newline at end of file diff --git a/qtbase/exception.h b/qtbase/include/exception.h similarity index 100% rename from qtbase/exception.h rename to qtbase/include/exception.h diff --git a/qtbase/WHelper.h b/qtbase/include/helper.h similarity index 100% rename from qtbase/WHelper.h rename to qtbase/include/helper.h diff --git a/qtbase/WInterface.h b/qtbase/include/interface.h similarity index 100% rename from qtbase/WInterface.h rename to qtbase/include/interface.h diff --git a/qtbase/nullable.h b/qtbase/include/nullable.h similarity index 100% rename from qtbase/nullable.h rename to qtbase/include/nullable.h diff --git a/qtbase/WObject.h b/qtbase/include/object.h similarity index 98% rename from qtbase/WObject.h rename to qtbase/include/object.h index 1da59ad..57f24e8 100644 --- a/qtbase/WObject.h +++ b/qtbase/include/object.h @@ -18,7 +18,7 @@ #include "nullable.h" #include "exception.h" -#include "WHelper.h" +#include "WHelper" class QDomElement; class QDomDocument; diff --git a/qtbase/WTransaction.h b/qtbase/include/transaction.h similarity index 99% rename from qtbase/WTransaction.h rename to qtbase/include/transaction.h index da72912..f2a75a2 100644 --- a/qtbase/WTransaction.h +++ b/qtbase/include/transaction.h @@ -18,7 +18,7 @@ #include #include "nullable.h" -#include "WHelper.h" +#include "WHelper" /**base class of all transactions*/ class WTransaction:public WHelper diff --git a/qtbase/WHelper.cpp b/qtbase/src/helper.cpp similarity index 97% rename from qtbase/WHelper.cpp rename to qtbase/src/helper.cpp index cc7441f..06afd48 100644 --- a/qtbase/WHelper.cpp +++ b/qtbase/src/helper.cpp @@ -10,7 +10,7 @@ // // -#include "WHelper.h" +#include "WHelper" #include #include diff --git a/qtbase/WInterface.cpp b/qtbase/src/interface.cpp similarity index 97% rename from qtbase/WInterface.cpp rename to qtbase/src/interface.cpp index aee9cf8..c85e80b 100644 --- a/qtbase/WInterface.cpp +++ b/qtbase/src/interface.cpp @@ -10,7 +10,7 @@ // // -#include "WInterface.h" +#include "WInterface" #include #include diff --git a/qtbase/WObject.cpp b/qtbase/src/object.cpp similarity index 90% rename from qtbase/WObject.cpp rename to qtbase/src/object.cpp index 10a7629..fc8a896 100644 --- a/qtbase/WObject.cpp +++ b/qtbase/src/object.cpp @@ -10,4 +10,4 @@ // // -#include "WObject.h" +#include "WObject" diff --git a/qtbase/WTransaction.cpp b/qtbase/src/transaction.cpp similarity index 99% rename from qtbase/WTransaction.cpp rename to qtbase/src/transaction.cpp index 99cbe0b..50f83f2 100644 --- a/qtbase/WTransaction.cpp +++ b/qtbase/src/transaction.cpp @@ -10,8 +10,8 @@ // // -#include "WTransaction.h" -#include "WInterface.h" +#include "WTransaction" +#include "WInterface" #include #include diff --git a/qtbase/wbase.pro b/qtbase/wbase.pro index dddaeeb..c8c9ac3 100644 --- a/qtbase/wbase.pro +++ b/qtbase/wbase.pro @@ -10,15 +10,17 @@ RCC_DIR = .ctmp HEADERS += \ - nullable.h \ - WHelper.h \ - WObject.h \ - WTransaction.h \ - WInterface.h + include/nullable.h \ + include/helper.h \ + include/object.h \ + include/transaction.h \ + include/interface.h SOURCES += \ - WObject.cpp \ - WHelper.cpp \ - WTransaction.cpp \ - WInterface.cpp + src/object.cpp \ + src/helper.cpp \ + src/transaction.cpp \ + src/interface.cpp +INCLUDEPATH += include src +DEPENDPATH += include src \ No newline at end of file diff --git a/woc/mfile.h b/woc/mfile.h index 07b298d..0e12fb0 100644 --- a/woc/mfile.h +++ b/woc/mfile.h @@ -32,7 +32,7 @@ class MFile:public QFile /**compares the old (if it exists) and new version of the file and overwrites the old one if there are differences*/ virtual void close(); /**opens the file, WriteOnly is assumed as mode*/ - virtual bool open(QIODevice::OpenMode m); + virtual bool open(QIODevice::OpenMode m=QIODevice::WriteOnly); /**returns the name of the file (without ",new")*/ QString fileName()const{return name;} diff --git a/woc/qt/qtclass.cpp b/woc/qt/qtclass.cpp index 7395609..2b71781 100644 --- a/woc/qt/qtclass.cpp +++ b/woc/qt/qtclass.cpp @@ -39,8 +39,8 @@ void WocQtClass::newClass(const WocClass&cls) QString cna=cn; if(cls.isAbstract(m_lang))cna+="Abstract"; addFile(cna); - MFile hdr(m_basedir+"/"+m_subdir+"/"+cna+".h"); - MFile src(m_basedir+"/"+m_subdir+"/"+cna+".cpp"); + MFile hdr(m_basedir+"/"+m_subdir+"/src"+cna+".h"); + MFile src(m_basedir+"/"+m_subdir+"/src"+cna+".cpp"); if(!hdr.open(QIODevice::WriteOnly|QIODevice::Truncate) || !src.open(QIODevice::WriteOnly|QIODevice::Truncate)){ qDebug("Error: cannot create class files for class %s.",cn.toAscii().data()); @@ -54,11 +54,11 @@ void WocQtClass::newClass(const WocClass&cls) QString hcd; QString scd; //includes - hcd="#include \""+cls.clientBaseClass()+".h\"\n#include \n\n"; + hcd="#include \""+cls.clientBaseClass()+"\"\n#include \n\n"; QStringList k=cls.propertyNames(); for(int i=0;i\n" "#include \n"; //end section of all source files diff --git a/woc/qt/qtctrans.cpp b/woc/qt/qtctrans.cpp index 9af83b7..1626525 100644 --- a/woc/qt/qtctrans.cpp +++ b/woc/qt/qtctrans.cpp @@ -32,8 +32,8 @@ void WocQtClientTransaction::newTransaction(const WocTransaction&trn) { QString cn=m_prefix+"T"+trn.name(); addFile(cn); - MFile hdr(m_basedir+"/"+m_subdir+"/"+cn+".h"); - MFile src(m_basedir+"/"+m_subdir+"/"+cn+".cpp"); + MFile hdr(m_basedir+"/"+m_subdir+"/src"+cn+".h"); + MFile src(m_basedir+"/"+m_subdir+"/src"+cn+".cpp"); if(!hdr.open(QIODevice::WriteOnly|QIODevice::Truncate) || !src.open(QIODevice::WriteOnly|QIODevice::Truncate)){ qDebug("Error: cannot create class files for transaction %s.",cn.toAscii().data()); @@ -48,15 +48,15 @@ void WocQtClientTransaction::newTransaction(const WocTransaction&trn) src.write(QByteArray(SRCSTART).replace("%",cn.toAscii())); QString hcd; QString scd; - hcd="#include \""+m_transbase+".h\"\n"; - scd+="#include \"WInterface.h\"\n#include \n"; + hcd="#include \""+m_transbase+"\"\n"; + scd+="#include \"WInterface\"\n#include \n"; for(int i=0;i\n"; + if(tp!="")hcd+="#include <"+tp+">\n"; } for(int i=0;i\n"; + if(tp!="")hcd+="#include <"+tp+">\n"; } hcd+="\nclass "+cn+":public "+m_transbase+"\n{\n"; hdr.write(hcd.toAscii()); diff --git a/woc/qt/qtout.cpp b/woc/qt/qtout.cpp index 0c7de04..ad3dcec 100644 --- a/woc/qt/qtout.cpp +++ b/woc/qt/qtout.cpp @@ -49,21 +49,21 @@ WocQtOut::WocQtOut(QDomElement&el) //create interface class WocProcessor*woc=WocProcessor::instance(); QString pn=woc->projectName(); - m_ifacecpp.setFileName(m_basedir+"/"+m_subdir+"/"+m_prefix+"Interface.cpp"); + m_ifacecpp.setFileName(m_basedir+"/"+m_subdir+"/src"+m_prefix+"Interface.cpp"); if(!m_ifacecpp.open(QIODevice::WriteOnly|QIODevice::Truncate)){ qDebug("Error: cannot create Qt interface file %s.",m_ifacecpp.fileName().toAscii().data()); emit errorFound(); return; } m_ifacecpp.write(QByteArray(SRCSTART).replace('%',m_prefix+"Interface")); - m_iface.setFileName(m_basedir+"/"+m_subdir+"/"+m_prefix+"Interface.h"); + m_iface.setFileName(m_basedir+"/"+m_subdir+"/src"+m_prefix+"Interface.h"); if(!m_iface.open(QIODevice::WriteOnly|QIODevice::Truncate)){ qDebug("Error: cannot create Qt interface file %s.",m_iface.fileName().toAscii().data()); emit errorFound(); return; } m_iface.write(QByteArray(HDRSTART).replace("%",m_prefix.toAscii()+"INTERFACE_H")); - m_iface.write(QByteArray("#include \""+m_prefix.toAscii()+"Include.h\"\n#include \"WInterface.h\"\n")); + m_iface.write(QByteArray("#include \""+m_prefix.toAscii()+"IncludeAll\"\n#include \"WInterface\"\n")); m_iface.write(QByteArray("#include \n")); m_iface.write(QString("class "+m_prefix+"Interface:public WInterface\n{\n Q_OBJECT\n").toAscii()); m_iface.write(QString(" public:\n "+m_prefix+"Interface(QString name=\""+pn+"\"):WInterface(name){}\n").toAscii()); @@ -76,7 +76,7 @@ WocQtOut::WocQtOut(QDomElement&el) m_iface.write(QString(" static QString svnRepositoryUrl(){return \""+woc->svnRepositoryUrl()+"\";}\n\n").toAscii()); //create all includer - m_hdr.setFileName(m_basedir+"/"+m_subdir+"/"+m_prefix+"Include.h"); + m_hdr.setFileName(m_basedir+"/"+m_subdir+"/"+m_prefix+"IncludeAll"); if(!m_hdr.open(QIODevice::WriteOnly|QIODevice::Truncate)){ qDebug("Error: cannot create Qt header file %s.",m_hdr.fileName().toAscii().data()); emit errorFound(); @@ -131,9 +131,13 @@ void WocQtOut::newTransaction(const WocTransaction&trn) void WocQtOut::addFile(QString bn) { - QString code="HEADERS+="+m_subdir+"/"+bn+".h\nSOURCES+="+m_subdir+"/"+bn+".cpp\n"; + QString code="HEADERS+="+m_subdir+"/src"+bn+".h\n"; + code+="SOURCES+="+m_subdir+"/src"+bn+".cpp\n"; m_pri.write(code.toAscii()); - m_hdr.write(QByteArray("#include \"%.h\"\n").replace('%',bn.toAscii())); + m_hdr.write(QByteArray("#include \"%\"\n").replace('%',bn.toAscii())); + MFile wrap(m_basedir+"/"+m_subdir+"/"+bn); + wrap.open(); + wrap.write(QString("#include \"src"+bn+".h\"\n").toAscii()); } QString WocQtOut::qttype(const WocClass&cls,QString p,bool dolist)