From 692556212a82a27a2563852923b89b83faebbb3d Mon Sep 17 00:00:00 2001 From: Konrad Rosenbaum Date: Wed, 26 Dec 2012 15:44:51 +0100 Subject: [PATCH] update for Qt 5 --- qtbase/src/server.cpp | 10 ++++---- qtbase/src/transaction.cpp | 10 ++++---- woc/htmlout.cpp | 34 +++++++++++++------------- woc/php/phpclass.cpp | 26 ++++++++++---------- woc/php/phpctrans.cpp | 2 +- woc/php/phpdb.cpp | 12 ++++---- woc/php/phpout.cpp | 4 +- woc/php/phpstrans.cpp | 4 +- woc/php/phptrans.cpp | 18 +++++++------- woc/proc/proc.pri | 16 ++++++------ woc/proc/procclass.cpp | 30 +++++++++++----------- woc/proc/processor.cpp | 4 +- woc/proc/proctable.cpp | 26 ++++++++++---------- woc/proc/proctrans.cpp | 16 ++++++------ woc/qt/qtclass.cpp | 52 ++++++++++++++++++++-------------------- woc/qt/qtctrans.cpp | 24 +++++++++--------- woc/qt/qtout.cpp | 56 ++++++++++++++++++++++---------------------- woc/qt/qtstrans.cpp | 26 ++++++++++---------- woc/woc.pro | 2 +- 19 files changed, 186 insertions(+), 186 deletions(-) diff --git a/qtbase/src/server.cpp b/qtbase/src/server.cpp index 8429651..dc0ee0c 100644 --- a/qtbase/src/server.cpp +++ b/qtbase/src/server.cpp @@ -242,7 +242,7 @@ static inline QString headerVar(QString h) bool WServerRequest::hasCgiHeader(const QString&h)const { - return mhead.contains(headerVar(h).toAscii()); + return mhead.contains(headerVar(h).toLatin1()); } bool WServerRequest::hasHeader(const QString&h)const @@ -257,11 +257,11 @@ QByteArray WServerRequest::header(const QString&h)const QByteArray WServerRequest::cgiHeader(const QString&h)const { - return mhead.value(headerVar(h).toAscii()); + return mhead.value(headerVar(h).toLatin1()); } QString WServerRequest::pathInfo()const { - QString p=QString::fromAscii(cgiHeader("PATH_INFO")); + QString p=QString::fromLatin1(cgiHeader("PATH_INFO")); if(p=="")return "/"; else return p; } @@ -313,7 +313,7 @@ bool WServerReply::setStatus(short code,QString str) if(str.size()>500)return false; //assign mStatCode=code; - mStatStr=str.toAscii(); + mStatStr=str.toLatin1(); return true; } @@ -351,7 +351,7 @@ QByteArray WServerReply::toWireFormat()const ret="Status: "+QByteArray::number(mStatCode)+" "+mStatStr+"\r\n"; QStringList hl=mHead.keys(); for(int i=0;i&hl) { QString r; for(int i=0;ihdrs=iface->headers(hreq); QStringList hdrn=hdrs.keys(); for(int i=0;im_errstr.toUtf8(),0,QCoreApplication::UnicodeUTF8); + return QCoreApplication::translate("php::",d->m_errstr.toUtf8(),0); } WTransaction::Stage WTransaction::stage()const{return d->m_stage;} @@ -307,7 +307,7 @@ void WTransaction::Log::outStr(const QString&s) { QStringList sl=s.split("\n"); for(int i=0;idbUpdatingDefault()?"updating":"reading")+"
"; inf+="Database Schema Version: "+woc->dbVersion()+"

