diff options
Diffstat (limited to 'languages/php/phpfile.cpp')
-rw-r--r-- | languages/php/phpfile.cpp | 142 |
1 files changed, 71 insertions, 71 deletions
diff --git a/languages/php/phpfile.cpp b/languages/php/phpfile.cpp index afd741bd..d54028da 100644 --- a/languages/php/phpfile.cpp +++ b/languages/php/phpfile.cpp @@ -17,9 +17,9 @@ */ #include <kapplication.h> -#include <qstring.h> -#include <qfileinfo.h> -#include <qregexp.h> +#include <tqstring.h> +#include <tqfileinfo.h> +#include <tqregexp.h> #include <urlutil.h> #include <kprocess.h> @@ -34,9 +34,9 @@ using namespace std; -PHPFile::PHPFile(PHPSupportPart *phpSupport, const QString& fileName) +PHPFile::PHPFile(PHPSupportPart *phpSupport, const TQString& fileName) { - m_fileinfo = new QFileInfo(fileName); + m_fileinfo = new TQFileInfo(fileName); m_part = phpSupport; modified = true; inClass = FALSE; @@ -44,9 +44,9 @@ PHPFile::PHPFile(PHPSupportPart *phpSupport, const QString& fileName) /* phpCheckProc = new KShellProcess("/bin/sh"); - connect(phpCheckProc, SIGNAL(receivedStdout (KProcess*, char*, int)), this, SLOT(slotReceivedPHPCheckStdout (KProcess*, char*, int))); - connect(phpCheckProc, SIGNAL(receivedStderr (KProcess*, char*, int)), this, SLOT(slotReceivedPHPCheckStderr (KProcess*, char*, int))); - connect(phpCheckProc, SIGNAL(processExited(KProcess*)), this, SLOT(slotPHPCheckExited(KProcess*))); + connect(phpCheckProc, TQT_SIGNAL(receivedStdout (KProcess*, char*, int)), this, TQT_SLOT(slotReceivedPHPCheckStdout (KProcess*, char*, int))); + connect(phpCheckProc, TQT_SIGNAL(receivedStderr (KProcess*, char*, int)), this, TQT_SLOT(slotReceivedPHPCheckStderr (KProcess*, char*, int))); + connect(phpCheckProc, TQT_SIGNAL(processExited(KProcess*)), this, TQT_SLOT(slotPHPCheckExited(KProcess*))); */ } @@ -58,22 +58,22 @@ PHPFile::~PHPFile() // delete phpCheckProc; } -QStringList PHPFile::getContents() +TQStringList PHPFile::getContents() { return m_contents; } -QString PHPFile::fileName() { +TQString PHPFile::fileName() { return m_fileinfo->filePath(); } -QStringList PHPFile::readFromEditor() +TQStringList PHPFile::readFromEditor() { - QStringList contents; + TQStringList contents; kapp->lock(); - QPtrList<KParts::Part> parts( *m_part->partController()->parts() ); - QPtrListIterator<KParts::Part> it( parts ); + TQPtrList<KParts::Part> parts( *m_part->partController()->parts() ); + TQPtrListIterator<KParts::Part> it( parts ); while( it.current() ){ KTextEditor::Document* doc = dynamic_cast<KTextEditor::Document*>( it.current() ); ++it; @@ -82,7 +82,7 @@ QStringList PHPFile::readFromEditor() if ( !doc || !editIface || doc->url().path() != fileName() ) continue; - contents = QStringList::split("\n", editIface->text().ascii(), true); + contents = TQStringList::split("\n", editIface->text().ascii(), true); break; } kapp->unlock(); @@ -90,15 +90,15 @@ QStringList PHPFile::readFromEditor() return contents; } -QStringList PHPFile::readFromDisk() +TQStringList PHPFile::readFromDisk() { - QStringList contents; - QFile f( fileName() ); + TQStringList contents; + TQFile f( fileName() ); if (f.open(IO_ReadOnly)) { - QTextStream stream( &f ); - QStringList list; - QString rawline; + TQTextStream stream( &f ); + TQStringList list; + TQString rawline; while (!stream.eof()) { rawline = stream.readLine(); contents.append(rawline.stripWhiteSpace().local8Bit()); @@ -137,11 +137,11 @@ void PHPFile::Analyse() { postEvent( new FileParseEvent( Event_EndParse, this->fileName() ) ); } -bool PHPFile::ParseClass(QString line, int lineNo) { +bool PHPFile::ParseClass(TQString line, int lineNo) { if (line.find("class ", 0, FALSE) == -1) return FALSE; - QRegExp Class("^[ \t]*(abstract|final|)[ \t]*class[ \t]+([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)[ \t]*(extends[ \t]*([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*))?.*$"); + TQRegExp Class("^[ \t]*(abstract|final|)[ \t]*class[ \t]+([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)[ \t]*(extends[ \t]*([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*))?.*$"); Class.setCaseSensitive(FALSE); if (Class.search(line) != -1) { @@ -158,11 +158,11 @@ bool PHPFile::ParseClass(QString line, int lineNo) { return FALSE; } -bool PHPFile::ParseFunction(QString line, int lineNo) { +bool PHPFile::ParseFunction(TQString line, int lineNo) { if (line.find("function", 0, FALSE) == -1) return FALSE; - QRegExp function("^[ \t]*(final|abstract|static|)[ \t]*(public|private|protected|)[ \t]*(static|)[ \t]*function[ \t&]*([_a-zA-Z\x7f-\xff][_a-zA-Z0-9\x7f-\xff]*)[ \t]*\\(([_a-zA-Z\x7f-\xff]*[_$, &'\\\"0-9A-Za-z\x7f-\xff\t-=]*)\\).*$"); + TQRegExp function("^[ \t]*(final|abstract|static|)[ \t]*(public|private|protected|)[ \t]*(static|)[ \t]*function[ \t&]*([_a-zA-Z\x7f-\xff][_a-zA-Z0-9\x7f-\xff]*)[ \t]*\\(([_a-zA-Z\x7f-\xff]*[_$, &'\\\"0-9A-Za-z\x7f-\xff\t-=]*)\\).*$"); function.setCaseSensitive(FALSE); if (function.search(line) != -1) { @@ -197,11 +197,11 @@ bool PHPFile::ParseFunction(QString line, int lineNo) { return FALSE; } -bool PHPFile::ParseVariable(QString line, int lineNo) { +bool PHPFile::ParseVariable(TQString line, int lineNo) { if (line.find("var") == -1 && line.find("public") == -1 && line.find("private") == -1 && line.find("protected") == -1) return FALSE; - QRegExp variable("^[ \t]*(var|public|private|protected|static)[ \t]*\\$([a-zA-Z_\x7f-\xff][0-9A-Za-z_\x7f-\xff]*)[ \t;=].*$"); + TQRegExp variable("^[ \t]*(var|public|private|protected|static)[ \t]*\\$([a-zA-Z_\x7f-\xff][0-9A-Za-z_\x7f-\xff]*)[ \t;=].*$"); variable.setCaseSensitive(FALSE); if (variable.search(line) != -1) { @@ -226,11 +226,11 @@ bool PHPFile::ParseVariable(QString line, int lineNo) { return FALSE; } -bool PHPFile::ParseThisMember(QString line, int lineNo) { +bool PHPFile::ParseThisMember(TQString line, int lineNo) { if (line.find("$this->", 0, FALSE) == -1) return FALSE; - QRegExp createthis; + TQRegExp createthis; createthis.setCaseSensitive(FALSE); createthis.setPattern("\\$this->([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)[ \t]*=[ \t]*([0-9]*)[ \t]*;"); @@ -270,13 +270,13 @@ bool PHPFile::ParseThisMember(QString line, int lineNo) { return FALSE; } -bool PHPFile::ParseMember(QString line, int lineNo) { +bool PHPFile::ParseMember(TQString line, int lineNo) { if (line.find("$", 0, FALSE) == -1) return FALSE; /// @todo Ajouter plus de test .... - QRegExp createmember; + TQRegExp createmember; createmember.setCaseSensitive(FALSE); createmember.setPattern("\\$([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)[ \t]*=[ \t]*([0-9]*)[ \t]*;"); @@ -323,18 +323,18 @@ bool PHPFile::ParseMember(QString line, int lineNo) { return FALSE; } -bool PHPFile::ParseReturn(QString line, int lineNo) { - QString rettype; +bool PHPFile::ParseReturn(TQString line, int lineNo) { + TQString rettype; if (line.find("return", 0, FALSE) == -1) return FALSE; - QRegExp typeex; + TQRegExp typeex; typeex.setCaseSensitive(FALSE); typeex.setPattern("return[ \t]*(\\(|)([a-zA-Z_\x7f-\xff$][a-zA-Z0-9_\x7f-\xff]*)(\\)|)[ \t]*;"); if (typeex.search(line) != -1) { - QString varname = typeex.cap(2).ascii(); + TQString varname = typeex.cap(2).ascii(); rettype = varname; if (varname.find("$") == 0) { @@ -342,7 +342,7 @@ bool PHPFile::ParseReturn(QString line, int lineNo) { /* varname = varname.mid(1); - QValueList<Action *>::ConstIterator it = m_vars.begin(); + TQValueList<Action *>::ConstIterator it = m_vars.begin(); while ( it != m_vars.end() ) { Action *p = *it++; @@ -365,11 +365,11 @@ bool PHPFile::ParseReturn(QString line, int lineNo) { return TRUE; } -bool PHPFile::ParseTodo(QString line, int lineNo) { +bool PHPFile::ParseTodo(TQString line, int lineNo) { if (line.find("todo", 0, FALSE) == -1) return FALSE; - QRegExp todo("/[/]+[ \t]*[@]*todo([ \t]*:[ \t]*|[ \t]*)[ \t]*(.*)$"); + TQRegExp todo("/[/]+[ \t]*[@]*todo([ \t]*:[ \t]*|[ \t]*)[ \t]*(.*)$"); todo.setCaseSensitive(FALSE); if (todo.search(line) != -1) { @@ -380,11 +380,11 @@ bool PHPFile::ParseTodo(QString line, int lineNo) { return FALSE; } -bool PHPFile::ParseFixme(QString line, int lineNo) { +bool PHPFile::ParseFixme(TQString line, int lineNo) { if (line.find("fixme", 0, FALSE) == -1) return FALSE; - QRegExp fixme("/[/]+[ \t]*[@]*fixme([ \t]*:[ \t]*|[ \t]*)[ \t]*(.*)$"); + TQRegExp fixme("/[/]+[ \t]*[@]*fixme([ \t]*:[ \t]*|[ \t]*)[ \t]*(.*)$"); fixme.setCaseSensitive(FALSE); if (fixme.search(line) != -1) { @@ -396,34 +396,34 @@ bool PHPFile::ParseFixme(QString line, int lineNo) { } void PHPFile::ParseSource() { - QString line; + TQString line; int lineNo = 0; int bracketOpen = 0; int bracketClose = 0; int bracketFuncOpen = 0; int bracketFuncClose = 0; - QRegExp includere("^[ \t]*(include|require|include_once|require_once)[ \t]*(\\(|)[ \t]*[\"'](.*)[\"'][ \t]*(\\)|)[ \t]*;$"); + TQRegExp includere("^[ \t]*(include|require|include_once|require_once)[ \t]*(\\(|)[ \t]*[\"'](.*)[\"'][ \t]*(\\)|)[ \t]*;$"); includere.setCaseSensitive(FALSE); - for ( QStringList::Iterator it = m_contents.begin(); it != m_contents.end(); ++it ) { + for ( TQStringList::Iterator it = m_contents.begin(); it != m_contents.end(); ++it ) { line = (*it).local8Bit(); if (!line.isNull()) { if (line.find("include", 0, FALSE) != -1 || line.find("require", 0, FALSE) != -1) { if (includere.search(line) != -1) { - QStringList include_path; + TQStringList include_path; include_path = include_path.split(":", m_part->getIncludePath()); include_path.append(URLUtil::directory(fileName()) + "/"); include_path.append(""); - QStringList list = includere.capturedTexts(); + TQStringList list = includere.capturedTexts(); - for ( QStringList::Iterator it = include_path.begin(); it != include_path.end(); ++it ) { - QString abso = URLUtil::canonicalPath(*it + "/" + list[3]); + for ( TQStringList::Iterator it = include_path.begin(); it != include_path.end(); ++it ) { + TQString abso = URLUtil::canonicalPath(*it + "/" + list[3]); if (!abso.isNull()) { - QString rel = URLUtil::relativePathToFile (m_part->project()->projectDirectory(), abso); + TQString rel = URLUtil::relativePathToFile (m_part->project()->projectDirectory(), abso); postEvent( new FileParseEvent( Event_AddFile, abso ) ); } } @@ -492,7 +492,7 @@ void PHPFile::PHPCheck() { /* char buf[255]; - FILE *fd = popen(QString(m_phpSupport->getExePath() + " -l -f " + KShellProcess::quote(fileName())).ascii(), "r"); + FILE *fd = popen(TQString(m_phpSupport->getExePath() + " -l -f " + KShellProcess::quote(fileName())).ascii(), "r"); while (!feof(fd)) { memset(buf, 0, 255); fgets(buf, 255, fd); @@ -507,12 +507,12 @@ void PHPFile::PHPCheck() { /* void PHPFile::slotReceivedPHPCheckStdout (KProcess* proc, char* buffer, int buflen) { kdDebug(9018) << "slotPHPExeStdout()" << endl; - m_phpCheckOutput += QString::fromLocal8Bit(buffer,buflen+1); + m_phpCheckOutput += TQString::fromLocal8Bit(buffer,buflen+1); } void PHPFile::slotReceivedPHPCheckStderr (KProcess* proc, char* buffer, int buflen) { kdDebug(9018) << "slotPHPExeStderr()" << endl; - m_phpCheckOutput += QString::fromLocal8Bit(buffer,buflen+1); + m_phpCheckOutput += TQString::fromLocal8Bit(buffer,buflen+1); } void PHPFile::slotPHPCheckExited (KProcess* proc) { @@ -520,15 +520,15 @@ void PHPFile::slotPHPCheckExited (KProcess* proc) { } */ -void PHPFile::ParseStdout(QString phpOutput) { +void PHPFile::ParseStdout(TQString phpOutput) { kdDebug(9018) << "ParseStdout()" << endl; - QRegExp parseError("^(<b>|)Parse error(</b>|): parse error, (.*) in (<b>|)(.*)(</b>|) on line (<b>|)(.*)(</b>|).*$"); - QRegExp undefFunctionError("^(<b>|)Fatal error(</b>|): Call to undefined function: (.*) in (<b>|)(.*)(</b>|) on line (<b>|)(.*)(</b>|).*$"); - QRegExp warning("^(<b>|)Warning(</b>|): (<b>|)(.*)(</b>|) in (.*) on line (<b>|)(.*)(</b>|).*$"); - QRegExp generalFatalError("^(<b>|)Fatal error(</b>|): (.*) in (<b>|)(.*)(</b>|) on line (<b>|)(.*)(</b>|).*$"); + TQRegExp parseError("^(<b>|)Parse error(</b>|): parse error, (.*) in (<b>|)(.*)(</b>|) on line (<b>|)(.*)(</b>|).*$"); + TQRegExp undefFunctionError("^(<b>|)Fatal error(</b>|): Call to undefined function: (.*) in (<b>|)(.*)(</b>|) on line (<b>|)(.*)(</b>|).*$"); + TQRegExp warning("^(<b>|)Warning(</b>|): (<b>|)(.*)(</b>|) in (.*) on line (<b>|)(.*)(</b>|).*$"); + TQRegExp generalFatalError("^(<b>|)Fatal error(</b>|): (.*) in (<b>|)(.*)(</b>|) on line (<b>|)(.*)(</b>|).*$"); - QStringList list = QStringList::split("\n", phpOutput); - QStringList::Iterator it; + TQStringList list = TQStringList::split("\n", phpOutput); + TQStringList::Iterator it; for ( it = list.begin(); it != list.end(); ++it ) { if (generalFatalError.search(*it) >= 0) { // m_errorview->reportProblem(Error, parseError.cap(5), parseError.cap(8).toInt(), parseError.cap(3)); @@ -546,9 +546,9 @@ void PHPFile::ParseStdout(QString phpOutput) { } /* -ClassDom PHPFile::classByName(QString filename, QString classname) { - QValueList<ClassDom> CList; - QString abso = URLUtil::canonicalPath(filename); +ClassDom PHPFile::classByName(TQString filename, TQString classname) { + TQValueList<ClassDom> CList; + TQString abso = URLUtil::canonicalPath(filename); ClassList classList = m_model->globalNamespace()->classList(); ClassList::Iterator classIt; @@ -560,8 +560,8 @@ ClassDom PHPFile::classByName(QString filename, QString classname) { return NULL; } -QValueList<ClassDom> PHPFile::classByName(QString classname) { - QValueList<ClassDom> CList; +TQValueList<ClassDom> PHPFile::classByName(TQString classname) { + TQValueList<ClassDom> CList; ClassList classList = m_model->globalNamespace()->classList(); @@ -580,13 +580,13 @@ void PHPFile::postEvent(FileParseEvent *event) { usleep(100); } -bool PHPFile::AddClass(QString name, QString extends, int start) { +bool PHPFile::AddClass(TQString name, TQString extends, int start) { postEvent( new FileParseEvent( Event_AddClass, this->fileName(), name, extends, start ) ); inClass = TRUE; return TRUE; } -bool PHPFile::SetClass(QString arguments) { +bool PHPFile::SetClass(TQString arguments) { postEvent( new FileParseEvent( Event_SetClass, this->fileName(), "", arguments ) ); return TRUE; } @@ -597,13 +597,13 @@ bool PHPFile::CloseClass(int end) { return TRUE; } -bool PHPFile::AddFunction(QString name, QString arguments, int start) { +bool PHPFile::AddFunction(TQString name, TQString arguments, int start) { postEvent( new FileParseEvent( Event_AddFunction, this->fileName(), name, arguments, start ) ); inMethod = TRUE; return TRUE; } -bool PHPFile::SetFunction(QString name, QString arguments) { +bool PHPFile::SetFunction(TQString name, TQString arguments) { postEvent( new FileParseEvent( Event_SetFunction, this->fileName(), name, arguments ) ); return TRUE; } @@ -614,23 +614,23 @@ bool PHPFile::CloseFunction(int end) { return TRUE; } -bool PHPFile::AddVariable(QString name, QString type, int position, bool classvar) { +bool PHPFile::AddVariable(TQString name, TQString type, int position, bool classvar) { postEvent( new FileParseEvent( Event_AddVariable, this->fileName(), name, type, position, classvar ) ); return TRUE; } -bool PHPFile::SetVariable(QString arguments) { +bool PHPFile::SetVariable(TQString arguments) { postEvent( new FileParseEvent( Event_SetVariable, this->fileName(), "", arguments ) ); return TRUE; } -bool PHPFile::AddTodo(QString arguments, int position) { +bool PHPFile::AddTodo(TQString arguments, int position) { postEvent( new FileParseEvent( Event_AddTodo, this->fileName(), "", arguments, position ) ); inClass = TRUE; return TRUE; } -bool PHPFile::AddFixme(QString arguments, int position) { +bool PHPFile::AddFixme(TQString arguments, int position) { postEvent( new FileParseEvent( Event_AddFixme, this->fileName(), "", arguments, position ) ); inClass = TRUE; return TRUE; |