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
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;
}
if(str.size()>500)return false;
//assign
mStatCode=code;
- mStatStr=str.toAscii();
+ mStatStr=str.toLatin1();
return true;
}
ret="Status: "+QByteArray::number(mStatCode)+" "+mStatStr+"\r\n";
QStringList hl=mHead.keys();
for(int i=0;i<hl.size();i++)
- ret+=mHead[hl[i]].first.toAscii()+": "+mHead[hl[i]].second.toAscii()+"\r\n";
+ ret+=mHead[hl[i]].first.toLatin1()+": "+mHead[hl[i]].second.toLatin1()+"\r\n";
//body
ret+="\r\n"+mBody;
//return it
{
QString r;
for(int i=0;i<hl.size();i++)
- r+=QString::fromAscii(hl[i].first)+"="+QString::fromAscii(hl[i].second)+"\n";
+ r+=QString::fromLatin1(hl[i].first)+"="+QString::fromLatin1(hl[i].second)+"\n";
return r;
}
QMap<QString,QString>hdrs=iface->headers(hreq);
QStringList hdrn=hdrs.keys();
for(int i=0;i<hdrn.size();i++)
- req.setRawHeader("X-"+hdrn[i].toAscii(),hdrs[hdrn[i]].toAscii());
- req.setRawHeader("X-WobRequest",hreq.toAscii());
+ req.setRawHeader("X-"+hdrn[i].toLatin1(),hdrs[hdrn[i]].toLatin1());
+ req.setRawHeader("X-WobRequest",hreq.toLatin1());
req.setHeader(QNetworkRequest::ContentLengthHeader,QByteArray::number(data.size()));
req.setHeader(QNetworkRequest::ContentTypeHeader,"application/x-webobject; charset=UTF-8");
//send it (with body)
QString WTransaction::errorString()const
{
- return QCoreApplication::translate("php::",d->m_errstr.toUtf8(),0,QCoreApplication::UnicodeUTF8);
+ return QCoreApplication::translate("php::",d->m_errstr.toUtf8(),0);
}
WTransaction::Stage WTransaction::stage()const{return d->m_stage;}
{
QStringList sl=s.split("\n");
for(int i=0;i<sl.size();i++)
- qDebug("T%i: %s",cnt,sl[i].toAscii().data());
+ qDebug("T%i: %s",cnt,sl[i].toLatin1().data());
}
void WTransaction::Log::setRequ(const QString&h,const QString&d)
//create index file
m_index.setFileName(m_basedir+"/"+m_subdir+"/index.html");
if(!m_index.open(QIODevice::WriteOnly|QIODevice::Truncate)){
- qDebug("Error: cannot create HTML index file %s.",m_index.fileName().toAscii().data());
+ qDebug("Error: cannot create HTML index file %s.",m_index.fileName().toLatin1().data());
emit errorFound();
return;
}
inf+="Database default access mode: "+QString(woc->dbUpdatingDefault()?"updating":"reading")+"<br/>";
inf+="Database Schema Version: "+woc->dbVersion()+"<p/>";
- m_index.write(inf.toAscii());
+ m_index.write(inf.toLatin1());
//write global docu
QStringList dcs=woc->docStrings();
for(int i=0;i<dcs.size();i++){
inf="<p>"+dcs[i]+"</p>\n";
- m_index.write(inf.toAscii());
+ m_index.write(inf.toLatin1());
}
}
qSort(sl);
for(int i=0;i<sl.size();i++)
s+="<li><a href=\"class-"+sl[i]+".html\">"+sl[i]+"</a></li>\n";
- m_index.write(s.toAscii());
+ m_index.write(s.toLatin1());
m_index.write(QByteArray("</ul></td><td valign=\"top\"><ul>"));
sl=WocProcessor::instance()->transactionNames();
qSort(sl);
for(int i=0;i<sl.size();i++)
s+="<li><a href=\"trn-"+sl[i]+".html\">"+sl[i]+"</a></li>\n";
- m_index.write(s.toAscii());
+ m_index.write(s.toLatin1());
m_index.write(QByteArray("</ul></td><td valign=\"top\"><ul>"));
sl=WocProcessor::instance()->tableNames();
qSort(sl);
for(int i=0;i<sl.size();i++)
s+="<li><a href=\"table-"+sl[i]+".html\">"+sl[i]+"</a></li>\n";
- m_index.write(s.toAscii());
+ m_index.write(s.toLatin1());
m_index.write(QByteArray("</ul></td></tr></table>\n"));
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("<html><title>Table "+cn+"</title><body>\n").toAscii());
+ htm.write(QString("<html><title>Table "+cn+"</title><body>\n").toLatin1());
QString hcd;
//table declaration
}
hcd+="</body></html>\n";
- htm.write(hcd.toAscii());
+ htm.write(hcd.toLatin1());
}
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("<html><title>Class "+cn+"</title><body>\n").toAscii());
+ htm.write(QString("<html><title>Class "+cn+"</title><body>\n").toLatin1());
QString hcd;
//class declaration
QStringList doc=cls.docStrings();
for(int i=0;i<doc.size();i++)
hcd+="<p>"+doc[i]+"</p>\n";
- htm.write(hcd.toAscii());
+ htm.write(hcd.toLatin1());
//enums
classEnums(cls,htm);
}
hcd+="</table>\n";
}
- hdr.write(hcd.toAscii());
+ hdr.write(hcd.toLatin1());
}
void WocHtmlOut::classProperties(const WocClass&cls,QFile&hdr)
}
hcd+="</ul>\n";
//write
- hdr.write(hcd.toAscii());
+ hdr.write(hcd.toLatin1());
}
void WocHtmlOut::classMappings(const WocClass&cls,QFile&hdr)
hcd+="</table>\n";
}
- hdr.write(hcd.toAscii());
+ hdr.write(hcd.toLatin1());
}
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;
}
hcd+="</ul>\n";
}
hcd+="</body></html>\n";
- htm.write(hcd.toAscii());
+ htm.write(hcd.toLatin1());
}
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;
}
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();
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";
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";
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";
}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
}
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");
}
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;
}
//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(\"";
//write table class
code+="};\n";
- tf.write(code.toAscii());
+ tf.write(code.toLatin1());
tf.write(PHPEND);
tf.close();
}
//write
- m_schema.write(code.toAscii());
+ m_schema.write(code.toLatin1());
//create autoloading
addLoad("WT"+tbl.name(),"wt_"+tbl.name());
return;
}
m_loader.write(PHPSTART);
- m_loader.write(QString("$d=dirname(__FILE__);\n").toAscii());
+ m_loader.write(QString("$d=dirname(__FILE__);\n").toLatin1());
}
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)
}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
code+="\t$this->commitTransaction();\n}\n";
//direct execution
- code+=trnExecute(trn).toAscii();
+ code+=trnExecute(trn).toLatin1();
return code;
}
default:code+="Wob";break;
}
code+="();}\n\n";
- m_transact.write(code.toAscii());
+ m_transact.write(code.toLatin1());
}
}
code+="\n\t);\n}\n";
- m_transact.write(code.toAscii());
+ m_transact.write(code.toLatin1());
}
void WocPHPTransaction::finalize()
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;
}
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)
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
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"));
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;
}
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;
}
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;
}
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);
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;
}
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<QDomElement> nl3=elementsByTagName(el2,"Call");
}
//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");
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
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');
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<QDomElement> nl=elementsByTagName(tbl,"Column");
for(int i=0;i<nl.size();i++){
QPair<bool,s_col> 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;
}
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;
}
//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());
}
}
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<bool,s_col>(false,s_col());
}
cl.isprime=str2bool(el.attribute("primarykey","0"));
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<bool,s_col>(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<bool,s_col>(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<bool,s_col>(false,s_col());
}
}
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);
//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;
}
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;
}
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;
}
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;
}
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;
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);
//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)
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"
hcd+="\tenum "+k[i]+"{\n";
QList<WocEnum>ev=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;
}
}
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&)
}
}
//write
- hdr.write(hcd.toAscii());
+ hdr.write(hcd.toLatin1());
}
void WocQtClass::classDeserializer(const WocClass&cls,MFile&hdr,MFile&src,QString cn)
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";
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;
}
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;
}
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;
}
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)
for(int j=0;j<p.size();j++){
QStringList pv=p[j].split("/",QString::SkipEmptyParts);
if(pv.size()<1){
- qDebug("Error: encountered empty property while creating serializer for class %s.",cls.name().toAscii().data());
+ qDebug("Error: encountered empty property while creating serializer for class %s.",cls.name().toLatin1().data());
emit errorFound();
return;
}
scd+="\t\tel.appendChild(doc.createTextNode(QString::number(mp_"+prop+"[i])));\n";
scd+="\t\tr.appendChild(el);\n";
}else{
- qDebug("Error: cannot generate serializer for class %s property %s.",cls.name().toAscii().data(),prop.toAscii().data());
+ qDebug("Error: cannot generate serializer for class %s property %s.",cls.name().toLatin1().data(),prop.toLatin1().data());
emit errorFound();
return;
}
scd+="\t\tel.appendChild(doc.createTextNode(mp_"+prop+".value().toBase64()));\n";
scd+="\t\tr.appendChild(el);\n";
}else{
- qDebug("Error: cannot generate serializer for class %s property %s.",cls.name().toAscii().data(),prop.toAscii().data());
+ qDebug("Error: cannot generate serializer for class %s property %s.",cls.name().toLatin1().data(),prop.toLatin1().data());
emit errorFound();
return;
}
}
}
scd+="\n}\n";
- hdr.write(hcd.toAscii());
- src.write(scd.toAscii());
+ hdr.write(hcd.toLatin1());
+ src.write(scd.toLatin1());
}
MFile src(m_parent->destinationPath()+"/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;
}
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
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;
}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";
}
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";
}
//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 <QStringList>\n"));
if(m_genscript)
//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();
//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(){}
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"));
QStringList ent=d.entryList(QDir::Files);
for(int i=0;i<ent.size();i++)
if(!MFile::touchedFile(m_basedir+"/"+m_subdir+"/"+ent[i])){
- qDebug("Info: removing old file %s",ent[i].toAscii().data());
+ qDebug("Info: removing old file %s",ent[i].toLatin1().data());
d.remove(ent[i]);
}
}
{
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 \"%\"\n").replace('%',bn.toAscii()));
+ m_pri.write(code.toLatin1());
+ m_hdr.write(QByteArray("#include \"%\"\n").replace('%',bn.toLatin1()));
MFile wrap(m_basedir+"/"+m_subdir+"/"+bn);
wrap.open();
- wrap.write(QString("#include \"src"+bn+".h\"\n").toAscii());
+ wrap.write(QString("#include \"src"+bn+".h\"\n").toLatin1());
}
void WocQtOut::addFile(WocQtOut::FileType ft,QString fn)
case Header:code="HEADERS+="+m_subdir+"/"+fn+"\n";break;
case Source:code+="SOURCES+="+m_subdir+"/"+fn+"\n";break;
}
- m_pri.write(code.toAscii());
+ m_pri.write(code.toLatin1());
}
void WocQtOut::addProjectLine(QString ln)
{
- m_pri.write(QString(ln+"\n").toAscii());
+ m_pri.write(QString(ln+"\n").toLatin1());
}
if(tp=="blob")r+="QByteArray";else
if(tp=="bool")r+="bool";else
if(tp==""){
- qDebug("Warning: the final type of property %s is empty!",v.toAscii().data());
+ qDebug("Warning: the final type of property %s is empty!",v.toLatin1().data());
r+="void";
}else r+=m_prefix+"O"+tp.split("/",QString::SkipEmptyParts).at(0);
r+=e;r+=" ";
// m_scriptcode="#include <QScriptEngine>\n";
//script converters for nullables
QFile nscr(":/nullscript.cpp");nscr.open(QIODevice::ReadOnly);
- m_scriptcode+=QString::fromAscii(nscr.readAll());
+ m_scriptcode+=QString::fromLatin1(nscr.readAll());
m_scriptcode+="\n\n";
nscr.close();
//initializer routine
MFile vhf;
vhf.setFileName(m_basedir+"/"+m_subdir+"/staticVersion.h");
if(!vhf.open(QIODevice::WriteOnly|QIODevice::Truncate)){
- qDebug("Error: cannot create Qt version info file %s.",vhf.fileName().toAscii().data());
+ qDebug("Error: cannot create Qt version info file %s.",vhf.fileName().toLatin1().data());
emit errorFound();
return;
}
- vhf.write(QByteArray(HDRSTART).replace("%",m_prefix.toAscii()+"STATIC_VERSION_H"));
+ vhf.write(QByteArray(HDRSTART).replace("%",m_prefix.toLatin1()+"STATIC_VERSION_H"));
//generate functions for project's own values
QString data="#include <WOb>\n#include <QString>\n#include <QMap>\n\n"
"static inline QString WOCgenerated_versionInfo(WOb::VersionInfo vi){\nswitch(vi){\n";
void WocQtOut::addIfaceImpl ( const QString& s )
{
- m_ifacecpp.write(s.toAscii());
+ m_ifacecpp.write(s.toLatin1());
}
MFile src(m_parent->destinationPath()+"/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
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)
}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";
}
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";
}
code+="\treturn rp;\n}\n";
//write to interface CPP
- m_parent->addIfaceImpl(code.toAscii());
+ m_parent->addIfaceImpl(code.toLatin1());
}
include(qt/qt.pri)
include(soap/soap.pri)
-QMAKE_CXXFLAGS += -std=gnu++0x
+gcc { QMAKE_CXXFLAGS += -std=gnu++11 }
INCLUDEPATH += . ../vinfo ../qtbase/include