"; - m_index.write(inf.toAscii()); + m_index.write(inf.toLatin1()); //write global docu QStringList dcs=woc->docStrings(); for(int i=0;i\n"; - m_index.write(inf.toAscii()); + m_index.write(inf.toLatin1()); } } @@ -78,7 +78,7 @@ void WocHtmlOut::finalize() qSort(sl); for(int i=0;i"+sl[i]+"\n"; - m_index.write(s.toAscii()); + m_index.write(s.toLatin1()); m_index.write(QByteArray("

    ")); sl=WocProcessor::instance()->transactionNames(); @@ -86,7 +86,7 @@ void WocHtmlOut::finalize() qSort(sl); for(int i=0;i"+sl[i]+"\n"; - m_index.write(s.toAscii()); + m_index.write(s.toLatin1()); m_index.write(QByteArray("
    ")); sl=WocProcessor::instance()->tableNames(); @@ -94,7 +94,7 @@ void WocHtmlOut::finalize() qSort(sl); for(int i=0;i"+sl[i]+"\n"; - m_index.write(s.toAscii()); + m_index.write(s.toLatin1()); m_index.write(QByteArray("
\n")); @@ -107,12 +107,12 @@ void WocHtmlOut::newTable(const WocTable&tbl) QString cn=tbl.name(); QFile htm(m_basedir+"/"+m_subdir+"/table-"+cn+".html"); if(!htm.open(QIODevice::WriteOnly|QIODevice::Truncate)){ - qDebug("Error: cannot create html file for table %s.",cn.toAscii().data()); + qDebug("Error: cannot create html file for table %s.",cn.toLatin1().data()); emit errorFound(); return; } //lead in - htm.write(QString("Table "+cn+"\n").toAscii()); + htm.write(QString("Table "+cn+"\n").toLatin1()); QString hcd; //table declaration @@ -197,7 +197,7 @@ void WocHtmlOut::newTable(const WocTable&tbl) } hcd+="\n"; - htm.write(hcd.toAscii()); + htm.write(hcd.toLatin1()); } void WocHtmlOut::newClass(const WocClass&cls) @@ -205,12 +205,12 @@ void WocHtmlOut::newClass(const WocClass&cls) QString cn=cls.name(); QFile htm(m_basedir+"/"+m_subdir+"/class-"+cn+".html"); if(!htm.open(QIODevice::WriteOnly|QIODevice::Truncate)){ - qDebug("Error: cannot create html file for class %s.",cn.toAscii().data()); + qDebug("Error: cannot create html file for class %s.",cn.toLatin1().data()); emit errorFound(); return; } //lead in - htm.write(QString("Class "+cn+"\n").toAscii()); + htm.write(QString("Class "+cn+"\n").toLatin1()); QString hcd; //class declaration @@ -233,7 +233,7 @@ void WocHtmlOut::newClass(const WocClass&cls) QStringList doc=cls.docStrings(); for(int i=0;i\n"; - htm.write(hcd.toAscii()); + htm.write(hcd.toLatin1()); //enums classEnums(cls,htm); @@ -266,7 +266,7 @@ void WocHtmlOut::classEnums(const WocClass&cls,QFile&hdr) } hcd+="\n"; } - hdr.write(hcd.toAscii()); + hdr.write(hcd.toLatin1()); } void WocHtmlOut::classProperties(const WocClass&cls,QFile&hdr) @@ -290,7 +290,7 @@ void WocHtmlOut::classProperties(const WocClass&cls,QFile&hdr) } hcd+="\n"; //write - hdr.write(hcd.toAscii()); + hdr.write(hcd.toLatin1()); } void WocHtmlOut::classMappings(const WocClass&cls,QFile&hdr) @@ -310,7 +310,7 @@ void WocHtmlOut::classMappings(const WocClass&cls,QFile&hdr) hcd+="\n"; } - hdr.write(hcd.toAscii()); + hdr.write(hcd.toLatin1()); } void WocHtmlOut::newTransaction(const WocTransaction&trn) @@ -318,7 +318,7 @@ void WocHtmlOut::newTransaction(const WocTransaction&trn) QString cn=trn.name(); QFile htm(m_basedir+"/"+m_subdir+"/trn-"+cn+".html"); if(!htm.open(QIODevice::WriteOnly|QIODevice::Truncate)){ - qDebug("Error: cannot create HTML file for transaction %s.",cn.toAscii().data()); + qDebug("Error: cannot create HTML file for transaction %s.",cn.toLatin1().data()); emit errorFound(); return; } @@ -386,5 +386,5 @@ void WocHtmlOut::newTransaction(const WocTransaction&trn) hcd+="\n"; } hcd+="\n"; - htm.write(hcd.toAscii()); + htm.write(hcd.toLatin1()); } diff --git a/woc/php/phpclass.cpp b/woc/php/phpclass.cpp index 40d0092..71c8e75 100644 --- a/woc/php/phpclass.cpp +++ b/woc/php/phpclass.cpp @@ -31,7 +31,7 @@ void WocPHPClass::newClass(const WocClass&cls) fn=m_subdir+"/"+fn+m_fileext; QFile tf(m_basedir+"/"+fn); if(!tf.open(QIODevice::ReadWrite|QIODevice::Truncate)){ - qDebug("Error: cannot create PHP object file %s.",fn.toAscii().data()); + qDebug("Error: cannot create PHP object file %s.",fn.toLatin1().data()); emit errorFound(); return; } @@ -42,32 +42,32 @@ void WocPHPClass::newClass(const WocClass&cls) QString code="/* TRANSLATOR "+cna+" */\nclass "+cna+" extends "+ cls.baseClass(m_lang,m_parent->classPrefix())+ "{\n\n"; - tf.write(code.toAscii()); + tf.write(code.toLatin1()); //property declaration and constructor - tf.write(classConstruct(cls).toAscii()); + tf.write(classConstruct(cls).toLatin1()); //enums - tf.write(classEnums(cls).toAscii()); + tf.write(classEnums(cls).toLatin1()); //properties - tf.write(classProperties(cls).toAscii()); + tf.write(classProperties(cls).toLatin1()); //mappings - tf.write(classMappings(cls).toAscii()); + tf.write(classMappings(cls).toLatin1()); //serializers - tf.write(classSerializers(cls).toAscii()); + tf.write(classSerializers(cls).toLatin1()); //de-serializer - tf.write(classDeserializers(cls).toAscii()); + tf.write(classDeserializers(cls).toLatin1()); //prop to array conversion - tf.write(classPropertiesList(cls).toAscii()); + tf.write(classPropertiesList(cls).toLatin1()); //end of class code="\n//end of class\n};\n"; - tf.write(code.toAscii()); + tf.write(code.toLatin1()); tf.write(PHPEND); tf.close(); @@ -190,7 +190,7 @@ QString WocPHPClass::classPropertyValidator(const WocClass&cls,QString prop) if(cls.propertyIsObject(prop)) code+="\treturn is_a($value,\"WO"+cls.propertyPlainType(prop)+"\");\n"; else{ - qDebug("Warning: unable to generate validator for class %s property %s: unknown type.",cls.name().toAscii().data(),prop.toAscii().data()); + qDebug("Warning: unable to generate validator for class %s property %s: unknown type.",cls.name().toLatin1().data(),prop.toLatin1().data()); code+="\treturn false;\n"; } code+="}\n"; @@ -302,7 +302,7 @@ QString WocPHPClass::classPropertyListSetters(const WocClass&cls,QString prop) acode+="\t\treturn true;\n"; acode+="\t}else return false;\n"; }else{ - qDebug("Warning: unable to generate setter for class %s property %s: unknown type.",cls.name().toAscii().data(),prop.toAscii().data()); + qDebug("Warning: unable to generate setter for class %s property %s: unknown type.",cls.name().toLatin1().data(),prop.toLatin1().data()); code+="\treturn false;\n"; } code+="}\n"; @@ -377,7 +377,7 @@ QString WocPHPClass::classPropertyScalarSetters(const WocClass&cls,QString prop) code+="\t\t$this->prop_"+prop+"=$value;\n"; code+="\t\treturn true;\n\t}\n"; }else{ - qDebug("Warning: unable to generate setter for class %s property %s: unknown type.",cls.name().toAscii().data(),prop.toAscii().data()); + qDebug("Warning: unable to generate setter for class %s property %s: unknown type.",cls.name().toLatin1().data(),prop.toLatin1().data()); code+="\treturn false;\n"; } code+="}\n"; diff --git a/woc/php/phpctrans.cpp b/woc/php/phpctrans.cpp index 3cb573c..0535ebc 100644 --- a/woc/php/phpctrans.cpp +++ b/woc/php/phpctrans.cpp @@ -61,7 +61,7 @@ QString WocPHPClientTransaction::trnHandlers(const WocTransaction&trn) }else{ code+="\t/*normally here would be the PHP call, but it is missing from the config*/\n"; code+="\t$this->abortNotImplemented();\nreturn;\n"; - qDebug("Warning: transaction %s does not have a PHP call!",trn.name().toAscii().data()); + qDebug("Warning: transaction %s does not have a PHP call!",trn.name().toLatin1().data()); } //encode outputs/handle errors diff --git a/woc/php/phpdb.cpp b/woc/php/phpdb.cpp index 330c58d..22f6a9e 100644 --- a/woc/php/phpdb.cpp +++ b/woc/php/phpdb.cpp @@ -27,7 +27,7 @@ WocPHPTable::WocPHPTable(WocPHPOut* p) } m_schema.write(PHPSTART); m_schema.write(SCHEMASTART); - m_schema.write(("\tself::$sversion=\""+WocProcessor::instance()->dbVersion()+"\";\n").toAscii()); + m_schema.write(("\tself::$sversion=\""+WocProcessor::instance()->dbVersion()+"\";\n").toLatin1()); addLoad("WobSchema","schema"); } @@ -48,7 +48,7 @@ void WocPHPTable::newTable(const WocTable&tbl) QString fn=m_subdir+"/wt_"+tbl.name()+m_fileext; QFile tf(m_basedir+"/"+fn); if(!tf.open(QIODevice::ReadWrite|QIODevice::Truncate)){ - qDebug("Error: cannot create PHP table file %s.",fn.toAscii().data()); + qDebug("Error: cannot create PHP table file %s.",fn.toLatin1().data()); emit errorFound(); return; } @@ -114,13 +114,13 @@ void WocPHPTable::newTable(const WocTable&tbl) //parse via QStringList v1=via.split("="); if(v1.size()!=2){ - qDebug("Warning: Foreign clause %s of table %s has illegal syntax. Should be foreigntable:column=localcolumn.",fs[i].toAscii().data(),tbl.name().toAscii().data()); + qDebug("Warning: Foreign clause %s of table %s has illegal syntax. Should be foreigntable:column=localcolumn.",fs[i].toLatin1().data(),tbl.name().toLatin1().data()); continue; } QString local=v1[1].trimmed(); QStringList foreign=v1[0].split(":"); if(foreign.size()!=2){ - qDebug("Warning: Foreign clause %s of table %s has illegal syntax. Should be foreigntable:column=localcolumn.",fs[i].toAscii().data(),tbl.name().toAscii().data()); + qDebug("Warning: Foreign clause %s of table %s has illegal syntax. Should be foreigntable:column=localcolumn.",fs[i].toLatin1().data(),tbl.name().toLatin1().data()); continue; } code+="public function "+fs[i]+"(){\n\tglobal "+dbi+";\n\treturn WT"+foreign[0]+"::selectFromDB(\""+foreign[1]+"=\"."+dbi+"->escapeColumn(\""; @@ -166,7 +166,7 @@ void WocPHPTable::newTable(const WocTable&tbl) //write table class code+="};\n"; - tf.write(code.toAscii()); + tf.write(code.toLatin1()); tf.write(PHPEND); tf.close(); @@ -213,7 +213,7 @@ void WocPHPTable::newTable(const WocTable&tbl) } //write - m_schema.write(code.toAscii()); + m_schema.write(code.toLatin1()); //create autoloading addLoad("WT"+tbl.name(),"wt_"+tbl.name()); diff --git a/woc/php/phpout.cpp b/woc/php/phpout.cpp index c676fc9..cc63670 100644 --- a/woc/php/phpout.cpp +++ b/woc/php/phpout.cpp @@ -63,7 +63,7 @@ WocPHPOut::WocPHPOut(const QDomElement&el) return; } m_loader.write(PHPSTART); - m_loader.write(QString("$d=dirname(__FILE__);\n").toAscii()); + m_loader.write(QString("$d=dirname(__FILE__);\n").toLatin1()); } @@ -82,7 +82,7 @@ void WocPHPOut::finalize() void WocPHPOut::addLoad(QString cn,QString fn) { QString ld="wob_autoclass(\""+cn+"\",$d.\"/"+fn+m_fileext+"\");\n"; - m_loader.write(ld.toAscii()); + m_loader.write(ld.toLatin1()); } void WocPHPOut::newTransaction(const WocTransaction&trn) diff --git a/woc/php/phpstrans.cpp b/woc/php/phpstrans.cpp index b92ccca..0175e2b 100644 --- a/woc/php/phpstrans.cpp +++ b/woc/php/phpstrans.cpp @@ -74,7 +74,7 @@ QString WocPHPServerTransaction::trnHandlers(const WocTransaction&trn) }else{ code+="\t/*normally here would be the PHP call, but it is missing from the config*/\n"; code+="\t$this->abortNotImplemented();\nreturn;\n"; - qDebug("Warning: transaction %s does not have a PHP call!",trn.name().toAscii().data()); + qDebug("Warning: transaction %s does not have a PHP call!",trn.name().toLatin1().data()); } //encode outputs/handle errors @@ -83,7 +83,7 @@ QString WocPHPServerTransaction::trnHandlers(const WocTransaction&trn) code+="\t$this->commitTransaction();\n}\n"; //direct execution - code+=trnExecute(trn).toAscii(); + code+=trnExecute(trn).toLatin1(); return code; } diff --git a/woc/php/phptrans.cpp b/woc/php/phptrans.cpp index 8763a35..6667ac9 100644 --- a/woc/php/phptrans.cpp +++ b/woc/php/phptrans.cpp @@ -60,7 +60,7 @@ void WocPHPTransaction::transInfo() default:code+="Wob";break; } code+="();}\n\n"; - m_transact.write(code.toAscii()); + m_transact.write(code.toLatin1()); } @@ -84,7 +84,7 @@ void WocPHPTransaction::transInfo2() } code+="\n\t);\n}\n"; - m_transact.write(code.toAscii()); + m_transact.write(code.toLatin1()); } void WocPHPTransaction::finalize() @@ -108,7 +108,7 @@ void WocPHPTransaction::newTransaction(const WocTransaction&trn) fn=m_subdir+"/"+fn+m_fileext; QFile tf(m_basedir+"/"+fn); if(!tf.open(QIODevice::ReadWrite|QIODevice::Truncate)){ - qDebug("Error: cannot create PHP object file %s.",fn.toAscii().data()); + qDebug("Error: cannot create PHP object file %s.",fn.toLatin1().data()); emit errorFound(); return; } @@ -119,27 +119,27 @@ void WocPHPTransaction::newTransaction(const WocTransaction&trn) QString code="/* TRANSLATOR "+cn+" */\nclass "+cn+" extends "+m_transbase+"{\n"; //constructor code+=trnConstruct(trn); - tf.write(code.toAscii()); + tf.write(code.toLatin1()); //request handler: - tf.write(trnHandlers(trn).toAscii()); + tf.write(trnHandlers(trn).toLatin1()); //getters/setters - tf.write(trnGetSet(trn).toAscii()); + tf.write(trnGetSet(trn).toLatin1()); //privileges - tf.write(trnPrivileges(trn).toAscii()); + tf.write(trnPrivileges(trn).toLatin1()); //end code="\n//end of class\n}\n"; - tf.write(code.toAscii()); + tf.write(code.toLatin1()); tf.write(PHPEND); tf.close(); //// //generate loader code code="\tcase \""+trn.name()+"\":$trn=new "+cn+";$trn->handleRequest();break;\n"; - m_transact.write(code.toAscii()); + m_transact.write(code.toLatin1()); } QString WocPHPTransaction::trnConstruct(const WocTransaction&trn) diff --git a/woc/proc/proc.pri b/woc/proc/proc.pri index 5209b44..e936da0 100644 --- a/woc/proc/proc.pri +++ b/woc/proc/proc.pri @@ -1,13 +1,13 @@ SOURCES+= \ - processor.cpp \ - procclass.cpp \ - proctrans.cpp \ - proctable.cpp + proc/processor.cpp \ + proc/procclass.cpp \ + proc/proctrans.cpp \ + proc/proctable.cpp HEADERS+= \ - processor.h \ - procclass.h \ - proctrans.h \ - proctable.h + proc/processor.h \ + proc/procclass.h \ + proc/proctrans.h \ + proc/proctable.h CONFIG(prewoc, prewoc|woc){ RESOURCES += proc/version.qrc diff --git a/woc/proc/procclass.cpp b/woc/proc/procclass.cpp index 56d7d25..22a65e9 100644 --- a/woc/proc/procclass.cpp +++ b/woc/proc/procclass.cpp @@ -34,16 +34,16 @@ WocClass::WocClass(const QDomElement&cls) return; } if(woc->hasClass(m_name)){ - qDebug("Error: double definition of class %s at line %i column %i.",m_name.toAscii().data(),cls.lineNumber(),cls.columnNumber()); + qDebug("Error: double definition of class %s at line %i column %i.",m_name.toLatin1().data(),cls.lineNumber(),cls.columnNumber()); m_valid=false; return; } if(!symok.exactMatch(m_name)){ - qDebug("Error: Illegal class name %s.",m_name.toAscii().data()); + qDebug("Error: Illegal class name %s.",m_name.toLatin1().data()); m_valid=false; return; } - qDebug("Info: parsing class %s",m_name.toAscii().data()); + qDebug("Info: parsing class %s",m_name.toLatin1().data()); //scan inheritance if(cls.hasAttribute("base")) m_base.insert("wolf",cls.attribute("base")); @@ -69,12 +69,12 @@ WocClass::WocClass(const QDomElement&cls) s_prop p; p.name=el.attribute("name"); if(!symok.exactMatch(p.name)){ - qDebug("Error: Illegal property %s in class %s.",p.name.toAscii().data(),m_name.toAscii().data()); + qDebug("Error: Illegal property %s in class %s.",p.name.toLatin1().data(),m_name.toLatin1().data()); m_valid=false; return; } if(hasProperty(p.name)){ - qDebug("Error: Double definition of property %s in class %s.",p.name.toAscii().data(),m_name.toAscii().data()); + qDebug("Error: Double definition of property %s in class %s.",p.name.toLatin1().data(),m_name.toLatin1().data()); m_valid=false; return; } @@ -93,12 +93,12 @@ WocClass::WocClass(const QDomElement&cls) if(el.isNull())continue; QString nm=el.attribute("name"); if(!symok.exactMatch(nm)){ - qDebug("Error: Illegal enum type %s in class %s.",nm.toAscii().data(),m_name.toAscii().data()); + qDebug("Error: Illegal enum type %s in class %s.",nm.toLatin1().data(),m_name.toLatin1().data()); m_valid=false; return; } if(hasEnumType(nm)){ - qDebug("Error: Double definition of enum type %s in class %s.",nm.toAscii().data(),m_name.toAscii().data()); + qDebug("Error: Double definition of enum type %s in class %s.",nm.toLatin1().data(),m_name.toLatin1().data()); m_valid=false; return; } @@ -108,18 +108,18 @@ WocClass::WocClass(const QDomElement&cls) if(el.hasAttribute("refColumn")){ QStringList ref=el.attribute("refColumn").split(":"); if(ref.size()!=2){ - qDebug("Error: illegal enum reference in class %s enum %s.",m_name.toAscii().data(),nm.toAscii().data()); + qDebug("Error: illegal enum reference in class %s enum %s.",m_name.toLatin1().data(),nm.toLatin1().data()); m_valid=false; return; } if(!woc->hasTable(ref[0])){ - qDebug("Error: enum reference in class %s enum %s points to non-existant table.",m_name.toAscii().data(),nm.toAscii().data()); + qDebug("Error: enum reference in class %s enum %s points to non-existant table.",m_name.toLatin1().data(),nm.toLatin1().data()); m_valid=false; return; } WocTable tab=woc->table(ref[0]); if(!tab.hasColumn(ref[1])){ - qDebug("Error: enum reference in class %s enum %s points to non-existant column.",m_name.toAscii().data(),nm.toAscii().data()); + qDebug("Error: enum reference in class %s enum %s points to non-existant column.",m_name.toLatin1().data(),nm.toLatin1().data()); m_valid=false; return; } @@ -136,7 +136,7 @@ WocClass::WocClass(const QDomElement&cls) if(el2.isNull())continue; QString n=el2.attribute("name"); if(n==""){ - qDebug("Warning: anonymous enum value in class %s enum %s. Ignoring it.",m_name.toAscii().data(),nm.toAscii().data()); + qDebug("Warning: anonymous enum value in class %s enum %s. Ignoring it.",m_name.toLatin1().data(),nm.toLatin1().data()); continue; } nxval=el2.attribute("value",QString::number(nxval)).toInt(0,0); @@ -167,12 +167,12 @@ WocClass::WocClass(const QDomElement&cls) if(el.isNull())continue; QString name=el.attribute("table"); if(!symok.exactMatch(name)){ - qDebug("Error: Illegal mapping %s in class %s.",name.toAscii().data(),m_name.toAscii().data()); + qDebug("Error: Illegal mapping %s in class %s.",name.toLatin1().data(),m_name.toLatin1().data()); m_valid=false; return; } if(hasMapping(name)){ - qDebug("Error: Double definition of mapping %s in class %s.",name.toAscii().data(),m_name.toAscii().data()); + qDebug("Error: Double definition of mapping %s in class %s.",name.toLatin1().data(),m_name.toLatin1().data()); m_valid=false; return; } @@ -187,7 +187,7 @@ WocClass::WocClass(const QDomElement&cls) if(sm.property=="")sm.property=sm.column; if(sm.column=="")sm.column=sm.property; if(sm.column==""){ - qDebug("Warning: empty mapping in class %s mapping %s. Ignoring it.",m_name.toAscii().data(),name.toAscii().data()); + qDebug("Warning: empty mapping in class %s mapping %s. Ignoring it.",m_name.toLatin1().data(),name.toLatin1().data()); continue; } QList nl3=elementsByTagName(el2,"Call"); @@ -214,7 +214,7 @@ WocClass::WocClass(const QDomElement&cls) } //check abstraction if(!m_abstract && isAbstract("")){ - qDebug("Warning: class %s should be declared abstract.",m_name.toAscii().data()); + qDebug("Warning: class %s should be declared abstract.",m_name.toLatin1().data()); } //conditional abstraction (must be after check or we'll get false positives) nl=elementsByTagName(cls,"Abstract"); diff --git a/woc/proc/processor.cpp b/woc/proc/processor.cpp index 93513d1..fefee7b 100644 --- a/woc/proc/processor.cpp +++ b/woc/proc/processor.cpp @@ -145,7 +145,7 @@ bool WocProcessor::processFile(QString fn) m_auth=str2AuthMode(el.attribute("auth","none")); if(m_auth==UnknownAuth){ errorFound(); - qDebug("Error: unknown authentication mode %s", el.attribute("auth").toAscii().data()); + qDebug("Error: unknown authentication mode %s", el.attribute("auth").toLatin1().data()); return false; } }else @@ -393,7 +393,7 @@ static bool procGit(const QStringList¶m,QStringList&ret,const QString&tgt,co proc.start(git,param); proc.waitForFinished(); if(proc.exitCode()!=0){ - qDebug("Warning: error while calling git %s.",param.value(0).toAscii().data()); + qDebug("Warning: error while calling git %s.",param.value(0).toLatin1().data()); return false; } ret=QString::fromLocal8Bit(proc.readAllStandardOutput()).split('\n'); diff --git a/woc/proc/proctable.cpp b/woc/proc/proctable.cpp index c8c1ae2..4986c50 100644 --- a/woc/proc/proctable.cpp +++ b/woc/proc/proctable.cpp @@ -35,19 +35,19 @@ WocTable::WocTable(const QDomElement&tbl) QRegExp good("[a-z][a-z0-9_]*",Qt::CaseInsensitive); //check name syntax, check it does not exist yet if(woc->hasTable(m_name)){ - qDebug("Error: double definition of table %s.",m_name.toAscii().data()); + qDebug("Error: double definition of table %s.",m_name.toLatin1().data()); m_valid=false; return; } if(!good.exactMatch(m_name)){ - qDebug("Error: table %s does not have a regular name.",m_name.toAscii().data()); + qDebug("Error: table %s does not have a regular name.",m_name.toLatin1().data()); m_valid=false; return; } m_backup=str2bool(tbl.attribute("backup","0")); m_base=tbl.attribute("base","WobTable"); m_audit=str2bool(tbl.attribute("audit","0")); - qDebug("Info: parsing table %s",m_name.toAscii().data()); + qDebug("Info: parsing table %s",m_name.toLatin1().data()); //Columns QList nl=elementsByTagName(tbl,"Column"); for(int i=0;i cl=parseColumn(el,m_name); if(!cl.first)return; if(hasColumn(cl.second.name)){ - qDebug("Error: double definition of column %s in table %s.",cl.second.name.toAscii().data(),m_name.toAscii().data()); + qDebug("Error: double definition of column %s in table %s.",cl.second.name.toLatin1().data(),m_name.toLatin1().data()); m_valid=false; return; } @@ -95,13 +95,13 @@ WocTable::WocTable(const QDomElement&tbl) QDomElement el2=nl2.at(j).toElement(); if(el2.isNull())continue; if(!el2.hasAttribute("col") || (!el2.hasAttribute("val") && !el2.hasAttribute("code"))){ - qDebug("Error: table definition %s contains illegal preset.",m_name.toAscii().data()); + qDebug("Error: table definition %s contains illegal preset.",m_name.toLatin1().data()); m_valid=false; return; } QString nm=el2.attribute("col"); if(!hasColumn(nm)){ - qDebug("Error: table definition %s contains preset for invalid column %s.",m_name.toAscii().data(),nm.toAscii().data()); + qDebug("Error: table definition %s contains preset for invalid column %s.",m_name.toLatin1().data(),nm.toLatin1().data()); m_valid=false; return; } @@ -123,13 +123,13 @@ WocTable::WocTable(const QDomElement&tbl) //sanity checks //check we have any columns at all if(m_columns.size()==0){ - qDebug("Error: table %s does not have any columns.",m_name.toAscii().data()); + qDebug("Error: table %s does not have any columns.",m_name.toLatin1().data()); m_valid=false; return; } //check that we have a primary key if(primaryColumns().size()==0){ - qDebug("Warning: table %s does not have any primary key columns.",m_name.toAscii().data()); + qDebug("Warning: table %s does not have any primary key columns.",m_name.toLatin1().data()); } } @@ -141,7 +141,7 @@ QPair WocTable::parseColumn(const QDomElement&el,QString m cl.name=el.attribute("name"); //check name syntax, check it is not doubled if(!good.exactMatch(cl.name)){ - qDebug("Error: table %s column %s does not have a regular name.",m_name.toAscii().data(),cl.name.toAscii().data()); + qDebug("Error: table %s column %s does not have a regular name.",m_name.toLatin1().data(),cl.name.toLatin1().data()); return QPair(false,s_col()); } cl.isprime=str2bool(el.attribute("primarykey","0")); @@ -161,15 +161,15 @@ QPair WocTable::parseColumn(const QDomElement&el,QString m if(cl.foreign!=""){ QStringList fgn=cl.foreign.split(":"); if(fgn.size()!=2){ - qDebug("Error: table %s column %s: foreign key definition must use syntax 'table:column'",m_name.toAscii().data(),cl.name.toAscii().data()); + qDebug("Error: table %s column %s: foreign key definition must use syntax 'table:column'",m_name.toLatin1().data(),cl.name.toLatin1().data()); return QPair(false,s_col()); } if(!woc->hasTable(fgn[0])){ - qDebug("Error: table %s column %s: foreign key target table %s does not exist",m_name.toAscii().data(),cl.name.toAscii().data(),fgn[0].toAscii().data()); + qDebug("Error: table %s column %s: foreign key target table %s does not exist",m_name.toLatin1().data(),cl.name.toLatin1().data(),fgn[0].toLatin1().data()); return QPair(false,s_col()); } if(!woc->table(fgn[0]).hasColumn(fgn[1])){ - qDebug("Error: table %s column %s: foreign key target table/column %s does not exist",m_name.toAscii().data(),cl.name.toAscii().data(),cl.foreign.toAscii().data()); + qDebug("Error: table %s column %s: foreign key target table/column %s does not exist",m_name.toLatin1().data(),cl.name.toLatin1().data(),cl.foreign.toLatin1().data()); return QPair(false,s_col()); } } @@ -183,7 +183,7 @@ QPair WocTable::parseColumn(const QDomElement&el,QString m if(el2.isNull())continue; QString n=el2.attribute("name"); if(n==""){ - qDebug("Warning: anonymous enum value in table %s column %s. Ignoring it.",m_name.toAscii().data(),cl.name.toAscii().data()); + qDebug("Warning: anonymous enum value in table %s column %s. Ignoring it.",m_name.toLatin1().data(),cl.name.toLatin1().data()); continue; } nxval=el2.attribute("value",QString::number(nxval)).toInt(0,0); diff --git a/woc/proc/proctrans.cpp b/woc/proc/proctrans.cpp index cafba69..1f92e23 100644 --- a/woc/proc/proctrans.cpp +++ b/woc/proc/proctrans.cpp @@ -28,18 +28,18 @@ WocTransaction::WocTransaction(const QDomElement&root) //get basics m_name=root.attribute("name"); if(!rval.exactMatch(m_name)){ - qDebug("Error: invalid transaction name %s.",m_name.toAscii().data()); + qDebug("Error: invalid transaction name %s.",m_name.toLatin1().data()); m_valid=false; return; } - qDebug("Info: parsing transaction %s",m_name.toAscii().data()); + qDebug("Info: parsing transaction %s",m_name.toLatin1().data()); if(root.hasAttribute("mode")){ QString m=root.attribute("mode").toLower(); if(m=="checked")m_mode=Checked;else if(m=="auth")m_mode=Auth;else if(m=="open")m_mode=Open; else{ - qDebug("Error: invalid transaction mode %s in transaction %s, must be checked, auth, or open.",m.toAscii().data(),m_name.toAscii().data()); + qDebug("Error: invalid transaction mode %s in transaction %s, must be checked, auth, or open.",m.toLatin1().data(),m_name.toLatin1().data()); m_valid=false; return; } @@ -60,12 +60,12 @@ WocTransaction::WocTransaction(const QDomElement&root) if(el2.isNull())continue; QString nm=el2.attribute("name"); if(!rval.exactMatch(nm)){ - qDebug("Error: invalid input variable %s in transaction %s.",nm.toAscii().data(),m_name.toAscii().data()); + qDebug("Error: invalid input variable %s in transaction %s.",nm.toLatin1().data(),m_name.toLatin1().data()); m_valid=false; return; } if(hasInput(nm)){ - qDebug("Error: double definition of input variable %s in transaction %s.",nm.toAscii().data(),m_name.toAscii().data()); + qDebug("Error: double definition of input variable %s in transaction %s.",nm.toLatin1().data(),m_name.toLatin1().data()); m_valid=false; return; } @@ -84,7 +84,7 @@ WocTransaction::WocTransaction(const QDomElement&root) if(el.isNull())continue; QString nm=el.attribute("lang"); if(hasCall(nm)){ - qDebug("Error: double definition of input variable %s in transaction %s.",nm.toAscii().data(),m_name.toAscii().data()); + qDebug("Error: double definition of input variable %s in transaction %s.",nm.toLatin1().data(),m_name.toLatin1().data()); m_valid=false; return; } @@ -108,12 +108,12 @@ WocTransaction::WocTransaction(const QDomElement&root) if(el2.isNull())continue; QString nm=el2.attribute("name"); if(!rval.exactMatch(nm)){ - qDebug("Error: invalid output variable %s in transaction %s.",nm.toAscii().data(),m_name.toAscii().data()); + qDebug("Error: invalid output variable %s in transaction %s.",nm.toLatin1().data(),m_name.toLatin1().data()); m_valid=false; return; } if(hasOutput(nm)){ - qDebug("Error: double definition of output variable %s in transaction %s.",nm.toAscii().data(),m_name.toAscii().data()); + qDebug("Error: double definition of output variable %s in transaction %s.",nm.toLatin1().data(),m_name.toLatin1().data()); m_valid=false; return; } diff --git a/woc/qt/qtclass.cpp b/woc/qt/qtclass.cpp index 381caa7..288fcd4 100644 --- a/woc/qt/qtclass.cpp +++ b/woc/qt/qtclass.cpp @@ -39,13 +39,13 @@ void WocQtClass::newClass(const WocClass&cls) MFile src(m_parent->destinationPath()+"/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()); + qDebug("Error: cannot create class files for class %s.",cn.toLatin1().data()); emit errorFound(); return; } //lead in - hdr.write(QByteArray(HDRSTART).replace("%",cna.toAscii())); - src.write(QByteArray(SRCSTART).replace("%",cna.toAscii())); + hdr.write(QByteArray(HDRSTART).replace("%",cna.toLatin1())); + src.write(QByteArray(SRCSTART).replace("%",cna.toLatin1())); QString hcd; QString scd; @@ -60,7 +60,7 @@ void WocQtClass::newClass(const WocClass&cls) QString cnb=cls.baseClass(m_parent->languageSpec(),m_parent->namePrefix()+"O"); hcd+=doxyFormat(cls.docStrings()); hcd+="class "+cna+":public "+cnb+"\n{\n Q_OBJECT\n"; - hdr.write(hcd.toAscii()); + hdr.write(hcd.toLatin1()); //enums classEnums(cls,hdr,src,cna); @@ -88,12 +88,12 @@ void WocQtClass::newClass(const WocClass&cls) //end of class, aux stuff, meta types hdr.write(QByteArray("\n};\n")); - hdr.write(m_aux.toAscii());m_aux.clear(); - src.write(scd.toAscii()); + hdr.write(m_aux.toLatin1());m_aux.clear(); + src.write(scd.toLatin1()); //lead out - hdr.write(QByteArray(HDREND).replace("%",cna.toAscii())); - src.write(QByteArray(SRCEND).replace("%",cna.toAscii())); + hdr.write(QByteArray(HDREND).replace("%",cna.toLatin1())); + src.write(QByteArray(SRCEND).replace("%",cna.toLatin1())); } void WocQtClass::classScripting(const WocClass& cls, MFile& hdr, MFile& src, QString cna,QString cn) @@ -118,8 +118,8 @@ void WocQtClass::classScripting(const WocClass& cls, MFile& hdr, MFile& src, QSt scd+="void "+cn+"::fromScriptValue(const QScriptValue&val,"+cn+"&obj)\n{\n"; scd+="\t"+cn+"*xobj=qobject_cast<"+cn+"*>(val.toQObject());\n"; scd+="\tif(xobj!=0 && &obj!=xobj)obj = *xobj;\n}\n"; - hdr.write(hcd.toAscii()); - src.write(scd.toAscii()); + hdr.write(hcd.toLatin1()); + src.write(scd.toLatin1()); //scripting registry m_parent->addScriptInit( "\tgval.setProperty(\""+cn+"\",engine->newQMetaObject(&"+cn+"::staticMetaObject));\n" @@ -147,7 +147,7 @@ void WocQtClass::classEnums(const WocClass&cls,MFile&hdr,MFile&src,QString cn) hcd+="\tenum "+k[i]+"{\n"; QListev=cls.enumValues(k[i]); if(ev.size()<1){ - qDebug("Error: enums must have at least one member - class %s enum %s",cls.name().toAscii().data(),k[i].toAscii().data()); + qDebug("Error: enums must have at least one member - class %s enum %s",cls.name().toLatin1().data(),k[i].toLatin1().data()); emit errorFound(); return; } @@ -190,8 +190,8 @@ void WocQtClass::classEnums(const WocClass&cls,MFile&hdr,MFile&src,QString cn) } scd+="\treturn \"\";\n}\n"; } - hdr.write(hcd.toAscii()); - src.write(scd.toAscii()); + hdr.write(hcd.toLatin1()); + src.write(scd.toLatin1()); } void WocQtClass::classProperties(const WocClass&cls,MFile&hdr,MFile&) @@ -226,7 +226,7 @@ void WocQtClass::classProperties(const WocClass&cls,MFile&hdr,MFile&) } } //write - hdr.write(hcd.toAscii()); + hdr.write(hcd.toLatin1()); } void WocQtClass::classDeserializer(const WocClass&cls,MFile&hdr,MFile&src,QString cn) @@ -277,7 +277,7 @@ void WocQtClass::classDeserializer(const WocClass&cls,MFile&hdr,MFile&src,QStrin scd+="\t\tadd"+k[i]+"(el.text());\n"; }else if(cls.propertyIsBlob(k[i])){ - scd+="\t\tadd"+k[i]+"(QByteArray::fromBase64(el.text().toAscii()));\n"; + scd+="\t\tadd"+k[i]+"(QByteArray::fromBase64(el.text().toLatin1()));\n"; }else if(cls.propertyIsEnum(k[i])){ scd+="\t\tbool b;\n"; @@ -290,7 +290,7 @@ void WocQtClass::classDeserializer(const WocClass&cls,MFile&hdr,MFile&src,QStrin scd+="\t\tadd"+k[i]+"("+m_parent->namePrefix()+ "O"+cls.propertyPlainType(k[i])+"(el));\n"; }else{ scd+="#error \"Internal Generator error.\"\n"; - qDebug("Error: unable to generate code for property %s of type %s.", k[i].toAscii().data(),cls.propertyType(k[i]).toAscii().data()); + qDebug("Error: unable to generate code for property %s of type %s.", k[i].toLatin1().data(),cls.propertyType(k[i]).toLatin1().data()); emit errorFound(); return; } @@ -319,7 +319,7 @@ void WocQtClass::classDeserializer(const WocClass&cls,MFile&hdr,MFile&src,QStrin scd+="\t\telse throw WDeserializerException(QCoreApplication::translate(\"WobTransaction\",\"Class '%1' property '%2' is enum, invalid value was found.\").arg(\""+cn+"\").arg(\""+k[i]+"\"));\n"; }else{ scd+="#error \"Internal Generator error.\"\n"; - qDebug("Error: unable to generate code for property %s of type %s.",k[i].toAscii().data(),cls.propertyType(k[i]).toAscii().data()); + qDebug("Error: unable to generate code for property %s of type %s.",k[i].toLatin1().data(),cls.propertyType(k[i]).toLatin1().data()); emit errorFound(); return; } @@ -332,13 +332,13 @@ void WocQtClass::classDeserializer(const WocClass&cls,MFile&hdr,MFile&src,QStrin scd+="\t\tset"+k[i]+"(nl.at(0).toElement().text());\n"; }else if(cls.propertyIsBlob(k[i])){ - scd+="\t\tset"+k[i]+ "(QByteArray::fromBase64(nl.at(0).toElement().text().toAscii()));\n"; + scd+="\t\tset"+k[i]+ "(QByteArray::fromBase64(nl.at(0).toElement().text().toLatin1()));\n"; }else if(cls.propertyIsObject(k[i])){ scd+="\t\tset"+k[i]+"("+ m_parent->namePrefix()+ "O"+cls.propertyPlainType(k[i])+ "(nl.at(0).toElement()));\n"; }else{ scd+="#error \"Internal Generator error.\"\n"; - qDebug("Error: unable to generate code for property %s of type %s.",k[i].toAscii().data(),cls.propertyType(k[i]).toAscii().data()); + qDebug("Error: unable to generate code for property %s of type %s.",k[i].toLatin1().data(),cls.propertyType(k[i]).toLatin1().data()); emit errorFound(); return; } @@ -351,8 +351,8 @@ void WocQtClass::classDeserializer(const WocClass&cls,MFile&hdr,MFile&src,QStrin hcd+="\tvirtual ~"+cn+"(){}\n"; //write it... - hdr.write(hcd.toAscii()); - src.write(scd.toAscii()); + hdr.write(hcd.toLatin1()); + src.write(scd.toLatin1()); } void WocQtClass::classSerializers(const WocClass&cls,MFile&hdr,MFile&src,QString cn) @@ -379,7 +379,7 @@ void WocQtClass::classSerializers(const WocClass&cls,MFile&hdr,MFile&src,QString for(int j=0;jdestinationPath()+"/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()); + qDebug("Error: cannot create class files for transaction %s.",cn.toLatin1().data()); emit errorFound(); return; } @@ -86,8 +86,8 @@ void WocQtClientTransaction::newTransaction(const WocTransaction&trn) QtCTrans ct(trn,cn,cnp); initList(ct); //lead in - hdr.write(QByteArray(HDRSTART).replace("%",cn.toAscii())); - src.write(QByteArray(SRCSTART).replace("%",cn.toAscii())); + hdr.write(QByteArray(HDRSTART).replace("%",cn.toLatin1())); + src.write(QByteArray(SRCSTART).replace("%",cn.toLatin1())); //start constructing code @@ -124,15 +124,15 @@ void WocQtClientTransaction::newTransaction(const WocTransaction&trn) ct.scd+="static int mymetatypeid=qRegisterMetaType<"+cn+">();\n"; //write code - hdr.write(ct.hdi.toAscii()); - hdr.write(ct.hcd.toAscii()); - src.write(ct.sri.toAscii()); - src.write(ct.pcd.toAscii()); - src.write(ct.scd.toAscii()); + hdr.write(ct.hdi.toLatin1()); + hdr.write(ct.hcd.toLatin1()); + src.write(ct.sri.toLatin1()); + src.write(ct.pcd.toLatin1()); + src.write(ct.scd.toLatin1()); //lead out - hdr.write(QByteArray(HDREND).replace("%",cn.toAscii())); - src.write(QByteArray(SRCEND).replace("%",cn.toAscii())); + hdr.write(QByteArray(HDREND).replace("%",cn.toLatin1())); + src.write(QByteArray(SRCEND).replace("%",cn.toLatin1())); //memorize documentation for finalize s_transdoc td; @@ -438,7 +438,7 @@ QString WocQtClientTransaction::trnOutput(const WocTransaction&trn) }else if(trn.isBoolType(t)){ code+="\t\tp->out_"+sl[i]+".append(str2bool(nl.at(i).toElement().text()));\n"; }else if(trn.isBlobType(t)){ - code+="\t\tp->out_"+sl[i]+".append(QByteArray::fromBase64(nl.at(i).toElement().text().toAscii()));\n"; + code+="\t\tp->out_"+sl[i]+".append(QByteArray::fromBase64(nl.at(i).toElement().text().toLatin1()));\n"; }else{//can only be string code+="\t\tp->out_"+sl[i]+".append(nl.at(i).toElement().text());\n"; } @@ -448,7 +448,7 @@ QString WocQtClientTransaction::trnOutput(const WocTransaction&trn) if(trn.isObjectType(t)){ code+="\t\ttry{p->out_"+sl[i]+"="+m_parent->qtobjtype(trn,sl[i],WocQtOut::Out)+"(nl.at(0).toElement());}catch(WException e){d->m_stage=Error;d->m_errtype=e.component();d->m_errstr=e.error();log.setError(d->m_errstr);}\n"; }else if(trn.isBlobType(t)){ - code+="\t\tp->out_"+sl[i]+"=QByteArray::fromBase64(nl.at(0).toElement().text().toAscii());\n"; + code+="\t\tp->out_"+sl[i]+"=QByteArray::fromBase64(nl.at(0).toElement().text().toLatin1());\n"; }else{//can only be string code+="\t\tp->out_"+sl[i]+"=nl.at(0).toElement().text();\n"; } diff --git a/woc/qt/qtout.cpp b/woc/qt/qtout.cpp index 21875a1..8eb38ce 100644 --- a/woc/qt/qtout.cpp +++ b/woc/qt/qtout.cpp @@ -34,30 +34,30 @@ WocQtOut::WocQtOut(QDomElement&el) //create project file m_pri.setFileName(m_basedir+"/"+m_subdir+"/"+el.attribute("priInclude","qtwob.pri")); if(!m_pri.open(QIODevice::WriteOnly|QIODevice::Truncate)){ - qDebug("Error: cannot create Qt project file %s.",m_pri.fileName().toAscii().data()); + qDebug("Error: cannot create Qt project file %s.",m_pri.fileName().toLatin1().data()); emit errorFound(); return; } m_pri.write(QByteArray("#AUTOMATICALLY GENERATED FILE - DONT CHANGE!\n")); - m_pri.write(QByteArray("INCLUDEPATH += ")+m_subdir.toAscii()+QByteArray("\n")); + m_pri.write(QByteArray("INCLUDEPATH += ")+m_subdir.toLatin1()+QByteArray("\n")); //create interface class WocProcessor*woc=WocProcessor::instance(); QString pn=woc->projectName(); m_ifacecpp.setFileName(m_basedir+"/"+m_subdir+"/src"+ifaceClassName()+".cpp"); if(!m_ifacecpp.open(QIODevice::WriteOnly|QIODevice::Truncate)){ - qDebug("Error: cannot create Qt interface file %s.",m_ifacecpp.fileName().toAscii().data()); + qDebug("Error: cannot create Qt interface file %s.",m_ifacecpp.fileName().toLatin1().data()); emit errorFound(); return; } m_ifacecpp.write(QByteArray(SRCSTART).replace('%',ifaceClassName())); m_iface.setFileName(m_basedir+"/"+m_subdir+"/src"+ifaceClassName()+".h"); if(!m_iface.open(QIODevice::WriteOnly|QIODevice::Truncate)){ - qDebug("Error: cannot create Qt interface file %s.",m_iface.fileName().toAscii().data()); + qDebug("Error: cannot create Qt interface file %s.",m_iface.fileName().toLatin1().data()); emit errorFound(); return; } - m_iface.write(QByteArray(HDRSTART).replace("%",m_prefix.toAscii()+"INTERFACE_H")); + m_iface.write(QByteArray(HDRSTART).replace("%",m_prefix.toLatin1()+"INTERFACE_H")); m_iface.write(QByteArray("#include \"WInterface\"\n")); m_iface.write(QByteArray("#include \n")); if(m_genscript) @@ -70,19 +70,19 @@ WocQtOut::WocQtOut(QDomElement&el) //version info, static addIfaceHeaderClass(" /// returns version information of this interface\n"); addIfaceHeaderClass(" Q_INVOKABLE static QString staticVersionInfo(WOb::VersionInfo);\n"); - m_ifacecpp.write(QByteArray("#include \""+m_prefix.toAscii()+"IncludeAll\"\n")); + m_ifacecpp.write(QByteArray("#include \""+m_prefix.toLatin1()+"IncludeAll\"\n")); m_ifacecpp.write(QByteArray("#include \"staticVersion.h\"\n")); - m_ifacecpp.write(QString("QString "+ifaceClassName()+"::staticVersionInfo(WOb::VersionInfo vi){return WOCgenerated_versionInfo(vi);}\n").toAscii()); + m_ifacecpp.write(QString("QString "+ifaceClassName()+"::staticVersionInfo(WOb::VersionInfo vi){return WOCgenerated_versionInfo(vi);}\n").toLatin1()); addIfaceHeaderClass(" /// returns version information about the WOC that created the interface class\n"); addIfaceHeaderClass(" Q_INVOKABLE static QString staticWocVersionInfo(WOb::VersionInfo);\n"); - m_ifacecpp.write(QString("QString "+ifaceClassName()+"::staticWocVersionInfo(WOb::VersionInfo vi){return WOCcopied_versionInfo(vi);}\n").toAscii()); + m_ifacecpp.write(QString("QString "+ifaceClassName()+"::staticWocVersionInfo(WOb::VersionInfo vi){return WOCcopied_versionInfo(vi);}\n").toLatin1()); //version info, virtual addIfaceHeaderClass(" /// returns version information of this interface\n"); addIfaceHeaderClass(" Q_INVOKABLE QString versionInfo(WOb::VersionInfo)const;\n"); - m_ifacecpp.write(QString("QString "+ifaceClassName()+"::versionInfo(WOb::VersionInfo vi)const{return WOCgenerated_versionInfo(vi);}\n").toAscii()); + m_ifacecpp.write(QString("QString "+ifaceClassName()+"::versionInfo(WOb::VersionInfo vi)const{return WOCgenerated_versionInfo(vi);}\n").toLatin1()); addIfaceHeaderClass(" /// returns version information about the WOC that created the interface class\n"); addIfaceHeaderClass(" Q_INVOKABLE QString wocVersionInfo(WOb::VersionInfo)const;\n"); - m_ifacecpp.write(QString("QString "+ifaceClassName()+"::wocVersionInfo(WOb::VersionInfo vi)const{return WOCcopied_versionInfo(vi);}\n").toAscii()); + m_ifacecpp.write(QString("QString "+ifaceClassName()+"::wocVersionInfo(WOb::VersionInfo vi)const{return WOCcopied_versionInfo(vi);}\n").toLatin1()); //init scripting initScripting(); @@ -90,11 +90,11 @@ WocQtOut::WocQtOut(QDomElement&el) //create all includer 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()); + qDebug("Error: cannot create Qt header file %s.",m_hdr.fileName().toLatin1().data()); emit errorFound(); return; } - m_hdr.write(QByteArray(HDRSTART).replace("%",m_prefix.toAscii()+"INCLUDE_H")); + m_hdr.write(QByteArray(HDRSTART).replace("%",m_prefix.toLatin1()+"INCLUDE_H")); } WocQtOut::~WocQtOut(){} @@ -110,19 +110,19 @@ void WocQtOut::finalize() addIfaceHeaderClass(" /// use this call to initialize a script engine that needs access to the interface\n"); addIfaceHeaderClass(" void initScriptEngine(QScriptEngine*);\n"); m_scriptcode+="}\n\n"; - m_ifacecpp.write(m_scriptcode.toAscii()); + m_ifacecpp.write(m_scriptcode.toLatin1()); } //generate versionInfo initVersionH(); //add interface class - addFile(ifaceClassName().toAscii()); + addFile(ifaceClassName().toLatin1()); //finish sources m_ifacecpp.write(SRCEND); m_ifacecpp.close(); - m_iface.write(m_iface_prefix.toAscii()); - m_iface.write(m_iface_class.toAscii()); + m_iface.write(m_iface_prefix.toLatin1()); + m_iface.write(m_iface_class.toLatin1()); m_iface.write(QByteArray("};\n")); - m_iface.write(m_postiface.toAscii()); + m_iface.write(m_postiface.toLatin1()); m_iface.write(HDREND); m_iface.close(); m_pri.write(QByteArray("\n#END OF AUTOGENERATED PRI FILE\n")); @@ -135,7 +135,7 @@ void WocQtOut::finalize() QStringList ent=d.entryList(QDir::Files); for(int i=0;idestinationPath()+"/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()); + qDebug("Error: cannot create class files for transaction %s.",cn.toLatin1().data()); emit errorFound(); return; } //basics QtSTrans ct(trn,cn,cnp); //lead in - hdr.write(QByteArray(HDRSTART).replace("%",cn.toAscii())); - src.write(QByteArray(SRCSTART).replace("%",cn.toAscii())); + hdr.write(QByteArray(HDRSTART).replace("%",cn.toLatin1())); + src.write(QByteArray(SRCSTART).replace("%",cn.toLatin1())); //start constructing code @@ -108,15 +108,15 @@ void WocQtServerTransaction::newTransaction(const WocTransaction&trn) ct.scd+="static int mymetatypeid=qRegisterMetaType<"+cn+">();\n"; //write code - hdr.write(ct.hdi.toAscii()); - hdr.write(ct.hcd.toAscii()); - src.write(ct.sri.toAscii()); - src.write(ct.pcd.toAscii()); - src.write(ct.scd.toAscii()); + hdr.write(ct.hdi.toLatin1()); + hdr.write(ct.hcd.toLatin1()); + src.write(ct.sri.toLatin1()); + src.write(ct.pcd.toLatin1()); + src.write(ct.scd.toLatin1()); //lead out - hdr.write(QByteArray(HDREND).replace("%",cn.toAscii())); - src.write(QByteArray(SRCEND).replace("%",cn.toAscii())); + hdr.write(QByteArray(HDREND).replace("%",cn.toLatin1())); + src.write(QByteArray(SRCEND).replace("%",cn.toLatin1())); } void WocQtServerTransaction::genInclude(QtSTrans&ct) @@ -390,7 +390,7 @@ QString WocQtServerTransaction::trnInput(const WocTransaction&trn) }else if(trn.isBoolType(t)){ code+="\t\tp->in_"+sl[i]+".append(str2bool(nl.at(i).toElement().text()));\n"; }else if(trn.isBlobType(t)){ - code+="\t\tp->in_"+sl[i]+".append(QByteArray::fromBase64(nl.at(i).toElement().text().toAscii()));\n"; + code+="\t\tp->in_"+sl[i]+".append(QByteArray::fromBase64(nl.at(i).toElement().text().toLatin1()));\n"; }else{//can only be string code+="\t\tp->in_"+sl[i]+".append(nl.at(i).toElement().text());\n"; } @@ -400,7 +400,7 @@ QString WocQtServerTransaction::trnInput(const WocTransaction&trn) if(trn.isObjectType(t)){ code+="\t\ttry{p->in_"+sl[i]+"="+m_parent->qtobjtype(trn,sl[i],WocQtOut::Out)+"(nl.at(0).toElement());}catch(WException e){d->m_stage=Error;d->m_errtype=e.component();d->m_errstr=e.error();log.setError(d->m_errstr);}\n"; }else if(trn.isBlobType(t)){ - code+="\t\tp->in_"+sl[i]+"=QByteArray::fromBase64(nl.at(0).toElement().text().toAscii());\n"; + code+="\t\tp->in_"+sl[i]+"=QByteArray::fromBase64(nl.at(0).toElement().text().toLatin1());\n"; }else{//can only be string code+="\t\tp->in_"+sl[i]+"=nl.at(0).toElement().text();\n"; } @@ -498,5 +498,5 @@ void WocQtServerTransaction::trnList() code+="\treturn rp;\n}\n"; //write to interface CPP - m_parent->addIfaceImpl(code.toAscii()); + m_parent->addIfaceImpl(code.toLatin1()); } diff --git a/woc/woc.pro b/woc/woc.pro index 9ee072d..d258fa2 100644 --- a/woc/woc.pro +++ b/woc/woc.pro @@ -39,7 +39,7 @@ include(php/php.pri) include(qt/qt.pri) include(soap/soap.pri) -QMAKE_CXXFLAGS += -std=gnu++0x +gcc { QMAKE_CXXFLAGS += -std=gnu++11 } INCLUDEPATH += . ../vinfo ../qtbase/include -- 1.7.2.5