From 438f31d9d493976234f400625bab36da6bc5bc11 Mon Sep 17 00:00:00 2001 From: konrad Date: Sun, 1 Feb 2009 12:13:02 +0000 Subject: [PATCH] merge in soaptest changes git-svn-id: https://silmor.de/svn/softmagic/smoke/trunk@253 6e3c4bff-ac9f-4ac1-96c5-d2ea494d3e33 --- wob/basics.wolf | 8 ++ wob/magicsmoke.wolf | 21 +++++ wob/order.wolf | 132 ++++++++++++++++++++++++++++++++ wob/user.wolf | 8 ++ woc/phpout.cpp | 17 ++++ woc/phpout.h | 27 +++++++ woc/processor.cpp | 178 +++++++++++++++++++++++++++++++++++++++++++ woc/processor.h | 74 ++++++++++++++++++ woc/qtout.cpp | 17 ++++ woc/qtout.h | 27 +++++++ woc/woc.cpp | 36 +++++++++ woc/woc.pro | 7 ++ www/inc/classes/random.php | 2 +- www/inc/machine/version.inc | 4 +- www/inc/wbase/autoload.php | 21 +++++ www/inc/wbase/table.php | 64 +++++++++++++++ 16 files changed, 640 insertions(+), 3 deletions(-) create mode 100644 wob/basics.wolf create mode 100644 wob/magicsmoke.wolf create mode 100644 wob/order.wolf create mode 100644 wob/user.wolf create mode 100644 woc/phpout.cpp create mode 100644 woc/phpout.h create mode 100644 woc/processor.cpp create mode 100644 woc/processor.h create mode 100644 woc/qtout.cpp create mode 100644 woc/qtout.h create mode 100644 woc/woc.cpp create mode 100644 woc/woc.pro create mode 100644 www/inc/wbase/autoload.php create mode 100644 www/inc/wbase/table.php diff --git a/wob/basics.wolf b/wob/basics.wolf new file mode 100644 index 0000000..de63028 --- /dev/null +++ b/wob/basics.wolf @@ -0,0 +1,8 @@ + + + + + +
+ +
diff --git a/wob/magicsmoke.wolf b/wob/magicsmoke.wolf new file mode 100644 index 0000000..151ff08 --- /dev/null +++ b/wob/magicsmoke.wolf @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/wob/order.wolf b/wob/order.wolf new file mode 100644 index 0000000..027a336 --- /dev/null +++ b/wob/order.wolf @@ -0,0 +1,132 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + +
+ + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + orderid customerid seller amountpaid state amountdue + orderid customerid seller amountpaid state amountdue tickets/Full vouchers/Full + +
\ No newline at end of file diff --git a/wob/user.wolf b/wob/user.wolf new file mode 100644 index 0000000..e1e68d1 --- /dev/null +++ b/wob/user.wolf @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/woc/phpout.cpp b/woc/phpout.cpp new file mode 100644 index 0000000..e911c0d --- /dev/null +++ b/woc/phpout.cpp @@ -0,0 +1,17 @@ +// +// C++ Implementation: phpout +// +// Description: +// +// +// Author: Konrad Rosenbaum , (C) 2009 +// +// Copyright: See README/COPYING files that come with this distribution +// +// + +#include "phpout.h" + +WocPHPServerOut::WocPHPServerOut(QString srcDir,QString subDir,QString ext,QString loader){} +void WocPHPServerOut::finalize(){} +void WocPHPServerOut::newClass(const WocClass&){} diff --git a/woc/phpout.h b/woc/phpout.h new file mode 100644 index 0000000..8054961 --- /dev/null +++ b/woc/phpout.h @@ -0,0 +1,27 @@ +// +// C++ Interface: phpout +// +// Description: +// +// +// Author: Konrad Rosenbaum , (C) 2009 +// +// Copyright: See README/COPYING files that come with this distribution +// +// + +#ifndef WOC_PHPOUT_H +#define WOC_PHPOUT_H + +#include "processor.h" + +class WocPHPServerOut:public WocOutput +{ + public: + WocPHPServerOut(QString srcDir,QString subDir,QString ext,QString loader); + protected: + virtual void finalize(); + virtual void newClass(const WocClass&); +}; + +#endif diff --git a/woc/processor.cpp b/woc/processor.cpp new file mode 100644 index 0000000..4fc8f9a --- /dev/null +++ b/woc/processor.cpp @@ -0,0 +1,178 @@ +// +// C++ Implementation: processor +// +// Description: +// +// +// Author: Konrad Rosenbaum , (C) 2009 +// +// Copyright: See README/COPYING files that come with this distribution +// +// + +#include "processor.h" + +#include "phpout.h" +#include "qtout.h" + +#include +#include +#include +#include + +WocProcessor* WocProcessor::inst=0; + +WocProcessor::WocProcessor() +{ + m_baseDir=QDir(".").absolutePath(); + m_wobDir="."; + m_verComm="0"; + m_verNeedComm="0"; + m_verHR="0.0"; + m_svnTarget="."; + m_svnCache=".svn_*.xml"; + m_svnExe="svn"; + m_dbInst="dbInst"; + m_dbScheme="dbScheme"; + + inst=this; +} + +bool WocProcessor::processFile(QString fn) +{ + //open file + QFile fd(fn); + if(!fd.open(QIODevice::ReadOnly)){ + qDebug("Error: cannot read file %s",fn.toLocal8Bit().data()); + return false; + } + //get XML content + QDomDocument doc; + QString err;int eln,ecl; + if(!doc.setContent(&fd,&err,&eln,&ecl)){ + qDebug("Error: XML parser error in file %s line %i column %i: %s",fn.toLocal8Bit().data(),eln,ecl,err.toLocal8Bit().data()); + fd.close(); + return false; + } + fd.close(); + QDomElement root=doc.documentElement(); + if(root.isNull() || root.tagName()!="Wolf"){ + qDebug("Error: XML File %s is not a Wolf.",fn.toLocal8Bit().data()); + return false; + } + //go on, process file + qDebug("Info: processing file %s...",fn.toLocal8Bit().data()); + QDomNodeList nl=root.childNodes(); + for(int i=0;i0)callSvn(); + } + else{ + qDebug("Warning: file %s has unknown element '%s' at line %i column %i", fn.toLocal8Bit().data(), tn.toLocal8Bit().data(), el.lineNumber(), el.columnNumber()); + } + } + return true; +} + +void WocProcessor::callSvn() +{ + //svn info + QString svntgt=m_baseDir+"/"+m_svnTarget; + QProcess svn; + svn.setProcessChannelMode(QProcess::MergedChannels); + svn.setWorkingDirectory(svntgt); + svn.start(m_svnExe,QStringList()<<"info"<<"-R"<<"--xml"<<"--non-interactive"<<"."); + svn.waitForFinished(); + if(svn.exitCode()!=0){ + qDebug("Warning: error while calling svn info."); + return; + }else{ + QDomDocument doc; + if(!doc.setContent(svn.readAllStandardOutput())){ + qDebug("Warning: unable to parse output of svn info."); + return; + } + //TODO: parse it. + } + //svn status + svn.start(m_svnExe,QStringList()<<"status"<<"--xml"<<"--non-interactive"<<"."); + svn.waitForFinished(); + if(svn.exitCode()!=0)return; + QFile stat(m_baseDir+"/"+QString(m_svnCache).replace("*","status")); + if(stat.open(QIODevice::WriteOnly|QIODevice::Truncate)){ + stat.write(svn.readAllStandardOutput()); + stat.close(); + qDebug("Info: wrote svn status to %s",stat.fileName().toLocal8Bit().data()); + }else + qDebug("Warning: unable to call svn status"); +} + +void WocProcessor::finalize() +{ + emit sfinalize(); +} + +WocOutput::WocOutput() +{ + connect(WocProcessor::instance(),SIGNAL(sfinalize()),this,SLOT(finalize())); + connect(WocProcessor::instance(),SIGNAL(newClass(const WocClass&)),this,SLOT(newClass(const WocClass&))); +} + +WocOutput::~WocOutput(){} + +WocClass::WocClass(const QDomElement&cls) +{ + m_valid=true; + qDebug("not really parsing class %s",cls.attribute("name").toAscii().data()); + +} diff --git a/woc/processor.h b/woc/processor.h new file mode 100644 index 0000000..7fbd271 --- /dev/null +++ b/woc/processor.h @@ -0,0 +1,74 @@ +// +// C++ Interface: processor +// +// Description: +// +// +// Author: Konrad Rosenbaum , (C) 2009 +// +// Copyright: See README/COPYING files that come with this distribution +// +// + +#ifndef WOC_PROCESSOR_H +#define WOC_PROCESSOR_H + +#include + +class QDomElement; + +class WocClass +{ + public: + WocClass(const QDomElement&); + + bool isValid()const{return m_valid;} + private: + bool m_valid; +}; + +class WocOutput:public QObject +{ + Q_OBJECT + public: + WocOutput(); + virtual ~WocOutput(); + + protected slots: + virtual void finalize()=0; + virtual void newClass(const WocClass&)=0; +}; + +class WocProcessor:public QObject +{ + Q_OBJECT + public: + WocProcessor(); + + bool processFile(QString); + void finalize(); + + static WocProcessor* instance(){return inst;} + QString baseDir()const{return m_baseDir;} + QString wobDir()const{return m_wobDir;} + QString verComm()const{return m_verComm;} + QString verNeedComm()const{return m_verNeedComm;} + QString verHR()const{return m_verHR;} + QString svnCache()const{return m_svnCache;} + QString dbInst()const{return m_dbInst;} + QString dbScheme()const{return m_dbScheme;} + signals: + void sfinalize(); + void newClass(const WocClass&); + + private: + QString m_baseDir,m_wobDir,m_verComm,m_verNeedComm,m_verHR; + QString m_svnTarget,m_svnCache,m_svnExe,m_dbInst,m_dbScheme; + + static WocProcessor*inst; + + void callSvn(); +}; + + +#endif diff --git a/woc/qtout.cpp b/woc/qtout.cpp new file mode 100644 index 0000000..151848c --- /dev/null +++ b/woc/qtout.cpp @@ -0,0 +1,17 @@ +// +// C++ Implementation: qtout +// +// Description: +// +// +// Author: Konrad Rosenbaum , (C) 2009 +// +// Copyright: See README/COPYING files that come with this distribution +// +// + +#include "qtout.h" + +WocQtClientOut::WocQtClientOut(QString srcDir,QString subDir,QString prifile){} +void WocQtClientOut::finalize(){} +void WocQtClientOut::newClass(const WocClass&){} diff --git a/woc/qtout.h b/woc/qtout.h new file mode 100644 index 0000000..ced1e88 --- /dev/null +++ b/woc/qtout.h @@ -0,0 +1,27 @@ +// +// C++ Interface: qtout +// +// Description: +// +// +// Author: Konrad Rosenbaum , (C) 2009 +// +// Copyright: See README/COPYING files that come with this distribution +// +// + +#ifndef WOC_QTOUT_H +#define WOC_QTOUT_H + +#include "processor.h" + +class WocQtClientOut:public WocOutput +{ + public: + WocQtClientOut(QString srcDir,QString subDir,QString prifile); + protected: + virtual void finalize(); + virtual void newClass(const WocClass&); +}; + +#endif diff --git a/woc/woc.cpp b/woc/woc.cpp new file mode 100644 index 0000000..05b4dd8 --- /dev/null +++ b/woc/woc.cpp @@ -0,0 +1,36 @@ +// +// C++ Implementation: woc +// +// Description: +// +// +// Author: Konrad Rosenbaum , (C) 2009 +// +// Copyright: See README/COPYING files that come with this distribution +// +// + +#include +#include + +#include "processor.h" + +int main(int argc,char**argv) +{ + QCoreApplication app(argc,argv); + //get arguments + QStringList args=app.arguments(); + args.removeFirst(); + //process files + WocProcessor proc; + for(int i=0;i +// +---------------------------------------------------------------------- +// | +// | Copyright: See COPYING file that comes with this distribution +// +---------------------------------------------------------------------- +// + +$AUTOCLASS["WobTable"]="wbase/table.php"; + +function __autoload($cname) +{ + global $AUTOCLASS; + if(isset($AUTOCLASS[$cname])) + require_once 'inc/'.$AUTOCLASS[$cname]; +} + +?> diff --git a/www/inc/wbase/table.php b/www/inc/wbase/table.php new file mode 100644 index 0000000..b339c4e --- /dev/null +++ b/www/inc/wbase/table.php @@ -0,0 +1,64 @@ +, (C) 2009 +// +// Copyright: See README/COPYING files that come with this distribution +// +// + +class WobTable +{ + private $data; + private $isfromdb; + private $table; + + protected function __construct(array $data,$isfromdb,$table) + { + $this->data=$data; + $this->isfromdb=$isfromdb; + $this->table=$table; + } + + public function __set($name,$value) + { + //verify name against scheme + //escape value + //DB update (if from DB) + //if successful: store + } + + public function __get($name) + { + //verify name + //return value or false + } + + public function __isset($name) + { + //verify name and return true on existence + } + + public function __unset($name) + { + //ignore those fools! + } + + /**insert the object under a new primary key value into the DB (implicitly calls newKey)*/ + public function insert() + { + } + + /**generate a new primary key value for insert and marks the object as not yet in the DB; the default sets the primary key to NULL; call the original first if you overwrite it*/ + public function newKey() + { + $this->isfromdb=false; + //get primary key columns and set them to false + } +}; + +?> \ No newline at end of file -- 1.7.2.5