summaryrefslogtreecommitdiffstats
path: root/quanta/parsers/dtd/dtd.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'quanta/parsers/dtd/dtd.cpp')
-rw-r--r--quanta/parsers/dtd/dtd.cpp128
1 files changed, 64 insertions, 64 deletions
diff --git a/quanta/parsers/dtd/dtd.cpp b/quanta/parsers/dtd/dtd.cpp
index 18e3d712..964c35fb 100644
--- a/quanta/parsers/dtd/dtd.cpp
+++ b/quanta/parsers/dtd/dtd.cpp
@@ -16,11 +16,11 @@
***************************************************************************/
-#include <qfile.h>
-#include <qfileinfo.h>
-#include <qregexp.h>
-#include <qstringlist.h>
-#include <qdom.h>
+#include <tqfile.h>
+#include <tqfileinfo.h>
+#include <tqregexp.h>
+#include <tqstringlist.h>
+#include <tqdom.h>
#include <klocale.h>
#include <kurl.h>
@@ -34,42 +34,42 @@
#include "../qextfileinfo.h"
-DTD::DTD(const KURL &dtdURL, const QString &dtepDir)
+DTD::DTD(const KURL &dtdURL, const TQString &dtepDir)
{
m_dtdURL = dtdURL;
- m_dtepDir = dtepDir + "/"+QFileInfo(dtdURL.fileName()).baseName(); //TODO: get the dir name from the DTD or from the user
+ m_dtepDir = dtepDir + "/"+TQFileInfo(dtdURL.fileName()).baseName(); //TODO: get the dir name from the DTD or from the user
}
DTD::~DTD()
{
}
-QStringList DTD::getTags()
+TQStringList DTD::getTags()
{
return tags;
}
-AttributeList* DTD::getTagAttributes(QString tag)
+AttributeList* DTD::getTagAttributes(TQString tag)
{
return tagAttributes.find(tag);
}
-QStringList DTD::getTextCompletion(QString tag)
+TQStringList DTD::getTextCompletion(TQString tag)
{
- return QStringList();
+ return TQStringList();
}
void DTD::printContents()
{
- for ( QStringList::Iterator tagIt = tags.begin(); tagIt != tags.end(); ++tagIt ) {
- QString tag = *tagIt;
+ for ( TQStringList::Iterator tagIt = tags.begin(); tagIt != tags.end(); ++tagIt ) {
+ TQString tag = *tagIt;
kdDebug(24000) << tag << endl;
AttributeList *attributes = getTagAttributes(tag);
for ( uint i = 0; i < attributes->count(); i++)
{
Attribute *attribute = attributes->at(i);
- QString s = " " + attribute->name + ": ";
+ TQString s = " " + attribute->name + ": ";
for (uint j = 0; j < attribute->values.count(); j++)
{
s += attribute->values[j] + ", ";
@@ -81,7 +81,7 @@ void DTD::printContents()
void DTD::writeTagFiles()
{
- QString dirName = m_dtepDir;
+ TQString dirName = m_dtepDir;
KURL u;
u.setPath(dirName);
if (!QExtFileInfo::createDir(dirName)) {
@@ -89,13 +89,13 @@ void DTD::writeTagFiles()
return;
}
dirName.append("/");
- for ( QStringList::Iterator tagIt = tags.begin(); tagIt != tags.end(); ++tagIt ) {
- QString tag = *tagIt;
+ for ( TQStringList::Iterator tagIt = tags.begin(); tagIt != tags.end(); ++tagIt ) {
+ TQString tag = *tagIt;
- QFile file( dirName + tag.lower() + ".tag" );
+ TQFile file( dirName + tag.lower() + ".tag" );
if ( file.open( IO_WriteOnly ) ) {
- QTextStream stream( &file );
- stream.setEncoding(QTextStream::UnicodeUTF8);
+ TQTextStream stream( &file );
+ stream.setEncoding(TQTextStream::UnicodeUTF8);
stream << "<!DOCTYPE TAGS>" << endl
<< "<TAGS>" << endl
<< "<tag name=\"" << tag << "\">" << endl << endl;
@@ -114,31 +114,31 @@ void DTD::writeTagFiles()
KConfig config(dirName + "description.rc");
config.setGroup("General");
- config.writeEntry("Name", QFileInfo(m_dtdURL.fileName()).baseName()); //TODO: get from the DTD!
- config.writeEntry("NickName", QFileInfo(m_dtdURL.fileName()).baseName()); //TODO: get from the user!
+ config.writeEntry("Name", TQFileInfo(m_dtdURL.fileName()).baseName()); //TODO: get from the DTD!
+ config.writeEntry("NickName", TQFileInfo(m_dtdURL.fileName()).baseName()); //TODO: get from the user!
config.sync();
}
bool DTD::parseDTD(const KURL &url)
{
- QString fileName = QString::null;
+ TQString fileName = TQString::null;
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)));
return false;
}
- QFile file(fileName);
+ TQFile file(fileName);
if (file.open(IO_ReadOnly))
{
- QTextStream fileStream(&file);
- fileStream.setEncoding(QTextStream::UnicodeUTF8);
- QString entireDTD = fileStream.read();
+ TQTextStream fileStream(&file);
+ fileStream.setEncoding(TQTextStream::UnicodeUTF8);
+ TQString entireDTD = fileStream.read();
file.close();
removeComments(entireDTD);
- QString line;
- QStringList lines = QStringList::split("\n",entireDTD);
- QStringList::Iterator it = lines.begin();
+ TQString line;
+ TQStringList lines = TQStringList::split("\n",entireDTD);
+ TQStringList::Iterator it = lines.begin();
while (it != lines.end()) {
line = *it;
@@ -183,7 +183,7 @@ bool DTD::parseDTD(const KURL &url)
parseDTD(entityURL);
} else
{
- kdDebug(24000) << QString("Unknown tag: [%1]").arg(line) << endl;
+ kdDebug(24000) << TQString("Unknown tag: [%1]").arg(line) << endl;
}
if (it != lines.end()) ++it;
@@ -191,16 +191,16 @@ bool DTD::parseDTD(const KURL &url)
}
}
-void DTD::parseDTDEntity(QString line) {
- QString name;
- QString *value;
+void DTD::parseDTDEntity(TQString line) {
+ TQString name;
+ TQString *value;
line.replace("\\end", " ");
name = line.mid(11);
int firstSpace = name.find(' ');
name = name.remove(firstSpace, name.length()-firstSpace);
- value = new QString(line.mid(11+firstSpace));
+ value = new TQString(line.mid(11+firstSpace));
value->remove(0, value->find("\"")+1);
value->remove(value->findRev("\""), value->length());
@@ -212,17 +212,17 @@ void DTD::parseDTDEntity(QString line) {
//kdDebug() << "Entity --- Name: " << name << " --- Value: " << *value << endl;
}
-void DTD::parseDTDElement(const QString &l) {
- QString name;
- QString *value;
+void DTD::parseDTDElement(const TQString &l) {
+ TQString name;
+ TQString *value;
- QString line = l;
+ TQString line = l;
line.replace("\\end", " ");
name = line.mid(10);
int firstSpace = name.find(' ');
name.remove(firstSpace, name.length()-firstSpace);
- value = new QString(line.mid(10+firstSpace));
+ value = new TQString(line.mid(10+firstSpace));
//value->remove(0, value->find("\"")+1);
value->remove(value->find(">"), 10000);
@@ -232,8 +232,8 @@ void DTD::parseDTDElement(const QString &l) {
if ( name.startsWith("(") && name.endsWith(")") ) {
name.remove(0,1);
name.remove(name.length()-1,1);
- QStringList multipleTags = QStringList::split("|", name);
- QStringList::Iterator it = multipleTags.begin();
+ TQStringList multipleTags = TQStringList::split("|", name);
+ TQStringList::Iterator it = multipleTags.begin();
while(it != multipleTags.end()) {
name = *it;
name = name.stripWhiteSpace();
@@ -249,17 +249,17 @@ void DTD::parseDTDElement(const QString &l) {
}
}
-void DTD::parseDTDAttlist(const QString &l) {
- QString name;
- QString *value;
+void DTD::parseDTDAttlist(const TQString &l) {
+ TQString name;
+ TQString *value;
- QString line = l;
+ TQString line = l;
line.replace("\\end", " ");
name = line.mid(10);
int firstSpace = name.find(' ');
name.remove(firstSpace, name.length()-firstSpace);
- value = new QString(line.mid(10+firstSpace));
+ value = new TQString(line.mid(10+firstSpace));
//value->remove(0, value->find("\"")+1);
value->remove(value->find(">"), 10000);
@@ -269,8 +269,8 @@ void DTD::parseDTDAttlist(const QString &l) {
if ( name.startsWith("(") && name.endsWith(")") ) {
name.remove(0,1);
name.remove(name.length()-1,1);
- QStringList multipleTags = QStringList::split("|", name);
- QStringList::Iterator it = multipleTags.begin();
+ TQStringList multipleTags = TQStringList::split("|", name);
+ TQStringList::Iterator it = multipleTags.begin();
while(it != multipleTags.end()) {
name = *it;
name = name.stripWhiteSpace();
@@ -287,16 +287,16 @@ void DTD::parseDTDAttlist(const QString &l) {
}
-void DTD::parseTagAttributeValues(const QString &name, QString *value) {
+void DTD::parseTagAttributeValues(const TQString &name, TQString *value) {
AttributeList *attributes = new AttributeList();
- QStringList attrLines = QStringList::split("\\end",*value);
- QStringList::Iterator lineIt = attrLines.begin();
+ TQStringList attrLines = TQStringList::split("\\end",*value);
+ TQStringList::Iterator lineIt = attrLines.begin();
while (lineIt != attrLines.end()) //iterate through the attribute lines
{
//split the attribute line
- QStringList all = QStringList::split(" ", *lineIt);
- QStringList::Iterator it = all.begin();
+ TQStringList all = TQStringList::split(" ", *lineIt);
+ TQStringList::Iterator it = all.begin();
while(it != all.end())
{
Attribute *attr = new Attribute();
@@ -304,14 +304,14 @@ void DTD::parseTagAttributeValues(const QString &name, QString *value) {
//kdDebug() << "Inserting for tag " << name << ": " << *it << endl;
++it;
- QString values = *it;
+ TQString values = *it;
//list of possible values
if ( values.startsWith("(") && values.endsWith(")") )
{
values.remove(0,1);
values.remove(values.length()-1,1);
- attr->values = QStringList::split("|", values);
- QString s = (attr->values[0]+attr->values[1]).lower();
+ attr->values = TQStringList::split("|", values);
+ TQString s = (attr->values[0]+attr->values[1]).lower();
stripSpaces(&s);
if ((s == "truefalse") || (s == "falsetrue"))
{
@@ -330,7 +330,7 @@ void DTD::parseTagAttributeValues(const QString &name, QString *value) {
if (it != all.end())
{
++it;
- QString s=*it;
+ TQString s=*it;
if (s.startsWith("\"") && s.endsWith("\"") && it!=all.end())
{
s.remove(0,1);
@@ -360,13 +360,13 @@ void DTD::parseTagAttributeValues(const QString &name, QString *value) {
tagAttributes.insert(name, attributes);
}
-void DTD::parseDTDReplace(QString *value) {
+void DTD::parseDTDReplace(TQString *value) {
int begin, end;
begin = value->find("%");
end = value->find(";");
while (begin != -1 && end != -1) {
- QString replaceText = value->mid(begin+1, end-begin-1);
- QString *replaceValue = entities.find(replaceText);
+ TQString replaceText = value->mid(begin+1, end-begin-1);
+ TQString *replaceValue = entities.find(replaceText);
if (replaceValue != 0L) {
value->replace(begin, end-begin+1, *replaceValue);
@@ -380,7 +380,7 @@ void DTD::parseDTDReplace(QString *value) {
}
}
-void DTD::stripSpaces(QString *value) {
+void DTD::stripSpaces(TQString *value) {
int index=-1;
while ( (index=value->find(' ',++index)) != -1 ) {
if ( value->findRev('(',index) != -1 && value->find(')',index) != -1)
@@ -388,7 +388,7 @@ void DTD::stripSpaces(QString *value) {
}
}
-void DTD::removeComments(QString &value) {
+void DTD::removeComments(TQString &value) {
int begin, end;
begin = value.find("<!--");
end = value.find("-->",begin+2);
@@ -406,7 +406,7 @@ void DTD::removeComments(QString &value) {
end = value.find("--",begin+2);
}
- value.replace(QRegExp("<!>"), "");
+ value.replace(TQRegExp("<!>"), "");
}
bool DTD::parseDTD()