summaryrefslogtreecommitdiffstats
path: root/languages/php/phpcodecompletion.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:56:07 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:56:07 +0000
commitd6f8bbb45b267065a6907e71ff9c98bb6d161241 (patch)
treed109539636691d7b03036ca1c0ed29dbae6577cf /languages/php/phpcodecompletion.cpp
parent3331a47a9cad24795c7440ee8107143ce444ef34 (diff)
downloadtdevelop-d6f8bbb45b267065a6907e71ff9c98bb6d161241.tar.gz
tdevelop-d6f8bbb45b267065a6907e71ff9c98bb6d161241.zip
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdevelop@1157658 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'languages/php/phpcodecompletion.cpp')
-rw-r--r--languages/php/phpcodecompletion.cpp174
1 files changed, 87 insertions, 87 deletions
diff --git a/languages/php/phpcodecompletion.cpp b/languages/php/phpcodecompletion.cpp
index c9bd7213..b2b1eb33 100644
--- a/languages/php/phpcodecompletion.cpp
+++ b/languages/php/phpcodecompletion.cpp
@@ -26,9 +26,9 @@
#include <kstandarddirs.h>
#include <kdebug.h>
-#include <qfile.h>
-#include <qtextstream.h>
-#include <qregexp.h>
+#include <tqfile.h>
+#include <tqtextstream.h>
+#include <tqregexp.h>
#include <iostream>
@@ -36,7 +36,7 @@
using namespace std;
-PHPCodeCompletion::PHPCodeCompletion(PHPSupportPart *phpSupport, PHPConfigData *config) : QObject(), m_cursorInterface(0), m_codeInterface(0), m_editInterface(0), m_selectionInterface(0) {
+PHPCodeCompletion::PHPCodeCompletion(PHPSupportPart *phpSupport, PHPConfigData *config) : TQObject(), m_cursorInterface(0), m_codeInterface(0), m_editInterface(0), m_selectionInterface(0) {
m_phpSupport = phpSupport;
m_config = config;
@@ -52,21 +52,21 @@ PHPCodeCompletion::~PHPCodeCompletion(){
void PHPCodeCompletion::readGlobalPHPFunctionsFile(){
KStandardDirs *dirs = PHPSupportFactory::instance()->dirs();
- QString phpFuncFile = dirs->findResource("data","kdevphpsupport/phpfunctions");
- QRegExp lineReg(":([0-9A-Za-z_]+) ([0-9A-Za-z_]+)\\((.*)\\)");
+ TQString phpFuncFile = dirs->findResource("data","kdevphpsupport/phpfunctions");
+ TQRegExp lineReg(":([0-9A-Za-z_]+) ([0-9A-Za-z_]+)\\((.*)\\)");
FunctionCompletionEntry e;
- QFile f(phpFuncFile);
+ TQFile f(phpFuncFile);
if ( f.open(IO_ReadOnly) ) { // file opened successfully
- QTextStream t( &f ); // use a text stream
- QString s;
+ TQTextStream t( &f ); // use a text stream
+ TQString s;
while ( !t.eof() ) { // until end of file...
s = t.readLine(); // line of text excluding '\n'
if (lineReg.search(s.local8Bit()) != -1) {
e.prefix = lineReg.cap(1);
e.text = lineReg.cap(2);
- e.postfix = "(" + QString(lineReg.cap(3)) + ")";
- e.prototype = QString(lineReg.cap(1)) + " " + QString(lineReg.cap(2)) + "(" + QString(lineReg.cap(3)) + ")";
+ e.postfix = "(" + TQString(lineReg.cap(3)) + ")";
+ e.prototype = TQString(lineReg.cap(1)) + " " + TQString(lineReg.cap(2)) + "(" + TQString(lineReg.cap(3)) + ")";
m_globalFunctions.append(e);
}
}
@@ -119,11 +119,11 @@ void PHPCodeCompletion::setActiveEditorPart(KParts::Part *part)
}
disconnect(part->widget(), 0, this, 0 ); // to make sure that it is't connected twice
-// connect(part->widget(), SIGNAL(cursorPositionChanged()), this, SLOT(cursorPositionChanged()));
- connect( part, SIGNAL(textChanged()), this, SLOT(cursorPositionChanged()) );
- connect(part->widget(), SIGNAL(argHintHidden()), this, SLOT(argHintHided()));
- connect(part->widget(), SIGNAL(completionAborted()), this, SLOT(completionBoxHided()));
- connect(part->widget(), SIGNAL(completionDone()), this, SLOT(completionBoxHided()));
+// connect(part->widget(), TQT_SIGNAL(cursorPositionChanged()), this, TQT_SLOT(cursorPositionChanged()));
+ connect( part, TQT_SIGNAL(textChanged()), this, TQT_SLOT(cursorPositionChanged()) );
+ connect(part->widget(), TQT_SIGNAL(argHintHidden()), this, TQT_SLOT(argHintHided()));
+ connect(part->widget(), TQT_SIGNAL(completionAborted()), this, TQT_SLOT(completionBoxHided()));
+ connect(part->widget(), TQT_SIGNAL(completionDone()), this, TQT_SLOT(completionBoxHided()));
}
void PHPCodeCompletion::cursorPositionChanged(){
@@ -135,7 +135,7 @@ void PHPCodeCompletion::cursorPositionChanged(){
kdDebug(9018) << "cursorPositionChanged:" << line << ":" << col << endl;
m_currentLine = line;
- QString lineStr = m_editInterface->textLine(line);
+ TQString lineStr = m_editInterface->textLine(line);
if (lineStr.isNull() || lineStr.isEmpty()) {
return;
}
@@ -147,11 +147,11 @@ void PHPCodeCompletion::cursorPositionChanged(){
if (m_config->getCodeHinting()) {
int pos1 = lineStr.findRev("(", col - 1);
- int pos2 = lineStr.findRev(QRegExp("[ \\t=;\\$\\.\\(\\)]"), pos1 - 1);
+ int pos2 = lineStr.findRev(TQRegExp("[ \\t=;\\$\\.\\(\\)]"), pos1 - 1);
int pos3 = lineStr.findRev(")", col);
if (pos1 > pos2 && pos1 != -1 && pos3 < pos1) {
- QString line = lineStr.mid(pos2 + 1, pos1 - pos2 - 1).stripWhiteSpace();
+ TQString line = lineStr.mid(pos2 + 1, pos1 - pos2 - 1).stripWhiteSpace();
checkForArgHint(line, col);
kdDebug(9018) << "end checkForArgHint" << endl;
}
@@ -163,8 +163,8 @@ void PHPCodeCompletion::cursorPositionChanged(){
return;
}
- int pos = lineStr.findRev(QRegExp("[ \\t=;\\$\\.\\(\\)]"), col - 1);
- QString line = lineStr.mid(pos + 1, col - pos).stripWhiteSpace();
+ int pos = lineStr.findRev(TQRegExp("[ \\t=;\\$\\.\\(\\)]"), col - 1);
+ TQString line = lineStr.mid(pos + 1, col - pos).stripWhiteSpace();
if (checkForVariable(line, col)) {
kdDebug(9018) << "end checkForVariable" << endl;
@@ -180,7 +180,7 @@ kdDebug(9018) << "end checkForGlobalFunction" << endl;
return;
}
- pos = lineStr.stripWhiteSpace().findRev(QRegExp("[ \\t=;\\$\\.\\(\\)]"), col - 1);
+ pos = lineStr.stripWhiteSpace().findRev(TQRegExp("[ \\t=;\\$\\.\\(\\)]"), col - 1);
line = lineStr.mid(pos + 1, col - pos);
if (checkForNew(line, col)) {
@@ -196,7 +196,7 @@ kdDebug(9018) << "end checkFor" << endl;
}
}
-bool PHPCodeCompletion::showCompletionBox(QValueList<KTextEditor::CompletionEntry> list, unsigned long max) {
+bool PHPCodeCompletion::showCompletionBox(TQValueList<KTextEditor::CompletionEntry> list, unsigned long max) {
if (list.count() > 0) {
if (list.count() == 1) {
KTextEditor::CompletionEntry e = list.first();
@@ -210,19 +210,19 @@ bool PHPCodeCompletion::showCompletionBox(QValueList<KTextEditor::CompletionEntr
return false;
}
-bool PHPCodeCompletion::checkForStaticFunction(QString line, int col) {
+bool PHPCodeCompletion::checkForStaticFunction(TQString line, int col) {
kdDebug(9018) << "checkForStaticFunction" << endl;
- QValueList<KTextEditor::CompletionEntry> list;
+ TQValueList<KTextEditor::CompletionEntry> list;
if (line.find("::") == -1)
return false;
- QRegExp Class("([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)::([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*|)");
+ TQRegExp Class("([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)::([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*|)");
Class.setCaseSensitive(FALSE);
if (Class.search(line) != -1) {
- QString classname = Class.cap(1);
- QString function = Class.cap(2);
+ TQString classname = Class.cap(1);
+ TQString function = Class.cap(2);
ClassList classList = getClassByName(classname);
@@ -248,8 +248,8 @@ bool PHPCodeCompletion::checkForStaticFunction(QString line, int col) {
}
if (nClass->baseClassList().count() != 0) {
- QStringList base = nClass->baseClassList();
- QStringList::Iterator nameIt;
+ TQStringList base = nClass->baseClassList();
+ TQStringList::Iterator nameIt;
for (nameIt = base.begin(); nameIt != base.end(); ++nameIt) {
ClassList baseList = getClassByName(*nameIt);
ClassList::Iterator baseIt;
@@ -263,14 +263,14 @@ bool PHPCodeCompletion::checkForStaticFunction(QString line, int col) {
return false;
}
-bool PHPCodeCompletion::checkForNew(QString line, int col){
+bool PHPCodeCompletion::checkForNew(TQString line, int col){
kdDebug(9018) << "checkForNew" << endl;
- QValueList<KTextEditor::CompletionEntry> list;
+ TQValueList<KTextEditor::CompletionEntry> list;
if (line.find("new ", 0, FALSE) == -1)
return false;
- QRegExp New("[& \t]*new[ \t]+([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*|)");
+ TQRegExp New("[& \t]*new[ \t]+([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*|)");
New.setCaseSensitive(FALSE);
if (New.search(line) != -1) {
@@ -293,14 +293,14 @@ bool PHPCodeCompletion::checkForNew(QString line, int col){
return false;
}
-bool PHPCodeCompletion::checkForExtends(QString line, int col){
+bool PHPCodeCompletion::checkForExtends(TQString line, int col){
kdDebug(9018) << "checkForExtends" << endl;
- QValueList<KTextEditor::CompletionEntry> list;
+ TQValueList<KTextEditor::CompletionEntry> list;
if (line.find("extends", 0, FALSE) == -1)
return false;
- QRegExp extends("[ \t]*extends[ \t]+([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*|)");
+ TQRegExp extends("[ \t]*extends[ \t]+([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*|)");
extends.setCaseSensitive(FALSE);
if (extends.search(line) != -1) {
@@ -311,10 +311,10 @@ bool PHPCodeCompletion::checkForExtends(QString line, int col){
return false;
}
-bool PHPCodeCompletion::checkForVariable(QString line, int col){
+bool PHPCodeCompletion::checkForVariable(TQString line, int col){
kdDebug(9018) << "checkForVariable" << endl;
- QValueList<KTextEditor::CompletionEntry> list;
- QString args;
+ TQValueList<KTextEditor::CompletionEntry> list;
+ TQString args;
if (line.find("->") == -1) {
return false;
@@ -326,10 +326,10 @@ bool PHPCodeCompletion::checkForVariable(QString line, int col){
line = line.mid(0, pos);
}
- QStringList vars = QStringList::split("->", line);
- QString classname;
+ TQStringList vars = TQStringList::split("->", line);
+ TQString classname;
- for ( QStringList::Iterator it = vars.begin(); it != vars.end(); ++it ) {
+ for ( TQStringList::Iterator it = vars.begin(); it != vars.end(); ++it ) {
classname = getClassName(*it, classname);
}
@@ -343,9 +343,9 @@ bool PHPCodeCompletion::checkForVariable(QString line, int col){
return showCompletionBox(list, args.length());
}
-bool PHPCodeCompletion::checkForGlobalFunction(QString line, int col) {
+bool PHPCodeCompletion::checkForGlobalFunction(TQString line, int col) {
kdDebug(9018) << "checkForGlobalFunction(" + line + "," << col << endl;
- QValueList<KTextEditor::CompletionEntry> list;
+ TQValueList<KTextEditor::CompletionEntry> list;
if (line.length() < 3)
return false;
@@ -354,9 +354,9 @@ bool PHPCodeCompletion::checkForGlobalFunction(QString line, int col) {
return showCompletionBox(list, line.length());
}
-QValueList<KTextEditor::CompletionEntry> PHPCodeCompletion::getClasses(QString name) {
- QValueList<KTextEditor::CompletionEntry> list;
- QStringList added;
+TQValueList<KTextEditor::CompletionEntry> PHPCodeCompletion::getClasses(TQString name) {
+ TQValueList<KTextEditor::CompletionEntry> list;
+ TQStringList added;
ClassList classList = m_model->globalNamespace()->classList();
ClassList::Iterator classIt;
@@ -365,7 +365,7 @@ QValueList<KTextEditor::CompletionEntry> PHPCodeCompletion::getClasses(QString n
if (name == NULL || name.isEmpty() || nClass->name().startsWith(name, FALSE)) {
KTextEditor::CompletionEntry e;
- QStringList::Iterator it = added.find(nClass->name());
+ TQStringList::Iterator it = added.find(nClass->name());
if (it == added.end()) {
e.text = nClass->name();
list.append(e);
@@ -376,12 +376,12 @@ QValueList<KTextEditor::CompletionEntry> PHPCodeCompletion::getClasses(QString n
return list;
}
-QValueList<KTextEditor::CompletionEntry> PHPCodeCompletion::getFunctionsAndVars(QString classname, QString function) {
+TQValueList<KTextEditor::CompletionEntry> PHPCodeCompletion::getFunctionsAndVars(TQString classname, TQString function) {
kdDebug(9018) << "getFunctionsAndVars " << classname << endl;
- QValueList<KTextEditor::CompletionEntry> list;
+ TQValueList<KTextEditor::CompletionEntry> list;
if (classname.isEmpty()) {
- QValueList<FunctionCompletionEntry>::Iterator it;
+ TQValueList<FunctionCompletionEntry>::Iterator it;
for( it = m_globalFunctions.begin(); it != m_globalFunctions.end(); ++it ) {
if((*it).text.startsWith(function, FALSE)){
KTextEditor::CompletionEntry e;
@@ -440,8 +440,8 @@ QValueList<KTextEditor::CompletionEntry> PHPCodeCompletion::getFunctionsAndVars(
}
if (nClass->baseClassList().count() != 0) {
- QStringList base = nClass->baseClassList();
- QStringList::Iterator nameIt;
+ TQStringList base = nClass->baseClassList();
+ TQStringList::Iterator nameIt;
for (nameIt = base.begin(); nameIt != base.end(); ++nameIt) {
ClassList baseList = getClassByName(*nameIt);
ClassList::Iterator baseIt;
@@ -453,12 +453,12 @@ QValueList<KTextEditor::CompletionEntry> PHPCodeCompletion::getFunctionsAndVars(
return list;
}
-QStringList PHPCodeCompletion::getArguments(QString classname, QString function) {
+TQStringList PHPCodeCompletion::getArguments(TQString classname, TQString function) {
kdDebug(9018) << "getArguments " << function << endl;
- QStringList list;
+ TQStringList list;
if (classname.isEmpty()) {
- QValueList<FunctionCompletionEntry>::Iterator it;
+ TQValueList<FunctionCompletionEntry>::Iterator it;
for( it = m_globalFunctions.begin(); it != m_globalFunctions.end(); ++it ) {
if((*it).text.lower() == function.lower()){
KTextEditor::CompletionEntry e = (*it);
@@ -472,7 +472,7 @@ QStringList PHPCodeCompletion::getArguments(QString classname, QString function)
if ((*methodIt)->name().lower() == function.lower()){
KTextEditor::CompletionEntry e;
ArgumentDom pArgs;
- QString args = "()";
+ TQString args = "()";
ArgumentDom pArg = (*methodIt)->argumentList().first();
if (pArgs)
@@ -500,8 +500,8 @@ QStringList PHPCodeCompletion::getArguments(QString classname, QString function)
}
if (nClass->baseClassList().count() != 0) {
- QStringList base = nClass->baseClassList();
- QStringList::Iterator nameIt;
+ TQStringList base = nClass->baseClassList();
+ TQStringList::Iterator nameIt;
for (nameIt = base.begin(); nameIt != base.end(); ++nameIt) {
ClassList baseList = getClassByName(*nameIt);
ClassList::Iterator baseIt;
@@ -514,22 +514,22 @@ QStringList PHPCodeCompletion::getArguments(QString classname, QString function)
return list;
}
-QString PHPCodeCompletion::getCurrentClassName() {
+TQString PHPCodeCompletion::getCurrentClassName() {
kdDebug(9018) << "getCurrentClassName" << endl;
- 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);
for(int i = m_currentLine; i >= 0; i--){
- QString line = m_editInterface->textLine(i);
+ TQString line = m_editInterface->textLine(i);
if (!line.isNull()) {
if (Class.search(line) != -1)
return Class.cap(2);
}
}
- return QString::null;
+ return TQString::null;
}
-QString PHPCodeCompletion::getClassName(QString varName, QString classname) {
+TQString PHPCodeCompletion::getClassName(TQString varName, TQString classname) {
kdDebug(9018) << "getClassName " << varName << "::" << classname << endl;
if (varName.find("$") == 0)
@@ -557,7 +557,7 @@ QString PHPCodeCompletion::getClassName(QString varName, QString classname) {
FunctionList::Iterator funcIt;
for (funcIt = funcList.begin(); funcIt != funcList.end(); ++funcIt) {
- if (QString((*funcIt)->name().lower() + "(") == varName.lower())
+ if (TQString((*funcIt)->name().lower() + "(") == varName.lower())
return (*funcIt)->resultType();
}
@@ -573,23 +573,23 @@ QString PHPCodeCompletion::getClassName(QString varName, QString classname) {
kdDebug(9018) << "Need " << classname << " " << varName << endl;
/*
/// @fixme peut devenir recursif voir xbutton.php ligne 204
- QRegExp createmember("\\" + varName + "[ \t]*=[ \t]*(.*)[ \t]*;");
+ TQRegExp createmember("\\" + varName + "[ \t]*=[ \t]*(.*)[ \t]*;");
for(int i = m_currentLine; i >= 0; i--){
- QString line = m_editInterface->textLine(i);
+ TQString line = m_editInterface->textLine(i);
if (!line.isNull() && line.find(varName,0 , FALSE) != -1) {
if (createmember.search(line) != -1) {
- QString right = createmember.cap(1).stripWhiteSpace();
+ TQString right = createmember.cap(1).stripWhiteSpace();
- QStringList vars = QStringList::split("->", right);
- for ( QStringList::Iterator it = vars.begin(); it != vars.end(); ++it ) {
- QString objet = *it;
+ TQStringList vars = TQStringList::split("->", right);
+ for ( TQStringList::Iterator it = vars.begin(); it != vars.end(); ++it ) {
+ TQString objet = *it;
++it;
if (it == vars.end())
break;
- QString var = *it;
+ TQString var = *it;
if (objet.lower() == "$this")
objet = this->getCurrentClassName();
@@ -597,9 +597,9 @@ QString PHPCodeCompletion::getClassName(QString varName, QString classname) {
classname = getClassName(var, objet);
NamespaceDom varns = m_model->globalNamespace()->namespaceByName("varsns");
- QString fromns;
+ TQString fromns;
if (varns) {
- QString name = objet + "::" + var;
+ TQString name = objet + "::" + var;
kdDebug(9018) << name << endl;
VariableDom nVar = varns->variableByName(name);
fromns = nVar->type();
@@ -618,8 +618,8 @@ QString PHPCodeCompletion::getClassName(QString varName, QString classname) {
return "";
}
-QValueList<ClassDom> PHPCodeCompletion::getClassByName(QString classname) {
- QValueList<ClassDom> CList;
+TQValueList<ClassDom> PHPCodeCompletion::getClassByName(TQString classname) {
+ TQValueList<ClassDom> CList;
ClassList classList = m_model->globalNamespace()->classList();
@@ -632,21 +632,21 @@ QValueList<ClassDom> PHPCodeCompletion::getClassByName(QString classname) {
return CList;
}
-bool PHPCodeCompletion::checkForArgHint(QString line, int col) {
+bool PHPCodeCompletion::checkForArgHint(TQString line, int col) {
kdDebug(9018) << "checkForArgHint" << endl;
- QValueList<KTextEditor::CompletionEntry> list;
- QStringList argsList;
+ TQValueList<KTextEditor::CompletionEntry> list;
+ TQStringList argsList;
if (m_argWidgetShow == true)
return false;
if (line.find("::") != -1) {
- QRegExp Static("([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)::([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)");
+ TQRegExp Static("([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)::([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)");
Static.setCaseSensitive(FALSE);
if (Static.search(line) != -1) {
- QString classname = Static.cap(1);
- QString function = Static.cap(2);
+ TQString classname = Static.cap(1);
+ TQString function = Static.cap(2);
argsList = getArguments(classname, function);
@@ -661,16 +661,16 @@ bool PHPCodeCompletion::checkForArgHint(QString line, int col) {
if (line.findRev("->") != -1) {
int pos1 = line.findRev("->");
- QString classname;
- QString function = line.mid(pos1 + 2);
+ TQString classname;
+ TQString function = line.mid(pos1 + 2);
line = line.mid(0, pos1);
kdDebug(9018) << "checkForArgHint 2 " << line << endl;
- QStringList vars = QStringList::split("->", line);
+ TQStringList vars = TQStringList::split("->", line);
- for ( QStringList::Iterator it = vars.begin(); it != vars.end(); ++it ) {
+ for ( TQStringList::Iterator it = vars.begin(); it != vars.end(); ++it ) {
kdDebug(9018) << "for " << line << endl;
classname = getClassName(*it, classname);
kdDebug(9018) << "next " << line << endl;
@@ -705,7 +705,7 @@ kdDebug(9018) << "checkForArgHint 0 " << line << endl;
return false;
}
-void PHPCodeCompletion::setStatusBar(QString expr, QString type) {
+void PHPCodeCompletion::setStatusBar(TQString expr, TQString type) {
m_phpSupport->mainWindow()->statusBar()->message( i18n("Type of %1 is %2").arg(expr).arg(type), 1000 );
}