diff options
Diffstat (limited to 'lib/store/KoXmlWriter.cpp')
-rw-r--r-- | lib/store/KoXmlWriter.cpp | 96 |
1 files changed, 48 insertions, 48 deletions
diff --git a/lib/store/KoXmlWriter.cpp b/lib/store/KoXmlWriter.cpp index 2670e304..6b2bf039 100644 --- a/lib/store/KoXmlWriter.cpp +++ b/lib/store/KoXmlWriter.cpp @@ -21,12 +21,12 @@ #include <kglobal.h> // kMin #include <kdebug.h> -#include <qiodevice.h> +#include <tqiodevice.h> #include <float.h> static const int s_indentBufferLength = 100; -KoXmlWriter::KoXmlWriter( QIODevice* dev, int indentLevel ) +KoXmlWriter::KoXmlWriter( TQIODevice* dev, int indentLevel ) : m_dev( dev ), m_baseIndentLevel( indentLevel ) { init(); @@ -67,36 +67,36 @@ void KoXmlWriter::startDocument( const char* rootElemName, const char* publicId, void KoXmlWriter::endDocument() { - // just to do exactly like QDom does (newline at end of file). + // just to do exactly like TQDom does (newline at end of file). writeChar( '\n' ); Q_ASSERT( m_tags.isEmpty() ); } -// returns the value of indentInside of the parent +// returns the value of indentInside of the tqparent bool KoXmlWriter::prepareForChild() { if ( !m_tags.isEmpty() ) { - Tag& parent = m_tags.top(); - if ( !parent.hasChildren ) { - closeStartElement( parent ); - parent.hasChildren = true; - parent.lastChildIsText = false; + Tag& tqparent = m_tags.top(); + if ( !tqparent.hasChildren ) { + closeStartElement( tqparent ); + tqparent.hasChildren = true; + tqparent.lastChildIsText = false; } - if ( parent.indentInside ) { + if ( tqparent.indentInside ) { writeIndent(); } - return parent.indentInside; + return tqparent.indentInside; } return true; } void KoXmlWriter::prepareForTextNode() { - Tag& parent = m_tags.top(); - if ( !parent.hasChildren ) { - closeStartElement( parent ); - parent.hasChildren = true; - parent.lastChildIsText = true; + Tag& tqparent = m_tags.top(); + if ( !tqparent.hasChildren ) { + closeStartElement( tqparent ); + tqparent.hasChildren = true; + tqparent.lastChildIsText = true; } } @@ -104,10 +104,10 @@ void KoXmlWriter::startElement( const char* tagName, bool indentInside ) { Q_ASSERT( tagName != 0 ); - // Tell parent that it has children - bool parentIndent = prepareForChild(); + // Tell tqparent that it has tqchildren + bool tqparentIndent = prepareForChild(); - m_tags.push( Tag( tagName, parentIndent && indentInside ) ); + m_tags.push( Tag( tagName, tqparentIndent && indentInside ) ); writeChar( '<' ); writeCString( tagName ); //kdDebug() << k_funcinfo << tagName << endl; @@ -120,7 +120,7 @@ void KoXmlWriter::addCompleteElement( const char* cstr ) } -void KoXmlWriter::addCompleteElement( QIODevice* indev ) +void KoXmlWriter::addCompleteElement( TQIODevice* indev ) { prepareForChild(); bool openOk = indev->open( IO_ReadOnly ); @@ -128,9 +128,9 @@ void KoXmlWriter::addCompleteElement( QIODevice* indev ) if ( !openOk ) return; static const int MAX_CHUNK_SIZE = 8*1024; // 8 KB - QByteArray buffer(MAX_CHUNK_SIZE); + TQByteArray buffer(MAX_CHUNK_SIZE); while ( !indev->atEnd() ) { - Q_LONG len = indev->readBlock( buffer.data(), buffer.size() ); + TQ_LONG len = indev->readBlock( buffer.data(), buffer.size() ); if ( len <= 0 ) // e.g. on error break; m_dev->writeBlock( buffer.data(), len ); @@ -191,14 +191,14 @@ void KoXmlWriter::addAttribute( const char* attrName, const char* value ) void KoXmlWriter::addAttribute( const char* attrName, double value ) { - QCString str; + TQCString str; str.setNum( value, 'g', DBL_DIG ); addAttribute( attrName, str.data() ); } void KoXmlWriter::addAttributePt( const char* attrName, double value ) { - QCString str; + TQCString str; str.setNum( value, 'g', DBL_DIG ); str += "pt"; addAttribute( attrName, str.data() ); @@ -211,10 +211,10 @@ void KoXmlWriter::writeIndent() s_indentBufferLength ) ); } -void KoXmlWriter::writeString( const QString& str ) +void KoXmlWriter::writeString( const TQString& str ) { // cachegrind says .utf8() is where most of the time is spent - QCString cstr = str.utf8(); + TQCString cstr = str.utf8(); m_dev->writeBlock( cstr.data(), cstr.size() - 1 ); } @@ -235,7 +235,7 @@ char* KoXmlWriter::escapeForXML( const char* source, int length = -1 ) const // we drop the idea of using it, and we allocate a bigger buffer. // Note that this if() can only be hit once per call to the method. if ( length == -1 ) - length = qstrlen( source ); // expensive... + length = tqstrlen( source ); // expensive... uint newLength = length * 6 + 1; // worst case. 6 is due to " and ' char* buffer = new char[ newLength ]; destBoundary = buffer + newLength; @@ -280,7 +280,7 @@ char* KoXmlWriter::escapeForXML( const char* source, int length = -1 ) const return output; } -void KoXmlWriter::addManifestEntry( const QString& fullPath, const QString& mediaType ) +void KoXmlWriter::addManifestEntry( const TQString& fullPath, const TQString& mediaType ) { startElement( "manifest:file-entry" ); addAttribute( "manifest:media-type", mediaType ); @@ -288,7 +288,7 @@ void KoXmlWriter::addManifestEntry( const QString& fullPath, const QString& medi endElement(); } -void KoXmlWriter::addConfigItem( const QString & configName, const QString& value ) +void KoXmlWriter::addConfigItem( const TQString & configName, const TQString& value ) { startElement( "config:config-item" ); addAttribute( "config:name", configName ); @@ -297,7 +297,7 @@ void KoXmlWriter::addConfigItem( const QString & configName, const QString& valu endElement(); } -void KoXmlWriter::addConfigItem( const QString & configName, bool value ) +void KoXmlWriter::addConfigItem( const TQString & configName, bool value ) { startElement( "config:config-item" ); addAttribute( "config:name", configName ); @@ -306,61 +306,61 @@ void KoXmlWriter::addConfigItem( const QString & configName, bool value ) endElement(); } -void KoXmlWriter::addConfigItem( const QString & configName, int value ) +void KoXmlWriter::addConfigItem( const TQString & configName, int value ) { startElement( "config:config-item" ); addAttribute( "config:name", configName ); addAttribute( "config:type", "int"); - addTextNode(QString::number( value ) ); + addTextNode(TQString::number( value ) ); endElement(); } -void KoXmlWriter::addConfigItem( const QString & configName, double value ) +void KoXmlWriter::addConfigItem( const TQString & configName, double value ) { startElement( "config:config-item" ); addAttribute( "config:name", configName ); addAttribute( "config:type", "double" ); - addTextNode( QString::number( value ) ); + addTextNode( TQString::number( value ) ); endElement(); } -void KoXmlWriter::addConfigItem( const QString & configName, long value ) +void KoXmlWriter::addConfigItem( const TQString & configName, long value ) { startElement( "config:config-item" ); addAttribute( "config:name", configName ); addAttribute( "config:type", "long" ); - addTextNode( QString::number( value ) ); + addTextNode( TQString::number( value ) ); endElement(); } -void KoXmlWriter::addConfigItem( const QString & configName, short value ) +void KoXmlWriter::addConfigItem( const TQString & configName, short value ) { startElement( "config:config-item" ); addAttribute( "config:name", configName ); addAttribute( "config:type", "short" ); - addTextNode( QString::number( value ) ); + addTextNode( TQString::number( value ) ); endElement(); } -void KoXmlWriter::addTextSpan( const QString& text ) +void KoXmlWriter::addTextSpan( const TQString& text ) { - QMap<int, int> tabCache; + TQMap<int, int> tabCache; addTextSpan( text, tabCache ); } -void KoXmlWriter::addTextSpan( const QString& text, const QMap<int, int>& tabCache ) +void KoXmlWriter::addTextSpan( const TQString& text, const TQMap<int, int>& tabCache ) { uint len = text.length(); int nrSpaces = 0; // number of consecutive spaces bool leadingSpace = false; - QString str; + TQString str; str.reserve( len ); // Accumulate chars either in str or in nrSpaces (for spaces). // Flush str when writing a subelement (for spaces or for another reason) // Flush nrSpaces when encountering two or more consecutive spaces for ( uint i = 0; i < len ; ++i ) { - QChar ch = text[i]; + TQChar ch = text[i]; if ( ch != ' ' ) { if ( nrSpaces > 0 ) { // For the first space we use ' '. @@ -377,7 +377,7 @@ void KoXmlWriter::addTextSpan( const QString& text, const QMap<int, int>& tabCac if ( nrSpaces > 0 ) { // there are more spaces if ( !str.isEmpty() ) addTextNode( str ); - str = QString::null; + str = TQString(); startElement( "text:s" ); if ( nrSpaces > 1 ) // it's 1 by default addAttribute( "text:c", nrSpaces ); @@ -387,20 +387,20 @@ void KoXmlWriter::addTextSpan( const QString& text, const QMap<int, int>& tabCac nrSpaces = 0; leadingSpace = false; } - switch ( ch.unicode() ) { + switch ( ch.tqunicode() ) { case '\t': if ( !str.isEmpty() ) addTextNode( str ); - str = QString::null; + str = TQString(); startElement( "text:tab" ); - if ( tabCache.contains( i ) ) + if ( tabCache.tqcontains( i ) ) addAttribute( "text:tab-ref", tabCache[i] + 1 ); endElement(); break; case '\n': if ( !str.isEmpty() ) addTextNode( str ); - str = QString::null; + str = TQString(); startElement( "text:line-break" ); endElement(); break; |