move the PACK Qt port to a more Qt like include mode
authorkonrad <konrad@6e3c4bff-ac9f-4ac1-96c5-d2ea494d3e33>
Sun, 26 Sep 2010 19:01:43 +0000 (19:01 +0000)
committerkonrad <konrad@6e3c4bff-ac9f-4ac1-96c5-d2ea494d3e33>
Sun, 26 Sep 2010 19:01:43 +0000 (19:01 +0000)
git-svn-id: https://silmor.de/svn/softmagic/pack/trunk@591 6e3c4bff-ac9f-4ac1-96c5-d2ea494d3e33

22 files changed:
qtbase/include/Nullable [new file with mode: 0644]
qtbase/include/WException [new file with mode: 0644]
qtbase/include/WHelper [new file with mode: 0644]
qtbase/include/WInterface [new file with mode: 0644]
qtbase/include/WObject [new file with mode: 0644]
qtbase/include/WTransaction [new file with mode: 0644]
qtbase/include/exception.h [moved from qtbase/exception.h with 100% similarity]
qtbase/include/helper.h [moved from qtbase/WHelper.h with 100% similarity]
qtbase/include/interface.h [moved from qtbase/WInterface.h with 100% similarity]
qtbase/include/nullable.h [moved from qtbase/nullable.h with 100% similarity]
qtbase/include/object.h [moved from qtbase/WObject.h with 98% similarity]
qtbase/include/transaction.h [moved from qtbase/WTransaction.h with 99% similarity]
qtbase/src/helper.cpp [moved from qtbase/WHelper.cpp with 97% similarity]
qtbase/src/interface.cpp [moved from qtbase/WInterface.cpp with 97% similarity]
qtbase/src/object.cpp [moved from qtbase/WObject.cpp with 90% similarity]
qtbase/src/transaction.cpp [moved from qtbase/WTransaction.cpp with 99% similarity]
qtbase/wbase.pro
woc/mfile.h
woc/qt/qtclass.cpp
woc/qt/qtconst.h
woc/qt/qtctrans.cpp
woc/qt/qtout.cpp

diff --git a/qtbase/include/Nullable b/qtbase/include/Nullable
new file mode 100644 (file)
index 0000000..013b50f
--- /dev/null
@@ -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 (file)
index 0000000..37c0fac
--- /dev/null
@@ -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 (file)
index 0000000..fd0b5ec
--- /dev/null
@@ -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 (file)
index 0000000..0775374
--- /dev/null
@@ -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 (file)
index 0000000..d52452b
--- /dev/null
@@ -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 (file)
index 0000000..34e3143
--- /dev/null
@@ -0,0 +1 @@
+#include "transaction.h"
\ No newline at end of file
similarity index 100%
rename from qtbase/WHelper.h
rename to qtbase/include/helper.h
similarity index 100%
rename from qtbase/nullable.h
rename to qtbase/include/nullable.h
similarity index 98%
rename from qtbase/WObject.h
rename to qtbase/include/object.h
index 1da59ad..57f24e8 100644 (file)
@@ -18,7 +18,7 @@
 
 #include "nullable.h"
 #include "exception.h"
-#include "WHelper.h"
+#include "WHelper"
 
 class QDomElement;
 class QDomDocument;
similarity index 99%
rename from qtbase/WTransaction.h
rename to qtbase/include/transaction.h
index da72912..f2a75a2 100644 (file)
@@ -18,7 +18,7 @@
 #include <QString>
 
 #include "nullable.h"
-#include "WHelper.h"
+#include "WHelper"
 
 /**base class of all transactions*/
 class WTransaction:public WHelper
similarity index 97%
rename from qtbase/WHelper.cpp
rename to qtbase/src/helper.cpp
index cc7441f..06afd48 100644 (file)
@@ -10,7 +10,7 @@
 //
 //
 
-#include "WHelper.h"
+#include "WHelper"
 
 #include <QDomElement>
 #include <QDomNode>
similarity index 97%
rename from qtbase/WInterface.cpp
rename to qtbase/src/interface.cpp
index aee9cf8..c85e80b 100644 (file)
@@ -10,7 +10,7 @@
 //
 //
 
-#include "WInterface.h"
+#include "WInterface"
 
 #include <QHttp>
 #include <QMutex>
similarity index 90%
rename from qtbase/WObject.cpp
rename to qtbase/src/object.cpp
index 10a7629..fc8a896 100644 (file)
@@ -10,4 +10,4 @@
 //
 //
 
-#include "WObject.h"
+#include "WObject"
similarity index 99%
rename from qtbase/WTransaction.cpp
rename to qtbase/src/transaction.cpp
index 99cbe0b..50f83f2 100644 (file)
@@ -10,8 +10,8 @@
 //
 //
 
-#include "WTransaction.h"
-#include "WInterface.h"
+#include "WTransaction"
+#include "WInterface"
 
 #include <QCoreApplication>
 #include <QDebug>
index dddaeeb..c8c9ac3 100644 (file)
@@ -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
index 07b298d..0e12fb0 100644 (file)
@@ -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;}
index 7395609..2b71781 100644 (file)
@@ -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 <QCoreApplication>\n\n";
+       hcd="#include \""+cls.clientBaseClass()+"\"\n#include <QCoreApplication>\n\n";
        QStringList k=cls.propertyNames();
        for(int i=0;i<k.size();i++)
                if(cls.propertyIsObject(k[i]))
-                       hcd+="#include \""+m_prefix+"O"+cls.propertyPlainType(k[i])+".h\"\n";
+                       hcd+="#include \""+m_prefix+"O"+cls.propertyPlainType(k[i])+"\"\n";
 
        //class declaration
        hcd+="class "+cna+":public "+cls.clientBaseClass()+"\n{\n";
index f252ddd..301e418 100644 (file)
@@ -26,7 +26,7 @@ static const QByteArray HDREND="\n//END OF AUTOMATICALLY GENERATED FILE\n#endif\
 static const QByteArray SRCSTART=
        "//AUTOMATICALLY GENERATED FILE\n"
        "//DO NOT EDIT THIS FILE DIRECTLY, USE THE XML SOURCE!\n"
-       "#include \"%.h\"\n"
+       "#include \"%\"\n"
        "#include <QDomElement>\n"
        "#include <QDomDocument>\n";
 //end section of all source files
index 9af83b7..1626525 100644 (file)
@@ -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 <QCoreApplication>\n";
+       hcd="#include \""+m_transbase+"\"\n";
+       scd+="#include \"WInterface\"\n#include <QCoreApplication>\n";
        for(int i=0;i<in.size();i++){
                QString tp=qtobjtype(trn,in[i],WocQtOut::In);
-               if(tp!="")hcd+="#include <"+tp+".h>\n";
+               if(tp!="")hcd+="#include <"+tp+">\n";
        }
        for(int i=0;i<out.size();i++){
                QString tp=qtobjtype(trn,out[i],WocQtOut::Out);
-               if(tp!="")hcd+="#include <"+tp+".h>\n";
+               if(tp!="")hcd+="#include <"+tp+">\n";
        }
        hcd+="\nclass "+cn+":public "+m_transbase+"\n{\n";
        hdr.write(hcd.toAscii());
index 0c7de04..ad3dcec 100644 (file)
@@ -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 <QStringList>\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)