[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    koffice/libs/store
From:       Jarosław Staniek <staniek () kde ! org>
Date:       2009-07-03 14:05:56
Message-ID: 1246629956.055319.9752.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 990945 by staniek:

revert r989984, not-indenting of whitespace-sensitive elements is only important


 M  +5 -11     KoXmlWriter.cpp  
 M  +2 -4      KoXmlWriter.h  


--- trunk/koffice/libs/store/KoXmlWriter.cpp #990944:990945
@@ -38,9 +38,9 @@
         //TODO: look at if we must delete "dev". For me we must delete it otherwise we will leak it
     }
 
-    QIODevice* const dev;
+    QIODevice* dev;
     QStack<Tag> tags;
-    const int baseIndentLevel;
+    int baseIndentLevel;
 
     char* indentBuffer; // maybe make it static, but then it needs a K_GLOBAL_STATIC
     // and would eat 1K all the time... Maybe refcount it :)
@@ -55,11 +55,9 @@
 
 void KoXmlWriter::init()
 {
-    d->indentBuffer = d->baseIndentLevel > 0 ? new char[ s_indentBufferLength ] : 0;
-    if (d->indentBuffer) {
-        memset(d->indentBuffer, ' ', s_indentBufferLength);
-        *d->indentBuffer = '\n'; // write newline before indentation, in one go
-    }
+    d->indentBuffer = new char[ s_indentBufferLength ];
+    memset(d->indentBuffer, ' ', s_indentBufferLength);
+    *d->indentBuffer = '\n'; // write newline before indentation, in one go
 
     d->escapeBuffer = new char[s_escapeBufferLen];
     if (!d->dev->isOpen())
@@ -268,8 +266,6 @@
 
 void KoXmlWriter::writeIndent()
 {
-    if (d->baseIndentLevel == 0) // optimization: no indentation at all
-        return;
     // +1 because of the leading '\n'
     d->dev->write(d->indentBuffer, qMin(indentLevel() + 1,
                                         s_indentBufferLength));
@@ -505,8 +501,6 @@
 
 int KoXmlWriter::indentLevel() const
 {
-    if (d->baseIndentLevel == 0)
-        return 0;
     return d->tags.size() + d->baseIndentLevel;
 }
 
--- trunk/koffice/libs/store/KoXmlWriter.h #990944:990945
@@ -38,10 +38,8 @@
 {
 public:
     /**
-     * Create a KoXmlWriter instance to write out an XML document.
-     * @param dev target device for writing the XML document.
-     * @param indentLevel indentation level for the written document;
-     *                    if 0, no indentations nor new line characters are written.
+     * Create a KoXmlWriter instance to write out an XML document into
+     * the given QIODevice.
      */
     explicit KoXmlWriter(QIODevice* dev, int indentLevel = 0);
 
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic