diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-25 05:28:35 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-25 05:28:35 +0000 |
commit | f008adb5a77e094eaf6abf3fc0f36958e66896a5 (patch) | |
tree | 8e9244c4d4957c36be81e15b566b4aa5ea26c982 /lib/kofficecore/KoXmlReader.cpp | |
parent | 1210f27b660efb7b37ff43ec68763e85a403471f (diff) | |
download | koffice-f008adb5a77e094eaf6abf3fc0f36958e66896a5.tar.gz koffice-f008adb5a77e094eaf6abf3fc0f36958e66896a5.zip |
TQt4 port koffice
This should enable compilation under both Qt3 and Qt4; fixes for any missed components will be forthcoming
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/koffice@1238284 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'lib/kofficecore/KoXmlReader.cpp')
-rw-r--r-- | lib/kofficecore/KoXmlReader.cpp | 424 |
1 files changed, 212 insertions, 212 deletions
diff --git a/lib/kofficecore/KoXmlReader.cpp b/lib/kofficecore/KoXmlReader.cpp index ae1e2ae6..323d0ad6 100644 --- a/lib/kofficecore/KoXmlReader.cpp +++ b/lib/kofficecore/KoXmlReader.cpp @@ -32,25 +32,25 @@ memory read/write and any type of leak occurs. If you are not familiar with Valgrind then RTFM first and come back again later on. - * The public API shall remain as compatible as QDom. + * The public API shall remain as compatible as TQDom. - * All QDom-compatible methods should behave the same. All QDom-compatible + * All TQDom-compatible methods should behave the same. All TQDom-compatible functions should return the same result. In case of doubt, run - koxmlreadertest.cpp but uncomment KOXML_USE_QDOM in koxmlreader.h - so that the tests are performed with standard QDom. + koxmlreadertest.cpp but uncomment KOXML_USE_TQDOM in koxmlreader.h + so that the tests are performed with standard TQDom. - Some differences compared to QDom: + Some differences compared to TQDom: - DOM tree in KoXmlDocument is read-only, you can not modify it. This is sufficient for KOffice since the tree is only accessed when loading a document to the application. For saving the document to XML file, use KoXmlWriter. - - Comment node (like QDomComment) is not implemented as comments are + - Comment node (like TQDomComment) is not implemented as comments are simply ignored. - DTD, entity and entity reference are not handled. Thus, the associated - nodes (like QDomDocumentType, QDomEntity, QDomEntityReference) are also + nodes (like TQDomDocumentType, TQDomEntity, TQDomEntityReference) are also not implemented. - Attribute mapping node is not implemented. But of course, functions to @@ -61,46 +61,46 @@ #include "KoXmlReader.h" -#ifndef KOXML_USE_QDOM +#ifndef KOXML_USE_TQDOM -#include <qxml.h> -#include <qdom.h> +#include <tqxml.h> +#include <tqdom.h> -#include <qmap.h> -#include <qcstring.h> +#include <tqmap.h> +#include <tqcstring.h> -// double QString, used for hashing against namespace and qualified name pair -class DQString +// double TQString, used for hashing against namespace and qualified name pair +class DTQString { public: - DQString() { } - DQString( const QString& s1, const QString& s2 ){ str1 = s1; str2 = s2; } - DQString( const DQString& b ) { str1 = b.str1; str2 = b.str2; } - DQString& operator=( const DQString& b ){ str1 = b.str1; str2 = b.str2; return *this; } - bool operator==( const DQString& b ) const { return (str1==b.str1) && (str2==b.str2); } - bool operator!=( const DQString& b ) const { return (str1!=b.str1) || (str2!=b.str2); } - bool operator<( const DQString& b ) const + DTQString() { } + DTQString( const TQString& s1, const TQString& s2 ){ str1 = s1; str2 = s2; } + DTQString( const DTQString& b ) { str1 = b.str1; str2 = b.str2; } + DTQString& operator=( const DTQString& b ){ str1 = b.str1; str2 = b.str2; return *this; } + bool operator==( const DTQString& b ) const { return (str1==b.str1) && (str2==b.str2); } + bool operator!=( const DTQString& b ) const { return (str1!=b.str1) || (str2!=b.str2); } + bool operator<( const DTQString& b ) const { return ( str1 < b.str1 ) ? true : ( str1==b.str1 ) ? str2<b.str2 : false; } - QString s1() const { return str1; } - QString s2() const { return str2; } + TQString s1() const { return str1; } + TQString s2() const { return str2; } private: - QString str1, str2; + TQString str1, str2; }; -// just for completeness, this is the self-test for DQString above +// just for completeness, this is the self-test for DTQString above #if 0 - DQString b1; - DQString b2; + DTQString b1; + DTQString b2; CHECK( b1==b2, true ); CHECK( b1!=b2, false ); - b1 = DQString( "sweet","princess" ); - b2 = DQString( "sweet","princess" ); + b1 = DTQString( "sweet","princess" ); + b2 = DTQString( "sweet","princess" ); CHECK( b1==b2, true ); CHECK( b1!=b2, false ); - b1 = DQString( "sweet","princess" ); - b2 = DQString( "bad","prince" ); + b1 = DTQString( "sweet","princess" ); + b2 = DTQString( "bad","prince" ); CHECK( b1==b2, false ); CHECK( b1!=b2, true ); #endif @@ -109,20 +109,20 @@ class KoXmlStream { public: KoXmlStream(){ saveData = true; data.reserve(1024); pos = 0; } - QString stringData() const { return data; } + TQString stringData() const { return data; } void setSaveData( bool s ){ saveData = s; } int at() const { return pos; } - KoXmlStream& operator<<( const QString& str ) + KoXmlStream& operator<<( const TQString& str ) { if(saveData) data.append(str); pos+=str.length(); return *this; } - KoXmlStream& appendEscape( const QString& str ); + KoXmlStream& appendEscape( const TQString& str ); private: bool saveData; - QString data; + TQString data; int pos; }; -KoXmlStream& KoXmlStream::appendEscape( const QString& str ) +KoXmlStream& KoXmlStream::appendEscape( const TQString& str ) { unsigned len = str.length(); @@ -158,10 +158,10 @@ public: // generic properties KoXmlNode::NodeType nodeType; - QString tagName; - QString namespaceURI; - QString prefix; - QString localName; + TQString tagName; + TQString namespaceURI; + TQString prefix; + TQString localName; // reference counting unsigned long count; @@ -170,16 +170,16 @@ public: // type information virtual const char* typeInfo() const { return "Node"; } - QString nodeName() const; + TQString nodeName() const; // for tree and linked-list - KoXmlNodeData* parent; + KoXmlNodeData* tqparent; KoXmlNodeData* prev; KoXmlNodeData* next; KoXmlNodeData* first; KoXmlNodeData* last; - QString text(); + TQString text(); // node manipulation void appendChild( KoXmlNodeData* child ); @@ -187,22 +187,22 @@ public: KoXmlNodeData* ownerDocument(); // attributes - void setAttribute( const QString& name, const QString& value ); - QString attribute( const QString& name ); - bool hasAttribute( const QString& name ); - void setAttributeNS( const QString& nsURI, const QString& name, const QString& value ); - QString attributeNS( const QString& nsURI, const QString& name ); - bool hasAttributeNS( const QString& nsURI, const QString& name ); + void setAttribute( const TQString& name, const TQString& value ); + TQString attribute( const TQString& name ); + bool hasAttribute( const TQString& name ); + void setAttributeNS( const TQString& nsURI, const TQString& name, const TQString& value ); + TQString attributeNS( const TQString& nsURI, const TQString& name ); + bool hasAttributeNS( const TQString& nsURI, const TQString& name ); // for text and CDATA - QString data() const; - void setData( const QString& data ); + TQString data() const; + void setData( const TQString& data ); // for document node - QXmlSimpleReader* xmlReader; - QString buffer; - bool setContent( QXmlInputSource* source, QXmlReader* reader, - QString* errorMsg = 0, int* errorLine = 0, int* errorColumn = 0 ); + TQXmlSimpleReader* xmlReader; + TQString buffer; + bool setContent( TQXmlInputSource* source, TQXmlReader* reader, + TQString* errorMsg = 0, int* errorLine = 0, int* errorColumn = 0 ); // used when doing on-demand (re)parse bool loaded; @@ -212,13 +212,13 @@ public: bool fastLoading; private: - QMap<QString,QString> attr; - QMap<DQString,QString> attrNS; - QString textData; + TQMap<TQString,TQString> attr; + TQMap<DTQString,TQString> attrNS; + TQString textData; friend class KoXmlHandler; }; -class KoXmlHandler : public QXmlDefaultHandler +class KoXmlHandler : public TQXmlDefaultHandler { public: KoXmlHandler( KoXmlNodeData*, bool processNamespace ); @@ -231,38 +231,38 @@ public: bool startDocument(); bool endDocument(); - bool startElement( const QString& nsURI, const QString& localName, - const QString& qName, const QXmlAttributes& atts ); - bool endElement( const QString& nsURI, const QString& localName, - const QString& qName ); + bool startElement( const TQString& nsURI, const TQString& localName, + const TQString& qName, const TQXmlAttributes& atts ); + bool endElement( const TQString& nsURI, const TQString& localName, + const TQString& qName ); - bool characters( const QString& ch ); - bool processingInstruction( const QString& target, const QString& data ); - bool skippedEntity( const QString& name ); + bool characters( const TQString& ch ); + bool processingInstruction( const TQString& target, const TQString& data ); + bool skippedEntity( const TQString& name ); // lexical handler bool startCDATA(); bool endCDATA(); - bool startEntity( const QString & ); - bool endEntity( const QString & ); - bool startDTD( const QString& name, const QString& publicId, - const QString& systemId ); - bool comment( const QString& ch ); + bool startEntity( const TQString & ); + bool endEntity( const TQString & ); + bool startDTD( const TQString& name, const TQString& publicId, + const TQString& systemId ); + bool comment( const TQString& ch ); // decl handler - bool externalEntityDecl( const QString &name, const QString &publicId, - const QString &systemId ) ; + bool externalEntityDecl( const TQString &name, const TQString &publicId, + const TQString &systemId ) ; // DTD handler - bool notationDecl( const QString & name, const QString & publicId, - const QString & systemId ); - bool unparsedEntityDecl( const QString &name, const QString &publicId, - const QString &systemId, const QString ¬ationName ) ; + bool notationDecl( const TQString & name, const TQString & publicId, + const TQString & systemId ); + bool unparsedEntityDecl( const TQString &name, const TQString &publicId, + const TQString &systemId, const TQString ¬ationName ) ; // error handler - bool fatalError( const QXmlParseException& exception ); + bool fatalError( const TQXmlParseException& exception ); - QString errorMsg; + TQString errorMsg; int errorLine; int errorColumn; @@ -270,7 +270,7 @@ private: bool processNamespace; KoXmlNodeData* rootNode; KoXmlNodeData* currentNode; - QString entityName; + TQString entityName; bool cdata; int parseOffset; KoXmlStream bufferStream; @@ -288,14 +288,14 @@ KoXmlNodeData::KoXmlNodeData() { nodeType = KoXmlNode::NullNode; - tagName = QString::null; - prefix = QString::null; - localName = QString::null; - namespaceURI = QString::null; - textData = QString::null; + tagName = TQString(); + prefix = TQString(); + localName = TQString(); + namespaceURI = TQString(); + textData = TQString(); count = 1; - parent = 0; + tqparent = 0; prev = next = 0; first = last = 0; @@ -305,7 +305,7 @@ KoXmlNodeData::KoXmlNodeData() fastLoading = false; // assume true, it will be set to false by XML parser when this node - // apparently has children AND the children are not loaded + // aptqparently has tqchildren AND the tqchildren are not loaded loaded = true; } @@ -325,26 +325,26 @@ void KoXmlNodeData::clear() } nodeType = KoXmlNode::NullNode; - tagName = QString::null; - prefix = QString::null; - namespaceURI = QString::null; - textData = QString::null; + tagName = TQString(); + prefix = TQString(); + namespaceURI = TQString(); + textData = TQString(); attr.clear(); attrNS.clear(); - parent = 0; + tqparent = 0; prev = next = 0; first = last = 0; delete xmlReader; xmlReader = 0; - buffer = QString::null; + buffer = TQString(); } -QString KoXmlNodeData::text() +TQString KoXmlNodeData::text() { - QString t( "" ); + TQString t( "" ); loadChildren(); @@ -367,18 +367,18 @@ QString KoXmlNodeData::text() return t; } -QString KoXmlNodeData::nodeName() const +TQString KoXmlNodeData::nodeName() const { - QString n; + TQString n; switch( nodeType ) { case KoXmlNode::ElementNode: n = tagName; if (!prefix.isEmpty()) n.prepend(":").prepend(prefix); break; - case KoXmlNode::TextNode: return QString("#text"); - case KoXmlNode::CDATASectionNode: return QString("#cdata-section"); - case KoXmlNode::DocumentNode: return QString("#document"); + case KoXmlNode::TextNode: return TQString("#text"); + case KoXmlNode::CDATASectionNode: return TQString("#cdata-section"); + case KoXmlNode::DocumentNode: return TQString("#document"); default: break; } @@ -389,15 +389,15 @@ KoXmlNodeData* KoXmlNodeData::ownerDocument() { KoXmlNodeData* owner = this; - while( owner->parent ) - owner = owner->parent; + while( owner->tqparent ) + owner = owner->tqparent; return (owner->nodeType==KoXmlNode::DocumentNode) ? owner : 0; } void KoXmlNodeData::appendChild( KoXmlNodeData* node ) { - node->parent = this; + node->tqparent = this; if( !last ) first = last = node; else @@ -409,27 +409,27 @@ void KoXmlNodeData::appendChild( KoXmlNodeData* node ) } } -void KoXmlNodeData::setAttribute( const QString& name, const QString& value ) +void KoXmlNodeData::setAttribute( const TQString& name, const TQString& value ) { attr[ name ] = value; } -QString KoXmlNodeData::attribute( const QString& name ) +TQString KoXmlNodeData::attribute( const TQString& name ) { return attr[ name ]; } -bool KoXmlNodeData::hasAttribute( const QString& name ) +bool KoXmlNodeData::hasAttribute( const TQString& name ) { - return attr.contains( name ); + return attr.tqcontains( name ); } -void KoXmlNodeData::setAttributeNS( const QString& nsURI, -const QString& name, const QString& value ) +void KoXmlNodeData::setAttributeNS( const TQString& nsURI, +const TQString& name, const TQString& value ) { - QString prefix; - QString localName = name; - int i = name.find( ':' ); + TQString prefix; + TQString localName = name; + int i = name.tqfind( ':' ); if( i != -1 ) { localName = name.mid( i + 1 ); @@ -438,34 +438,34 @@ const QString& name, const QString& value ) if( prefix.isNull() ) return; - DQString key( nsURI, localName ); + DTQString key( nsURI, localName ); attrNS[ key ] = value; } -QString KoXmlNodeData::attributeNS( const QString& nsURI, const QString& name ) +TQString KoXmlNodeData::attributeNS( const TQString& nsURI, const TQString& name ) { - DQString key( nsURI, name ); + DTQString key( nsURI, name ); return attrNS[ key ]; } -bool KoXmlNodeData::hasAttributeNS( const QString& nsURI, const QString& name ) +bool KoXmlNodeData::hasAttributeNS( const TQString& nsURI, const TQString& name ) { - DQString key( nsURI, name ); - return attrNS.contains( key ); + DTQString key( nsURI, name ); + return attrNS.tqcontains( key ); } -QString KoXmlNodeData::data() const +TQString KoXmlNodeData::data() const { return textData; } -void KoXmlNodeData::setData( const QString& d ) +void KoXmlNodeData::setData( const TQString& d ) { textData = d; } -bool KoXmlNodeData::setContent( QXmlInputSource* source, -QXmlReader* reader, QString* errorMsg, int* errorLine, int* errorColumn ) +bool KoXmlNodeData::setContent( TQXmlInputSource* source, +TQXmlReader* reader, TQString* errorMsg, int* errorLine, int* errorColumn ) { if( nodeType != KoXmlNode::DocumentNode ) return false; @@ -478,7 +478,7 @@ QXmlReader* reader, QString* errorMsg, int* errorLine, int* errorColumn ) if( !reader ) return false; // copy the reader for later on-demand loading - // FIXME this is a workaround because no copy is possible with QXmlReader + // FIXME this is a workaround because no copy is possible with TQXmlReader char* features[] = { "http://xml.org/sax/features/namespaces", @@ -486,7 +486,7 @@ QXmlReader* reader, QString* errorMsg, int* errorLine, int* errorColumn ) "http://trolltech.com/xml/features/report-whitespace-only-CharData", "http://trolltech.com/xml/features/report-start-end-entity" }; - xmlReader = new QXmlSimpleReader; + xmlReader = new TQXmlSimpleReader; for( int fi=0; fi<4; fi++ ) xmlReader->setFeature( features[fi], reader->feature( features[fi] ) ); @@ -534,8 +534,8 @@ void KoXmlNodeData::loadChildren( int depth ) !doc->xmlReader->feature( "http://xml.org/sax/features/namespace-prefixes" ); - // XML snippet for the children, including this element - QString snippet = doc->buffer.mid( startPos, endPos-startPos+1 ); + // XML snippet for the tqchildren, including this element + TQString snippet = doc->buffer.mid( startPos, endPos-startPos+1 ); // now parse all subnodes KoXmlHandler handler( this, nsProcess ); @@ -547,7 +547,7 @@ void KoXmlNodeData::loadChildren( int depth ) doc->xmlReader->setDeclHandler( &handler ); doc->xmlReader->setDTDHandler( &handler ); - QXmlInputSource source; + TQXmlInputSource source; source.setData( snippet ); if( !doc->xmlReader->parse( source ) ) { @@ -585,16 +585,16 @@ void KoXmlNodeData::unloadChildren() // ================================================================== KoXmlHandler::KoXmlHandler( KoXmlNodeData* n, bool ns ): -QXmlDefaultHandler() +TQXmlDefaultHandler() { processNamespace = ns; rootNode = n; currentNode = n; cdata = false; - entityName = QString::null; + entityName = TQString(); - errorMsg = QString::null; + errorMsg = TQString(); errorLine = 0; errorColumn = 0; @@ -614,7 +614,7 @@ bool KoXmlHandler::startDocument() // just for sanity currentNode = rootNode; cdata = false; - entityName = QString::null; + entityName = TQString(); elementDepth = -1; return true; @@ -633,8 +633,8 @@ bool KoXmlHandler::endDocument() return true; } -bool KoXmlHandler::startDTD( const QString& name, const QString& publicId, -const QString& systemId ) +bool KoXmlHandler::startDTD( const TQString& name, const TQString& publicId, +const TQString& systemId ) { Q_UNUSED( name ); Q_UNUSED( publicId ); @@ -644,8 +644,8 @@ const QString& systemId ) return true; } -bool KoXmlHandler::startElement( const QString& nsURI, const QString& localName, -const QString& name, const QXmlAttributes& atts ) +bool KoXmlHandler::startElement( const TQString& nsURI, const TQString& localName, +const TQString& name, const TQXmlAttributes& atts ) { Q_UNUSED( localName ); @@ -656,7 +656,7 @@ const QString& name, const QXmlAttributes& atts ) // we are going one level deeper elementDepth++; - QString nodePrefix, nodeLocalName, nodeTagName; + TQString nodePrefix, nodeLocalName, nodeTagName; KoXmlNodeData* element = 0; if( processNamespace ) @@ -664,8 +664,8 @@ const QString& name, const QXmlAttributes& atts ) // parse, using namespace nodeTagName = name; nodeLocalName = name; - nodePrefix = nsURI.isNull() ? QString::null : QString(""); - int i = name.find( ':' ); + nodePrefix = nsURI.isNull() ? TQString() : TQString(""); + int i = name.tqfind( ':' ); if( i != -1 ) { nodeTagName = name.mid( i + 1 ); @@ -678,7 +678,7 @@ const QString& name, const QXmlAttributes& atts ) // construct a new element element = new KoXmlNodeData; element->nodeType = KoXmlNode::ElementNode; - element->parent = currentNode; + element->tqparent = currentNode; element->namespaceURI = nsURI; element->prefix = nodePrefix; element->localName = nodeLocalName; @@ -690,12 +690,12 @@ const QString& name, const QXmlAttributes& atts ) // handle the attributes for( int c=0; c<atts.length(); c++ ) { - QString prefix; - QString qName; // with prefix - QString name; // without prefix, i.e. local name + TQString prefix; + TQString qName; // with prefix + TQString name; // without prefix, i.e. local name name = qName = atts.qName(c); - int i = qName.find( ':' ); + int i = qName.tqfind( ':' ); if( i != -1 ) prefix = qName.left( i ); if( i != -1 ) name = qName.mid( i + 1 ); element->setAttributeNS( atts.uri(c), qName, atts.value(c) ); @@ -718,9 +718,9 @@ const QString& name, const QXmlAttributes& atts ) bufferStream << "\""; for( int c=0; c<atts.length(); c++ ) { - QString prefix; - QString name = atts.qName(c); // qName contains the prefix - int i = name.find( ':' ); + TQString prefix; + TQString name = atts.qName(c); // qName contains the prefix + int i = name.tqfind( ':' ); if( i != -1 ) prefix = name.left( i ); if( i != -1 ) name = atts.qName(c).mid( i + 1 ); if( !atts.uri(c).isEmpty() ) @@ -744,10 +744,10 @@ const QString& name, const QXmlAttributes& atts ) // construct a new element element = new KoXmlNodeData; element->nodeType = KoXmlNode::ElementNode; - element->parent = currentNode; - element->namespaceURI = QString::null; - element->prefix = QString::null; - element->localName = QString::null; + element->tqparent = currentNode; + element->namespaceURI = TQString(); + element->prefix = TQString(); + element->localName = TQString(); element->tagName = nodeTagName; if( rootNode->nodeType == KoXmlNode::DocumentNode ) @@ -802,15 +802,15 @@ const QString& name, const QXmlAttributes& atts ) return true; } -bool KoXmlHandler::endElement( const QString& nsURI, const QString& localName, -const QString& qName ) +bool KoXmlHandler::endElement( const TQString& nsURI, const TQString& localName, +const TQString& qName ) { Q_UNUSED( nsURI ); Q_UNUSED( localName ); // sanity check if( !currentNode ) return false; - if( !currentNode->parent ) return false; + if( !currentNode->tqparent ) return false; // see comments in startElement about first element and on-demand loading if( rootNode->nodeType == KoXmlNode::DocumentNode ) @@ -826,7 +826,7 @@ const QString& qName ) // go up one level if( elementDepth <= maxDepth ) - currentNode = currentNode->parent; + currentNode = currentNode->tqparent; // we are going up one level elementDepth--; @@ -834,7 +834,7 @@ const QString& qName ) return true; } -bool KoXmlHandler::characters( const QString& str ) +bool KoXmlHandler::characters( const TQString& str ) { // sanity check if( rootNode->nodeType == KoXmlNode::DocumentNode ) @@ -856,7 +856,7 @@ bool KoXmlHandler::characters( const QString& str ) { KoXmlNodeData* cdata = new KoXmlNodeData; cdata->nodeType = KoXmlNode::CDATASectionNode; - cdata->parent = currentNode; + cdata->tqparent = currentNode; cdata->setData( str ); currentNode->appendChild( cdata ); } @@ -871,7 +871,7 @@ bool KoXmlHandler::characters( const QString& str ) { KoXmlNodeData* text = new KoXmlNodeData; text->nodeType = KoXmlNode::TextNode; - text->parent = currentNode; + text->tqparent = currentNode; text->setData( str ); currentNode->appendChild( text ); } @@ -884,8 +884,8 @@ bool KoXmlHandler::characters( const QString& str ) return true; } -bool KoXmlHandler::processingInstruction( const QString& target, -const QString& data ) +bool KoXmlHandler::processingInstruction( const TQString& target, +const TQString& data ) { // sanity check if( !currentNode ) @@ -893,7 +893,7 @@ const QString& data ) KoXmlNodeData* instruction = new KoXmlNodeData; instruction->nodeType = KoXmlNode::ProcessingInstructionNode; - instruction->parent = currentNode; + instruction->tqparent = currentNode; instruction->tagName = target; instruction->setData( data ); @@ -902,7 +902,7 @@ const QString& data ) return true; } -bool KoXmlHandler::skippedEntity( const QString& name ) +bool KoXmlHandler::skippedEntity( const TQString& name ) { Q_UNUSED( name ); @@ -922,20 +922,20 @@ bool KoXmlHandler::endCDATA() return true; } -bool KoXmlHandler::startEntity( const QString& name ) +bool KoXmlHandler::startEntity( const TQString& name ) { entityName = name; return true; } -bool KoXmlHandler::endEntity( const QString& name ) +bool KoXmlHandler::endEntity( const TQString& name ) { Q_UNUSED( name ); - entityName = QString::null; + entityName = TQString(); return true; } -bool KoXmlHandler::comment( const QString& comment ) +bool KoXmlHandler::comment( const TQString& comment ) { Q_UNUSED( comment ); @@ -943,8 +943,8 @@ bool KoXmlHandler::comment( const QString& comment ) return true; } -bool KoXmlHandler::unparsedEntityDecl( const QString &name, -const QString &publicId, const QString &systemId, const QString ¬ationName ) +bool KoXmlHandler::unparsedEntityDecl( const TQString &name, +const TQString &publicId, const TQString &systemId, const TQString ¬ationName ) { Q_UNUSED( name ); Q_UNUSED( publicId ); @@ -955,8 +955,8 @@ const QString &publicId, const QString &systemId, const QString ¬ationName ) return true; } -bool KoXmlHandler::externalEntityDecl( const QString &name, -const QString &publicId, const QString &systemId ) +bool KoXmlHandler::externalEntityDecl( const TQString &name, +const TQString &publicId, const TQString &systemId ) { Q_UNUSED( name ); Q_UNUSED( publicId ); @@ -966,8 +966,8 @@ const QString &publicId, const QString &systemId ) return true; } -bool KoXmlHandler::notationDecl( const QString & name, -const QString & publicId, const QString & systemId ) +bool KoXmlHandler::notationDecl( const TQString & name, +const TQString & publicId, const TQString & systemId ) { Q_UNUSED( name ); Q_UNUSED( publicId ); @@ -977,12 +977,12 @@ const QString & publicId, const QString & systemId ) return true; } -bool KoXmlHandler::fatalError( const QXmlParseException& exception ) +bool KoXmlHandler::fatalError( const TQXmlParseException& exception ) { errorMsg = exception.message(); errorLine = exception.lineNumber(); errorColumn = exception.columnNumber(); - return QXmlDefaultHandler::fatalError( exception ); + return TQXmlDefaultHandler::fatalError( exception ); } // ================================================================== @@ -1078,38 +1078,38 @@ void KoXmlNode::clear() d = new KoXmlNodeData; } -QString KoXmlNode::nodeName() const +TQString KoXmlNode::nodeName() const { return d->nodeName(); } -QString KoXmlNode::prefix() const +TQString KoXmlNode::prefix() const { - return isElement() ? d->prefix : QString::null; + return isElement() ? d->prefix : TQString(); } -QString KoXmlNode::namespaceURI() const +TQString KoXmlNode::namespaceURI() const { - return isElement() ? d->namespaceURI : QString::null; + return isElement() ? d->namespaceURI : TQString(); } -QString KoXmlNode::localName() const +TQString KoXmlNode::localName() const { - return isElement() ? d->localName : QString::null; + return isElement() ? d->localName : TQString(); } KoXmlDocument KoXmlNode::ownerDocument() const { KoXmlNodeData* node = d; - while( node->parent ) node = node->parent; + while( node->tqparent ) node = node->tqparent; if( node->nodeType != DocumentNode ) return KoXmlDocument(); return KoXmlDocument( node ); } -KoXmlNode KoXmlNode::parentNode() const +KoXmlNode KoXmlNode::tqparentNode() const { - return d->parent ? KoXmlNode( d->parent ) : KoXmlNode(); + return d->tqparent ? KoXmlNode( d->tqparent ) : KoXmlNode(); } bool KoXmlNode::hasChildNodes() const @@ -1142,7 +1142,7 @@ KoXmlNode KoXmlNode::previousSibling() const return d->prev ? KoXmlNode( d->prev ) : KoXmlNode(); } -KoXmlNode KoXmlNode::namedItem( const QString& name ) const +KoXmlNode KoXmlNode::namedItem( const TQString& name ) const { if( !d->fastLoading ) d->loadChildren(); @@ -1159,7 +1159,7 @@ KoXmlNode KoXmlNode::namedItem( const QString& name ) const return KoXmlNode(); } -KoXmlNode KoXmlNode::namedItemNS( const QString& nsURI, const QString& name ) const +KoXmlNode KoXmlNode::namedItemNS( const TQString& nsURI, const TQString& name ) const { if( !d->fastLoading ) d->loadChildren(); @@ -1263,12 +1263,12 @@ bool KoXmlElement::operator!= ( const KoXmlElement& element ) const return (d!=element.d); } -QString KoXmlElement::tagName() const +TQString KoXmlElement::tagName() const { - return isElement() ? ((KoXmlNodeData*)d)->tagName: QString::null; + return isElement() ? ((KoXmlNodeData*)d)->tagName: TQString(); } -QString KoXmlElement::text() const +TQString KoXmlElement::text() const { return d->text(); } @@ -1278,13 +1278,13 @@ bool KoXmlElement::isElement() const return true; } -QString KoXmlElement::attribute( const QString& name ) const +TQString KoXmlElement::attribute( const TQString& name ) const { - return attribute( name, QString::null ); + return attribute( name, TQString() ); } -QString KoXmlElement::attribute( const QString& name, -const QString& defaultValue ) const +TQString KoXmlElement::attribute( const TQString& name, +const TQString& defaultValue ) const { if( !isElement() ) return defaultValue; @@ -1295,8 +1295,8 @@ const QString& defaultValue ) const return ((KoXmlNodeData*)d)->attribute( name ); } -QString KoXmlElement::attributeNS( const QString& namespaceURI, -const QString& localName, const QString& defaultValue ) const +TQString KoXmlElement::attributeNS( const TQString& namespaceURI, +const TQString& localName, const TQString& defaultValue ) const { if( !isElement() ) return defaultValue; @@ -1307,13 +1307,13 @@ const QString& localName, const QString& defaultValue ) const return ((KoXmlNodeData*)d)->attributeNS( namespaceURI,localName ); } -bool KoXmlElement::hasAttribute( const QString& name ) const +bool KoXmlElement::hasAttribute( const TQString& name ) const { return isElement() ? ((KoXmlNodeData*)d)->hasAttribute( name ) : false; } -bool KoXmlElement::hasAttributeNS( const QString& namespaceURI, -const QString& localName ) const +bool KoXmlElement::hasAttributeNS( const TQString& namespaceURI, +const TQString& localName ) const { return isElement() ? ((KoXmlNodeData*)d)->hasAttributeNS( namespaceURI, localName ) : false;; @@ -1357,7 +1357,7 @@ bool KoXmlText::isText() const return true; } -QString KoXmlText::data() const +TQString KoXmlText::data() const { return ((KoXmlNodeData*)d)->data(); } @@ -1492,8 +1492,8 @@ bool KoXmlDocument::fastLoading() const return d->fastLoading; } -bool KoXmlDocument::setContent( QXmlInputSource *source, QXmlReader *reader, - QString* errorMsg, int* errorLine, int* errorColumn ) +bool KoXmlDocument::setContent( TQXmlInputSource *source, TQXmlReader *reader, + TQString* errorMsg, int* errorLine, int* errorColumn ) { if( d->nodeType != KoXmlNode::DocumentNode ) return false; @@ -1502,27 +1502,27 @@ bool KoXmlDocument::setContent( QXmlInputSource *source, QXmlReader *reader, } // no namespace processing -bool KoXmlDocument::setContent( QIODevice* device, QString* errorMsg, +bool KoXmlDocument::setContent( TQIODevice* device, TQString* errorMsg, int* errorLine, int* errorColumn ) { return setContent( device, false, errorMsg, errorLine, errorColumn ); } -bool KoXmlDocument::setContent( QIODevice* device, bool namespaceProcessing, -QString* errorMsg, int* errorLine, int* errorColumn ) +bool KoXmlDocument::setContent( TQIODevice* device, bool namespaceProcessing, +TQString* errorMsg, int* errorLine, int* errorColumn ) { if( d->nodeType != KoXmlNode::DocumentNode ) return false; - QXmlSimpleReader reader; + TQXmlSimpleReader reader; reader.setFeature( "http://xml.org/sax/features/namespaces", namespaceProcessing ); reader.setFeature( "http://xml.org/sax/features/namespace-prefixes", !namespaceProcessing ); reader.setFeature( "http://trolltech.com/xml/features/report-whitespace-only-CharData", false ); - // FIXME this hack is apparently private + // FIXME this hack is aptqparently private //reader.setUndefEntityInAttrHack(true); - QXmlInputSource source( device ); + TQXmlInputSource source( device ); return d->setContent( &source, &reader, errorMsg, errorLine, errorColumn ); } @@ -1531,8 +1531,8 @@ QString* errorMsg, int* errorLine, int* errorColumn ) KoXmlElement KoXml::namedItemNS( const KoXmlNode& node, const char* nsURI, const char* localName ) { -#ifdef KOXML_USE_QDOM - // David's solution for namedItemNS, only for QDom stuff +#ifdef KOXML_USE_TQDOM + // David's solution for namedItemNS, only for TQDom stuff KoXmlNode n = node.firstChild(); for ( ; !n.isNull(); n = n.nextSibling() ) { if ( n.isElement() && n.localName() == localName && @@ -1547,8 +1547,8 @@ const char* localName ) void KoXml::load( KoXmlNode& node, int depth ) { -#ifdef KOXML_USE_QDOM - // do nothing, QDom has no on-demand loading +#ifdef KOXML_USE_TQDOM + // do nothing, TQDom has no on-demand loading Q_UNUSED( node ); Q_UNUSED( depth ); #else @@ -1559,8 +1559,8 @@ void KoXml::load( KoXmlNode& node, int depth ) void KoXml::unload( KoXmlNode& node ) { -#ifdef KOXML_USE_QDOM - // do nothing, QDom has no on-demand unloading +#ifdef KOXML_USE_TQDOM + // do nothing, TQDom has no on-demand unloading Q_UNUSED( node ); #else node.unload(); |