diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-16 19:02:47 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-16 19:02:47 +0000 |
commit | e985f7e545f4739493965aad69bbecb136dc9346 (patch) | |
tree | 54afd409d8acd6202dd8ab611d24e78c28e4c0a0 /quanta/parsers | |
parent | f7670c198945adc3b95ad69a959fe5f8ae55b493 (diff) | |
download | tdewebdev-e985f7e545f4739493965aad69bbecb136dc9346.tar.gz tdewebdev-e985f7e545f4739493965aad69bbecb136dc9346.zip |
TQt4 port kdewebdev
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdewebdev@1237029 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'quanta/parsers')
-rw-r--r-- | quanta/parsers/dtd/dtd.cpp | 72 | ||||
-rw-r--r-- | quanta/parsers/dtd/dtd.h | 2 | ||||
-rw-r--r-- | quanta/parsers/dtd/dtdparser.cpp | 44 | ||||
-rw-r--r-- | quanta/parsers/dtd/dtdparser.h | 2 | ||||
-rw-r--r-- | quanta/parsers/dtd/dtepcreationdlg.ui | 34 | ||||
-rw-r--r-- | quanta/parsers/node.cpp | 60 | ||||
-rw-r--r-- | quanta/parsers/node.h | 24 | ||||
-rw-r--r-- | quanta/parsers/parser.cpp | 286 | ||||
-rw-r--r-- | quanta/parsers/parser.h | 1 | ||||
-rw-r--r-- | quanta/parsers/parsercommon.cpp | 54 | ||||
-rw-r--r-- | quanta/parsers/parsercommon.h | 10 | ||||
-rw-r--r-- | quanta/parsers/qtag.cpp | 70 | ||||
-rw-r--r-- | quanta/parsers/qtag.h | 30 | ||||
-rw-r--r-- | quanta/parsers/sagroupparser.cpp | 62 | ||||
-rw-r--r-- | quanta/parsers/sagroupparser.h | 5 | ||||
-rw-r--r-- | quanta/parsers/saparser.cpp | 94 | ||||
-rw-r--r-- | quanta/parsers/saparser.h | 9 | ||||
-rw-r--r-- | quanta/parsers/tag.cpp | 54 |
18 files changed, 458 insertions, 455 deletions
diff --git a/quanta/parsers/dtd/dtd.cpp b/quanta/parsers/dtd/dtd.cpp index 964c35fb..c0942441 100644 --- a/quanta/parsers/dtd/dtd.cpp +++ b/quanta/parsers/dtd/dtd.cpp @@ -30,8 +30,8 @@ #include <ktempfile.h> #include "dtd.h" -#include "../quantacommon.h" -#include "../qextfileinfo.h" +#include "../tquantacommon.h" +#include "../tqextfileinfo.h" DTD::DTD(const KURL &dtdURL, const TQString &dtepDir) @@ -51,7 +51,7 @@ TQStringList DTD::getTags() AttributeList* DTD::getTagAttributes(TQString tag) { - return tagAttributes.find(tag); + return tagAttributes.tqfind(tag); } @@ -84,7 +84,7 @@ void DTD::writeTagFiles() TQString dirName = m_dtepDir; KURL u; u.setPath(dirName); - if (!QExtFileInfo::createDir(dirName)) { + if (!TQExtFileInfo::createDir(dirName)) { QuantaCommon::dirCreationError(0, u); return; } @@ -121,10 +121,10 @@ void DTD::writeTagFiles() bool DTD::parseDTD(const KURL &url) { - TQString fileName = TQString::null; + TQString fileName = TQString(); if (!KIO::NetAccess::download(url, fileName)) { - KMessageBox::error(0, i18n("<qt>Cannot download the DTD from <b>%1</b>.</qt>").arg(url.prettyURL(0, KURL::StripFileProtocol))); + KMessageBox::error(0, i18n("<qt>Cannot download the DTD from <b>%1</b>.</qt>").tqarg(url.prettyURL(0, KURL::StripFileProtocol))); return false; } TQFile file(fileName); @@ -183,7 +183,7 @@ bool DTD::parseDTD(const KURL &url) parseDTD(entityURL); } else { - kdDebug(24000) << TQString("Unknown tag: [%1]").arg(line) << endl; + kdDebug(24000) << TQString("Unknown tag: [%1]").tqarg(line) << endl; } if (it != lines.end()) ++it; @@ -195,14 +195,14 @@ void DTD::parseDTDEntity(TQString line) { TQString name; TQString *value; - line.replace("\\end", " "); + line.tqreplace("\\end", " "); name = line.mid(11); - int firstSpace = name.find(' '); + int firstSpace = name.tqfind(' '); name = name.remove(firstSpace, name.length()-firstSpace); value = new TQString(line.mid(11+firstSpace)); - value->remove(0, value->find("\"")+1); - value->remove(value->findRev("\""), value->length()); + value->remove(0, value->tqfind("\"")+1); + value->remove(value->tqfindRev("\""), value->length()); parseDTDReplace(value); stripSpaces(value); @@ -217,14 +217,14 @@ void DTD::parseDTDElement(const TQString &l) { TQString *value; TQString line = l; - line.replace("\\end", " "); + line.tqreplace("\\end", " "); name = line.mid(10); - int firstSpace = name.find(' '); + int firstSpace = name.tqfind(' '); name.remove(firstSpace, name.length()-firstSpace); value = new TQString(line.mid(10+firstSpace)); - //value->remove(0, value->find("\"")+1); - value->remove(value->find(">"), 10000); + //value->remove(0, value->tqfind("\"")+1); + value->remove(value->tqfind(">"), 10000); parseDTDReplace(&name); parseDTDReplace(value); @@ -254,14 +254,14 @@ void DTD::parseDTDAttlist(const TQString &l) { TQString *value; TQString line = l; - line.replace("\\end", " "); + line.tqreplace("\\end", " "); name = line.mid(10); - int firstSpace = name.find(' '); + int firstSpace = name.tqfind(' '); name.remove(firstSpace, name.length()-firstSpace); value = new TQString(line.mid(10+firstSpace)); - //value->remove(0, value->find("\"")+1); - value->remove(value->find(">"), 10000); + //value->remove(0, value->tqfind("\"")+1); + value->remove(value->tqfind(">"), 10000); parseDTDReplace(&name); parseDTDReplace(value); @@ -362,51 +362,51 @@ void DTD::parseTagAttributeValues(const TQString &name, TQString *value) { void DTD::parseDTDReplace(TQString *value) { int begin, end; - begin = value->find("%"); - end = value->find(";"); + begin = value->tqfind("%"); + end = value->tqfind(";"); while (begin != -1 && end != -1) { TQString replaceText = value->mid(begin+1, end-begin-1); - TQString *replaceValue = entities.find(replaceText); + TQString *replaceValue = entities.tqfind(replaceText); if (replaceValue != 0L) { - value->replace(begin, end-begin+1, *replaceValue); + value->tqreplace(begin, end-begin+1, *replaceValue); } else { kdDebug(24000) << "Can not find entity: " << replaceText << endl; return; } - begin = value->find("%"); - end = value->find(";"); + begin = value->tqfind("%"); + end = value->tqfind(";"); } } void DTD::stripSpaces(TQString *value) { int index=-1; - while ( (index=value->find(' ',++index)) != -1 ) { - if ( value->findRev('(',index) != -1 && value->find(')',index) != -1) + while ( (index=value->tqfind(' ',++index)) != -1 ) { + if ( value->tqfindRev('(',index) != -1 && value->tqfind(')',index) != -1) value->remove(index,1); } } void DTD::removeComments(TQString &value) { int begin, end; - begin = value.find("<!--"); - end = value.find("-->",begin+2); + begin = value.tqfind("<!--"); + end = value.tqfind("-->",begin+2); while (begin != -1 && end != -1) { value.remove(begin, end-begin+3); - begin = value.find("<!--"); - end = value.find("-->",begin+2); + begin = value.tqfind("<!--"); + end = value.tqfind("-->",begin+2); } - begin = value.find("--"); - end = value.find("--",begin+2); + begin = value.tqfind("--"); + end = value.tqfind("--",begin+2); while (begin != -1 && end != -1) { value.remove(begin, end-begin+2); - begin = value.find("--"); - end = value.find("--",begin+2); + begin = value.tqfind("--"); + end = value.tqfind("--",begin+2); } - value.replace(TQRegExp("<!>"), ""); + value.tqreplace(TQRegExp("<!>"), ""); } bool DTD::parseDTD() diff --git a/quanta/parsers/dtd/dtd.h b/quanta/parsers/dtd/dtd.h index cc0cf238..723ee4b6 100644 --- a/quanta/parsers/dtd/dtd.h +++ b/quanta/parsers/dtd/dtd.h @@ -22,7 +22,7 @@ #include <tqdict.h> //app includes -#include "qtag.h" +#include "tqtag.h" class KURL; diff --git a/quanta/parsers/dtd/dtdparser.cpp b/quanta/parsers/dtd/dtdparser.cpp index 0d623978..577d2734 100644 --- a/quanta/parsers/dtd/dtdparser.cpp +++ b/quanta/parsers/dtd/dtdparser.cpp @@ -72,10 +72,10 @@ DTDParser::~DTDParser() bool DTDParser::parse(const TQString &targetDir, bool entitiesOnly) { bool fineTune = false; - TQString fileName = TQString::null; + TQString fileName = TQString(); if (!KIO::NetAccess::download(m_dtdURL, fileName, 0)) { - KMessageBox::error(0, i18n("<qt>Cannot download the DTD from <b>%1</b>.</qt>").arg( m_dtdURL.prettyURL(0, KURL::StripFileProtocol))); + KMessageBox::error(0, i18n("<qt>Cannot download the DTD from <b>%1</b>.</qt>").tqarg( m_dtdURL.prettyURL(0, KURL::StripFileProtocol))); return false; } DTD::dtd_ptr = xmlParseDTD(NULL, xmlCharStrndup(fileName.utf8(), fileName.utf8().length())); @@ -86,23 +86,23 @@ bool DTDParser::parse(const TQString &targetDir, bool entitiesOnly) xmlErrorPtr errorPtr = xmlGetLastError(); if (errorPtr != NULL) { - TQString s = TQString::fromLatin1(errorPtr->message); + TQString s = TQString::tqfromLatin1(errorPtr->message); if (!s.isEmpty()) errorStr = s; - s = TQString::fromLatin1(errorPtr->str1); + s = TQString::tqfromLatin1(errorPtr->str1); if (!s.isEmpty()) errorStr += "<br>" + s; - s = TQString::fromLatin1(errorPtr->str2); + s = TQString::tqfromLatin1(errorPtr->str2); if (!s.isEmpty()) errorStr += "<br>" + s; - s = TQString::fromLatin1(errorPtr->str2); + s = TQString::tqfromLatin1(errorPtr->str2); if (!s.isEmpty()) errorStr += "<br>" + s; - errorStr += TQString("(%1, %2)").arg(errorPtr->line).arg(errorPtr->int2); + errorStr += TQString("(%1, %2)").tqarg(errorPtr->line).tqarg(errorPtr->int2); xmlResetError(errorPtr); } #endif - KMessageBox::error(0, i18n("<qt>Error while parsing the DTD.<br>The error message is:<br><i>%1</i></qt>").arg(errorStr)); + KMessageBox::error(0, i18n("<qt>Error while parsing the DTD.<br>The error message is:<br><i>%1</i></qt>").tqarg(errorStr)); return false; } if (targetDir.isEmpty()) @@ -123,8 +123,8 @@ bool DTDParser::parse(const TQString &targetDir, bool entitiesOnly) m_name = w.dtdName->text(); m_nickName = w.nickName->text(); m_doctype = w.doctype->text(); - m_doctype.replace(TQRegExp("<!doctype", false), ""); - m_doctype = m_doctype.left(m_doctype.findRev(">")); + m_doctype.tqreplace(TQRegExp("<!doctype", false), ""); + m_doctype = m_doctype.left(m_doctype.tqfindRev(">")); m_dtdURLLine = w.dtdURL->text(); m_defaultExtension = w.defaultExtension->text(); m_caseSensitive = w.caseSensitive->isChecked(); @@ -134,7 +134,7 @@ bool DTDParser::parse(const TQString &targetDir, bool entitiesOnly) DTD::dirName = targetDir; KURL u; u.setPath(DTD::dirName); - if (!QExtFileInfo::createDir(u, 0L)) { + if (!TQExtFileInfo::createDir(u, 0L)) { QuantaCommon::dirCreationError(0L, u); return false; } @@ -144,7 +144,7 @@ bool DTDParser::parse(const TQString &targetDir, bool entitiesOnly) TQFile file( DTD::dirName + "entities.tag" ); if ( file.open( IO_WriteOnly ) ) { - DTD::entityStream.setDevice(&file); + DTD::entityStream.setDevice(TQT_TQIODEVICE(&file)); DTD::entityStream.setEncoding(TQTextStream::UnicodeUTF8); DTD::entityStream << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" << endl; DTD::entityStream << "<!DOCTYPE TAGS>" << endl @@ -154,8 +154,8 @@ bool DTDParser::parse(const TQString &targetDir, bool entitiesOnly) file.close(); } else { - KMessageBox::error(0L, i18n("<qt>Cannot create the <br><b>%1</b> file.<br>Check that you have write permission in the parent folder.</qt>") - .arg(file.name())); + KMessageBox::error(0L, i18n("<qt>Cannot create the <br><b>%1</b> file.<br>Check that you have write permission in the tqparent folder.</qt>") + .tqarg(file.name())); return false; } } @@ -235,7 +235,7 @@ void saveElement(xmlElementPtr elem, xmlBufferPtr buf) attr->name = TQString((const char*)at_ptr->name); switch (at_ptr->def) { case 1: {attr->status = "optional"; break;} //NONE - case 2: {attr->status = "required"; break;} //REQUIRED + case 2: {attr->status = "required"; break;} //RETQUIRED case 3: {attr->status = "implied"; break;} //IMPLIED case 4: {attr->status = "fixed"; break;} //FIXED } @@ -265,7 +265,7 @@ void saveElement(xmlElementPtr elem, xmlBufferPtr buf) if (childNum > 0) { - stream << "<children>" << endl; + stream << "<tqchildren>" << endl; for( int i = 0; i < childNum; i++ ) { stream << " <child name=\"" << TQString((const char*)list_ptr[i]) << "\""; @@ -293,14 +293,14 @@ void saveElement(xmlElementPtr elem, xmlBufferPtr buf) stream << " />" << endl; } - stream << "</children>" << endl; + stream << "</tqchildren>" << endl; stream << endl; } /* xmlElementContentPtr content_ptr = el_ptr->content; if (content_ptr) { - stream << "<children>" << endl; + stream << "<tqchildren>" << endl; while (content_ptr) { if (!TQString((const char*)content_ptr->name).isEmpty()) @@ -325,17 +325,17 @@ void saveElement(xmlElementPtr elem, xmlBufferPtr buf) { if (content_ptr == el_ptr->content) break; - if (content_ptr->parent) + if (content_ptr->tqparent) { - if (content_ptr == content_ptr->parent->c1) + if (content_ptr == content_ptr->tqparent->c1) content_ptr->c1 = 0L; else content_ptr->c2 = 0L; } - content_ptr = content_ptr->parent; + content_ptr = content_ptr->tqparent; } } - stream << "</children>" << endl; + stream << "</tqchildren>" << endl; } */ } stream << "</tag>" << endl diff --git a/quanta/parsers/dtd/dtdparser.h b/quanta/parsers/dtd/dtdparser.h index 800fa445..b9948ea6 100644 --- a/quanta/parsers/dtd/dtdparser.h +++ b/quanta/parsers/dtd/dtdparser.h @@ -35,7 +35,7 @@ public: * @param entitiesOnly if true, only the entities are extracted from the DTD into the entities.tag file * @return true on success, false if some error happened */ - bool parse(const TQString &targetDir = TQString::null, bool entitiesOnly = false); + bool parse(const TQString &targetDir = TQString(), bool entitiesOnly = false); protected: void writeDescriptionRC(); diff --git a/quanta/parsers/dtd/dtepcreationdlg.ui b/quanta/parsers/dtd/dtepcreationdlg.ui index 3247c7ae..adaeabc4 100644 --- a/quanta/parsers/dtd/dtepcreationdlg.ui +++ b/quanta/parsers/dtd/dtepcreationdlg.ui @@ -9,7 +9,7 @@ ***************************************************************************/ </comment> <author>(C) 2003 Andras Mantia <amantia@kde.org></author> -<widget class="QWidget"> +<widget class="TQWidget"> <property name="name"> <cstring>DTEPCreationDlg</cstring> </property> @@ -21,7 +21,7 @@ <height>285</height> </rect> </property> - <property name="minimumSize"> + <property name="tqminimumSize"> <size> <width>500</width> <height>200</height> @@ -37,17 +37,17 @@ <property name="name"> <cstring>unnamed</cstring> </property> - <widget class="QLineEdit" row="2" column="1"> + <widget class="TQLineEdit" row="2" column="1"> <property name="name"> <cstring>nickName</cstring> </property> </widget> - <widget class="QLineEdit" row="4" column="1"> + <widget class="TQLineEdit" row="4" column="1"> <property name="name"> <cstring>dtdURL</cstring> </property> </widget> - <widget class="QLabel" row="1" column="0"> + <widget class="TQLabel" row="1" column="0"> <property name="name"> <cstring>textLabel1</cstring> </property> @@ -55,7 +55,7 @@ <string>Name: </string> </property> </widget> - <widget class="QLabel" row="2" column="0"> + <widget class="TQLabel" row="2" column="0"> <property name="name"> <cstring>textLabel2</cstring> </property> @@ -63,7 +63,7 @@ <string>Nickname:</string> </property> </widget> - <widget class="QLabel" row="3" column="0"> + <widget class="TQLabel" row="3" column="0"> <property name="name"> <cstring>textLabel3</cstring> </property> @@ -71,22 +71,22 @@ <string>!DOCTYPE definition line:</string> </property> </widget> - <widget class="QLineEdit" row="0" column="1"> + <widget class="TQLineEdit" row="0" column="1"> <property name="name"> <cstring>directory</cstring> </property> </widget> - <widget class="QLineEdit" row="3" column="1"> + <widget class="TQLineEdit" row="3" column="1"> <property name="name"> <cstring>doctype</cstring> </property> </widget> - <widget class="QLineEdit" row="1" column="1"> + <widget class="TQLineEdit" row="1" column="1"> <property name="name"> <cstring>dtdName</cstring> </property> </widget> - <widget class="QLabel" row="4" column="0"> + <widget class="TQLabel" row="4" column="0"> <property name="name"> <cstring>textLabel5</cstring> </property> @@ -94,7 +94,7 @@ <string>DTD URL:</string> </property> </widget> - <widget class="QLabel" row="0" column="0"> + <widget class="TQLabel" row="0" column="0"> <property name="name"> <cstring>textLabel4</cstring> </property> @@ -102,7 +102,7 @@ <string>Target directory name:</string> </property> </widget> - <widget class="QLabel" row="5" column="0"> + <widget class="TQLabel" row="5" column="0"> <property name="name"> <cstring>textLabel1_2</cstring> </property> @@ -110,12 +110,12 @@ <string>Default extension:</string> </property> </widget> - <widget class="QLineEdit" row="5" column="1"> + <widget class="TQLineEdit" row="5" column="1"> <property name="name"> <cstring>defaultExtension</cstring> </property> </widget> - <widget class="QCheckBox" row="6" column="0" rowspan="1" colspan="2"> + <widget class="TQCheckBox" row="6" column="0" rowspan="1" colspan="2"> <property name="name"> <cstring>caseSensitive</cstring> </property> @@ -126,7 +126,7 @@ <bool>true</bool> </property> </widget> - <widget class="QCheckBox" row="7" column="0" rowspan="1" colspan="2"> + <widget class="TQCheckBox" row="7" column="0" rowspan="1" colspan="2"> <property name="name"> <cstring>fineTune</cstring> </property> @@ -148,5 +148,5 @@ <tabstop>defaultExtension</tabstop> <tabstop>caseSensitive</tabstop> </tabstops> -<layoutdefaults spacing="6" margin="11"/> +<tqlayoutdefaults spacing="6" margin="11"/> </UI> diff --git a/quanta/parsers/node.cpp b/quanta/parsers/node.cpp index 219716e9..ef7599b8 100644 --- a/quanta/parsers/node.cpp +++ b/quanta/parsers/node.cpp @@ -33,9 +33,9 @@ int NN = 0; //for debugging purposes: count the Node objects GroupElementMapList globalGroupMap; -Node::Node(Node *parent) +Node::Node(Node *tqparent) { - this->parent = parent; + this->tqparent = tqparent; prev = next = child = 0L; tag = 0L; mainListItem = 0L; @@ -48,7 +48,7 @@ Node::Node(Node *parent) m_leafNode = 0L; m_groupElements.clear(); NN++; -// if (nodes.contains(this) == 0) +// if (nodes.tqcontains(this) == 0) nodes[this] = 1; // else // { @@ -60,7 +60,7 @@ bool Node::deleteNode(Node *node) { if (!node) return true; - if (!nodes.contains(node)) + if (!nodes.tqcontains(node)) { kdDebug(24000) << "Trying to delete a node with address " << node << " that was not allocated!" << endl; return false; @@ -71,7 +71,7 @@ bool Node::deleteNode(Node *node) Node::~Node() { -// if (!nodes.contains(this)) +// if (!nodes.tqcontains(this)) // { // kdError(24000) << "No node with this address " << this << " was allocated!" << endl; // return; @@ -89,8 +89,8 @@ Node::~Node() nodes.erase(this); if (prev && prev->next == this) prev->next = 0L; - if (parent && parent->child == this) - parent->child = 0L; + if (tqparent && tqparent->child == this) + tqparent->child = 0L; if (removeAll) { deleteNode(child); @@ -101,8 +101,8 @@ Node::~Node() { if (next && next->prev == this) next->prev = 0L; - if (child && child->parent == this) - child->parent = 0L; + if (child && child->tqparent == this) + child->tqparent = 0L; } delete tag; @@ -148,7 +148,7 @@ void Node::save(TQDomElement& element) const element.setAttribute("removeAll", removeAll); // bool element.setAttribute("insideSpecial", insideSpecial); // bool element.setAttribute("specialInsideXml", specialInsideXml); // bool - element.setAttribute("fileName", fileName); // QString + element.setAttribute("fileName", fileName); // TQString /* TQString s_element; TQTextStream stream(&s_element, IO_WriteOnly); @@ -174,13 +174,13 @@ bool Node::load(TQDomElement const& element) { next = new Node(0); next->prev = this; - next->parent = this->parent; + next->tqparent = this->tqparent; next->load(e); } else if(e.tagName() == "nodeChild") { child = new Node(0); - child->parent = this; + child->tqparent = this; child->load(e); } else if(e.tagName() == "nodeClosing") @@ -201,7 +201,7 @@ bool Node::load(TQDomElement const& element) removeAll = TQString(element.attribute("removeAll")).toInt(); // bool insideSpecial = TQString(element.attribute("insideSpecial")).toInt(); // bool specialInsideXml = TQString(element.attribute("specialInsideXml")).toInt(); // bool - fileName = element.attribute("fileName"); // QString + fileName = element.attribute("fileName"); // TQString //kafkaCommon::coutTree(this, 3); @@ -225,14 +225,14 @@ Node *Node::nextSibling() Node *n = this; while (n) { - if (n->parent && n->parent->next) + if (n->tqparent && n->tqparent->next) { - result = n->parent->next; + result = n->tqparent->next; break; } else { - n = n->parent; + n = n->tqparent; } } } @@ -257,7 +257,7 @@ Node *Node::previousSibling() } else { - result = parent; + result = tqparent; } return result; @@ -272,14 +272,14 @@ Node *Node::nextNotChild() Node *n = this; while (n) { - if (n->parent && n->parent->next) + if (n->tqparent && n->tqparent->next) { - n = n->parent->next; + n = n->tqparent->next; break; } else { - n = n->parent; + n = n->tqparent; } } @@ -291,14 +291,14 @@ TQString Node::nodeName() { if(tag) return tag->name; - return TQString::null; + return TQString(); } TQString Node::nodeValue() { if(tag) return tag->tagStr(); - return TQString::null; + return TQString(); } void Node::setNodeValue(const TQString &value) @@ -358,15 +358,15 @@ Node *Node::SPrev() Node *node = prev; int bCol, bLine, eCol, eLine, col, line; - if(parent) + if(tqparent) { - parent->tag->beginPos(bLine, bCol); - parent->tag->endPos(eLine, eCol); + tqparent->tag->beginPos(bLine, bCol); + tqparent->tag->endPos(eLine, eCol); } while(node && node->tag->type != Tag::XmlTag && node->tag->type != Tag::Text) { - if (parent && node->tag->type == Tag::ScriptTag) + if (tqparent && node->tag->type == Tag::ScriptTag) { //Check if it is an embedded ScriptTag. If it is, continue. node->tag->beginPos(line, col); @@ -384,7 +384,7 @@ Node *Node::SNext() Node *node = next; int bCol, bLine, eCol, eLine, col, line; - if(parent) + if(tqparent) { tag->beginPos(bLine, bCol); tag->endPos(eLine, eCol); @@ -392,7 +392,7 @@ Node *Node::SNext() while(node && node->tag->type != Tag::XmlTag && node->tag->type != Tag::Text) { - if (parent && node->tag->type == Tag::ScriptTag) + if (tqparent && node->tag->type == Tag::ScriptTag) { //Check if it is an embedded ScriptTag. If it is, continue. node->tag->beginPos(line, col); @@ -509,7 +509,7 @@ void Node::operator =(Node* node) (*this) = (*node); prev = 0L; next = 0L; - parent = 0L; + tqparent = 0L; child = 0L; mainListItem = 0L; m_groupElements.clear(); @@ -520,7 +520,7 @@ void Node::operator =(Node* node) void Node::detachNode() { - if (nodes.contains(this) == 0) + if (nodes.tqcontains(this) == 0) { kdError(24000) << "No node with this address " << this << " was allocated!" << endl; return; diff --git a/quanta/parsers/node.h b/quanta/parsers/node.h index 4e3451af..ab8e6267 100644 --- a/quanta/parsers/node.h +++ b/quanta/parsers/node.h @@ -36,8 +36,8 @@ struct GroupElement{ Node *node; /* The tag which point to the actual place in the node */ Tag *tag; - /*The parent node indicating the beginning of a structure */ - Node *parentNode; + /*The tqparent node indicating the beginning of a structure */ + Node *tqparentNode; bool global; bool deleted; TQString type; @@ -48,7 +48,7 @@ typedef TQValueList<GroupElement*> GroupElementList; typedef TQMap<TQString, GroupElementList> GroupElementMapList; /** - * A Node is a basic unit of a Tree. It keeps track of his parent, his left neighbour, his right neighbour + * A Node is a basic unit of a Tree. It keeps track of his tqparent, his left neighbour, his right neighbour * and his first child. * It contains some functions to navigate through the tree, but some more are located at kafkacommon.h * (and should be moved here...) @@ -61,7 +61,7 @@ typedef TQMap<TQString, GroupElementList> GroupElementMapList; class Node { public: - Node( Node *parent ); + Node( Node *tqparent ); ~Node(); /** @@ -73,7 +73,7 @@ public: static bool deleteNode(Node *node); /** - * Copy everything from node except prev, next, child, parent, listItem, group, groupTag, which are set to Null + * Copy everything from node except prev, next, child, tqparent, listItem, group, groupTag, which are set to Null * The groupElementsList is cleared. */ void operator =(Node* node); @@ -84,22 +84,22 @@ public: Node *next; Node *prev; - Node *parent; + Node *tqparent; Node *child; - /** Returns the child if available, else the next node, else the next node of the first parent which has one, else 0L. + /** Returns the child if available, else the next node, else the next node of the first tqparent which has one, else 0L. WARNING: it doesn't behave like DOM::Node::nextSibling() which give the next Node, or 0L if there is no next Node */ Node *nextSibling(); Node *previousSibling(); - /** Returns the next node, or the parent's next, if next doesn't exists, - or the granparent's next, if parent's next doesn't exists, etc. */ + /** Returns the next node, or the tqparent's next, if next doesn't exists, + or the grantqparent's next, if tqparent's next doesn't exists, etc. */ Node *nextNotChild(); /** DOM like functions cf dom/dom_node.h */ TQString nodeName(); TQString nodeValue(); void setNodeValue(const TQString &value); - Node* parentNode() {return parent;} + Node* tqparentNode() {return tqparent;} Node* firstChild() {return child;} Node* lastChild(); Node* DOMpreviousSibling() {return prev;} @@ -113,7 +113,7 @@ public: /** Others functions. */ // check if Node has node in its child subtree (and grand-child,...) bool hasForChild(Node *node); - void setParent(Node *nodeParent) {parent = nodeParent;} + void setParent(Node *nodeParent) {tqparent = nodeParent;} //If Node is of type XmlTag or ScriptTag, return the corresponding XmlTagEnd if available Node *getClosingNode(); //If Node is of type XmlTagEnd, return the corresponding XmlTag or ScriptTag if available @@ -130,7 +130,7 @@ public: Node *lastChildNE(); /** - * The main problem manipulating the default links prev/next/parent/child is that we often want + * The main problem manipulating the default links prev/next/tqparent/child is that we often want * to manipulate only the "significant" Nodes e.g. XmlTag, Text, ScriptNode, like in a DOM::Node tree. * These functions, prefixed with "S" which stands for "simplified" or "significant", will only return * and manipulate XmlTag, Text and ScriptNode. diff --git a/quanta/parsers/parser.cpp b/quanta/parsers/parser.cpp index 707d97b0..0a9441db 100644 --- a/quanta/parsers/parser.cpp +++ b/quanta/parsers/parser.cpp @@ -115,13 +115,13 @@ Node *Parser::parseArea(int startLine, int startCol, int endLine, int endCol, No bool nodeFound = false; bool goUp; Node *rootNode = 0L; - Node *parentNode = a_node; + Node *tqparentNode = a_node; Node *currentNode = a_node; if (currentNode && (currentNode->tag->type != Tag::XmlTag || currentNode->tag->single)) - parentNode = currentNode->parent; + tqparentNode = currentNode->tqparent; Tag *tag = 0L; - QTag *qTag = 0L; + TQTag *qTag = 0L; textLine.append(write->text(startLine, startCol, startLine, write->editIf->lineLength(startLine))); if (line == endLine) { @@ -137,21 +137,21 @@ Node *Parser::parseArea(int startLine, int startCol, int endLine, int endCol, No nodeFound = false; goUp = false; //find the first "<" and the first special area start definition in this line - tagStartPos = textLine.find('<', col); - specialStartPos = specialAreaCount ? textLine.find(m_dtd->specialAreaStartRx, col): -1; + tagStartPos = textLine.tqfind('<', col); + specialStartPos = specialAreaCount ? textLine.tqfind(m_dtd->specialAreaStartRx, col): -1; //if the special area start definition is before the first "<" it means //that we have found a special area if ( specialStartPos != -1 && (specialStartPos <= tagStartPos || tagStartPos == -1) ) { - currentNode = ParserCommon::createTextNode(write, currentNode, line, specialStartPos, parentNode); + currentNode = ParserCommon::createTextNode(write, currentNode, line, specialStartPos, tqparentNode); if (!rootNode) rootNode = currentNode; TQString foundText = m_dtd->specialAreaStartRx.cap(); //create a toplevel node for the special area AreaStruct area(line, specialStartPos, line, specialStartPos + foundText.length() - 1); - Node *node = ParserCommon::createScriptTagNode(write, area, foundText, m_dtd, parentNode, currentNode); - if (node->parent && node->prev == node->parent) //some strange cases, but it's possible, eg.: <a href="<? foo ?>""></a><input size="<? foo ?>" > + Node *node = ParserCommon::createScriptTagNode(write, area, foundText, m_dtd, tqparentNode, currentNode); + if (node->tqparent && node->prev == node->tqparent) //some strange cases, but it's possible, eg.: <a href="<? foo ?>""></a><input size="<? foo ?>" > { node->prev->next = 0L; node->prev = 0L; @@ -263,37 +263,37 @@ Node *Parser::parseArea(int startLine, int startCol, int endLine, int endCol, No tag->name.truncate(tag->name.length() - 1); } //the tag we found indicates the beginning of a special area, like <script type=... > - if (m_dtd->specialTags.contains(tag->name.lower()) && !tag->single) + if (m_dtd->specialTags.tqcontains(tag->name.lower()) && !tag->single) { //TODO: handle goUp here - Node *node = new Node(parentNode); + Node *node = new Node(tqparentNode); nodeNum++; node->tag = tag; node->insideSpecial = true; - if (currentNode && currentNode != parentNode) + if (currentNode && currentNode != tqparentNode) { currentNode->next = node; node->prev = currentNode; } else { - if (parentNode) - parentNode->child = node; + if (tqparentNode) + tqparentNode->child = node; } if (!rootNode) rootNode = node; //find the DTD that needs to be used for the special area TQString tmpStr = m_dtd->specialTags[tag->name.lower()]; - int defPos = tmpStr.find('['); + int defPos = tmpStr.tqfind('['); TQString defValue; if (defPos != 0) { - defValue = tmpStr.mid(defPos+1, tmpStr.findRev(']')-defPos-1).stripWhiteSpace(); + defValue = tmpStr.mid(defPos+1, tmpStr.tqfindRev(']')-defPos-1).stripWhiteSpace(); tmpStr = tmpStr.left(defPos); } TQString s = tag->attributeValue(tmpStr); if (s.isEmpty()) s = defValue; - const DTDStruct *dtd = DTDs::ref()->find(s); + const DTDStruct *dtd = DTDs::ref()->tqfind(s); if (!dtd) dtd = m_dtd; //a trick here: replace the node's DTD with this one //Note: with the new SAParser, the top level nodes must be Tag::ScriptTag-s! @@ -315,21 +315,21 @@ Node *Parser::parseArea(int startLine, int startCol, int endLine, int endCol, No } qTag = 0L; - goUp = ( parentNode && - ( (tag->type == Tag::XmlTagEnd && QuantaCommon::closesTag(parentNode->tag, tag) + goUp = ( tqparentNode && + ( (tag->type == Tag::XmlTagEnd && QuantaCommon::closesTag(tqparentNode->tag, tag) ) || - parentNode->tag->single ) + tqparentNode->tag->single ) ); - if (parentNode && !goUp) + if (tqparentNode && !goUp) { - qTag = QuantaCommon::tagFromDTD(m_dtd, parentNode->tag->name); + qTag = QuantaCommon::tagFromDTD(m_dtd, tqparentNode->tag->name); if ( qTag ) { TQString searchFor = (m_dtd->caseSensitive)?tag->name:tag->name.upper(); searchFor.remove('/'); - if ( qTag->stoppingTags.contains(searchFor)) + if ( qTag->stoppingTags.tqcontains(searchFor)) { - parentNode->tag->closingMissing = true; //parent is single... + tqparentNode->tag->closingMissing = true; //tqparent is single... goUp = true; } } @@ -340,9 +340,9 @@ Node *Parser::parseArea(int startLine, int startCol, int endLine, int endCol, No if (nodeFound) { //first create a text/empty node between the current position and the last node - Node *savedParentNode = parentNode; - currentNode = ParserCommon::createTextNode(write, currentNode, tagStartLine, tagStartPos, parentNode); - if (savedParentNode != parentNode) + Node *savedParentNode = tqparentNode; + currentNode = ParserCommon::createTextNode(write, currentNode, tagStartLine, tagStartPos, tqparentNode); + if (savedParentNode != tqparentNode) goUp = false; if (!rootNode) rootNode = currentNode; @@ -351,31 +351,31 @@ Node *Parser::parseArea(int startLine, int startCol, int endLine, int endCol, No if (goUp) { //handle cases like <ul><li></ul> - if (tag->type == Tag::XmlTagEnd && !QuantaCommon::closesTag(parentNode->tag, tag)) + if (tag->type == Tag::XmlTagEnd && !QuantaCommon::closesTag(tqparentNode->tag, tag)) { - while ( parentNode->parent && - QuantaCommon::closesTag(parentNode->parent->tag, tag) + while ( tqparentNode->tqparent && + QuantaCommon::closesTag(tqparentNode->tqparent->tag, tag) ) { - parentNode = parentNode->parent; + tqparentNode = tqparentNode->tqparent; } } else if (qTag && tag->type != Tag::XmlTagEnd) { - //handle the case when a tag is a stopping tag for parent, and grandparent and so on. - Node *n = parentNode; + //handle the case when a tag is a stopping tag for tqparent, and grandtqparent and so on. + Node *n = tqparentNode; TQString searchFor = (m_dtd->caseSensitive)?tag->name:tag->name.upper(); while (qTag && n) { qTag = QuantaCommon::tagFromDTD(m_dtd, n->tag->name); if ( qTag ) { - if ( qTag->stoppingTags.contains(searchFor) ) + if ( qTag->stoppingTags.tqcontains(searchFor) ) { - n->tag->closingMissing = true; //parent is single... - if (n->parent) - parentNode = n; - n = n->parent; + n->tag->closingMissing = true; //tqparent is single... + if (n->tqparent) + tqparentNode = n; + n = n->tqparent; } else { break; @@ -384,29 +384,29 @@ Node *Parser::parseArea(int startLine, int startCol, int endLine, int endCol, No } } - node = new Node(parentNode->parent); + node = new Node(tqparentNode->tqparent); nodeNum++; - node->prev = parentNode; - parentNode->next = node; - parentNode = parentNode->parent; + node->prev = tqparentNode; + tqparentNode->next = node; + tqparentNode = tqparentNode->tqparent; node->closesPrevious = true; } else { - node = new Node(parentNode); + node = new Node(tqparentNode); nodeNum++; - if (currentNode && currentNode != parentNode) + if (currentNode && currentNode != tqparentNode) { currentNode->next = node; node->prev = currentNode; } else { - if (parentNode) + if (tqparentNode) { - if (!parentNode->child) - parentNode->child = node; + if (!tqparentNode->child) + tqparentNode->child = node; else { - Node *n = parentNode->child; + Node *n = tqparentNode->child; while (n->next) n = n->next; n->next = node; @@ -416,7 +416,7 @@ Node *Parser::parseArea(int startLine, int startCol, int endLine, int endCol, No } } if (!tag->single) - parentNode = node; + tqparentNode = node; node->tag = tag; if (tag->type == Tag::NeedsParsing) @@ -467,7 +467,7 @@ Node *Parser::parseArea(int startLine, int startCol, int endLine, int endCol, No #endif cleanGroups(); m_saParser->setParsingEnabled(true); - currentNode = m_saParser->parseArea(area, "", "", parentNode, true, true); //TODO: don't parse in detail here + currentNode = m_saParser->parseArea(area, "", "", tqparentNode, true, true); //TODO: don't parse in detail here m_saParser->setParsingEnabled(false); el = m_saParser->lastParsedLine(); ec = m_saParser->lastParsedColumn(); @@ -484,16 +484,16 @@ Node *Parser::parseArea(int startLine, int startCol, int endLine, int endCol, No el = endLine; ec = endCol + 1; } - currentNode = ParserCommon::createTextNode(write, currentNode, el, ec, parentNode); + currentNode = ParserCommon::createTextNode(write, currentNode, el, ec, tqparentNode); } else if (el != endLine || ec != endCol) { if (currentNode && currentNode->tag->type == Tag::ScriptTag) { - parentNode = currentNode; + tqparentNode = currentNode; currentNode = 0L; } - currentNode = ParserCommon::createTextNode(write, currentNode, endLine, endCol, parentNode); + currentNode = ParserCommon::createTextNode(write, currentNode, endLine, endCol, tqparentNode); } if (!rootNode) rootNode = currentNode; @@ -621,13 +621,13 @@ Node *Parser::nodeAt(int line, int col, bool findDeepest, bool exact) node = node->child; } else { - if (node->parent) + if (node->tqparent) { - int parentEl, parentEc; - node->parent->tag->endPos(parentEl, parentEc); - if (!exact && QuantaCommon::isBetween(line, col, bl, bc, parentEl, parentEc) == 0) + int tqparentEl, tqparentEc; + node->tqparent->tag->endPos(tqparentEl, tqparentEc); + if (!exact && QuantaCommon::isBetween(line, col, bl, bc, tqparentEl, tqparentEc) == 0) { - node = node->parent; + node = node->tqparent; } } break; //we found the node @@ -635,8 +635,8 @@ Node *Parser::nodeAt(int line, int col, bool findDeepest, bool exact) } else if (result == -1) { - if (node->parent) - node = node->parent; + if (node->tqparent) + node = node->tqparent; break; //we found the node } else { @@ -653,9 +653,9 @@ Node *Parser::nodeAt(int line, int col, bool findDeepest, bool exact) if (node && node->tag->type == Tag::Empty && (findDeepest || (bl == el && ec < bc)) ) { - if (node->parent) + if (node->tqparent) { - node = node->parent; + node = node->tqparent; } else if (node->prev) { @@ -807,7 +807,7 @@ bool Parser::invalidArea(Document *w, AreaStruct &area, Node **firstNode, Node * void Parser::deleteNodes(Node *firstNode, Node *lastNode, NodeModifsSet *modifs) { - Node *nextNode, *child, *parent, *next, *prev; + Node *nextNode, *child, *tqparent, *next, *prev; int i, j; Node *node = firstNode; bool closesPrevious = false; @@ -819,7 +819,7 @@ void Parser::deleteNodes(Node *firstNode, Node *lastNode, NodeModifsSet *modifs) nextNode = node->nextSibling(); node->removeAll = false; child = node->child; - parent = node->parent; + tqparent = node->tqparent; next = node->next; prev = node->prev; closesPrevious = node->closesPrevious; @@ -827,9 +827,9 @@ void Parser::deleteNodes(Node *firstNode, Node *lastNode, NodeModifsSet *modifs) { nextNode->prev = prev; } - if (nextNode && nextNode->parent == node) + if (nextNode && nextNode->tqparent == node) { - nextNode->parent = parent; + nextNode->tqparent = tqparent; } if (next) next->prev = prev; @@ -845,9 +845,9 @@ void Parser::deleteNodes(Node *firstNode, Node *lastNode, NodeModifsSet *modifs) modif->setLocation(kafkaCommon::getLocation(node)); if (prev && prev->next == node) prev->next = 0L; - if(parent && parent->child == node) - parent->child = 0L; - node->parent = 0L; + if(tqparent && tqparent->child == node) + tqparent->child = 0L; + node->tqparent = 0L; node->next = 0L; node->prev = 0L; @@ -860,17 +860,17 @@ void Parser::deleteNodes(Node *firstNode, Node *lastNode, NodeModifsSet *modifs) j = 0; if (!closesPrevious) { - //move the children up one level + //move the tqchildren up one level Node *n = child; Node *m = child; while (n) { m = n; - n->parent = parent; + n->tqparent = tqparent; n = n->next; i++; } - //connect the first child to the tree (after prev, or as the first child of the parent) + //connect the first child to the tree (after prev, or as the first child of the tqparent) if (prev && child) { prev->next = child; @@ -882,7 +882,7 @@ void Parser::deleteNodes(Node *firstNode, Node *lastNode, NodeModifsSet *modifs) } } else { - if (!child) //when there is no child, connect the next as the first child of the parent + if (!child) //when there is no child, connect the next as the first child of the tqparent child = next; else if (next) @@ -893,14 +893,14 @@ void Parser::deleteNodes(Node *firstNode, Node *lastNode, NodeModifsSet *modifs) n->next = next; next->prev = n; } - if (parent && !parent->child) + if (tqparent && !tqparent->child) { - parent->child = child; + tqparent->child = child; } } } else { - //change the parent of children, so the prev will be the new parent + //change the tqparent of tqchildren, so the prev will be the new tqparent if (child) { Node *n = child; @@ -908,7 +908,7 @@ void Parser::deleteNodes(Node *firstNode, Node *lastNode, NodeModifsSet *modifs) while (n) { m = n; - n->parent = prev; + n->tqparent = prev; n = n->next; i++; } @@ -928,7 +928,7 @@ void Parser::deleteNodes(Node *firstNode, Node *lastNode, NodeModifsSet *modifs) prev->child = child; } } - //move down the nodes starting with next one level and append to the list of children of prev + //move down the nodes starting with next one level and append to the list of tqchildren of prev if (next) { if (prev->child) //if the previous node has a child, append the next node after the last child @@ -953,7 +953,7 @@ void Parser::deleteNodes(Node *firstNode, Node *lastNode, NodeModifsSet *modifs) Node *n = next; while (n) { - n->parent = prev; + n->tqparent = prev; n = n->next; j++; } @@ -1020,7 +1020,7 @@ Node *Parser::rebuild(Document *w) return n; } - kdDebug(24000) << TQString("Invalid area: %1,%2,%3,%4").arg(area.bLine).arg(area.bCol).arg(area.eLine).arg(area.eCol) << "\n"; + kdDebug(24000) << TQString("Invalid area: %1,%2,%3,%4").tqarg(area.bLine).tqarg(area.bCol).tqarg(area.eLine).tqarg(area.eCol) << "\n"; // kdDebug(24000) << "lastNode1: " << lastNode << " " << lastNode->tag << endl; deleteNodes(firstNode->nextSibling(), lastNode, modifs); @@ -1053,8 +1053,8 @@ Node *Parser::rebuild(Document *w) { if (lastNode->prev ) lastNode->prev->next = 0L; - if (lastNode->parent && lastNode->parent->child == lastNode) - lastNode->parent->child = 0L; + if (lastNode->tqparent && lastNode->tqparent->child == lastNode) + lastNode->tqparent->child = 0L; } Node::deleteNode(lastNode); nodeNum--; @@ -1077,7 +1077,7 @@ Node *Parser::rebuild(Document *w) lastNode->prev = lastInserted->prev; if (lastInserted->prev) lastInserted->prev->next = lastNode; - lastNode->parent = lastInserted->parent; + lastNode->tqparent = lastInserted->tqparent; lastInserted->tag->beginPos(area.bLine, area.bCol); lastNode->tag->endPos(area.eLine, area.eCol); Tag *_tag = new Tag(*(lastNode->tag)); @@ -1091,9 +1091,9 @@ Node *Parser::rebuild(Document *w) { lastNode->tag->type = Tag::Empty; } - if (lastInserted->parent && lastInserted->parent->child == lastInserted) - //lastInserted->parent->child = lastInserted->next; lastInserted has no next! - lastInserted->parent->child = lastNode; + if (lastInserted->tqparent && lastInserted->tqparent->child == lastInserted) + //lastInserted->tqparent->child = lastInserted->next; lastInserted has no next! + lastInserted->tqparent->child = lastNode; //here, lastNode is at the pos of lastInserted. modif = new NodeModif(); @@ -1102,11 +1102,11 @@ Node *Parser::rebuild(Document *w) if(lastInserted->prev) lastInserted->prev->next = 0L; - if(lastInserted->parent && lastInserted->parent->child == lastInserted) - lastInserted->parent->child = 0L; + if(lastInserted->tqparent && lastInserted->tqparent->child == lastInserted) + lastInserted->tqparent->child = 0L; lastInserted->prev = 0L; lastInserted->next = 0L; - lastInserted->parent = 0L; + lastInserted->tqparent = 0L; lastInserted->child = 0L; // delete lastInserted; @@ -1127,63 +1127,63 @@ Node *Parser::rebuild(Document *w) node = lastInserted; // kdDebug(24000) << "lastNode5: " << lastNode << " " << lastNode->tag << endl; - QTag *qTag = 0L; + TQTag *qTag = 0L; while (node && lastNode) { // kdDebug(24000) << "lastNode6: " << lastNode << " " << lastNode->tag << endl; qTag = 0L; - goUp = ( node->parent && - ( (lastNode->tag->type == Tag::XmlTagEnd && QuantaCommon::closesTag(node->parent->tag, lastNode->tag) ) || - node->parent->tag->single ) + goUp = ( node->tqparent && + ( (lastNode->tag->type == Tag::XmlTagEnd && QuantaCommon::closesTag(node->tqparent->tag, lastNode->tag) ) || + node->tqparent->tag->single ) ); - if (node->parent && !goUp) + if (node->tqparent && !goUp) { - qTag = QuantaCommon::tagFromDTD(m_dtd, node->parent->tag->name); + qTag = QuantaCommon::tagFromDTD(m_dtd, node->tqparent->tag->name); if ( qTag ) { TQString searchFor = (m_dtd->caseSensitive)?lastNode->tag->name:lastNode->tag->name.upper(); searchFor.remove('/'); - if ( qTag->stoppingTags.contains( searchFor ) ) + if ( qTag->stoppingTags.tqcontains( searchFor ) ) { - node->parent->tag->closingMissing = true; //parent is single... + node->tqparent->tag->closingMissing = true; //tqparent is single... goUp = true; } } } if (goUp && - ( (m_dtd->caseSensitive && node->tag->name == node->parent->tag->name) || - (!m_dtd->caseSensitive && node->tag->name.lower() == node->parent->tag->name.lower())) ) - goUp = false; //it can happen that the tag closes the previous and not the parent + ( (m_dtd->caseSensitive && node->tag->name == node->tqparent->tag->name) || + (!m_dtd->caseSensitive && node->tag->name.lower() == node->tqparent->tag->name.lower())) ) + goUp = false; //it can happen that the tag closes the previous and not the tqparent - if (goUp) //lastnode closes the node->parent + if (goUp) //lastnode closes the node->tqparent { //handle cases like <ul><li></ul> if (lastNode->tag->type == Tag::XmlTagEnd && - !QuantaCommon::closesTag(node->parent->tag, lastNode->tag)) + !QuantaCommon::closesTag(node->tqparent->tag, lastNode->tag)) { - while ( node->parent->parent && - QuantaCommon::closesTag(node->parent->parent->tag, lastNode->tag) + while ( node->tqparent->tqparent && + QuantaCommon::closesTag(node->tqparent->tqparent->tag, lastNode->tag) ) { - node = node->parent; + node = node->tqparent; } } else if (qTag && lastNode->tag->type != Tag::XmlTagEnd) { - //handle the case when a tag is a stopping tag for parent, and grandparent and so on. I'm not sure it's needed here, but anyway... - Node *n = node->parent; + //handle the case when a tag is a stopping tag for tqparent, and grandtqparent and so on. I'm not sure it's needed here, but anyway... + Node *n = node->tqparent; TQString searchFor = (m_dtd->caseSensitive) ? lastNode->tag->name : lastNode->tag->name.upper(); while (qTag && n) { qTag = QuantaCommon::tagFromDTD(m_dtd, n->tag->name); if ( qTag ) { - if ( qTag->stoppingTags.contains(searchFor) ) + if ( qTag->stoppingTags.tqcontains(searchFor) ) { - n->tag->closingMissing = true; //parent is single... - if (n->parent) + n->tag->closingMissing = true; //tqparent is single... + if (n->tqparent) node = n; - n = n->parent; + n = n->tqparent; } else { break; @@ -1193,15 +1193,15 @@ Node *Parser::rebuild(Document *w) } if (lastNode->prev && lastNode->prev->next == lastNode) lastNode->prev->next = 0L; - if (lastNode->parent && lastNode->parent->child == lastNode) - lastNode->parent->child = 0L; - if (node->parent) - node->parent->next = lastNode; - lastNode->prev = node->parent; - if (node->parent) - lastNode->parent = node->parent->parent; + if (lastNode->tqparent && lastNode->tqparent->child == lastNode) + lastNode->tqparent->child = 0L; + if (node->tqparent) + node->tqparent->next = lastNode; + lastNode->prev = node->tqparent; + if (node->tqparent) + lastNode->tqparent = node->tqparent->tqparent; else - lastNode->parent = 0L; + lastNode->tqparent = 0L; node->next = 0L; lastNode->closesPrevious = true; } else @@ -1210,14 +1210,14 @@ Node *Parser::rebuild(Document *w) lastNode->prev->next = 0L; node->next = lastNode; lastNode->prev = node; - lastNode->parent = node->parent; + lastNode->tqparent = node->tqparent; // kdDebug(24000) << "lastNode7: " << lastNode << " " << lastNode->tag << endl; } node = lastNode; lastNode = lastNode->nextNotChild(); //For some reason this can happen, the lastNode can point to an invalid place. //To avoid crashes, forget the rebuild and do a full parse instead. - if (!nodes.contains(lastNode)) + if (!nodes.tqcontains(lastNode)) { kdDebug(24000) << "Lastnode is invalid, do a full reparse!" << endl; logReparse(modifs, w); @@ -1433,12 +1433,12 @@ void Parser::parseIncludedFile(const TQString& fileName, const DTDStruct *dtd) TQString specialEndStr; while (areaPos != -1) { - areaPos = content.find(dtd->specialAreaStartRx, lastAreaPos); + areaPos = content.tqfind(dtd->specialAreaStartRx, lastAreaPos); if (areaPos != -1) { foundStr = dtd->specialAreaStartRx.cap(); specialEndStr = dtd->specialAreas[foundStr]; - int areaPos2 = content.find(specialEndStr, areaPos); + int areaPos2 = content.tqfind(specialEndStr, areaPos); if (areaPos2 == -1) { areaPos2 = content.length(); @@ -1456,7 +1456,7 @@ void Parser::parseIncludedFile(const TQString& fileName, const DTDStruct *dtd) int structPos = 0; while (structPos !=-1) { - structPos = foundStr.find(dtd->structBeginStr, structPos); + structPos = foundStr.tqfind(dtd->structBeginStr, structPos); if (structPos != -1) { structPositions.append(structPos); @@ -1494,14 +1494,14 @@ void Parser::parseIncludedFile(const TQString& fileName, const DTDStruct *dtd) foundStr = foundStr.left(pos); TQString spaces; spaces.fill(' ', pos - structPos + 1); - foundStr.replace(structPos, pos - structPos + 1, spaces); + foundStr.tqreplace(structPos, pos - structPos + 1, spaces); //FIXME: This code replaces the content between ( ) with //empty spaces. This is quite PHP (or functions) //specific, and it's done in order to not find variables //declared as function arguments. A generic way is needed //to exclude unwanted areas. - int openBracketPos = foundStr.findRev(dtd->structKeywordsRx, structPos); - openBracketPos = foundStr.find('(', openBracketPos); + int openBracketPos = foundStr.tqfindRev(dtd->structKeywordsRx, structPos); + openBracketPos = foundStr.tqfind('(', openBracketPos); openNum = 1; if (openBracketPos != -1) { @@ -1517,7 +1517,7 @@ void Parser::parseIncludedFile(const TQString& fileName, const DTDStruct *dtd) } closeBracketPos--; spaces.fill(' ', closeBracketPos - openBracketPos); - foundStr.replace(openBracketPos, closeBracketPos - openBracketPos, spaces); + foundStr.tqreplace(openBracketPos, closeBracketPos - openBracketPos, spaces); } //now check which groups are present in this area @@ -1548,29 +1548,29 @@ void Parser::parseIncludedFile(const TQString& fileName, const DTDStruct *dtd) } TQString s = content.mid(areaPos + pos, l); pos += l; - if (!(*elements)[group.name].contains(s)) + if (!(*elements)[group.name].tqcontains(s)) { Tag *tag = new Tag(); tag->name = s; tag->setDtd(dtd); tag->setWrite(write); TQString s2 = content.left(areaPos + pos); - int newLineNum = s2.contains('\n'); - int tmpCol = s2.length() - s2.findRev('\n') - 1; + int newLineNum = s2.tqcontains('\n'); + int tmpCol = s2.length() - s2.tqfindRev('\n') - 1; tag->setTagPosition(newLineNum, tmpCol - s.length(), newLineNum, tmpCol); Node *node = new Node(0L); node->tag = tag; node->fileName = fileName; GroupElement *groupElement = new GroupElement; groupElement->node = node; - groupElement->parentNode = 0L; + groupElement->tqparentNode = 0L; int minPos = areaPos + pos + 1; for (TQValueList<GroupElementPosition>::Iterator gPosIt = gPositions.begin(); gPosIt != gPositions.end(); ++gPosIt) { GroupElementPosition gPos = (*gPosIt); if ( (areaPos + pos > gPos.startPos) && (areaPos + pos < gPos.endPos) && (gPos.startPos < minPos)) { - groupElement->parentNode = gPos.element->node; + groupElement->tqparentNode = gPos.element->node; minPos = gPos.startPos; } } @@ -1585,12 +1585,12 @@ void Parser::parseIncludedFile(const TQString& fileName, const DTDStruct *dtd) if (group.appendToTags) { - QTag *qTag = new QTag(); - qTag->setName(s.left(s.find('('))); + TQTag *qTag = new TQTag(); + qTag->setName(s.left(s.tqfind('('))); qTag->className = ""; - if (groupElement->parentNode) - qTag->className = groupElement->parentNode->tag->name; - write->userTagList.replace(s.lower(), qTag); + if (groupElement->tqparentNode) + qTag->className = groupElement->tqparentNode->tag->name; + write->userTagList.tqreplace(s.lower(), qTag); } } } @@ -1606,7 +1606,7 @@ void Parser::parseIncludedFile(const TQString& fileName, const DTDStruct *dtd) void Parser::slotIncludedFileChanged(const TQString& fileName) { - int pos = ParserCommon::includedFiles.findIndex(fileName); + int pos = ParserCommon::includedFiles.tqfindIndex(fileName); if (pos != -1) { const DTDStruct *dtd = ParserCommon::includedFilesDTD.at(pos); @@ -1635,7 +1635,7 @@ void Parser::slotIncludedFileChanged(const TQString& fileName) void Parser::parseForXMLGroup(Node *node) { - xmlGroupIt = node->tag->dtd()->xmlStructTreeGroups.find(node->tag->name.lower()); + xmlGroupIt = node->tag->dtd()->xmlStructTreeGroups.tqfind(node->tag->name.lower()); if (xmlGroupIt != node->tag->dtd()->xmlStructTreeGroups.end()) { XMLStructGroup group = xmlGroupIt.data(); @@ -1658,7 +1658,7 @@ void Parser::parseForXMLGroup(Node *node) groupElement->deleted = false; groupElement->tag = newTag; groupElement->node = node; - groupElement->parentNode = 0L; + groupElement->tqparentNode = 0L; groupElement->global = true; groupElement->group = const_cast<XMLStructGroup*>(&(xmlGroupIt.data())); node->m_groupElements.append(groupElement); @@ -1690,17 +1690,17 @@ bool Parser::parseScriptInsideTag(Node *startNode) while (pos != -1) { - pos = text.find(dtd->specialAreaStartRx, col); + pos = text.tqfind(dtd->specialAreaStartRx, col); if (pos != -1) { foundText = dtd->specialAreaStartRx.cap(); //Calculate the beginning coordinates s = text.left(pos); - n = s.contains('\n'); + n = s.tqcontains('\n'); bl = node_bl + n; if (n > 0) { - bc = pos - s.findRev('\n') - 1; + bc = pos - s.tqfindRev('\n') - 1; } else { bc = node_bc + pos; diff --git a/quanta/parsers/parser.h b/quanta/parsers/parser.h index 8c4b2335..37716379 100644 --- a/quanta/parsers/parser.h +++ b/quanta/parsers/parser.h @@ -45,6 +45,7 @@ typedef TQMap<TQString, IncludedGroupElements> IncludedGroupElementsMap; class Parser: public TQObject { Q_OBJECT + TQ_OBJECT public: Parser(); diff --git a/quanta/parsers/parsercommon.cpp b/quanta/parsers/parsercommon.cpp index be660255..8a9a4be5 100644 --- a/quanta/parsers/parsercommon.cpp +++ b/quanta/parsers/parsercommon.cpp @@ -78,7 +78,7 @@ void appendAreaToTextNode(Document *write, const AreaStruct &area, Node *node) node->tag->setTagPosition(bLine, bCol, area.eLine, area.eCol); } -Node* createTextNode(Document *write, Node *node, int eLine, int eCol, Node *parentNode) +Node* createTextNode(Document *write, Node *node, int eLine, int eCol, Node *tqparentNode) { Tag *textTag = 0L; Node *textNode = 0L; @@ -89,10 +89,10 @@ Node* createTextNode(Document *write, Node *node, int eLine, int eCol, Node *par { node->tag->endPos(bLine, bCol); } else - if (parentNode) - parentNode->tag->endPos(bLine, bCol); - if (parentNode) - dtd = parentNode->tag->dtd(); + if (tqparentNode) + tqparentNode->tag->endPos(bLine, bCol); + if (tqparentNode) + dtd = tqparentNode->tag->dtd(); eCol--; if (bLine == 0 && bCol == 0) bCol = -1; @@ -110,13 +110,13 @@ Node* createTextNode(Document *write, Node *node, int eLine, int eCol, Node *par textTag->type = Tag::Text; } - if (parentNode && parentNode->tag->single) + if (tqparentNode && tqparentNode->tag->single) { - textNode = new Node(parentNode->parent); + textNode = new Node(tqparentNode->tqparent); nodeNum++; - textNode->prev = parentNode; - parentNode->next = textNode; - parentNode = parentNode->parent; + textNode->prev = tqparentNode; + tqparentNode->next = textNode; + tqparentNode = tqparentNode->tqparent; } else { if ( node && @@ -129,21 +129,21 @@ Node* createTextNode(Document *write, Node *node, int eLine, int eCol, Node *par textTag = 0L; } else { - textNode = new Node(parentNode); + textNode = new Node(tqparentNode); nodeNum++; - if (node && node != parentNode) + if (node && node != tqparentNode) { node->next = textNode; textNode->prev = node; } else { - if (parentNode) + if (tqparentNode) { - Node *n = parentNode->child; + Node *n = tqparentNode->child; while (n && n->next) n = n->next; if (!n) - parentNode->child = textNode; + tqparentNode->child = textNode; else { n->next = textNode; @@ -163,32 +163,32 @@ Node* createTextNode(Document *write, Node *node, int eLine, int eCol, Node *par } Node* createScriptTagNode(Document *write, const AreaStruct &area, const TQString &areaName, - const DTDStruct *dtd, Node *parentNode, Node *currentNode) + const DTDStruct *dtd, Node *tqparentNode, Node *currentNode) { Tag *tag = new Tag(); tag->setTagPosition(area); tag->setStr(areaName); tag->setWrite(write); - const DTDStruct *d = DTDs::ref()->find(dtd->specialAreaNames[areaName]); + const DTDStruct *d = DTDs::ref()->tqfind(dtd->specialAreaNames[areaName]); if (d) tag->setDtd(d); else tag->setDtd(dtd); - tag->name = i18n("%1 block").arg(dtd->specialAreaNames[areaName].upper()); + tag->name = i18n("%1 block").tqarg(dtd->specialAreaNames[areaName].upper()); tag->type = Tag::ScriptTag; tag->validXMLTag = false; - Node *node = new Node(parentNode); + Node *node = new Node(tqparentNode); nodeNum++; node->tag = tag; node->insideSpecial = true; - if (parentNode) + if (tqparentNode) { - if (!parentNode->child) - parentNode->child = node; + if (!tqparentNode->child) + tqparentNode->child = node; else { - Node *n = parentNode->child; + Node *n = tqparentNode->child; while (n->next) n = n->next; n->next = node; @@ -216,11 +216,11 @@ void coutTree(Node *node, int indent) node->tag->beginPos(bLine, bCol); node->tag->endPos(eLine, eCol); if (node->tag->type != Tag::Text) - output += node->tag->name.replace('\n'," "); + output += node->tag->name.tqreplace('\n'," "); else - output+= node->tag->tagStr().replace('\n'," "); + output+= node->tag->tagStr().tqreplace('\n'," "); kdDebug(24000) << output <<" (" << node->tag->type << ") at pos " << - bLine << ":" << bCol << " - " << eLine << ":" << eCol << " This: "<< node << " Parent: " << node->parent << " Prev: " << node->prev << " Next: " << node->next << " Child: " << node->child << " Tag:" << node->tag << endl; + bLine << ":" << bCol << " - " << eLine << ":" << eCol << " This: "<< node << " Parent: " << node->tqparent << " Prev: " << node->prev << " Next: " << node->next << " Child: " << node->child << " Tag:" << node->tag << endl; /* for(j = 0; j < node->tag->attrCount(); j++) { kdDebug(24000)<< " attr" << j << " " << @@ -245,7 +245,7 @@ void verifyTree(Node *node) if (!node->tag) { kdDebug(24000) << "Bad node: " << node << endl; - kdDebug(24000) << "Parent: " << node->parent << " " << node->parent->tag->tagStr() << endl; + kdDebug(24000) << "Parent: " << node->tqparent << " " << node->tqparent->tag->tagStr() << endl; } if (node->child) verifyTree(node->child); diff --git a/quanta/parsers/parsercommon.h b/quanta/parsers/parsercommon.h index 9b0c01f4..021541b0 100644 --- a/quanta/parsers/parsercommon.h +++ b/quanta/parsers/parsercommon.h @@ -39,16 +39,16 @@ namespace ParserCommon{ /** Appends a text area to a text node. */ void appendAreaToTextNode(Document *write, const AreaStruct &area, Node *node); /** Creates a text/empty node between node and the provided position */ - Node* createTextNode(Document *write, Node *node, int eLine, int eCol, Node *parentNode); + Node* createTextNode(Document *write, Node *node, int eLine, int eCol, Node *tqparentNode); /** Creates a head node for special areas. area: the area belonging to this node areaName: the special area name (type) - dtd: the parent DTD - parentNode: the parent of the node - currentNode: the last child of the parent, if it exists + dtd: the tqparent DTD + tqparentNode: the tqparent of the node + currentNode: the last child of the tqparent, if it exists */ Node* createScriptTagNode(Document *write, const AreaStruct &area, const TQString &areaName, - const DTDStruct *dtd, Node *parentNode, Node *currentNode); + const DTDStruct *dtd, Node *tqparentNode, Node *currentNode); /** Print the doc structure tree to the standard output. Only for debugging purposes. */ diff --git a/quanta/parsers/qtag.cpp b/quanta/parsers/qtag.cpp index 46b5b411..d31f91b8 100644 --- a/quanta/parsers/qtag.cpp +++ b/quanta/parsers/qtag.cpp @@ -18,22 +18,22 @@ #include "tag.h" #include <kdebug.h> -QTag::QTag() +TQTag::TQTag() { attrs.setAutoDelete(true); single = false; optional = false; type = "xmltag"; - parentDTD = 0L; + tqparentDTD = 0L; } -QTag::QTag( QTag &t) +TQTag::TQTag( TQTag &t) { tagName = t.tagName; single = t.single; optional = t.optional; m_fileName = t.m_fileName; - parentDTD = t.parentDTD; + tqparentDTD = t.tqparentDTD; type = t.type; returnType = t.returnType; comment = t.comment; @@ -48,12 +48,12 @@ QTag::QTag( QTag &t) } } -QTag::~QTag() +TQTag::~TQTag() { } /** Add an attribute to the tag. */ -void QTag::addAttribute(Attribute* attr) +void TQTag::addAttribute(Attribute* attr) { if (attr) { @@ -79,24 +79,24 @@ void QTag::addAttribute(Attribute* attr) } } /** Returns the number of attributes for the tag. */ -int QTag::attributeCount() +int TQTag::attributeCount() { return attrs.count(); } /** Returns the attribute at index. */ -Attribute* QTag::attributeAt(int index) +Attribute* TQTag::attributeAt(int index) { return attrs.at(index); } /** Returns true if the attribute exists */ -bool QTag::isAttribute(const TQString &attrName) +bool TQTag::isAttribute(const TQString &attrName) { Attribute *a; int i; AttributeList *groupAttrs; - //Check in the QTag specific attributes + //Check in the TQTag specific attributes for(a = attrs.first(); a; a = attrs.next()) { if(a->name == attrName) @@ -105,7 +105,7 @@ bool QTag::isAttribute(const TQString &attrName) //Check in the common attributes for(i = 0; i < (signed)commonGroups.count(); i++) { - groupAttrs = parentDTD->commonAttrs->find(commonGroups[i]); + groupAttrs = tqparentDTD->commonAttrs->tqfind(commonGroups[i]); if(groupAttrs) { for(a = groupAttrs->first(); a; a = groupAttrs->next()) @@ -119,57 +119,57 @@ bool QTag::isAttribute(const TQString &attrName) } /** No descriptions */ -void QTag::setSingle(bool isSingle) +void TQTag::setSingle(bool isSingle) { single = isSingle; } /** No descriptions */ -void QTag::setOptional(bool isOptional) +void TQTag::setOptional(bool isOptional) { optional = isOptional; } /** No descriptions */ -void QTag::setName(const TQString& theName) +void TQTag::setName(const TQString& theName) { tagName = theName; } /** No descriptions */ -TQString QTag::name(bool doNotConvert) +TQString TQTag::name(bool doNotConvert) { - if (doNotConvert || !parentDTD || parentDTD->caseSensitive) + if (doNotConvert || !tqparentDTD || tqparentDTD->caseSensitive) return tagName; else return tagName.upper(); } /** No descriptions */ -bool QTag::isSingle() +bool TQTag::isSingle() { return single; } /** No descriptions */ -bool QTag::isOptional() +bool TQTag::isOptional() { return optional; } /** No descriptions */ -void QTag::setFileName(const TQString& fileName) +void TQTag::setFileName(const TQString& fileName) { m_fileName = fileName; } /** No descriptions */ -TQString QTag::fileName() +TQString TQTag::fileName() { return m_fileName; } -QTag QTag::operator = (QTag &t) +TQTag TQTag::operator = (TQTag &t) { tagName = t.tagName; single = t.single; optional = t.optional; m_fileName = t.m_fileName; - parentDTD = t.parentDTD; + tqparentDTD = t.tqparentDTD; type = t.type; returnType = t.returnType; comment = t.comment; @@ -186,7 +186,7 @@ QTag QTag::operator = (QTag &t) } /** Returns the attribute with name, or 0 if the tag does not have any attribute with name. */ -Attribute* QTag::attribute(const TQString& name) +Attribute* TQTag::attribute(const TQString& name) { Attribute *attr = 0L; for (uint i = 0; i < attrs.count(); i++) @@ -201,17 +201,17 @@ Attribute* QTag::attribute(const TQString& name) return attr; } -bool QTag::isChild(const TQString& tag, bool trueIfNoChildsDefined) +bool TQTag::isChild(const TQString& tag, bool trueIfNoChildsDefined) { TQString tagName = tag; - tagName = parentDTD->caseSensitive ? tagName : tagName.upper(); + tagName = tqparentDTD->caseSensitive ? tagName : tagName.upper(); if(trueIfNoChildsDefined) - return (childTags.isEmpty() || childTags.contains(tagName)); + return (childTags.isEmpty() || childTags.tqcontains(tagName)); else - return (!childTags.isEmpty() && childTags.contains(tagName)); + return (!childTags.isEmpty() && childTags.tqcontains(tagName)); } -bool QTag::isChild(Node *node, bool trueIfNoChildsDefined, bool treatEmptyNodesAsText) +bool TQTag::isChild(Node *node, bool trueIfNoChildsDefined, bool treatEmptyNodesAsText) { TQString nodeName; @@ -220,18 +220,18 @@ bool QTag::isChild(Node *node, bool trueIfNoChildsDefined, bool treatEmptyNodesA else if(node->tag->type == Tag::Text) { if(trueIfNoChildsDefined) - return(childTags.isEmpty() || childTags.contains("#text") || childTags.contains("#TEXT")); + return(childTags.isEmpty() || childTags.tqcontains("#text") || childTags.tqcontains("#TEXT")); else - return(!childTags.isEmpty() && (childTags.contains("#text") || childTags.contains("#TEXT"))); + return(!childTags.isEmpty() && (childTags.tqcontains("#text") || childTags.tqcontains("#TEXT"))); } else if(node->tag->type == Tag::Empty && !treatEmptyNodesAsText) return true; else if(node->tag->type == Tag::Empty && treatEmptyNodesAsText) { if(trueIfNoChildsDefined) - return(childTags.isEmpty() || childTags.contains("#text") || childTags.contains("#TEXT")); + return(childTags.isEmpty() || childTags.tqcontains("#text") || childTags.tqcontains("#TEXT")); else - return(!childTags.isEmpty() && (childTags.contains("#text") || childTags.contains("#TEXT"))); + return(!childTags.isEmpty() && (childTags.tqcontains("#text") || childTags.tqcontains("#TEXT"))); } else if(node->tag->type == Tag::XmlTagEnd) { @@ -247,10 +247,10 @@ bool QTag::isChild(Node *node, bool trueIfNoChildsDefined, bool treatEmptyNodesA return isChild(node->tag->name, trueIfNoChildsDefined); } -TQPtrList<QTag> QTag::parents() +TQPtrList<TQTag> TQTag::tqparents() { - TQPtrList<QTag> qTagList; - TQDictIterator<QTag> it((*parentDTD->tagsList)); + TQPtrList<TQTag> qTagList; + TQDictIterator<TQTag> it((*tqparentDTD->tagsList)); for(; it.current(); ++it) { if(it.current()->isChild(name())) diff --git a/quanta/parsers/qtag.h b/quanta/parsers/qtag.h index c7839c23..679fbc55 100644 --- a/quanta/parsers/qtag.h +++ b/quanta/parsers/qtag.h @@ -13,8 +13,8 @@ * * ***************************************************************************/ -#ifndef QTAG_H -#define QTAG_H +#ifndef TQTAG_H +#define TQTAG_H /**Quanta style tag (XML tag or code tag), as they are defined in the DTD. Contains @@ -33,7 +33,7 @@ //app includes -class QTag; +class TQTag; class Node; //an attribute of a tag looks like: @@ -58,7 +58,7 @@ class XMLStructGroup { bool hasFileName; ///<the group contains filename(s) TQRegExp fileNameRx; ///<delete the matches of this regexp to obtain a filename (eg. linked, included file name) bool appendToTags; ///<true if the group elements must be used as normal tags in autocompletion - TQString parentGroup; ///<if the group element can be a child of another group (eg. member function of a class), holds the parent name. Makes sense only if appentToTags is true + TQString tqparentGroup; ///<if the group element can be a child of another group (eg. member function of a class), holds the tqparent name. Makes sense only if appentToTags is true }; @@ -80,7 +80,7 @@ class StructTreeGroup:public XMLStructGroup { typedef TQPtrList<Attribute> AttributeList; typedef TQDict<AttributeList> AttributeListDict; -typedef TQDict<QTag> QTagList; +typedef TQDict<TQTag> TQTagList; enum DTDFamily{Unknown = 0, Xml, Script}; @@ -101,7 +101,7 @@ struct DTDStruct int family; ///< xml, script type bool toplevel; ///< true if the DTD can be the main DTD of a document. Always true for XML like DTD's TQString documentation; ///< the name of the documentation package - QTagList* tagsList; ///< the list of all defined tags in the DTD + TQTagList* tagsList; ///< the list of all defined tags in the DTD TQString fileName; ///< the DTD decription.rc with path AttributeListDict* commonAttrs; ///< the attributes of the common groups @@ -205,12 +205,12 @@ defined in the structure after the keyword have local scope */ }; -class QTag { +class TQTag { public: - QTag(); - QTag( QTag&); - ~QTag(); - QTag operator = ( QTag& ); + TQTag(); + TQTag( TQTag&); + ~TQTag(); + TQTag operator = ( TQTag& ); /** Add an attribute to the tag. */ void addAttribute(Attribute* attr); /** Returns the number of attributes for the tag. */ @@ -243,12 +243,12 @@ public: void setScope(TQString const& scope) {m_scope = scope;} /** Returns true if tag is a possible child of this tag, or if - there are no children defined and if trueIfNoChildsDefined is set to true. */ + there are no tqchildren defined and if trueIfNoChildsDefined is set to true. */ bool isChild(const TQString& tag, bool trueIfNoChildsDefined = true); //prefer using this variant, it handle Text, Empty, XmlTagEnd nodes! bool isChild(Node *node, bool trueIfNoChildsDefined = true, bool treatEmptyNodesAsText = false); - /*** Returns the list of parent of this tag. */ - TQPtrList<QTag> parents(); + /*** Returns the list of tqparent of this tag. */ + TQPtrList<TQTag> tqparents(); /** No descriptions */ TQString fileName(); @@ -258,7 +258,7 @@ public: Attribute* attribute(const TQString& name); /** The tag belongs to this DTD */ - const DTDStruct *parentDTD; + const DTDStruct *tqparentDTD; /** The tag has the attributes of the above common groups */ TQStringList commonGroups; TQStringList stoppingTags; diff --git a/quanta/parsers/sagroupparser.cpp b/quanta/parsers/sagroupparser.cpp index 6e409509..e28abe78 100644 --- a/quanta/parsers/sagroupparser.cpp +++ b/quanta/parsers/sagroupparser.cpp @@ -35,14 +35,14 @@ extern GroupElementMapList globalGroupMap; -SAGroupParser::SAGroupParser(SAParser *parent, Document *write, Node *startNode, Node *endNode, bool synchronous, bool parsingLastNode, bool paringLastGroup) +SAGroupParser::SAGroupParser(SAParser *tqparent, Document *write, Node *startNode, Node *endNode, bool synchronous, bool parsingLastNode, bool paringLastGroup) { g_node = startNode; g_endNode = endNode; m_synchronous = synchronous; m_lastGroupParsed = paringLastGroup; m_parsingLastNode = parsingLastNode; - m_parent = parent; + m_parent = tqparent; m_write = write; m_count = 0; m_parseForGroupTimer = new TQTimer(this); @@ -117,7 +117,7 @@ void SAGroupParser::parseForScriptGroup(Node *node) StructTreeGroup group; GroupElement *groupElement; GroupElementList* groupElementList; - KURL baseURL = QExtFileInfo::path(m_write->url()); + KURL baseURL = TQExtFileInfo::path(m_write->url()); TQString str = node->tag->cleanStr; TQString tagStr = node->tag->tagStr(); const DTDStruct* dtd = node->tag->dtd(); @@ -144,20 +144,20 @@ void SAGroupParser::parseForScriptGroup(Node *node) title = tagStr.mid(pos, group.definitionRx.matchedLength()); node->tag->beginPos(bl, bc); tmpStr = tagStr.left(pos); - int newLines = tmpStr.contains('\n'); + int newLines = tmpStr.tqcontains('\n'); bl += newLines; - int l = tmpStr.findRev('\n'); //the last EOL + int l = tmpStr.tqfindRev('\n'); //the last EOL bc = (l == -1) ? bc + pos : pos - l - 1; - newLines = title.contains('\n'); + newLines = title.tqcontains('\n'); l = title.length(); el = bl + newLines; - ec = (newLines > 0) ? l - title.findRev('\n') : bc + l - 1; + ec = (newLines > 0) ? l - title.tqfindRev('\n') : bc + l - 1; pos += l; AreaStruct area(bl, bc, el, ec); //get the list of elements which are present in this group and //have the same title. For example get the list of all group //element which are variable and the matched string was "$i" - int cap1Pos = str.find(group.definitionRx.cap(1)); + int cap1Pos = str.tqfind(group.definitionRx.cap(1)); TQString s = tagStr.mid(cap1Pos, group.definitionRx.cap(1).length()); groupElementList = & (globalGroupMap[group.name + "|" + s]); //Create a new tag which point to the exact location of the matched string. @@ -178,40 +178,40 @@ void SAGroupParser::parseForScriptGroup(Node *node) Node *tmpNode = node; while (tmpNode && tmpNode->tag->dtd() == dtd && tmpNode->tag->type != Tag::ScriptStructureBegin) { - tmpNode = tmpNode->parent; + tmpNode = tmpNode->tqparent; } if (tmpNode && tmpNode->tag->type == Tag::ScriptStructureBegin) { - groupElement->parentNode = tmpNode; + groupElement->tqparentNode = tmpNode; } else { - groupElement->parentNode = 0L; + groupElement->tqparentNode = 0L; } groupElement->global = true; - tmpNode = node->parent; + tmpNode = node->tqparent; while (tmpNode && tmpNode->tag->dtd() == dtd) { if ( tmpNode->tag->type == Tag::ScriptStructureBegin && tmpNode->tag->dtd()->localScopeKeywordsRx.search(tmpNode->tag->cleanStr) != -1) { groupElement->global = false; - groupElement->parentNode = tmpNode; + groupElement->tqparentNode = tmpNode; break; } - tmpNode = tmpNode->parent; + tmpNode = tmpNode->tqparent; } if (group.appendToTags) { - QTag *qTag = new QTag(); + TQTag *qTag = new TQTag(); // The location of the first open bracket '(', also the end of the tag name - int nameEnd = s.find('('); + int nameEnd = s.tqfind('('); qTag->setName(s.left(nameEnd)); qTag->className = ""; - if (groupElement->parentNode) + if (groupElement->tqparentNode) { - for (GroupElementList::ConstIterator it2 = groupElement->parentNode->m_groupElements.constBegin(); it2 != groupElement->parentNode->m_groupElements.constEnd(); ++it2) + for (GroupElementList::ConstIterator it2 = groupElement->tqparentNode->m_groupElements.constBegin(); it2 != groupElement->tqparentNode->m_groupElements.constEnd(); ++it2) { - if ((*it2)->group->name == group.parentGroup) + if ((*it2)->group->name == group.tqparentGroup) { qTag->className = (*it2)->tag->name; break; @@ -219,24 +219,24 @@ void SAGroupParser::parseForScriptGroup(Node *node) } } // Test for variable or function Type by checking for an opening bracket "(" used by functions - // and store the type in the QTag type variable. + // and store the type in the TQTag type variable. bool isArgument=false; if (nameEnd == -1) { qTag->type="variable"; // If this tag is a class function argument, it should not belong to the class, so we need to remove it - if(qTag->className.length() != 0 && tagStr.contains('(') && tagStr.contains(')')) + if(qTag->className.length() != 0 && tagStr.tqcontains('(') && tagStr.tqcontains(')')) { // First we want to determine the whole line the tag is on TQString tagWholeLineStr = tagStr; // Remove lines before target line while(tagWholeLineStr.length() > 0) // this stops infinit looping in case something goes wrong! { - int firstNewline = tagWholeLineStr.find('\n'); + int firstNewline = tagWholeLineStr.tqfind('\n'); if(firstNewline == -1) //no new lines so we must be on the last break; TQString checkLineStr = tagWholeLineStr.mid(firstNewline+1,tagWholeLineStr.length()); - if(checkLineStr.contains(s)) + if(checkLineStr.tqcontains(s)) tagWholeLineStr = checkLineStr; else break; @@ -244,23 +244,23 @@ void SAGroupParser::parseForScriptGroup(Node *node) // Remove lines after target line - essentially same as above while(tagWholeLineStr.length() > 0) { - int lastNewLine = tagWholeLineStr.findRev('\n'); + int lastNewLine = tagWholeLineStr.tqfindRev('\n'); if(lastNewLine == -1) break; TQString checkLineStr = tagWholeLineStr.mid(0,lastNewLine); - if(checkLineStr.contains(s)) + if(checkLineStr.tqcontains(s)) tagWholeLineStr = checkLineStr; else break; } - // Now we are left with the current line, lets check if the variable is inside parentheses - int lineOpenParenth=tagWholeLineStr.find('('); + // Now we are left with the current line, lets check if the variable is inside tqparentheses + int lineOpenParenth=tagWholeLineStr.tqfind('('); if(lineOpenParenth != -1) { - int lineCloseParenth=tagWholeLineStr.find(')'); + int lineCloseParenth=tagWholeLineStr.tqfind(')'); if(lineCloseParenth != -1) { - int lineNameLocation=tagWholeLineStr.find(s); + int lineNameLocation=tagWholeLineStr.tqfind(s); if(lineNameLocation > lineOpenParenth || lineNameLocation < lineCloseParenth) // Write the current tag to the list isArgument=true; } @@ -272,7 +272,7 @@ void SAGroupParser::parseForScriptGroup(Node *node) qTag->type="function"; } if(!isArgument) - m_write->userTagList.replace(s.lower(), qTag); + m_write->userTagList.tqreplace(s.lower(), qTag); } @@ -294,7 +294,7 @@ void SAGroupParser::parseForScriptGroup(Node *node) s.remove(group.fileNameRx); KURL url; QuantaCommon::setUrl(url, s.stripWhiteSpace()); - url = QExtFileInfo::toAbsolute(url, baseURL); + url = TQExtFileInfo::toAbsolute(url, baseURL); ParserCommon::includedFiles += url.path(); ParserCommon::includedFilesDTD.append(dtd); ParserCommon::includeWatch->addFile(url.path()); diff --git a/quanta/parsers/sagroupparser.h b/quanta/parsers/sagroupparser.h index 1045cc74..35e8d1f9 100644 --- a/quanta/parsers/sagroupparser.h +++ b/quanta/parsers/sagroupparser.h @@ -29,12 +29,13 @@ class SAParser; /** This class is used to parse for special area (script) groups in the node tree. */ -class SAGroupParser : public QObject +class SAGroupParser : public TQObject { Q_OBJECT + TQ_OBJECT public: public: - SAGroupParser(SAParser *parent, Document *write, Node *startNode, Node *endNode, bool synchronous, bool parsingLastNode, bool paringLastGroup); + SAGroupParser(SAParser *tqparent, Document *write, Node *startNode, Node *endNode, bool synchronous, bool parsingLastNode, bool paringLastGroup); ~SAGroupParser() {}; TQTimer *m_parseForGroupTimer; diff --git a/quanta/parsers/saparser.cpp b/quanta/parsers/saparser.cpp index f402e0c8..e562d47b 100644 --- a/quanta/parsers/saparser.cpp +++ b/quanta/parsers/saparser.cpp @@ -86,29 +86,29 @@ bool SAParser::slotParseOneLine() //search for different s_contexts if (s_searchContent) //search for quoted strings, comments, groups only in non-comment special areas { - quotedStringPos = s_textLine.find(m_quotesRx, s_col); //quoted strings + quotedStringPos = s_textLine.tqfind(m_quotesRx, s_col); //quoted strings s_searchedString = s_textLine.left(quotedStringPos); - commentPos = s_searchedString.find(s_dtd->commentsStartRx, s_col); //comments + commentPos = s_searchedString.tqfind(s_dtd->commentsStartRx, s_col); //comments s_searchedString = s_textLine.left(commentPos); if (s_fullParse) - groupKeywordPos = s_searchedString.find(s_dtd->structRx, s_col); //groups, like { } + groupKeywordPos = s_searchedString.tqfind(s_dtd->structRx, s_col); //groups, like { } } else s_searchedString = s_textLine; int specialAreaPos = -1; if (s_searchForSpecialAreas) //special area inside special area { s_searchedString = s_textLine.left(groupKeywordPos); - specialAreaPos = s_searchedString.find(s_dtd->specialAreaStartRx, s_col); + specialAreaPos = s_searchedString.tqfind(s_dtd->specialAreaStartRx, s_col); } if (s_searchForAreaEnd) //the end of the special area { s_searchedString = s_textLine.left(specialAreaPos); - areaEndPos = s_searchedString.find(s_areaEndString, s_col); + areaEndPos = s_searchedString.tqfind(s_areaEndString, s_col); } else if (s_searchForForcedAreaEnd) //the end of the special area if a forcing string was specified { s_searchedString = s_textLine.left(specialAreaPos); - areaEndPos = s_searchedString.find(s_forcedAreaRx, s_col); + areaEndPos = s_searchedString.tqfind(s_forcedAreaRx, s_col); if (areaEndPos != -1) s_areaEndString = s_forcedAreaRx.cap(); } @@ -157,7 +157,7 @@ bool SAParser::slotParseOneLine() s_currentNode->tag->type == Tag::Empty) ) ParserCommon::appendAreaToTextNode(m_write, s_currentContext.area, s_currentNode); else - s_currentNode = ParserCommon::createTextNode(m_write, s_currentNode, s_line, s_currentContext.area.eCol + 1, s_currentContext.parentNode); + s_currentNode = ParserCommon::createTextNode(m_write, s_currentNode, s_line, s_currentContext.area.eCol + 1, s_currentContext.tqparentNode); s_currentNode->tag->type = Tag::ScriptStructureBegin; s_currentNode->tag->single = false; @@ -166,7 +166,7 @@ bool SAParser::slotParseOneLine() s_currentContext.lastNode = s_currentNode; s_contextStack.push(s_currentContext); - s_currentContext.parentNode = s_currentNode; + s_currentContext.tqparentNode = s_currentNode; s_col = s_context.area.bCol + s_context.startString.length(); s_currentContext.area.bLine = s_line; s_currentContext.area.bCol = s_col; @@ -201,21 +201,21 @@ bool SAParser::slotParseOneLine() } s_currentContext.area.eLine = s_line; s_currentContext.area.eCol = groupKeywordPos - 1; - //kdDebug(24000) << TQString("Group Struct s_context: %1, %2, %3, %4").arg( s_currentContext.bLine).arg(s_currentContext.bCol).arg(s_currentContext.eLine).arg(s_currentContext.eCol) << endl; + //kdDebug(24000) << TQString("Group Struct s_context: %1, %2, %3, %4").tqarg( s_currentContext.bLine).tqarg(s_currentContext.bCol).tqarg(s_currentContext.eLine).tqarg(s_currentContext.eCol) << endl; if (s_currentNode && (s_currentNode->tag->type == Tag::Text || s_currentNode->tag->type == Tag::Empty) ) ParserCommon::appendAreaToTextNode(m_write, s_currentContext.area, s_currentNode); else - s_currentNode = ParserCommon::createTextNode(m_write, s_currentNode, s_line, groupKeywordPos, s_currentContext.parentNode); + s_currentNode = ParserCommon::createTextNode(m_write, s_currentNode, s_line, groupKeywordPos, s_currentContext.tqparentNode); if (s_currentNode) { s_currentNode->insideSpecial = true; s_currentNode->specialInsideXml = m_specialInsideXml; } s_previousContext = s_contextStack.pop(); - s_currentContext.parentNode = s_previousContext.parentNode; + s_currentContext.tqparentNode = s_previousContext.tqparentNode; s_currentContext.lastNode = s_previousContext.lastNode; s_currentContext.type = s_previousContext.type; s_currentContext.area.bLine = s_line; @@ -232,14 +232,14 @@ bool SAParser::slotParseOneLine() tag->setDtd(s_dtd); tag->type = Tag::ScriptStructureEnd; tag->single = true; - Node *node = new Node(s_currentContext.parentNode); + Node *node = new Node(s_currentContext.tqparentNode); nodeNum++; node->tag = tag; node->insideSpecial = true; node->specialInsideXml = m_specialInsideXml; - if (s_currentContext.parentNode && !s_currentContext.parentNode->child) + if (s_currentContext.tqparentNode && !s_currentContext.tqparentNode->child) { - s_currentContext.parentNode->child = node; + s_currentContext.tqparentNode->child = node; } else if (s_currentContext.lastNode) { @@ -275,7 +275,7 @@ bool SAParser::slotParseOneLine() s_currentNode->tag->type == Tag::Empty) ) ParserCommon::appendAreaToTextNode(m_write, s_currentContext.area, s_currentNode); else - s_currentNode = ParserCommon::createTextNode(m_write, s_currentNode, s_line, specialAreaPos, s_currentContext.parentNode); + s_currentNode = ParserCommon::createTextNode(m_write, s_currentNode, s_line, specialAreaPos, s_currentContext.tqparentNode); if (s_currentNode) { s_currentNode->insideSpecial = true; @@ -284,7 +284,7 @@ bool SAParser::slotParseOneLine() } //create a toplevel node for the included special area AreaStruct area(s_line, specialAreaPos, s_line, specialAreaPos + foundText.length() - 1); - Node *node = ParserCommon::createScriptTagNode(m_write, area, foundText, s_dtd, s_currentContext.parentNode, s_currentNode); + Node *node = ParserCommon::createScriptTagNode(m_write, area, foundText, s_dtd, s_currentContext.tqparentNode, s_currentNode); #ifdef DEBUG_PARSER kdDebug(24001) << "Parsing a nested area." << endl; #endif @@ -316,11 +316,11 @@ bool SAParser::slotParseOneLine() } else //when we look only for the area end string if (s_searchForAreaEnd) { - areaEndPos = s_textLine.find(s_areaEndString, s_col); + areaEndPos = s_textLine.tqfind(s_areaEndString, s_col); } else if (s_searchForForcedAreaEnd) { - areaEndPos = s_textLine.find(s_forcedAreaRx, s_col); + areaEndPos = s_textLine.tqfind(s_forcedAreaRx, s_col); if (areaEndPos != -1) s_areaEndString = s_forcedAreaRx.cap(); } @@ -351,7 +351,7 @@ bool SAParser::slotParseOneLine() s_currentNode->specialInsideXml = m_specialInsideXml; } } - //kdDebug(24000) << TQString("Special area %1 ends at %2, %3").arg(s_dtd->name).arg(s_line).arg(lastCol) << endl; + //kdDebug(24000) << TQString("Special area %1 ends at %2, %3").tqarg(s_dtd->name).tqarg(s_line).tqarg(lastCol) << endl; //create a closing node for the special area Tag *tag = new Tag(); @@ -363,7 +363,7 @@ bool SAParser::slotParseOneLine() tag->single = true; //at this point s_parentNode = the opening node of the special area (eg. <?) //and it should always exist - Node *node = new Node(s_parentNode->parent); + Node *node = new Node(s_parentNode->tqparent); nodeNum++; s_parentNode->next = node; node->prev = s_parentNode; @@ -419,10 +419,10 @@ bool SAParser::slotParseOneLine() { s_context.area.bLine = s_line; s_context.area.eLine = s_context.area.eCol = -1; - s_context.parentNode = s_currentContext.parentNode; + s_context.tqparentNode = s_currentContext.tqparentNode; s_currentContext.area.eLine = s_context.area.bLine; s_currentContext.area.eCol = s_context.area.bCol - 1; - // s_currentContext.parentNode = s_parentNode; + // s_currentContext.tqparentNode = s_parentNode; s_contextStack.push(s_currentContext); if (s_fullParse) { @@ -451,14 +451,14 @@ bool SAParser::slotParseOneLine() } tag->single = true; //create a node with the above tag - Node *node = new Node(s_currentContext.parentNode); + Node *node = new Node(s_currentContext.tqparentNode); nodeNum++; node->tag = tag; node->insideSpecial = true; node->specialInsideXml = m_specialInsideXml; - if (s_currentContext.parentNode && !s_currentContext.parentNode->child) + if (s_currentContext.tqparentNode && !s_currentContext.tqparentNode->child) { - s_currentContext.parentNode->child = node; + s_currentContext.tqparentNode->child = node; } else if (s_currentNode) { @@ -468,7 +468,7 @@ bool SAParser::slotParseOneLine() s_currentNode = node; } } - //kdDebug(24000) << TQString("%1 s_context: %2, %3, %4, %5").arg(s_currentContext.type).arg( s_currentContext.bLine).arg(s_currentContext.bCol).arg(s_currentContext.eLine).arg(s_currentContext.eCol) << endl; + //kdDebug(24000) << TQString("%1 s_context: %2, %3, %4, %5").tqarg(s_currentContext.type).tqarg( s_currentContext.bLine).tqarg(s_currentContext.bCol).tqarg(s_currentContext.eLine).tqarg(s_currentContext.eCol) << endl; s_currentContext = s_context; s_col = s_context.area.bCol + s_context.startString.length(); @@ -487,7 +487,7 @@ bool SAParser::slotParseOneLine() int l = s_textLine.length(); while (p < l) { - p = s_textLine.find(s_currentContext.startString, p); + p = s_textLine.tqfind(s_currentContext.startString, p); if (p != -1) { if (p >= 0) @@ -514,7 +514,7 @@ bool SAParser::slotParseOneLine() // if (pos != 0) pos++; s_currentContext.area.eLine = s_line; s_currentContext.area.eCol = pos; - //kdDebug(24000) << TQString("Quoted String s_context: %1, %2, %3, %4").arg( s_currentContext.bLine).arg(s_currentContext.bCol).arg(s_currentContext.eLine).arg(s_currentContext.eCol) << endl; + //kdDebug(24000) << TQString("Quoted String s_context: %1, %2, %3, %4").tqarg( s_currentContext.bLine).tqarg(s_currentContext.bCol).tqarg(s_currentContext.eLine).tqarg(s_currentContext.eCol) << endl; if (s_fullParse) { if ( s_currentNode && @@ -522,12 +522,12 @@ bool SAParser::slotParseOneLine() s_currentNode->tag->type == Tag::Empty) ) ParserCommon::appendAreaToTextNode(m_write, s_currentContext.area, s_currentNode); else - s_currentNode = ParserCommon::createTextNode(m_write, 0L, s_line, pos, s_currentContext.parentNode); + s_currentNode = ParserCommon::createTextNode(m_write, 0L, s_line, pos, s_currentContext.tqparentNode); s_currentNode->insideSpecial = true; s_currentNode->specialInsideXml = m_specialInsideXml; } s_previousContext = s_contextStack.pop(); - s_currentContext.parentNode = s_previousContext.parentNode; + s_currentContext.tqparentNode = s_previousContext.tqparentNode; s_currentContext.type = s_previousContext.type; s_currentContext.area.bLine = s_line; s_currentContext.area.bCol = pos + 1; @@ -544,10 +544,10 @@ bool SAParser::slotParseOneLine() } case Comment: { - int pos = s_textLine.find(s_dtd->comments[s_currentContext.startString], s_col); + int pos = s_textLine.tqfind(s_dtd->comments[s_currentContext.startString], s_col); if (pos == -1 && s_dtd->comments[s_currentContext.startString] == "\n") { - int pos2 = s_textLine.find(s_areaEndString, s_col); + int pos2 = s_textLine.tqfind(s_areaEndString, s_col); if (pos2 != -1) { pos = pos2 - 1; @@ -561,7 +561,7 @@ bool SAParser::slotParseOneLine() s_currentContext.area.eLine = s_line; s_currentContext.area.eCol = pos + s_dtd->comments[s_currentContext.startString].length() - 1; s_currentContext.type = s_previousContext.type; - //kdDebug(24000) << TQString("Comment s_context: %1, %2, %3, %4").arg( s_currentContext.bLine).arg(s_currentContext.bCol).arg(s_currentContext.eLine).arg(s_currentContext.eCol) << endl; + //kdDebug(24000) << TQString("Comment s_context: %1, %2, %3, %4").tqarg( s_currentContext.bLine).tqarg(s_currentContext.bCol).tqarg(s_currentContext.eLine).tqarg(s_currentContext.eCol) << endl; if (s_fullParse) { @@ -570,22 +570,22 @@ bool SAParser::slotParseOneLine() tag->type = Tag::Comment; tag->single = true; //create a node with the above tag - Node *node = new Node(s_currentContext.parentNode); + Node *node = new Node(s_currentContext.tqparentNode); nodeNum++; node->tag = tag; node->insideSpecial = true; node->specialInsideXml = m_specialInsideXml; - if (s_currentNode && s_currentNode != node->parent) + if (s_currentNode && s_currentNode != node->tqparent) { s_currentNode->next = node; node->prev = s_currentNode; } else - if (node->parent && !node->parent->child) - node->parent->child = node; + if (node->tqparent && !node->tqparent->child) + node->tqparent->child = node; s_currentNode = node; } s_previousContext = s_contextStack.pop(); - s_currentContext.parentNode = s_previousContext.parentNode; + s_currentContext.tqparentNode = s_previousContext.tqparentNode; s_currentContext.type = s_previousContext.type; s_currentContext.area.bLine = s_line; s_currentContext.area.bCol = s_currentContext.area.eCol + 1; @@ -635,11 +635,11 @@ bool SAParser::slotParseOneLine() Node* SAParser::parseArea(const AreaStruct &specialArea, const TQString &areaStartString, const TQString &forcedAreaEndString, - Node *parentNode, + Node *tqparentNode, bool fullParse, bool synchronous) { m_synchronous = synchronous; - s_parentNode = parentNode; + s_parentNode = tqparentNode; s_fullParse = fullParse; #ifdef DEBUG_PARSER kdDebug(24001) << "parseArea full: " << s_fullParse << " synch: " << m_synchronous <<endl; @@ -649,18 +649,18 @@ Node* SAParser::parseArea(const AreaStruct &specialArea, int s_startCol = specialArea.bCol; s_endLine = specialArea.eLine; s_endCol = specialArea.eCol; - //kdDebug(24000) << TQString("Starting to parse at %1, %2 for %3").arg(s_startLine).arg(s_startCol).arg(areaStartString) << endl; + //kdDebug(24000) << TQString("Starting to parse at %1, %2 for %3").tqarg(s_startLine).tqarg(s_startCol).tqarg(areaStartString) << endl; s_searchForAreaEnd = false; s_searchForForcedAreaEnd = false; s_dtd = 0L; if (s_parentNode && !areaStartString.isEmpty()) { - const DTDStruct *parentDTD = m_dtd; - if (s_parentNode->parent) - parentDTD = s_parentNode->parent->tag->dtd(); - s_dtd = DTDs::ref()->find(parentDTD->specialAreaNames[areaStartString]); - s_areaEndString = parentDTD->specialAreas[areaStartString]; + const DTDStruct *tqparentDTD = m_dtd; + if (s_parentNode->tqparent) + tqparentDTD = s_parentNode->tqparent->tag->dtd(); + s_dtd = DTDs::ref()->tqfind(tqparentDTD->specialAreaNames[areaStartString]); + s_areaEndString = tqparentDTD->specialAreas[areaStartString]; s_searchForAreaEnd = true; } if (!forcedAreaEndString.isEmpty()) @@ -702,7 +702,7 @@ Node* SAParser::parseArea(const AreaStruct &specialArea, s_currentContext.area.bLine = s_line; s_currentContext.area.bCol = s_col; s_currentContext.area.eLine = s_currentContext.area.eCol = -1; - s_currentContext.parentNode = s_parentNode; + s_currentContext.tqparentNode = s_parentNode; s_currentNode = s_parentNode; m_lastParsedNode = 0L; s_useReturnVars = false; diff --git a/quanta/parsers/saparser.h b/quanta/parsers/saparser.h index 74b00b3e..d344fb55 100644 --- a/quanta/parsers/saparser.h +++ b/quanta/parsers/saparser.h @@ -38,9 +38,10 @@ class SAGroupParser; /** This class is used to parse a special area (script) in the document. */ -class SAParser: public QObject +class SAParser: public TQObject { Q_OBJECT + TQ_OBJECT public: SAParser(); @@ -56,7 +57,7 @@ public: area. It may end before the end position. areaStartString: the special area starting string forcedAreaEndString: force this as the special area ending string. - parentNode: the Node under where the special area goes + tqparentNode: the Node under where the special area goes fullParse: the script node will be fully parsed for groups, structures or so. If false, only the script beginning and end will be determined. synchronous: if true, the function does not return until the parsing is finished, otherwise return immediately. @@ -65,7 +66,7 @@ public: Node* parseArea(const AreaStruct &specialArea, const TQString &areaStartString, const TQString &forcedAreaEndString, - Node *parentNode, + Node *tqparentNode, bool fullParse, bool synchronous); /** Returns the line where the last parsing run ended. */ int lastParsedLine() {return m_lastParsedLine;} @@ -96,7 +97,7 @@ private: int type; AreaStruct area; TQString startString; - Node *parentNode; + Node *tqparentNode; Node *lastNode; }; enum ContextType { diff --git a/quanta/parsers/tag.cpp b/quanta/parsers/tag.cpp index 54779d57..f6460fce 100644 --- a/quanta/parsers/tag.cpp +++ b/quanta/parsers/tag.cpp @@ -33,8 +33,8 @@ void TagAttr::save(TQDomElement& element) const { - element.setAttribute("name", name); // QString - element.setAttribute("value", value); // QString + element.setAttribute("name", name); // TQString + element.setAttribute("value", value); // TQString element.setAttribute("nameLine", nameLine); // int element.setAttribute("nameCol", nameCol); // int element.setAttribute("valueLine", valueLine); // int @@ -127,13 +127,13 @@ void Tag::init() void Tag::save(TQDomElement& element) const { - element.setAttribute("name", name); // QString - element.setAttribute("nameSpace", nameSpace); // QString - element.setAttribute("cleanStr", cleanStr); // QString + element.setAttribute("name", name); // TQString + element.setAttribute("nameSpace", nameSpace); // TQString + element.setAttribute("cleanStr", cleanStr); // TQString element.setAttribute("type", type); // int element.setAttribute("single", single); // bool element.setAttribute("closingMissing", closingMissing); // bool - element.setAttribute("structBeginStr", structBeginStr); // QString + element.setAttribute("structBeginStr", structBeginStr); // TQString element.setAttribute("validXMLTag", validXMLTag); // bool element.setAttribute("cleanStrBuilt", m_cleanStrBuilt); // bool element.setAttribute("indentationDone", m_indentationDone); // bool @@ -149,18 +149,18 @@ void Tag::save(TQDomElement& element) const (*it).save(child_element); } - element.setAttribute("tagStr", m_tagStr); // QString + element.setAttribute("tagStr", m_tagStr); // TQString } bool Tag::load(TQDomElement const& element) { - name = element.attribute("name"); // QString - nameSpace = element.attribute("nameSpace"); // QString - cleanStr = element.attribute("cleanStr"); // QString + name = element.attribute("name"); // TQString + nameSpace = element.attribute("nameSpace"); // TQString + cleanStr = element.attribute("cleanStr"); // TQString type = TQString(element.attribute("type")).toInt(); // int single = TQString(element.attribute("single")).toInt(); // bool closingMissing = TQString(element.attribute("closingMissing")).toInt(); // bool - structBeginStr = element.attribute("structBeginStr"); // QString + structBeginStr = element.attribute("structBeginStr"); // TQString validXMLTag = TQString(element.attribute("validXMLTag")).toInt(); // bool m_cleanStrBuilt = TQString(element.attribute("cleanStrBuilt")).toInt(); // bool m_indentationDone = TQString(element.attribute("indentationDone")).toInt(); // bool @@ -183,7 +183,7 @@ bool Tag::load(TQDomElement const& element) } } - m_tagStr = element.attribute("tagStr"); // QString + m_tagStr = element.attribute("tagStr"); // TQString return true; } @@ -209,7 +209,7 @@ void Tag::parse(const TQString &p_tagStr, Document *p_write) pos++; } name = m_tagStr.mid(1, pos - 1); - int nameSpacePos = name.find(':'); + int nameSpacePos = name.tqfind(':'); if (nameSpacePos != -1) { nameSpace = name.left(nameSpacePos); @@ -237,7 +237,7 @@ void Tag::parse(const TQString &p_tagStr, Document *p_write) attr.name = attr.name.left(attr.name.length() - 1).lower(); if (!attr.name.stripWhiteSpace().isEmpty()) { - attr.nameLine = m_tagStr.left(sPos).contains('\n') + m_area.bLine; + attr.nameLine = m_tagStr.left(sPos).tqcontains('\n') + m_area.bLine; if (attr.nameLine == m_area.bLine) attr.nameCol = sPos + m_area.bCol; else @@ -252,7 +252,7 @@ void Tag::parse(const TQString &p_tagStr, Document *p_write) } if (m_dtd && !m_dtd->caseSensitive) attr.name = attr.name.lower(); - attr.nameLine = m_tagStr.left(sPos).contains('\n') + m_area.bLine; + attr.nameLine = m_tagStr.left(sPos).tqcontains('\n') + m_area.bLine; if (attr.nameLine == m_area.bLine) attr.nameCol = sPos + m_area.bCol; else @@ -298,7 +298,7 @@ void Tag::parse(const TQString &p_tagStr, Document *p_write) pos--; attr.value = m_tagStr.mid(valueStartPos, pos - valueStartPos); } - attr.valueLine = m_tagStr.left(valueStartPos).contains('\n') + m_area.bLine; + attr.valueLine = m_tagStr.left(valueStartPos).tqcontains('\n') + m_area.bLine; if (attr.valueLine == m_area.bLine) attr.valueCol = valueStartPos + m_area.bCol; else @@ -322,13 +322,13 @@ void Tag::parse(const TQString &p_tagStr, Document *p_write) if ( !QuantaCommon::isKnownTag(m_dtd->name, tagName) && name[0] != '/' ) { - QTag *newTag = m_write->userTagList.find(tagName); + TQTag *newTag = m_write->userTagList.tqfind(tagName); bool insertNew = !newTag; if (insertNew) { - newTag = new QTag(); + newTag = new TQTag(); newTag->setName(name); - newTag->parentDTD = m_dtd; + newTag->tqparentDTD = m_dtd; } for (int i = 0; i >attrCount(); i++) { @@ -340,7 +340,7 @@ void Tag::parse(const TQString &p_tagStr, Document *p_write) } if (insertNew) { - m_write->userTagList.replace(tagName, newTag); + m_write->userTagList.tqreplace(tagName, newTag); } } } @@ -566,7 +566,7 @@ void Tag::deleteAttribute(const TQString& attrName) void Tag::modifyAttributes(TQDict<TQString> *attrDict) { - QTag *qTag = QuantaCommon::tagFromDTD(m_dtd, name); + TQTag *qTag = QuantaCommon::tagFromDTD(m_dtd, name); TQDictIterator<TQString> it(*attrDict); TQString attribute; TQString value; @@ -574,7 +574,7 @@ void Tag::modifyAttributes(TQDict<TQString> *attrDict) { attribute = it.currentKey(); value = *(it.current()); - if (qTag && qTag->parentDTD->singleTagStyle == "xml" && attribute=="/") + if (qTag && qTag->tqparentDTD->singleTagStyle == "xml" && attribute=="/") { ++it; continue; @@ -584,7 +584,7 @@ void Tag::modifyAttributes(TQDict<TQString> *attrDict) } for (uint i = 0 ; i < attrs.count(); i++) { - if ( !attrDict->find(attrs[i].name) ) + if ( !attrDict->tqfind(attrs[i].name) ) { attrs.remove(attrs.at(i)); } @@ -593,7 +593,7 @@ void Tag::modifyAttributes(TQDict<TQString> *attrDict) TQString Tag::toString() { - QTag *qTag = QuantaCommon::tagFromDTD(m_dtd, name); + TQTag *qTag = QuantaCommon::tagFromDTD(m_dtd, name); TQValueList<TagAttr>::Iterator it; TagAttr attr; TQString attrString; @@ -622,7 +622,7 @@ TQString Tag::toString() attrString.append(QuantaCommon::tagCase(name)); tagString.prepend(attrString); - if (attrs.isEmpty() && qTag && qTag->parentDTD->singleTagStyle == "xml" && + if (attrs.isEmpty() && qTag && qTag->tqparentDTD->singleTagStyle == "xml" && (qTag->isSingle() || (!qConfig.closeOptionalTags && qTag->isOptional()) || single) ) @@ -660,10 +660,10 @@ bool Tag::isInsideScript(const TQString &str) //This detects if the last char from str is inside a script area or not, to //treat cases like <a href="<? echo "foo" ?>"> correctly //TODO: speed up if you can... - if (str.find(m_dtd->specialAreaStartRx) != -1) + if (str.tqfind(m_dtd->specialAreaStartRx) != -1) { TQString foundString = m_dtd->specialAreaStartRx.cap(); - if (str.find(m_dtd->specialAreas[foundString]) == -1) + if (str.tqfind(m_dtd->specialAreas[foundString]) == -1) { return true; } |